ylong hai 8 meses
pai
achega
2fdbbffa37

+ 60 - 0
src/views/finance/subsidyReview/components/log-dialog.vue

@@ -0,0 +1,60 @@
+<template>
+    <ele-modal v-model="visible" title="操作日志" width="800px">
+        <ele-data-table
+            :data="logData"
+            :columns="logColumns"
+            :border="true"
+            :pagination="false"
+            :height="450"
+        />
+    </ele-modal>
+</template>
+
+<script setup>
+import { ref, defineExpose } from 'vue';
+import request from '@/utils/request';
+import { ElMessage } from 'element-plus';
+
+const visible = ref(false);
+const logData = ref([]);
+
+const logColumns = [
+    { label: '操作名称', prop: 'operator', align: 'center', width: 120 },
+    { label: '操作人', prop: 'operatorUserName', align: 'center', width: 120 },
+    { label: '操作内容', prop: 'content', align: 'center', minWidth: 200 },
+    { label: '操作时间', prop: 'createTime', align: 'center', width: 180 }
+];
+
+/**
+ * 打开日志弹窗
+ * @param {Object} row 记录行数据
+ */
+const open = async (row) => {
+    visible.value = true;
+    logData.value = [];
+    try {
+        const res = await request.get(`/order/orderCompensationLog/operatorLog/${row.id}`);
+        if (res.data.code === 200) {
+            logData.value = res.data.data || [];
+        } else {
+            ElMessage.error(res.data.msg || '获取操作日志失败');
+        }
+    } catch (error) {
+        console.error('获取操作日志失败:', error);
+        ElMessage.error('获取操作日志失败');
+    }
+};
+
+/**
+ * 关闭弹窗
+ */
+const close = () => {
+    visible.value = false;
+    logData.value = [];
+};
+
+defineExpose({
+    open,
+    close
+});
+</script> 

+ 201 - 165
src/views/finance/subsidyReview/index.vue

@@ -1,174 +1,210 @@
 <template>
