Explorar o código

付款单-功能联调

jingbb hai 4 meses
pai
achega
20ddb8e75e

+ 110 - 41
src/views/purchase/payment/components/paymentForm.vue

@@ -16,13 +16,23 @@
 						</a-col>
             <a-col :span="12">
 							<a-form-item label="付款类型(pay type)" v-bind="validateInfos.payType" id="saleInvoiceForm-payType" name="payType" >
-                <JDictSelectTag v-model:value="formData.payType" placeholder="请选择" dictCode="pay_type" style="width: 100%;"/>
+                <JDictSelectTag v-model:value="formData.payType" placeholder="请选择" dictCode="pay_type" style="width: 100%;" @change="handleChange"/>
 							</a-form-item>
 						</a-col>
 						<a-col :span="12">
 							<a-form-item label="申请单(apply bill)" v-bind="validateInfos.applyBill" id="saleInvoiceForm-applyBill" name="applyBill" >
-                <JSelectInput   v-model:value="formData.applyBill"  placeholder="请选择" :options="payeeOption" style="width: 50%;margin-right: 1%;"></JSelectInput>
-                 <a-button type="primary" style="width: 35%;" > 查看详情(view detail)</a-button>
+                <ApiSelect
+                  :api="applyBillList"
+                  showSearch
+                  v-model:value="formData.applyBill"
+                  :filterOption="false"
+                  resultField="records"
+                  labelField="billCode"
+                  valueField="billCode"
+                  :params='{pageSize:-1}'
+                  @change="changeApplyBill"
+                />
+                 <a-button type="primary" style="width: 35%;" @click="viewDetail"> 查看详情(view detail)</a-button>
 							</a-form-item>
 						</a-col>
             <a-col :span="12">
@@ -56,37 +66,41 @@
 							</a-form-item>
 						</a-col>
             <a-col :span="12">
-							<a-form-item label="申请金(apply money)" v-bind="validateInfos.applyMoney" id="saleInvoiceForm-applyMoney" name="applyMoney" >
+							<a-form-item label="申请金(apply money)" v-bind="validateInfos.applyMoney" id="saleInvoiceForm-applyMoney" name="applyMoney" >
 								<a-input v-model:value="formData.applyMoney" placeholder="请输入"  allow-clear AutoComplete="off" disabled></a-input>
 							</a-form-item>
 						</a-col>
             <a-col :span="12">
-							<a-form-item label="付款金(payment)" v-bind="validateInfos.payment" id="saleInvoiceForm-payment" name="payment" >
-								<a-input v-model:value="formData.payment" placeholder="请输入"  allow-clear AutoComplete="off" ></a-input>
+							<a-form-item label="付款金(payment)" v-bind="validateInfos.paymentMoney" id="saleInvoiceForm-paymentMoney" name="paymentMoney" >
+								<a-input v-model:value="formData.paymentMoney" placeholder="请输入"  allow-clear AutoComplete="off" ></a-input>
 							</a-form-item>
 						</a-col>
             <a-col :span="12">
-							<a-form-item label="预付款比例(prepayment ratio)" v-bind="validateInfos.prepaymentRatio" id="saleInvoiceForm-prepaymentRatio" name="prepaymentRatio" >
-								<a-input v-model:value="formData.prepaymentRatio" placeholder="请输入"  allow-clear AutoComplete="off" disabled></a-input>
+							<a-form-item label="预付款比例(prepayment ratio)" v-bind="validateInfos.paymentRate" id="saleInvoiceForm-paymentRate" name="paymentRate" >
+								<a-input v-model:value="formData.paymentRate" placeholder="请输入"  allow-clear AutoComplete="off" disabled></a-input>
 							</a-form-item>
 						</a-col>
           </a-row>
         </a-form>
       </template>
     </JFormContainer>
+    <purPaymentRequestFormModal  @register="registerModal" v-if="formData.payType=='采购付款申请'"></purPaymentRequestFormModal>
+    <commissionPayRequestFormModal  @register="registerModal" v-if="formData.payType=='佣金付款申请'"></commissionPayRequestFormModal>
   </a-spin>
 </template>
 
 <script lang="ts">
