diff --git a/src/views/usergold/gold/clientCountWallet.vue b/src/views/usergold/gold/clientCountWallet.vue index fda7966..d1a3123 100644 --- a/src/views/usergold/gold/clientCountWallet.vue +++ b/src/views/usergold/gold/clientCountWallet.vue @@ -38,18 +38,19 @@ const scrollTableTop = () => { } // 新增金币总数变量 -const goldtotal = ref(0) - -// 计算用户各金币总数的不分页对象 -const tableAllData = ref([]) -// 各金币字段 -const permanentGold = ref(0) // 修改为 currentPermanentGold 对应字段 -const freeJuneGold = ref(0) // 修改为 currentFreeJune 对应字段 -const freeDecemberGold = ref(0) // 修改为 currentFreeDecember 对应字段 -const taskGold = ref(0) // 修改为 currentTaskGold 对应字段 -const freeGold = ref(0) // 计算免费金币总数 +const statisticsData = ref({ + hkGold: 0, + sgHcGold: 0, + myGold: 0, + sgGold: 0, + caGold: 0, + thHsGold: 0, + thHaGold: 0, + vnGold: 0, + bjGold: 0 +}) + //客户消费记录 -const tableCountData = ref([]) const userInfo = ref({}) // 搜索=========================================== @@ -76,10 +77,6 @@ const sortOrder = ref('') // 搜索=========================================================================== // 搜索方法 const get = async function (val) { - if (!findMenuById(menuTree.value, permissionMapping.gold_coin_customer_balance)) { - ElMessage.error(t('elmessage.noPermission')) - return - } try { // 搜索参数页码赋值 if (typeof val === 'number') { @@ -134,12 +131,17 @@ const get = async function (val) { // 将表格数据设置为空数组 tableData.value = [] // 将合计数设置为 0 - permanentGold.value = 0 - freeJuneGold.value = 0 - freeDecemberGold.value = 0 - taskGold.value = 0 - goldtotal.value = 0 - freeGold.value = 0 + statisticsData.value = { + hkGold: 0, + sgHcGold: 0, + myGold: 0, + sgGold: 0, + caGold: 0, + thHsGold: 0, + thHaGold: 0, + vnGold: 0, + bjGold: 0 + } // // 新增金币总数变量 // const goldtotal = ref(0) @@ -152,12 +154,17 @@ const get = async function (val) { // 将表格数据设置为空数组 tableData.value = [] // 将合计数设置为 0 - permanentGold.value = 0 - freeJuneGold.value = 0 - freeDecemberGold.value = 0 - taskGold.value = 0 - goldtotal.value = 0 - freeGold.value = 0 + statisticsData.value = { + hkGold: 0, + sgHcGold: 0, + myGold: 0, + sgGold: 0, + caGold: 0, + thHsGold: 0, + thHaGold: 0, + vnGold: 0, + bjGold: 0 + } } else { // 将响应结果存储到响应式数据中 @@ -170,10 +177,7 @@ const get = async function (val) { // 从接口返回数据中获取各金币数值 if (resultGoldTotal.data) { - permanentGold.value = parseFloat(resultGoldTotal.data.permanentGold.toFixed(2)) - freeGold.value = parseFloat(resultGoldTotal.data.freeGold.toFixed(2)) - taskGold.value = parseFloat(resultGoldTotal.data.taskGold.toFixed(2)) - goldtotal.value = parseFloat(resultGoldTotal.data.goldtotal.toFixed(2)) + statisticsData.value = { ...resultGoldTotal.data } } else { console.error('合计数数据格式错误', resultGoldTotal) ElMessage.error(t('elmessage.getTotalFailed')) @@ -217,7 +221,6 @@ const cellClick = function (row, column) { console.log('cellClick', column.label) if (column.label === t('common.name')) { dialogVisible.value = true - userInfo.value = row } } @@ -225,14 +228,8 @@ const cellClick = function (row, column) { const handleSortChange = (column) => { console.log('排序字段:', column.prop) console.log('排序方式:', column.order) - if (column.prop === 'currentPermanentGold') { - sortField.value = 'current_permanent_gold' - } else if (column.prop === 'currentTaskGold') { - sortField.value = 'current_task_gold' - } else if (column.prop === 'currentFreeJune') { - sortField.value = 'current_free_june' - } else if (column.prop === 'currentFreeDecember') { - sortField.value = 'current_free_december' + if (column.prop) { + sortField.value = column.prop.replace(/([A-Z])/g, "_$1").toLowerCase(); } sortOrder.value = column.order === 'ascending' ? 'ASC' : 'DESC' get() @@ -420,10 +417,15 @@ const format3 = (num) => {
- {{ $t('common.totalGoldCoin') }}:{{ format3(goldtotal || 0) }}     - {{ $t('common.permanentGold') }}:{{ format3(permanentGold || 0) }}     - {{ $t('common.freeGold') }}:{{ format3(freeGold || 0) }}     - {{ $t('common.taskGold') }}:{{ format3(taskGold || 0) }} + 香港:{{ format3(statisticsData.hkGold || 0) }}     + 新加坡HC:{{ format3(statisticsData.sgHcGold || 0) }}     + 马来西亚:{{ format3(statisticsData.myGold || 0) }}     + 新加坡:{{ format3(statisticsData.sgGold || 0) }}     + 加拿大:{{ format3(statisticsData.caGold || 0) }}     + 泰国HS:{{ format3(statisticsData.thHsGold || 0) }}     + 泰国HA:{{ format3(statisticsData.thHaGold || 0) }}     + 越南:{{ format3(statisticsData.vnGold || 0) }}     + 北京:{{ format3(statisticsData.bjGold || 0) }}
@@ -439,34 +441,49 @@ const format3 = (num) => { - - + + + + + - + - + - + - + + + + + + + + + +