diff --git a/src/api/customer/index.js b/src/api/customer/index.js index 4aebd9b..a884be3 100644 --- a/src/api/customer/index.js +++ b/src/api/customer/index.js @@ -59,7 +59,8 @@ export function visitLog(params) { return request({ method: "get", url: "/api/admin/visit-log/index", - params + params, + paramsSerializer: customParamsSerializer, }) } diff --git a/src/views/customer/components/addMessage.vue b/src/views/customer/components/addMessage.vue index 8017d74..8329c13 100644 --- a/src/views/customer/components/addMessage.vue +++ b/src/views/customer/components/addMessage.vue @@ -102,7 +102,7 @@ } from "@/api/customer/message.js" import { index as getProduct - } from "@/api/product/index.js" + } from "@/api/product/category.js" import customerMixin from "@/mixin/customer.js" export default { mixins:[customerMixin], @@ -112,11 +112,14 @@ id: '', type: 'add', typeList: [{ - id: 0, - value: 'Contact Us' - }, { id: 1, + value: 'Question' + }, { + id: 2, value: 'Request Free Sample' + }, { + id: 3, + value: 'Contact Us' }], productList:[], form: { @@ -148,6 +151,8 @@ methods: { async getProductList() { const res = await getProduct({ + type:2, + // is_recommend:1, page_size: 9999, page: 1 }) @@ -195,10 +200,11 @@ product_id: '', full_name: '', email: '', - region: '', + region: '', + organization: '', question: '', additional: '', - organization: '', + product_name: '', } this.$refs['dialog'].reset() diff --git a/src/views/customer/email.vue b/src/views/customer/email.vue index d325151..a2780cd 100644 --- a/src/views/customer/email.vue +++ b/src/views/customer/email.vue @@ -9,12 +9,12 @@ -
+ diff --git a/src/views/customer/index.vue b/src/views/customer/index.vue index 09a7358..d0aa32a 100644 --- a/src/views/customer/index.vue +++ b/src/views/customer/index.vue @@ -7,7 +7,19 @@
- + +
+
+ +
+
+ +
+
+ +
search @@ -15,6 +27,9 @@
reset
+
+ export +
@@ -52,18 +67,25 @@ index, destroy } from "@/api/customer"; + import { + download + } from "@/utils/downloadRequest"; export default { components: { - showCustomer, + showCustomer, addCustomer }, data() { return { select: { name: '', + last_name: '', + email: '', page: 1, page_size: 10, }, + dateRange: [], + range: '', total: 0, list: [], table_item: [{ @@ -106,8 +128,8 @@ width: 360 }, { - prop: 'Created At', - label: 'created_at', + prop: 'created_at', + label: 'Created At', align: 'left', width: 240 } @@ -135,15 +157,85 @@ resetSearch() { this.select.page = 1 this.select.name = '' + this.select.last_name = '' + this.select.email = '' + this.range = '' + this.dateRange = '' this.getList() }, + changeDate(e) { + if (e) { + console.log("e", e) + this.range = e.join(",") + '' + } else { + this.range = '' + } + }, async getList() { const res = await index({ - ...this.select + ...this.select, + filter: [{ + key: 'first_name', + op: 'eq', + value: this.select.name + }, { + key: 'last_name', + op: 'eq', + value: this.select.last_name + }, { + key: 'email', + op: 'like', + value: this.select.email + }, { + key: 'created_at', + op: 'range', + value: this.range ? this.range : '' + }] }) this.list = res.data this.total = res.total }, + exportExcel() { + if (!this.range) { + this.$Message.warning('Select a time period to export') + return + } + let _export = {} + this.table_item.map(item => { + if (item.type === 'index') { + + } else { + _export[item.prop] = item.label + } + }) + download( + '/api/admin/user/index', + 'get', { + export_fields: _export, + ...this.select, + filter: [{ + key: 'first_name', + op: 'eq', + value: this.select.name + }, { + key: 'last_name', + op: 'eq', + value: this.select.last_name + }, { + key: 'email', + op: 'like', + value: this.select.email + }, { + key: 'created_at', + op: 'range', + value: this.range ? this.range : '' + }], + is_export: 1, + page: 1, + page_size: 999 + }, + `Customer List.xlsx`) + }, editCustomer(type, id) { if (type == 'editor') { this.$refs.addCustomer.id = id @@ -154,8 +246,8 @@ }, deleteList(id) { var that = this; - destroy({ - id:id + destroy({ + id: id }).then(response => { this.$Message.success('Success'); this.getList() diff --git a/src/views/customer/message.vue b/src/views/customer/message.vue index 7ac7a3f..7660147 100644 --- a/src/views/customer/message.vue +++ b/src/views/customer/message.vue @@ -9,6 +9,21 @@
+
+ +
+
+ + + + +
+
+ + +
search
@@ -24,13 +39,23 @@
- + +