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