votePopup.vue 5.5 KB

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