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

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

王英杰 пре 1 година
родитељ
комит
fbfbc1afc8

+ 68 - 52
package-basic-data/pages/register/company-register/company-register.js

@@ -40,53 +40,53 @@ Page({
     cardList: ['main'],
     contentObj: {
       main: [{
-          code: 'gradeCode',
-          type: 'tabs',
-          tagList: [{
-              name: mixins.$t('standardVersion'),
-              id: Constants.gradeCode.STD
-            },
-            // 专业版暂时注释掉
-            // {
-            //   name: mixins.$t('professionalVersion'),
-            //   id: Constants.gradeCode.PRO
-            // }
-          ],
-          title: mixins.$t('gradeCode')
-        },
-        {
-          code: 'cpName',
-          type: 'str',
-          required: 'true',
-          title: mixins.$t('cpName')
-        },
-        {
-          code: 'cpManager',
-          type: 'str',
-          required: 'true',
-          title: mixins.$t('cpManager')
-        },
-        {
-          code: 'cpPhone',
-          type: 'phone',
-          required: 'true',
-          title: mixins.$t('cpPhone')
-        },
-        {
-          code: 'cpSize',
-          type: 'str',
-          title: mixins.$t('cpSize')
-        },
-        {
-          code: 'shopSize',
-          type: 'str',
-          title: mixins.$t('shopSize')
-        },
-        {
-          code: 'feedback',
-          type: 'textarea',
-          title: mixins.$t('feedback')
+        code: 'gradeCode',
+        type: 'tabs',
+        tagList: [{
+          name: mixins.$t('standardVersion'),
+          id: Constants.gradeCode.STD
         },
+          // 专业版暂时注释掉
+          // {
+          //   name: mixins.$t('professionalVersion'),
+          //   id: Constants.gradeCode.PRO
+          // }
+        ],
+        title: mixins.$t('gradeCode')
+      },
+      {
+        code: 'cpName',
+        type: 'str',
+        required: 'true',
+        title: mixins.$t('cpName')
+      },
+      {
+        code: 'cpManager',
+        type: 'str',
+        required: 'true',
+        title: mixins.$t('cpManager')
+      },
+      {
+        code: 'cpPhone',
+        type: 'phone',
+        required: 'true',
+        title: mixins.$t('cpPhone')
+      },
+      {
+        code: 'cpSize',
+        type: 'str',
+        title: mixins.$t('cpSize')
+      },
+      {
+        code: 'shopSize',
+        type: 'str',
+        title: mixins.$t('shopSize')
+      },
+      {
+        code: 'feedback',
+        type: 'textarea',
+        title: mixins.$t('feedback')
+      },
       ],
     },
   },
@@ -125,8 +125,8 @@ Page({
     let item = e.currentTarget.dataset.item;
     let summaryInfo = this.data.summaryInfo
     // 计算截止日期
-    let months = item.validLong + item.extraLong 
-    let  endDate = new Date(this.data.buyBeginDate).addMonths(months)
+    let months = item.validLong + item.extraLong
+    let endDate = new Date(this.data.buyBeginDate).addMonths(months)
     summaryInfo.endDate = endDate.toDateStr();
     this.setData({
       curentAdItem: item,
@@ -236,7 +236,7 @@ Page({
       url: this.data.route.productDetail.url,
       events: {
         // 回调后,在这里给页面赋值
-        bandData: function (e) {}
+        bandData: function (e) { }
       },
       success: function (res) {
         // 通过eventChannel向被打开页面传送数据 TODO 测试例子url是写死的,实际中,需要从route中读取
@@ -323,7 +323,10 @@ Page({
     }
     // 从好有分享过来的数据 好友互利共赢  shareType=1 cpid userid startdate enddate 
     if (this.data.shareType) {
-
+      params.cpIdFrom = this.data.cpIdFrom 
+      params.shareEndDate = this.data.shareEndDate 
+      params.userIdFrom = this.data.userIdFrom 
+      params.staffNameFrom = this.data.staffNameFrom  
     }
     return params
   },
@@ -487,6 +490,19 @@ Page({
       })
     }
 
+    // 来源公司 -userid
+    if (options.userIdFrom) {
+      this.setData({
+        userIdFrom: options.userIdFrom,
+      })
+    }
+    // 来源公司 -员工
+    if (options.staffNameFrom) {
+      this.setData({
+        staffNameFrom: options.staffNameFrom,
+      })
+    }
+
     // 查询活动
     this.getActivity();
     // this.setData({
@@ -506,8 +522,8 @@ Page({
       if (res.data.code == Constants.SUCESS_CODE) {
         //服务器的时间  
         let nowDate = res.data.data.currentDate
-          nowDate = new Date(nowDate).toDateStr()
-        _this.setData({ 
+        nowDate = new Date(nowDate).toDateStr()
+        _this.setData({
           buyBeginDate: nowDate
         })
       }

+ 16 - 3
package-basic-data/pages/share-power/share-power.js

@@ -2,6 +2,7 @@
 const Constants = require('@/utils/Constants.js');
 const mixins = require('@/mixins/index.js');
 const app = getApp()
+const util = require('@/utils/util.js')
 const api = require('@/utils/api.js');
 Page({
   mixins: [mixins],
@@ -12,7 +13,8 @@ Page({
     needHelpUserNumber: 5,
     powerModelShowFlag: true,
     menuButtonTop: 48,
-    params: {}
+    params: {},
+    helpFlag: true
   },
 
   /**
@@ -20,6 +22,9 @@ Page({
    */
   onLoad(options) {
     console.log('options', options);
+    this.setData({
+      params: options
+    })
     wx.hideShareMenu()
   },
 
@@ -120,12 +125,20 @@ Page({
     console.log('helpMe');
     _this.wxlogin().then(res => {
       _this.getopenid({ code: res.code }).then(res => {
-        console.log('res', res);
         if (res.data.code == Constants.SUCESS_CODE) {
           const openid = res.data.data.openid
           let service = app.globalData['couponReceiveService']
           const params = _this.data.params
-          _this.excute(service, service.insert, )
+          params.userWxid = openid
+          _this.excute(service, 'insert_coupon_send', params).then(res => {
+            if (res.data.code == Constants.SUCESS_CODE) {
+              util.showToast('助力成功!')
+            }
+              this.setData({
+                helpFlag: false,
+                powerModelShowFlag: false
+              })
+          })
         }
       })
     })

+ 3 - 3
package-basic-data/pages/share-power/share-power.wxml

@@ -30,7 +30,7 @@
           <view>购买更便宜</view>
         </view>
         <view class="prize-view">
-          <view class="number">5</view>折
+          <view class="number">{{params.discount}}</view>折
         </view>
       </view>
       <view class="icon-view">
@@ -41,7 +41,7 @@
         </view>
       </view>
       <view class="button-view">
-        <van-button size="normal" wx:if="{{true}}" color="#FF7B1A" custom-style="width:100%;margin-top:30rpx;border-radio:50rpx;" bind:tap="helpMe">帮我点一下
+        <van-button size="normal" wx:if="{{helpFlag}}" color="#FF7B1A" custom-style="width:100%;margin-top:30rpx;border-radio:50rpx;" bind:tap="helpMe">帮我点一下
         </van-button>
         <van-button size="normal" wx:else color="#FF7B1A" custom-style="width:100%;margin-top:30rpx;border-radio:50rpx;">我也想使用软件
         </van-button>
@@ -68,7 +68,7 @@
         </view>
         <view class="coupon-recrive-card">
           <view class="info">
-            <view class="number">5</view>折
+            <view class="number">{{params.discount}}</view>折
           </view>
           <view class="font">优惠劵</view>
         </view>

+ 95 - 53
package-basic-data/pages/share/share.js

@@ -94,7 +94,19 @@ Page({
     if (e.currentTarget.dataset.name != 'toShare') {
       switch (e.currentTarget.dataset.name) {
         case 'toPower':
-          this.getPowerItem()
+          this.getPowerItem().then(res => {
+            const data = res.data.data
+            if (data) {
+              const that = this
+              const endDate = data.endDate
+              const nowTime = data.nowTime
+              const time = that.calculateTimeDifference(new Date(nowTime), new Date(endDate))
+              that.setData({
+                time: time,
+                couponSendItem: data
+              })
+            }
+          })
           break;
         case 'toRegister':
           // this.getRegisterItem()
@@ -114,19 +126,7 @@ Page({
       sendUser: app.globalData.user.userId,
     }
     let service = app.globalData['couponSendService']
-    this.excute(service, 'get_item', params).then(res => {
-      const data = res.data.data
-      if (data) {
-        const that = this
-        const endDate = data.endDate
-        const nowTime = data.nowTime
-        const time = that.calculateTimeDifference(new Date(nowTime), new Date(endDate))
-        that.setData({
-          time: time,
-          couponSendItem: data
-        })
-      }
-    });
+    return this.excute(service, 'get_item', params)
   },
   /**
   * @desc : 倒计时事件
@@ -164,6 +164,7 @@ Page({
           this.setData({
             integralTacticItem: res.data.data.list[0],
           })
+          this.getShareNumber()
         }
       }
     });
@@ -223,28 +224,12 @@ Page({
     let service = app.globalData['couponUseService']
     this.excute(service, service.countByCond, params).then(res => {
       this.setData({
-        couponNumber: res.data
+        couponNumber: res.data.data
       })
     });
   },
 
   /**
-  * @desc : 优惠券
-  * @author : 刘尧
-  * @date : 2024/7/25 14:32
-  */
-  getCouponCount() {
-    let params = {}
-    let service = app.globalData['couponService']
-    this.excute(service, '10002024-0718-0000-0000-000005c0a01e', params).then(res => {
-      console.log(res.data);
-      if (res.data.code == Constants.SUCESS_CODE) {
-
-      }
-    });
-  },
-
-  /**
   * @desc : 点击立即助力按钮调后台服务插入优惠劵发出数据
   * @author : 刘尧
   * @date : 2024/7/25 14:32
@@ -259,19 +244,7 @@ Page({
       flgValid: true
     }
     let service = app.globalData['couponSendService']
-    this.excute(service, service.insert, params).then(res => {
-      if (res.data.code == Constants.SUCESS_CODE) {
-        const that = this
-        const data = res.data.data
-        const endDate = data.endDate
-        const nowTime = data.nowTime
-        const time = that.calculateTimeDifference(new Date(nowTime), new Date(endDate))
-        that.setData({
-          time: time,
-          couponSendItem: data
-        })
-      }
-    });
+    return this.excute(service, service.insert, params)
   },
 
   /**
@@ -290,19 +263,64 @@ Page({
   },
 
   /**
+  * @desc : 分享调用
+  * @author : 刘尧
+  * @date : 2024/7/30 15:40
+  */
+  shareIntegral(){
+    let service = app.globalData['integralShareService']
+    const params = {
+      cpId: app.globalData.company.cpId,
+      tacticId: this.data.integralTacticItem.tacticId,
+      flgValid: true,
+      integralType: Constants.integralType.share,
+      userId: app.globalData.user.userId,
+    }
+    return this.excute(service, service.insert, params)
+  },
+  
+  /**
+  * @desc : 获取用户剩余分享次数
+  * @author : 刘尧
+  * @date : 2024/7/30 15:40
+  */
+  getShareNumber(){
+    let service = app.globalData['integralShareService']
+    const params = {
+      cpId: app.globalData.company.cpId,
+      tacticId: this.data.integralTacticItem.tacticId,
+      flgValid: true,
+      integralType: Constants.integralType.share,
+      userId: app.globalData.user.userId,
+    }
+    this.excute(service, 'select_share_number', params).then(res => {
+      console.log('getShareNumber', res.data.data);
+      const integralTacticItem = this.data.integralTacticItem
+      integralTacticItem.shareDayNum = integralTacticItem.shareDayNum - res.data.data
+      this.setData({
+        integralTacticItem: integralTacticItem
+      })
+    })
+  },
+  /**
    * 用户点击右上角分享
    */
-  onShareAppMessage(e) {
+  onShareAppMessage: async function(e) {
     const url = this.data.imageUrl + 'share-background.png'
     this.setData({
       cilckViewId: e.target.dataset.detail
     })
     if (e.target.dataset.detail === "toShare") {
-      return {
-        title: '分享好友获取云币',
-        desc: '分享不停歇',
-        path: '/pages/welcome/welcome',
-        imageUrl: url
+      const res = await this.shareIntegral()
+      console.log('shareIntegral', res);
+      if (res.data.code == Constants.SUCESS_CODE) {
+        this.getShareNumber()
+        return {
+          title: '分享好友获取云币',
+          desc: '分享不停歇',
+          path: '/pages/welcome/welcome',
+          imageUrl: url
+        }
       }
     }
     if (e.target.dataset.detail === "toRegister") {
@@ -315,13 +333,37 @@ Page({
     }
     if (e.target.dataset.detail === "toPower") {
       const couponDesc = this.data.couponItem.couponDesc
-      console.log('discount', couponDesc);
-      this.insertNewPowerItem()
+      let item = await this.getPowerItem()
+      item = item.data.data
+      if (item) {
+        const that = this
+        const endDate = item.endDate
+        const nowTime = item.nowTime
+        const time = that.calculateTimeDifference(new Date(nowTime), new Date(endDate))
+        that.setData({
+          time: time,
+          couponSendItem: item
+        })
+      }
+      if(!this.data.couponSendItem){
+        const that = this
+        const res = await this.insertNewPowerItem()
+        if (res.data.code == Constants.SUCESS_CODE) {
+          const data = res.data.data
+          const endDate = data.endDate
+          const nowTime = data.nowTime
+          const time = that.calculateTimeDifference(new Date(nowTime), new Date(endDate))
+          that.setData({
+            time: time,
+            couponSendItem: data
+          })
+        }
+      }
       const that = this
       return {
         title: couponDesc,
         desc: '助力拿福利',
-        path: '/package-basic-data/pages/share-power/share-power?cpId=' + app.globalData.company.cpId + '&couponId=' + that.data.couponItem.couponId,
+        path: '/package-basic-data/pages/share-power/share-power?cpId=' + app.globalData.company.cpId + '&couponId=' + that.data.couponItem.couponId + '&sendId=' + that.data.couponSendItem.sendId + '&discount=' + that.data.couponItem.discount,
         imageUrl: url
       }
     }

+ 3 - 1
package-basic-data/pages/share/share.wxml

@@ -1,3 +1,5 @@
+<!-- 加载图层 -->
+<loading wx:if="{{loading}}"></loading>
 <view class="content">
   <view class="user-card">
     <view class="user-card-info">
@@ -83,7 +85,7 @@
         <view>{{ couponItem.couponDesc }}</view>
       </view>
       <view class="button-view">
-        <van-button customStyle="background-color: #EBC07F;border-radius:50rpx;color:#ffffff;" dataset="toPower" open-type='share' bind:tap="toPowerTap">
+        <van-button customStyle="background-color: #EBC07F;border-radius:50rpx;color:#ffffff;" dataset="toPower" open-type='share'>
           <view style="display: flex;justify-content: center;align-content: center;justify-items: center;align-items: center;font-size: 25rpx;">
             立即助力
             <view style="display: flex;justify-content: center;align-content: center;align-items:center;background: #ECD1A7;border-radius: 50%;width: 15px;height: 15px;margin-left: 10rpx;">

+ 1 - 0
package-basic-data/pages/share/share.wxss

@@ -147,6 +147,7 @@ page {
   color: #FF7B1A;
   font-size: 17px;
   text-decoration-line: underline;
+  padding: 0 8rpx;
 }
 
 .integral-info .rearmk-view {

+ 1 - 1
package-basic-data/pages/sign-share-detail/coupon-detail.js

@@ -137,7 +137,7 @@ Page({
   let service = app.globalData['couponUseService']
   this.excute(service, service.countByCond, params).then(res => {
     this.setData({
-      couponNumber: res.data
+      couponNumber: res.data.data
     })
   });
 },

+ 3 - 1
package-basic-data/pages/sign-share-detail/coupon-detail.wxml

@@ -1,4 +1,6 @@
-<!--package-basic-data/pages/sign-share-detail/integral-detail.wxml-->
+<!-- 加载图层 -->
+<loading wx:if="{{loading}}"></loading>
+
 <view class="content">
   <view class="user-card">
     <view class="user-card-info">

+ 1 - 1
package-basic-data/pages/sign-share-detail/integral-detail.js

@@ -35,7 +35,7 @@ Page({
    * @date : 2024/7/24 16:45
    * @author : 刘尧
    */
-  onChangeTabs(e) { 
+  onChangeTabs(e) {
     let code = e.detail.detail.code
     this.setData({
       saleStatus: code,

+ 4 - 2
package-basic-data/pages/sign-share-detail/integral-detail.wxml

@@ -1,4 +1,6 @@
-<!--package-basic-data/pages/sign-share-detail/integral-detail.wxml-->
+<!-- 加载图层 -->
+<loading wx:if="{{loading}}"></loading>
+
 <view class="content">
   <view class="user-card">
     <view class="user-card-info">
@@ -43,7 +45,7 @@
       <view class="list-item" wx:for="{{itemList}}" wx:for-index="index" wx:for-item="item">
         <view>
           <view class="item-type">{{item.integralTypeName=='使用'?item.remarks:item.integralTypeName}}</view>
-          <view class="item-info" wx:if="{{saleStatus === '' || saleStatus === '收入'}}">{{item.accDate}}/{{item.staffName}}</view>
+          <view class="item-info" wx:if="{{saleStatus === '' || saleStatus === '收入'}}">{{item.accDate}}/{{item.staffName?item.staffName:''}}</view>
           <view class="item-info" wx:if="{{saleStatus === '使用'}}">{{item.accDate}}</view>
         </view>
         <view class="integral-value">

+ 1 - 0
package-basic-data/pages/sign/sign.js

@@ -217,6 +217,7 @@ Page({
     setParams(params) {
         params.userId = app.globalData.user.userId
         params.cpId = app.globalData.company.cpId
+        params.staffName = app.globalData.user.staffName
         return params
     },
 

+ 3 - 2
package-basic-data/pages/sign/sign.wxml

@@ -1,5 +1,6 @@
-<!--package-basic-data/pages/share/share.wxml-->
-<!-- <text>package-basic-data/pages/share/share.wxml</text> -->
+<!-- 加载图层 -->
+<loading wx:if="{{loading}}"></loading>
+
 <view class="content">
 	<view class="user-card">
 		<view class="user-card-info">

+ 1 - 0
package-basic-data/pages/sign/sign.wxss

@@ -107,6 +107,7 @@ page {
   color: #FF7B1A;
   font-size: 16px;
   text-decoration-line:underline;
+  padding: 0 8rpx;
 }
 
 .integral-info .rearmk-view{

+ 19 - 4
pages/login/login.js

@@ -69,6 +69,19 @@ Page({
       })
     }
 
+    // 来源公司 -userid
+    if (options.userIdFrom) {
+      this.setData({
+        userIdFrom: options.userIdFrom,
+      })
+    }
+    // 来源公司 -员工
+    if (options.staffNameFrom) {
+      this.setData({
+        staffNameFrom: options.staffNameFrom,
+      })
+    }
+
   },
 
   /**
@@ -367,10 +380,12 @@ Page({
 
         } else {
           // 从好有分享过来的数据 好友互利共赢  shareType=1 cpid userid startdate enddate
-          let url = _this.data.shareType 
-          ? '/package-basic-data/pages/register/company-register/company-register?shareType' + _this.data.shareType + '&cpIdFrom=' + _this.data.cpIdFrom
-          + '&shareEndDate=' + _this.data.shareEndDate
-          : '/package-basic-data/pages/register/company-register/company-register'
+          let url = _this.data.shareType
+            ? '/package-basic-data/pages/register/company-register/company-register?shareType' + _this.data.shareType + '&cpIdFrom=' + _this.data.cpIdFrom
+            + '&shareEndDate=' + _this.data.shareEndDate
+            + '&userIdFrom=' + this.data.userIdFrom
+            + '&staffNameFrom=' + this.data.staffNameFrom
+            : '/package-basic-data/pages/register/company-register/company-register'
           wx.navigateTo({
             url: url,
             events: {

+ 41 - 22
pages/welcome/welcome.js

@@ -77,7 +77,18 @@ Page({
                 shareEndDate: options.shareEndDate,
             })
         }
-
+        // 来源公司 -userid
+        if (options.userIdFrom) {
+            this.setData({
+                userIdFrom: options.userIdFrom,
+            })
+        }
+        // 来源公司 -员工
+        if (options.staffNameFrom) {
+            this.setData({
+                staffNameFrom: options.staffNameFrom,
+            })
+        }
     },
 
     /**
@@ -179,18 +190,20 @@ Page({
                     //     url: '../../pages/company/company',
                     // })
                     // 调转选择公司
-                    if (this.data.shareType){
+                    if (this.data.shareType) {
                         wx.reLaunch({
-                            url: '../../pages/login/login?shareType=' 
-                            + this.data.shareType + '&cpIdFrom=' + this.data.cpIdFrom
-                            + '&shareEndDate=' + this.data.shareEndDate,
+                            url: '../../pages/login/login?shareType='
+                                + this.data.shareType + '&cpIdFrom=' + this.data.cpIdFrom
+                                + '&shareEndDate=' + this.data.shareEndDate
+                                + '&userIdFrom=' + this.data.userIdFrom
+                                + '&staffNameFrom=' + this.data.staffNameFrom,
                         })
-                    }else{
+                    } else {
                         wx.reLaunch({
                             url: '../../pages/login/login',
                         })
                     }
-                   
+
                 }
                 else
                     if (data.company == undefined
@@ -198,13 +211,15 @@ Page({
                         || res.data.data.company.cpId == ''
                         || res.data.data.company.cpId == undefined) {
                         // 调转选择公司
-                        if (this.data.shareType){
+                        if (this.data.shareType) {
                             wx.reLaunch({
-                                url: '../../pages/login/login?shareType=' 
-                                + this.data.shareType + '&cpIdFrom=' + this.data.cpIdFrom
-                                + '&shareEndDate=' + this.data.shareEndDate,
+                                url: '../../pages/login/login?shareType='
+                                    + this.data.shareType + '&cpIdFrom=' + this.data.cpIdFrom
+                                    + '&shareEndDate=' + this.data.shareEndDate
+                                    + '&userIdFrom=' + this.data.userIdFrom
+                                    + '&staffNameFrom=' + this.data.staffNameFrom,
                             })
-                        }else{
+                        } else {
                             wx.reLaunch({
                                 url: '../../pages/login/login',
                             })
@@ -227,13 +242,15 @@ Page({
                 // 当前用户未注册 // 公司到期
                 // 调转选择公司
                 setTimeout(() => {
-                    if (this.data.shareType){
+                    if (this.data.shareType) {
                         wx.reLaunch({
-                            url: '../../pages/login/login?shareType=' 
-                            + this.data.shareType + '&cpIdFrom=' + this.data.cpIdFrom
-                            + '&shareEndDate=' + this.data.shareEndDate,
+                            url: '../../pages/login/login?shareType='
+                                + this.data.shareType + '&cpIdFrom=' + this.data.cpIdFrom
+                                + '&shareEndDate=' + this.data.shareEndDate
+                                + '&userIdFrom=' + this.data.userIdFrom
+                                + '&staffNameFrom=' + this.data.staffNameFrom,
                         })
-                    }else{
+                    } else {
                         wx.reLaunch({
                             url: '../../pages/login/login',
                         })
@@ -242,13 +259,15 @@ Page({
             } else if (res.data.code == 1000) { // 令牌为空
                 // 调转选择公司
                 setTimeout(() => {
-                    if (this.data.shareType){
+                    if (this.data.shareType) {
                         wx.reLaunch({
-                            url: '../../pages/login/login?shareType=' 
-                            + this.data.shareType + '&cpIdFrom=' + this.data.cpIdFrom
-                            + '&shareEndDate=' + this.data.shareEndDate,
+                            url: '../../pages/login/login?shareType='
+                                + this.data.shareType + '&cpIdFrom=' + this.data.cpIdFrom
+                                + '&shareEndDate=' + this.data.shareEndDate
+                                + '&userIdFrom=' + this.data.userIdFrom
+                                + '&staffNameFrom=' + this.data.staffNameFrom,
                         })
-                    }else{
+                    } else {
                         wx.reLaunch({
                             url: '../../pages/login/login',
                         })

+ 1 - 1
utils/Constants.js

@@ -165,7 +165,7 @@ module.exports = {
     proTitle:'六大模块功能',
     title: '注册须知:',
     cpName: '用于登录系统时显示公司信息。',
-    contact: '负责人和联系电话:用于开通系统电话确认核实信息。',
+    contact: '联系电话:用于登录系统。',
     cpSize: '公司规模及门店规模:用于开通系统配置基础档案。'
   },