Просмотр исходного кода

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

zhoux 2 лет назад
Родитель
Сommit
be6413b8e0
33 измененных файлов с 875 добавлено и 435 удалено
  1. 4 1
      api/pages/ivt/inboundProcessing.js
  2. 6 0
      api/pages/ivt/inboundReturn.js
  3. 1 2
      api/pages/ivt/saleOutBoundReturn.js
  4. 9 9
      api/pages/mac/receiptPayment.js
  5. 86 50
      components/dkbase/dk-form-bill/dk-form-bill.js
  6. 4 2
      components/dkbase/dk-form-more-items/dk-form-more-items.js
  7. 2 1
      i18n/zh-CN.js
  8. 125 12
      package-accounts-manage/pages/payment-order/add/add.js
  9. 16 16
      package-accounts-manage/pages/payment-order/payment-order.wxml
  10. 132 20
      package-accounts-manage/pages/receipt/add/add.js
  11. 1 3
      package-accounts-manage/pages/receipt/add/add.wxml
  12. 7 1
      package-base-select/pages/select-bill/select-bill.js
  13. 3 2
      package-base-select/pages/select-bill/select-bill.wxml
  14. 97 10
      package-base-select/pages/select-collection_confirm/select-collection_confirm.js
  15. 1 1
      package-base-select/pages/select-goods/select-goods.js
  16. 1 1
      package-base-select/pages/select-goods/select-goods.wxml
  17. 1 1
      package-inventory/pages/other-outbound/other-outbound.js
  18. 1 1
      package-inventory/pages/other-warehousing/other-warehousing.js
  19. 4 3
      package-purchase/pages/purchase-order/add/add.js
  20. 1 1
      package-purchase/pages/purchase-order/add/add.wxml
  21. 5 3
      package-purchase/pages/purchase-order/purchase-order-detail/purchase-order-detail.js
  22. 2 2
      package-purchase/pages/purchase-order/purchase-order-detail/purchase-order-detail.wxml
  23. 180 31
      package-purchase/pages/purchase-receipt/add/add.js
  24. 1 1
      package-purchase/pages/purchase-receipt/add/add.wxml
  25. 22 0
      package-purchase/pages/purchase-receipt/detail/detail.js
  26. 3 1
      package-purchase/pages/purchase-receipt/detail/detail.wxml
  27. 7 0
      package-purchase/pages/purchase-receipt/detail/detail.wxss
  28. 87 10
      package-purchase/pages/purchase-return/add/add.js
  29. 8 9
      package-purchase/pages/purchase-return/add/add.wxml
  30. 21 1
      package-purchase/pages/purchase-return/purchase-return.js
  31. 32 232
      package-sales/pages/order-return/order-return.js
  32. 4 8
      package-sales/pages/order-return/order-return.wxml
  33. 1 0
      utils/Constants.js

+ 4 - 1
api/pages/ivt/inboundProcessing.js

@@ -11,7 +11,10 @@ module.exports = {
   inboundProcessingService: {
       // 前缀
       prefix: 'mdm-server/ivt/inbound_purchase/',   
-      inBoundHandle:'inbound_handle'
+      inBoundHandle:'inbound_handle',
+      inboundInsert:'inbound_insert',
+      inboundUpdate:'inbound_update',
+      
   },
 
   routeUrl: {

+ 6 - 0
api/pages/ivt/inboundReturn.js

@@ -29,6 +29,12 @@ module.exports = {
         key:'detail',url:'/package-purchase/pages/purchase-return/detail/detail'
       },
       openingInventory: { key: 'openingInventory', url: '/package-base-select/pages/select-data/select-data',type:'warehouse'  },
+      add:{
+        key:'add',url:'/package-purchase/pages/purchase-return/add/add'
+      },
+      chooseSupplier: { key: 'chooseSupplier', url: '/package-base-select/pages/select-data/select-data',type:'supplier'  },
+      chooseStaff: { key: 'chooseStaff', url: '/package-base-select/pages/select-data/select-data',type:'staff'  },
+      chooseOrg: { key: 'chooseOrg',url: '/package-base-select/pages/select-data/select-data',type:'org' }, 
     }
   } 
 };

+ 1 - 2
api/pages/ivt/saleOutBoundReturn.js

