pointsMall.vue 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307
  1. <template>
  2. <view class="pointsMall">
  3. <view class="background">
  4. <view class="me-integral" v-if="userCode != null">
  5. <view class="item"> 我的积分: </view>
  6. <view class="num"> {{ userCode || 0 }}积分 </view>
  7. </view>
  8. </view>
  9. <swiper class="commodity" @change="imgActiveFun" :indicator-dots="false" :autoplay="false"
  10. v-if="headGoodsList && headGoodsList.length > 0">
  11. <swiper-item v-for="item in headGoodsList" :key="item.id" @click="
  12. goProductDetails('/pages/shop/goodsDetails?id=' + item.productId)
  13. ">
  14. <view class="commodity-item">
  15. <image :src="`${item.coverImage}?x-oss-process=style/w_350`" mode=""></image>
  16. <view class="number u-text2">
  17. {{ item.title }}
  18. </view>
  19. <view class="completed">
  20. {{ item.minPoints ? item.minPoints * 1 : '0' }}<text style="font-size: 30rpx;">积分</text><text
  21. v-if="item.maxSalePrice > 0">
  22. <text style="margin: 0 4rpx;">+</text>¥{{ item.maxSalePrice * 1 }}元</text>
  23. </view>
  24. </view>
  25. </swiper-item>
  26. </swiper>
  27. <noData v-else :config="{ top: 1, content: '暂无商品~' }"></noData>
  28. <view class="option" v-if="RowsList && RowsList.length > 0">
  29. <view class="option-item" :class="{ active: activeBannerIndex == index }" v-for="(item, index) in RowsList"
  30. :key="index">
  31. </view>
  32. </view>
  33. <view class="selected">
  34. <view class="title">
  35. <view class="item"> 精选商品 </view>
  36. <view class="line"> </view>
  37. <view class="hotseparation"> 热销优品快来拼购 </view>
  38. </view>
  39. <view class="middle" v-if="RowsList && RowsList.length > 0">
  40. <view class="item" v-for="(item, index) in RowsList" :key="index" @click="
  41. goProductDetails('/pages/shop/goodsDetails?id=' + item.productId)
  42. ">
  43. <image :src="`${item.coverImage}?x-oss-process=style/w_350`" mode=""></image>
  44. <view class="titletop ">
  45. {{ item.title }}
  46. </view>
  47. <view class="numintegral">
  48. {{ item.minPoints ? item.minPoints * 1 : '0' }}积分
  49. <text v-if="item.maxSalePrice > 0"><text>+</text>¥{{ item.maxSalePrice * 1 }}元 </text>
  50. </view>
  51. </view>
  52. </view>
  53. <noData v-else :config="{ top: 1, content: '暂无商品~' }"></noData>
  54. </view>
  55. </view>
  56. </template>
  57. <script setup>
  58. import { ref } from 'vue';
  59. import { onLoad } from '@dcloudio/uni-app';
  60. import { totalIntegral_Api } from "@/api/userInfo.js";
  61. import { shopProductPage_Api } from "@/api/shop.js";
  62. import { usePageData } from "@/hooks/usePageData";
  63. const { RowsList, LoadStatus, initData } = usePageData(shopProductPage_Api);
  64. const activeBannerIndex = ref(0);
  65. const userCode = ref(null);
  66. const headGoodsList = ref([]);
  67. const imgActiveFun = (e) => {
  68. activeBannerIndex.value = e.detail.current;
  69. }
  70. const goProductDetails = (url) => {
  71. uni.navigateTo({
  72. url: url,
  73. });
  74. }
  75. // 获取我的积分
  76. const getMyMsg = () => {
  77. totalIntegral_Api().then(res => {
  78. if (res && res.code == 200) {
  79. userCode.value = res.data || 0;
  80. // console.log(userCode.value)
  81. }
  82. })
  83. }
  84. // 获取积分商品列表
  85. const getHeadGoodsList = (type) => {
  86. shopProductPage_Api({
  87. pageSize: 6,
  88. pageNum: 1,
  89. productPaymentMode: 1,
  90. }).then((res) => {
  91. if (res && res.code == 200) {
  92. headGoodsList.value = res.rows || [];
  93. }
  94. });
  95. }
  96. onLoad(() => {
  97. getMyMsg();
  98. getHeadGoodsList();
  99. initData({
  100. productPaymentMode: 1,
  101. })
  102. })
  103. </script>
  104. <style lang="scss" scoped>
  105. .commodity {
  106. margin-top: -195rpx;
  107. width: 720rpx;
  108. margin-left: 30rpx;
  109. min-height: 428rpx;
  110. overflow: hidden;
  111. ::v-deep swiper-item {
  112. width: 286rpx !important;
  113. padding-right: 18rpx;
  114. }
  115. ::v-deep .uni-swiper-slide-frame {
  116. width: 42% !important;
  117. }
  118. .commodity-item {
  119. // margin-right: 30rpx;
  120. border-radius: 16rpx;
  121. background-color: #ffffff;
  122. // padding: 18rpx;
  123. padding-top: 20rpx;
  124. text-align: center;
  125. display: flex;
  126. flex-direction: column;
  127. align-items: center;
  128. padding-bottom: 30rpx;
  129. image {
  130. width: 232rpx;
  131. height: 232rpx;
  132. border-radius: 16rpx;
  133. }
  134. .completed {
  135. font-size: 33rpx;
  136. margin-top: 14rpx;
  137. font-weight: Bold;
  138. color: #FF0000;
  139. }
  140. .number {
  141. height: 64rpx;
  142. line-height: 32rpx;
  143. margin-top: 20rpx;
  144. font-size: 22rpx;
  145. color: #333333;
  146. font-weight: 500;
  147. .zero {
  148. margin-left: 20rpx;
  149. font-size: 22rpx;
  150. color: #ff0000;
  151. font-weight: 500;
  152. }
  153. .one {
  154. color: #ff0000;
  155. font-size: 34rpx;
  156. font-weight: 700;
  157. }
  158. .two {
  159. color: #ff0000;
  160. font-size: 18rpx;
  161. font-weight: 700;
  162. }
  163. }
  164. }
  165. }
  166. .selected {
  167. background-color: #ffffff;
  168. border-radius: 40rpx 40rpx 0 0;
  169. overflow: hidden;
  170. .middle {
  171. padding: 30rpx 0 0 30rpx;
  172. display: flex;
  173. flex-wrap: wrap;
  174. box-sizing: border-box;
  175. .item {
  176. width: 216rpx;
  177. text-align: center;
  178. background-color: #ffffff;
  179. box-shadow: 0rpx 0rpx 5rpx #e6e6e6;
  180. border-radius: 20rpx;
  181. margin-bottom: 30rpx;
  182. margin-right: 20rpx;
  183. image {
  184. width: 216rpx;
  185. height: 216rpx;
  186. border-radius: 18rpx;
  187. }
  188. .titletop {
  189. font-size: 24rpx;
  190. line-height: 34rpx;
  191. font-weight: 400;
  192. color: #333333;
  193. overflow: hidden;
  194. white-space: nowrap;
  195. text-overflow: ellipsis;
  196. padding: 0 10rpx;
  197. }
  198. .numintegral {
  199. font-size: 28rpx;
  200. font-weight: 500;
  201. color: #ff0000;
  202. margin-bottom: 12rpx;
  203. margin-top: 8rpx;
  204. }
  205. }
  206. }
  207. .title {
  208. display: flex;
  209. align-items: center;
  210. margin-top: 36rpx;
  211. margin-left: 30rpx;
  212. .item {
  213. font-weight: 700;
  214. font-size: 36rpx;
  215. color: #1a1a1a;
  216. }
  217. .line {
  218. width: 1rpx;
  219. height: 34rpx;
  220. background-color: #707070;
  221. margin: 0 15rpx;
  222. }
  223. .hotseparation {
  224. font-size: 24rpx;
  225. flex: 1;
  226. font-weight: 400;
  227. color: #666666;
  228. }
  229. }
  230. }
  231. .pointsMall {
  232. background-color: #f6f6f6;
  233. }
  234. .option {
  235. margin: 30rpx 0;
  236. display: flex;
  237. justify-content: center;
  238. .option-item {
  239. background-color: #d9d9d9;
  240. margin: 0 8rpx;
  241. width: 14rpx;
  242. height: 14rpx;
  243. border-radius: 7rpx;
  244. }
  245. .active {
  246. background-color: #ff4e15;
  247. width: 35rpx;
  248. height: 14rpx;
  249. border-radius: 7rpx;
  250. }
  251. }
  252. .background {
  253. width: 100%;
  254. height: 300rpx;
  255. background-color: #FA6138;
  256. overflow: hidden;
  257. .num {
  258. color: #ffffff;
  259. font-size: 28rpx;
  260. font-weight: 500;
  261. }
  262. .me-integral {
  263. display: flex;
  264. justify-content: center;
  265. color: #ffffff;
  266. font-size: 28rpx;
  267. font-weight: 500;
  268. margin-top: 30rpx;
  269. }
  270. }
  271. </style>