From 9d22148b85e9178e7a9f4720405bb7b87bd34d36 Mon Sep 17 00:00:00 2001 From: donghaolin <17667510818@163.com> Date: Sat, 28 Dec 2024 17:44:53 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BF=99=E6=98=AF=E5=AF=BC=E5=87=BAexcel?= =?UTF-8?q?=E7=9A=84=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- vue/gold-system/src/views/consume/allConsume.vue | 2 +- vue/gold-system/src/views/usergold/index.vue | 173 ++++++++++++++++++----- 2 files changed, 139 insertions(+), 36 deletions(-) diff --git a/vue/gold-system/src/views/consume/allConsume.vue b/vue/gold-system/src/views/consume/allConsume.vue index f81c83f..5dbceb9 100644 --- a/vue/gold-system/src/views/consume/allConsume.vue +++ b/vue/gold-system/src/views/consume/allConsume.vue @@ -83,7 +83,7 @@ const get = async function (val) { // 发送POST请求 const result = await API.post("http://192.168.8.93:10010/consume/select", { ...getObj.value, - detailVo: { ...detailVo.value }, + consumeDetail: { ...detailVo.value }, }); // 将响应结果存储到响应式数据中 diff --git a/vue/gold-system/src/views/usergold/index.vue b/vue/gold-system/src/views/usergold/index.vue index 06e5d19..cab7179 100644 --- a/vue/gold-system/src/views/usergold/index.vue +++ b/vue/gold-system/src/views/usergold/index.vue @@ -242,20 +242,146 @@ const json_meta = [ ], ]; const exportExcel = () => { - const ws = XLSX.utils.json_to_sheet(tableData.value, json_fields); + const ws = XLSX.utils.json_to_sheet(excelInfo.value, json_fields); const wb = XLSX.utils.book_new(); XLSX.utils.book_append_sheet(wb, ws, "Sheet1"); XLSX.writeFile(wb, "客户金币明细.xlsx"); }; const putExcel = ref({}); +const excelInfo = ref({}); +const areyour = async function (val) { + try { + const result = await API.post( + "http://192.168.8.93:10010/detailY/searchAll", + { ...putExcel.value } + ); + excelInfo.value = result.data; + areyouright.value = true; + ElMessage({ + type: "success", + message: "导出成功", + }); + } catch (error) { + console.log("请求失败", error); + } +}; + +const areyouright = ref(false); + +//选地区 +const area = [ + { + value: "马来西亚", + label: "马来西亚", + }, + { + value: "新加坡", + label: "新加坡", + }, + { + value: "香港", + label: "香港", + }, + { + value: "泰国", + label: "泰国", + }, + { + value: "加拿大", + label: "加拿大", + }, + { + value: "越南HCM", + label: "越南HCM", + }, +]; + +const TimeGet = ref("1"); + +// 今天 +const getT = function () { + const today = new Date(); + const startDate = new Date( + today.getFullYear(), + today.getMonth(), + today.getDate() + ); + const endDate = new Date( + today.getFullYear(), + today.getMonth(), + today.getDate() + 1 + ); + putExcel.value.startDate = startDate; + putExcel.value.endDate = endDate; + console.log("putExcel", putExcel.value); +}; +//3天 +const get3 = function () { + const today = new Date(); + const startDate = new Date( + today.getFullYear(), + today.getMonth(), + today.getDate() - 2 + ); + const endDate = new Date( + today.getFullYear(), + today.getMonth(), + today.getDate() + 1 + ); + putExcel.value.startDate = startDate; + putExcel.value.endDate = endDate; + console.log("putExcel", putExcel.value); +}; +// 7天 +const get7 = function () { + const today = new Date(); + const startDate = new Date( + today.getFullYear(), + today.getMonth(), + today.getDate() - 6 + ); + const endDate = new Date( + today.getFullYear(), + today.getMonth(), + today.getDate() + 1 + ); + putExcel.value.startDate = startDate; + putExcel.value.endDate = endDate; + console.log("putExcel", putExcel.value); +}; +// 30天 +const get30 = function () { + const today = new Date(); + const startDate = new Date( + today.getFullYear(), + today.getMonth() - 1, + today.getDate() + ); + const endDate = new Date( + today.getFullYear(), + today.getMonth(), + today.getDate() + 1 + ); + putExcel.value.startDate = startDate; + putExcel.value.endDate = endDate; + console.log("putExcel", putExcel.value); +};