Kaynağa Gözat

feat: 新增审核设置

叶静 1 ay önce
ebeveyn
işleme
b5e6885a04

+ 1 - 1
src/app/shop/admin/finance/recharge/detail.vue

@@ -22,7 +22,7 @@
           <el-col :span="6">
             <div class="info-item" :style="{ '--label-width': formLabelWidth }">
               <span class="label">{{ t('modules.recharge.bank') }}:</span>
-              <span class="value">{{ rechargeDetail.bankName || '--' }}</span>
+              <span class="value">{{ rechargeDetail.bank || '--' }}</span>
             </div>
           </el-col>
           <el-col :span="6">

+ 90 - 8
src/app/shop/admin/finance/withdraw/audit.vue

@@ -1,14 +1,26 @@
 <template>
   <el-container>
     <el-main>
-      <el-form ref="formRef" :model="formData" label-width="100px" :rules="rules">
-        <!-- 审核通过时显示通道选择 - 暂时注释 -->
-        <!-- <el-form-item v-if="auditType === 'approve'" label="选择通道:" prop="channel">
-          <el-select v-model="formData.channel" placeholder="请选择提款通道" style="width: 100%">
-            <el-option label="TKPAY" value="TKPAY" />
-            <el-option label="3QPAY" value="3QPAY" />
+      <el-form ref="formRef" :model="formData" :label-width="formLabelWidth" :rules="rules">
+        <!-- 审核通过时显示通道选择 -->
+        <el-form-item v-if="auditType === 'approve'" :label="t('modules.withdraw.paymentChannel') + ':'"
+          prop="channelId">
+          <el-select v-model="formData.channelId" :placeholder="t('modules.withdraw.selectPaymentChannel')"
+            style="width: 100%" @change="handleChannelChange" :loading="channelLoading">
+            <el-option v-for="channel in channelList" :key="channel.id" :label="channel.channelName"
+              :value="channel.id" />
           </el-select>
-        </el-form-item> -->
+        </el-form-item>
+
+        <!-- 通道代码选择 -->
+        <el-form-item v-if="auditType === 'approve' && formData.channelId"
+          :label="t('modules.withdraw.channelCode') + ':'" prop="channelCode">
+          <el-radio-group v-model="formData.channelCode">
+            <el-radio v-for="code in channelCodeOptions" :key="code.value" :label="code.value">
+              {{ code.label }}
+            </el-radio>
+          </el-radio-group>
+        </el-form-item>
 
         <!-- 审核内容 -->
         <el-form-item
@@ -27,10 +39,12 @@
 </template>
 
 <script setup>
-import { reactive, ref, computed } from 'vue';
+import { reactive, ref, computed, onMounted } from 'vue';
 import { ElMessage } from 'element-plus';
 import { useI18n } from 'vue-i18n';
+import { useFormConfig } from '@/hooks/useFormConfig';
 import { api } from '../finance.service';
+import adminApi from '@/app/admin/api';
 
 const { t } = useI18n();
 
@@ -39,6 +53,9 @@ const emit = defineEmits(['modalCallBack']);
 
 const formRef = ref();
 const loading = ref(false);
+const channelLoading = ref(false);
+const channelList = ref([]);
+const channelCodeOptions = ref([]);
 
 // 审核类型:approve(通过) 或 reject(拒绝)
 const auditType = computed(() => props.modal?.params?.type || 'approve');
@@ -46,8 +63,54 @@ const auditType = computed(() => props.modal?.params?.type || 'approve');
 // 表单数据
 const formData = reactive({
   review: '', // 审核内容
+  channelId: '', // 支付通道ID
+  channelCode: '', // 通道代码
 });
 
