소스 검색

Merge branch 'master' of http://git.dongkesoft.com:9001/iBOSS-2.0-Mini/iboss-mini-web

changhaoning 2 년 전
부모
커밋
183b58bc58

+ 4 - 0
src/api/pages/common/common.js

@@ -99,6 +99,10 @@ export default {
     getMultiOrg: 'get_multi_org',
     // 获取多业务员
     getMultiStaff: 'get_multi_staff',
+    // 获取组织仓库
+    getMultiWarehouse: 'get_multi_warehouse',
+    // 获取组织资金账户
+    getMultiMoneyAccount: 'get_multi_moneyAccount',
   },
 }
 

+ 1 - 0
src/api/pages/fin/account.js

@@ -6,6 +6,7 @@
 export default {
   accountService: {
     prefix: '/mdm-server/mac/account/',
+    getReceivableAccountItem: 'get_receivable_account_item',
   }
 }
 

+ 27 - 0
src/api/pages/fin/receipt.js

@@ -0,0 +1,27 @@
+/**
+ * @desc   : 客户收款服务
+ * @author : 付斌
+ * @date   : 2024-01-31 14:37
+ */
+export default {
+  receiptService: {
+    prefix: '/mdm-server/mac/recPay/',
+    selectRpInfoById: 'select_rp_info_by_id',
+    getRpForUpdate: 'get_rp_for_update',
+    insertReceipt: 'insert_receipt',
+    insertRefund: 'insert_refund',
+  }
+}
+
+/**
+ * @desc   : 客户收款路由
+ * @author : 付斌
+ * @date   : 2024-02-01 16:03
+ */
+export const routeUrl = {
+  receipt: {
+    receipt: {key: 'receipt', routeName: 'receipt-add'},
+    refund: {key: 'refund', routeName: 'receipt-refund'},
+    invalid: {key: 'invalid', method: 'invalid'},
+  }
+}

+ 0 - 20
src/api/pages/sale/receipt.js

@@ -1,20 +0,0 @@
-/**
-* @desc   : 客户收款服务
-* @author : 常皓宁
-* @date   : 2024/2/22 15:10
-*/
-export default {
-  receiptService: {
-  }
-}
-
-/**
-* @desc   : 客户收款路由
-* @author : 常皓宁
-* @date   : 2024/2/22 15:10
-*/
-export const routeUrl = {
-  receipt: {
-    add: {key: 'add', method: 'add'},
-  }
-}

+ 21 - 27
src/components/business/multi-select/multi-select.vue

