appPopup.vue 6.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273
  1. <template>
  2. <!-- app回答正确弹窗 -->
  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" @click="handleItem(item,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. </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="goApp">{{goodsInfo.availableCoins}}芳华币已到账,去兑换</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. goApp() {
  52. this.$refs.appPopup.close()
  53. this.postMessage({
  54. isFullscreen: false,
  55. login: 1,
  56. productId: '',
  57. pagesUrl:'/pages/user/integral/integralGoodsList'
  58. })
  59. },
  60. //app礼品列表
  61. getInfo() {
  62. uni.showLoading({
  63. title: '加载中'
  64. })
  65. getCourseIntegralGoods().then(res=>{
  66. uni.hideLoading()
  67. if(res.code == 200) {
  68. this.goodsInfo = res.data
  69. this.products = res.data && res.data.products? res.data.products:[]
  70. } else {
  71. uni.showToast({
  72. title: res.msg,
  73. icon: 'none'
  74. })
  75. }
  76. }).catch(()=>{
  77. uni.hideLoading()
  78. })
  79. },
  80. postMessage(data) {
  81. this.uniReady(() => {
  82. uni.webView.postMessage({
  83. data: data
  84. });
  85. })
  86. },
  87. uniReady(callback) {
  88. if (uni.webView) {
  89. callback()
  90. } else {
  91. document.addEventListener('UniAppJSBridgeReady', callback, { once: true })
  92. }
  93. },
  94. handleItem(item,index) {
  95. this.postMessage({
  96. isFullscreen: false,
  97. login: 1,
  98. productId: item.productId,
  99. pagesUrl:''
  100. })
  101. }
  102. }
  103. }
  104. </script>
  105. <style scoped lang="scss">
  106. @mixin u-flex($flexD, $alignI, $justifyC) {
  107. display: flex;
  108. flex-direction: $flexD;
  109. align-items: $alignI;
  110. justify-content: $justifyC;
  111. }
  112. .textOne {
  113. overflow: hidden;
  114. white-space: nowrap;
  115. text-overflow: ellipsis;
  116. }
  117. .num {
  118. margin-left: 12rpx;
  119. font-family: DINPro, DINPro;
  120. font-size: 40rpx;
  121. }
  122. .appPopup-mask {
  123. margin-top: -88rpx;
  124. width: 670rpx;
  125. @include u-flex(column, center, center);
  126. .tipimg {
  127. height: 206rpx;
  128. width: 206rpx;
  129. }
  130. .close_icon {
  131. height: 48rpx;
  132. width: 48rpx;
  133. position: absolute;
  134. top: 34rpx;
  135. right: 20rpx;
  136. }
  137. .appPopup-box {
  138. width: 670rpx;
  139. padding-bottom: 32rpx;
  140. background: linear-gradient( 180deg, #FFEBBD 0%, #FFFFFF 9%, #FFFFFF 100%);
  141. border-radius: 32rpx 32rpx 32rpx 32rpx;
  142. overflow: hidden;
  143. margin-top: -103rpx;
  144. padding-top: 103rpx;
  145. box-sizing: border-box;
  146. font-family: PingFang SC;
  147. font-weight: 400;
  148. font-size: 28rpx;
  149. color: #757575;
  150. text-align: center;
  151. }
  152. .appPopup-title {
  153. margin-bottom: 10rpx;
  154. font-family: PingFang SC;
  155. font-weight: 600;
  156. font-size: 40rpx;
  157. color: #222222;
  158. }
  159. }
  160. .goodslist {
  161. margin-top: 58rpx;
  162. padding: 24rpx 10rpx;
  163. @include u-flex(row, center, space-evenly);
  164. }
  165. .bg {
  166. width: 100%;
  167. height: 100%;
  168. position: absolute;
  169. bottom: 0;
  170. left: 0;
  171. z-index: -1;
  172. }
  173. .goodsitem {
  174. flex: 1;
  175. max-width: 200rpx;
  176. min-height: 124rpx;
  177. border-radius: 10rpx;
  178. @include u-flex(column, center, flex-start);
  179. font-family: PingFang SC;
  180. font-weight: 400;
  181. font-size: 22rpx;
  182. color: #999999;
  183. position: relative;
  184. z-index: 2;
  185. .img {
  186. width: 153rpx;
  187. height: 126rpx;
  188. margin-top: -44rpx;
  189. border-radius: 10rpx;
  190. }
  191. &-name {
  192. width: 100%;
  193. padding: 8rpx 14rpx;
  194. text-align: center;
  195. font-family: PingFang SC;
  196. font-weight: 500;
  197. font-size: 24rpx;
  198. color: #222222;
  199. box-sizing: border-box;
  200. word-break: break-all;
  201. }
  202. &-integral {
  203. min-width: 80%;
  204. padding-bottom: 16rpx;
  205. box-sizing: border-box;
  206. font-family: PingFang SC;
  207. font-weight: 400;
  208. font-size: 22rpx;
  209. color: #FF5C03;
  210. border-bottom: 2px #999999 dotted;
  211. &-num {
  212. font-family: DINPro, DINPro;
  213. font-weight: 500;
  214. font-size: 36rpx;
  215. }
  216. }
  217. &-price {
  218. padding: 10rpx 0;
  219. }
  220. }
  221. .appPopup-btn {
  222. width: 560rpx;
  223. height: 84rpx;
  224. margin: 0 auto;
  225. background: #FF5C03;
  226. border-radius: 42rpx 42rpx 42rpx 42rpx;
  227. @include u-flex(row, center, center);
  228. font-family: PingFang SC;
  229. font-weight: 500;
  230. font-size: 32rpx;
  231. color: #FFFFFF;
  232. }
  233. .changebtn {
  234. width: 152rpx;
  235. height: 64rpx;
  236. margin: 0 auto;
  237. border-radius: 32rpx 32rpx 32rpx 32rpx;
  238. border: 1rpx solid #FF5C03;
  239. @include u-flex(row, center, center);
  240. font-family: PingFang SC;
  241. font-weight: 400;
  242. font-size: 24rpx;
  243. color: #FF5C03;
  244. }
  245. .progress {
  246. padding: 0 90rpx;
  247. margin-top: 40rpx;
  248. font-family: PingFang SC;
  249. font-weight: 500;
  250. font-size: 32rpx;
  251. color: #222222;
  252. }
  253. ::v-deep {
  254. .uni-progress-bar, .uni-progress-inner-bar {
  255. border-radius: 6px;
  256. }
  257. }
  258. .my-integral {
  259. margin: 32rpx 0;
  260. font-family: PingFang SC;
  261. font-weight: 400;
  262. font-size: 28rpx;
  263. color: #222222;
  264. text {
  265. color: #FF5C03;
  266. }
  267. }
  268. .appPopup-tips {
  269. margin-top: 32rpx;
  270. }
  271. </style>