-  <ele-page flex-table>
-    <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="statistics.totalMoney"
-            title="累计申请金额"
-            :precision="2"
-            value-style="font-size:30px"
-            class="mr-20"
-          ></el-statistic>
-          <el-statistic
-            :value="statistics.unFinishMoney"
-            title="待审核补贴"
-            :precision="0"
-            value-style="font-size:30px"
-            class="mr-20"
-          ></el-statistic>
-          <el-statistic
-            :value="statistics.finishMoney"
-            title="已审核补贴金额"
-            :precision="0"
-            value-style="font-size:30px"
-            class="mr-20"
-          ></el-statistic>
-        </div>
-
-        <div class="common-title mb-4">交易记录</div>
-
-        <el-radio-group @change="handleStatusChange" v-model="useStatus">
-          <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>
-
-      <template #orderId="{ row }">
-        <el-button type="primary" link @click="handleOrderId(row)">{{
-          row.orderId
-        }}</el-button>
-      </template>
-
-      <template #action="{ row }">
-        <div>
-          <el-button
-            type="primary"
-            link
-            v-if="row.status == 1"
-            v-permission="'finance:subsidyReview:audit'"
-            @click="handleChangeStatus(row)"
-          >
-            [审核]
-          </el-button>
-          <el-button
-            type="primary"
-            link
-            v-permission="'finance:subsidyReview:log'"
-            @click="handleUpdate(row)"
-          >
-            [操作日志]
-          </el-button>
-        </div>
-      </template>
-    </common-table>
-
-    <orderDetail ref="orderDetailRef" />
-  </ele-page>
+    <ele-page flex-table>
+        <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="statistics.sumMoney"
+                        title="累计申请金额"
+                        :precision="2"
+                        value-style="font-size:30px"
+                        class="mr-20"
+                    ></el-statistic>
+                    <el-statistic
+                        :value="statistics.unAuditMoney"
+                        title="待审核补贴"
+                        :precision="2"
+                        value-style="font-size:30px"
+                        class="mr-20"
+                    ></el-statistic>
+                    <el-statistic
+                        :value="statistics.auditMoney"
+                        title="已审核补贴金额"
+                        :precision="2"
+                        value-style="font-size:30px"
+                        class="mr-20"
+                    ></el-statistic>
+                </div>
+
+                <div class="common-title mb-4">交易记录</div>
+
+                <el-radio-group
+                    @change="handleStatusChange"
+                    v-model="useStatus"
+                >
+                    <el-radio-button label="全部" value="" />
+                    <el-radio-button label="待审核" value="1" />
+                    <el-radio-button label="已审核" value="2" />
+                    <el-radio-button label="未提交" value="3" />
+                </el-radio-group>
+            </template>
+
+            <template #type="{ row }">
+                <dict-data
+                    code="order_compensation_type"
+                    type="text"
+                    :model-value="row.type"
+                />
+            </template>
+            <template #status="{ row }">
+                <dict-data
+                    code="order_compensation_status"
+                    type="text"
+                    :model-value="row.status"
+                />
+            </template>
+
+            <template #orderId="{ row }">
+                <el-button type="primary" link @click="handleOrderId(row)">{{
+                    row.orderId
+                }}</el-button>
+            </template>
+
+            <template #action="{ row }">
+                <div>
+                    <el-button
+                        type="primary"
+                        link
+                        v-if="row.status == 1"
+                        v-permission="'finance:subsidyReview:audit'"
+                        @click="handleAudit(row)"
+                    >
+                        [审核]
+                    </el-button>
+                    <el-button
+                        type="primary"
+                        link
+                        v-permission="'finance:subsidyReview:log'"
+                        @click="handleLog(row)"
+                    >
+                        [操作日志]
+                    </el-button>
+                </div>
+            </template>
+        </common-table>
+
+        <orderDetail ref="orderDetailRef" />
+        
+        <!-- 操作日志弹窗 -->
+        <log-dialog ref="logDialogRef" />
+    </ele-page>
 </template>
 
 <script setup>
