index.vue 5.4 KB

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