votePopup.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  1. <template>
  2. <view>
  3. <u-popup v-model="show" mode="bottom" width="100%" height="750" border-radius="15" :closeable="true">
  4. <view class="padding-30">
  5. <view class="padding-top-20 text-bold text-xl">投票助力</view>
  6. <view
  7. style="color: #888888;font-size: 22rpx;font-family: PingFang-SC-Medium;line-height: 36rpx;padding: 20rpx 0;">
  8. {{gitfs[selected].content}}
  9. </view>
  10. <scroll-view style="white-space: nowrap;" :scroll-x="true">
  11. <view v-for="(item,index) in gitfs" :key="index" class="gift-item">
  12. <view @click.stop="selected = index;count = index" class="padding-20"
  13. :class="{'icon-box': true,'selected': index == selected}">
  14. <image mode="aspectFit" class="gift-img" :src="item.imgUrl"></image>
  15. <view class="gift-name">{{item.name}}</view>
  16. </view>
  17. <view style="color: #999999;font-size: 20rpx;text-align: center;padding-top: 10rpx;">
  18. {{item.activeVote==0? '剩余免费次数':'剩余次数'}} {{item.remainCount}}</view>
  19. </view>
  20. </scroll-view>
  21. <view class="handle-bar">
  22. <view v-if="pointNum>=0" class="text-center padding-bottom-20" style="color: #0A9FEF;">您目前的移动积分:
  23. {{pointNum}}</view>
  24. <view v-else class="text-center padding-bottom-20" style="color: #0A9FEF;">您目前的移动积分 <u-loading
  25. style="margin: 10rpx;" mode="circle"></u-loading>
  26. </view>
  27. <view class="button-bar">
  28. <view class="button-r">
  29. <u-count-to v-if="show" color="#E72226" start-val="0" :end-val="gitfs[selected].point"
  30. :duration="500"></u-count-to>
  31. <span class="info">移动积分</span>
  32. </view>
  33. <view class="button-f" @click="toVote">点击投票</view>
  34. </view>
  35. </view>
  36. </view>
  37. </u-popup>
  38. <point-auth ref="pointAuth" ></point-auth>
  39. <loading ref="loading" type="3" />
  40. </view>
  41. </template>
  42. <script>
  43. import pointAuth from '../../components/alert/pointAuth.vue'
  44. export default {
  45. name: "votePopup",
  46. components: {
  47. pointAuth
  48. },
  49. data() {
  50. return {
  51. productId:0,
  52. show: false,
  53. selected: 0,
  54. count: 0,
  55. pointNum: 0,
  56. gitfs: [],
  57. };
  58. },
  59. methods: {
  60. async pointAuthClose(){
  61. this.$refs.loading.hide()
  62. await this.fetchGiftsData()
  63. this.show=true
  64. console.log(this.gitfs[this.selected].point);
  65. },
  66. async showVote(mobile,productId) {
  67. this.productId=productId
  68. this.$refs.loading.showLoading("礼物获取中")
  69. let params = {
  70. mobile
  71. }
  72. let isCmcc=await this.checkIsCmcc()
  73. if (isCmcc) {
  74. const queryRes = (await this.$api.CMCC.queryCmccPoint(this.$u.queryParams(params)));
  75. if (queryRes.data.data.resultCode == '0001') {
  76. this.$refs.pointAuth.showAuth(queryRes.data.data.data);
  77. this.$refs.loading.hide()
  78. return;
  79. }
  80. const pointDetail = JSON.parse(queryRes.data.data.data);
  81. this.pointNum = pointDetail['points'];
  82. }
  83. await this.fetchGiftsData()
  84. this.$refs.loading.hide()
  85. this.show = true;
  86. },
  87. async fetchGiftsData(){
  88. let data = {
  89. productId:this.productId,
  90. userId: this.vuex_userId,
  91. current: 1,
  92. size: 99
  93. }
  94. const res = await this.$api.activity.getGiftList(data);
  95. this.gitfs = res.data.data.records;
  96. console.log(this.gitfs,"/**//**/");
  97. },
  98. hideVote() {
  99. this.show = false;
  100. },
  101. toVote() {
  102. let item=this.gitfs[this.selected]
  103. if (this.pointNum==0 && item.point !=0) {
  104. this.$u.toast('您无可用移动积分')
  105. return
  106. }
  107. // if (item.remainCount == 0) {
  108. // this.$u.toast('今天已无该道具兑换次数')
  109. // return
  110. // }
  111. this.$emit('toVote', this.gitfs[this.selected])
  112. }
  113. }
  114. }
  115. </script>
  116. <style lang="scss" scoped>
  117. .gift-item {
  118. width: 150rpx;
  119. height: 250rpx;
  120. margin: 12rpx;
  121. // box-shadow: 0rpx 2rpx 2rpx 2rpx #DDDDDD;
  122. // background: #007AFF;
  123. display: inline-block;
  124. .icon-box {
  125. width: 150rpx;
  126. height: 200rpx;
  127. border: 1rpx solid #DDDDDD;
  128. box-shadow: 3rpx 3rpx 4rpx rgba(26, 26, 26, 0.2);
  129. border-radius: 10rpx;
  130. }
  131. .gift-img {
  132. width: 100rpx;
  133. height: 100rpx;
  134. border: 1rpx dashed #DDDDDD;
  135. padding: 10rpx;
  136. transition: border 0.5s;
  137. border: 0 solid transparent;
  138. }
  139. .selected {
  140. border: 2rpx solid #E72226;
  141. }
  142. .selected::before {
  143. content: "";
  144. position: absolute;
  145. margin-top: 147rpx;
  146. margin-left: 97rpx;
  147. border-radius: 5rpx 0 0 0;
  148. height: 30rpx;
  149. width: 30rpx;
  150. background: url(../../static/icon/selected.png) no-repeat center/22rpx red;
  151. }
  152. .gift-name {
  153. font-size: 22rpx;
  154. color: #353535;
  155. padding-top: 10rpx;
  156. }
  157. }
  158. .handle-bar {
  159. position: absolute;
  160. width: 100%;
  161. bottom: 0;
  162. left: 0;
  163. padding-bottom: 80rpx;
  164. .button-bar {
  165. width: 80%;
  166. height: 80rpx;
  167. border: 2rpx solid #E72226;
  168. margin: auto;
  169. border-radius: 100rpx;
  170. display: flex;
  171. .button-f {
  172. flex-basis: 50%;
  173. color: white;
  174. display: flex;
  175. font-size: 30rpx;
  176. justify-content: center;
  177. align-items: center;
  178. background: #E72226;
  179. border-radius: 0 100rpx 100rpx 0;
  180. }
  181. .button-r {
  182. color: #E82E3E;
  183. font-weight: 800;
  184. flex-basis: 50%;
  185. display: flex;
  186. font-size: 40rpx;
  187. justify-content: center;
  188. align-items: center;
  189. .info {
  190. color: #AAAAAA;
  191. font-weight: 500;
  192. margin-left: 15rpx;
  193. font-size: 22rpx;
  194. }
  195. }
  196. }
  197. }
  198. </style>