|  | @@ -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 });
 | 
	
		
			
				|  |  |    });
 |