Prechádzať zdrojové kódy

分账模块待补全

学习?学个屁 1 týždeň pred
rodič
commit
007427170b

+ 11 - 0
src/views/AccountManagement/Merchant/Merchant.api..ts

@@ -9,7 +9,10 @@ enum Api {
   edit = '/merchant/update',
   queryById = '/merchant/findById',
   resetPassword = '/merchant/reset',
+  editSitePayInfo = '/appSite/editSitePayInfo',
+  querySitePayInfo = '/appSite/querySitePayInfoById',
 }
+
 /**
  * 列表接口
  * @param params
@@ -32,3 +35,11 @@ export const getDetaile = (params) => {
 export const resetPassword = (params) => {
   return defHttp.get({ url: Api.resetPassword, params });
 };
+
+export const putEditSitePayInfo = (params) => {
+  return defHttp.put({ url: Api.editSitePayInfo, params });
+};
+
+export const getSitePayInfo = (params) => {
+  return defHttp.get({ url: Api.querySitePayInfo, params });
+};

+ 91 - 16
src/views/AccountManagement/Merchant/components/UnionPayModel.vue

@@ -1,16 +1,17 @@
 <template>
-  <BasicModal v-bind="$attrs" @register="registerModal" destroyOnClose title="银联商户" :width="800">
-    <a-button type="primary" preIcon="ant-design:plus-outlined" @click="router.push({ path: '/AccountManagement/Merchant/UnionPay' })">
-      新建</a-button
-    >
-    <!-- <BasicTable @register="registerTable" :rowSelection="rowSelection">
-      <template #tableTitle>
-        <a-button type="primary" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button>
-      </template>
-      <template #action="{ record }">
-        <TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)" />
-      </template>
-    </BasicTable> -->
+  <BasicModal v-bind="$attrs" @register="registerModal" destroyOnClose title="微信支付" :width="800">
+    <!--    <a-button type="primary" preIcon="ant-design:plus-outlined" @click="router.push({ path: '/AccountManagement/Merchant/UnionPay' })">-->
+    <!--      新建</a-button-->
+    <!--    >-->
+    <!--   <BasicTable @register="registerTable" :rowSelection="rowSelection">-->
+    <!--      <template #tableTitle>-->
+    <!--        <a-button type="primary" @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增</a-button>-->
+    <!--      </template>-->
+    <!--      <template #action="{ record }">-->
+    <!--        <TableAction :actions="getTableAction(record)" :dropDownActions="getDropDownAction(record)" />-->
+    <!--      </template>-->
+    <!--    </BasicTable>-->
+    <BasicForm @register="registerForm" @submit="handleSubmit" />
   </BasicModal>
 </template>
 
@@ -18,22 +19,96 @@
   import { InputNumber, FormItem } from 'ant-design-vue';
   import { ref, computed, unref } from 'vue';
   import { BasicModal, useModalInner } from '/@/components/Modal';
-  import { BasicForm, useForm } from '/@/components/Form/index';
+  import { useForm, BasicForm, FormSchema } from '/@/components/Form';
   import { formSchema, columns } from '../Merchant.data';
-  import { saveOrUpdate } from '../Merchant.api.';
+  import { saveOrUpdate, putEditSitePayInfo,getSitePayInfo } from '../Merchant.api.';
   import { useMessage } from '/@/hooks/web/useMessage';
   import { useListPage } from '/@/hooks/system/useListPage';
   import { useRouter } from 'vue-router';
+
   const router = useRouter();
   const { createMessage } = useMessage();
   // Emits声明
   const emit = defineEmits(['register', 'success']);
+  const formSchemas: FormSchema[] = [
+    {
+      label: '微信支付商户号',
+      field: 'mchId',
+      component: 'Input',
+      componentProps: {
+        placeholder: '请输入微信支付商户号',
+      },
+      required: true,
+    },
+    {
+      label: '工商信用代码',
+      field: 'orgIdCardNum',
+      component: 'Input',
+      componentProps: {
+        placeholder: '请输入工商信用代码',
+      },
+      required: true,
+    },
+    {
+      label: '商户名称',
+      field: 'mchName',
+      component: 'Input',
+      componentProps: {
+        placeholder: '请输入商户名称',
+      },
+      required: true,
+    },
+  ];
+  /**
+   * BasicForm绑定注册;
+   */
+  const [registerForm, { getFieldsValue, validate,setFieldsValue}] = useForm({
+    //注册表单列
+    schemas: formSchemas,
+    showResetButton: false,
+    submitButtonOptions: { text: '提交', preIcon: ''},
+  });
 
+  const handleSubmit = async () => {
+    try {
+      await validate();
+      setModalProps({ confirmLoading: true });
+      const formData = getFieldsValue();
+      if (currentRecordId.value) {
+        formData.siteId = currentRecordId.value;
+      }
+      await putEditSitePayInfo(formData);
+      closeModal();
+      emit('success');
+    } catch ({ errorFields }) {
+      return Promise.reject(errorFields);
+    } finally {
+      setModalProps({ confirmLoading: false });
+    }
+  };
   //表单赋值
+  const currentRecordId = ref();
   const [registerModal, { setModalProps, closeModal }] = useModalInner(async (data) => {
     //重置表单
-    setModalProps({ confirmLoading: false, showCancelBtn: !!data?.showFooter, showOkBtn: !!data?.showFooter, maskClosable: false });
-
+    setModalProps({
+      confirmLoading: false,
+      showCancelBtn: !!data?.showFooter,
+      showOkBtn: !!data?.showFooter,
+      maskClosable: false,
+    });
+    if (data?.record?.id) {
+      currentRecordId.value = data.record.id;
+      try {
+        // 调用接口获取数据
+        const res = await getSitePayInfo({ id: data.record.id });
+        if (res) {
+          // 数据回显
+          setFieldsValue(res);
+        }
+      } catch (error) {
+        console.error('获取支付信息失败:', error);
+      }
+    }
     // 隐藏底部时禁用整个表单
     // setProps({ disabled: !data?.showFooter });
   });

