王英杰 hai 1 ano
pai
achega
82850f3c1b

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

@@ -17,8 +17,8 @@ module.exports = {
     otherOutboundUpdate: 'outbound_update', //编辑
     repeal: 'repeal', //作废
     getOutReturnForUpdate: 'get_out_return_for_update', //作废
-    saleReturnOutboundCancel:'outbound_cancel'
- 
+    saleReturnOutboundCancel:'outbound_cancel',
+    outboundInsertRefund:'outbound_insert_refund',//新建销售退货 退款
   },
 
   routeUrl: {

+ 10 - 0
components/dkbase/dk-popup/dk-popup.js

@@ -530,6 +530,16 @@ Component({
         loading: false
       })
     },
+   /**
+    * @desc   : 清除数据
+    * @author : 周兴
+    * @date   : 2024/2/2 11:46
+    */
+   setLoading(loading) { 
+    this.setData({ 
+      loading: loading
+    })
+  },
 
     /**
     * @desc   : 清除数据指定

+ 3 - 2
mixins/index.js

@@ -427,11 +427,12 @@ module.exports = {
     saveFlag = true,
     url,
     dialogMes
-  }) {
+  }) { 
     // 解决点击太快,blur没有切换过来的问题
     setTimeout(() => {
       // 校验
       this._validData().then(res => {
+        console.log('_validData',res);
         if (!res) {
           return;
         }
@@ -583,7 +584,7 @@ module.exports = {
       // 非空校验
       if (this.data.formName) {
         const component = this.selectComponent('#' + this.data.formName);
-        if (component && component.validData) {
+        if (component && component.validData) { 
           let valid = component.validData();
           console.log('valid', valid);
           if (!valid) {

+ 50 - 6
package-base-select/pages/select-collection_confirm/select-collection_confirm.js

@@ -33,6 +33,7 @@ mixins: [mixins],
       otherReceivableService: app.globalData['otherReceivableService'],
       orderService: app.globalData['orderService'],
       otherPayableService: app.globalData['otherPayableService'],
+      saleOutBoundReturnService: app.globalData['saleOutBoundReturnService'],
     },
 
     /**
@@ -470,13 +471,55 @@ mixins: [mixins],
           )
         })
         params.paymentList = paymentList
+      }else if (this.data.formType == 10) { //销售退货 >>> 客户退款 
+        //新建销售退货参数
+        let itemIndex = 0
+        let formData = JSON.parse(this.data.formData) 
+        params.fromId = formData.orderId
+        let btnFormData = formData.btnFormData 
+        params.flgAutoHandle = btnFormData ? btnFormData.flag : false //自动出库标识 
+        formData.goodsList.forEach(res => { 
+          res.itemIndex = itemIndex++
+          res.canNegativeFlag = true 
+          if (params.flgAutoHandle) {
+            res.outBox = res.box
+            res.outPiece = res.piece
+          } else {
+            res.outingBox = res.box
+            res.outingPiece = res.piece
+          } 
+            delete res['itemId']  
+        }) 
+         itemList = formData.goodsList //明细  
+        params.makeStaff = app.globalData.user.staffId
+        // params.deleteItemList = params.deleteList ? params.deleteList : []  
+        params.addressName = formData.addressName
+        params.objectId = formData.cusId
+        params.canNegativeFlag = true
+        params.outDate = utils.formatDayTime(new Date())  
+           //客户退款保存参数 
+           params.sumAmtRec = Number(formData.sumAmtRec)
+           params.rpType = Constants.rpType.returnReceipt
+           //编辑退款 
+           let itemListRecPayItemVO = []
+             tableData.forEach(item => {
+              itemListRecPayItemVO.push(
+                 {
+                   amtRec: item.sumAmount,
+                   balance: item.balance,
+                   macCode: item.macCode,
+                   macId: item.macId,
+                   macName: item.macName,
+                 }
+               )
+             })
+             params.accDate = params.accDate ? params.accDate : utils.formatDayTime(new Date())  
+             params.itemListRecPayItemVO = itemListRecPayItemVO
       }
 
       if (this.data.formType !== 8) {
         params.itemList = itemList
-      }
-
-
+      } 
       return params
     },
 
@@ -503,8 +546,7 @@ mixins: [mixins],
           return this.excute(this.data.service, this.data.service.update, this.data.params)
         } else {
           return this.excute(this.data.service, this.data.service.insertRefund, this.data.params)
-        }
-
+        } 
       } else if (this.data.formType == 5) {
         return this.excute(this.data.service, this.data.service.insertReceivableReceipt, this.data.params)
       } else if (this.data.formType == 6) {
@@ -521,8 +563,10 @@ mixins: [mixins],
 
       } else if (this.data.formType == 9) {
         return this.excute(this.data.otherPayableService, this.data.otherPayableService.insert, this.data.params);
+      }else if (this.data.formType == 10) { //销售退货 >>> 客户退款
+        return this.excute(this.data.saleOutBoundReturnService, this.data.saleOutBoundReturnService.outboundInsertRefund, this.data.params);
       }
-
+      outbound_insert_refund
 
 
 

+ 4 - 4
package-basic-data/pages/basic-data/basic-data-sort/basic-data-sort.js

@@ -80,9 +80,9 @@ Page({
      * @date : 2024/1/23 9:16
      */
   getData(params) {
-    if (this.data.formType == mixins.$t('warehouse')) { //仓库档案
+    if (this.data.formType == mixins.$t('warehouseSys')) { //仓库档案
       return this.excute(this.data.warehouseService, this.data.warehouseService.selectByCond, params);
-    } else if (this.data.formType == mixins.$t('saleChannel')) { //销售渠道
+    } else if (this.data.formType == mixins.$t('saleChannelSys')) { //销售渠道
       return this.excute(this.data.saleChannelService, this.data.saleChannelService.selectByCond, params);
     } else {
       //基础数据接口
@@ -141,9 +141,9 @@ Page({
     const eventChannel = this.getOpenerEventChannel()
     eventChannel.on('params', function (data) {
       let titleKey = that.data.titleKey
-      if (data.formType == mixins.$t('warehouse')) {
+      if (data.formType == mixins.$t('warehouseSys')) {
         titleKey = 'whName'
-      } else if (data.formType == mixins.$t('saleChannel')) {
+      } else if (data.formType == mixins.$t('saleChannelSys')) {
         titleKey = 'channelName'
       } else {
         titleKey = 'dataValue'

+ 7 - 3
package-basic-data/pages/basic-data/basic-data.js

@@ -560,7 +560,7 @@ Page({
     if (this.data.dictCode == mixins.$t('warehouseSys')) { //仓库档案
       service = this.data.warehouseService
       id = params.whId
-      if (id && !historyDataItem.flgDefault && params.flgDefault) {
+      if (id && !historyDataItem.flgDefault && params.flgDefault) { 
         //判断默认给提示
         this.isFlgDefault(id, historyDataItem, params, service)
         return
@@ -632,8 +632,8 @@ Page({
             this.setData({
               dataItem: null
             })
-            //清除组件数据
-            this.selectComponent('#popup').setFormNull()
+            //清除组件数据  关闭蒙层
+            this.selectComponent('#popup').setLoading(false)
             return
           });
         } else {
@@ -667,6 +667,7 @@ Page({
    * @date : 2022/5/26 20:16
    */
   isFlgDefault(id, historyDataItem, params, service) {
+ 
     Dialog.confirm({
       message: '已存在默认,是否要新作默认',
     }).then(() => {
@@ -698,6 +699,9 @@ Page({
    * @date : 2022/5/26 20:16
    */
   isFlgDefaultSave(service) {
+    this.setData({
+      loading:false
+    })
     return new Promise((resolve, reject) => {
       this.excute(service, service.selectByCond, {
         flgDefault: true

+ 1 - 1
package-sales/pages/customer-collection/refund/refund.js

@@ -142,7 +142,7 @@ Page({
       param.staffName = app.globalData.user.staffName
       param.objectId = formData.cusId
     } else {
-      //编辑退款
+      //编辑退款 
       param.editFlag = true
       this.data.dataItem.forEach(res=>{
         res.checked = true

+ 474 - 162
package-sales/pages/order-return/add/add.js

@@ -15,24 +15,79 @@ Page({
     orderService: app.globalData['orderService'],
     commonService: app.globalData['commonService'],
     saleOutBoundReturnService: app.globalData['saleOutBoundReturnService'],
-    btnFormData: JSON.stringify({ flag: app.globalData.setting[Constants.settingCode.IVT001] == "true" ? true : false }),
+    btnFormData: JSON.stringify({
+      flag: app.globalData.setting[Constants.settingCode.IVT001] == "true" ? true : false
+    }),
     // 系统参数
     flgHandleSetting: app.globalData.setting[Constants.settingCode.IVT001] == "true" ? true : false,
-    cardList: [
-      { name: 'main', title: mixins.$t("customerInformation") },
-      { name: 'relation' },
-      { name: 'items', title: mixins.$t("goodsDetail"), chooseGoodsFlag: true, itemAmt: '', displayNum: 2 },
-      { name: 'other', title: mixins.$t("otherInfo") }
+    cardList: [{
+        name: 'main',
+        title: mixins.$t("customerInformation")
+      },
+      {
+        name: 'relation'
+      },
+      {
+        name: 'items',
+        title: mixins.$t("goodsDetail"),
+        chooseGoodsFlag: true,
+        itemAmt: '',
+        displayNum: 2
+      },
+      {
+        name: 'other',
+        title: mixins.$t("otherInfo")
+      }
     ],
-    popupTopObj: [{ leftTitle: '库存量', leftCode: 'usableQty', rightTitle: '可售量', rightCode: 'invQty' }],
+    popupTopObj: [{
+      leftTitle: '库存量',
+      leftCode: 'usableQty',
+      rightTitle: '可售量',
+      rightCode: 'invQty'
+    }],
     contentObj: {
-      main: [
-        { code: 'cusName', type: 'selectIcon', urlKey: 'selectCustomers', required: true, readonly: false, title: mixins.$t('customerName') },
-        { code: 'cusPhone', type: 'phone', title: mixins.$t('cusPhone'), required: true },
-        { code: 'addressFull', type: 'address', title: mixins.$t('addressFull'), required: true },
-        { code: 'addressNo', type: 'str', required: true, title: mixins.$t('addressNo') },
-        { code: 'channelId', name: 'channelName', type: 'drop', required: true, dropType: 'saleChannel', title: mixins.$t('saleChannel') },
-        { code: 'cusFrom', name: 'cusFromName', type: 'drop', required: false, dropType: 'customerFrom', title: mixins.$t('customerSource') },
+      main: [{
+          code: 'cusName',
+          type: 'selectIcon',
+          urlKey: 'selectCustomers',
+          required: true,
+          readonly: false,
+          title: mixins.$t('customerName')
+        },
+        {
+          code: 'cusPhone',
+          type: 'phone',
+          title: mixins.$t('cusPhone'),
+          required: true
+        },
+        {
+          code: 'addressFull',
+          type: 'address',
+          title: mixins.$t('addressFull'),
+          required: true
+        },
+        {
+          code: 'addressNo',
+          type: 'str',
+          required: true,
+          title: mixins.$t('addressNo')
+        },
+        {
+          code: 'channelId',
+          name: 'channelName',
+          type: 'drop',
+          required: true,
+          dropType: 'saleChannel',
+          title: mixins.$t('saleChannel')
+        },
+        {
+          code: 'cusFrom',
+          name: 'cusFromName',
+          type: 'drop',
+          required: false,
+          dropType: 'customerFrom',
+          title: mixins.$t('customerSource')
+        },
       ],
       relation: [{
         code: 'fromNo',
@@ -41,43 +96,102 @@ Page({
         titpsKey: 'cusId',
         titpsMessage: '请选择客户',
         controlChooseFlag: true,
-        title: mixins.$t("sourceOrder"),//'关联源单'
+        title: mixins.$t("sourceOrder"), //'关联源单'
         urlKey: 'selectSourceSaleOrder'
       }],
-      items: [
-        { code: 'collectType', name: 'collectName', type: 'drop', required: true, dropType: 'collect' },
-        { code: 'collectAmount', type: 'number', title: mixins.$t("amountCollected"), required: true }
+      items: [{
+          code: 'collectType',
+          name: 'collectName',
+          type: 'drop',
+          dropType: 'collect'
+        },
+        {
+          code: 'collectAmount',
+          type: 'number',
+          title: mixins.$t("amountCollected"),
+        }
       ],
-      other: [
-        { code: 'contractNo', type: 'textarea', title: mixins.$t("contractNumber"), readonly: false },
-  
-        { code: 'remarks', type: 'textarea', title: mixins.$t("remarks"), readonly: false },
-        { code: 'file', type: 'uploader', title: mixins.$t("uploader") }
+      other: [{
+          code: 'contractNo',
+          type: 'textarea',
+          title: mixins.$t("contractNumber"),
+          readonly: false
+        },
+
+        {
+          code: 'remarks',
+          type: 'textarea',
+          title: mixins.$t("remarks"),
+          readonly: false
+        },
+        {
+          code: 'file',
+          type: 'uploader',
+          title: mixins.$t("uploader")
+        }
       ]
     },
     //按钮
-    buttonSaveList: [
-      { code: 'save', title: mixins.$t("save") }
+    buttonSaveList: [{
+        code: 'refund',
+        title: mixins.$t("refund")
+      },
+      {
+        code: 'save',
+        title: mixins.$t("save")
+      }
     ],
-    contentSaveList: [
-      { code: 'flag', title: mixins.$t("autoSaleOutBoundFlag"), type: 'checkbox' },
-      { code: 'need', title: mixins.$t("saleCollection"), type: 'str' },
-      { code: 'receivable', content: 0, type: 'number' }
+    contentSaveList: [{
+        code: 'flag',
+        title: mixins.$t("autoSaleOutBoundFlag"),
+        type: 'checkbox'
+      },
+      {
+        code: 'need',
+        title: mixins.$t("saleCollection"),
+        type: 'str'
+      },
+      {
+        code: 'receivable',
+        content: 0,
+        type: 'number'
+      }
     ],
-    popContent: [
-      { code: 'outingQty', type: 'step', title: mixins.$t("count"), required: true },
-      { code: 'packageBox', type: 'packageBox', title: mixins.$t("packageBox"),   },
-      { code: 'priceOut', type: 'number', title: mixins.$t("priceSale"), required: true },
+    popContent: [{
+        code: 'outingQty',
+        type: 'step',
+        title: mixins.$t("count"),
+        required: true
+      },
+      {
+        code: 'packageBox',
+        type: 'packageBox',
+        title: mixins.$t("packageBox"),
+      },
+      {
+        code: 'priceOut',
+        type: 'number',
+        title: mixins.$t("priceSale"),
+        required: true
+      },
+      {
+        code: 'whId',
+        name: 'whName',
+        choosePopupType: 'inventorySku',
+        title: mixins.$t("warehouseId"),
+        type: 'choose',
+        urlKey: 'selectInventorySku',
+      },
       {
-        code: 'whId', name: 'whName', choosePopupType: 'inventorySku', title: mixins.$t("warehouseId"), type: 'choose', urlKey: 'selectInventorySku',
+        code: 'nonStdCode',
+        title: mixins.$t("goodsBatch"),
+        type: 'str',
       },
-      { code: 'nonStdCode', title: mixins.$t("goodsBatch"), type: 'str', }, 
     ],
     // 新手引导
     step: {
       name: 'order-return',
-      guideList: [
-        {
+      guideList: [{
           el: "#dkForm>>>#cusName",
           tips: mixins.$t('chooseCustomer'),
         },
@@ -103,7 +217,7 @@ Page({
    * @date : 2024/2/1 15:49
    * @author : 于继渤
    */
-  setGoods(e) { 
+  setGoods(e) {
     //设置需收款
     let contentSaveList = this.data.contentSaveList
     let formData = JSON.parse(this.data.formData)
@@ -116,10 +230,12 @@ Page({
         nonStdCode: res.nonStdCode,
         whId: res.whId
       })
-      res.sunPrice =   res.priceOut * res.itemQty 
+      res.sunPrice = res.priceOut * res.itemQty
     })
     //批量查库存
-    this.getInventory({ skuIdNonStdCodeWhIdList: list }).then(item => {
+    this.getInventory({
+      skuIdNonStdCodeWhIdList: list
+    }).then(item => {
       formData.goodsList.forEach(res => {
         if (item.length > 0) {
           item.forEach(it => {
@@ -135,7 +251,7 @@ Page({
         } else {
           res.invQty = 0
           res.usableQty = 0
-        } 
+        }
       })
       //组件显示 需收款
       contentSaveList[2]['content'] = Number(formData.sumAmount)
@@ -154,13 +270,13 @@ Page({
       if (res.invId) {
         //选择的数量大于可售量
         if (Math.abs(res.outQty) > res.usableQty) {
-          res['usableQtyInsufficientFlag'] = true  //可售量不足
-          res['usableQty'] = res.usableQty  //可售量
+          res['usableQtyInsufficientFlag'] = true //可售量不足
+          res['usableQty'] = res.usableQty //可售量
           res['titpsItemColorFlagKey'] = true
           res['titpsLabel'] = '缺货'
         } else {
-          res['usableQtyInsufficientFlag'] = false  //可售量不足
-          res['usableQty'] = res.usableQty  //可售量
+          res['usableQtyInsufficientFlag'] = false //可售量不足
+          res['usableQty'] = res.usableQty //可售量
           res['titpsItemColorFlagKey'] = false
           res['titpsLabel'] = '有货'
         }
@@ -175,15 +291,15 @@ Page({
     })
     this.setData({
       formData: JSON.stringify(formData),
-      goodsTagColor: usableQtyInsufficientFlagList.length > 0 ? '#E4002B' : null  //设置颜色
+      goodsTagColor: usableQtyInsufficientFlagList.length > 0 ? '#E4002B' : null //设置颜色
     })
   },
 
   /**
-    * @desc : 查询库存
-    * @date : 2024/2/1 15:49
-    * @author : 于继渤
-    */
+   * @desc : 查询库存
+   * @date : 2024/2/1 15:49
+   * @author : 于继渤
+   */
   getInventory(params) {
     return new Promise((resolve, reject) => {
       this.excute(this.data.commonService, this.data.commonService.getInventoryByList, params).then(res => {
@@ -197,10 +313,10 @@ Page({
 
 
   /**
-     * @desc :   自动办理事件
-     * @date : 2024/2/1 15:49
-     * @author : 于继渤
-     */
+   * @desc :   自动办理事件
+   * @date : 2024/2/1 15:49
+   * @author : 于继渤
+   */
   saveChange(e) {
     let btnFormData = JSON.parse(this.data.btnFormData)
     let that = this
@@ -208,7 +324,7 @@ Page({
       //提示
       Dialog.confirm({
         message: mixins.$t("saleOutBoundInfo"),
-      }).then(() => { }).catch(() => {
+      }).then(() => {}).catch(() => {
         btnFormData.flag = true
         that.setData({
           btnFormData: JSON.stringify(btnFormData)
@@ -292,24 +408,73 @@ Page({
   },
 
   /**
-    * @desc : 底部按钮事件
-    * @date : 2024/2/1 15:49
-    * @author : 于继渤
-    */
+   * @desc : 底部按钮事件
+   * @date : 2024/2/1 15:49
+   * @author : 于继渤
+   */
   saveButton(e) {
-    console.log('wojinlaile',e)
+    console.log(e)
     let name = e.detail.name
     if (name == 'save') { //保存
       this.save({})
-    } else {
+    } else if (name == 'merge') { //撤回
       this.handleWarehousing()
+    } else if (name == 'refund') { //退款
+      let formData = JSON.parse(this.data.formData)
+      formData.btnFormData = this.data.btnFormData ? JSON.parse(this.data.btnFormData) : '' 
+      if( formData.goodsList){ //算出 要退款 的钱
+        let nmb = 0
+        formData.goodsList.forEach(element => {
+          nmb = element.priceOut + nmb
+        });
+        formData.sumAmtRec = nmb 
+      } 
+      formData.objInfo = {} //退款页面的 客户信息
+      formData.objInfo['cusPhone'] = formData.cusPhone
+      formData.objInfo['cusName'] = formData.cusName
+      formData.objInfo['objectId'] = formData.cusId
+      formData.objInfo['addressFull'] = formData.addressFull 
+   
+      this.setData({
+        formData:JSON.stringify(formData),
+        refundFlag:true,
+      })
+      this.save({})
+   
     }
   },
   /**
-  * @desc : 撤回
-  * @date : 2024/2/1 15:49
-  * @author : 于
-  */
+   * @desc : 退款
+   * @date : 2024/2/1 15:49
+   * @author : 于
+   */
+  handRefunding(e) {
+    let _this = this
+    wx.navigateTo({
+      url: '/package-base-select/pages/select-collection_confirm/select-collection_confirm',
+      events: {
+        // 回调后
+        refresh: function (data) {
+         // 保存成功后 回调
+         wx.navigateBack({
+          data: 1
+        })
+        }
+      },
+      success: function (res) {
+        // 通过eventChannel向被打开页面传送数据 
+        res.eventChannel.emit('params', {
+          item: _this.data.formData,
+          formType: 10
+        })
+      }
+    })
+  },
+  /**
+   * @desc : 撤回
+   * @date : 2024/2/1 15:49
+   * @author : 于
+   */
   handleWarehousing(e) {
     let item = {}
     item.outId = this.data.id
@@ -321,12 +486,13 @@ Page({
     })
   },
   /**
-    * @desc : 设置保存参数
-    * @date : 2024/2/1 15:49
-    * @author : 于继渤
-    */
+   * @desc : 设置保存参数
+   * @date : 2024/2/1 15:49
+   * @author : 于继渤
+   */
   setParams(params) {
     let itemIndex = 0
+    let formData = JSON.parse(this.data.formData)
     console.log('params1', params)
     params.fromId = params.orderId
     params.goodsList.forEach(res => {
@@ -341,16 +507,16 @@ Page({
       }
 
     })
-
+    let btnFormData = this.data.btnFormData ? JSON.parse(this.data.btnFormData) : ''
     params.flgAutoHandle = btnFormData ? btnFormData.flag : false //自动出库标识 
     params.itemList = params.goodsList //明细
-    if(element.outStatus == Constants.outStatus.outBounded)//""出库状态-已出库"
+    if (formData.outStatus == Constants.outStatus.outBounded) //""出库状态-已出库"
     {
       params.itemList.forEach(element => {
         element.outBox = element.box
         element.outPiece = element.piece
       });
-    }else{
+    } else {
       params.itemList.forEach(element => {
         if (params.flgAutoHandle) {
           element.outBox = element.box
@@ -358,15 +524,15 @@ Page({
         } else {
           element.outingBox = element.box
           element.outingPiece = element.piece
-        } 
+        }
       });
     }
 
 
     params.makeStaff = app.globalData.user.staffId
     // params.deleteItemList = params.deleteList ? params.deleteList : []
-    let btnFormData = this.data.btnFormData ? JSON.parse(this.data.btnFormData) : ''
-    
+
+
     params.addressName = params.address.addressName
     params.objectId = params.cusId
     params.canNegativeFlag = true
@@ -382,7 +548,14 @@ Page({
    * @date : 2024/2/1 15:49
    * @author : 于继渤
    */
-  saveData() { 
+  saveData() {
+    if(this.data.refundFlag){
+      this.setData({
+        refundFlag:false
+      })
+      this.handRefunding()
+      return
+    }
     if (this.data.formMode == Constants.formMode.other || this.data.formMode == Constants.formMode.add) { //关联源单新建退货
       return this.excute(this.data.service, this.data.service.outboundInsert, this.data.params);
     }
@@ -395,10 +568,10 @@ Page({
   },
 
   /**
-    * @desc : 查询商品明细
-    * @date : 2024/2/1 15:49
-    * @author : 于继渤
-    */
+   * @desc : 查询商品明细
+   * @date : 2024/2/1 15:49
+   * @author : 于继渤
+   */
   getItemDetal(id, service, API) {
     if (!API) {
       API = 'getOutReturnForUpdate'
@@ -409,9 +582,10 @@ Page({
         let formData = JSON.parse(this.data.formData)
         if (res.data.data.data.outStatus == mixins.$t("outBoundedOutStatus") && this.data.formMode != 'other') {
           let buttonSaveList = this.data.buttonSaveList
-          buttonSaveList = [
-            { name: 'merge', title: mixins.$t("handleWithdrawal"), }
-          ]
+          buttonSaveList = [{
+            name: 'merge',
+            title: mixins.$t("handleWithdrawal"),
+          }]
           this.setData({
             buttonSaveList: buttonSaveList
           })
@@ -440,20 +614,19 @@ Page({
         formData.goodsList = res.data.data.dataItem
 
         formData.goodsList.forEach(element => {
-          if(element.outStatus == Constants.outStatus.outBounded)//""出库状态-已出库"
-          { 
-           element.box =  element.outBox
-           element.piece =  element.outPiece
-          }else
-          { 
-           element.box =  element.outingBox
-           element.piece =  element.outingPiece
-          } 
+          if (element.outStatus == Constants.outStatus.outBounded) //""出库状态-已出库"
+          {
+            element.box = element.outBox
+            element.piece = element.outPiece
+          } else {
+            element.box = element.outingBox
+            element.piece = element.outingPiece
+          }
           if (element.flgSubUnit) {
             element.calculationFormula = element.packBox + element.unitName + '= 1' + element.subUnitName
             element.packageBox = element['outingBox'] + element.subUnitName + element['outingPiece'] + element.unitName
           }
-          element.sunPrice =   element.priceOut * element.itemQty
+          element.sunPrice = element.priceOut * element.itemQty
 
         });
         //处理默认值  业务员业务部门
@@ -473,10 +646,10 @@ Page({
   },
 
   /**
-     * @desc : 给表单赋值
-     * @date : 2024/2/1 15:49
-     * @author : 于继渤
-     */
+   * @desc : 给表单赋值
+   * @date : 2024/2/1 15:49
+   * @author : 于继渤
+   */
   setValuesByEdit(data) {
     let cardList = this.data.cardList
     //处理地址
@@ -502,58 +675,155 @@ Page({
   },
 
   /**
-    * @desc : 设置表单 为只读状态
-    * @date : 2024/2/1 15:49
-    * @author : 于继渤
-    */
+   * @desc : 设置表单 为只读状态
+   * @date : 2024/2/1 15:49
+   * @author : 于继渤
+   */
   setFormMain() {
     let contentObj = this.data.contentObj
     let cardList = this.data.cardList
     let buttonSaveList = this.data.buttonSaveList
     let contentSaveList = this.data.contentSaveList
     let popContent = this.data.popContent
-    contentObj.main = [
-      { code: 'cusName', type: 'str', readonly: true, required: false, title: mixins.$t('customerName') },
-      { code: 'cusPhone', type: 'str', readonly: true, required: false, title: mixins.$t('cusPhone') },
-      { code: 'addressFull', type: 'str', readonly: true, required: false, title: mixins.$t('addressFull') },
-      { code: 'addressNo', type: 'str', readonly: true, required: false, title: mixins.$t('addressNo') },
-      { code: 'channelName', type: 'str', readonly: true, required: false, title: mixins.$t('saleChannel') },
-      { code: 'cusFromName', type: 'str', readonly: true, required: false, title: mixins.$t('customerSource') },
+    contentObj.main = [{
+        code: 'cusName',
+        type: 'str',
+        readonly: true,
+        required: false,
+        title: mixins.$t('customerName')
+      },
+      {
+        code: 'cusPhone',
+        type: 'str',
+        readonly: true,
+        required: false,
+        title: mixins.$t('cusPhone')
+      },
+      {
+        code: 'addressFull',
+        type: 'str',
+        readonly: true,
+        required: false,
+        title: mixins.$t('addressFull')
+      },
+      {
+        code: 'addressNo',
+        type: 'str',
+        readonly: true,
+        required: false,
+        title: mixins.$t('addressNo')
+      },
+      {
+        code: 'channelName',
+        type: 'str',
+        readonly: true,
+        required: false,
+        title: mixins.$t('saleChannel')
+      },
+      {
+        code: 'cusFromName',
+        type: 'str',
+        readonly: true,
+        required: false,
+        title: mixins.$t('customerSource')
+      },
     ]
     contentObj.relation = [{
-      code: 'fromNo',
-      type: 'str',
-      title: mixins.$t("sourceOrder"),//'关联源单'
-      readonly: true,
-    }],
-      contentObj.other = [
-        { code: 'contractNo', type: 'str', readonly: true, required: false, title: mixins.$t('contractNumber') },
- 
-        { code: 'remarks', type: 'str', readonly: true, required: false, title: mixins.$t('remarks') },
-        { code: 'file', type: 'uploader', title: mixins.$t("uploader") }
+        code: 'fromNo',
+        type: 'str',
+        title: mixins.$t("sourceOrder"), //'关联源单'
+        readonly: true,
+      }],
+      contentObj.other = [{
+          code: 'contractNo',
+          type: 'str',
+          readonly: true,
+          required: false,
+          title: mixins.$t('contractNumber')
+        },
+
+        {
+          code: 'remarks',
+          type: 'str',
+          readonly: true,
+          required: false,
+          title: mixins.$t('remarks')
+        },
+        {
+          code: 'file',
+          type: 'uploader',
+          title: mixins.$t("uploader")
+        }
       ]
-    cardList = [
-      { name: 'main', title: mixins.$t("customerInformation") },
-      { name: 'relation' },
-      { name: 'items', title: mixins.$t("goodsDetail"), chooseGoodsFlag: false, itemAmt: '', displayNum: 2 },
-      { name: 'other', title: mixins.$t("otherInfo") }
+    cardList = [{
+        name: 'main',
+        title: mixins.$t("customerInformation")
+      },
+      {
+        name: 'relation'
+      },
+      {
+        name: 'items',
+        title: mixins.$t("goodsDetail"),
+        chooseGoodsFlag: false,
+        itemAmt: '',
+        displayNum: 2
+      },
+      {
+        name: 'other',
+        title: mixins.$t("otherInfo")
+      }
     ]
     //详情(办理)
     if (this.data.formMode == Constants.formMode.detail) {
       //按钮
-      buttonSaveList = [
-        { code: 'save', title: mixins.$t("outProcessing") }
-      ]
-      contentSaveList = [
-        { code: 'need', title: mixins.$t("saleCollection"), type: 'str' },
-        { code: 'receivable', content: 0, type: 'number' }
+      buttonSaveList = [{
+        code: 'save',
+        title: mixins.$t("outProcessing")
+      }]
+      contentSaveList = [{
+          code: 'need',
+          title: mixins.$t("saleCollection"),
+          type: 'str'
+        },
+        {
+          code: 'receivable',
+          content: 0,
+          type: 'number'
+        }
       ]
-      popContent = [
-        { code: 'outingQty', type: 'step', title: mixins.$t("count"), required: true, readonly: true },
-        { code: 'packageBox', type: 'packageBox', title: mixins.$t("packageBox"),   },
-        { code: 'priceOut', type: 'number', title: mixins.$t("priceSale"), required: true, readonly: true },
-        { code: 'whName', title: mixins.$t("warehouseId"), type: 'str', readonly: true, readonly: true },
-        { code: 'nonStdCode', title: mixins.$t("goodsBatch"), type: 'str', readonly: true },
+      popContent = [{
+          code: 'outingQty',
+          type: 'step',
+          title: mixins.$t("count"),
+          required: true,
+          readonly: true
+        },
+        {
+          code: 'packageBox',
+          type: 'packageBox',
+          title: mixins.$t("packageBox"),
+        },
+        {
+          code: 'priceOut',
+          type: 'number',
+          title: mixins.$t("priceSale"),
+          required: true,
+          readonly: true
+        },
+        {
+          code: 'whName',
+          title: mixins.$t("warehouseId"),
+          type: 'str',
+          readonly: true,
+          readonly: true
+        },
+        {
+          code: 'nonStdCode',
+          title: mixins.$t("goodsBatch"),
+          type: 'str',
+          readonly: true
+        },
       ]
     }
     this.setData({
@@ -565,10 +835,10 @@ Page({
     })
   },
   /**
-    * @desc : 处理地址
-    * @date : 2024/2/1 15:49
-    * @author : 于继渤
-    */
+   * @desc : 处理地址
+   * @date : 2024/2/1 15:49
+   * @author : 于继渤
+   */
   setAddress(item) {
     let address = {
       address: item.addressFull,
@@ -581,10 +851,10 @@ Page({
   },
 
   /**
-    * @desc   : 计算金额
-    * @author : 于继渤
-    * @date   : 2024/1/26 11:46
-    */
+   * @desc   : 计算金额
+   * @author : 于继渤
+   * @date   : 2024/1/26 11:46
+   */
   calculateAmount(formData) {
     ///设置总单信息
     let sumStandard = Number(0)
@@ -624,10 +894,10 @@ Page({
   },
 
   /**
-    * @desc : 设置顶部默认值
-    * @date : 2024/3/28 15:49
-    * @author : 于继渤
-    */
+   * @desc : 设置顶部默认值
+   * @date : 2024/3/28 15:49
+   * @author : 于继渤
+   */
   setStaffOrg(formData) {
     formData['staff'] = {
       text: formData.staffName ? formData.staffName : app.globalData.user.staffName,
@@ -644,22 +914,23 @@ Page({
 
 
   /**
-     * @desc :   编辑
-     * @date : 2024/2/1 15:49
-     * @author : 于继渤
-     */
+   * @desc :   编辑
+   * @date : 2024/2/1 15:49
+   * @author : 于继渤
+   */
   toEdit() {
     let this_ = this
     wx.navigateTo({
       url: this_.data.route.add.url,
       events: {
         // 保存成功后刷新页面
-        refresh: function (data) {
-        }
+        refresh: function (data) {}
       },
       success: function (res) {
         res.eventChannel.emit('params', {
-          formMode: Constants.formMode.other, id: this_.data.id, formType: Constants.formMode.edit
+          formMode: Constants.formMode.other,
+          id: this_.data.id,
+          formType: Constants.formMode.edit
         });
       }
     })
@@ -681,8 +952,22 @@ Page({
       this.setFormMain()
       //查询信息
       this.getItemDetal(this.data.id)
-    } else if (this.data.formMode == Constants.formMode.add) {  //新建
+    } else if (this.data.formMode == Constants.formMode.add) { //新建
       //处理默认值  业务员业务部门
+      let buttonSaveList = this.data.buttonSaveList
+      //按钮
+      buttonSaveList =  [{
+        code: 'refund',
+        title: mixins.$t("refund")
+      },
+      {
+        code: 'save',
+        title: mixins.$t("save")
+      }
+    ],
+      this.setData({
+        buttonSaveList: buttonSaveList
+      }) 
       formData = this.setStaffOrg(formData)
       const eventChannel = this.getOpenerEventChannel()
       eventChannel.on('params', function (data) {
@@ -699,15 +984,42 @@ Page({
 
       if (this.data.formMode == Constants.formMode.other) {
         this.setData({
-          popContent: [
-            { code: 'outingQty', type: 'step', title: mixins.$t("count"), required: true },
-            { code: 'packageBox', type: 'packageBox', title: mixins.$t("packageBox"),   },
-            { code: 'priceOut', type: 'number', title: mixins.$t("priceSale"), required: true },
+          popContent: [{
+              code: 'outingQty',
+              type: 'step',
+              title: mixins.$t("count"),
+              required: true
+            },
+            {
+              code: 'packageBox',
+              type: 'packageBox',
+              title: mixins.$t("packageBox"),
+            },
+            {
+              code: 'priceOut',
+              type: 'number',
+              title: mixins.$t("priceSale"),
+              required: true
+            },
+            {
+              code: 'whId',
+              name: 'whName',
+              choosePopupType: 'inventorySku',
+              title: mixins.$t("warehouseId"),
+              type: 'choose',
+              urlKey: 'selectInventorySku',
+            },
+            {
+              code: 'nonStdCode',
+              title: mixins.$t("goodsBatch"),
+              type: 'str',
+            },
             {
-              code: 'whId', name: 'whName', choosePopupType: 'inventorySku', title: mixins.$t("warehouseId"), type: 'choose', urlKey: 'selectInventorySku',
+              code: 'flgGift',
+              title: mixins.$t("flgGift"),
+              type: 'checkbox',
+              readonly: true
             },
-            { code: 'nonStdCode', title: mixins.$t("goodsBatch"), type: 'str', },
-            { code: 'flgGift', title: mixins.$t("flgGift"), type: 'checkbox', readonly: true },
           ]
         })