index.vue 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311
  1. <template>
  2. <view class="pointsMall">
  3. <navbar :config="config" backColor="#666"></navbar>
  4. <view class="background">
  5. <view class="me-integral" v-if="userCode">
  6. <view class="item"> 我的积分: </view>
  7. <view class="num"> {{userCode.integral_able}}积分 </view>
  8. </view>
  9. </view>
  10. <swiper class="commodity" @change="imgActiveFun" :indicator-dots="false"
  11. :autoplay="false" v-if="goodsList && goodsList.length > 0">
  12. <swiper-item
  13. v-for="item in goodsList"
  14. :key="item.id"
  15. @click="
  16. goProductDetails('/pages/product/goods/IntegralGood?id=' + item.id)
  17. "
  18. >
  19. <view class="commodity-item">
  20. <image :src="item.cover" mode=""></image>
  21. <view class="number u-text2">
  22. {{ item.title }}
  23. </view>
  24. <view class="completed"> {{ item.min_exchange_point }}<text style="font-size: 30rpx;">积分</text> </view>
  25. </view>
  26. </swiper-item>
  27. </swiper>
  28. <nodata v-else :config="{ top: 1, content: '暂无商品~' }"></nodata>
  29. <view class="option" v-if="goodsList && goodsList.length > 0">
  30. <view
  31. class="option-item"
  32. :class="{ active: activeBannerIndex == index }"
  33. v-for="(item, index) in goodsList"
  34. :key="index"
  35. >
  36. </view>
  37. </view>
  38. <view class="selected">
  39. <view class="title">
  40. <view class="item"> 精选商品 </view>
  41. <view class="line"> </view>
  42. <view class="hotseparation"> 热销优品快来拼购 </view>
  43. </view>
  44. <view class="middle" v-if="goodsList && goodsList.length > 0">
  45. <view class="item" v-for="(item, index) in goodsList" :key="index" @click="
  46. goProductDetails('/pages/product/goods/IntegralGood?id=' + item.id)
  47. ">
  48. <image :src="item.cover" mode=""></image>
  49. <view class="titletop ">
  50. {{ item.title }}
  51. </view>
  52. <view class="numintegral"> {{ item.min_exchange_point }}积分 </view>
  53. </view>
  54. </view>
  55. <nodata v-else :config="{ top: 1, content: '暂无商品~' }"></nodata>
  56. </view>
  57. </view>
  58. </template>
  59. <script>
  60. export default {
  61. data() {
  62. return {
  63. config: {
  64. back: true, //false是tolbar页面 是则不写
  65. title: "积分商城",
  66. color: "#1a1a1a",
  67. switchnextstep: true, //切换底部样式
  68. //背景颜色;参数一:透明度(0-1);参数二:背景颜色(array则为线性渐变,string为单色背景)
  69. backgroundColor: [1, '#fff'],
  70. },
  71. params: {
  72. page: 1,
  73. limit: 10,
  74. },
  75. status: "more",
  76. goodsList: [],
  77. activeBannerIndex: 0,
  78. user:null,
  79. userCode:null,
  80. };
  81. },
  82. onLoad(options) {
  83. if(uni.getStorageSync('personal')) {
  84. this.user=uni.getStorageSync('personal')
  85. }
  86. this.getList();
  87. this.getMyMsg()
  88. },
  89. onReachBottom(e) {
  90. this.status = "loading";
  91. this.params.page++;
  92. this.getList();
  93. },
  94. onPullDownRefresh() {
  95. this.params.page = 1;
  96. this.goodsList = [];
  97. this.getList();
  98. uni.stopPullDownRefresh()
  99. },
  100. methods: {
  101. imgActiveFun(e) {
  102. this.activeBannerIndex = e.detail.current;
  103. },
  104. goProductDetails(url) {
  105. uni.navigateTo({
  106. url: url,
  107. });
  108. },
  109. getMyMsg(){
  110. this.$http.get("/account/app-account-info").then(res=>{
  111. if(res&&res.code==200){
  112. this.userCode=res.data
  113. console.log(this.userCode)
  114. }
  115. })
  116. },
  117. getList() {
  118. this.$http.get(`/goods/pointgoods/pages`, this.params).then((res) => {
  119. if (res && res.code == 200) {
  120. this.goodsList = this.goodsList.concat(res.page.list);
  121. if (res.page.totalPage <= res.page.currPage) {
  122. this.status = "noMore";
  123. } else {
  124. this.status = "more";
  125. }
  126. }
  127. });
  128. },
  129. },
  130. };
  131. </script>
  132. <style lang="scss" scoped>
  133. .commodity {
  134. margin-top: -195rpx;
  135. width: 720rpx;
  136. margin-left: 30rpx;
  137. height: 428rpx;
  138. overflow: hidden;
  139. /deep/ swiper-item {
  140. width: 286rpx !important;
  141. padding-right: 18rpx;
  142. }
  143. /deep/ .uni-swiper-slide-frame {
  144. width: 42% !important;
  145. }
  146. .commodity-item {
  147. // margin-right: 30rpx;
  148. border-radius: 16rpx;
  149. background-color: #ffffff;
  150. // padding: 18rpx;
  151. padding-top: 20rpx;
  152. text-align: center;
  153. display: flex;
  154. flex-direction: column;
  155. align-items: center;
  156. padding-bottom: 30rpx;
  157. image {
  158. width: 232rpx;
  159. height: 232rpx;
  160. border-radius: 16rpx;
  161. }
  162. .completed {
  163. font-size: 33rpx;
  164. margin-top: 14rpx;
  165. font-weight: Bold;
  166. color: #FF0000;
  167. }
  168. .number {
  169. height: 64rpx;
  170. line-height: 32rpx;
  171. margin-top: 20rpx;
  172. font-size: 22rpx;
  173. color: #333333;
  174. font-weight: 500;
  175. .zero {
  176. margin-left: 20rpx;
  177. font-size: 22rpx;
  178. color: #ff0000;
  179. font-weight: 500;
  180. }
  181. .one {
  182. color: #ff0000;
  183. font-size: 34rpx;
  184. font-weight: 700;
  185. }
  186. .two {
  187. color: #ff0000;
  188. font-size: 18rpx;
  189. font-weight: 700;
  190. }
  191. }
  192. }
  193. }
  194. .selected {
  195. background-color: #ffffff;
  196. border-radius: 40rpx 40rpx 0 0;
  197. overflow: hidden;
  198. .middle {
  199. padding: 30rpx 0 0 30rpx;
  200. display: flex;
  201. flex-wrap: wrap;
  202. .item {
  203. width: 216rpx;
  204. text-align: center;
  205. background-color: #ffffff;
  206. box-shadow: 0rpx 0rpx 5rpx #e6e6e6;
  207. border-radius: 20rpx;
  208. margin-bottom: 30rpx;
  209. margin-right: 20rpx;
  210. image {
  211. width: 216rpx;
  212. height: 216rpx;
  213. border-radius: 18rpx;
  214. }
  215. .titletop {
  216. font-size: 24rpx;
  217. line-height: 34rpx;
  218. font-weight: 400;
  219. color: #333333;
  220. overflow: hidden;
  221. white-space: nowrap;
  222. text-overflow: ellipsis;
  223. padding: 0 10rpx;
  224. }
  225. .numintegral {
  226. font-size: 28rpx;
  227. font-weight: 500;
  228. color: #ff0000;
  229. margin-bottom: 12rpx;
  230. margin-top: 8rpx;
  231. }
  232. }
  233. }
  234. .title {
  235. display: flex;
  236. align-items: center;
  237. margin-top: 36rpx;
  238. margin-left: 30rpx;
  239. .item {
  240. font-weight: 700;
  241. font-size: 36rpx;
  242. color: #1a1a1a;
  243. }
  244. .line {
  245. width: 1rpx;
  246. height: 34rpx;
  247. background-color: #707070;
  248. margin: 0 15rpx;
  249. }
  250. .hotseparation {
  251. font-size: 24rpx;
  252. flex: 1;
  253. font-weight: 400;
  254. color: #666666;
  255. }
  256. }
  257. }
  258. .pointsMall {
  259. background-color: #f6f6f6;
  260. }
  261. .option {
  262. margin: 30rpx 0;
  263. display: flex;
  264. justify-content: center;
  265. .option-item {
  266. background-color: #d9d9d9;
  267. margin: 0 8rpx;
  268. width: 14rpx;
  269. height: 14rpx;
  270. border-radius: 7rpx;
  271. }
  272. .active {
  273. background-color: #ff4e15;
  274. width: 35rpx;
  275. height: 14rpx;
  276. border-radius: 7rpx;
  277. }
  278. }
  279. .background {
  280. width: 100%;
  281. height: 300rpx;
  282. background-color: #FA6138;
  283. overflow: hidden;
  284. .num {
  285. color: #ffffff;
  286. font-size: 28rpx;
  287. font-weight: 500;
  288. }
  289. .me-integral {
  290. display: flex;
  291. justify-content: center;
  292. color: #ffffff;
  293. font-size: 28rpx;
  294. font-weight: 500;
  295. margin-top: 30rpx;
  296. }
  297. }
  298. </style>