瀏覽代碼

客户接待跳转选品开单

于继渤 2 年之前
父節點
當前提交
7461be43e1

+ 3 - 0
api/pages/mst/cusFollow.js

@@ -30,6 +30,9 @@ module.exports = {
       },
       edit:{
         key: 'edit', url: '/package-basic-data/pages/customer-reception/detail/detail'
+      },
+      toSelectGoods:{
+        key: 'toSelectGoods', url: '/package-base-select/pages/select-goods/select-goods',chooseRoute:'/package-sales/pages/order-billing/add/add'
       }
     }
   }

+ 2 - 1
api/pages/mst/customer.js

@@ -34,7 +34,8 @@ module.exports = {
       measureTo:{
         key: 'measureTo', url: '/package-basic-data/pages/customer-reception/measure-to/measure-to'
       },
-
+      chooseChannel: { key: 'chooseChannel', url: '/package-base-select/pages/select-data/select-data', type: 'saleChannel' },
+      choosecusFrom: { key: 'choosecusFrom', url: '/package-base-select/pages/select-data/select-data', type: 'customerFrom' },
       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' }, 
       collection:{ key: 'collection', url: '/package-sales/pages/customer-collection/customer-collection', formMode: 'index', idKey: 'cusId' } //跳转客户收款

+ 6 - 0
mixins/index.js

@@ -791,6 +791,12 @@ module.exports = {
             item: data.item
           })
         }