@@ -254,7 +254,6 @@ export default {
     orderId(n, o) {
       if(n){
         // 如果Id改变,需要重新查询数据库
-        console.log('n',n)
         this.getDataTable();
       }
     },
@@ -501,8 +500,9 @@ export default {
       param.leafFlag = this.leafFlag
       // 不分页
       param.pageSize = null
-      // 如果是结算方式或仓库,需要赋值给
-      if (this.type === this.$config.MagnifierType.settlementType || this.type === this.$config.MagnifierType.warehouse) {
+      // 如果是结算方式或仓库、资金账户,需要赋值给
+      if (this.type === this.$config.MagnifierType.settlementType || this.type === this.$config.MagnifierType.warehouse
+            ||this.type === this.$config.MagnifierType.moneyAccount) {
         param['orgId'] = this.orderId;
         if (this.organizationFlag) {
           param.organizationFlag = true;
@@ -532,7 +532,6 @@ export default {
             // 如果value传递的不是数组,那么需要处理成数组
 
             this.value.forEach(it => {
-              console.log('va',this.value,arr,this.selectKey,it)
               filterRows = arr.filter(row => row[this.selectKey] === it[this.selectKey])
               if (filterRows && filterRows.length > 0) {
                 //给第一个行赋值 为了滚动定位 TODO
@@ -955,7 +954,7 @@ export default {
       // 仓库
       else if (self.type === self.$config.MagnifierType.warehouse) {
         self.service = this.$service.commonService
-        self.methodsNameDetail = 'getWarehouseByPage' //详细函数名称,目前对应后台的查询接口名称
+        self.methodsNameDetail = 'getMultiWarehouse' //详细函数名称,目前对应后台的查询接口名称
         self.searchContent = [
           {itemCode: 'whName'},                       //查询条件
           {itemCode: 'whCode'},
@@ -967,38 +966,30 @@ export default {
         self.columns = [
           {field: 'whName', width: '100'},          //查询出来的字段以及宽度
           {field: 'whCode', width: '100'},
-          {field: 'mmCode', width: '100'},
-          {field: 'directorName', width: '100'},
-          {field: 'contactsName', width: '100'},
-          {field: 'contactNo', width: '100'},
-          {field: 'cpName', width: '100'},
+          {field: 'contactPhone', width: '100'},
+          {field: 'supervisor', width: '100'},
           {field: 'remarks', width: '100'},
-          {field: 'flgDefault', title: "flgDefaultWh", width: '100', type: 'switch', disabled: false},
+          {field: 'ownerFlag', width: '40', type: 'switch', disabled: false},
         ]
       }
       //资金账号
-      else if (self.type === self.$config.MagnifierType.capitalAccount) {
+      else if (self.type === self.$config.MagnifierType.moneyAccount) {
         self.service = this.$service.commonService
-        self.methodsName = 'getCapitalAccount'
-        self.methodsNameDetail = 'getCapitalAccountByPage'
+        self.methodsNameDetail = 'getMultiMoneyAccount'
         self.searchContent = [
-          {itemCode: 'capitalName'},
-          {itemCode: 'capitalType'},
+          {itemCode: 'macCode'},
+          {itemCode: 'macName'},
         ]
-        self.selectKey = 'capitalId'
-        self.selectLabel = 'capitalName'
+        self.selectKey = 'macId'
+        self.selectLabel = 'macName'
         self.modalWidth = 700
         self.colCount = 2
         self.columns = [
-          {field: 'capitalName', width: '100'},
-          {field: 'mmCode', width: '100'},
-          {field: 'capitalType', width: '100'},
-          {field: 'cpName', width: '100'},
-          {field: 'openingCompany', width: '100'},
-          {field: 'openingBank', width: '100'},
-          {field: 'bankAccount', width: '100'},
+          {field: 'macCode', width: '100'},
+          {field: 'macName', width: '100'},
+          {field: 'macType', width: '100'},
           {field: 'remarks', width: '100'},
-          {field: 'flgDefault', title: 'flgDefaultCa', width: '100', type: 'switch', disabled: false},
+          {field: 'ownerFlag', width: '40', type: 'switch', disabled: false},
         ]
       }
     }
@@ -1012,7 +1003,10 @@ export default {
     this.setDefaultValue();
   },
   mounted() {
-    // this.getDataTable()
+    // 如果orderId有值,查询数据
+    if(this.orderId){
+      this.getDataTable()
+    }
   }
 }
 </script>

+ 1 - 1
src/components/table/dk-table/dk-table.vue

@@ -838,7 +838,7 @@ export default {
           })
         }
       } else {
-        count = this.pageInfo.total ? this.pageInfo.total : this.dataFinal.length;
+        count = this.pageInfo.total ? this.pageInfo.total : this.dataFinal?.length;
       }
       return count;
     },

+ 1 - 0
src/components/table/edit-table/edit-table.vue

@@ -1652,6 +1652,7 @@ export default {
         //TODO 负号设置
         // 如果是这里必须是负数,需要自动转为负数
         let neg = typeof colItem.negative == 'function' ? colItem.negative() : colItem.negative;
+        console.log('e',colItem)
         if (neg && parseFloat(row[field]) > 0) {
           this.tableData[rowIndex][field] = -1 * parseFloat(row[field]);
         }

+ 3 - 1
src/config/index.js

@@ -552,7 +552,9 @@ export default {
     //供应商
     supplier: 'supplier',
     // 品牌
-    brand: 'brand',
+    brand:'brand',
+    // 资金账户 宋扬
+    moneyAccount:'moneyAccount',
     //供应商与对象
     supplierAndCustomer: 'supplierAndCustomer',
     //组织机构

+ 5 - 2
src/locale/lang/zh-CN.js

@@ -96,6 +96,7 @@ export const button = {
   receipt: '收款',
   refund: '退款',
   unFreeze:'解冻',
+  chooseReceivableInvoice:'选择应收款单',
 }
 
 /**
@@ -148,6 +149,7 @@ export const columns = {
   staffRelation: '绑定员工',
   goodsInformation: '商品信息',
   customerAccount: '客户收款',
+  receivableInvoice: '应收款单',
   conditionInformation: '查询条件设置',
   sqlInformation: 'SQL设置',
   tableInformation: '表格设置',
@@ -351,8 +353,8 @@ export const columns = {
   returnWareHouse:'退货仓库',
   priceStandard:'标价',
   skuSpec:'商品规格',
-  macCode:'账编码',
-  macName:'账名称',
+  macCode:'账编码',
+  macName:'账名称',
   macTypeName:'账号类别',
   macType:'账号类别',
   balance:'期初金额',
@@ -432,6 +434,7 @@ export const columns = {
   amtRec:'收款金额',
   ownerFlag:'主业务标识',
   receiptResidue:'客户可用余额',
+  macId:'资金账户',
 }
 
 /**

+ 1 - 0
src/mixins/index.js

@@ -170,6 +170,7 @@ export const indexMixin = {
                 // todo
                 // this.$router.push(url + '/' + this.$route.name + '-add');
               } else {
+                console.log('ttt',routeUrl)
                 if (routeUrl.chooseFlag && chooseKeys && chooseKeys.length > 0) {
                   // this.$router.push(url.endsWith('/') ? (url + chooseKeys[0]) : (url + '/' + chooseKeys[0]))
                   console.log('routeUrl',routeUrl)

+ 7 - 6
src/view/fin/receipt/add.vue

@@ -1,13 +1,14 @@
 <template>
-
+  <CommonForm type="add" ></CommonForm>
 </template>
 
 <script>
+import CommonForm from './form'
+
 export default {
-  name: "add"
+  name: 'receipt-add',
+  components:{
+    CommonForm
+  },
 }
 </script>
-
-<style scoped>
-
-</style>

+ 7 - 6
src/view/fin/receipt/edit.vue

@@ -1,13 +1,14 @@
 <template>
-
+  <CommonForm type="edit" ></CommonForm>
 </template>
 
 <script>
+import CommonForm from './form'
+
 export default {
-  name: "edit"
+  name: 'receipt-refund',
+  components:{
+    CommonForm
+  },
 }
 </script>
-
-<style scoped>
-
-</style>

+ 395 - 5
src/view/fin/receipt/form.vue

@@ -1,13 +1,403 @@
+<!-- @desc:销售订单新建  @auth:付斌  @time:2024/02/20 15:15 -->
 <template>
 
+  <div class="main-div" style="position: relative;">
+    <DkCollapse @on-change="changeCollapse" ref="collapse">
+      <DkPanel prop="essentialInformation">
+        <!--  单据信息  -->
+        <DkForm slot="content" ref="formInline" v-model="formData" :labelMaxWords="6" style="width:100%">
+          <!--客户电话-->
+          <DkFormItem prop="cusPhone" :required="true">
+            <SelectMagnifier v-model="formData.cusPhone" ref="cusPhone" :telephone="true"
+                             primary-key="objectId" :multiple="false"
+                             :type="this.$config.MagnifierType.customer"
+                             @on-input-blur="selectCustomer"
+                             @ok="selectCustomer"/>
+          </DkFormItem>
+          <!--客户名称-->
+          <DkFormItem prop="cusName">
+            <InputPop ref="cusName" :disabled="true" v-model="formData.cusName"/>
+          </DkFormItem>
+          <!--详细地址-->
+          <DkFormItem prop="addressFull">
+            <InputPop ref="addressFull" v-model="formData.addressFull" :disabled="true"/>
+          </DkFormItem>
+          <!--业务部门-->
+          <DkFormItem prop="orgId" :label="$t('orgId')">
+            <SelectMagnifier v-model="formData.orgId" :display-text="formData.orgName"
+                             :type="this.$config.MagnifierType.org"
+                             :initSearchFlag="true"
+                             :multiple="false" :disabled="true"/>
+          </DkFormItem>
+          <!--业务员-->
+          <DkFormItem prop="staffId" :label="$t('staffId')">
+            <SelectMagnifier v-model="formData.staffId" :display-text="formData.staffName"
+                             :type="this.$config.MagnifierType.staff"
+                             :initSearchFlag="true"
+                             :multiple="false" :disabled="true"/>
+          </DkFormItem>
+          <!--收款时间-->
+          <DkFormItem prop="accDate" :data-type="$config.dataType.date">
+            <DatePickerPop v-model="formData.accDate"
+                           :short-cut-flag="true"/>
+          </DkFormItem>
+          <!--客户可用余额-->
+          <DkFormItem prop="receiptResidue">
+            <InputNumberPop ref="receiptResidue" v-model="formData.receiptResidue" :disabled="true"/>
+          </DkFormItem>
+          <!--合计收款金额-->
+          <DkFormItem prop="sumAmtRec">
+            <InputNumberPop ref="sumAmtRec" v-model="formData.sumAmtRec" :disabled="true"/>
+          </DkFormItem>
+        </DkForm>
+      </DkPanel>
+      <!--客户收款-->
+      <DkPanel prop="customerAccount">
+        <div id="search-cond-div-goods-info" ref="search-cond-div-goods-info" slot="content">
+          <EditTable v-if="showEditTable" ref="receiptTable" :data="formData.itemList" showFooter
+                     major-field="receiptId"
+                     :height="this.tableHeight/2"
+                     :new-row-flag="true"
+                     :columns="receiptColumns"
+                     controlId="macId" @on-choose="getTotals" @changeValue="getTotals"/>
+        </div>
+      </DkPanel>
+
+      <BaseIndexButtonGroup ref="BaseIndexButtonGroup" id="BaseIndexButtonGroup">
+        <template #left>
+          <BaseIndexButton ref="chooseReceivableInvoice" name="chooseReceivableInvoice"
+                           @click="chooseReceivableInvoice"></BaseIndexButton>
+        </template>
+      </BaseIndexButtonGroup>
+
+      <!--应收款单-->
+      <DkPanel prop="receivableInvoice">
+        <div id="search-cond-div-receivable-info" ref="search-cond-div-goods-info" slot="content">
+          <EditTable ref="receivableTable" :data="formData.receivableList" showFooter
+                     major-field="receiptId"
+                     :height="this.tableHeight/2"
+                     :new-row-flag="true"
+                     :columns="receivableColumns"
+                     controlId="macId" @on-choose="getTotals" @changeValue="getTotals"/>
+        </div>
+      </DkPanel>
+    </DkCollapse>
+    <!--      下部分按钮区域-->
+    <DkSaveButton ref="saveButton" :loading="loading" @save="save(true)" @close="close"/>
+
+    <!-- 应收款单 -->
+    <DkModal :loading="loading" v-model="receivableModal" ref="modal_receivable"
+             @modalOk="receivableOk" :title='this.$t("应收款单")' :height="900" :width="1200">
+      <BaseIndexButtonGroup ref="BaseIndexButtonGroup2" id="BaseIndexButtonGroup2">
+        <template #left>
+          <BaseIndexButton ref="search" name="search" @click="getReceivableInvoice"></BaseIndexButton>
+          <BaseIndexButton ref="clear" name="clear"></BaseIndexButton>
+        </template>
+      </BaseIndexButtonGroup>
+      <DkTable :id="'table-'+$options.name" ref="detail-select" :pageFlag="false"
+               :data="tableData_receivable" :height="this.tableHeight" primaryKey="item_id" name="table">
+        <DkTableColumn field="biznisNo"/>
+        <DkTableColumn field="accDate"/>
+        <DkTableColumn field="recStatus"/>
+        <DkTableColumn field="amtShould"/>
+        <DkTableColumn field="amtHandle"/>
+        <DkTableColumn field="amtWaive"/>
+        <DkTableColumn field="amtResidue"/>
+      </DkTable>
+    </DkModal>
+  </div>
 </template>
 
 <script>
+import {formMixin} from '@/mixins/form'
+
 export default {
-  name: "form"
-}
-</script>
+  components: {},
+  mixins: [formMixin],
+  data() {
+    let self = this
+    return {
+      loading: false,
+      receivableModal: false,
+      tableData_receivable: null,
+      negativeFlag: false,
+      showEditTable: true,
+      //控制客户是否可以输入
+      readonlyFlag: true,
+      allCanNoEdit: false, //是否所有的都不允许编辑
+      // 画面表单数据
+      formData: {
+        accDate: new Date(),
+        rpType: null,
+        objectId: null,//客户Id
+        cusName: null,
+        cusPhone: null,
+        addressFull: null,              // 详细地址
+        staffId: null,
+        staffName: null,
+        staffCode: null,
+        orgId: null,
+        orgName: null,
+        orgCode: null,
+        sumAmtRec: null,
+        receiptResidue: null,
+        makeStaff: self.$store.state.user.id,
+        cpId: self.$store.state.user.cpId,
+        itemList: [],
+        receivableList: [],
+      },
+      receiptColumns: [
+        {
+          field: 'macName',
+          controlId: 'macId',
+          type: 'tableSelect',
+          width: 200,
+          dataType: self.$config.tableSelectType.moneyAccount,
+          fieldUpdate: self.$updateColumns.receiptChooseMac,
+          searchDetailFlag: true
+        },
+        // //账户余额
+        // {
+        //   field: 'balance',
+        //   type: 'disabled',
+        //   digits: 2,
+        //   title: this.$t('accountBalance'),
+        // },
+        //收款金额
+        {
+          field: 'amtRec',
+          type: 'number',
+          digits: 2,
+          negative: () => self.negativeFlag,
+          sum: true,
+        },
+        {
+          field: 'remarks', type: 'text', equal: true,
+        },
+      ],
+      receivableColumns: [
+        {field: 'biznisNo', type: 'disabled'},
+        {field: 'accDate', type: 'disabled'},
+        {field: 'recStatus', type: 'disabled'},
+        {field: 'amtShould', type: 'disabled'},
+        {field: 'amtHandle', type: 'disabled'},
+        {field: 'amtWaive', type: 'disabled'},
+        {field: 'amtResidue', type: 'disabled'},
+      ],
+    }
+  },
+  methods: {
+    chooseReceivableInvoice() {
+      this.receivableModal = true
+    },
+    /**
+     * @desc   : 获取应收款单
+     * @author : 付斌
+     * @date   : 2024-03-22 16:42
+     */
+    getReceivableInvoice() {
+      // 查询客户可用余额
+      let params = {
+        'objectId': this.formData.objectId
+      }
+      this.excute(this.$service.accountService, this.$service.accountService.getReceivableAccountItem, params).then(res => {
+        if (res.code === this.$config.SUCCESS_CODE) {
+          this.tableData_receivable = res.data
+        }
+      })
+    },
+    receivableOk() {
+      let self = this;
+      let sensitiveList = self.sensitiveList
+      this.params = {
+        roleId: this.roleId
+      }
+      let roleSensitiveList = []
+      for (let it of sensitiveList) {
+        if (it.checked) {
+          let list = {
+            roleId: this.roleId,
+            senItemCode: it.itemCode,
+            flgShow: true,
+          }
+          roleSensitiveList.push(list)
+        }
+      }
+      this.params.roleSensitiveList = roleSensitiveList;
+      return this.excute(this.$service.roleSensitiveService, this.$service.roleSensitiveService.updateBatch, this.params, true, 'save')
+    },
+    /**
+     * @desc   : 加载数据
+     * @author : 付斌
+     * @date   : 2024-02-20 15:53
+     */
+    initData() {
+    },
+    /**
+     *   @desc   : 获取客户资料并且监听每一次的客户修改
+     *   @date   : 2022/5/24 15:04
+     *   @author : 付斌
+     */
+    selectCustomer(val) {
+      if (val && val.length > 0) {
+        this.formData.objectId = val[0].cusId
+        this.formData.cusPhone = val[0].cusPhone
+        this.formData.cusName = val[0].cusName
+        this.formData.orgId = val[0].orgId
+        this.formData.orgName = val[0].orgName
+        this.formData.staffId = val[0].staffId
+        this.formData.staffName = val[0].staffName
+        this.formData.addressFull = val[0].addressFull
 
-<style scoped>
+        // 查询客户可用余额
+        let params = {
+          'objectId': this.formData.objectId
+        }
+        this.excute(this.$service.accountService, this.$service.accountService.selectByCond, params).then(res => {
+          if (res.code === this.$config.SUCCESS_CODE && res.data.list.length > 0) {
+            this.formData.receiptResidue = res.data.list[0].receiptResidue
+          }
+        })
+      }
+    },
+    /**
+     *   @desc   : 计算合计
+     *   @date   : 2022/5/30 15:31
+     *   @author : 付斌
+     */
+    getTotals(field, row, rowIndex) {
+      let table = this.$refs['receiptTable'].getTableDataFilter();
+      let sumAmtRec = 0;  // 合计数量
+      if (table && table.length > 0) {
+        table.forEach(row => {
+          if (row["amtRec"]) {
+            sumAmtRec += parseFloat(row["amtRec"]);
+          }
+        })
+        this.formData.sumAmtRec = sumAmtRec;
+      }
+    },
+    /**
+     * @desc   : 通过id查询
+     * @author : 付斌
+     * @date   : 2022/03/04 13:17
+     */
+    detail(id) {
+      return this.excuteNoParam(this.$service.cusReceiptService, this.$service.cusReceiptService.getRpForUpdate, [id]);
+    },
+    /**
+     * @desc   : 编辑页面赋值
+     * @author : 付斌
+     * @date   : 2024-03-03 9:33
+     */
+    setValuesByEdit(data) {
+      if (data) {
+        this.formData = data["data"];
+        this.formData.itemList = data["dataItem"];
 
-</style>
+        // 如果是退款,editTable要输入负数
+        if (this.formData.rpType === this.$config.rpType.tuiShouKuan) {
+          this.showEditTable = false
+          this.negativeFlag = true;
+          setTimeout(() => {
+            this.showEditTable = true;
+          }, 50)
+        }
+      }
+    },
+    /**
+     * @desc   : 校验数据
+     * @author : 付斌
+     * @date   : 2024-03-11 14:37
+     */
+    validData() {
+      let itemTable = this.$refs['receiptTable'].getTableDataFilter();
+      if (!itemTable || itemTable.length == 0) {
+        this.$Message.warning(this.$t('W_012'))
+        return false;
+      }
+      for (let it of itemTable) {
+        if (!it.amtRec || it.amtRec === '') {
+          this.$Message.warning(this.$t('W_042', {'param': '收款金额不能'}))
+          return false;
+        }
+      }
+      return true;
+    },
+    /**
+     * @desc   : 给参数赋值
+     * @author : 付斌
+     * @date   : 2023/6/25 14:31
+     */
+    setParams(arg) {
+      if (this.type === this.$config.formMode.receipt) {
+        this.formData.rpType = this.$config.rpType.shouKuan
+      } else if (this.type === this.$config.formMode.refund) {
+        this.formData.rpType = this.$config.rpType.tuiShouKuan
+      }
+      this.formData.accDate = new Date(this.formData.accDate).toDateStr();
+      // 修改新增的表数据
+      let itemTable = this.$refs['receiptTable'].getTableDataFilter();
+      this.formData.itemList = itemTable
+      this.params = {...this.formData}
+      // itemTable.forEach((it, index) => {
+      //   this.$set(it, 'residueAmt', it["amtRec"]);
+      //   Object.assign(it, it, this.formData)
+      // });
+      // this.params = {"itemList": itemTable}
+    },
+    /**
+     * @desc   : 保存数据
+     * @author : 付斌
+     * @date   : 2023/6/25 14:31
+     */
+    saveData() {
+      if (this.type === this.$config.formMode.receipt) {
+        return this.excute(this.$service.cusReceiptService, this.$service.cusReceiptService.insertReceipt, this.params);
+      } else if (this.type === this.$config.formMode.refund) {
+        return this.excute(this.$service.cusReceiptService, this.$service.cusReceiptService.insertRefund, this.params)
+      } else if (this.type === this.$config.formMode.edit) {
+        return this.excute(this.$service.cusReceiptService, this.$service.cusReceiptService.update, this.params)
+      }
+    },
+    /**
+     * @desc   :新建完毕后清空窗体
+     * @author : 付斌
+     * @date   : 2024-02-27 10:33
+     */
+    clear() {
+      let self = this
+      this.formData = {
+        accDate: new Date(),
+        rpType: null,
+        objectId: null,//客户Id
+        cusName: null,
+        cusPhone: null,
+        addressFull: null,              // 详细地址
+        staffId: null,
+        staffName: null,
+        staffCode: null,
+        orgId: null,
+        orgName: null,
+        orgCode: null,
+        sumAmtRec: null,
+        receiptResidue: null,
+        makeStaff: self.$store.state.user.id,
+        cpId: self.$store.state.user.cpId,
+        itemList: [],
+      }
+    },
+  }
+  ,
+  /**
+   * @desc   : 在实例创建完成后被立即同步调用
+   * @author : 付斌
+   * @date   : 2022/3/3 10:32
+   */
+  created() {
+    this.focusItem = 'receiptId';    // 给第一个组件赋值,可以在混入中自动去聚焦
+    this.primaryKey = 'receiptId'  // 设置主键Id
+    this.routeObjName = 'receipt'  // 设置路由名称
+  }
+}
+</script>

+ 251 - 1
src/view/fin/receipt/index.vue

@@ -1,10 +1,260 @@
+<!-- @desc:收款单  @auth:付斌  @time:2024/2/21 14:06 -->
 <template>
+  <div class="main-div" ref="mainDiv">
+    <loading :loading="loading" v-if="!modalVisible"></loading>
+    <!--按钮区-->
+    <BaseIndexButtonGroup ref="BaseIndexButtonGroup" id="BaseIndexButtonGroup">
+      <template #left>
+        <BaseIndexButton ref="search" name="search"></BaseIndexButton>
+        <BaseIndexButton ref="clear" name="clear"></BaseIndexButton>
+        <BaseIndexButton ref="receipt" name="receipt" :isMustChooseFlag="false"></BaseIndexButton>
+        <BaseIndexButton ref="refund" name="refund" :isMustChooseFlag="false"></BaseIndexButton>
+        <BaseIndexButton ref="invalid" name="invalid"></BaseIndexButton>
+      </template>
+    </BaseIndexButtonGroup>
 
+    <!--  查询条件区域  -->
+    <div id="search-cond-div" ref="search-cond-div" class="search-cond-class">
+      <SearchCond ref="searchCond" v-model="searchCond"
+                  @collapse-change="collapseChange" :setFlag="false"
+                  :searchContent="searchContent"
+      ></SearchCond>
+    </div>
+
+    <!--  表格部分  -->
+    <DkSplit mode="vertical" v-model="split" :height="tableHeight">
+      <div slot="top" style="margin-left: 5px;">
+        <DkTable slot="top"
+                 :id="'table-'+$options.name"
+                 ref="table-select"
+                 :data="tableData"
+                 showFooter
+                 :height="this.tableHeight * split - 35"
+                 primaryKey="rpId"
+                 @pageChange="pageSizeChange"
+                 :page-total="pageInfo.total"
+                 :current-page="pageInfo.currentPage"
+                 :choose-flag="false"
+                 @current-change="currentChange($event)"
+                 :page-size-opts="pageSizeOpts"
+                 :page-size="pageInfo.pageSize"
+                 name="table">
+          <DkTableColumn field="rpNo" :title="$t('receiptNo')"/>
+          <DkTableColumn field="biznisNo"/>
+          <DkTableColumn field="rpTypeName" :title="$t('receiptTypeName')"/>
+          <DkTableColumn field="cusName"/>
+          <DkTableColumn field="cusPhone"/>
+          <DkTableColumn field="addressFull"/>
+          <DkTableColumn field="sumAmtRec" :digits="2" dataType="number" sum/>
+          <DkTableColumn field="accDate" :title="$t('receiptDate')"/>
+          <DkTableColumn field="orgName"/>
+          <DkTableColumn field="staffName"/>
+          <DkTableColumn field="makeStaffName"/>
+          <DkTableColumn field="makeTime" data-type="dateTime"/>
+          <DkTableColumn field="remarks"/>
+        </DkTable>
+      </div>
+      <div slot="bottom">
+        <DkTable :id="'table-'+$options.name" ref="detail-select" :data="tableDataDetail_rpDetail" showFooter
+                 :height="this.tableHeight * (1-split)" primaryKey="itemId" name="table">
+          <DkTableColumn field="macName"/>
+          <DkTableColumn field="amtRec" :digits="2" dataType="number" sum/>
+          <DkTableColumn field="remarks"/>
+        </DkTable>
+      </div>
+    </DkSplit>
+  </div>
 </template>
 
 <script>
+import {indexMixin} from "@/mixins";
+
 export default {
-  name: "index"
+  name: 'receipt',
+  mixins: [indexMixin],
+  data() {
+    let self = this
+    return {
+      tableData: [],
+      tableDataDetail_rpDetail: [],
+      searchContent: [
+        {
+          itemCode: '收款单号-文本',
+          itemName: 'receiptNo',
+          valueFormat: {code: 'receiptNo'},
+          valueKind: 'STR'
+        },
+        {
+          itemCode: '客户名称-文本',
+          itemName: 'cusName',
+          valueFormat: {code: 'cusName'},
+          valueKind: 'STR'
+        },
+        {
+          itemCode: '客户电话-文本',
+          itemName: 'cusPhone',
+          valueFormat: {code: 'cusPhone'},
+          valueKind: 'STR'
+        },
+        {
+          itemCode: '详细地址-文本',
+          itemName: 'addressFull',
+          valueFormat: {code: 'addressFull'},
+          valueKind: 'STR'
+        },
+        {
+          itemCode: '业务部门-文本',
+          itemName: 'orgId',
+          valueFormat: {
+            code: 'orgIdList',
+            data: [],
+            valueKey: 'orgId',
+            labelKey: 'orgName',
+          },
+          valueKind: 'M-CHOICE'
+        },
+        {
+          itemCode: '业务员-文本',
+          itemName: 'staffId',
+          valueFormat: {
+            code: 'staffIdList',
+            data: [],
+            valueKey: 'staffId',
+            labelKey: 'staffCodeName',
+          },
+          valueKind: 'M-CHOICE'
+        },
+        {
+          itemCode: '收款类型-下拉',
+          itemName: 'receiptType',
+          valueFormat: {
+            code: 'receiptTypeList',
+            data: [
+              {receiptType: '收款类型-收款', receiptTypeName: '收款'},
+              {receiptType: '收款类型-退款', receiptTypeName: '退款'}],
+            valueKey: 'receiptType',
+            labelKey: 'receiptTypeName',
+            default: []
+          },
+          valueKind: 'M-CHOICE'
+        },
+        {
+          itemCode: '资金账户-文本',
+          itemName: 'receiptMac',
+          valueFormat: {
+            code: 'receiptMacList',
+            data: [],
+            valueKey: 'macId',
+            labelKey: 'macName',
+          },
+          valueKind: 'M-CHOICE'
+        },
+        {
+          itemCode: '制单时间-时间',
+          itemName: 'makeTime',
+          valueFormat: {
+            code: 'makeTime',
+            default: [new Date().addMonths(-1).format('yyyy-MM-dd'), new Date().format('yyyy-MM-dd')]
+          },
+          valueKind: 'DATE_RANGE',
+          // required: true,
+        },
+      ],
+    }
+  },
+  methods: {
+    /**
+     * @desc   : 加载数据
+     * @author : 付斌
+     * @date   : 2024-02-20 15:53
+     */
+    initData() {
+      //查询业务部门
+      this.getOrg()
+      //查询业务员
+      this.getStaff()
+      //查询资金账户
+      this.getMac()
+    },
+    /**
+     * @desc   : 查询业务部门
+     * @author : 付斌
+     * @date   : 2024-02-26 14:27
+     */
+    getOrg() {
+      this.excute(this.$service.commonService, this.$service.commonService.getOrg, {}).then(res => {
+        if (res.code === this.$config.SUCCESS_CODE) {
+          let list = this.searchContent.filter(it => it.valueFormat.code == 'orgIdList')
+          if (list.length > 0) {
+            list[0].valueFormat.data = res.data
+          }
+        }
+      })
+    },
+    /**
+     * @desc   : 查询业务员
+     * @author : 付斌
+     * @date   : 2024-02-26 14:27
+     */
+    getStaff() {
+      this.excute(this.$service.commonService, this.$service.commonService.getStaff, {}).then(res => {
+        if (res.code === this.$config.SUCCESS_CODE) {
+          let list = this.searchContent.filter(it => it.valueFormat.code == 'staffIdList')
+          if (list.length > 0) {
+            list[0].valueFormat.data = res.data
+          }
+        }
+      })
+    },
+    /**
+     * @desc   : 查询资金账户
+     * @author : 付斌
+     * @date   : 2024-02-26 14:27
+     */
+    getMac() {
+      this.excute(this.$service.commonService, this.$service.commonService.getMac, {}).then(res => {
+        if (res.code === this.$config.SUCCESS_CODE) {
+          let list = this.searchContent.filter(it => it.valueFormat.code == 'receiptMacList')
+          if (list.length > 0) {
+            list[0].valueFormat.data = res.data
+          }
+        }
+      })
+    },
+    /**
+     * @desc   : 查询数据
+     * @author : 付斌
+     * @date   : 2024-02-20 15:53
+     */
+    getData(params) {
+      this.tableData = [];
+
+      return this.excute(this.$service.cusReceiptService, this.$service.cusReceiptService.selectByCond, params)
+    },
+    /**
+     * @desc   : 行改变事件
+     * @author : 付斌
+     * @date   : 2024-02-28 11:06
+     */
+    currentChange({row}) {
+      this.loading = true
+      this.excuteNoParam(this.$service.cusReceiptService, this.$service.cusReceiptService.selectRpInfoById, [row.rpId], false).then(res => {
+        if (res.code === this.$config.SUCCESS_CODE) {
+          this.tableDataDetail_rpDetail = res.data.recPayItem;
+        }
+        this.loading = false
+      })
+    },
+  },
+  /**
+   * @desc   : 在实例创建完成后被立即同步调用
+   * @author : 付斌
+   * @date   : 2022/3/3 10:32
+   */
+  created() {
+    this.primaryKey = 'rpId'  // 设置主键Id
+    this.routeObjName = 'receipt'  // 设置路由名称
+  },
 }
 </script>
 

+ 82 - 3
src/view/mst/org/index.vue

@@ -68,6 +68,26 @@
                      :multiple="false" :tree-flag="true" :tree-strict="false"
                      :disabled="formData.levelNo == 1"/>
         </DkFormItem>
+        <!--仓库-->
+        <DkFormItem prop="whId" :required="true">
+          <MultiSelect v-model="formData.warehouseList"
+                       main-field="ownerFlag"
+                       rate-field="allocationRatio"
+                       :order-id="formData.orgId"
+                       :default-value="formData.whName"
+                       @ok="warehousOk($event)"
+                       :type="this.$config.MagnifierType.warehouse"/>
+        </DkFormItem>
+        <!--资金账号-->
+        <DkFormItem prop="macId" :required="true">
+          <MultiSelect v-model="formData.macList"
+                       main-field="ownerFlag"
+                       rate-field="allocationRatio"
+                       :order-id="formData.orgId"
+                       :default-value="formData.macName"
+                       @ok="moneyAccountOk($event)"
+                       :type="this.$config.MagnifierType.moneyAccount"/>
+        </DkFormItem>
         <!--备注-->
         <DkFormItem prop="remarks">
           <InputPop v-model="formData.remarks" textareaFlag/>
@@ -92,7 +112,15 @@ export default {
         parentId: null,
         levelLeaf: null,
         displayNo: null,
-        remarks: null
+        remarks: null,
+        warehouseList: [],//存放组织仓库
+        macList:[],//存放资金账号
+        whId:null,
+        whCode:null,
+        whName:null,
+        macId:null,
+        macCode:null,
+        macName:null,
       },
       // 获取topId值
       topId: null,
@@ -151,6 +179,58 @@ export default {
     },
 
     /**
+     * @desc   : 仓库赋值
+     * @author : 宋扬
+     * @date   : 2024/3/22 10:19
+     */
+    warehousOk(rows) {
+      if (rows && rows.length > 0) {
+        this.formData.warehouseList = []
+        for (let i of rows) {
+          //找到主业务员
+          if (i.ownerFlag) {
+            this.formData.whId = i.whId
+            this.formData.whCode = i.whCode
+            this.formData.whName = i.whName
+          }
+          //存放从业务员id和分配比
+          this.formData.warehouseList.push({
+            whId: i.whId,
+            whCode: i.whCode,
+            whName: i.whName,
+            ownerFlag: i.ownerFlag
+          })
+        }
+      }
+    },
+
+    /**
+     * @desc   : 资金账户
+     * @author : 宋扬
+     * @date   : 2024/3/22 10:21
+     */
+    moneyAccountOk(rows) {
+      if (rows && rows.length > 0) {
+        this.formData.macList = []
+        for (let i of rows) {
+          //找到主业务员
+          if (i.ownerFlag) {
+            this.formData.macId = i.macId
+            this.formData.macCode = i.macCode
+            this.formData.macName = i.macName
+          }
+          //存放从业务员id和分配比
+          this.formData.macList.push({
+            macId: i.macId,
+            macCode: i.macCode,
+            macName: i.macName,
+            ownerFlag: i.ownerFlag
+          })
+        }
+      }
+    },
+
+    /**
      * @desc   : 切换实际赋值
      * @author : 宋扬
      * @date   : 2024/3/11 17:17
@@ -161,8 +241,7 @@ export default {
         // 判断是否是底层数据
         this.flgValid = row.levelLeaf;
       }
-    }
-    ,
+    },
 
   },
   created() {

+ 32 - 49
src/view/sale/cus-receipt/form.vue

@@ -54,11 +54,11 @@
       <!--客户收款-->
       <DkPanel prop="customerAccount">
         <div id="search-cond-div-goods-info" ref="search-cond-div-goods-info" slot="content">
-          <EditTable ref="receiptTable" :data="formData.itemList" showFooter
+          <EditTable v-if="showEditTable" ref="receiptTable" :data="formData.itemList" showFooter
                      major-field="receiptId"
                      :height="this.tableHeight"
                      :new-row-flag="true"
-                     :columns="this.type === this.$config.formMode.receipt ? receiptColumns : refundColumns"
+                     :columns="receiptColumns"
                      controlId="macId" @on-choose="getTotals" @changeValue="getTotals"/>
         </div>
       </DkPanel>
@@ -78,6 +78,8 @@ export default {
     let self = this
     return {
       loading: false,
+      negativeFlag: false,
+      showEditTable: true,
       //控制客户是否可以输入
       readonlyFlag: true,
       allCanNoEdit: false, //是否所有的都不允许编辑
@@ -100,7 +102,6 @@ export default {
         makeStaff: self.$store.state.user.id,
         cpId: self.$store.state.user.cpId,
         itemList: [],
-        deleteItemList: [],
       },
       receiptColumns: [
         {
@@ -112,27 +113,6 @@ export default {
           fieldUpdate: self.$updateColumns.receiptChooseMac,
           searchDetailFlag: true
         },
-        //收款金额
-        {
-          field: 'amtRec',
-          type: 'number',
-          digits: 2,
-          sum: true,
-        },
-        {
-          field: 'remarks', type: 'text', equal: true,
-        },
-      ],
-      refundColumns: [
-        {
-          field: 'macName',
-          controlId: 'macId',
-          type: 'tableSelect',
-          width: 200,
-          dataType: self.$config.tableSelectType.moneyAccount,
-          fieldUpdate: self.$updateColumns.receiptChooseMac,
-          searchDetailFlag: true
-        },
         // //账户余额
         // {
         //   field: 'balance',
@@ -144,15 +124,14 @@ export default {
         {
           field: 'amtRec',
           type: 'number',
-          negative: true,
           digits: 2,
+          negative: () => self.negativeFlag,
           sum: true,
         },
         {
           field: 'remarks', type: 'text', equal: true,
         },
       ],
-      receiptList: [],//定金
     }
   },
   methods: {
@@ -162,7 +141,6 @@ export default {
      * @date   : 2024-02-20 15:53
      */
     initData() {
-
     },
     /**
      *   @desc   : 获取客户资料并且监听每一次的客户修改
@@ -180,6 +158,7 @@ export default {
         this.formData.staffName = val[0].staffName
         this.formData.addressFull = val[0].addressFull
 
+        // 查询客户可用余额
         let params = {
           'objectId': this.formData.objectId
         }
@@ -225,6 +204,14 @@ export default {
         this.formData = data["data"];
         this.formData.itemList = data["dataItem"];
 
+        // 如果是退款,editTable要输入负数
+        if (this.formData.rpType === this.$config.rpType.tuiShouKuan) {
+          this.showEditTable = false
+          this.negativeFlag = true;
+          setTimeout(() => {
+            this.showEditTable = true;
+          }, 50)
+        }
       }
     },
     /**
@@ -252,12 +239,6 @@ export default {
      * @date   : 2023/6/25 14:31
      */
     setParams(arg) {
-      if (this.type === this.$config.formMode.edit) {
-        // 删除的表数据
-        let deleteItemTable = this.$refs['receiptTable'].getDeleteData();
-        this.formData.deleteItemList = deleteItemTable
-      }
-
       if (this.type === this.$config.formMode.receipt) {
         this.formData.rpType = this.$config.rpType.shouKuan
       } else if (this.type === this.$config.formMode.refund) {
@@ -284,6 +265,8 @@ export default {
         return this.excute(this.$service.cusReceiptService, this.$service.cusReceiptService.insertReceipt, this.params);
       } else if (this.type === this.$config.formMode.refund) {
         return this.excute(this.$service.cusReceiptService, this.$service.cusReceiptService.insertRefund, this.params)
+      } else if (this.type === this.$config.formMode.edit) {
+        return this.excute(this.$service.cusReceiptService, this.$service.cusReceiptService.update, this.params)
       }
     },
     /**
@@ -295,22 +278,22 @@ export default {
       let self = this
       this.formData = {
         accDate: new Date(),
-          rpType: null,
-          objectId: null,//客户Id
-          cusName: null,
-          cusPhone: null,
-          addressFull: null,              // 详细地址
-          staffId: null,
-          staffName: null,
-          staffCode: null,
-          orgId: null,
-          orgName: null,
-          orgCode: null,
-          sumAmtRec: null,
-          receiptResidue: null,
-          makeStaff: self.$store.state.user.id,
-          cpId: self.$store.state.user.cpId,
-          itemList: [],
+        rpType: null,
+        objectId: null,//客户Id
+        cusName: null,
+        cusPhone: null,
+        addressFull: null,              // 详细地址
+        staffId: null,
+        staffName: null,
+        staffCode: null,
+        orgId: null,
+        orgName: null,
+        orgCode: null,
+        sumAmtRec: null,
+        receiptResidue: null,
+        makeStaff: self.$store.state.user.id,
+        cpId: self.$store.state.user.cpId,
+        itemList: [],
       }
     },
   }