@@ -10,8 +10,7 @@
 module.exports = {
   saleOutBoundReturnService: {
     // 前缀
-    prefix: 'mdm-server/ivt/outbound_sale_return/',
-    outboundInsert: 'outbound_insert'
+    prefix: 'mdm-server/ivt/outbound_sale_return/'
   },
 
   routeUrl: {

+ 9 - 9
api/pages/mac/receiptPayment.js

@@ -11,10 +11,10 @@ module.exports = {
 	receiptPaymentService: {
 		// 前缀
 		prefix: 'mdm-server/mac/recPay/',
-		insertReceivableReceipt:'insert_receivable_receipt',
-    insertPayableReceipt:'insert_payable_receipt',
-    insertReceipt:'insert_receipt',
-    insertRefund:'insert_refund'
+		insertReceivableReceipt: 'insert_receivable_receipt',
+		insertPayableReceipt: 'insert_payable_receipt',
+		insertReceipt: 'insert_receipt',
+		insertRefund: 'insert_refund'
 	},
 
 	routeUrl: {
@@ -23,7 +23,7 @@ module.exports = {
 			add: { key: 'add', url: '/package-accounts-manage/pages/receipt/add/add' },
 			// 付款单新建
 			addPay: { key: 'addPay', url: '/package-accounts-manage/pages/payment-order/add/add' },
-			
+
 			edit: { key: 'edit', url: '/package-accounts-manage/pages/receipt/detail/detail' },
 			detail: {
 				key: 'detail', url: '/package-purchase/pages/purchase-return/detail/detail'
@@ -31,11 +31,11 @@ module.exports = {
 			selectBill: {
 				key: 'selectBill', url: '/package-base-select/pages/select-bill/select-bill'
 			},
-			chooseSupplier: { key: 'chooseSupplier', url: '/package-base-select/pages/select-data/select-data',type:'supplier'  },
-			chooseStaff: { key: 'chooseStaff', url: '/package-base-select/pages/select-data/select-data',type:'staff'  },
+			chooseSupplier: { key: 'chooseSupplier', url: '/package-base-select/pages/select-data/select-data', type: 'supplier' },
+			chooseStaff: { key: 'chooseStaff', url: '/package-base-select/pages/select-data/select-data', type: 'staff' },
 			staffadd: { key: 'staffadd', url: '/package-basic-data/pages/staff/add/add' },
-			chooseOrg: { key: 'chooseOrg',url: '/package-base-select/pages/select-data/select-data',type:'org' }, 
-			chooseWh: { key: 'chooseWh', url: '/package-base-select/pages/select-data/select-data',type:'warehouse'  },
+			chooseOrg: { key: 'chooseOrg', url: '/package-base-select/pages/select-data/select-data', type: 'org' },
+			chooseWh: { key: 'chooseWh', url: '/package-base-select/pages/select-data/select-data', type: 'warehouse' },
 		}
 	}
 }; 

+ 86 - 50
components/dkbase/dk-form-bill/dk-form-bill.js

@@ -112,7 +112,7 @@ Component({
     quantityMin: { //步进器 最小值
       type: String,
     },
-    quantityMax:{
+    quantityMax: {
       type: String
     },
     showPopFlag: { //弹窗标识  true 不弹窗
@@ -153,50 +153,50 @@ Component({
     delValidFlag: {
       type: Boolean,
     },
-      // 对象取值列
-      objCol: {
-        type: String
-      },
-      // 对象列名
-      objLabel: {
-        type: String
-      },
-      // 对象类型(客户customer;供应商supplier)
-      objType: {
-        type: String
-      },
-      // 对象标题
-      objTitle: {
-        type: String,
-        value: 'cusName'
-      },
-      // 对象副标题
-      objSubTitle: {
-        type: String,
-        value: 'cusPhone'
-      },
-      // 金额标题
-      amountTitle: {
-        type: String,
-        value: '应收金额'
-      },
-      // 金额列
-      amountCol: {
-        type: String,
-        value: 'receivableResidue'
-      },
-      // 对象Id列
-      objIdCol: {
-        type: String,
-        value: 'cusId'
-      },
-      chooseText:{
-        type: String,
-      },
+    // 对象取值列
+    objCol: {
+      type: String
+    },
+    // 对象列名
+    objLabel: {
+      type: String
+    },
+    // 对象类型(客户customer;供应商supplier)
+    objType: {
+      type: String
+    },
+    // 对象标题
+    objTitle: {
+      type: String,
+      value: 'cusName'
+    },
+    // 对象副标题
+    objSubTitle: {
+      type: String,
+      value: 'cusPhone'
+    },
+    // 金额标题
+    amountTitle: {
+      type: String,
+      value: '应收金额'
+    },
+    // 金额列
+    amountCol: {
+      type: String,
+      value: 'receivableResidue'
+    },
+    // 对象Id列
+    objIdCol: {
+      type: String,
+      value: 'cusId'
+    },
+    chooseText: {
+      type: String,
+    },
 
-      goodsTagColor:{ //标签颜色
-        type: String,
-      },
+    goodsTagColor: { //标签颜色
+      type: String,
+    },
     // 结果集
     value: {
       type: String,
@@ -245,7 +245,7 @@ Component({
       if (this.data.type == Constants.billType.sale ||
         this.data.type == Constants.billType.pur
         ||
-        this.data.type == Constants.billType.out) {
+        this.data.type == Constants.billType.out || this.data.type == Constants.billType.purReturn) {
         this.setData({
           selectGoodsUrl: '/package-base-select/pages/select-goods/select-goods'
         })
@@ -1041,6 +1041,10 @@ Component({
         if (this.data.type == Constants.billType.sale) {
           this.setGoodsAmount(e.data);
         }
+
+        if (this.data.type == Constants.billType.purReturn) { //采购退货
+          this.setReturnGoodsAmount(e.data);
+        }
         if (this.data.type == Constants.billType.pur) {
           // this.setPurGoodsAmount(e.data);
         }
@@ -1064,20 +1068,20 @@ Component({
       let deleteFlag = true;
       let item = e.currentTarget.dataset.item
       // 判断删除前是否需要判断
-      if(this.data.delValidFlag){
+      if (this.data.delValidFlag) {
         // 行不允许删除
-        if(item.deleteFlag == false){
+        if (item.deleteFlag == false) {
           deleteFlag = false;
         }
       }
       // 不允许删除给出提示信息
-      if(!deleteFlag){
+      if (!deleteFlag) {
         wx.showToast({
-          title: item.message?item.message:'不满足删除条件',
+          title: item.message ? item.message : '不满足删除条件',
           image: '/static/image/warning.png',
           duration: 2000
         })
-      }else{
+      } else {
         const { instance } = e.detail;
         let index = e.currentTarget.dataset.index
         // 删除明细
@@ -1208,6 +1212,38 @@ Component({
       })
     },
     /**
+  * @desc : 设置商品明细金额相关信息 TODO 
+  * @author : 周兴
+  * @date : 2024/1/19
+  */
+    setReturnGoodsAmount(data) {
+      let cardList = this.data.cardList
+      let form = this.data.form
+      let index = cardList.findIndex(it => it.name == 'items');
+      if (form.goodsList && form.goodsList.length > 0) {
+        let sumReturnAmt = Number(0) //合计金额
+        let sumReturnQty = Number(0)
+        form.goodsList.forEach(item => {
+          item.priceReturn = item.priceStandard * -1
+          item.priceInto = item.priceStandard 
+          item.itemAmt = Number(item.priceReturn * item.itemQty)
+          item.itemQtyMax = -1
+          item.itemQtyMin = item.usableQty * -1
+          // sumReturnAmt += item.priceReturn * item.itemQty
+          // sumReturnQty += item.itemQty
+          item.itemQty = item.itemQty * -1
+        })
+        // form.sumReturnQty = sumReturnQty
+        // form.sumReturnAmt = sumReturnAmt
+        // cardList[index].sumReturnAmt = sumReturnAmt
+      }
+      console.log('form', form)
+      this.setData({
+        cardList: cardList,
+        form: form
+      })
+    },
+    /**
      * @desc : 上传附件超出大小
      * @author : 周兴
      * @date : 2024/3/27 16:16

+ 4 - 2
components/dkbase/dk-form-more-items/dk-form-more-items.js

@@ -398,6 +398,7 @@ Component({
      * @date   : 2024/1/26 11:46
      */
     openDatePop(e) {
+      
       // 只读
       if (this.data.readonly) {
         return;
@@ -405,7 +406,7 @@ Component({
       this.setData({
         showDate: true
       })
-      let item = e.currentTarget.dataset;
+      let item = e.currentTarget.dataset; 
       if (item) {
         this.setData({
           index: item.index,
@@ -430,7 +431,7 @@ Component({
      * @date   : 2024/1/26 11:46
      */
     chooseDate(e) {
-      let form = this.data.form;
+      let form = this.data.form; 
       if (this.data.dateCol) {
         form[this.data.dateCol + '_time'] = e.detail;
         form[this.data.dateCol] = util.toDateStr(e.detail);
@@ -753,6 +754,7 @@ Component({
         form: form,
         contentObj: contentObj
       })
+      console.log("changeNumber组件",form);
       this.triggerEvent("changeNumber", { code: key, data: e.detail.value })
     },
     /**

+ 2 - 1
i18n/zh-CN.js

@@ -449,7 +449,8 @@ const pur = {
   returnAndOutbound : "退货出库",
   editPurOrder : "编辑采购订单",
   addPurOrder : "新建采购订单",
-
+  editPurInbound : "编辑采购入库",
+  addPurInbound : "新建采购入库",
 }
 module.exports = {
   items: Object.assign({},pur, fund, home, ivt,mac, basicData, columns, saleOrder, button, messages, others, accountsManage, org, supplier, goodsSku, customer)}

+ 125 - 12
package-accounts-manage/pages/payment-order/add/add.js

@@ -1,3 +1,11 @@
+/*******************************************************************************
+ * Copyright(c) 2022 dongke All rights reserved. / Confidential
+ * 类的信息:
+ *		1.程序名称:  新建付款单
+ * 编辑履历:
+ *		作者				日期					版本				修改内容
+ *		姜永辉      2024-03-22    1.00		   	    
+ *******************************************************************************/
 const mixins = require('@/mixins/index.js')
 const Constants = require('@/utils/Constants.js');
 const app = getApp();
@@ -43,7 +51,7 @@ Page({
 
       ],
       bill: [
-        { code: 'cancelAmount', type: 'cancel', title: '核销应付', bill: 4, amount: 500 },
+        { code: 'cancelAmount', type: 'cancel', title: '核销应付', bill: 0, amount: 0 },
         { code: 'payableResidue', type: 'number', title: '待核销金额', readonly: true, },
 
         { code: 'sumWaiveAmt', type: 'number', title: '优惠金额', },
@@ -75,6 +83,7 @@ Page({
     paymentResidue: 0,
     bill: 0,
     objInfo: {},
+    table: Constants.tables.recPay,
   },
 
   /**
@@ -102,13 +111,15 @@ Page({
       formData.orgName = data.name
     }
     if (code == "bill") { //选取应付的返回值     
+      formData.payableList = data.payableList
       _this.setData({
+        payableList: data.payableList,
         objInfo: data.objInfo,
         payableResidue: data.payableResidue,
         paymentResidue: data.paymentResidue,
-        bill: data.itemLists.length,
+        bill: data.payableList.length,
       })
-      this.setForm(formData, contentObj, data.payableResidue, data.paymentResidue, data.itemLists.length)
+      this.setForm(formData, contentObj, data.payableResidue, data.paymentResidue, data.payableList.length)
       return
     }
     this.setData({
@@ -135,15 +146,17 @@ Page({
       accItemType: '账款类型-应付',
       amtResidueFlg: true,
     }
-    this.excute(this.data.accountService, this.data.accountService.getReceivableAccountItemCount, params).then(res => {
+    this.excute(this.data.accountService, this.data.accountService.getReceivableAccountItem, params).then(res => {
       formData.cancelAmount = true
+      formData.payableList = res.data.data
       _this.setForm(formData, contentObj, objInfo.payableResidue,
         objInfo.paymentResidue, res.data.data)
       _this.setData({
+        payableList: data.payableList,
         objInfo,
         payableResidue: objInfo.payableResidue,
         paymentResidue: objInfo.paymentResidue,
-        bill: res.data.data
+        bill: res.data.data.length
       })
 
     })
@@ -159,19 +172,72 @@ Page({
     let formData = JSON.parse(this.data.formData)
     let contentObj = this.data.contentObj
     if (cancelAmount) {
+      formData.payableList = this.data.payableList
       this.setForm(formData, contentObj, this.data.payableResidue, this.data.paymentResidue, this.data.bill)
     } else {
-
+      formData.payableList = []
       this.setForm(formData, contentObj, 0, 0, 0)
     }
   },
 
   /**
+ * @desc : 设置表单的数据
+ * @date : 2024/2/1 15:49
+ * @author : 姜永辉
+ */
+  changeNumber(e) {
+    let formData = JSON.parse(this.data.formData)
+    let code = e.detail.code
+    let data = e.detail.data
+    // 本次付款金额
+    if (code == "sumAmtPay") {
+      formData.sumAmtPay = data
+      formData.sumAmount = data
+      let contentList = this.data.contentList
+      contentList.forEach(it => {
+        if (it.type == 'number') {
+          it.content = data
+        }
+      })
+      this.setData({
+        contentList,
+      })
+    }
+    // 本次核销金额
+    if (code == "currentPayableResidue") {
+      formData.currentPayableResidue = data
+    }
+    // 优惠金额
+    if (code == "sumWaiveAmt") {
+      formData.sumWaiveAmt = data
+    }
+    this.setData({
+      formData: JSON.stringify(formData)
+    })
+  },
+
+  /**
    * @desc : 设置表单的数据
    * @date : 2024/2/1 15:49
    * @author : 姜永辉
    */
   setForm(formData, contentObj, payableResidue, paymentResidue, bill) {
+    console.log("app.globalData.user", app.globalData.user);
+    if (payableResidue == null) {
+      payableResidue = 0
+    }
+    if (paymentResidue == null) {
+      paymentResidue = 0
+    }
+    if (bill == null) {
+      bill = 0
+    }
+    if (formData.staffId == null) {
+      formData.staffId = app.globalData.user.staffId
+      formData.orgId = app.globalData.user.orgId
+      formData.staffName = app.globalData.user.staffName
+      formData.orgName = app.globalData.user.orgName
+    }
     formData.payableResidue = payableResidue  // 总剩余应付
     formData.currentPayableResidue = payableResidue  // 总剩余应付
     formData.sumAmount = payableResidue  // 总剩余应付
@@ -202,8 +268,12 @@ Page({
       > Number(formData.payableResidue)) {
       msgError = '本次核销不能大于待核销金额'
     }
+    if (Number(formData.currentPayableResidue) == 0
+      && Number(formData.sumAmtPay) == 0) {
+      msgError = '本次核销金额和本次付款不能同时为0'
+    }
     // 本次付款》= 本次核销
-    if (Number(formData.sumAmtRec)
+    if (Number(formData.sumAmtPay)
       < Number(formData.currentPayableResidue)) {
       msgError = '本次核销金额不能大于付款金额'
     }
@@ -227,22 +297,23 @@ Page({
    * @author : 姜永辉
    */
   setParams(params) {
-    let btnFormData = this.data.btnFormData ? JSON.parse(this.data.btnFormData) : ''
     let formData = JSON.parse(this.data.formData)
-
+    if (Number(formData.sumAmtPay) != 0) {
+      return params
+    }
     //收付款类型-收款的查询参数
     params.rpType = Constants.rpType.payment
     params.orgId = formData.orgId  //组织部门
     params.staffId = formData.staffId  // 员工
     //  // 供应商1 客户2 所有 传空
-    params.objectId = this.data.objInfo.cusId  // 客户
+    params.objectId = this.data.objInfo.supId  // 经销商
     // 收款金额					
-    params.sumAmtPay = 0
+    params.sumAmtPay = formData.sumAmtPay
     // 合计应付冲抵金额								
     params.sumAmtPayableHandle = formData.currentPayableResidue
     // 合计优惠金额
     params.sumWaiveAmt = formData.sumWaiveAmt
-    params.annexPaths = {}
+    params.annexPaths = formData.annexPaths || [] //附件 
     // params.biznisType = null
     // params.biznisId	 = null
     // params.biznisNo	= null	 
@@ -251,10 +322,52 @@ Page({
     params.makeStaff = app.globalData.user.staffId  // 制单人
 
     params.itemList = [] //明细 
+    let rlsit = this.setReturnPayableList(formData.payableList || [], formData.sumWaiveAmt, formData.currentPayableResidue, formData.payableResidue)
+    params.payableList = rlsit //应付款的明细 
     return params
   },
 
   /**
+ * @desc : 将优惠和本次核销的金额分摊到应付单据的明细里
+ * @date : 2024/2/1 15:49
+ * @author : 姜永辉
+ */
+  setReturnPayableList(list, sumWaiveAmt, currentPayableResidue, totalAmount) {
+    let retList = []
+    if (sumWaiveAmt == null || sumWaiveAmt == undefined) {
+      sumWaiveAmt = 0
+    }
+    if (currentPayableResidue == null || currentPayableResidue == null) {
+      currentPayableResidue = 0
+    }
+    if (currentPayableResidue == 0 && sumWaiveAmt == 0 || list == null) {
+      return retList
+    }
+    let finalAmout = currentPayableResidue
+    let finalSumWaiveAmt = sumWaiveAmt
+    for (let index = 0; index < list.length; index++) {
+      const element = list[index];
+      // 应付冲抵金额	== 明细的剩余金额	默认
+      let amtReceivableHandle = (finalAmout < element.amtResidue ? finalAmout : element.amtResidue)
+      let amtWaive = Number(parseFloat(element.amtResidue / totalAmount * sumWaiveAmt).toFixed(2))
+      finalAmout -= amtReceivableHandle
+      finalSumWaiveAmt -= amtWaive
+
+      retList.push({
+        accDate: list.accDate,
+        accItemId: element.accItemId,
+        // 应付冲抵金额	
+        amtPayableHandle: amtReceivableHandle,
+        // 优惠金额-分摊之后 最后一条的数据取剩余的值
+        amtWaive: (index == list.length - 1 ? finalSumWaiveAmt : amtWaive),
+      })
+    }
+
+    return retList
+
+  },
+
+  /**
   * @desc : 保存数据服务
   * @date : 2024/2/1 15:49
   * @author : 姜永辉

+ 16 - 16
package-accounts-manage/pages/payment-order/payment-order.wxml

@@ -1,18 +1,18 @@
-<!-- 前台导入wxmlUtil.wxs -->
-<wxs src='/utils/wxmlUtil.wxs' module="wxmlUtil"></wxs>
-<loading wx:if="{{loading}}"></loading>
-<van-sticky scroll-top="0">
-  <!-- 查询条件 -->
-  <dk-dropdown-menu model:value="{{searchForm}}" menuList="{{searchContent}}" pullMenuList="{{pullMenuList}}" bind:search="searchData" searchTextPlaceholder="{{wxmlUtil.setSearchPlaceholder($t,['orderNo','supplierName'])}}">
-  </dk-dropdown-menu>
-</van-sticky>
-<!-- 暂无数据 -->
-<van-empty wx:if="{{tableData.length<=0}}" description="{{$t['nodata']}}" />
-<!-- 列表区 -->
-<dk-list list="{{tableData}}" title="supplierName" subTitle="makeTime" content="{{contentList}}" collectCol="sumAmtPay" collectName="付款" contentObj="{{contentObj}}" contentCol="" footerAmount="{{footerAmount}}" footerInfo="{{footerInfo}}" bind:toDetail="toDetail" bind:toTitle="toTitle" routeObjName="{{routeObjName}}" buttonList="{{buttonList}}" bind:open="open"></dk-list>
+  <!-- 前台导入wxmlUtil.wxs -->
+  <wxs src='/utils/wxmlUtil.wxs' module="wxmlUtil"></wxs>
+  <loading wx:if="{{loading}}"></loading>
+  <van-sticky scroll-top="0">
+    <!-- 查询条件 -->
+    <dk-dropdown-menu model:value="{{searchForm}}" menuList="{{searchContent}}" pullMenuList="{{pullMenuList}}" bind:search="searchData" searchTextPlaceholder="{{wxmlUtil.setSearchPlaceholder($t,['orderNo','supplierName'])}}">
+    </dk-dropdown-menu>
+  </van-sticky>
+  <!-- 暂无数据 -->
+  <van-empty wx:if="{{tableData.length<=0}}" description="{{$t['nodata']}}" />
+  <!-- 列表区 -->
+  <dk-list list="{{tableData}}" title="supplierName" subTitle="makeTime" content="{{contentList}}" collectCol="sumAmtPay" collectName="付款" contentObj="{{contentObj}}" contentCol="" footerAmount="{{footerAmount}}" footerInfo="{{footerInfo}}" bind:toDetail="toDetail" bind:toTitle="toTitle" routeObjName="{{routeObjName}}" buttonList="{{buttonList}}" bind:open="open"></dk-list>
 
-<van-divider wx:if="{{noMore}}" contentPosition="center" borderColor="#DCDCDC">{{$t['noMore']}}~</van-divider>
+  <van-divider wx:if="{{noMore}}" contentPosition="center" borderColor="#DCDCDC">{{$t['noMore']}}~</van-divider>
 
-<view style="height: 180rpx;"></view>
-<!-- 新建按钮 -->
-<dk-save-button model:value="{{btnFormData}}" btnAutoWidthFlag="{{false}}" btnRightFlag="{{true}}"  buttonList="{{buttonFootList}}" contentList="{{contentnFootList}}" bind:open="open"></dk-save-button> 
+  <view style="height: 180rpx;"></view>
+  <!-- 新建按钮 -->
+  <dk-save-button model:value="{{btnFormData}}" btnAutoWidthFlag="{{false}}" btnRightFlag="{{true}}"  buttonList="{{buttonFootList}}" contentList="{{contentnFootList}}" bind:open="open"></dk-save-button> 

+ 132 - 20
package-accounts-manage/pages/receipt/add/add.js

@@ -1,3 +1,11 @@
+/*******************************************************************************
+ * Copyright(c) 2022 dongke All rights reserved. / Confidential
+ * 类的信息:
+ *		1.程序名称:  新建收款单
+ * 编辑履历:
+ *		作者				日期					版本				修改内容
+ *		姜永辉      2024-03-22    1.00		   	    
+ *******************************************************************************/
 const mixins = require('@/mixins/index.js')
 const Constants = require('@/utils/Constants.js');
 const app = getApp();
@@ -43,9 +51,9 @@ Page({
 
       ],
       bill: [
-        { code: 'cancelAmount', type: 'cancel', title: '核销应收', bill: 4, amount: 500 },
+        { code: 'cancelAmount', type: 'cancel', title: '核销应收', bill: 0, amount: 0 },
         { code: 'receivableResidue', type: 'number', title: '待核销金额', readonly: true, },
-        { code: 'receiptResidue', type: 'number', title: '使用预存', },
+        { code: 'receiptResidue', type: 'number', title: '使用预存', readonly: true, },
         { code: 'sumWaiveAmt', type: 'number', title: '优惠金额', },
         { code: 'currentReceivableResidue', type: 'number', title: '本次核销', required: true },
       ],
@@ -75,6 +83,7 @@ Page({
     receiptResidue: 0,
     bill: 0,
     objInfo: {},
+    table: Constants.tables.recPay,
   },
 
   /**
@@ -102,13 +111,15 @@ Page({
       formData.orgName = data.name
     }
     if (code == "bill") { //选取应收的返回值     
-      _this.setData({
+      formData.receivableList = data.receivableList
+      this.setData({
+        receivableList: data.receivableList,
         objInfo: data.objInfo,
         receivableResidue: data.receivableResidue,
         receiptResidue: data.receiptResidue,
-        bill: data.itemLists.length,
+        bill: data.receivableList.length,
       })
-      this.setForm(formData, contentObj, data.receivableResidue, data.receiptResidue, data.itemLists.length)
+      this.setForm(formData, contentObj, data.receivableResidue, data.receiptResidue, data.receivableList.length)
       return
     }
     this.setData({
@@ -134,15 +145,18 @@ Page({
       accItemType: '账款类型-应收',
       amtResidueFlg: true,
     }
-    this.excute(this.data.accountService, this.data.accountService.getReceivableAccountItemCount, params).then(res => {
+    this.excute(this.data.accountService, this.data.accountService.getReceivableAccountItem, params).then(res => {
+      console.log("getReceivableAccountItem", res);
       formData.cancelAmount = true
+      formData.receivableList = res.data.data
       _this.setForm(formData, contentObj, objInfo.receivableResidue,
-        objInfo.receiptResidue, res.data.data)
+        objInfo.receiptResidue, res.data.data.length)
       _this.setData({
         objInfo,
+        receivableList: res.data.data,
         receivableResidue: objInfo.receivableResidue,
         receiptResidue: objInfo.receiptResidue,
-        bill: res.data.data
+        bill: res.data.data.length
       })
 
     })
@@ -158,26 +172,78 @@ Page({
     let formData = JSON.parse(this.data.formData)
     let contentObj = this.data.contentObj
     if (cancelAmount) {
+      formData.receivableList = this.data.receivableList
       this.setForm(formData, contentObj, this.data.receivableResidue, this.data.receiptResidue, this.data.bill)
     } else {
-
+      formData.receivableList = []
       this.setForm(formData, contentObj, 0, 0, 0)
     }
   },
 
   /**
+  * @desc : 设置表单的数据
+  * @date : 2024/2/1 15:49
+  * @author : 姜永辉
+  */
+  changeNumber(e) {
+    let formData = JSON.parse(this.data.formData)
+    let code = e.detail.code
+    let data = e.detail.data
+    console.log(code, data, e);
+    // 本次收款金额
+    if (code == "sumAmtRec") {
+      formData.sumAmtRec = data
+      formData.sumAmount = data
+      let contentList = this.data.contentList
+      contentList.forEach(it => {
+        if (it.type == 'number') {
+          it.content = data
+        }
+      })
+      this.setData({
+        contentList,
+      })
+    }
+    // 本次核销金额
+    if (code == "currentReceivableResidue") {
+      formData.currentReceivableResidue = data
+    }
+    // 优惠金额
+    if (code == "sumWaiveAmt") {
+      formData.sumWaiveAmt = data
+    }
+    this.setData({
+      formData: JSON.stringify(formData)
+    })
+  },
+
+  /**
    * @desc : 设置表单的数据
    * @date : 2024/2/1 15:49
    * @author : 姜永辉
    */
   setForm(formData, contentObj, receivableResidue, receiptResidue, bill) {
+    if (receivableResidue == null) {
+      receivableResidue = 0
+    }
+    if (receiptResidue == null) {
+      receiptResidue = 0
+    }
+    if (bill == null) {
+      bill = 0
+    }
     formData.receivableResidue = receivableResidue  // 总剩余应收
-    formData.currentReceivableResidue = receivableResidue  // 总剩余应收
-    formData.receivableResidue = receivableResidue  // 总剩余应收
-    formData.receiptResidue = receiptResidue  // 预存 
+    formData.currentReceivableResidue = receivableResidue  // 总剩余应收 
+    if (receivableResidue > receiptResidue) {
+      formData.receiptResidue = receiptResidue  // 预存 
+    } else {
+      formData.receiptResidue = receivableResidue  // 预存 (用总剩余应收来负值)
+    }
     if (formData.staffId == null) {
       formData.staffId = app.globalData.user.staffId
       formData.orgId = app.globalData.user.orgId
+      formData.staffName = app.globalData.user.staffName
+      formData.orgName = app.globalData.user.orgName
     }
     contentObj['bill'].forEach(itcard => {
       if (itcard.code === 'cancelAmount') {
@@ -205,6 +271,10 @@ Page({
       > Number(formData.receivableResidue)) {
       msgError = '本次核销不能大于待核销金额'
     }
+    if (Number(formData.currentReceivableResidue) == 0
+      && Number(formData.sumAmtRec) == 0) {
+      msgError = '本次核销金额和本次收款不能同时为0'
+    }
     // 预存+本次收款》= 本次核销
     if (Number(formData.sumAmtRec) + Number(formData.receiptResidue)
       < Number(formData.currentReceivableResidue)) {
@@ -217,22 +287,22 @@ Page({
         icon: 'none'
       })
       return false
-    }   
+    }
 
     return true
   },
 
-
-
   /**
    * @desc : 保存的參數設置
    * @date : 2024/2/1 15:49
    * @author : 姜永辉
    */
   setParams(params) {
-    let btnFormData = this.data.btnFormData ? JSON.parse(this.data.btnFormData) : ''
-    let formData = JSON.parse(this.data.formData)
 
+    let formData = JSON.parse(this.data.formData)
+    if (Number(formData.sumAmtRec) != 0) {
+      return params
+    }
     //收付款类型-收款的查询参数
     params.rpType = Constants.rpType.receipt
     params.orgId = formData.orgId  //组织部门
@@ -246,8 +316,8 @@ Page({
     // 合计优惠金额
     params.sumWaiveAmt = formData.sumWaiveAmt
     // 预存的使用
-    params.receiptResidue = formData.receiptResidue 
-    params.annexPaths = {}
+    params.receiptResidue = formData.receiptResidue
+    params.annexPaths = formData.annexPaths || [] //附件 
     // params.biznisType = null
     // params.biznisId	 = null
     // params.biznisNo	= null	 
@@ -256,10 +326,53 @@ Page({
     params.makeStaff = app.globalData.user.staffId  // 制单人
 
     params.itemList = [] //明细 
+    let rlsit = this.setReturnReceivableList(formData.receivableList || [], formData.sumWaiveAmt, formData.currentReceivableResidue, formData.receivableResidue)
+    params.receivableList = rlsit //应收收款的明细 
+
     return params
   },
 
   /**
+  * @desc : 将优惠和本次核销的金额分摊到应收单据的明细里
+  * @date : 2024/2/1 15:49
+  * @author : 姜永辉
+  */
+  setReturnReceivableList(list, sumWaiveAmt, currentReceivableResidue, totalAmount) {
+    let retList = []
+    if (sumWaiveAmt == null || sumWaiveAmt == undefined) {
+      sumWaiveAmt = 0
+    }
+    if (currentReceivableResidue == null || currentReceivableResidue == null) {
+      currentReceivableResidue = 0
+    }
+    if (currentReceivableResidue == 0 && sumWaiveAmt == 0 || list == null) {
+      return retList
+    }
+    let finalAmout = currentReceivableResidue
+    let finalSumWaiveAmt = sumWaiveAmt
+    for (let index = 0; index < list.length; index++) {
+      const element = list[index];
+      // 应收冲抵金额	== 明细的剩余金额	默认
+      let amtReceivableHandle = (finalAmout < element.amtResidue ? finalAmout : element.amtResidue)
+      let amtWaive = Number(parseFloat(element.amtResidue / totalAmount * sumWaiveAmt).toFixed(2))
+      finalAmout -= amtReceivableHandle
+      finalSumWaiveAmt -= amtWaive
+
+      retList.push({
+        accDate: list.accDate,
+        accItemId: element.accItemId,
+        // 应收冲抵金额	
+        amtReceivableHandle: amtReceivableHandle,
+        // 优惠金额-分摊之后 最后一条的数据取剩余的值
+        amtWaive: (index == list.length - 1 ? finalSumWaiveAmt : amtWaive),
+      })
+    }
+
+    return retList
+
+  },
+
+  /**
   * @desc : 保存数据服务
   * @date : 2024/2/1 15:49
   * @author : 姜永辉
@@ -275,7 +388,6 @@ Page({
 
   },
 
-
   /**
   * @desc : 保存数据服务-跳转收款页面
   * @date : 2024/2/1 15:49

+ 1 - 3
package-accounts-manage/pages/receipt/add/add.wxml

@@ -3,9 +3,7 @@
 
 <loading wx:if="{{loading}}"></loading>
 
-<dk-form-more-items id="{{formName}}" routeObjName="{{routeObjName}}" objCol="customerId" objLabel="客户名称" objType="customer"  cardList="{{cardList}}" contentObj="{{contentObj}}" model:value="{{formData}}" bind:chooseData="chooseData" bind:chooseObjTypeData="chooseObjTypeData" 
-bind:onCheckChange="onCheckChange" 
->
+<dk-form-more-items id="{{formName}}" routeObjName="{{routeObjName}}" objCol="customerId" objLabel="客户名称" objType="customer" cardList="{{cardList}}" contentObj="{{contentObj}}" model:value="{{formData}}" bind:chooseData="chooseData" table="{{table}}" bind:chooseObjTypeData="chooseObjTypeData" bind:onCheckChange="onCheckChange" bind:changeNumber="changeNumber">
 </dk-form-more-items>
 
 <view style="height: 220rpx;"></view>

+ 7 - 1
package-base-select/pages/select-bill/select-bill.js

@@ -306,6 +306,12 @@ Page({
     // 路由
     routeObjName: 'account',
     formMode: Constants.formMode.index,
+     // 弹出按钮
+     buttonList: [{
+      name: 'merge',
+      title: mixins.$t('confirm')
+    }],
+     
   },
 
   /**
@@ -415,7 +421,7 @@ Page({
     const eventChannel = that.getOpenerEventChannel();
     eventChannel.emit('bindData', {
       data: {
-        itemLists: itemLists,
+        receivableList: itemLists,
         objInfo: that.data.objInfo,
         receivableResidue: that.data.totalAmount,
         receiptResidue: that.data.objInfo.receiptResidue, //剩余预存

+ 3 - 2
package-base-select/pages/select-bill/select-bill.wxml

@@ -61,5 +61,6 @@
 <van-empty wx:if="{{tableData.length<=0}}" description="{{$t['nodata']}}" />
 
 <view style="height: 200rpx;"></view>
-<!--  底部工具栏-保存 -->
-<dk-save-bottom checked="{{allChecked}}" totallength="{{returnTotalAmount}}" flagTypeName="select-source-purchase-order" bottomClass="{{true}}" bind:onCheckboxChange="onCheckboxChange" bind:allClean="returnData" />
+ 
+
+<dk-save-button   model:value="{{btnFormData}}" btnAutoWidthFlag="{{true}}" btnRightFlag="{{true}}" buttonList="{{buttonList}}" contentList="{{contentList}}" bind:open="returnData"></dk-save-button>

+ 97 - 10
package-base-select/pages/select-collection_confirm/select-collection_confirm.js

@@ -104,6 +104,86 @@ mixins: [mixins],
     },
 
     /**
+  * @desc : 将优惠和本次核销的金额分摊到应收单据的明细里
+  * @date : 2024/2/1 15:49
+  * @author : 姜永辉
+  */
+    setReturnReceivableList(list, sumWaiveAmt, currentReceivableResidue, totalAmount) {
+      let retList = []
+      if (sumWaiveAmt == null || sumWaiveAmt == undefined) {
+        sumWaiveAmt = 0
+      }
+      if (currentReceivableResidue == null || currentReceivableResidue == null) {
+        currentReceivableResidue = 0
+      }
+      if (currentReceivableResidue == 0 && sumWaiveAmt == 0 || list == null) {
+        return retList
+      }
+      let finalAmout = currentReceivableResidue
+      let finalSumWaiveAmt = sumWaiveAmt
+      for (let index = 0; index < list.length; index++) {
+        const element = list[index];
+        // 应收冲抵金额	== 明细的剩余金额	默认
+        let amtReceivableHandle = (finalAmout < element.amtResidue ? finalAmout : element.amtResidue)
+        let amtWaive = Number(parseFloat(element.amtResidue / totalAmount * sumWaiveAmt).toFixed(2))
+        finalAmout -= amtReceivableHandle
+        finalSumWaiveAmt -= amtWaive
+
+        retList.push({
+          accDate: list.accDate,
+          accItemId: element.accItemId,
+          // 应收冲抵金额	
+          amtReceivableHandle: amtReceivableHandle,
+          // 优惠金额-分摊之后 最后一条的数据取剩余的值
+          amtWaive: (index == list.length - 1 ? finalSumWaiveAmt : amtWaive),
+        })
+      }
+
+      return retList
+
+    },
+
+    /**
+ * @desc : 将优惠和本次核销的金额分摊到应付单据的明细里
+ * @date : 2024/2/1 15:49
+ * @author : 姜永辉
+ */
+    setReturnPayableList(list, sumWaiveAmt, currentPayableResidue, totalAmount) {
+      let retList = []
+      if (sumWaiveAmt == null || sumWaiveAmt == undefined) {
+        sumWaiveAmt = 0
+      }
+      if (currentPayableResidue == null || currentPayableResidue == null) {
+        currentPayableResidue = 0
+      }
+      if (currentPayableResidue == 0 && sumWaiveAmt == 0 || list == null) {
+        return retList
+      }
+      let finalAmout = currentPayableResidue
+      let finalSumWaiveAmt = sumWaiveAmt
+      for (let index = 0; index < list.length; index++) {
+        const element = list[index];
+        // 应付冲抵金额	== 明细的剩余金额	默认
+        let amtReceivableHandle = (finalAmout < element.amtResidue ? finalAmout : element.amtResidue)
+        let amtWaive = Number(parseFloat(element.amtResidue / totalAmount * sumWaiveAmt).toFixed(2))
+        finalAmout -= amtReceivableHandle
+        finalSumWaiveAmt -= amtWaive
+
+        retList.push({
+          accDate: list.accDate,
+          accItemId: element.accItemId,
+          // 应付冲抵金额	
+          amtPayableHandle: amtReceivableHandle,
+          // 优惠金额-分摊之后 最后一条的数据取剩余的值
+          amtWaive: (index == list.length - 1 ? finalSumWaiveAmt : amtWaive),
+        })
+      }
+
+      return retList
+
+    },
+
+    /**
      * @desc : 保存的參數設置
      * @date : 2024/2/1 15:49
      * @author : 姜永辉
@@ -112,12 +192,12 @@ mixins: [mixins],
       let form = this.data.form
       let itemList = []
       //收付款类型-收款的查询参数
-      params.rpType =  params.rpType ?  params.rpType : Constants.rpType.receipt
+      params.rpType = params.rpType ? params.rpType : Constants.rpType.receipt
       params.orgId = form.orgId  //组织部门
       params.staffId = form.staffId  // 员工
       // 合计优惠金额
       params.sumWaiveAmt = 0
-      params.annexPaths = form.annexPaths ? form.annexPaths :[]
+      params.annexPaths = form.annexPaths ? form.annexPaths : []
       params.accDate = form.accDate  // 
       params.remarks = form.remarks  // 备注
       params.makeStaff = app.globalData.user.staffId  // 制单人 
@@ -126,13 +206,17 @@ mixins: [mixins],
       // formType :1 收款单 ,2 付款单,3 客户收款保存参数
       if (this.data.formType == 1) {
         // 1 收款单
-        params.objectId = this.data.objInfo.cusId  // 客户
+        params.objectId = this.data.form.objInfo.cusId  // 客户
         // 收款金额					
         params.sumAmtRec = Number(form.sumAmount)
         // 合计应收冲抵金额								
         params.sumAmtReceivableHandle = form.currentReceivableResidue
         // 预存的使用
-        params.receiptResidue = formData.receiptResidue
+        params.receiptResidue = form.receiptResidue
+        // 合计优惠金额
+        params.sumWaiveAmt = form.sumWaiveAmt
+        let rlsit = this.setReturnReceivableList(form.receivableList || [], form.sumWaiveAmt, form.currentReceivableResidue, form.receivableResidue)
+        params.receivableList = rlsit //应收收款的明细 
         tableData.forEach(item => {
           itemList.push(
             {
@@ -147,13 +231,16 @@ mixins: [mixins],
 
       } else if (this.data.formType == 2) {
         // 2 付款单,
-        params.objectId = this.data.objInfo.supId  // 供应商
+        params.objectId = this.data.form.objInfo.supId  // 供应商
         // 收款金额					
         params.sumAmtPay = Number(form.sumAmount)
         // 合计应付冲抵金额								
-        params.sumAmtPayableHandle = formData.currentPayableResidue
+        params.sumAmtPayableHandle = form.currentPayableResidue
         // 合计优惠金额
-        params.sumWaiveAmt = formData.sumWaiveAmt
+        params.sumWaiveAmt = form.sumWaiveAmt
+        let rlsit = this.setReturnPayableList(form.payableList || [], form.sumWaiveAmt, form.currentPayableResidue, form.payableResidue)
+        params.payableList = rlsit //应付款的明细 
+
         tableData.forEach(item => {
           itemList.push(
             {
@@ -182,8 +269,8 @@ mixins: [mixins],
             }
           )
         })
-        params.accDate = params.accDate ? params.accDate: utils.formatDayTime(new Date())
-      }else if (this.data.formType == 4) {
+        params.accDate = params.accDate ? params.accDate : utils.formatDayTime(new Date())
+      } else if (this.data.formType == 4) {
         //客户退款保存参数
         console.log('params', params)
         params.sumAmtRec = Number(params.sumAmtRec)
@@ -199,7 +286,7 @@ mixins: [mixins],
             }
           )
         })
-        params.accDate = params.accDate ? params.accDate: utils.formatDayTime(new Date())
+        params.accDate = params.accDate ? params.accDate : utils.formatDayTime(new Date())
       }
       params.itemList = itemList
       return params

+ 1 - 1
package-base-select/pages/select-goods/select-goods.js

@@ -111,7 +111,7 @@ Page({
   getData(params) {
     if (this.data.item == Constants.billType.sale) {
       return this.excute(this.data.commonService, this.data.commonService.getGoodsForOrderByPage, params);
-    } else if (this.data.item == Constants.billType.out) {
+    } else if (this.data.item == Constants.billType.out || this.data.item ==  Constants.billType.purReturn) {
       return this.excute(this.data.inventoryService, this.data.inventoryService.selectByCond, params);
     } else {
       return this.excute(this.data.service, this.data.service.selectByCond, params);

+ 1 - 1
package-base-select/pages/select-goods/select-goods.wxml

@@ -72,7 +72,7 @@
   </scroll-view>
 
   <!--出库商品 列表 -->
-  <view wx:if="{{active == 0 && billType == 'out'}}" catch:tap="openAddItemInfo" wx:for="{{tableData}}" data-item="{{item}}" wx:key="index" class="main-class" style="width: 75%;margin-left: 166rpx; ">
+  <view wx:if="{{active == 0 && (billType == 'out' ||  billType =='purReturn')}}" catch:tap="openAddItemInfo" wx:for="{{tableData}}" data-item="{{item}}" wx:key="index" class="main-class" style="width: 75%;margin-left: 166rpx; ">
     <view class="main-foot" style="border-radius:15rpx;">
       <view>
         <view class="table-content-row">

+ 1 - 1
package-inventory/pages/other-outbound/other-outbound.js

@@ -343,7 +343,7 @@ Page({
         params.outingQty = formData.goodsList.sum("outingQty")     //一共的商品数量
         params.outAmt = 0     //  已出库金额
         params.outQty = 0     //  已出库数量         
-        params.automaticFlg = btnFormData ? btnFormData.flag : false //自动出出库标识 
+        params.flgAutoHandle = btnFormData ? btnFormData.flag : false //自动出出库标识 
         // params.fromId = this.data.purIdArray  //来源id
         // params.fromNo = formData.fromNo  //来源单号
         params.orgId = formData.orgId  //组织部门

+ 1 - 1
package-inventory/pages/other-warehousing/other-warehousing.js

@@ -336,7 +336,7 @@ Page({
         params.intoingQty = formData.goodsList.sum("intoingQty")     //一共的商品数量
         params.intoAmt = 0     //  已入库金额
         params.intoQty = 0     //  已入库数量         
-        params.automaticFlg = btnFormData ? btnFormData.flag : false //自动出入库标识      
+        params.flgAutoHandle = btnFormData ? btnFormData.flag : false //自动出入库标识      
         params.orgId = formData.orgId  //组织部门
         params.staffId = formData.staffId  // 员工
         //  // 供应商1 客户2 所有 传空

+ 4 - 3
package-purchase/pages/purchase-order/add/add.js

@@ -305,9 +305,7 @@ Page({
         //         card.max = 1
         //     }
         // })
-        // 刷新商品明细 显示 查看更多
-        let card = cardList_.filter(it => it.name == 'items');
-        this.selectComponent('#dk-form-bill').handleContentObj(card[0])
+ 
         this.setData({
             item: data,
             contentList: contentList_,
@@ -315,6 +313,9 @@ Page({
             popContent:popContent_,
             formData: JSON.stringify(data)
         })
+             // 刷新商品明细 显示 查看更多
+     let card = this.data.cardList.filter(it => it.name == 'items');
+     this.selectComponent('#'+this.data.formName).handleContentObj(card[0])
     },
 
 

+ 1 - 1
package-purchase/pages/purchase-order/add/add.wxml

@@ -6,7 +6,7 @@
 <!-- <dk-form id="{{formName}}" cardList="{{cardList}}" contentObj="{{contentObj}}" model:value="{{formData}}" bind:chooseData="chooseData">
 </dk-form> -->
 
-<dk-form-bill type="pur" id="dk-form-bill" routeObjName="{{routeObjName}}" cardList="{{cardList}}" titleTagCol="shortName" titleCol="skuCode" descCol="skuModel" priceCol="pricePurchase" quantityCol="itemQty" sumAmountCol="itemAmt" contentObj="{{contentObj}}" model:value="{{formData}}" popContent="{{popContent}}" bind:chooseData="chooseData" popType="sale" priceTitle="{{$t['wholesalePrice']}}:" bind:editItems="setGoods" bind:clear = "clear" table="{{table}}"
+<dk-form-bill id="{{formName}}"  type="pur"  routeObjName="{{routeObjName}}" cardList="{{cardList}}" titleTagCol="shortName" titleCol="skuCode" descCol="skuModel" priceCol="pricePurchase" quantityCol="itemQty" sumAmountCol="itemAmt" contentObj="{{contentObj}}" model:value="{{formData}}" popContent="{{popContent}}" bind:chooseData="chooseData" popType="sale" priceTitle="{{$t['wholesalePrice']}}:" bind:editItems="setGoods" bind:clear = "clear" table="{{table}}"
 bind:delItem="setGoods" bind:setGoods="setGoods">
 </dk-form-bill>
 

+ 5 - 3
package-purchase/pages/purchase-order/purchase-order-detail/purchase-order-detail.js

@@ -106,15 +106,17 @@ Page({
         card.content = data.goodsList.sum("itemAmt")
       }
     })
-    // 刷新商品明细 显示 查看更多
-    let card = cardList_.filter(it => it.name == 'items');
-    this.selectComponent('#dk-form-bill').handleContentObj(card[0])
+        
+   
     this.setData({
       item: data,
       contentList: contentList_,
       cardList: cardList_,
       formData: JSON.stringify(data)
     })
+     // 刷新商品明细 显示 查看更多
+     let card = this.data.cardList.filter(it => it.name == 'items');
+     this.selectComponent('#'+this.data.formName).handleContentObj(card[0])
   },
   /**
    * @desc : 关闭

+ 2 - 2
package-purchase/pages/purchase-order/purchase-order-detail/purchase-order-detail.wxml

@@ -21,7 +21,7 @@
       </view>
       <view data-item="{{item}}"  bind:tap="toEdit" style="text-align:center;position:absolute;right: 50px;top:10px;">
           <van-image custom-class="image-class" src="/static/img/edit.png" />
-        </view>
+      </view>
     </view>
     <!-- 收货人 -->
     <view style="display: flex;padding-right: 32rpx;">
@@ -92,7 +92,7 @@
 
 
  <!-- 商品信息 和 其他信息 -->
-<dk-form-bill id="dk-form-bill"  routeObjName="{{routeObjName}}" readonly ="{{true}}" 
+<dk-form-bill id="{{formName}}"  routeObjName="{{routeObjName}}" readonly ="{{true}}" 
 cardList="{{cardList}}"  titleTagCol ="shortName"  titleCol ="skuCode"   
 descCol = "skuModel" priceCol ="pricePur" quantityCol ="itemQty" sumAmountCol="itemAmt"  
 contentObj="{{contentObj}}" model:value="{{formData}}" popContent = "{{popContent}}" 

+ 180 - 31
package-purchase/pages/purchase-receipt/add/add.js

@@ -39,7 +39,8 @@ Page({
                 name: 'whName',
                 title: mixins.$t("warehouseId"), //'仓库',
                 type: 'drop',
-                dropType: 'warehouse'
+                dropType: 'warehouse',
+                required: true
             },
             {
                 code: 'skuSpec',
@@ -75,7 +76,7 @@ Page({
         contentObj: {
             main: [{
                     code: 'supId',
-                    name: 'supName',
+                    name: 'supplierName',
                     title: mixins.$t("supplier"), //'供应商',
                     type: 'choose',
                     required: true,
@@ -111,18 +112,7 @@ Page({
                 title: mixins.$t("sourceOrder"), //'关联源单',
                 urlKey: 'choosePurchaseOrder'
             }],
-            items: [{
-                code: 'collectType',
-                name: 'collectName',
-                type: 'drop',
-                required: true,
-                dropType: 'collect'
-            }, {
-                code: 'collectAmount',
-                type: 'number',
-                title: mixins.$t("amountCollected"), //'收款金额',
-                required: true
-            }],
+            items: [ ],
 
             other: [{
                 code: 'remarks',
@@ -138,7 +128,40 @@ Page({
         // 路由
         routeObjName: 'inbound',
         //接口
-        purchaseService: app.globalData['purchaseService'],
+        purchaseService: app.globalData['purchaseService'], //采购订单 路由
+        inboundProcessingService: app.globalData['inboundProcessingService'],
+    },
+    /**
+     * @desc : 选择框右边删除 回调
+     * @date : 2024/2/1 15:49
+     * @author : 王英杰
+     */
+    clear(e) {
+        let code = e.detail.code
+        let formData = JSON.parse(this.data.formData)
+        if (code == "sourceNo") { //来源单号
+            let contentList_ = this.data.contentList
+            let cardList = this.data.cardList
+            formData.goodsList = []
+            contentList_.forEach(card => {
+                if (card.code === 'amount') {
+                    card.content = 0
+                }
+            })
+            cardList.forEach(card => {
+                if (card.name === 'items') {
+                    card.itemAmt = 0
+                }
+            })
+            this.setData({
+                contentList: contentList_,
+                cardList,
+                chooseVisible: false,
+            })
+        }
+        this.setData({
+            formData: JSON.stringify(formData)
+        })
     },
     /**
      * @desc   : 绑定数据
@@ -152,7 +175,7 @@ Page({
         let data = e.detail.data.data
         if (code == "supId") { //供应商
             formData.supId = data.id
-            formData.supName = data.name
+            formData.supplierName = data.name
         }
         if (code == "staffId") { //员工
             formData.staffId = data.id
@@ -165,10 +188,13 @@ Page({
         if (code == "whId") { //仓库
             formData.whId = data.id
             formData.whName = data.name
-            formData.goodsList.forEach(element => { //总单的入库仓库 作为一个总开关 直接改变 所以品的仓库
-                element.whId = data.id
-                element.whName = data.whName
-            });
+            if(formData.goodsList){
+                formData.goodsList.forEach(element => { //总单的入库仓库 作为一个总开关 直接改变 所以品的仓库
+                    element.whId = data.id
+                    element.whName = data.whName
+                });
+            }
+       
         }
         if (code == "sourceNo") { //来源单  
             this.calculateTotal(data.chooosepurchaseItemResponseList)
@@ -179,9 +205,105 @@ Page({
             formData: JSON.stringify(formData)
         })
     },
+    /**
+     * @desc : 给表单赋值
+     * @date : 2024/2/1 15:49
+     * @author : 王英杰
+     */
+    setValuesByEdit(data) {
+        { //是否可编辑逻辑
+            if (data.fromId) { //有来源单据
+                this.setData({ //隐藏选商品按钮
+                    chooseVisible: true
+                })
+                if (this.data.isSysSetting) { //系统参数为自动办理
+                    if (this.data.nopay) { //未付款
+                        data.goodsList.forEach(element => {
+                            // (添加商品、修改数量不能超出订单商品范围)添加商品TODO(后期改为跳入来源单据让他选择原单数据回来)
+                            element['itemQty_max'] = element.purItemQty - element.purItemIntoingQty - element.purItemIntoQty + element.intoQty
+                        });
+                   
+                    } else { //已付款 (只可以编辑备注和附件)
+                        this.setData({
+                            readonly: true
+                        })
+                    }
+                } else { //系统参数为手动办理
+                    if (data.intoStatus = Constants.intoStatus.inBounding) { //入库中 可以编辑修改商品、数量(修改商品、数量不能超出订单商品范围)和备注附件
+                        data.goodsList.forEach(element => {
+                            // (添加商品、修改数量不能超出订单商品范围)添加商品TODO(后期改为跳入来源单据让他选择原单数据回来)
+                            element['itemQty_max'] = element.purItemQty - element.purItemIntoingQty - element.purItemIntoQty + element.intoQty
+                        });
+                    } else { //已入库(未付款、已付款),只可以编辑备注、附件
+                        this.setData({
+                            readonly: true
+                        })
+                    } 
+                }
+            } else { //无来源单据
+                if (this.data.isSysSetting) { //系统参数为自动办理  
+                    if (this.data.nopay) { //已入库(未付款),可以编辑修改数量(修改商品、数量不限制,数量改大时要校验库存量)和备注附件; 
+                    data.goodsList.forEach(element => {  //  设置库存量未最大值
+                        element['itemQty_max'] = element.invQty
+                    });
+                    } else { //已付款 (只可以编辑备注和附件)
+                        this.setData({
+                            readonly: true
+                        })
+                    }
+                } else { //系统参数为手动办理
+                    if (data.intoStatus = Constants.intoStatus.inBounded) { //已入库
+                        if(this.data.nopay){ //(未付款),可以编辑修改数量(修改商品、数量不限制,数量改大时要校验库存量)和备注附件 
+                          data.goodsList.forEach(element => {  //  设置库存量未最大值
+                            element['itemQty_max'] = element.invQty
+                        });
+                        }else{//已付款 (只可以编辑备注和附件)
+                            this.setData({
+                                readonly: true
+                            }) 
+                        } 
+                    } 
+                }
+            }
+        } 
+        let purIdArray_ = this.data.purIdArray //来源单id
+        let cardList_ = this.data.cardList
+        let contentList_ = this.data.contentList //底部按钮上的合计金额
+
+        // 提取purNo字段为数组,并去重
+        const purNoArray = [...new Set(data.goodsList.map(item => item.purNo))];
+        const purIdArray = [...new Set(data.goodsList.map(item => item.purId))]
+        // 将数组元素转换为逗号分隔的字符串
+        data.fromNo = purNoArray.join(','); //来源单号
+        purIdArray_ = purIdArray.join(',');
+
+        data.goodsList.forEach(element => {
+            element.itemAmt = element.intoingAmt * element.intoingQty
+            element.itemQty = element.intoingQty
+        });
+        cardList_.forEach(card => { //循环出商品总共价格 展示用
+            if (card.name === 'items') {
+                card.itemAmt = data.goodsList.sum("itemAmt")
+            }
+        })
+        contentList_.forEach(card => { //底部按钮 展示价格 用
+            if (card.code === 'amount') {
+                card.content = data.goodsList.sum("itemAmt")
+            }
+        })
+           // 刷新商品明细 显示 查看更多
+    let card = this.data.cardList.filter(it => it.name == 'items');
+    this.selectComponent('#'+this.data.formName).handleContentObj(card[0])
 
+        this.setData({
+            contentList: contentList_,
+            purIdArray: purIdArray_,
+            cardList: cardList_,
+            formData: JSON.stringify(data)
+        })
+    },
     /**
-     * @desc :处理商品
+     * @desc :处理商品(选择采购订单处理)
      * @date : 2024/2/1 15:49
      * @author : 王英杰
      */
@@ -201,6 +323,7 @@ Page({
         formData.goodsList.forEach(element => {
             element.intoingAmt = element.itemAmt
             element.intoingQty = element.itemQty
+            element.sumAmt = element.itemQty * element.itemAmt
             element.costPrice = element.pricePur
             element.costAmt = element.itemAmt
             element.fromId = element.purId
@@ -218,12 +341,12 @@ Page({
         });
         cardList_.forEach(card => { //循环出商品总共价格 展示用
             if (card.name === 'items') {
-                card.itemAmt = formData.goodsList.sum("itemAmt")
+                card.itemAmt = formData.goodsList.sum("sumAmt")
             }
         })
         contentList_.forEach(card => { //底部按钮 展示价格 用
             if (card.code === 'amount') {
-                card.content = formData.goodsList.sum("itemAmt")
+                card.content = formData.goodsList.sum("sumAmt")
             }
         })
         this.setData({
@@ -278,7 +401,7 @@ Page({
      * @date : 2024/2/1 15:49
      * @author : 王英杰
      */
-    validData() {
+    validData() { 
         let formData = JSON.parse(this.data.formData)
         let that = this
         if (formData.goodsList == null || formData.goodsList.length == 0) {
@@ -286,6 +409,7 @@ Page({
                 title: "请选择商品明细",
                 icon: 'none'
             })
+             
             return false
         }
         // 明细的数量和仓库不能为空
@@ -296,6 +420,7 @@ Page({
                     title: mixins.$t("chooseWh"),
                     icon: 'none'
                 })
+                 
                 return false
             }
             //如果 设置了总单的仓库 然后又进行选品 没设置一样的仓库 那就把总单上的仓库清空
@@ -313,9 +438,10 @@ Page({
                     title: mixins.$t("inputWords") + "[" + element.skuCode + "]" + mixins.$t("count"),
                     icon: 'none'
                 })
+                 
                 return false
             }
-        }
+        }  
         return true
     },
     /**
@@ -325,13 +451,12 @@ Page({
      */
     setParams(params) {
         let btnFormData = this.data.btnFormData ? JSON.parse(this.data.btnFormData) : ''
-
         let formData = JSON.parse(this.data.formData)
         params.intoingAmt = formData.goodsList.sum("intoingAmt") //金额
         params.intoingQty = formData.goodsList.sum("intoingQty") //一共的商品数量
         params.intoAmt = 0 //  已入库金额
         params.intoQty = 0 //  已入库数量         
-        params.automaticFlg = btnFormData ? btnFormData.flag : false //自动出入库标识 
+        params.flgAutoHandle = btnFormData ? btnFormData.flag : false //自动出入库标识 
         params.fromId = this.data.purIdArray //来源id
         params.fromNo = formData.fromNo //来源单号
         params.orgId = formData.orgId //组织部门
@@ -351,10 +476,15 @@ Page({
      * @author : 王英杰
      */
     saveData() {
-        return this.excute(this.data.service, this.data.service.purchaseInboundInsert + "/insert", this.data.params)
+        if (this.data.formMode == Constants.formMode.edit) { //编辑保存
+            return this.excute(this.data.inboundProcessingService, this.data.inboundProcessingService.inboundUpdate, this.data.params)
+        } else { //新建保存
+            return this.excute(this.data.inboundProcessingService, this.data.inboundProcessingService.inboundInsert, this.data.params)
+        }
+
     },
     /**
-     * @desc : 查询数据
+     * @desc : 查询数据 (转入库调用)
      * @date : 2024/2/1 15:49
      * @author : 王英杰
      */
@@ -366,7 +496,17 @@ Page({
         let excute = this.excute(this.data.purchaseService, e.id, {});
         excute.then(res => {
             if (res.data.code === Constants.SUCESS_CODE) {
+                let formData = JSON.parse(this.data.formData)
+                formData = res.data.data
+                this.setData({
+                    formData:JSON.stringify(formData),
+                    chooseVisible: true
+                })
                 this.calculateTotal(res.data.data.purchaseItemResponseList)
+                   // 刷新商品明细 显示 查看更多
+                 let card = this.data.cardList.filter(it => it.name == 'items');
+             this.selectComponent('#'+this.data.formName).handleContentObj(card[0])
+
             }
         })
     },
@@ -376,15 +516,24 @@ Page({
      * @author : 王英杰
      */
     loadInit() {
-        let isSysSetting = false  //true为自动办理  false 为手动办理
+        let isSysSetting = false //true为自动办理  false 为手动办理
         let contentList = this.data.contentList
         if (isSysSetting) { //系统参数中的自动办理参数  
             // 使用 filter 方法删除 code 为 flag 的项  
             contentList = contentList.filter(item => item.code !== 'flag');
             this.setData({
-                contentList:contentList,
+                contentList: contentList,
                 isSysSetting
             })
         }
+        if (this.data.formMode == Constants.formMode.edit) {
+            wx.setNavigationBarTitle({
+                title: mixins.$t('editPurInbound') //"编辑采购入库",  
+            })
+        } else {
+            wx.setNavigationBarTitle({
+                title: mixins.$t('addPurInbound') //"新建采购入库",
+            })
+        }
     },
 })

+ 1 - 1
package-purchase/pages/purchase-receipt/add/add.wxml

@@ -6,7 +6,7 @@
 <!-- <dk-form id="{{formName}}" cardList="{{cardList}}" contentObj="{{contentObj}}" model:value="{{formData}}" bind:chooseData="chooseData">
 </dk-form> -->
 
-<dk-form-bill type="pur" id="{{formName}}" routeObjName="{{routeObjName}}" cardList="{{cardList}}" titleTagCol="shortName" titleCol="skuCode" descCol="skuModel" priceCol="pricePur" quantityCol="itemQty" sumAmountCol="itemAmt" contentObj="{{contentObj}}" model:value="{{formData}}" popContent="{{popContent}}" bind:chooseData="chooseData" popType="sale" priceTitle="批发价:" bind:editItems="setGoods" 
+<dk-form-bill type="pur" id="{{formName}}" routeObjName="{{routeObjName}}" cardList="{{cardList}}" titleTagCol="shortName" titleCol="skuCode" descCol="skuModel" priceCol="intoingAmt" quantityCol="intoingQty" sumAmountCol="itemAmt" contentObj="{{contentObj}}" model:value="{{formData}}" popContent="{{popContent}}" bind:chooseData="chooseData" popType="sale" priceTitle="批发价:" bind:editItems="setGoods" bind:clear = "clear" readonly = "{{readonly}}"chooseVisible="{{!chooseVisible}}"
 bind:delItem="setGoods" bind:setGoods="setGoods">
 </dk-form-bill>
 

+ 22 - 0
package-purchase/pages/purchase-receipt/detail/detail.js

@@ -1,5 +1,6 @@
 // package-basic-data/pages/test/add/add.js
 const mixins = require('@/mixins/index.js')
+const Constants = require('@/utils/Constants');
 const app = getApp()
 Page({
   mixins: [mixins],
@@ -106,6 +107,27 @@ Page({
     // 路由
     routeObjName: 'inbound',
   },
+    /**
+   * @desc : (编辑)
+   * @date : 2024/2/1 15:49
+   * @author : 王英杰
+   */
+  toEdit(e) {
+    let intoId = e.currentTarget.dataset.item.intoId
+    wx.navigateTo({
+      url: this.data.route.add.url,
+      events: {
+        // 回调后,在这里给页面赋值
+        bandData: function (e) {}
+      },
+      success: function (res) {
+        res.eventChannel.emit('params', {
+          id: intoId,
+          formMode: Constants.formMode.edit
+        })
+      }
+    })
+  },
   /**
    * @desc : dk-from choose 回调事件
    * @date : 2024/2/1 15:49

+ 3 - 1
package-purchase/pages/purchase-receipt/detail/detail.wxml

@@ -21,7 +21,9 @@
       <view style="padding-left: 14rpx;padding-top: 19rpx;font-size: 26rpx;line-height: 36rpx;color: #FFFFFF;">
         {{itemData.supplierName}}
       </view>
-
+      <view data-item="{{itemData}}"  bind:tap="toEdit" style="text-align:center;position:absolute;right: 50px;top:10px;">
+          <van-image custom-class="image-class" src="/static/img/edit.png" />
+     </view>
     </view>
     <!-- 收货人 -->
     <view style="display: flex;padding-right: 32rpx;">

+ 7 - 0
package-purchase/pages/purchase-receipt/detail/detail.wxss

@@ -19,4 +19,11 @@
   color:#fff !important;
   font-size: 16px !important;
   font-weight: 500 !important;
+}
+/*图标显示*/
+.image-class {
+  width: 36rpx;
+  height: 36rpx;
+  left: 16rpx;
+  top: calc((100% - 36rpx)/2);
 }

+ 87 - 10
package-purchase/pages/purchase-return/add/add.js

@@ -18,7 +18,7 @@ Page({
     showPopFlag: true,
     stepperFlag: true,
     cardList: [
-      { name: 'items', title: mixins.$t("goodsDetail"), chooseGoodsFlag: '', sumReturnAmt: 0, displayNum: 2 },
+      { name: 'items', title: mixins.$t("goodsDetail"), chooseGoodsFlag: false, sumReturnAmt: 0, displayNum: 2 },
       { name: 'other', title: mixins.$t("otherInfo") }
     ],
 
@@ -27,6 +27,15 @@ Page({
     ],
 
     contentObj: {
+      main: [
+        { code: 'supId', name: 'supName', title: mixins.$t("supplier"), type: 'choose', required: true, urlKey: 'chooseSupplier' },
+        {
+          code: 'staffId', name: 'staffName', title: mixins.$t("procureStaff"), type: 'choose', urlKey: 'chooseStaff'
+        },
+        {
+          code: 'orgId', name: 'orgName', title: mixins.$t("procureOrg"), type: 'choose', urlKey: 'chooseOrg'
+        }
+      ],
       other: [{
         code: 'remarks',
         type: 'textarea',
@@ -55,16 +64,49 @@ Page({
       type: 'number'
     }],
   },
+  /**
+   * @desc   : 绑定数据
+   * @author : 于继渤
+   * @date   : 2024年3月12日
+   */
+  chooseData(e) {
+    console.log("t", e, this.data.formData);
+    let formData = JSON.parse(this.data.formData)
+    let code = e.detail.code
+    let data = e.detail.data.data
+    if (code == "supId") { //供应商
+      formData.supId = data.id
+      formData.supName = data.name
+    }
+    if (code == "staffId") { //员工
+      formData.staffId = data.id
+      formData.staffName = data.name
+    }
+    if (code == "orgId") { //员工
+      formData.orgId = data.id
+      formData.orgName = data.name
+    }
 
+    this.setData({
+      formData: JSON.stringify(formData)
+    })
+  },
   /**
 * @desc : 设置保存参数
 * @date : 2024/3/19 15:49
 * @author : 于继渤
 */
   setParams(params) {
-    if (this.data.formMode !== 'edit') {
+    if (this.data.formMode !== 'edit' && this.data.formType !== 'add') {
       params.fromId = this.data.item.purId ? this.data.item.purId : params.purId //采购订单id
       params.fromNo = this.data.item.purNo ? this.data.item.purNo : params.purNo //采购订单id
+      params.supId = this.data.item.supId
+    } else {
+      //没源单的明细
+      let itemIndex = 0
+      params.goodsList.forEach(res => {
+        res.itemIndex = itemIndex++
+      })
     }
 
     let btnFormData = this.data.btnFormData ? JSON.parse(this.data.btnFormData) : ''
@@ -74,8 +116,8 @@ Page({
     params.orgId = app.globalData.user.orgId
     params.staffId = app.globalData.user.staffId
     params.makeStaff = app.globalData.user.staffId
-    params.supId = this.data.item.supId
-    params.intoDate =  utils.formatDayTime(new Date())
+
+    params.intoDate = utils.formatDayTime(new Date())
     delete params['goodsList']
     delete params['sumReturnAmt']
     delete params['sumReturnQty']
@@ -130,7 +172,31 @@ Page({
     this.calculateTotal()
   },
 
-
+  /**
+     * @desc : 外露设置产品方法 
+     * @date : 2024/2/1 15:49
+     * @author : 于继渤
+     */
+  setGoods(e) {
+    console.log('外露设置产品方法', e)
+    // let formData = JSON.parse(this.data.formData)
+    // let goodsList = e.detail.data
+    // let sumReturnAmt = Number(0) //合计金额
+    // let sumReturnQty = Number(0)
+    // goodsList.forEach(res => {
+    //   res.priceReturn = res.priceStandard * -1
+    //   sumReturnAmt += res.priceReturn * res.itemQty
+    //   res.itemAmt = Number(res.priceReturn * res.itemQty)
+    //   res.itemQtyMax = res.usableQty * -1
+    //   res.itemQtyMin = -1
+    //   res.itemQty = res.itemQty * -1
+    // })
+    // formData.sumReturnAmt = sumReturnAmt.toFixed(2)
+    // this.setData({
+    //   formData: JSON.stringify(formData)
+    // })
+    this.calculateTotal()
+  },
   /**
 * @desc :计算金额
 * @date : 2024/2/1 15:49
@@ -153,14 +219,16 @@ Page({
     formData.returnQty = sumReturnQty
     let cardList = this.data.cardList
     let contentList = this.data.contentList
-    cardList[0].sumReturnAmt = sumReturnAmt.toFixed(2)
+    cardList[1].sumReturnAmt = sumReturnAmt.toFixed(2)
     if (contentList.length > 0) {
       contentList[2].content = sumReturnAmt.toFixed(2)
     }
     let beforeSumAmount = this.data.beforeSumAmount
     let afterSumAmount = beforeSumAmount - sumReturnAmt
+
+    console.log('sumReturnAmt', sumReturnAmt)
     this.setData({
-      afterSumAmount: afterSumAmount ,
+      afterSumAmount: afterSumAmount,
       cardList: cardList,
       contentList: contentList,
       formData: JSON.stringify(formData),
@@ -244,12 +312,12 @@ Page({
     let that = this
     const eventChannel = this.getOpenerEventChannel()
     eventChannel.on('params', function (data) {
-      if (that.data.formMode != Constants.formMode.edit) {
+      if (that.data.formMode != Constants.formMode.edit && that.data.formType != Constants.formMode.add) {
         let formData = that.data.formData
         formData = {
           goodsList: data.choooseInboundItemList
-        } 
-        console.log('data',data)
+        }
+        console.log('data', data)
         that.setData({
           formData: JSON.stringify(formData),
           beforeSumAmount: Number(data.beforeSumAmount),
@@ -257,6 +325,15 @@ Page({
           item: JSON.parse(data.item)
         })
         that.calculateTotal()
+      } else if (that.data.formMode == Constants.formMode.add && that.data.formType == Constants.formMode.add) {
+        let cardList = that.data.cardList
+        that.setData({
+          cardList: [
+            { name: 'main' },
+            { name: 'items', title: mixins.$t("goodsDetail"), chooseGoodsFlag: true },
+            { name: 'other', title: mixins.$t("otherInfo") }
+          ]
+        })
       }
 
     })

+ 8 - 9
package-purchase/pages/purchase-return/add/add.wxml

@@ -1,10 +1,9 @@
-<wxs src='../../../../utils/numberFormat.wxs' module="numberFormat"></wxs>
-<wxs src='../../../../utils/wxmlUtil.wxs' module="wxmlUtil"></wxs>
+
 <van-dialog id="van-dialog" />
-<loading wx:if="{{loading}}" loadingName="加载中" backgroundColor="#f2f2f2;" opacity="0.8"></loading>
+<loading wx:if="{{loading}}" ></loading>
 
 <!-- 客户信息组件 -->
-<view class="return-style-blue">
+<view class="return-style-blue" wx:if="{{formType !== 'add'}}">
   <view style="flex-direction: column;justify-content: center;align-items: flex-start;background: linear-gradient(90.12deg, #718AC6 0.84%, #4A5E98 99.43%);border-radius: 15rpx 15rpx 0rpx 0rpx;">
     <view style="padding-right: 32rpx;padding-bottom: 15rpx;">
       <!-- 供应商 -->
@@ -47,7 +46,7 @@
 </view>
 
 <!--收款金额  -->
-<view class="return-style">
+<view class="return-style"  wx:if="{{formType !== 'add'}}">
   <view style="display: flex;  margin-bottom: 3vw;">
     <view style="width:50%;color:#1B365D;text-align: center;font-size:4vw; border-right: 1rpx lightgray solid ;" bindtap="toChooseGoods">
       <view style="font-weight:bold;font-size:15px; margin-bottom: -11px;">
@@ -67,11 +66,11 @@
 </view>
 
 
-<dk-form-bill id="dk-form-bill"  routeObjName="{{routeObjName}}"  
-cardList="{{cardList}}"  titleTagCol ="shortName"  titleCol ="skuCode"   showPopFlag="{{showPopFlag}}"
-descCol = "skuModel" priceCol ="priceReturn" quantityCol ="itemQty"   quantityMin="itemQtyMin" quantityMax="itemQtyMax" sumAmountCol ="sumReturnAmt"
+<dk-form-bill id="dk-form-bill"  routeObjName="{{routeObjName}}"   type="purReturn"
+cardList="{{cardList}}"  titleTagCol="shortName"  titleCol="skuCode"   showPopFlag="{{showPopFlag}}"
+descCol="skuModel" priceCol="priceReturn" quantityCol ="itemQty"   quantityMin="itemQtyMin" quantityMax="itemQtyMax" sumAmountCol="sumReturnAmt"  bind:chooseData="chooseData"
 contentObj="{{contentObj}}" model:value="{{formData}}"
-popType = "sale" 
+popType= "sale"   bind:setGoods="setGoods"
 
 bind:onStepper="onChangeStepper"
 quantityMin="itemQtyMin" 

+ 21 - 1
package-purchase/pages/purchase-return/purchase-return.js

@@ -32,6 +32,7 @@ Page({
         name: [{ name: 'orgName', title: '' },
         { name: 'staffName', title: mixins.$t("staffId") }], title: mixins.$t("storeInformation")
       }],
+    
     // 弹出按钮
     buttonList: [{ name: 'cancel', title: mixins.$t("invaidOrder") }],
     // 路由
@@ -113,9 +114,28 @@ Page({
    */
   open(e){
     console.log(e)
+    let item = e.detail.item
     if(e.detail && e.detail.name == 'cancel'){
         //调用作废接口
-        this.cancel(e.detail.item.intoId)
+        this.cancel(item.intoId)
+    }else{
+      wx.navigateTo({
+        url: this.data.route.add.url,
+        events: {
+          // 保存成功后刷新页面
+          refresh: function (data) {
+            // 刷新一览界面
+            _this.searchData();
+          }
+        },
+        success: function (res) {
+          let data = {
+            formMode: Constants.formMode.add,
+            formType: Constants.formMode.add,
+          }
+          res.eventChannel.emit('params', data);
+        }
+      })
     }
   },
    /**

+ 32 - 232
package-sales/pages/order-return/order-return.js

@@ -5,10 +5,10 @@
  *		2.销售退货列表
  * 编辑履历:
  *		作者				日期					版本				修改内容
- *		王英杰		        2022-0-12	            1.00		   	    
+ *		于继渤		        2022-0-12	            1.00		   	    
  *******************************************************************************/
 const Constants = require('@/utils/Constants.js');
-const util = require('@/utils/util.js') 
+const util = require('@/utils/util.js')
 const mixins = require('@/mixins/index.js')
 Page({
   mixins: [mixins],
@@ -16,15 +16,15 @@ Page({
    * 页面的初始数据 
    */
   data: {
-    tagList:[{title:"全部单据"},{title:"待出库"},{title:"已出库"}],
-    
-     // 查询条件
-     searchContent: [{
+    tagList: [{ title: "全部单据" }, { title: "待出库" }, { title: "已出库" }],
+
+    // 查询条件
+    searchContent: [{
       code: 'createtime',
       title: '近30天',
       defaultValue: 5,
       searchType: Constants.searchType.date
-    } , {
+    }, {
       code: 'choose',
       title: '筛选',
       searchType: Constants.searchType.pick
@@ -56,80 +56,35 @@ Page({
       dataType: 'date'
     }],
 
-    // 假数据
-    dataList: [{
-      salesChannelName: '',
-      customerId: 11,
-      customerName: '张三',
-      displayStatus: '待入库',
-      backgroundColor:'red',
-      orderNo: 'SA-LWYD-ZOO-202401300SBG',
-      customerPhone: '15659741980',
-      addressFull: '辽宁省沈阳市浑南区沈阳市浑南区人民政府(新聪街西)1',
-      orgName: '零售部',
-      staffName: '薛玉',
-      tsumAmount: 3000,
-      categoryQuantity: '',
-      tsumQuantity: 1,
-      data:'2024-03-12',
-      amont:1009,
-      makeTime: '2024-03-12' 
-    }, {
-      salesChannelName: '',
-      customerName: '李四',
-      displayStatus: '已入库', 
-      orderNo: 'SA-LWYD-ZOO-202401300SBD',
-      customerPhone: '15659741980',
-      addressFull: '辽宁省沈阳市浑南区沈阳市浑南区人民政府(新聪街西)2',
-      orgName: '零售部',
-      staffName: '薛玉',
-      tsumAmount: 4000,
-      categoryQuantity: '',
-      tsumQuantity: 2,
-      data:'2024-03-12',
-      amont:1009,
-      makeTime: '2024-03-12' 
-    }],
+
 
     // 列表区(脚部金额)
     footerAmount: {
-      name: 'tsumAmount',
-      title: '共计金额'
+      name: 'outAmt',
+      title: '退货金额'
     },
     // 列表区(脚部信息)
     footerInfo: [{
       name: 'categoryQuantity',
       title: '共计'
     }, {
-      name: 'tsumQuantity',
+      name: 'outQty',
       title: '件'
     }],
     // 列表区(内容)
-    contentList: [{
-      name: 'orderNo',
-      title: '订单编号'
-    }, {
-      name: [{
-        name: 'staffName',
-        title: ''
-      },{
-        name: 'customerPhone',
-        title: ''
-      }, ],
-      title: '收获信息'
-    }, {
-      name: 'addressFull',
-      title: '客户地址'
-    },  {
-      name: 'makeTime',
-      title: '预计收获日期'
-    },],
-
+    contentList: [
+      { name: 'outNo', title: '订单编号' },
+      { name: 'cusPhone', title: '客户电话' },
+      { name: 'addressFull', title: '客户地址' },
+      { name: [{ name: 'orgName', title: '' }, { name: 'staffName', title: mixins.$t('staffId')  }], title: mixins.$t('storeInformation') }
+    ],
+    buttonSaveList: [{ code: 'add', title: mixins.$t("add") }],
+    contentSaveList: [{ code: 'need', title: mixins.$t("totalAmount"), type: 'str' }, { code: 'amount', content: 2000, type: 'number' }],
     contentObj: {
       '成交': [{
         name: 'orderNo',
         title: '订单单号'
-      } , {
+      }, {
         name: [{
           name: 'orgName',
           title: ''
@@ -161,178 +116,23 @@ Page({
     buttonList: [{
       name: 'warehousingProcessing',
       title: '入库办理'
-      }, , {
-        name: 'salesReturnReversal',
-        title: '销售退货冲正'
-      } 
-     
-    ],
+    }, , {
+      name: 'salesReturnReversal',
+      title: '销售退货冲正'
+    }
 
-    totallength: 0, //视图下方提醒数量
+    ],
 
     // 路由
-    routeObjName: 'customer',
-    active:0
-  },
-   /**
-   * 切换 已出库 未出库
-   */
-  onChangeTabs(e) {
-      let index =   e.detail.detail.index
-      console.log("qeaqwewa", index)
-    console.log("qeaqwewa", e)
-    this.setData({
-      active:index, 
-    })
-     
-  },
-  /**
-   * 跳转客户详细
-   */
-  toDetail(e) {
-    
-    
-      wx.navigateTo({
-        url: './detail/detail?item=' + encodeURIComponent(JSON.stringify(e.currentTarget.dataset.item)) + '&sourcePage=outbound-processing',
-      })
-   
-  },
-  toTitle(e) {
-    console.log('t1', e);
-  },
-  toStatus(e) {
-    console.log('t2', e);
-  },
-  toPoint(e) {
-    console.log('t3', e);
-    this.setData({
-      showShare: true
-    })
-  },
-  toAdd() {
-    wx.navigateTo({
-      url: './select-original-order/select-original-order',
-    })
-  },
-  /**
-   * @desc : 右上角三个小点 点击回调事件
-   * @date : 2024/2/1 15:49
-   * @author : 王英杰
-   */
-  open(e) {
-     let name = e.detail.name
-     let item = e.detail.item 
-     if(name == 'warehousingProcessing'){  //入库办理
-      wx.navigateTo({
-        url: '/package-sales/pages/sales-return-reversal/sales-return-reversal?item=' + encodeURIComponent(JSON.stringify(e.currentTarget.dataset.item)) + '&sourcePage=sales-return-reversal-add',
-      })
-     }
-     if(name == 'salesReturnReversal'){  //salesReturnReversal
-   
-     }
-   
-       
-  
-  },
-  /**
-   * @desc : 校验
-   * @date : 2024/2/1 15:49
-   * @author : 周兴
-   */
-  openValidData(item, name) {
-    console.log('item', item, name, item.customerId);
-    if (!item.customerId) {
-      wx.showToast({
-        title: '无此联系人,或陌生接待',
-        icon: 'none'
-      })
-      return false;
-    }
-    return true;
+    routeObjName: 'saleOutBoundReturn',
+    active: 0
   },
-
   /**
-   * @desc : 查询
-   * @date : 2024/2/1 15:49
-   * @author : 周兴
-   */
+     * @desc : 加载数据
+     * @author : 于继渤
+     * @date : 2024/1/23 9:16
+     */
   getData(params) {
-    console.log('fff', params);
-  },
-
-  /**
-   * 生命周期函数--监听页面加载
-   */
-  onLoad: function (options) {
-    //按钮权限
-
-    // let Customer_Follow = common.hasButtonRight(Constants.Customer_Follow) //跟进
-    // let Customer_Follow_Task = common.hasButtonRight(Constants.Customer_Follow_Task) //跟进任务
-    // let Customer_Order = common.hasButtonRight(Constants.Customer_Order) //销售订单
-    // let Customer_Receive = common.hasButtonRight(Constants.Customer_Receive) //客户收款
-    // let Customer_Add = common.hasButtonRight(Constants.Customer_Add) //客户新建
-
-    this.setData({
-      Customer_Follow: true,
-      Customer_Follow_Task: true,
-      Customer_Order: true,
-      Customer_Receive: true,
-      Customer_Add: true
-
-    })
-
-
-
-
-    if (JSON.stringify(options) !== '{}') {
-
-      if (options.frommine) {
-
-        let frommine = JSON.parse(options.frommine)
-        var createtime = this.selectComponent('#createtime');
-        createtime.data.dataDefaultSearch = util.jumpPageDate(frommine.date.value)
-        createtime.data.createTimeType = frommine.date
-
-        let keyType = this.selectComponent('#keyType')
-        let keyTypeList = keyType.data.moreList
-        keyTypeList.forEach(kIt => {
-          if (frommine.keyTypeList) {
-            if (frommine.keyTypeList.some(it => kIt.id === it)) {
-              kIt.infotype = 'info'
-            }
-          }
-        })
-        keyType.setData({
-          moreList: keyTypeList
-        })
-
-        let searchForm = {
-          ...this.data.searchForm
-        }
-        searchForm.keyTypeList = frommine.keyTypeNameList
-
-        this.setData({
-          active: frommine.active,
-          createTimeType: frommine.date,
-          searchForm: searchForm,
-          searchFormNumber: (frommine.keyTypeNameList && frommine.keyTypeNameList.length > 0) ? 1 : null,
-          createTimeSearch: util.jumpPageDate(frommine.date.value),
-          staffIds: frommine.staffId ? [frommine.staffId] : [],
-          staffNames: frommine.staffNames,
-        })
-
-        createtime.init()
-      }
-    } else {
-      // this.searchData()
-    }
-  },
-  /**
-   * 生命周期函数--监听页面显示
-   */
-  onShow: function () {
-    if (this.data.selectflag) {
-      // this.searchData()
-    }
+    return this.excute(this.data.service, this.data.service.selectByCond, params);
   },
 })

+ 4 - 8
package-sales/pages/order-return/order-return.wxml

@@ -1,6 +1,6 @@
 <!-- 前台导入wxmlUtil.wxs -->
 <wxs src='/utils/wxmlUtil.wxs' module="wxmlUtil"></wxs>
-<loading wx:if="{{loading}}" loadingName="{{$t['loading']}}" backgroundColor="#f2f2f2;" opacity="0.8"></loading>
+<loading wx:if="{{loading}}" ></loading>
 <van-sticky scroll-top="0">
   <!-- 查询条件 -->
   <dk-dropdown-menu model:searchForm="{{searchForm}}" menuList="{{searchContent}}" pullMenuList="{{pullMenuList}}" bind:search="searchData" searchTextPlaceholder="{{wxmlUtil.setSearchPlaceholder($t,['customerName','orderNo','telephone','adddress','contractNumber'])}}">
@@ -9,16 +9,12 @@
   <dk-tabs active="{{active}}" list="{{tagList}}" bind:onChange="onChangeTabs">    </dk-tabs>
 </van-sticky>
 
-<!-- 暂无数据 -->
-<van-empty wx:if="{{dataList.length<=0}}" description="{{$t['nodata']}}" />
 
 <!-- 列表区 -->
-<dk-list  list="{{dataList}}" titleCorner="salesChannelName" title="customerName"collectCol="collectAmount"  status="displayStatus" subTitle="makeTime" content="{{contentList}}" contentObj="{{contentObj}}"  footerAmount="{{footerAmount}}" footerInfo="{{footerInfo}}" bind:toDetail="toDetail" bind:toTitle="toTitle" bind:toStatus="toStatus" bind:toPoint="toPoint" routeObjName="{{routeObjName}}" buttonList="{{buttonList}}" bind:open="open"></dk-list>
-
-<van-divider wx:if="{{noMore}}" contentPosition="center" borderColor="#DCDCDC">{{$t['noMore']}}~</van-divider>
-<view style="height: 135rpx;"></view>
+<dk-list  list="{{tableData}}" flgSubFormatDate="{{true}}" titleCorner="salesChannel" title="cusName" collectCol="collectAmount"  status="outStatusName" subTitle="makeTime" content="{{contentList}}" contentObj="{{contentObj}}"  footerAmount="{{footerAmount}}" footerInfo="{{footerInfo}}" bind:toDetail="toDetail" bind:toTitle="toTitle" bind:toStatus="toStatus" bind:toPoint="toPoint" routeObjName="{{routeObjName}}" buttonList="{{buttonList}}" bind:open="open"></dk-list>
 
+<view style="height: 200rpx;"></view>
 
 
 <!-- 新建按钮 -->
-<dk-save-bottom flagTypeName="order-add" selectTotallength="{{selectTotallength}}" selectlength="{{selectlength}}" totallength="{{numberFormat.toThousandCents(totallength)}}" bind:submit="toAdd"   submitFlag="{{true}}" />
+<dk-save-button model:value="{{btnFormData}}" btnAutoWidthFlag="{{true}}" btnRightFlag="{{true}}" buttonList="{{buttonSaveList}}" contentList="{{contentSaveList}}" bind:open="open"></dk-save-button>

+ 1 - 0
utils/Constants.js

@@ -223,6 +223,7 @@ module.exports = {
     // 采购订单
     pur: 'pur',
     out: 'out',
+    purReturn: 'purReturn',
   },
 
   // 收款状态