Selaa lähdekoodia

财务-书款记录

Alex 9 kuukautta sitten
vanhempi
sitoutus
f37546bde7

+ 60 - 35
src/views/finance/bookPayments/index.vue

@@ -1,26 +1,29 @@
 <template>
   <ele-page flex-table>
-    <page-search @search="reload"></page-search>
+    <page-search @search="reload" :status="useStatus"></page-search>
 
     <common-table ref="pageRef" :pageConfig="pageConfig" :columns="columns">
       <template #toolbar>
         <div class="flex items-center mb-4">
           <el-statistic
-            :value="693700"
+            :value="statistics.totalMoney"
             title="累计书款金额"
+            :precision="2"
             value-style="font-size:30px"
             class="mr-10"
           ></el-statistic>
           <el-statistic
-            :value="693700"
+            :value="statistics.unFinishMoney"
             title="待结算书款"
+            :precision="2"
             value-style="font-size:30px"
             class="mr-10"
           ></el-statistic>
           <el-statistic
-            :value="693700"
+            :value="statistics.finishMoney"
             title="已结算书款"
             value-style="font-size:30px"
+            :precision="2"
             class="mr-10"
           ></el-statistic>
         </div>
@@ -28,66 +31,88 @@
         <div class="common-title mb-4">交易记录</div>
 
         <el-radio-group @change="handleStatusChange" v-model="useStatus">
-          <el-radio-button label="全部" value="1" />
-          <el-radio-button label="待结算" value="2" />
-          <el-radio-button label="已结算" value="3" />
+          <el-radio-button label="全部" value="" />
+          <el-radio-button label="待结算" value="1" />
+          <el-radio-button label="已结算" value="2" />
         </el-radio-group>
       </template>
+
+      <template #status="{ row }">
+        {{ statusDicts.find((d) => d.value == row.status)?.label }}
+      </template>
     </common-table>
   </ele-page>
 </template>
 
 <script setup>
-  import { ref, reactive } from 'vue';
+  import { ref, reactive, onMounted } from 'vue';
   import CommonTable from '@/components/CommonPage/CommonTable.vue';
-  import pageSearch from '@/views/finance/withdrawal/components/page-search.vue';
-  import { useDictData } from '@/utils/use-dict-data';
+  import pageSearch from './page-search.vue';
+  import request from '@/utils/request';
 
-  defineOptions({ name: 'withdrawal' });
-  const [useStatusDicts] = useDictData(['use_status']);
+  defineOptions({ name: 'bookPayments' });
+
+  // 添加统计数据的响应式对象
+  const statistics = reactive({
+    totalMoney: 0,
+    unFinishMoney: 0,
+    finishMoney: 0
+  });
 
-  const useStatus = ref('1');
+  // 获取统计数据
+  async function fetchStatistics() {
+    try {
+      const res = await request.get('/sys/finance/orderMoneySum');
+      if (res.data.code === 200) {
+        Object.assign(statistics, res.data.data);
+      }
+    } catch (error) {
+      console.error('获取统计数据失败:', error);
+    }
+  }
+
+  onMounted(() => {
+    fetchStatistics();
+  });
+
+  const statusDicts = ref([
+    { label: '待结算', value: 1 },
+    { label: '已结算', value: 2 }
+  ]);
+
+  const useStatus = ref('');
   function handleStatusChange(value) {
-    pageRef.value.reload({ useStatus: value });
+    pageRef.value.reload({ status: value });
   }
 
   /** 表格列配置 */
   const columns = ref([
-    { label: '交易时间', prop: 'createTime', align: 'center', width: 180 },
-    { label: '用户UID', prop: 'uid', align: 'center', minWidth: 140 },
+    { label: '交易时间', prop: 'orderTime', align: 'center', width: 180 },
+    { label: '用户名', prop: 'userId', align: 'center' },
     {
       label: '支付单号/流水号',
-      prop: 'paymentCode',
-      align: 'center',
-      minWidth: 160
-    },
-    { label: '对方账户', prop: 'addressDetail', align: 'center' },
-    { label: '结算金额', prop: 'money', align: 'center' },
-    {
-      label: '交易状态',
-      prop: 'useStatus',
+      prop: 'changeLogId',
       align: 'center',
-      formatter: (row) =>
-        useStatusDicts.value.find((d) => d.dictValue == row.useStatus)
-          ?.dictLabel
+      minWidth: 180,
+      formatter: (row) => row.changeLogId || '-'
     },
+    { label: '对方账户', prop: 'nickName', align: 'center', minWidth: 140 },
+    { label: '结算金额', prop: 'finalMoney', align: 'center' },
+    { label: '交易状态', prop: 'status', align: 'center', slot: 'status' },
     {
       label: '交易类型',
-      prop: 'paymentType',
+      prop: 'type',
       align: 'center',
-      formatter: (row) =>
-        useStatusDicts.value.find((d) => d.dictValue == row.useStatus)
-          ?.dictLabel
+      formatter: (row) => (row.status == 2 ? '已结算书款' : '未结算书款')
     },
-    { label: '订单编号', prop: 'code', align: 'center' }
+    { label: '订单编号', prop: 'orderId', align: 'center', minWidth: 160 }
   ]);
 
   /** 页面组件实例 */
   const pageRef = ref(null);
 
   const pageConfig = reactive({
-    pageUrl: '/baseinfo/godown/pagelist',
-    exportUrl: '/baseinfo/godown/export',
+    pageUrl: '/sys/finance/orderMoneyList',
     fileName: '书款记录',
     cacheKey: 'bookPayments'
   });