-  import { defineComponent, ref, reactive, computed, toRaw, onMounted } from 'vue';
+  import { defineComponent, ref, reactive, computed, toRaw, unref } from 'vue';
   import { defHttp } from '/@/utils/http/axios';
-  import {queryDataById, saveOrUpdate } from '../paymentForm.api';
+  import {queryDataById, saveOrUpdate,listPurPay,listCommissionPay } from '../paymentForm.api';
   import { JVxeTable } from '/@/components/jeecg/JVxeTable';
+  import { useValidateAntFormAndTable } from '/@/hooks/system/useJvxeMethods';
   import JFormContainer from '/@/components/Form/src/container/JFormContainer.vue';
-  import JUpload from '/@/components/Form/src/jeecg/components/JUpload/JUpload.vue';
-  import { JDictSelectTag} from '/@/components/Form';
-  import JSelectInput from '/@/components/Form/src/jeecg/components/JSelectInput.vue';
+  import { ApiSelect,JDictSelectTag } from '/@/components/Form';
   import { Form,message } from 'ant-design-vue';
+  import {useModal} from '/@/components/Modal';
+  import purPaymentRequestFormModal from '../../purPaymentRequest/components/purPaymentRequestFormModal.vue'
+  import commissionPayRequestFormModal from '../../commissionPayRequest/components/commissionPayRequestFormModal.vue'
   import moment from 'moment';
   const useForm = Form.useForm;
   export default defineComponent({
@@ -94,9 +108,10 @@
     components:{
       JVxeTable,
 			JFormContainer,
-      JUpload,
+      ApiSelect,
       JDictSelectTag,
-      JSelectInput,
+      purPaymentRequestFormModal,
+      commissionPayRequestFormModal
     },
     props:{
       formDisabled:{
@@ -108,24 +123,28 @@
     },
     emits:['success'],
     setup(props, {emit}) {
+      const [registerModal, {openModal}] = useModal();
       const loading = ref(false);
       const formRef = ref();
-      var payeeOption =ref([]);
+      var applyBillList =ref();
       const formData = reactive<Record<string, any>>({
         id: '',
         status: undefined,
         delFlag: undefined,
         billDate: moment(new Date()).format('YYYY-MM-DD'),   
         billCode: '',   
-        commission: '',   
-        payee: '',   
-        expectedPaymentDate: '',   
-        currency: '',   
+        payType: '',   
+        applyBill: '',   
+        applyBillId:'',
+        seller: '',   
+        sellerId: '',   
+        currency:'',
         openingBank: '',   
-        bankAccount: '',   
-        invoice: '',   
+        bankAccount: '',    
         notes: '',   
-        swiftCode:''        
+        swiftCode:'',
+        applyMoney:'',
+        paymentRate:'' 
       });
 
       //表单验证
@@ -156,13 +175,11 @@
       //新增方法
       function add() {
         resetFields();
-        getPayeeOptions()
       }
       //编辑方法
       async function edit(row) {
         //主表数据
         await queryMainData(row.id);
-        getPayeeOptions()
       }
       //获取主表
       async function queryMainData(id) {
@@ -177,6 +194,7 @@
         //赋值
         Object.assign(formData,tmpData);
       }
+      const {transformData} = useValidateAntFormAndTable();
       //获取表单信息
       async function getFormData() {
         try {
@@ -220,20 +238,64 @@
       function handleFormChange(key, value) {
         formData[key] = value;
       }
-      //获取收款人列表
-      function getPayeeOptions(){
-          let params = {pageSize:'-1',status:1}
-          defHttp.get({url:'/cuspCode/cuspIntermediator/list',params}, { isTransformResponse: false }).then(res=>{
-            if(res){
-              payeeOption.value = []
-              res.result.records.forEach(item=>{
-                payeeOption.value.push({
-                  label: item.name,
-                  value: item.id,
-                })
-              })
-            }
-          })
+      //切换付款类型
+      function handleChange(data){
+        formData.applyBillId =''
+        formData.applyBill=''
+        if(data=='采购付款申请'){
+          applyBillList.value=listPurPay
+        }else if(data=='佣金付款申请'){
+          applyBillList.value=listCommissionPay
+        }else if(data=='佣金预付款'){ //待开发
+
+        }else if(data=='采购预付款'){//待开发
+          
+        }
+      }
+      async function changeApplyBill(value){
+        var result = {}
+        var param={billCode:value}
+        if(formData.payType=='采购付款申请'){
+          result=await listPurPay(param)    
+        }else if(formData.payType=='佣金付款申请'){
+          result=await listCommissionPay(param)    
+        }else if(formData.payType=='佣金付款申请'){//待开发
+   
+        }else if(formData.payType=='佣金付款申请'){  //待开发
+
+        }
+        formData.applyBillId =result.records[0].id
+        formData.seller =result.records[0].supplierName
+        formData.sellerId =result.records[0].supplier
+        formData.currency =result.records[0].currency
+        formData.openingBank =result.records[0].openingBank
+        formData.bankAccount =result.records[0].bankAccount
+        formData.swiftCode =result.records[0].swiftCode
+        formData.applyMoney =result.records[0].approveMoney	
+      }
+      async function viewDetail(){
+        if(formData.applyBillId==''){
+          message.warning('请先选择申请单!')
+        }else{
+          var record = {}
+          var param={id:formData.applyBillId}
+          if(formData.payType=='采购付款申请'){
+            record=await listPurPay(param)             
+          }else if(formData.payType=='佣金付款申请'){
+            record=await listCommissionPay(param)   
+          }else if(formData.payType=='佣金付款申请'){//待开发
+    
+          }else if(formData.payType=='佣金付款申请'){  //待开发
+
+          }
+          record = record.records[0]
+          openModal(true, {
+                record,
+              isUpdate: true,
+              showFooter: false,
+              isRevise: false
+            });
+        }
       }
       return {
         validatorRules,
@@ -249,7 +311,11 @@
         add,
         edit,
         formRef,
-        payeeOption,
+        applyBillList,
+        handleChange,
+        changeApplyBill,
+        viewDetail,
+        registerModal,
       }
     }
   });
@@ -273,5 +339,8 @@
   /deep/.ant-form-item{
     margin-bottom: 8px !important;
   }
-      
+  /deep/#saleInvoiceForm-applyBill .ant-select.ant-select-in-form-item{
+    width:50% !important;
+    margin-right: 1% !important;
+  }
 </style>

+ 18 - 10
src/views/purchase/payment/paymentForm.api.ts

@@ -4,16 +4,18 @@ import { useMessage } from "/@/hooks/web/useMessage";
 const { createConfirm } = useMessage();
 
 enum Api {
-  list = '/saleCode/saleQuotation/list',
-  save='/saleCode/saleQuotation/add',
-  edit='/saleCode/saleQuotation/edit',
-  deleteOne = '/saleCode/saleQuotation/delete',
-  deleteBatch = '/saleCode/saleQuotation/deleteBatch',
-  importExcel = '/saleCode/saleQuotation/importExcel',
-  exportXls = '/saleCode/saleQuotation/exportXls',
-  queryDataById = '/saleCode/saleQuotation/queryById',
-  submitBatch='/saleCode/saleQuotation/submitBatch',
-  cancelSubmitBatch='/saleCode/saleQuotation/returnSubmitBatch',
+  list = '/purCode/purPayment/list',
+  save='/purCode/purPayment/add',
+  edit='/purCode/purPayment/edit',
+  deleteOne = '/purCode/purPayment/delete',
+  deleteBatch = '/purCode/purPayment/deleteBatch',
+  importExcel = '/purCode/purPayment/importExcel',
+  exportXls = '/purCode/purPayment/exportXls',
+  queryDataById = '/purCode/purPayment/queryById',
+  submitBatch='/purCode/purPayment/submitBatch',
+  cancelSubmitBatch='/purCode/purPayment/returnSubmitBatch',
+  purPayList='/purCode/purPaymentRequest/list',
+  commissionPayList='/purCode/purCommissionRequest/list',
 }
 /**
  * 导出api
@@ -106,3 +108,9 @@ export const cancelBatchSubmit = (params, handleSuccess) => {
     }
   });
 }
+//采购付款申请列表
+export const listPurPay = (params) =>
+  defHttp.get({url: Api.purPayList, params});
+//佣金付款申请列表
+export const listCommissionPay = (params) =>
+  defHttp.get({url: Api.commissionPayList, params});

+ 5 - 5
src/views/purchase/payment/paymentForm.data.ts

@@ -26,7 +26,7 @@ export const columns: BasicColumn[] = [
     align:"center",
     ellipsis:true,
     width:250,
-    dataIndex: 'sellerName'
+    dataIndex: 'seller'
    },
    {
     title: '申请金额(apply money)',
@@ -36,15 +36,15 @@ export const columns: BasicColumn[] = [
     dataIndex: 'applyMoney'
    },
    {
-    title: '币种(currrncy)',
+    title: '币种(currency)',
     align:"center",
     ellipsis:true,
-    dataIndex: 'currrncy'
+    dataIndex: 'currency'
    },
    {
     title: '付款金额(payment)',
     align:"center",
-    dataIndex: 'payment',
+    dataIndex: 'paymentMoney',
     ellipsis:true,
     width:250,
 
@@ -73,7 +73,7 @@ export const paymentDetailsColumns: JVxeColumn[] = [
   },
   {
     title: '申请金额(approve money)',
-    key: 'approveMoney',
+    key: 'applyMoney',
     type: JVxeTypes.normal,
     placeholder: '请输入${title}',
     defaultValue:'',

+ 7 - 7
src/views/purchase/payment/paymentList.vue

@@ -26,7 +26,7 @@
               <a-col :lg="8">
                 <a-form-item name="seller">
                   <template #label><span title="销方(seller)">销方(seller)</span></template>
-                  <a-input placeholder="请输入" v-model:value="queryParam.sellerName" allow-clear AutoComplete="off"></a-input>
+                  <a-input placeholder="请输入" v-model:value="queryParam.seller" allow-clear AutoComplete="off"></a-input>
                 </a-form-item>
               </a-col>
               <a-col :lg="8">
@@ -56,20 +56,20 @@
      <BasicTable @register="registerTable" :rowSelection="rowSelection" size="small" >
        <!--插槽:table标题-->
         <template #tableTitle>
-            <a-button type="primary" v-auth="'saleCode:sale_order:add'"  @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增(add)</a-button>
-            <a-button  type="primary" v-auth="'saleCode:sale_order:exportXls'"  preIcon="ant-design:export-outlined" @click="onExportXls"> 导出(export)</a-button>
+            <a-button type="primary" v-auth="'purCode:pur_payment:add'"  @click="handleAdd" preIcon="ant-design:plus-outlined"> 新增(add)</a-button>
+            <a-button  type="primary" v-auth="'purCode:pur_payment:exportXls'"  preIcon="ant-design:export-outlined" @click="onExportXls"> 导出(export)</a-button>
             <a-button  type="primary"  @click="submit" > 提交(submit)</a-button>
             <a-button  type="primary"  @click="cancelSubmit"> 取消提交(cancelSubmit)</a-button>
             <a-dropdown v-if="selectedRowKeys.length > 0">
                 <template #overlay>
                   <a-menu>
-                    <a-menu-item key="1" @click="batchHandleDelete"  v-auth="'saleCode:sale_order_form:deleteBatch'">
+                    <a-menu-item key="1" @click="batchHandleDelete"  v-auth="'purCode:pur_payment:deleteBatch'">
                       <Icon icon="ant-design:delete-outlined"></Icon>
                       删除(delete)
                     </a-menu-item>
                   </a-menu>
                 </template>
-                <a-button v-auth="'saleCode:sale_order:delete'">批量操作
+                <a-button v-auth="'purCode:pur_payment:deleteBatch'">批量操作
                   <Icon icon="mdi:chevron-down"></Icon>
                 </a-button>
           </a-dropdown>
@@ -194,7 +194,7 @@
            {
              label: '编辑(edit)',
              onClick: handleEdit.bind(null, record),
-             auth: 'saleCode:sale_order:edit',
+             auth: 'purCode:pur_payment:edit',
              ifShow: record.submit=='0'||!record.submit
            },
            {
@@ -221,7 +221,7 @@
                confirm: handleDelete.bind(null, record),
                placement: 'topLeft'
              },
-             auth: 'saleCode:sale_order:delete',
+             auth: 'purCode:pur_payment:delete',
              ifShow: record.submit=='0'||!record.submit
            }
          ]