From 11afca8596fb63b037abff6199c4f109d0714752 Mon Sep 17 00:00:00 2001 From: hrx <18603305412@163.com> Date: Tue, 18 Nov 2025 17:51:40 +0800 Subject: [PATCH] updata --- .../customerInformationList/index.vue | 568 ++++++++++++------ 1 file changed, 390 insertions(+), 178 deletions(-) diff --git a/f/web-kboss/src/views/sales/customerManagement/customerInformationList/index.vue b/f/web-kboss/src/views/sales/customerManagement/customerInformationList/index.vue index 4fb5dcc..512b270 100644 --- a/f/web-kboss/src/views/sales/customerManagement/customerInformationList/index.vue +++ b/f/web-kboss/src/views/sales/customerManagement/customerInformationList/index.vue @@ -1,110 +1,174 @@ @@ -159,197 +223,345 @@ export default { total: null, dataOne: null, dataTwo: null, + startPickerOpts: { + disabledDate: (time) => { + if (this.dataTwo) { + return time.getTime() > new Date(this.dataTwo).getTime(); + } + return time.getTime() > Date.now(); + } + }, endPickerOpts: { - disabledDate(time) { + disabledDate: (time) => { + if (this.dataOne) { + return time.getTime() < new Date(this.dataOne).getTime() || time.getTime() > Date.now(); + } return time.getTime() > Date.now(); } }, }; }, mounted() { - this.loading = true + this.loading = true; this.getuserList(); + + // 设置默认查询日期为最近一个月 + const end = new Date(); + const start = new Date(); + start.setMonth(start.getMonth() - 1); + this.dataOne = start; + this.dataTwo = end; }, methods: { handleCurrentChange(index) { - this.current_page = index - this.lookUp() + this.current_page = index; + this.lookUp(); }, lookBill(row) { - this.currentRow = row - this.lookBillVisible = true - this.lookUp() + this.currentRow = row; + this.lookBillVisible = true; + this.lookUp(); }, lookUp(dataOne, dataTwo) { let params = { user_orgid: this.currentRow.id, - start_time: dataOne, - end_time: dataTwo, + start_time: dataOne || this.dataOne, + end_time: dataTwo || this.dataTwo, page_size: 10, current_page: this.current_page - } + }; + userGetbillAPI(params).then(res => { - console.log(res); if (res.status) { if (res.data.total_page != 0) { - - this.billList = res.data.bill_list - this.total = res.data.total_num + this.billList = res.data.bill_list; + this.total = res.data.total_num; } else { - this.billList = [] - this.total = 0 + this.billList = []; + this.total = 0; this.$message({ message: "暂无数据", type: 'warning' - }) + }); } - } else { this.$message({ message: res.msg, type: 'error' - }) + }); } - }) + }).catch(error => { + this.$message({ + message: "请求失败,请稍后重试", + type: 'error' + }); + console.error(error); + }); }, onsubmit() { if (!this.dataOne || !this.dataTwo) { this.$message({ - message: "请选择时间", + message: "请选择完整的时间范围", type: 'warning' - }) - } else { - this.lookUp(this.dataOne, this.dataTwo) + }); + return; } + + if (this.dataOne > this.dataTwo) { + this.$message({ + message: "开始日期不能大于结束日期", + type: 'warning' + }); + return; + } + + this.current_page = 1; + this.lookUp(); }, - expandChangeHandler(row, expandedRows) {// 点击展开的时候就会触发这个方法 - var orgid = { - orgid: row.id, - }; - getZJUserInfoAPI(orgid).then((res) => { - this.tableData = res.data; - }); + expandChangeHandler(row, expandedRows) { if (expandedRows.length) { this.expands = []; if (row) { this.expands.push(row.id); + + // 只在需要时请求数据 + var orgid = { + orgid: row.id, + }; + getZJUserInfoAPI(orgid).then((res) => { + this.tableData = res.data; + }).catch(error => { + console.error("获取客户详情失败:", error); + }); } } else { this.expands = []; } }, - - getuserList() {//获取所有客户 + getuserList() { var userid = { userid: sessionStorage.getItem("userId"), - // kv: "zj", }; getZJsaleGetUsersAPI(userid).then((res) => { - this.loading = false + this.loading = false; this.userList = res.data; + }).catch(error => { + this.loading = false; + console.error("获取客户列表失败:", error); + this.$message({ + message: "获取客户列表失败", + type: 'error' + }); }); }, - - open4(str) { //错误提示 - this.$message.error(str); - }, - getBusinessOp(data) { - switch (data) { - case 'BUY': - return "购买"; - case 'RECHARGE': - return "充值"; - case 'RECHARGE_ALIPAY': - return "支付宝充值"; - case 'REFUND': - return "退款"; - } - }, getBillstate(data) { switch (data) { case 0: return { message: '未支付', - type: 'info' + type: 'warning' }; case 1: return { message: '已支付', type: 'success' - } + }; case 2: return { message: '已取消', type: 'info' - } + }; case null: return { message: '已取消', type: 'info' - } + }; default: return { message: '未知', type: 'info' - } + }; } }, - }, }; -