+// 使用表单配置hooks
+const { formLabelWidth, formLayout } = useFormConfig();
+// 获取支付通道列表
+async function getChannelList() {
+  if (auditType.value !== 'approve') return;
+
+  channelLoading.value = true;
+  try {
+    const { code, data } = await adminApi.payment.channel.list({});
+    if (code === '200') {
+      channelList.value = data || [];
+    }
+  } catch (error) {
+    console.error('获取支付通道失败:', error);
+    ElMessage.error(t('message.fetchDataFailed'));
+  } finally {
+    channelLoading.value = false;
+  }
+}
+
+// 处理通道变更
+function handleChannelChange(channelId) {
+  formData.channelCode = ''; // 重置通道代码
+
+  const selectedChannel = channelList.value.find(channel => channel.id === channelId);
+  if (selectedChannel) {
+    // 构建通道代码选项
+    channelCodeOptions.value = [
+      {
+        label: 'Bkash',
+        value: selectedChannel.bkashPayCode
+      },
+      {
+        label: 'Nagad',
+        value: selectedChannel.nagadPayCode
+      },
+      {
+        label: 'Rocket',
+        value: selectedChannel.rocketPayCode
+      }
+    ].filter(option => option.value); // 过滤掉空值
+  }
+}
+
 // 表单验证规则
 const rules = computed(() => {
   const baseRules = {};
@@ -58,6 +121,14 @@ const rules = computed(() => {
       { required: true, message: t('modules.withdraw.rejectReasonRequired'), trigger: 'blur' },
       { min: 1, max: 200, message: t('modules.withdraw.rejectReasonLength'), trigger: 'blur' },
     ];
+  } else if (auditType.value === 'approve') {
+    // 审核通过时需要选择通道和通道代码
+    baseRules.channelId = [
+      { required: true, message: t('modules.withdraw.paymentChannelRequired'), trigger: 'change' }
+    ];
+    baseRules.channelCode = [
+      { required: true, message: t('modules.withdraw.channelCodeRequired'), trigger: 'change' }
+    ];
   }
 
   return baseRules;
@@ -85,6 +156,12 @@ async function handleConfirm() {
       review: formData.review || '', // 审核内容
     };
 
+    // 审核通过时添加通道信息
+    if (auditType.value === 'approve') {
+      requestData.channelId = formData.channelId;
+      requestData.channelCode = formData.channelCode;
+    }
+
     // 调用审核API
     const { code, message } = await api.withdraw.review(requestData);
 
@@ -102,6 +179,11 @@ async function handleConfirm() {
     loading.value = false;
   }
 }
+
+// 组件挂载时获取支付通道列表
+onMounted(() => {
+  getChannelList();
+});
 </script>
 
 <style lang="scss" scoped></style>

+ 7 - 1
src/locales/en-US/index.json

@@ -818,7 +818,13 @@
       "rejectReasonLength": "Reject reason length should be 1 to 200 characters",
       "approveSuccess": "Approve Success",
       "rejectSuccess": "Reject Success",
-      "auditFailed": "Audit Failed"
+      "auditFailed": "Audit Failed",
+      "paymentChannel": "Payment Channel",
+      "channelCode": "Channel Code",
+      "selectPaymentChannel": "Please select payment channel",
+      "selectChannelCode": "Please select channel code",
+      "paymentChannelRequired": "Please select payment channel",
+      "channelCodeRequired": "Please select channel code"
     },
     "dashboard": {
       "dashboard": "Dashboard",

+ 7 - 1
src/locales/zh-CN/index.json

@@ -761,7 +761,13 @@
       "rejectReasonLength": "拒绝原因长度在1到200个字符",
       "approveSuccess": "审核通过成功",
       "rejectSuccess": "审核拒绝成功",
-      "auditFailed": "审核失败"
+      "auditFailed": "审核失败",
+      "paymentChannel": "支付通道",
+      "channelCode": "通道代码",
+      "selectPaymentChannel": "请选择支付通道",
+      "selectChannelCode": "请选择通道代码",
+      "paymentChannelRequired": "请选择支付通道",
+      "channelCodeRequired": "请选择通道代码"
     },
     "finance": {
       "financeReport": "财务报表",