-  import { ref, reactive, onMounted } from 'vue';
-  import CommonTable from '@/components/CommonPage/CommonTable.vue';
-  import pageSearch from './page-search.vue';
-  import request from '@/utils/request';
-  import OrderDetail from '@/views/recycleOrder/components/order-detail.vue';
-
-  defineOptions({ name: 'subsidyReview' });
-
-  // 添加统计数据的响应式对象
-  const statistics = reactive({
-    totalMoney: 0,
-    unFinishMoney: 0,
-    finishMoney: 0
-  });
-
-  // 获取统计数据
-  async function fetchStatistics() {
-    try {
-      const res = await request.get('/sys/finance/subsidySum');
-      if (res.data.code === 200) {
-        Object.assign(statistics, res.data.data);
-      }
-    } catch (error) {
-      console.error('获取统计数据失败:', error);
+    import { ref, reactive, onMounted } from 'vue';
+    import CommonTable from '@/components/CommonPage/CommonTable.vue';
+    import pageSearch from './page-search.vue';
+    import request from '@/utils/request';
+    import OrderDetail from '@/views/recycleOrder/components/order-detail.vue';
+    import LogDialog from './components/log-dialog.vue';
+    import { ElMessage } from 'element-plus';
+    defineOptions({ name: 'subsidyReview' });
+
+    // 添加统计数据的响应式对象
+    const statistics = reactive({
+        sumMoney: 0,
+        unAuditMoney: 0,
+        auditMoney: 0
+    });
+
+    // 获取统计数据
+    async function fetchStatistics() {
+        try {
+            const res = await request.get('/order/orderCompensationLog/getSum');
+            if (res.data.code === 200) {
+                Object.assign(statistics, res.data.data);
+            }
+        } catch (error) {
+            console.error('获取统计数据失败:', error);
+        }
     }
-  }
-
-  const orderDetailRef = ref(null);
-  const handleOrderId = (row) => {
-    orderDetailRef.value?.handleOpen(row);
-  };
-
-  onMounted(() => {
-    fetchStatistics();
-  });
-
-  const statusDicts = ref([
-    { label: '待审核', value: 1 },
-    { label: '已审核', value: 2 }
-  ]);
-
-  const useStatus = ref('');
-  function handleStatusChange(value) {
-    pageRef.value.reload({ status: value });
-  }
-
-  /** 表格列配置 */
-  const columns = ref([
-    { label: '申请时间', prop: 'applyTime', align: 'center', width: 180 },
-    { label: '用户UID', prop: 'userId', align: 'center' },
-    {
-      label: '支付单号/流水号',
-      prop: 'paymentNo',
-      align: 'center',
-      minWidth: 180,
-      formatter: (row) => row.paymentNo || '-'
-    },
-    { label: '对方账户', prop: 'nickName', align: 'center', minWidth: 140 },
-    { label: '结算金额', prop: 'amount', align: 'center' },
-    { label: '交易状态', prop: 'status', align: 'center', slot: 'status' },
-    {
-      label: '交易类型',
-      prop: 'type',
-      align: 'center',
-      formatter: (row) => (row.status == 2 ? '超时审核' : '变与必箱')
-    },
-    {
-      label: '订单编号',
-      prop: 'orderId',
-      align: 'center',
-      minWidth: 120,
-      slot: 'orderId'
-    },
-    {
-      columnKey: 'action',
-      label: '操作',
-      width: 140,
-      align: 'center',
-      slot: 'action',
-      fixed: 'right'
-    }
-  ]);
 
-  /** 页面组件实例 */
-  const pageRef = ref(null);
+    const orderDetailRef = ref(null);
+    const handleOrderId = (row) => {
+        orderDetailRef.value?.handleOpen(row);
+    };
+
+    onMounted(() => {
+        fetchStatistics();
+    });
 
-  const pageConfig = reactive({
-    pageUrl: '/sys/finance/subsidyList',
-    fileName: '补贴审核',
-    cacheKey: 'subsidyReview'
-  });
+    const useStatus = ref('');
+    function handleStatusChange(value) {
+        useStatus.value = value;
+        pageConfig.params.status = value;
+        reload();
+    }
+
+    /** 表格列配置 */
+    const columns = ref([
+        { label: '申请时间', prop: 'submitTime', align: 'center', width: 180 },
+        { label: '用户UID', prop: 'userId', align: 'center' },
+        { label: '用户昵称', prop: 'nickName', align: 'center' },
+        {
+            label: '对方账户',
+            prop: 'nickName2',
+            align: 'center',
+            formatter: (row) => '小程序余额'
+        },
+        { label: '结算金额', prop: 'compensationMoney', align: 'center' },
+        { label: '交易状态', prop: 'status', align: 'center', slot: 'status' },
+        {
+            label: '交易类型',
+            prop: 'type',
+            align: 'center',
+            slot: 'type'
+        },
+        {
+            label: '订单编号',
+            prop: 'orderId',
+            align: 'center',
+            minWidth: 120,
+            slot: 'orderId'
+        },
+        {
+            columnKey: 'action',
+            label: '操作',
+            width: 150,
+            align: 'center',
+            slot: 'action',
+            fixed: 'right'
+        }
+    ]);
+
+    /** 页面组件实例 */
+    const pageRef = ref(null);
+
+    const pageConfig = reactive({
+        pageUrl: '/order/orderCompensationLog/pagelist',
+        fileName: '补贴审核',
+        cacheKey: 'subsidyReview',
+        params: {
+            status: useStatus.value
+        }
+    });
+
+    //刷新表格
+    function reload(where = {}) {
+        where.status = useStatus.value;
+        pageRef.value?.reload(where);
+    }
 
-  //刷新表格
-  function reload(where) {
-    pageRef.value?.reload(where);
-  }
+    // 审核
+    const handleAudit = (row) => {
+        pageRef.value?.messageBoxConfirm({
+            message: '确定审核通过吗?',
+            fetch: () =>
+                request.post(`/order/orderCompensationLog/audit/${row.id}`)
+        });
+    };
+
+    // 日志弹窗引用
+    const logDialogRef = ref(null);
+    
+    // 操作日志
+    const handleLog = (row) => {
+        logDialogRef.value?.open(row);
+    };
 </script>

+ 74 - 71
src/views/finance/subsidyReview/page-search.vue

@@ -1,83 +1,86 @@
 <!-- 搜索表单 -->
 <template>
-  <ele-card :body-style="{ paddingBottom: '8px' }">
-    <ProSearch
-      :items="formItems"
-      ref="searchRef"
-      @search="search"
-      :initKeys="initKeys"
-    >
-      <template #buttons>
-        <el-button type="primary" @click="searchRef.handleSearch()">查询</el-button>
-        <el-button @click="searchRef.handleReset()">重置</el-button>
-      </template>
-    </ProSearch>
-  </ele-card>
+    <ele-card :body-style="{ paddingBottom: '8px' }">
+        <ProSearch
+            :items="formItems"
+            ref="searchRef"
+            @search="search"
+            :initKeys="initKeys"
+        >
+            <template #buttons>
+                <el-button type="primary" @click="searchRef.handleSearch()"
+                    >查询</el-button
+                >
+                <el-button @click="searchRef.handleReset()">重置</el-button>
+            </template>
+        </ProSearch>
+    </ele-card>
 </template>
 
 <script setup>
-  import { reactive, ref, defineEmits, getCurrentInstance } from 'vue';
-  import ProSearch from '@/components/CommonPage/ProSearch2.vue';
+    import { reactive, ref, defineEmits } from 'vue';
+    import ProSearch from '@/components/CommonPage/ProSearch2.vue';
 
-  let { proxy } = getCurrentInstance();
-  const emit = defineEmits(['search']);
+    const emit = defineEmits(['search']);
 
-  const props = defineProps({
-    status: {
-      type: String,
-      default: ''
-    }
-  });
+    const props = defineProps({
+        status: {
+            type: String,
+            default: ''
+        }
+    });
 
-  const formItems = reactive([
-    { type: 'input', label: '输入用户UID', prop: 'userId' },
-    {
-      type: 'select',
-      label: '请选择状态',
-      prop: 'status',
-      options: [
-        { label: '待审核', value: 1 },
-        { label: '已审核', value: 2 }
-      ]
-    },
-    {
-      type: 'select',
-      label: '请选择交易类型',
-      prop: 'type',
-      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 formItems = reactive([
+        { type: 'input', label: '输入用户UID', prop: 'userId' },
+        {
+            type: 'dictSelect',
+            label: '请选择状态',
+            prop: 'status',
+            props: {
+                code: 'order_compensation_status'
+            }
+        },
+        {
+            type: 'dictSelect',
+            label: '请选择类型',
+            prop: 'type',
+            props: {
+                code: 'order_compensation_type'
+            }
+        },
+        {
+            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] : '';
+                    initKeys.timeRange = value;
+                    searchRef.value?.setData(initKeys);
+                }
+            }
         }
-      }
-    }
-  ]);
+    ]);
 
-  const initKeys = reactive({
-    startTime: '',
-    endTime: '',
-    userId: '',
-    status: '',
-    type: ''
-  });
+    const initKeys = reactive({
+        startTime: '',
+        endTime: '',
+        timeRange: [],
+        userId: '',
+        status: '',
+        type: ''
+    });
 
-  const searchRef = ref(null);
-  /** 搜索 */
-  const search = (data) => {
-    emit('search', { ...data });
-  };
+    const searchRef = ref(null);
+    /** 搜索 */
+    const search = (data) => {
+        let params = { ...data };
+        delete params.timeRange;
+        emit('search', params);
+    };
 </script>