integralGift.vue 6.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281
  1. <template>
  2. <!-- 回答正确弹窗 跳转 小程序-->
  3. <uni-popup ref="appPopup" type="center" :is-mask-click="false">
  4. <view class="appPopup-mask">
  5. <image class="tipimg" src="@/static/images/course_answer_img.png" mode="aspectFill"></image>
  6. <image class="close_icon" src="@/static/images/tc_close_icon.png" mode="aspectFill" @click="closePop"></image>
  7. <view class="appPopup-box">
  8. <view class="appPopup-title">恭喜你,<text style="color: #FF5C03;">回答正确</text></view>
  9. <view>百种好礼等你兑换</view>
  10. <view class="goodslist">
  11. <view class="goodsitem" v-for="(item,index) in products" :key="index">
  12. <image class="bg" src="/static/Subtract_bg100@2x.png" mode="widthFix"></image>
  13. <image class="img" :src="item.imageUrl" mode="aspectFill"></image>
  14. <view class="goodsitem-name textOne">{{item.productName}}</view>
  15. <view class="goodsitem-integral">
  16. <text class="goodsitem-integral-num">{{item.requiredPoints}}</text>
  17. <text>积分</text>
  18. </view>
  19. <view class="goodsitem-price">原价{{item.otPrice&&item.otPrice.toFixed(2)}}元</view>
  20. <wx-open-launch-weapp appid="wx20d588bebb30130f" :path="'pages_user/integralGoodsDetails?goodsId='+item.productId">
  21. <component :is="'script'" type="text/wxtag-template">
  22. <div class="goodsitem-mask"></div>
  23. </component>
  24. </wx-open-launch-weapp>
  25. </view>
  26. </view>
  27. <view class="changebtn" @click="getInfo">换一批</view>
  28. <view class="progress">
  29. <text>奖品兑换进度</text><text class="num">{{goodsInfo.exchangeProgress || 0}}%</text>
  30. <progress style="margin-top: 30rpx;" active-color="#FAA97F" backgroundColor="#F5F7FA" border-radius="12" :percent="goodsInfo.exchangeProgress" stroke-width="12"></progress>
  31. </view>
  32. <view class="my-integral">我的积分:<text>{{goodsInfo.currentPoints || 0}}</text> </view>
  33. <!-- <view class="launch-button" @click="closePop">{{goodsInfo.availableCoins}}积分已到账,去兑换</view> -->
  34. <wx-open-launch-weapp appid="wx20d588bebb30130f" path="pages_user/integralGoodsList" @launch="weappLaunch" @error="weappError">
  35. <component :is="'script'" type="text/wxtag-template">
  36. <div class="launch-button">{{goodsInfo.availableCoins}}积分已到账,去兑换</div>
  37. </component>
  38. </wx-open-launch-weapp>
  39. <!-- <view class="appPopup-tips">放弃积分,领取红包></view> -->
  40. </view>
  41. </view>
  42. </uni-popup>
  43. </template>
  44. <script>
  45. import { getCourseIntegralGoods } from "@/api/course.js"
  46. export default {
  47. data() {
  48. return {
  49. goodsInfo: {},
  50. products: []
  51. }
  52. },
  53. methods: {
  54. openPop() {
  55. this.$refs.appPopup.open("center")
  56. this.getInfo()
  57. },
  58. closePop() {
  59. this.$refs.appPopup.close()
  60. },
  61. //app礼品列表
  62. getInfo() {
  63. uni.showLoading({
  64. title: '加载中'
  65. })
  66. getCourseIntegralGoods().then(res=>{
  67. uni.hideLoading()
  68. if(res.code == 200) {
  69. this.goodsInfo = res.data
  70. this.products = res.data && res.data.products? res.data.products:[]
  71. } else {
  72. uni.showToast({
  73. title: res.msg,
  74. icon: 'none'
  75. })
  76. }
  77. }).catch(()=>{
  78. uni.hideLoading()
  79. })
  80. },
  81. handleItem(item,index) {
  82. uni.navigateToMiniProgram({
  83. appId: 'wx20d588bebb30130f',
  84. path: 'pages_user/integralGoodsDetails',
  85. extraData: {
  86. 'goodsId': item.productId
  87. },
  88. success(res) {
  89. // 打开成功
  90. }
  91. })
  92. },
  93. weappLaunch() {
  94. this.$refs.appPopup.close()
  95. },
  96. weappError(e) {
  97. console.log('fail', e.detail);
  98. }
  99. }
  100. }
  101. </script>
  102. <style>
  103. .launch-button {
  104. width: 560rpx;
  105. height: 84rpx;
  106. margin: 0 auto;
  107. background: #FF5C03;
  108. border-radius: 42rpx 42rpx 42rpx 42rpx;
  109. display: flex;
  110. flex-direction: row;
  111. align-items: center;
  112. justify-content: center;
  113. font-family: PingFang SC;
  114. font-weight: 500;
  115. font-size: 32rpx;
  116. color: #FFFFFF;
  117. }
  118. .goodsitem-mask {
  119. position: absolute;
  120. left: 0;
  121. top: 0;
  122. width: 100%;
  123. height: 100%;
  124. }
  125. </style>
  126. <style scoped lang="scss">
  127. @mixin u-flex($flexD, $alignI, $justifyC) {
  128. display: flex;
  129. flex-direction: $flexD;
  130. align-items: $alignI;
  131. justify-content: $justifyC;
  132. }
  133. .textOne {
  134. overflow: hidden;
  135. white-space: nowrap;
  136. text-overflow: ellipsis;
  137. }
  138. .num {
  139. margin-left: 12rpx;
  140. font-family: DINPro, DINPro;
  141. font-size: 40rpx;
  142. }
  143. .appPopup-mask {
  144. margin-top: -88rpx;
  145. width: 670rpx;
  146. @include u-flex(column, center, center);
  147. .tipimg {
  148. height: 206rpx;
  149. width: 206rpx;
  150. }
  151. .close_icon {
  152. height: 48rpx;
  153. width: 48rpx;
  154. position: absolute;
  155. top: 34rpx;
  156. right: 20rpx;
  157. }
  158. .appPopup-box {
  159. width: 670rpx;
  160. padding-bottom: 32rpx;
  161. background: linear-gradient( 180deg, #FFEBBD 0%, #FFFFFF 9%, #FFFFFF 100%);
  162. border-radius: 32rpx 32rpx 32rpx 32rpx;
  163. overflow: hidden;
  164. margin-top: -103rpx;
  165. padding-top: 103rpx;
  166. box-sizing: border-box;
  167. font-family: PingFang SC;
  168. font-weight: 400;
  169. font-size: 28rpx;
  170. color: #757575;
  171. text-align: center;
  172. }
  173. .appPopup-title {
  174. margin-bottom: 10rpx;
  175. font-family: PingFang SC;
  176. font-weight: 600;
  177. font-size: 40rpx;
  178. color: #222222;
  179. }
  180. }
  181. .goodslist {
  182. margin-top: 58rpx;
  183. padding: 24rpx 10rpx;
  184. @include u-flex(row, center, space-evenly);
  185. }
  186. .bg {
  187. width: 100%;
  188. height: 100%;
  189. position: absolute;
  190. bottom: 0;
  191. left: 0;
  192. z-index: -1;
  193. }
  194. .goodsitem {
  195. flex: 1;
  196. max-width: 200rpx;
  197. min-height: 124rpx;
  198. border-radius: 10rpx;
  199. @include u-flex(column, center, flex-start);
  200. font-family: PingFang SC;
  201. font-weight: 400;
  202. font-size: 22rpx;
  203. color: #999999;
  204. position: relative;
  205. z-index: 2;
  206. .img {
  207. width: 153rpx;
  208. height: 126rpx;
  209. margin-top: -44rpx;
  210. border-radius: 10rpx;
  211. }
  212. &-name {
  213. width: 100%;
  214. padding: 8rpx 14rpx;
  215. text-align: center;
  216. font-family: PingFang SC;
  217. font-weight: 500;
  218. font-size: 24rpx;
  219. color: #222222;
  220. box-sizing: border-box;
  221. word-break: break-all;
  222. }
  223. &-integral {
  224. min-width: 80%;
  225. padding-bottom: 16rpx;
  226. box-sizing: border-box;
  227. font-family: PingFang SC;
  228. font-weight: 400;
  229. font-size: 22rpx;
  230. color: #FF5C03;
  231. border-bottom: 2px #999999 dotted;
  232. &-num {
  233. font-family: DINPro, DINPro;
  234. font-weight: 500;
  235. font-size: 36rpx;
  236. }
  237. }
  238. &-price {
  239. padding: 10rpx 0;
  240. }
  241. }
  242. .changebtn {
  243. width: 152rpx;
  244. height: 64rpx;
  245. margin: 0 auto;
  246. border-radius: 32rpx 32rpx 32rpx 32rpx;
  247. border: 1rpx solid #FF5C03;
  248. @include u-flex(row, center, center);
  249. font-family: PingFang SC;
  250. font-weight: 400;
  251. font-size: 24rpx;
  252. color: #FF5C03;
  253. }
  254. .progress {
  255. padding: 0 90rpx;
  256. margin-top: 40rpx;
  257. font-family: PingFang SC;
  258. font-weight: 500;
  259. font-size: 32rpx;
  260. color: #222222;
  261. }
  262. ::v-deep {
  263. .uni-progress-bar, .uni-progress-inner-bar {
  264. border-radius: 6px;
  265. }
  266. }
  267. .my-integral {
  268. margin: 32rpx 0;
  269. font-family: PingFang SC;
  270. font-weight: 400;
  271. font-size: 28rpx;
  272. color: #222222;
  273. text {
  274. color: #FF5C03;
  275. }
  276. }
  277. .appPopup-tips {
  278. margin-top: 32rpx;
  279. }
  280. </style>