Преглед изворни кода

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

zhoux пре 2 година
родитељ
комит
94b04d09d2

+ 6 - 1
api/pages/ivt/outbound.js

@@ -29,7 +29,12 @@ module.exports = {
       chooseStorageOutReason: { key: 'chooseStorageOutReason', url:'/package-base-select/pages/select-data/select-data',type:'dictionary',dictCode:'基础资料-出库'  },
       selectSourceSaleOrder:{
         key:'selectSourceSaleOrder',url:'/package-base-select/pages/select-source-sale-order/select-source-sale-order'
-      }
+      },
+
+ 
+      
+      selectCustomers: { key: 'selectCustomers', url: '/package-base-select/pages/select-customers/select-customers' },
+      selectInventorySku:{ key: 'selectInventorySku', url: '/package-base-select/pages/select-data/select-data',type:'inventorySku'  },
     }
   }
 };

+ 5 - 1
api/pages/ivt/saleOutBound.js

@@ -11,15 +11,19 @@ module.exports = {
   saleOutBoundService: {
     // 前缀
     prefix: 'mdm-server/ivt/outbound_sale_order/',
-    outboundInsert: 'outbound_insert'
+    outboundInsert: 'outbound_insert',
+    outboundUpdate: 'outbound_update',
+    handleOutbound: 'handle_outbound'
   },
 
   routeUrl: {
     saleOutBound: { 
       add:{key:'add',url:'/package-sales/pages/sales-outbound/add/add'},
+      edit:{key:'edit',url:'/package-sales/pages/sales-outbound/add/add',idKey:'outId',formType:'detail'},
       selectSourceSaleOrder:{
         key:'selectSourceSaleOrder',url:'/package-base-select/pages/select-source-sale-order/select-source-sale-order'
       },
+      
       selectCustomers: { key: 'selectCustomers', url: '/package-base-select/pages/select-customers/select-customers' },
       openingInventory: { key: 'openingInventory', url: '/package-base-select/pages/select-data/select-data',type:'warehouse'  },
       selectInventorySku:{ key: 'selectInventorySku', url: '/package-base-select/pages/select-data/select-data',type:'inventorySku'  },

+ 7 - 0
mixins/index.js

@@ -279,6 +279,7 @@ module.exports = {
         if(e.detail.customUrl){
           url = e.detail.customUrl
         }
+   
         let _this = this;
         wx.navigateTo({
           url: url,
@@ -291,6 +292,7 @@ module.exports = {
           },
           success: function (res) {
             let data = {}
+            console.log('success',item)
             if (item && item.button && item.button.idKey) {
               data['id'] = item[item.button.idKey]
             }
@@ -300,6 +302,8 @@ module.exports = {
             if (item && item.button && item.button.formMode) {
               data['formMode'] = item.button.formMode
             }
+            console.log('routeUrl111111',routeUrl)
+
             //api 上的优先
             if(_this.data.route[name].formMode){
               data['formMode'] = _this.data.route[name].formMode
@@ -311,6 +315,9 @@ module.exports = {
             if (item && item.button && item.button.formType) {
               data['formType'] = item.button.formType
             }
+            if(routeUrl.formType){
+              data['formType'] = routeUrl.formType
+            }
             // 新建增加默认的新建formMode
             if(name === 'add'){
               data['formMode'] = Constants.formMode.add;

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

@@ -26,7 +26,7 @@
       <van-field label-class="nomal-label" value="{{ item.cusPhone }}" input-align="left" label="客户电话" placeholder="" data-type='name' readonly="{{true}}" autosize border="{{ false }}">
       </van-field>
 
-      <van-field label-class="nomal-label" value="{{ item.receivableResidue ? item.receivableResidue : 0}}" input-align="left" label="应收收款" placeholder="" data-type='name' readonly="{{true}}" autosize border="{{ false }}">
+      <van-field label-class="nomal-label" value="{{ item.receivableResidue ? item.receivableResidue : 0}}" input-align="left" label="应收余额" placeholder="" data-type='name' readonly="{{true}}" autosize border="{{ false }}">
       </van-field>
     </view>
   </view>

+ 38 - 1
package-sales/pages/order-billing/add/add.js

@@ -86,7 +86,44 @@ Page({
      * @date : 2024/1/23 9:16
      */
     getCustomerData(params) {
-      return this.excute(this.data.customerService, this.data.customerService.selectByCondNoPage, params);
+      return this.excute(this.data.customerService, this.data.customerService.selectByCondNoPage, params).then(res=>{
+        if(res.data.code == 200){
+          if(res.data.data.length > 0){
+            console.log('res',res)
+            let formData = JSON.parse(this.data.formData) 
+            let item  = res.data.data[0]
+            formData.cusCode = item.cusCode
+            formData.cusId = item.cusId
+            formData.cusName = item.cusName
+            // formData.cusPhone = item.cusPhone
+            formData.cusFromName = item.cusFromName
+            formData.cusFrom = item.cusFrom
+            //处理地址
+            formData.address = {
+              address: item.addressFull,
+              addressFull: item.addressFull,
+              addressArea: item.addressArea,
+              addressGcj02: item.addressGcj02,
+              addressName: item.addressName,
+            }
+            formData.addressArea = item.addressArea
+            formData.addressFull = item.addressFull
+            formData.addressGcj02 = item.addressGcj02
+            formData.addressName = item.addressName
+            formData.addressNo = item.addressNo
+            //订单销售渠道 ,默认取的部门的渠道
+            // formData.salesChannel = item.channelId
+            // formData.channelId = item.channelId
+            // formData.channelName = item.channelName
+            formData.contactPhone = item.contactPhone
+            formData.contactPhone = item.contactPhone
+
+            this.setData({
+              formData: JSON.stringify(formData)
+            })
+          }
+        }
+      });
     },
   /**
    * @desc   : 选择回调

+ 183 - 126
package-sales/pages/sales-outbound/add/add.js

@@ -9,9 +9,10 @@ Page({
    */
   data: {
     // 路由
-    routeObjName: 'saleOutBound',
+    routeObjName: 'outbound',
     table: Constants.tables.order,
     orderService: app.globalData['orderService'],
+    saleOutBoundService: app.globalData['saleOutBoundService'],
     btnFormData: JSON.stringify({ flag: true }),
     cardList: [
       { name: 'main', title: mixins.$t("customerInformation") },
@@ -58,17 +59,32 @@ Page({
       { code: 'receivable', content: 0, type: 'number' }
     ],
     popContent: [
-      { code: 'orderQty', type: 'step', title: mixins.$t("count"), required: true },
+      { code: 'outingQty', type: 'step', title: mixins.$t("count"), required: true },
       { 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: 'flgGift', title: mixins.$t("flgGift"), type: 'checkbox', },
     ],
   },
 
-
+  toEdit() {
+    let this_ = this
+    wx.navigateTo({
+      url: this_.data.route.add.url,
+      events: {
+        // 保存成功后刷新页面
+        refresh: function (data) {
+        }
+      },
+      success: function (res) {
+        res.eventChannel.emit('params', {
+          formMode:'edit',id:this_.data.id
+        });
+      }
+    })
+  },
 
   /**
      * @desc :   自动办理事件
@@ -91,79 +107,8 @@ Page({
     }
   },
 
-  /**
-   * @desc   : 选择回调
-   * @author : 于继渤
-   * @date   : 2024/1/26 11:46
-   */
-  chooseData(e) {
-    console.log('eee1', e);
-    let item = e.detail.data
-    let code = e.detail.code
-    let formData = JSON.parse(this.data.formData)
-    //设置客户信息
-    if (code == 'cusName') {
-      formData.cusCode = item.cusCode
-      formData.cusId = item.cusId
-      formData.objectId = item.cusId
-      formData.cusName = item.cusName
-      formData.cusPhone = item.cusPhone
-      formData.cusFromName = item.cusFromName
-      formData.cusFrom = item.cusFrom
-      //处理地址
-      formData.address = this.setAddress(item)
-      formData.addressArea = item.addressArea
-      formData.addressFull = item.addressFull
-      formData.addressGcj02 = item.addressGcj02
-      formData.addressName = item.addressName
-      formData.addressNo = item.addressNo
-      //订单销售渠道 ,默认取的客户的渠道
-      formData.salesChannel = item.channelId
-      formData.channelId = item.channelId
-      formData.channelName = item.channelName
-      formData.contactPhone = item.contactPhone
-      formData.contactPhone = item.contactPhone
-    }
-    ///设置主从业务员
-    if (code == 'staff') {
-      formData.staff = item.staffItem
-      formData['staffId'] = item.staffMain.staffId
-      formData['staffName'] = item.staffMain.staffName
-      formData['staffList'] = item.staffList
-      console.log(item.staffList)
-    }
-    ///设置主从业务部门
-    if (code == 'org') {
-      console.log('item', item)
-      formData.org = item.orgItem
-      formData['orgId'] = item.orgMain.orgId
-      formData['orgName'] = item.orgMain.orgName
-      formData['orgList'] = item.orgList
-    }
-    //选择源单
-    if (code == 'fromNo') {
-      if (item.itemList && item.itemList.length > 0) {
-        //处理商品明细
-        // item.itemList.forEach(res => {
-        //   res.priceOut = res.sale
-        // })
-        formData.goodsList = item.itemList
-
-
 
 
-        formData.fromNo = item.fromNo
-        this.calculateAmount(formData)
-      }
-    }
-
-
-    this.setData({
-      formData: JSON.stringify(formData)
-    })
-
-  },
-
   /**
     * @desc : 底部按钮事件
     * @date : 2024/2/1 15:49
@@ -185,12 +130,9 @@ Page({
     * @author : 于继渤
     */
   setParams(params) {
-
-    // params.goodsList.forEach(res=>{
-    //   res.orderQty
-    // })
-
-
+    params.goodsList.forEach(res=>{
+        console.log(res)
+    })
     params.itemList = params.goodsList //明细
     params.makeStaff = app.globalData.user.staffId
     // params.deleteItemList = params.deleteList ? params.deleteList : []
@@ -210,10 +152,12 @@ Page({
    * @author : 于继渤
    */
   saveData() {
-    if (this.data.formMode == Constants.formMode.edit) { //编辑
-      return this.excute(this.data.service, this.data.service.update, this.data.params);
-    } else { //新建
-      return this.excute(this.data.service, this.data.service.outboundInsert, this.data.params);
+    if (this.data.formMode == Constants.formMode.edit  && this.data.formType !== Constants.formMode.detail) { //编辑
+      return this.excute(this.data.saleOutBoundService, this.data.saleOutBoundService.outboundUpdate, this.data.params);
+    } else if(this.data.formMode == Constants.formMode.add && this.data.formType !== Constants.formMode.detail){ //新建
+      return this.excute(this.data.saleOutBoundService, this.data.saleOutBoundService.outboundInsert, this.data.params);
+    }else if(this.data.formMode == Constants.formMode.edit && this.data.formType == Constants.formMode.detail){ //办理
+      return this.excute(this.data.saleOutBoundService, this.data.saleOutBoundService.handleOutbound, this.data.params);
     }
 
   },
@@ -270,45 +214,79 @@ Page({
       cardList: cardList,
       formData: JSON.stringify(data)
     })
-    //查询商品明细
-    this.getItemDetal(data.orderId)
-
-
+    if (this.data.formMode == 'edit') { //编辑  办理页
+      //处理商品
+      this.calculateAmount(data)
+    } else {
+      //查询商品明细
+      this.getItemDetal(data.orderId)
+    }
   },
 
-
-
-  // 设置参数
-
-
   /**
-    * @desc : 设置表单 为只读状态
-    * @date : 2024/2/1 15:49
-    * @author : 于继渤
-    */
-  setFormMain() {
-    let contentObj = this.data.contentObj
-    contentObj.main = [
-      { code: 'cusName', type: 'str', readonly: true, required: true, title: mixins.$t('customerName') },
-      { code: 'cusPhone', type: 'str', readonly: true, required: true, title: mixins.$t('cusPhone') },
-      { code: 'addressFull', type: 'str', readonly: true, required: true, title: mixins.$t('addressFull') },
-      { code: 'addressNo', type: 'str', readonly: true, required: true, title: mixins.$t('addressNo') },
-      { code: 'channelName', type: 'str', readonly: true, required: true, 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,
-    }],
-      this.setData({
-        contentObj: contentObj
-      })
+   * @desc   : 选择回调
+   * @author : 于继渤
+   * @date   : 2024/1/26 11:46
+   */
+  chooseData(e) {
+    let item = e.detail.data
+    let code = e.detail.code
+    let formData = JSON.parse(this.data.formData)
+    //设置客户信息
+    if (code == 'cusName') {
+      formData.cusCode = item.cusCode
+      formData.cusId = item.cusId
+      formData.objectId = item.cusId
+      formData.cusName = item.cusName
+      formData.cusPhone = item.cusPhone
+      formData.cusFromName = item.cusFromName
+      formData.cusFrom = item.cusFrom
+      //处理地址
+      formData.address = this.setAddress(item)
+      formData.addressArea = item.addressArea
+      formData.addressFull = item.addressFull
+      formData.addressGcj02 = item.addressGcj02
+      formData.addressName = item.addressName
+      formData.addressNo = item.addressNo
+      //订单销售渠道 ,默认取的客户的渠道
+      formData.salesChannel = item.channelId
+      formData.channelId = item.channelId
+      formData.channelName = item.channelName
+      formData.contactPhone = item.contactPhone
+      formData.contactPhone = item.contactPhone
+    }
+    ///设置主从业务员
+    if (code == 'staff') {
+      formData.staff = item.staffItem
+      formData['staffId'] = item.staffMain.staffId
+      formData['staffName'] = item.staffMain.staffName
+      formData['staffList'] = item.staffList
+      console.log(item.staffList)
+    }
+    ///设置主从业务部门
+    if (code == 'org') {
+      console.log('item', item)
+      formData.org = item.orgItem
+      formData['orgId'] = item.orgMain.orgId
+      formData['orgName'] = item.orgMain.orgName
+      formData['orgList'] = item.orgList
+    }
+    //选择源单
+    if (code == 'fromNo') {
+      if (item.itemList && item.itemList.length > 0) {
+        formData.goodsList = item.itemList
+        formData.fromNo = item.fromNo
+        this.calculateAmount(formData)
+      }
+    }
+    this.setData({
+      formData: JSON.stringify(formData)
+    })
 
   },
 
 
+
   /**
     * @desc : 处理地址
     * @date : 2024/2/1 15:49
@@ -338,10 +316,9 @@ Page({
     formData.goodsList.forEach(item => {
       //标价合计 =  商品标价 x  商品数量
       sumStandard += item.amtStd
-      item['outingAmt'] = item.orderQty * item.priceOut 
-     
-      sumAmount += item.orderQty * item.priceOut //没有售价默认取标价
-      sumQuantity += item.orderQty //数量
+      item.outingAmt = item.outingQty * item.priceOut
+      sumAmount += item.outingQty * item.priceOut //没有售价默认取标价
+      sumQuantity += item.outingQty //数量
     })
     formData.sumStandard = sumStandard
     formData.saleDiscount = Number((sumAmount / sumStandard) * 100).toFixed(2)
@@ -355,7 +332,13 @@ Page({
     cardList[2].sumStandard = formData.sumStandard
     cardList[2].sumQuantity = formData.sumQuantity
     cardList[2].saleDiscount = formData.saleDiscount
-    contentSaveList[2].content = formData.sumAmount
+    //详情 办理
+    if (this.data.formMode == Constants.formMode.edit && this.data.formType == Constants.formMode.detail) {
+      contentSaveList[1].content = formData.sumAmount
+    } else {
+      contentSaveList[2].content = formData.sumAmount
+    }
+
     this.setData({
       cardList: cardList,
       contentSaveList: contentSaveList,
@@ -369,17 +352,14 @@ Page({
    * @author : 于继渤
    */
   setGoods(e) {
-    console.log('设置商品', e)
     //设置需收款
     let formData = JSON.parse(this.data.formData)
     let index = 0
     formData.goodsList.forEach(res => {
       //处理出库字段
       res.priceOut = res.priceSale
-      res.orderQty = res.itemQty
       res.outingQty = res.itemQty
       res.itemIndex = index++
-
     })
     this.setData({
       formData: JSON.stringify(formData)
@@ -406,7 +386,72 @@ Page({
 
 
 
+  /**
+      * @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.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: 'deliveryDate', type: 'str', readonly: true, required: false, title: mixins.$t('delivery_Time') },
+        { 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") }
+    ]
+    //详情(办理)
+    if (this.data.formMode == Constants.formMode.edit && this.data.formType == Constants.formMode.detail) {
+      //按钮
+      buttonSaveList = [
+        { code: 'save', title: mixins.$t("outProcessing"), width: '120rpx', color: '#1B365D' }
+      ]
+      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: '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({
+      contentObj: contentObj,
+      cardList: cardList,
+      popContent: popContent,
+      contentSaveList: contentSaveList,
+      buttonSaveList: buttonSaveList,
+    })
 
+  },
 
 
   /**
@@ -414,7 +459,7 @@ Page({
    */
   loadInit() {
     let formData = JSON.parse(this.data.formData)
-
+    console.log(this.data.formMode)
     if (this.data.formMode == Constants.formMode.other) { //转出库
       //查询可出库销售订单/商品
       this.setFormMain()
@@ -426,6 +471,18 @@ Page({
       eventChannel.on('params', function (data) {
         console.log('新建', data)
       })
+    } else if (this.data.formMode == Constants.formMode.edit && this.data.formType == Constants.formMode.detail) { //详情
+      //详情办理
+      wx.setNavigationBarTitle({
+        title: '销售出库详情'
+      })
+      //设置只读
+      this.setFormMain()
+    } else if (this.data.formMode == Constants.formMode.edit && !this.data.formType) {
+      //编辑
+      wx.setNavigationBarTitle({
+        title: '编辑销售出库'
+      })
     }
     this.setData({
       formData: JSON.stringify(formData)

+ 10 - 1
package-sales/pages/sales-outbound/add/add.wxml

@@ -3,11 +3,20 @@
 <loading wx:if="{{loading}}"></loading>
 
 
-<dk-form-bill type="saleOut" id="dk-form-bill" routeObjName="{{routeObjName}}" cardList="{{cardList}}" titleTagCol="shortName" titleCol="skuCode"  subCol="skuCode" descCol="skuModel" priceCol="priceOut" quantityCol="orderQty" sumAmountCol="sumAmount" discountStandardCol="saleDiscount" contentObj="{{contentObj}}" model:value="{{formData}}" popContent="{{popContent}}" bind:chooseData="chooseData" bind:setGoods="setGoods"   table="{{table}}"
+<dk-form-bill type="saleOut" id="dk-form-bill" routeObjName="{{routeObjName}}" cardList="{{cardList}}" titleTagCol="shortName" titleCol="skuCode"  subCol="skuCode" descCol="skuModel" priceCol="priceOut" quantityCol="outingQty" sumAmountCol="sumAmount" discountStandardCol="saleDiscount" contentObj="{{contentObj}}" model:value="{{formData}}" popContent="{{popContent}}" bind:chooseData="chooseData" bind:setGoods="setGoods"   table="{{table}}"
 bind:editItems="editItems"  bind:openChoosedItemInfo="openChoosedItemInfo" deleteName="deleteItemList"
 bind:customersChoose="customersChoose"   popType="sale" priceTitle="标价:" staff="staff" org="org">
 </dk-form-bill>
 <van-dialog id="van-dialog" />
 <view style="height: 200rpx;"></view>
+
+<!-- 底部加号 -->
+<view style="position: fixed;bottom: 230rpx;right: 30rpx;" wx:if="{{formMode == 'edit' && formType =='detail'}}">
+  <view bind:tap="toEdit" class="btn-add-class">
+    <van-icon name="edit" color="#FFFFFF" size="60rpx" />
+  </view>
+</view>
+
+
 <!--  保存 -->
 <dk-save-button model:value="{{btnFormData}}" btnAutoWidthFlag="{{true}}" btnRightFlag="{{true}}" buttonList="{{buttonSaveList}}" contentList="{{contentSaveList}}" bind:open="saveButton" bind:change="saveChange"></dk-save-button>

+ 9 - 0
package-sales/pages/sales-outbound/add/add.wxss

@@ -436,3 +436,12 @@ page {
   color: #95A8CB !important;
   font-size: 12px !important;
 }
+.btn-add-class {
+	background: #8091A9;
+	border-radius: 50%;
+	display: flex;
+	justify-content: center;
+	align-items: center;
+	padding: 20rpx;
+	box-shadow: 0px 17px 22px 0px #1B365D33;
+}