index.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266
  1. <template>
  2. <view class="integral_all">
  3. <!-- 积分信息 -->
  4. <view class="information">
  5. <view class="information_le">
  6. <view class="information_text1">当前可用积分</view>
  7. <view class="information_text2">{{ integralNum }}</view>
  8. <view class="information_text3" @click="goDet(1)">
  9. 积分明细
  10. <u-icon name="arrow-right" size="28"></u-icon>
  11. </view>
  12. </view>
  13. <view class="information_ri">
  14. <image src="../static/integral/rectangular.png" mode="r"></image>
  15. <view class="information_text4" @click="goDet(2)">兑换记录</view>
  16. </view>
  17. </view>
  18. <!-- 兑换商品 -->
  19. <view class="integral_goods">
  20. <view class="integral_goods_sty">
  21. <view class="integral_goods_sty1" v-for="(item, index) in dataList" :key="index">
  22. <image :src="item.couponPicture" mode=""></image>
  23. <view class="integral_goods_text">{{ item.couponName }}</view>
  24. <view class="integral_goods_sty_bo">
  25. <view class="integral_goods_sty_bo_le">
  26. <text class="integral_goods_text2">{{ item.needIntegral }}</text>
  27. 积分
  28. </view>
  29. <view class="integral_goods_sty_bo_ri" @click="exchange(item)">兑换</view>
  30. </view>
  31. </view>
  32. </view>
  33. </view>
  34. </view>
  35. </template>
  36. <script>
  37. export default {
  38. data() {
  39. return {
  40. btnnum: 0,
  41. page: 1,
  42. limit: 10,
  43. dataList: [],
  44. integralNum: 0
  45. }
  46. },
  47. onLoad() {
  48. this.getIntegral()
  49. this.getData()
  50. },
  51. methods: {
  52. exchange(e) {
  53. let that = this
  54. uni.showModal({
  55. title: '提示',
  56. content: '确定兑换' + e.couponName + '吗?',
  57. success: function (res) {
  58. if (res.confirm) {
  59. console.log('用户点击确定')
  60. that.$Request
  61. .post('/app/coupon/buyCoupon', {
  62. couponId: e.couponId
  63. })
  64. .then((res) => {
  65. if (res.code == 0) {
  66. uni.showToast({
  67. title: '兑换成功'
  68. })
  69. that.getIntegral()
  70. } else {
  71. uni.showToast({
  72. title: res.msg,
  73. icon: 'none'
  74. })
  75. }
  76. })
  77. } else if (res.cancel) {
  78. console.log('用户点击取消')
  79. }
  80. }
  81. })
  82. },
  83. goDet(e) {
  84. uni.navigateTo({
  85. url: '/my/integral/integralDet?classify=' + e
  86. })
  87. },
  88. change(e) {
  89. this.btnnum = e
  90. console.log(this.btnnum)
  91. },
  92. getIntegral() {
  93. this.$Request.get('/app/userintegral/selectUserIntegral').then((res) => {
  94. if (res.code == 0) {
  95. this.integralNum = res.data.integralNum
  96. }
  97. })
  98. },
  99. getData() {
  100. let data = {
  101. page: this.page,
  102. limit: this.limit,
  103. shopId: 0
  104. }
  105. this.$Request.get('/app/coupon/selectCouponList', data).then((res) => {
  106. if (res.code == 0) {
  107. if (this.page == 1) {
  108. this.dataList = res.data.list
  109. } else {
  110. this.dataList = [...this.dataList, ...res.data.list]
  111. }
  112. }
  113. })
  114. }
  115. },
  116. onReachBottom: function () {
  117. this.page = this.page + 1
  118. this.getData()
  119. }
  120. }
  121. </script>
  122. <style scoped>
  123. .integral_all {
  124. width: 100%;
  125. background-color: #fcd202;
  126. }
  127. /* 积分信息 */
  128. .information {
  129. width: 94%;
  130. padding: 4% 3% 5%;
  131. display: flex;
  132. align-items: center;
  133. justify-content: space-between;
  134. }
  135. .information_le {
  136. /* width: 70%; */
  137. color: #ffffff;
  138. }
  139. .information_text1 {
  140. font-size: 28rpx;
  141. font-weight: 500;
  142. color: #ffffff;
  143. margin-bottom: 10upx;
  144. line-height: 32rpx;
  145. }
  146. .information_text2 {
  147. font-size: 60rpx;
  148. font-weight: bold;
  149. color: #ffffff;
  150. margin-bottom: 10upx;
  151. }
  152. .information_text3 {
  153. font-size: 28rpx;
  154. font-weight: 500;
  155. color: #ffffff;
  156. line-height: 32rpx;
  157. }
  158. .information_ri {
  159. /* width: 30%; */
  160. /* padding-top: 50rpx; */
  161. position: relative;
  162. }
  163. .information_ri image {
  164. width: 218rpx;
  165. height: 98rpx;
  166. }
  167. .information_text4 {
  168. color: #ffffff;
  169. position: absolute;
  170. /* bottom: 0; */
  171. left: 51rpx;
  172. top: 23rpx;
  173. font-size: 28upx;
  174. /* right: 0; */
  175. /* margin: auto; */
  176. }
  177. .duihuan {
  178. padding: 8rpx 18rpx;
  179. background-color: #fcd202;
  180. box-shadow: 0 0 10rpx #fcd202;
  181. }
  182. /* 兑换商品 */
  183. .integral_goods {
  184. width: 100%;
  185. background-color: #f5f5f5;
  186. border-top-left-radius: 18rpx;
  187. border-top-right-radius: 18rpx;
  188. padding-bottom: 3%;
  189. }
  190. .integral_goods_sty {
  191. width: 94%;
  192. margin: 0 auto;
  193. display: flex;
  194. flex-wrap: wrap;
  195. justify-content: space-between;
  196. padding-top: 3%;
  197. }
  198. .integral_goods_sty1 {
  199. width: 48.5%;
  200. /* margin-left: 3%; */
  201. background-color: #ffffff;
  202. padding: 0 2% 4%;
  203. border-radius: 18rpx;
  204. margin-bottom: 3%;
  205. }
  206. /* .integral_goods_sty1:first-child {
  207. margin-left: 0;
  208. } */
  209. .integral_goods_sty1 image {
  210. width: 100%;
  211. height: 240upx;
  212. }
  213. .integral_goods_text {
  214. font-size: 35rpx;
  215. font-weight: bold;
  216. color: #333333;
  217. line-height: 1.8;
  218. }
  219. .integral_goods_sty_bo {
  220. display: flex;
  221. margin-top: 2%;
  222. }
  223. .integral_goods_sty_bo_le {
  224. width: 65%;
  225. color: #999999;
  226. font-size: 30rpx;
  227. }
  228. .integral_goods_text2 {
  229. color: #d80204;
  230. font-size: 28rpx;
  231. margin-right: 4upx;
  232. font-weight: bold;
  233. }
  234. .integral_goods_sty_bo_ri {
  235. width: 35%;
  236. background-color: #fcd202;
  237. font-size: 24rpx;
  238. font-weight: bold;
  239. color: #333333;
  240. padding: 2% 0;
  241. text-align: center;
  242. border-radius: 50rpx;
  243. }
  244. </style>