+ 2 - 1
src/views/AccountManagement/Merchant/index.vue

@@ -85,6 +85,7 @@
     });
   }
   function handleUnplay(record: Recordable) {
+    console.log('handleUnplay',record)
     openUnPlayModal(true, {
       record,
       isUpdate: false,
@@ -107,7 +108,7 @@
         onClick: handleEdit.bind(null, record),
       },
       {
-        label: '银联账户',
+        label: '微信支付',
         onClick: handleUnplay.bind(null, record),
       },
       {

+ 35 - 3
src/views/orderManagement/order/index.vue

@@ -31,13 +31,13 @@
     <template #price="{ record }">
       <div class="h-20px"></div>
       <div class="mt3 h-90px flex flex-col justify-center border-b border-solid" v-for="item in record.orderProInfoList" :key="item.id">
-        <div class="flex items-center" v-if="item.price>0">
+        <div class="flex items-center" v-if="item.price > 0">
           <div>¥{{ item.price || 0 }}</div>
           <div class="line-through ml-3 text-gray">¥{{ item.originalPrice || 0 }}</div>
         </div>
         <div class="flex items-center" v-else>
           <div>¥{{ item.originalPrice || 0 }}</div>
-<!--          <div class="line-through ml-3 text-gray">¥{{ item.originalPrice || 0 }}</div>-->
+          <!--          <div class="line-through ml-3 text-gray">¥{{ item.originalPrice || 0 }}</div>-->
         </div>
         <div class="text-gray">x{{ item.quantity }}</div>
       </div>
@@ -63,6 +63,11 @@
         <div v-else>无</div>
       </div>
     </template>
+    <template #sharing="{ record }">
+      <a-tag color="pink" v-if="record.profitSharingStatus == 0">未分账</a-tag>
+      <a-tag color="cyan" v-if="record.profitSharingStatus == 1">分账中</a-tag>
+      <a-tag color="green" v-if="record.profitSharingStatus == 2">已分账</a-tag>
+    </template>
   </BasicTable>
   <orderModelView @register="registerModal"></orderModelView>
   <a-modal v-model:open="openExportData" title="导出赛事名单" @ok="handleExportData" :confirmLoading="exportLoading">
@@ -79,9 +84,11 @@
   import { useModal } from '/@/components/Modal';
   import { useListPage } from '/@/hooks/system/useListPage';
   import { columns, searchFormSchema, afterSaleStatus, orderStatus } from './order.data';
-  import { list, exportData, queryEvents, queryProject } from './order.api';
+  import { list, exportData, queryEvents, queryProject, putProfitSharing } from './order.api';
   import { useUserStore } from '/@/store/modules/user';
+  import { useMessage } from '/@/hooks/web/useMessage';
 
+  const { createWarningModal } = useMessage();
   const queryParam = reactive<any>({});
   const userStore = useUserStore();
   //注册model
@@ -185,6 +192,26 @@
     });
   }
 
+  /**
+   * 确认分账
+   */
+  function handleConfirm(record) {
+    createWarningModal({
+      title: '提示',
+      content: '是否确认进行分账?',
+      okText: '确认',
+      cancelText: '取消',
+      okCancel: true,
+      onOk: async () => {
+        await putProfitSharing({ orderCode: record.orderCode });
+        await reload();
+      },
+      onCancel: () => {
+        reload();
+      },
+    });
+  }
+
   /**
    * 操作栏
    */
@@ -195,6 +222,11 @@
         onClick: handleEdit.bind(null, record),
         // auth: 'feedback:nm_feedback:edit',
       },
+      {
+        label: '分账',
+        onClick: handleConfirm.bind(null, record),
+        isShow: record.orProfitSharing == 1,
+      },
     ];
   }
 

+ 5 - 0
src/views/orderManagement/order/order.api.ts

@@ -6,6 +6,7 @@ enum Api {
   queryEvents = '/app/appOrder/exportConditionByName',
   queryProject = '/app/appOrder/exportConditionByProjectName',
   exportData = '/app/appOrder/exportCondition',
+  profitSharing = '/app/appOrder/profitSharing',
 }
 
 /**
@@ -17,6 +18,10 @@ export const list = (params) => defHttp.post({ url: Api.list, params });
 export const queryByid = (orderId) => defHttp.get<AppOrderInfoVO>({ url: `${Api.queryByid}/${orderId}` });
 export const queryEvents = (params) => defHttp.get({ url: Api.queryEvents, params });
 export const queryProject = (params) => defHttp.get({ url: Api.queryProject, params });
+export const putProfitSharing = (params) => {
+  const queryString = new URLSearchParams(params).toString();
+  return defHttp.put({ url: `${Api.profitSharing}?${queryString}` });
+};
 export const exportData = (params) =>
   defHttp.post(
     {

+ 7 - 0
src/views/orderManagement/order/order.data.ts

@@ -40,6 +40,13 @@ export const columns: BasicColumn[] = [
     width: 120,
     slots: { customRender: 'After' },
   },
+  {
+    title: '分账状态',
+    align: 'center',
+    dataIndex: 'profitSharingStatus',
+    width: 120,
+    slots: { customRender: 'sharing' },
+  },
   {
     title: '实付金额',
     align: 'center',