shop.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308
  1. <template>
  2. <view :style="vuex_skin">
  3. <u-navbar title-color="#fff" z-index="90" :border-bottom="false" :is-back="false" title="积分商城"
  4. :background="{'backgroundColor': vuex_theme.shopBg}"></u-navbar>
  5. <mescroll-body-diy ref="mescrollRef" @init="mescrollInit" :down="downOption" @down="downCallback"
  6. @up="upCallback">
  7. <view class="bg-card">
  8. <view class="info" style="display: flex;justify-content: space-between;">
  9. <view class="flex" v-if="vuex_userId">
  10. <image style="width: 90rpx;height: 90rpx;border-radius: 50%;" :src="$cache.get('userInfo').avatar">
  11. </image>
  12. <view class="center data">
  13. <text style="color: #FFD7D9;">我的积分:</text>
  14. <text class="text-bold text-xxl">{{$cache.get('userInfo').pufaPoint}}</text>
  15. </view>
  16. </view>
  17. <view class="flex" v-else @click="showLogin">
  18. <image style="width: 90rpx;height: 90rpx;border-radius: 50%;" src="/static/icon/unlogin.png">
  19. </image>
  20. <view class="center data">
  21. <text style="color: #FFFFFF;font-weight: 800;">点击授权登录</text>
  22. </view>
  23. </view>
  24. <view class="center" style="margin-right: -30rpx;">
  25. <view class="cu-btn round sm rule">
  26. 积分规则
  27. </view>
  28. </view>
  29. </view>
  30. </view>
  31. <view class="swiper">
  32. <u-swiper :list="swiperList" border-radius="12" height="250"></u-swiper>
  33. </view>
  34. <view class="recommend-info">
  35. <view class="goods-list">
  36. <view class="list" v-for="(item,index) in list" :key="index">
  37. <view class="pictrue">
  38. <image :src="item.imgUrl"></image>
  39. </view>
  40. <view class="title-tag" style="text-align: center;font-weight: 800;">
  41. <text>{{item.name}}</text>
  42. </view>
  43. <view class="price-info">
  44. <view class="user-price">
  45. <text class="min">¥</text>
  46. <text class="max">{{item.point}}积分</text>
  47. </view>
  48. </view>
  49. <view class="bottom padding-top-20">
  50. <button class="cu-btn round text-white bg-base"
  51. style="width: 140upx;height: 50upx;">兑换</button>
  52. </view>
  53. </view>
  54. </view>
  55. </view>
  56. </mescroll-body-diy>
  57. <login ref="login" @signIn="signIn" @phoneSuccess="phoneSuccess"></login>
  58. </view>
  59. </template>
  60. <script>
  61. import MescrollBodyDiy from "@/uni_modules/mescroll-uni/components/mescroll-diy/xinlang/mescroll-body.vue";
  62. import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
  63. export default {
  64. mixins: [MescrollMixin],
  65. components: {
  66. MescrollBodyDiy,
  67. },
  68. data() {
  69. return {
  70. swiperList: [
  71. 'https://guosen-bucket-ldt.obs.cn-south-1.myhuaweicloud.com:443/a20288db71c24a8983801f0c0cd66ea8-bg.jpg'
  72. ],
  73. downOption: {
  74. auto: false
  75. },
  76. top: 0,
  77. list: []
  78. }
  79. },
  80. methods: {
  81. downCallback() {
  82. setTimeout(() => {
  83. this.mescroll.resetUpScroll();
  84. }, 1000)
  85. },
  86. upCallback(mescroll) {
  87. try {
  88. let params = {
  89. current: mescroll.num,
  90. size: mescroll.size,
  91. }
  92. this.$api.pointgoods.list(params).then(res => {
  93. let data = res.data.data.records
  94. let total = res.data.data.total
  95. mescroll.endBySize(data.length, total);
  96. if (mescroll.num == 1) this.list = []; //如果是第一页需手动制空列表
  97. this.list = this.list.concat(data); //追加新数据
  98. })
  99. } catch (e) {
  100. console.error(e);
  101. this.mescroll.endErr()
  102. }
  103. }
  104. }
  105. }
  106. </script>
  107. <style lang="scss" scoped>
  108. .rule {
  109. background-color: var(--shopRule);
  110. color: #FFFFFF;
  111. padding: 20rpx 40rpx 20rpx 30rpx;
  112. }
  113. .bg-card {
  114. // position: relative;
  115. width: 100vw;
  116. height: 260rpx;
  117. background-color: var(--shopBg);
  118. border-radius: 0 0 10% 10%;
  119. .info {
  120. display: flex;
  121. padding: 30rpx 0rpx 0rpx 40rpx;
  122. .data {
  123. color: #FFFFFF;
  124. margin-left: 10rpx;
  125. }
  126. }
  127. }
  128. .swiper {
  129. margin-top: -120rpx;
  130. padding: 0 20rpx;
  131. }
  132. /* 为你推荐 */
  133. .recommend-info {
  134. padding-top: 30rpx;
  135. width: 100%;
  136. border-radius: 20rpx;
  137. .recommend-title {
  138. display: flex;
  139. align-items: center;
  140. justify-content: center;
  141. width: 100%;
  142. height: 100rpx;
  143. .title {
  144. display: flex;
  145. align-items: center;
  146. image {
  147. width: 416rpx;
  148. height: 40rpx;
  149. }
  150. }
  151. }
  152. .goods-list {
  153. display: flex;
  154. flex-wrap: wrap;
  155. justify-content: space-between;
  156. padding: 0 20rpx;
  157. .list {
  158. width: 49%;
  159. height: 550rpx;
  160. margin-bottom: 20rpx;
  161. background-color: #FFFFFF;
  162. border-radius: 12rpx;
  163. overflow: hidden;
  164. .pictrue {
  165. display: flex;
  166. justify-content: center;
  167. width: 100%;
  168. image {
  169. width: 100%;
  170. height: 340rpx;
  171. }
  172. }
  173. .title-tag {
  174. // display: flex;
  175. height: 70rpx;
  176. padding: 20rpx;
  177. }
  178. .price-info {
  179. display: flex;
  180. flex-wrap: wrap;
  181. align-items: center;
  182. justify-content: center;
  183. padding: 0 20rpx;
  184. height: 50rpx;
  185. .user-price {
  186. display: flex;
  187. justify-content: center;
  188. align-items: center;
  189. text {
  190. color: #e72226;
  191. }
  192. .min {
  193. font-size: 24rpx;
  194. }
  195. .max {
  196. font-size: 32rpx;
  197. }
  198. }
  199. .vip-price {
  200. padding-left: 20rpx;
  201. display: flex;
  202. align-items: center;
  203. image {
  204. width: 26rpx;
  205. height: 26rpx;
  206. margin-right: 10rpx;
  207. }
  208. text {
  209. text-decoration: line-through;
  210. color: #8c8c8c;
  211. font-size: 24rpx;
  212. }
  213. }
  214. }
  215. .bottom {
  216. margin: 10rpx 0;
  217. display: flex;
  218. justify-content: center;
  219. align-items: flex-end;
  220. }
  221. }
  222. }
  223. }
  224. </style>
  225. <!-- <template>
  226. <view :style="vuex_skin">
  227. <mescroll-body-diy ref="mescrollRef" @init="mescrollInit" :down="downOption" :up="upOption" @down="downCallback"
  228. @up="upCallback">
  229. </mescroll-body-diy>
  230. </view>
  231. </template>
  232. <script>
  233. import MescrollBodyDiy from "@/uni_modules/mescroll-uni/components/mescroll-diy/xinlang/mescroll-body.vue";
  234. import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
  235. export default {
  236. mixins: [MescrollMixin],
  237. data() {
  238. return {
  239. downOption: {
  240. auto: false
  241. },
  242. list: [],
  243. }
  244. },
  245. methods: {
  246. downCallback() {
  247. setTimeout(() => {
  248. this.mescroll.resetUpScroll();
  249. }, 1000)
  250. },
  251. upCallback(mescroll) {
  252. try {
  253. let params = {
  254. current: mescroll.num,
  255. size: mescroll.size,
  256. }
  257. this.$api.pointgoods.list(params).then(res => {
  258. let data = res.data.data.records
  259. let total = res.data.data.total
  260. mescroll.endBySize(data.length, total);
  261. if (mescroll.num == 1) this.list = []; //如果是第一页需手动制空列表
  262. this.list = this.list.concat(data); //追加新数据
  263. })
  264. } catch (e) {
  265. console.error(e);
  266. this.mescroll.endErr()
  267. }
  268. }
  269. }
  270. }
  271. </script>
  272. -->