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

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

zhoux 2 лет назад
Родитель
Сommit
7b900ad03b

+ 70 - 6
components/dkbase/dk-form/dk-form.js

@@ -11,6 +11,7 @@ const common = require('@/utils/common');
 const Constants = require('@/utils/Constants');
 const util = require('@/utils/util.js')
 const chooseLocation = requirePlugin('chooseLocation');
+const config = require('@/config/config.js')
 const app = getApp();
 Component({
   /**
@@ -22,6 +23,10 @@ Component({
       type: Array,
       value: []
     },
+    // 表名,用于上传附件
+    table: {
+      type: String,
+    },
     // 内容
     contentObj: {
       type: Object,
@@ -146,8 +151,8 @@ Component({
         })
       } else if (item.item.type == 'choose') {
         let that = this
-        console.log(item,this.data.routeObjName,this.data.routeUrl
-          );
+        console.log(item, this.data.routeObjName, this.data.routeUrl
+        );
         // 跳转链接
         if (item.item.urlKey) {
           let route = this.data.routeUrl[this.data.routeObjName][item.item.urlKey]
@@ -165,10 +170,10 @@ Component({
               },
               success: function (res) {
                 console.log('item', that.data.form)
-                let data = { 
-                  route: route, 
-                  formMode: item.item.formMode ,
-                  id:that.data.form[item.item.idKey],
+                let data = {
+                  route: route,
+                  formMode: item.item.formMode,
+                  id: that.data.form[item.item.idKey],
                   chooseType: item.item.chooseType
                 }
                 // 通过eventChannel向被打开页面传送数据
@@ -467,6 +472,7 @@ Component({
           errMsg: errMsg
         })
       }
+      this.triggerEvent('changePhoneblur', e)
     },
     /**
      * @desc : 小程序地图调用
@@ -590,6 +596,64 @@ Component({
       })
     },
     /**
+  * @desc : 上传附件超出大小
+  * @author : 周兴
+  * @date : 2024/3/27 16:16
+  */
+    overSize(e) {
+      util.showToast('文件超出' + Constants.uploadFileConfig.maxSizeMB);
+    },
+    /**
+     * @desc : 上传附件
+     * @author : 周兴
+     * @date : 2024/3/27 16:16
+     */
+    afterRead(e) {
+      // this.setData({
+      //     uploadFileFlag:true
+      // })
+      const _this = this;
+      const {
+        file
+      } = e.detail;
+      // 配置存放的文件夹 公司code - 表名 - 年月 -- 日
+      let folder = app.globalData.company.cpCode + '/' + this.data.table + '/' + new Date().toYearMonth2() + '/' + new Date().toDay()
+      let url = config.upload_url;
+      url = url.replace('mdm-server', 'mdm-server' + '-' + app.globalData.company.svcCode.replace('_', '-'))
+      file.forEach(res => {
+        // 当设置 mutiple 为 true 时, file 为数组格式,否则为对象格式
+        wx.uploadFile({
+          url: url,
+          filePath: res.path,
+          name: 'file',
+          formData: {
+            'folder': folder
+          },
+          header: {
+            'Authorization': 'Bearer ' + app.globalData.token
+          },
+          success(res) {
+            let data = JSON.parse(res.data)
+            if (data.code === 200) {
+              _this.setData({
+                uploadFileFlag: false
+              })
+              let form = _this.data.form
+              let annexPaths = form['annexPaths'] || []
+              data.data.url = config.image_url + data.data.path
+              annexPaths.push(data.data)
+              form.annexPaths = annexPaths;
+              _this.setData({
+                form: form,
+                value: JSON.stringify(form)
+              })
+              console.log('ff', _this.data.form);
+            }
+          },
+        })
+      })
+    },
+    /**
      * @desc : 获取语言的方法
      * @author : 周兴
      * @date : 2024/1/19

+ 7 - 7
components/dkbase/dk-form/dk-form.wxml

@@ -78,14 +78,14 @@
       </van-field>
       <!--附件-->
       <view style="display:flex;width:100%;margin: 1vw; padding-top: 20rpx;" wx:if="{{item.type=='uploader'}}">
-        <view style="width: 168rpx; flex:1;color: #95A8CB;font-size: 28rpx;padding-left: 27rpx;">附件</view>
-        <view style="width: calc(100% - 168rpx);text-align: left;">
-          <van-uploader max-count="5" accept="image" style="margin-left: 4%;border-radius: 15rpx;" preview-size="160rpx;" file-list="{{ fileList }}" bind:delete="deleteImg" bind:after-read="afterRead" multiple="true" imageFit="aspectFit" />
-          <view style="margin-left: 27rpx;color: #C8C9CC;font-size: 12px;">
-            图片最多上传5张
+            <view style="width: 168rpx; flex:1;color: #95A8CB;font-size: 28rpx;padding-left: 27rpx;">附件</view>
+            <view style="width: calc(100% - 168rpx);text-align: left;">
+              <van-uploader max-count="5" disabled="{{!!item.readonly}}" accept="image" style="margin-left: 4%;border-radius: 15rpx;" preview-size="160rpx;" file-list="{{ form['annexPaths'] }}" bind:delete="deleteImg" bind:after-read="afterRead" multiple="true" imageFit="aspectFit" max-size="{{maxSize}}" bind:oversize="overSize" />
+              <view style="margin-left: 27rpx;color: #C8C9CC;font-size: 12px;">
+                图片最多上传5张
+              </view>
+            </view>
           </view>
-        </view>
-      </view>
     </view>
   </view>
 </view>

+ 83 - 31
package-basic-data/pages/customer-reception/add/add.js

@@ -20,51 +20,102 @@ Page({
     radioFollowUp: '1',
     routeObjName: 'cusFollow',
     cardList: ['main'],
-    buttonSaveList:[{code:'add',title:mixins.$t('save'),width:'120rpx'}],
+    buttonSaveList: [{ code: 'add', title: mixins.$t('save'), width: '120rpx' }],
     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: false },
-        { code: 'addressNo', type: 'str', required: false, title: mixins.$t('addressNo')  },
-        { 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: 'cusPhone', type: 'phone', title: mixins.$t('cusPhone'), required: true },
+        { code: 'addressFull', type: 'address', title: mixins.$t('addressFull'), required: false },
+        { code: 'addressNo', type: 'str', required: false, title: mixins.$t('addressNo') },
+        { 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', }
       ]
     },
-
-    followStatus:mixins.$t('followStatusReporting')
+    table: Constants.tables.cusFollow,
+    customerService: app.globalData['customerService'],
+    followStatus: mixins.$t('followStatusReporting')
   },
 
 
- /**
-  * @desc : 设置保存参数
-  * @date : 2024/2/1 15:49
-  * @author : 于继渤
-  */
- setParams(params) {
-  params.followStatus = this.data.followStatus
-  params.followOrg =  app.globalData.user.orgId
-  return params
-},
-/**
- * @desc : 保存数据服务
- * @date : 2024/2/1 15:49
- * @author : 于继渤
- */
-saveData() {
+  /**
+   * @desc : 设置保存参数
+   * @date : 2024/2/1 15:49
+   * @author : 于继渤
+   */
+  setParams(params) {
+    params.followStatus = this.data.followStatus
+    params.followOrg = app.globalData.user.orgId
+    return params
+  },
+  /**
+   * @desc : 保存数据服务
+   * @date : 2024/2/1 15:49
+   * @author : 于继渤
+   */
+  saveData() {
     return this.excute(this.data.service, this.data.service.insert, this.data.params);
-},
-
-
+  },
+  /**
+   * @desc : 手机号离开焦点事件
+   * @date : 2024/4/8 15:49
+   * @author : 于继渤
+   */
+  changePhoneblur(e) {
+    let phone = e.detail.detail.detail.value
+    if (phone) {
+      //查询客户信息
+      this.getCustomerData({ cusPhone: phone })
+    }
+  },
 
+  /**
+   * @desc : 查询客户信息
+   * @author : 于继渤
+   * @date : 2024/1/23 9:16
+   */
+  getCustomerData(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) {
+          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.cusFromName = item.cusFromName
+          //处理地址
+          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
+          this.setData({
+            formData: JSON.stringify(formData)
+          })
+        }
+      }
+    });
+  },
+  /**
+    * @desc : 顶部切换
+    * @date : 2024/4/8 15:49
+    * @author : 于继渤
+    */
   onRadioFollowUp(e) {
     let detail = e.detail
     this.setFormContent(detail)
     this.setData({
       radioFollowUp: detail,
-      formData:null
+      formData: null
     })
     console.log('onRadioFollowUp', e.detail)
   },
