index.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. <template>
  2. <view class="warpper">
  3. <image class="top-bg" src="../static/receive-gift-bag.png" mode=""></image>
  4. <image class="top-bow" src="../static/bow.png" mode=""></image>
  5. <view class="aleart">
  6. <view class="from">{{ nickname }} 送给您的一份礼物</view>
  7. <view class="message">{{ gift_mark }}</view>
  8. <view class="aleart-body">
  9. <image class="goods-img" :src="image" mode=""></image>
  10. </view>
  11. <view class="title line1">
  12. {{ $t(store_name) }}
  13. </view>
  14. </view>
  15. <view v-if="(giftStatus == 1 || giftStatus == 2) && refund_status == 0" class="btn" @click="goGetGift()">
  16. {{ giftStatusText }}
  17. </view>
  18. <view v-if="giftStatus == 3 && refund_status == 0" class="btn-n">
  19. {{ $t('礼物已被领取') }}
  20. </view>
  21. <view v-if="refund_status != 0" class="btn-n">
  22. {{ $t('礼物已失效') }}
  23. </view>
  24. </view>
  25. </template>
  26. <script>
  27. import { getGiftOrderDetail } from '@/api/order.js';
  28. import { HTTP_REQUEST_URL } from '@/config/app';
  29. import { toLogin } from '@/libs/login.js';
  30. import { mapGetters } from 'vuex';
  31. let app = getApp();
  32. export default {
  33. computed: mapGetters(['isLogin']),
  34. data() {
  35. return {
  36. order_id: '',
  37. giftStatus: 0,
  38. refund_status: 0,
  39. gift_mark: '',
  40. image: '',
  41. store_name: '',
  42. nickname: '',
  43. giftStatusText: '',
  44. o_id: 0
  45. };
  46. },
  47. props: {},
  48. watch: {
  49. // aleartStatus(status) {
  50. // if (!status) {
  51. // this.aleartData = {};
  52. // }
  53. // }
  54. },
  55. onLoad(options) {
  56. if (this.isLogin) {
  57. this.order_id = options.id;
  58. // #ifdef MP
  59. if (options.scene) {
  60. let value = this.$util.getUrlParams(decodeURIComponent(options.scene));
  61. if (value.order_id) options.id = value.id;
  62. //记录推广人uid
  63. if (value.pid) app.globalData.spid = value.pid;
  64. }
  65. // #endif
  66. this.uid = this.$store.state.app.uid;
  67. this.getOrderInfo();
  68. } else {
  69. toLogin();
  70. }
  71. },
  72. methods: {
  73. goGetGift() {
  74. if (this.giftStatus == 2) {
  75. uni.reLaunch({
  76. url: `/pages/goods/order_details/index?is_gift=2&order_id=${this.o_id}&is_gift=2`
  77. });
  78. } else {
  79. uni.reLaunch({
  80. url: `/pages/goods/order_confirm/index?order_id=${this.order_id}&is_gift=2`
  81. });
  82. }
  83. },
  84. getOrderInfo() {
  85. getGiftOrderDetail(this.order_id).then((res) => {
  86. this.gift_uid = res.data.gift_uid;
  87. this.gift_mark = res.data.gift_mark;
  88. this.nickname = res.data.nickname;
  89. this.refund_status = res.data.refund_status;
  90. this.image = res.data.cartInfo[0].productInfo.image;
  91. this.store_name = res.data.cartInfo[0].productInfo.store_name;
  92. this.o_id = res.data.order_id
  93. if (this.gift_uid === 0) {
  94. this.giftStatus = 1;
  95. this.giftStatusText = this.$t('收下礼物');
  96. } else if (this.gift_uid === this.uid) {
  97. this.giftStatus = 2;
  98. this.giftStatusText = this.$t('查看礼物');
  99. } else if (this.gift_uid !== this.uid) {
  100. this.giftStatus = 3;
  101. }
  102. });
  103. }
  104. }
  105. };
  106. </script>
  107. <style lang="scss" scoped>
  108. .warpper {
  109. display: flex;
  110. flex-direction: column;
  111. align-items: center;
  112. .top-bg {
  113. width: 100%;
  114. height: 206rpx;
  115. }
  116. .top-bow {
  117. width: 342rpx;
  118. height: 78rpx;
  119. margin-top: -120rpx;
  120. z-index: 9;
  121. }
  122. }
  123. .aleart {
  124. width: 670rpx;
  125. z-index: 7;
  126. margin-top: -20rpx;
  127. background-color: #fff;
  128. padding: 30rpx;
  129. border-radius: 12rpx;
  130. background-size: 100% 100%;
  131. display: flex;
  132. flex-direction: column;
  133. align-items: center;
  134. justify-content: center;
  135. .from {
  136. font-size: 28rpx;
  137. font-weight: 500;
  138. color: #333333;
  139. margin-bottom: 16rpx;
  140. }
  141. .message {
  142. font-weight: 400;
  143. font-size: 26rpx;
  144. color: #999999;
  145. margin-bottom: 42rpx;
  146. }
  147. .aleart-body {
  148. display: flex;
  149. align-items: center;
  150. justify-content: center;
  151. width: 396rpx;
  152. height: 419rpx;
  153. background-image: url('/pages/goods/static/gift-border.png');
  154. background-size: 100% 100%;
  155. margin-bottom: 40rpx;
  156. .goods-img {
  157. width: 360rpx;
  158. height: 360rpx;
  159. margin-top: 24rpx;
  160. }
  161. }
  162. .title {
  163. width: 396rpx;
  164. font-weight: 400;
  165. font-size: 28rpx;
  166. color: #333333;
  167. margin-bottom: 34rpx;
  168. text-align: center;
  169. }
  170. }
  171. .btn,
  172. .btn-clear,
  173. .btn-n {
  174. width: 670rpx;
  175. height: 84rpx;
  176. line-height: 84rpx;
  177. border-radius: 20px;
  178. text-align: center;
  179. margin-top: 56rpx;
  180. }
  181. .btn {
  182. color: #fff;
  183. background: linear-gradient(90deg, #ff7931 0%, #e93323 100%);
  184. }
  185. .btn-clear {
  186. color: #e93323;
  187. border: 1px solid #e93323;
  188. }
  189. .btn-n {
  190. color: #fff;
  191. background: #cccccc;
  192. }
  193. </style>