Răsfoiți Sursa

fix: 活动分享细节优化

Cooklalala 1 an în urmă
părinte
comite
5b7adfaad5

+ 3 - 2
common/js/api.js

@@ -32,8 +32,9 @@ export default {
     //活动详情
     activityDetail(data) {
         return request({
-            url: '/business/wechat/activity/'+ data.id,
-            method: 'GET'
+            url: '/business/wechat/activity/getInfo',
+            method: 'GET',
+            data
         })
     },
 

+ 1 - 1
myPages/myActivityDetail/myActivityDetail.vue

@@ -177,7 +177,7 @@ export default {
     console.log(this.activity)
     let shareobj = {
       title: this.activity.shareContext, //分享的标题
-      path: '/orderPages/activityDetail/activityDetail?activityId=' + this.activity.activityId + '&inviteUserId=' + this.userInfo.id, //好友点击分享之后跳转的页面
+      path: '/orderPages/activityDetail/activityDetail?activityId=' + this.activity.activityId + '&inviteUserId=' + this.userInfo.id + '&inviteOrderId=' + this.activity.orderId, //好友点击分享之后跳转的页面
       //imageUrl: "https://****.com/banner.jpg", //分享的图片  支持PNG及JPG。显示图片长宽比是 5:4。
       imageUrl: this.facePhotoUrl, //内容图片
     }

+ 27 - 6
orderPages/activityDetail/activityDetail.vue

@@ -9,7 +9,8 @@
           </view>
           <view class="flex-row price">
             <text v-if="isShare">¥{{ activity.sharePrice }}</text>
-            <text :style="{textDecorationLine:(isShare ?'line-through' :'none'),color:(isShare ? '#878787':''),  fontSize:(isShare ? '24rpx':'') }">
+            <text
+                :style="{textDecorationLine:(isShare ?'line-through' :'none'),color:(isShare ? '#878787':''),  fontSize:(isShare ? '24rpx':'') }">
               ¥{{ activity.salePrice }}
             </text>
 
@@ -199,14 +200,16 @@ export default {
       show: false,
       serviceObjectId: null,
       isShare: false,
+      inviteUserId: null,
+      inviteOrderId: null,
     }
   },
 
   computed: {
     totalAmount() {
-      if(this.isShare){
+      if (this.isShare) {
         return this.activity.sharePrice
-      }else {
+      } else {
         return this.activity.salePrice
       }
     }
@@ -221,6 +224,7 @@ export default {
       console.log(e)
       this.id = e.activityId
       this.inviteUserId = e.inviteUserId
+      this.inviteOrderId = e.inviteOrderId
       this.isShare = true
     }
     // 扫技师端携带的参数,已存在缓存中
@@ -356,13 +360,30 @@ export default {
 
     activityDetail() {
       console.log(this.id, '活动ID')
-      this.$api.activityDetail({
+      const data = {
         id: this.id,
-      }).then(res => {
+      }
+      if (this.inviteUserId) {
+        data.userId = this.inviteUserId
+      }
+      if (this.inviteOrderId) {
+        data.inviteOrderId = this.inviteOrderId
+      }
+      this.$api.activityDetail(data).then(res => {
         console.log(res)
         this.activity = res.data.data
         this.$set(this.activity)
-
+        if (this.isShare) {
+          console.log(this.activity)
+          if (this.activity.shareMax !== 0 && this.activity.shareMax < this.activity.shareCount) {
+            this.isShare = false
+            uni.showToast({
+              duration: 3000,
+              title: '已经超出最大分享次数',
+              icon: 'none'
+            });
+          }
+        }
       })
     },