@@ -88,7 +139,8 @@ saveData() {
     let radioFollowUpTwolist = [
       { 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") }
     ]
 
     let contentObj = this.data.contentObj
@@ -103,7 +155,7 @@ saveData() {
     }
 
     this.setData({
-      followStatus,followStatus,
+      followStatus, followStatus,
       contentObj: contentObj
     })
   }

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

@@ -25,7 +25,7 @@
 </view>
 
 
-<dk-form id="{{formName}}" routeObjName="{{routeObjName}}" cardList="{{cardList}}" contentObj="{{contentObj}}" model:value="{{formData}}" bind:chooseData="chooseData">
+<dk-form id="{{formName}}" routeObjName="{{routeObjName}}" cardList="{{cardList}}" contentObj="{{contentObj}}" model:value="{{formData}}" bind:changePhoneblur="changePhoneblur" bind:chooseData="chooseData" table="{{table}}">
 </dk-form>
 
 <!-- 购物车 -->

+ 31 - 1
package-sales/pages/order-billing/order-billing.js

@@ -16,6 +16,7 @@ Page({
    * 页面的初始数据 
    */
   data: {
+    tagList: [{ title: "全部", code: '' }, { title: "待出库", code: ['出库状态-待出库', '出库状态-出库中'] }, { title: "已出库", code: ['出库状态-已出库'] }],
     routeObjName: 'order',
     // 查询条件
     searchContent: [
@@ -136,7 +137,8 @@ Page({
       code: 'count',
       bill: 0,
       quantity: 0
-    }]
+    }],
+    outStatus: []
 
   },
   /**
@@ -176,6 +178,34 @@ Page({
       }
     })
   },
+
+
+  /**
+ * @desc : 切换
+ * @date : 2024/2/1 15:49
+ * @author : 于继渤
+ */
+  onChangeTabs(e) {
+    let code = e.detail.detail.code
+    this.setData({
+      outStatus: code,
+      pageInfo: {
+        currentPage: 1,
+        pageSize: 5
+      }
+    })
+    this.searchData()
+  },
+  /**
+* @desc : 设置查询参数
+* @date : 2024/2/1 15:49
+* @author : 于继渤
+*/
+  setSearchParams(params) {
+    //销售状态
+    params.outStatusList = this.data.outStatus == 'all' ? [] : this.data.outStatus
+    return params
+  },
   /**
      * @desc : 加载数据
      * @author : 于继渤

+ 2 - 1
package-sales/pages/order-billing/order-billing.wxml

@@ -1,12 +1,13 @@
 <!-- 前台导入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}}" loadingName="{{$t['loading']}}" backgroundColor="#f2f2f2;" opacity="0.8"></loading>
 <van-sticky scroll-top="0">
   <!-- 查询条件 -->
 
 
   <dk-dropdown-menu model:value="{{searchForm}}" menuList="{{searchContent}}" pullMenuList="{{pullMenuList}}" bind:search="searchData" searchTextPlaceholder="{{wxmlUtil.setSearchPlaceholder($t,['customerName','orderNo','telephone','adddress','contractNumber'])}}">
   </dk-dropdown-menu>
+  <dk-tabs active="{{active}}" list="{{tagList}}" bind:onChange="onChangeTabs"></dk-tabs>
 </van-sticky>
 
 

+ 1 - 0
utils/Constants.js

@@ -315,6 +315,7 @@ module.exports = {
     income: 't_mac_other_receivable',
     // 其他支出单
     outlay: 't_mac_other_payable',
+    cusFollow: 't_crm_cus_follow',
   },
 
   /**