liuyao пре 1 година
родитељ
комит
c35fdfc20c

+ 51 - 22
package-basic-data/pages/share/share.js

@@ -164,6 +164,7 @@ Page({
           this.setData({
             integralTacticItem: res.data.data.list[0],
           })
+          this.getShareNumber()
         }
       }
     });
@@ -229,22 +230,6 @@ Page({
   },
 
   /**
-  * @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
@@ -278,6 +263,46 @@ 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: async function(e) {
@@ -286,12 +311,16 @@ Page({
       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") {

+ 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
     })
   });
 },