于继渤 1 rok temu
rodzic
commit
e2ac4c5ffd

+ 31 - 0
package-basic-data/pages/customer-list/add/add.js

@@ -17,6 +17,7 @@ Page({
    */
   data: {
     routeObjName: 'customer',
+    gradeCode: app.globalData.company.gradeCode,
     saleChannelService: app.globalData['saleChannelService'],
     cardList: ['main', 'center', 'remarks'],
     buttonSaveList: [{ code: 'add', title: mixins.$t('save'), width: '120rpx' }],
@@ -147,6 +148,36 @@ Page({
    */
   loadInit(options) {
     //TODO  销售渠道默认 零售 ,销售部门销售员工默认当前登录人的
+    let contentObj = this.data.contentObj
+    if (this.data.gradeCode == Constants.gradeCode.STD) {
+
+      contentObj.main = [
+        { code: 'cusName', type: 'str', required: true, 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: '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 },
+      ]
+
+
+    } else if (this.data.gradeCode == Constants.gradeCode.PRO) {
+
+      contentObj.main = [
+        { code: 'cusName', type: 'str', required: true, 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: 'cusFrom', name: 'cusFromName', required: false, 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 },
+      ]
+    }
+    this.setData({
+      contentObj: contentObj
+    })
+
     if (this.data.formMode == Constants.formMode.edit) {
       wx.setNavigationBarTitle({
         title: mixins.$t('editCus'),

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

@@ -11,6 +11,7 @@ Page({
   data: {
     // 路由
     routeObjName: 'order',
+    gradeCode: app.globalData.company.gradeCode,
     validFlag: true,
     customerService: app.globalData['customerService'],
     saleChannelService: app.globalData['saleChannelService'],
@@ -575,6 +576,7 @@ Page({
       wx.setNavigationBarTitle({
         title: '编辑订单'
       })
+      this.setStdAndPro()
       this.setData({
         buttonSaveList: [
           { code: 'save', title: mixins.$t("save") }
@@ -585,6 +587,7 @@ Page({
     } else {
       //设置默认业务员业务部门
       this.setTopStaffAndOrg(formData)
+      this.setStdAndPro()
 
       // 设置送货日期 当前日期 加一天
       var currentDate = new Date();
@@ -705,5 +708,37 @@ Page({
     }).catch(() => {
 
     })
-  }
+  },
+
+
+  setStdAndPro() {
+    let contentObj = this.data.contentObj
+    if (this.data.gradeCode == Constants.gradeCode.STD) {
+      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', required: true, title: mixins.$t('saleChannel'), type: 'choose', urlKey: 'chooseChannel' },
+        { code: 'contactName', type: 'str', required: false, title: mixins.$t('contactName') },
+        { code: 'contactPhone', type: 'str', title: mixins.$t('cpPhone'), required: false },
+
+      ]
+    } else if (this.data.gradeCode == Constants.gradeCode.PRO) {
+      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', required: true, title: mixins.$t('saleChannel'), type: 'choose', urlKey: 'chooseChannel' },
+        { code: 'cusFrom', name: 'cusFromName', required: false, 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 },
+      ]
+    }
+    this.setData({
+      contentObj: contentObj
+    })
+
+  },
 })

+ 98 - 47
package-sales/pages/sales-outbound/add/add.js

@@ -19,13 +19,15 @@ Page({
     cardList: [
       { name: 'main', title: mixins.$t("customerInformation") },
       { name: 'relation' },
-      { name: 'items', title: mixins.$t("goodsDetail"), 
-      chooseGoodsFlag: false,
-      chooseGoodsItemFlag: true,
-      chooseInventoryFlag: true,
-      chooseCoordinationFlag: true,
-      
-      itemAmt: '', displayNum: 2, controls: [{ card: 'relation', code: 'fromNo' }], },
+      {
+        name: 'items', title: mixins.$t("goodsDetail"),
+        chooseGoodsFlag: false,
+        chooseGoodsItemFlag: true,
+        chooseInventoryFlag: true,
+        chooseCoordinationFlag: true,
+
+        itemAmt: '', displayNum: 2, controls: [{ card: 'relation', code: 'fromNo' }],
+      },
       { name: 'other', title: mixins.$t("otherInfo") },
 
     ],
@@ -211,11 +213,11 @@ Page({
     }
   },
 
-    /**
-   * @desc : 自定义保存参数
-   * @date : 2024/2/1 15:49
-   * @author : 于继渤
-   */
+  /**
+ * @desc : 自定义保存参数
+ * @date : 2024/2/1 15:49
+ * @author : 于继渤
+ */
   handleSaveData() {
     let formData = {}
     //设置显示
@@ -595,7 +597,7 @@ Page({
     if (code == 'channelId') {
       formData.channelId = e.detail.data.data.id
       formData.channelCode = e.detail.data.data.code
-      formData.channelName =  e.detail.data.data.name
+      formData.channelName = e.detail.data.data.name
     }
     //客户来源
     if (code == 'cusFrom') {
@@ -674,9 +676,9 @@ Page({
 
     //详情 办理
     if (this.data.formMode == Constants.formMode.add) {
-      if(contentSaveList.length == 1){
+      if (contentSaveList.length == 1) {
         contentSaveList[0].content = formData.sumAmount
-      }else{
+      } else {
         contentSaveList[1].content = formData.sumAmount
       }
     } else {
@@ -723,16 +725,34 @@ Page({
     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') },
-      { code: 'contactName', type: 'str', readonly: true, title: mixins.$t('contactName') },
-      { code: 'contactPhone', type: 'str',  readonly: true,  title: mixins.$t('cpPhone'),  },
-    ]
+
+    // let contentObj = this.data.contentObj
+    if (this.data.gradeCode == Constants.gradeCode.STD) {
+      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: 'contactName', type: 'str', readonly: true, title: mixins.$t('contactName') },
+        { code: 'contactPhone', type: 'str', readonly: true, title: mixins.$t('cpPhone'), },
+      ]
+    } else if (this.data.gradeCode == Constants.gradeCode.PRO) {
+      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') },
+        { code: 'contactName', type: 'str', readonly: true, title: mixins.$t('contactName') },
+        { code: 'contactPhone', type: 'str', readonly: true, title: mixins.$t('cpPhone'), },
+      ]
+    }
+    this.setData({
+      contentObj: contentObj
+    })
+
     contentObj.relation = [{
       code: 'fromNo',
       type: 'str',
@@ -799,6 +819,7 @@ Page({
     } else if (this.data.formMode == Constants.formMode.add) {  //新建
       //设置显示
       this.setFlagView()
+      this.setStdAndPro()
       //处理默认值  业务员业务部门
       formData = this.setStaffOrg(formData)
       // 设置送货日期 当前日期 加一天
@@ -821,6 +842,7 @@ Page({
       })
       //设置显示
       this.setFlagView()
+      this.setStdAndPro()
       if (app.globalData.company.gradeCode == Constants.gradeCode.STD) {
         this.setData({
           checkFlag: true
@@ -833,7 +855,36 @@ Page({
       formData: JSON.stringify(formData)
     })
   },
+  setStdAndPro() {
+    let contentObj = this.data.contentObj
+    if (this.data.gradeCode == Constants.gradeCode.STD) {
+      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', required: true, title: mixins.$t('saleChannel'), type: 'choose', urlKey: 'chooseChannel' },
+        // { 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 },
+      ]
+    } else if (this.data.gradeCode == Constants.gradeCode.PRO) {
+      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', required: true, title: mixins.$t('saleChannel'), type: 'choose', urlKey: 'chooseChannel' },
+        { code: 'cusFrom', name: 'cusFromName', required: false, 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 },
+      ]
+    }
+    this.setData({
+      contentObj: contentObj
+    })
 
+  },
   /**
   * @desc : 设置显示
   * @date : 2024/2/1 15:49
@@ -843,7 +894,7 @@ Page({
     let contentObj = this.data.contentObj
     if (app.globalData.company.gradeCode == Constants.gradeCode.STD) {
       contentObj.relation = []
-      contentObj.main =  [
+      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 },
@@ -891,26 +942,26 @@ Page({
   * @date : 2024/2/1 15:49
   * @author : 于继渤
   */
- getDefChannel() {
-  this.excute(this.data.saleChannelService, this.data.saleChannelService.selectByCond, {
-    flgDefault: true
-  }).then(res => {
-    if (res.data.code == 200) {
-      let formData = JSON.parse(this.data.formData)
-      if (res.data.data.list && res.data.data.list.length > 0) {
-        formData.channelId = res.data.data.list[0].channelId
-        formData.channelName = res.data.data.list[0].channelName
-        formData.channelCode = res.data.data.list[0].channelCode
+  getDefChannel() {
+    this.excute(this.data.saleChannelService, this.data.saleChannelService.selectByCond, {
+      flgDefault: true
+    }).then(res => {
+      if (res.data.code == 200) {
+        let formData = JSON.parse(this.data.formData)
+        if (res.data.data.list && res.data.data.list.length > 0) {
+          formData.channelId = res.data.data.list[0].channelId
+          formData.channelName = res.data.data.list[0].channelName
+          formData.channelCode = res.data.data.list[0].channelCode
+        }
+        // formData.staffId = app.globalData.user.staffId
+        // formData.staffName = app.globalData.user.staffName
+        // formData.orgId = app.globalData.user.orgId
+        // formData.orgName = app.globalData.user.orgName
+        //设置默认值
+        this.setData({
+          formData: JSON.stringify(formData)
+        })
       }
-      // formData.staffId = app.globalData.user.staffId
-      // formData.staffName = app.globalData.user.staffName
-      // formData.orgId = app.globalData.user.orgId
-      // formData.orgName = app.globalData.user.orgName
-      //设置默认值
-      this.setData({
-        formData: JSON.stringify(formData)
-      })
-    }
-  })
-},
+    })
+  },
 })