Parcourir la source

Merge branch 'edit-bug-22.4.14' into test

zhangwei il y a 3 ans
Parent
commit
1f2c931f0d
1 fichiers modifiés avec 40 ajouts et 26 suppressions
  1. 40 26
      src/view/red-packet.vue

+ 40 - 26
src/view/red-packet.vue

@@ -156,6 +156,7 @@
     <div v-else-if="data.status == 'close'" class="close">
       <div class="header" :style="{ 'backgroundImage': `url(${require('../assets/svg/back-head-top.svg')})` }">
         <div class="close-title">{{ data.close_title }}</div>
+        <div class="close-title" v-if="data.close_text">{{ data.close_text }}</div>
       </div>
       <div class="luck-list-title">
         <div>{{ data.detail.receiveCount || 0 }}/{{ data.detail.totalCount || 0 }} People Got</div>
@@ -392,42 +393,55 @@ function init() {
         //   data.status = 'error'
         //   return
         // }
-
         data.detail = JSON.parse(res.data.postBizData)
         console.log(data.detail)
 
-        // 未开始
+        // 红包未开始
         if (data.detail.status == 0) {
           data.status = 'not-open'
-
-          // 进行中
-        } else if (data.detail.status == 1) {
-
-          if (data.detail.myReceived) {
-            data.status = 'opened'
-            data.money = data.detail.myReceived.amountValue
-            if (data.detail.myReceived.taskFinishStatus == 1) {
-              data.status = 'success'
-            }
-            if (data.detail.myReceived.taskFinishStatus == 2) {
-              data.status = 'close'
-              data.close_title = res.msg
-            }
+          return
+        }
+        // 我领取了  
+        if (data.detail.myReceived) {
+          data.status = 'opened'
+          data.money = data.detail.myReceived.amountValue
+          
+          // 我的红包已经过期了
+          if (data.detail.myReceived.taskFinishStatus == 2) {
+            data.status = 'close'
+            data.close_title = res.msg
+          }
+          // 我领取成功了
+          if (data.detail.myReceived.taskFinishStatus == 1) {
+            data.status = 'success'
+          }
+          // 我领取未完成
+          if (data.detail.myReceived.taskFinishStatus == 0) {
             initTaskDetail()
             getValidity()
-          } else if (data.detail.totalCount == data.detail.receiveCount) {
-            data.status = 'close'
-            data.close_title = 'Better luck next time!'
-          } else {
+            data.detail.taskCondition = JSON.parse(data.detail.taskCondition)
+            data.detail.amountValue = showLastTwoPlace(data.detail.amountValue)
+            data.detail.receiveAmountValue = showLastTwoPlace(data.detail.receiveAmountValue)
+          }
+
+        // 我没有领取
+        } else {
+          // 红包进行中
+          if (data.detail.status == 1) {
             data.status = 'not-open'
+
+          // 红包已经结束了
+          }else if (data.detail.status == 2) {
+            data.status = 'close'
+            data.close_title = `This Giveways`
+            data.close_text = `expired on ${moment(data.detail.endTimestamp).format('MM-DD')}`
           }
-          data.detail.taskCondition = JSON.parse(data.detail.taskCondition)
-          data.detail.amountValue = showLastTwoPlace(data.detail.amountValue)
-          data.detail.receiveAmountValue = showLastTwoPlace(data.detail.receiveAmountValue)
 
-          // 已结束
-        } else if (data.detail.status == 2) {
-          data.status = 'close'
+          // 红包已经被领完了
+          if (data.detail.totalCount == data.detail.receiveCount) {
+            data.status = 'close'
+            data.close_title = 'Better luck next time!'
+          }
         }
         break
     }