+        if (data.formItem) {
+          console.log(data.formItem)
+          _this.setData({
+            formItem: data.formItem
+          })
+        }
         if (data.formType) { //表单保存修改按钮控制属性(标识)
           _this.setData({
             formType: data.formType

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

@@ -245,6 +245,7 @@ Page({
     const eventChannel = this.getOpenerEventChannel();
     const choosedGoodsList = this.data.choosedGoodsList
     const chooseRoute = this.data.chooseRoute
+    let that = this
     if (chooseRoute) { //跳转到上一个页面传过来的url
       wx.navigateTo({
         url: chooseRoute,
@@ -253,8 +254,12 @@ Page({
           bindData: function (data) { }
         },
         success: function (res) {
+          let data = { item: choosedGoodsList }
+          if(that.data.formType == 'customer-reception'){ //客户接待跳转过来
+            data['formItem'] = that.data.formItem
+          }
           // 通过eventChannel向被打开页面传送数据
-          res.eventChannel.emit('params', { item: choosedGoodsList })
+          res.eventChannel.emit('params', data)
         }
       })
     } else {

+ 17 - 3
package-basic-data/pages/customer-list/add/add.js

@@ -25,15 +25,17 @@ Page({
         { 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: 'cusFrom', name: 'cusFromName', type: 'drop', required: true, dropType: 'customerFrom', title: mixins.$t('customerSource') },
+        { code: 'cusFrom', name: 'cusFromName', required: true, title: mixins.$t('customerSource'), type: 'choose', urlKey: 'choosecusFrom' },
         { code: 'contactName', type: 'str', required: false, title: mixins.$t('contactName') },
         { code: 'contactPhone', type: 'str', title: mixins.$t('cpPhone'), required: false },
       ],
       center: [
-        { code: 'channelId', name: 'channelName', type: 'drop', dropType: 'saleChannel',required: true, title: mixins.$t('saleChannel') },
+        { code: 'channelId', name: 'channelName', required: true, title: mixins.$t('saleChannel'), type: 'choose', urlKey: 'chooseChannel' },
+
+       
         { code: 'staffId', name: 'staffName', type: 'choose', required: true, title: mixins.$t('saleStaff'), urlKey: 'chooseStaff' },
         { code: 'orgId', name: 'orgName', type: 'choose', required: true, title: mixins.$t('saleOrg'), urlKey: 'chooseOrg' },
-        { code: 'initialDebt', type: 'number', required: false, title: mixins.$t('initialDebtOwed') },
+        { code: 'initialDebt', type: 'number', required: false, title:'初始欠款' },
 
 
       ],
@@ -61,6 +63,18 @@ Page({
       formData.orgId = data.id
       formData.orgName = data.name
     }
+      //销售渠道
+      if (code == 'channelId') {
+        formData.channelId = data.id
+        formData.channelCode = data.code
+        formData.channelName = data.name
+      }
+      //客户来源
+      if (code == 'cusFrom') {
+        formData.cusFrom = data.id
+        formData.cusFromCode = data.code
+        formData.cusFromName = data.name
+      }
     this.setData({
       formData: JSON.stringify(formData)
     })

+ 8 - 8
package-basic-data/pages/customer-list/customer-list.js

@@ -19,12 +19,12 @@ Page({
     tagList: [{ title: mixins.$t('potentialCus'), code: mixins.$t('salePotentialCus') }, { title: mixins.$t('seasCus'), code: mixins.$t('saleSeasCus') }, { title: mixins.$t('dealCus'), code: mixins.$t('saleDealCus') }, { title: mixins.$t('allCus'), code: 'all' }],
     // 查询条件
     searchContent: [
-      { code: 'createtime', title:  mixins.$t('pastThirthtyDays'), defaultValue: 5, searchType: Constants.searchType.date },
-      { code: 'staff', title: mixins.$t('staffId'), dropType: 'staff' },
-      { code: 'org', title: mixins.$t('orgId'), dropType: 'org' },
+      { code: 'createtime', title: mixins.$t('pastThirthtyDays'), defaultValue: 5, searchType: Constants.searchType.date },
+      { code: 'staff', title: mixins.$t("staffId"), dropType: 'staff' },
+      { code: 'org', title: mixins.$t("orgId"), dropType: 'org' },
       { code: 'choose', title: mixins.$t('choose'), searchType: Constants.searchType.pick }
     ],
-    buttonSaveList: [{ code: 'add', title:  mixins.$t('add'), width: '120rpx', color: '#1B365D' }],
+    buttonSaveList: [{ code: 'add', title: mixins.$t('add'), width: '120rpx', color: '#1B365D' }],
     contentSaveList: [{ code: 'need', title: mixins.$t('together'), type: 'count', color: '#1B365D', tail: mixins.$t('customers'), bill: 1, fontSize: '15px' }],
     // 查询条件-筛选
     pullMenuList: [
@@ -55,9 +55,9 @@ Page({
 
     // 弹出按钮
     buttonList: [
-      { name: 'followUp', title:mixins.$t('followUp') },
-      { name: 'followUpTasks', title:mixins.$t('followUpTasks') },
-      { name: 'collection', title: mixins.$t("cusCollection")  ,idKey: 'cusId' },//跳转客户收款
+      { name: 'followUp', title: mixins.$t('followUp') },
+      { name: 'followUpTasks', title: mixins.$t('followUpTasks') },
+      { name: 'collection', title: mixins.$t("cusCollection"), idKey: 'cusId' },//跳转客户收款
     ],
 
     totallength: 0, //视图下方提醒数量
@@ -65,7 +65,7 @@ Page({
     // 路由
     routeObjName: 'customer',
     active: 0,
-    saleStatus: mixins.$t('salePotentialCus') ,
+    saleStatus: mixins.$t('salePotentialCus'),
 
   },
   /**

+ 8 - 1
package-basic-data/pages/customer-reception/add/add.js

@@ -126,7 +126,14 @@ Page({
   * @author : 于继渤
   */
   toShopping(){
-
+        //跳转购物车开单
+      let that = this
+        wx.navigateTo({
+          url:  this.data.route.toSelectGoods.url,
+          success: function (res) {
+            res.eventChannel.emit('params', { choose: true, item: 'sale', formItem: that.data.formData,formType:'customer-reception',route:'/package-sales/pages/order-billing/add/add'})
+          }
+        })
   },
 
   /**

+ 1 - 2
package-basic-data/pages/customer-reception/customer-reception.wxml

@@ -3,9 +3,8 @@
 <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'])}}">
+  <dk-dropdown-menu model:value="{{searchForm}}" menuList="{{searchContent}}" pullMenuList="{{pullMenuList}}" bind:search="searchData" searchTextPlaceholder="{{wxmlUtil.setSearchPlaceholder($t,['customerName'\,'telephone','adddress','contractNumber'])}}">
   </dk-dropdown-menu>
- 
   <dk-tabs active="{{active}}" list="{{tagList}}" bind:onChange="onChangeTabs">    </dk-tabs>
 </van-sticky>
 

+ 4 - 2
package-basic-data/pages/customer-reception/detail/detail.js

@@ -20,7 +20,8 @@ Page({
         { code: 'intention', name: 'intentionName', type: 'drop', required: true, dropType: 'customerIntention', title: mixins.$t('intention') },
         { code: 'remarks', type: 'textarea', rows: '5', required: true, showWordLimit: true, title: mixins.$t('followData') },
         { code: 'nextFollowTime', type: 'dateTime', required: true, title: mixins.$t('nextFollowTime') },
-        { code: 'stayTimeLen', name: 'stayTimeLenName', required: true, title: mixins.$t('stayTimeLen'), dropType: 'storeRetentionTime', type: 'drop', }
+        { code: 'stayTimeLen', name: 'stayTimeLenName', required: true, title: mixins.$t('stayTimeLen'), dropType: 'storeRetentionTime', type: 'drop', },
+        { code: 'file', type: 'uploader', title: mixins.$t("uploader") }
       ]
     },
   },
@@ -64,7 +65,8 @@ Page({
           { code: 'intention', name: 'intentionName', type: 'drop', required: true, dropType: 'customerIntention', title: mixins.$t('intention') },
           { code: 'remarks', type: 'textarea', rows: '5', required: true, showWordLimit: true, title: mixins.$t('followData') },
 
-          { code: 'stayTimeLen', name: 'stayTimeLenName', required: true, title: mixins.$t('stayTimeLen'), dropType: 'storeRetentionTime', type: 'drop', }
+          { code: 'stayTimeLen', name: 'stayTimeLenName', required: true, title: mixins.$t('stayTimeLen'), dropType: 'storeRetentionTime', type: 'drop', },
+          { code: 'file', type: 'uploader', title: mixins.$t("uploader") }
         ]
         that.setData({
           contentObj: contentObj

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

@@ -454,7 +454,7 @@ Page({
         title: '编辑订单'
       })
       this.setData({
-        buttonSaveList :[
+        buttonSaveList: [
           { code: 'save', title: mixins.$t("save"), width: '120rpx', color: '#1B365D' }
         ]
       })
@@ -467,11 +467,96 @@ Page({
     let that = this
     const eventChannel = this.getOpenerEventChannel()
     eventChannel.on('params', function (data) {
+      console.log(data)
       if (data && data.goodsList && data.goodsList.length > 0) {
         formData.goodsList = data.goodsList
         that.calculateAmount(formData)
       }
+      //客户接待过来的
+      if (data && data.item && data.item.length > 0) {
+        if (data.formItem) {
+          let formItem = JSON.parse(data.formItem)
+          formData.cusCode = formItem.cusCode
+          formData.cusId = formItem.cusId
+          formData.cusName = formItem.cusName
+          formData.cusPhone = formItem.cusPhone
+          formData.cusFromName = formItem.cusFromName
+          formData.cusFrom = formItem.cusFrom
+          //处理地址
+          formData.address = {
+            address: formItem.addressFull,
+            addressFull: formItem.addressFull,
+            addressArea: formItem.addressArea,
+            addressGcj02: formItem.addressGcj02,
+            addressName: formItem.addressName,
+          }
+          formData.addressArea = formItem.addressArea
+          formData.addressFull = formItem.addressFull
+          formData.addressGcj02 = formItem.addressGcj02
+          formData.addressName = formItem.addressName
+          formData.addressNo = formItem.addressNo
+          formData.contactPhone = formItem.contactPhone
+          formData.contactPhone = formItem.contactPhone
+        }
+        formData.goodsList = data.item
+        that.setGoodsAmount(formData)
+        that.calculateAmount(formData)
+      }
     })
   },
+  setGoodsAmount(formData) {
+    let cardList = this.data.cardList
 
+    let index = cardList.findIndex(it => it.name == 'items');
+    if (formData.goodsList && formData.goodsList.length > 0) {
+      let sumStandard = Number(0)
+      let sumAmount = Number(0)
+      let sumQuantity = Number(0)
+      formData.goodsList.forEach(item => {
+        //标价合计 =  商品标价 x  商品数量
+        item.priceStd = item.priceStd ? item.priceStd : (item.priceStandard ? item.priceStandard : 0)//标价
+        item.amtStd = Number(item.priceStd * item.itemQty) //合计标价金额
+        item.priceSale = item.priceSale ? item.priceSale : item.priceStandard
+        item.itemAmt = item.priceSale * item.itemQty //商品金额
+        item.priceDiscount = item.priceStd ? Number((item.priceSale / item.priceStd) * 100).toFixed(2) : 100//售价折扣
+        sumQuantity += item.itemQty //数量
+        sumAmount += item.priceSale * item.itemQty //没有售价默认取标价
+        console.log('111', item.priceStandard)
+        console.log('111', item.priceStd)
+        sumStandard += (item.priceStd ? item.priceStd : item.priceStandard) * item.itemQty
+      })
+      //标价合计
+      cardList[index].sumStandard = sumStandard
+      //销售折扣 (合计金额/标价合计)
+      cardList[index].saleDiscount = sumStandard ? Number((sumAmount / sumStandard) * 100).toFixed(2) : 100
+      //合计金额
+      cardList[index].sumAmount = sumAmount
+      //TODO   需要获取当前客户可用预存
+      cardList[index].canUseCollect = 0  //可用
+      cardList[index].useCollect = 0  //使用
+      formData.sumStandard = sumStandard
+      formData.saleDiscount = cardList[index].saleDiscount
+      formData.sumAmount = sumAmount
+      formData.canUseCollect = 0
+      formData.useCollect = 0
+      formData.sumQuantity = sumQuantity
+    } else {
+      cardList[index].sumStandard = 0
+      cardList[index].saleDiscount = 0
+      cardList[index].sumAmount = 0
+      cardList[index].canUseCollect = 0
+      cardList[index].useCollect = 0
+
+      formData.sumStandard = 0
+      formData.saleDiscount = 0
+      formData.sumAmount = 0
+      formData.canUseCollect = 0
+      formData.useCollect = 0
+    }
+
+    this.setData({
+      cardList: cardList,
+      formData: JSON.stringify(formData)
+    })
+  },
 })