+ 76 - 0
src/views/finance/bookPayments/page-search.vue

@@ -0,0 +1,76 @@
+<!-- 搜索表单 -->
+<template>
+  <ele-card :body-style="{ paddingBottom: '8px' }">
+    <ProSearch
+      :items="formItems"
+      ref="searchRef"
+      @search="search"
+      :initKeys="initKeys"
+    ></ProSearch>
+  </ele-card>
+</template>
+
+<script setup>
+  import { reactive, ref, defineEmits } from 'vue';
+  import ProSearch from '@/components/CommonPage/ProSearch2.vue';
+
+  let { proxy } = getCurrentInstance();
+  const emit = defineEmits(['search']);
+
+  const props = defineProps({
+    status: {
+      type: String,
+      default: ''
+    }
+  });
+
+  const formItems = reactive([
+    { type: 'input', label: '用户名', prop: 'nickName' },
+    {
+      type: 'select',
+      label: '状态',
+      prop: 'status',
+      options: [
+        { label: '待结算', value: 1 },
+        { label: '已结算', value: 2 }
+      ]
+    },
+    {
+      type: 'daterange',
+      label: '时间',
+      prop: 'timeRange',
+      props: {
+        valueFormat: 'YYYY-MM-DD',
+        format: 'YYYY-MM-DD',
+        startPlaceholder: '开始日期',
+        endPlaceholder: '结束日期',
+        onChange: (value) => {
+          initKeys.startTime = value ? value[0] : '';
+          initKeys.endTime = value ? value[1] : '';
+          searchRef.value?.setData(initKeys);
+        }
+      }
+    }
+  ]);
+
+  const initKeys = reactive({
+    startTime: '',
+    endTime: '',
+    nickName: '',
+    status: ''
+  });
+
+  // watch(
+  //   () => props.status,
+  //   (newVal) => {
+  //     initKeys.status = newVal;
+  //     searchRef.value?.setData(initKeys);
+  //   }
+  // );
+
+  const searchRef = ref(null);
+  /** 搜索 */
+  const search = (data) => {
+    emit('search', { ...data });
+  };
+</script>

+ 8 - 3
src/views/finance/withdrawal/index.vue

@@ -8,12 +8,14 @@
           <el-statistic
             :value="statistics.totalWithdrawMoney"
             title="提现累计金额"
+            :precision="2"
             value-style="font-size:30px"
             class="mr-10"
           ></el-statistic>
           <el-statistic
             :value="statistics.unWithdrawMoney"
             title="待提现金额"
+            :precision="2"
             value-style="font-size:30px"
             class="mr-10"
           ></el-statistic>
@@ -22,10 +24,12 @@
             title="提现中金额"
             value-style="font-size:30px"
             class="mr-10"
+            :precision="2"
           ></el-statistic>
           <el-statistic
             :value="statistics.withdrawSuccessMoney"
             title="已提现金额"
+            :precision="2"
             value-style="font-size:30px"
             class="mr-10"
           ></el-statistic>
@@ -34,12 +38,14 @@
             title="平均提现时长"
             value-style="font-size:30px"
             class="mr-10"
+            :precision="2"
           ></el-statistic>
           <el-statistic
             :value="statistics.noWithdrawMoney"
             title="长期不提现金额"
             value-style="font-size:30px"
             class="mr-10"
+            :precision="2"
           ></el-statistic>
         </div>
 
@@ -171,8 +177,7 @@
       prop: 'withdrawType',
       align: 'center',
       formatter: (row) =>
-        withdrawTypeDicts.value.find((d) => d.value == row.withdrawType)
-          ?.label
+        withdrawTypeDicts.value.find((d) => d.value == row.withdrawType)?.label
     },
     { label: '金额', prop: 'withdrawMoney', align: 'center' },
     {
@@ -225,6 +230,6 @@
       ElMessage.warning('请至少选择一条数据');
       return;
     }
-    auditDialogRef.value?.handleOpen(selections.map(item => item.id));
+    auditDialogRef.value?.handleOpen(selections.map((item) => item.id));
   }
 </script>