pointsMall.vue 9.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376
  1. <template>
  2. <view :style="[pointsMallWrapStyle]" v-show="!isSortType">
  3. <view class="pointsMall" :style="[pointsMallStyle,goodsWrapperStyle]">
  4. <view class="acea-row row-middle row-between header" :style="[headerStyle]">
  5. <view v-if="dataConfig.titleConfig.tabVal" class="title" :style="[titleStyle]">{{ dataConfig.titleTxtConfig.value }}</view>
  6. <easy-loadimage v-else mode="widthFix" :image-src="titleImage" width="176rpx" height="32rpx"></easy-loadimage>
  7. <view class="more" :style="[buttonStyle]" @click="goPointsMall">
  8. <text>更多</text>
  9. <text class="iconfont icon-ic_rightarrow"></text>
  10. </view>
  11. </view>
  12. <view>
  13. <view v-if="dataConfig.goodStyleConfig.tabVal == 0" class="goods-wrapper0">
  14. <scroll-view class="scroll-view" scroll-x="true">
  15. <view class="item" v-for="item in goodsList" :key="item.id" @click="goGoodsDetails(item.id)">
  16. <easy-loadimage mode="widthFix" :image-src="item.image" width="224rpx" height="224rpx" :borderRadius="goodsImage"></easy-loadimage>
  17. <view class="price-box acea-row row-middle" :style="[priceBoxStyle]">
  18. <view class="point">{{ item.integral }}</view>
  19. <view class="">积分+{{ item.price }}元</view>
  20. </view>
  21. </view>
  22. </scroll-view>
  23. </view>
  24. <view v-else-if="dataConfig.goodStyleConfig.tabVal == 1" class="goods-wrapper">
  25. <view class="acea-row goods-list">
  26. <view class="item" v-for="item in goodsList" :key="item.id" @click="goGoodsDetails(item.id)">
  27. <easy-loadimage :image-src="item.image" width="100%" height="212rpx" :borderRadius="goodsImage"></easy-loadimage>
  28. <view class="price-box acea-row row-middle" :style="[priceBoxStyle]">
  29. <view class="acea-row row-middle">
  30. <image class="image" :src="`${imgHost}/statics/images/newVip3.png`" mode="aspectFit"></image>
  31. <text class="num" :style="[numStyle]">{{ item.integral }}</text>
  32. </view>
  33. <view class="">
  34. <text>+</text>
  35. <text class="num" :style="[numStyle]">{{ item.price }}</text>
  36. <text>元</text>
  37. </view>
  38. </view>
  39. <view class="title line1" :style="[goodsTitleStyle]">{{ item.title }}</view>
  40. </view>
  41. </view>
  42. </view>
  43. <view v-else-if="dataConfig.goodStyleConfig.tabVal == 2" class="goods-wrapper2">
  44. <view class="acea-row goods-list">
  45. <view class="item" v-for="item in goodsList" :key="item.id" @click="goGoodsDetails(item.id)">
  46. <easy-loadimage :image-src="item.image" width="100%" height="324rpx" :borderRadius="goodsImage"></easy-loadimage>
  47. <view class="title line1" :style="[goodsTitleStyle]">{{ item.title }}</view>
  48. <view class="price-box acea-row row-middle" :style="[priceBoxStyle]">
  49. <view class="">
  50. <image class="image" :src="`${imgHost}/statics/images/newVip3.png`" mode="aspectFit"></image>
  51. <text class="num point" :style="[numStyle]">{{ item.integral }}</text>
  52. </view>
  53. <view class="">
  54. <text>+</text>
  55. <text class="num" :style="[numStyle]">{{ item.price }}</text>
  56. <text>元</text>
  57. </view>
  58. </view>
  59. </view>
  60. </view>
  61. </view>
  62. </view>
  63. </view>
  64. </view>
  65. </template>
  66. <script>
  67. import {
  68. getStoreIntegralList
  69. } from '@/api/activity.js';
  70. import {
  71. HTTP_REQUEST_URL
  72. } from '@/config/app';
  73. export default {
  74. props: {
  75. dataConfig: {
  76. type: Object,
  77. default: () => {}
  78. },
  79. isSortType: {
  80. type: String | Number,
  81. default: 0
  82. }
  83. },
  84. data() {
  85. return {
  86. imgHost: HTTP_REQUEST_URL,
  87. goodsList: []
  88. }
  89. },
  90. computed: {
  91. headerStyle() {
  92. let background = `linear-gradient(90deg, ${this.dataConfig.headerBgColor.color[0].item} 0%, ${this.dataConfig.headerBgColor.color[1].item} 100%)`;
  93. if (this.dataConfig.styleConfig.tabVal) {
  94. background = `url(${this.dataConfig.imgBgConfig.url})`;
  95. }
  96. return {
  97. 'background-image': background,
  98. };
  99. },
  100. goodsWrapperStyle() {
  101. let color = this.dataConfig.moduleColor2.color;
  102. if (this.dataConfig.styleConfig.tabVal) {
  103. color = this.dataConfig.moduleColor.color;
  104. }
  105. return {
  106. 'background-image': `linear-gradient(270deg, ${color[0].item} 0%, ${color[1].item} 100%)`,
  107. };
  108. },
  109. pointsMallStyle() {
  110. let borderRadius = `${this.dataConfig.fillet.val * 2}rpx`;
  111. if (this.dataConfig.fillet.type) {
  112. borderRadius =
  113. `${this.dataConfig.fillet.valList[0].val * 2}rpx ${this.dataConfig.fillet.valList[1].val * 2}rpx ${this.dataConfig.fillet.valList[2].val * 2}rpx ${this.dataConfig.fillet.valList[3].val * 2}rpx`;
  114. }
  115. return {
  116. 'border-radius': borderRadius,
  117. };
  118. },
  119. buttonStyle() {
  120. let color = this.dataConfig.headerBntColor2.color[0].item;
  121. if (this.dataConfig.styleConfig.tabVal) {
  122. color = this.dataConfig.headerBntColor.color[0].item;
  123. }
  124. return {
  125. 'font-size': this.dataConfig.bntNumber.val,
  126. 'color': color,
  127. };
  128. },
  129. titleImage() {
  130. let url = this.dataConfig.imgConfig2.url;
  131. if (this.dataConfig.styleConfig.tabVal) {
  132. url = this.dataConfig.imgConfig.url;
  133. }
  134. return url;
  135. },
  136. titleStyle() {
  137. let fontStyle = 'normal';
  138. let fontWeight = 'normal';
  139. if (this.dataConfig.titleConfig.tabVal) {
  140. switch (this.dataConfig.titleText.tabVal) {
  141. case 0:
  142. fontWeight = 'bold';
  143. break;
  144. case 2:
  145. fontStyle = 'italic';
  146. break;
  147. }
  148. }
  149. return {
  150. 'font-style': fontStyle,
  151. 'font-weight': fontWeight,
  152. };
  153. },
  154. goodsImage() {
  155. let borderRadius = `${this.dataConfig.filletImg.val * 2}rpx`;
  156. if (this.dataConfig.filletImg.type) {
  157. borderRadius =
  158. `${this.dataConfig.filletImg.valList[0].val * 2}rpx ${this.dataConfig.filletImg.valList[1].val * 2}rpx ${this.dataConfig.filletImg.valList[2].val * 2}rpx ${this.dataConfig.filletImg.valList[3].val * 2}rpx`;
  159. }
  160. return borderRadius;
  161. },
  162. priceBoxStyle() {
  163. let styleObject = {};
  164. if (this.dataConfig.toneConfig.tabVal) {
  165. if (this.dataConfig.goodStyleConfig.tabVal) {
  166. styleObject['color'] = this.dataConfig.goodsUnitPriceColor.color[0].item;
  167. } else {
  168. styleObject['background'] = `linear-gradient(90deg, ${this.dataConfig.priceBgColor.color[0].item} 0%, ${this.dataConfig.priceBgColor.color[1].item} 100%)`;
  169. styleObject['color'] = this.dataConfig.goodsPriceColor.color[0].item;
  170. }
  171. }
  172. return styleObject;
  173. },
  174. goodsTitleStyle() {
  175. return {
  176. 'color': this.dataConfig.goodsNameColor2.color[0].item,
  177. };
  178. },
  179. // 数字样式
  180. numStyle() {
  181. let styleObject = {};
  182. if (this.dataConfig.toneConfig.tabVal) {
  183. styleObject['color'] = this.dataConfig.goodsPriceColor.color[0].item;
  184. }
  185. return styleObject;
  186. let color = this.dataConfig.goodsPriceColor2.color[0].item;
  187. if (this.dataConfig.goodStyleConfig.tabVal) {
  188. color = this.dataConfig.goodsPriceColor.color[0].item;
  189. }
  190. return {
  191. 'color': color,
  192. };
  193. },
  194. pointsMallWrapStyle() {
  195. return {
  196. 'padding': `${this.dataConfig.topConfig.val}rpx ${this.dataConfig.prConfig.val}rpx ${this.dataConfig.bottomConfig.val}rpx`,
  197. 'margin-top': `${this.dataConfig.mbConfig.val}rpx`,
  198. };
  199. },
  200. },
  201. mounted() {
  202. this.getStoreIntegralList();
  203. },
  204. methods: {
  205. getStoreIntegralList() {
  206. let limit = this.$config.LIMIT;
  207. getStoreIntegralList({
  208. page: 1,
  209. limit: this.dataConfig.numberConfig.val >= limit ? limit : this.dataConfig.numberConfig.val
  210. }).then(res => {
  211. this.goodsList = res.data;
  212. });
  213. },
  214. goPointsMall() {
  215. uni.navigateTo({
  216. url: `/pages/activity/points_mall/index`
  217. });
  218. },
  219. goGoodsDetails(id) {
  220. uni.navigateTo({
  221. url: `/pages/activity/goods_details/index?id=${id}&type=4`
  222. });
  223. },
  224. },
  225. }
  226. </script>
  227. <style lang="scss" scoped>
  228. .pointsMall {
  229. background: #FFFFFF;
  230. overflow: hidden;
  231. }
  232. .header {
  233. height: 96rpx;
  234. padding: 0 24rpx;
  235. background-repeat: no-repeat;
  236. background-size: 100% 100%;
  237. .title {
  238. font-weight: 500;
  239. font-size: 32rpx;
  240. color: #333333;
  241. }
  242. .more {
  243. font-size: 24rpx;
  244. color: #999999;
  245. .iconfont {
  246. font-size: 24rpx;
  247. }
  248. }
  249. }
  250. .goods-wrapper {
  251. .goods-list {
  252. padding: 0 10rpx 12rpx;
  253. .item {
  254. flex: 0 0 33.33%;
  255. min-width: 0;
  256. padding: 0 10rpx 20rpx;
  257. margin: 0;
  258. }
  259. .price-box {
  260. width: auto;
  261. height: auto;
  262. margin: 16rpx 0 0;
  263. background: none;
  264. font-family: SemiBold;
  265. font-size: 24rpx;
  266. line-height: 40rpx;
  267. color: #666666;
  268. }
  269. .image {
  270. width: 28rpx;
  271. height: 28rpx;
  272. margin-right: 8rpx;
  273. }
  274. .num {
  275. color: var(--view-theme);
  276. }
  277. .title {
  278. margin-top: 4rpx;
  279. font-size: 26rpx;
  280. line-height: 36rpx;
  281. color: #282828;
  282. }
  283. }
  284. }
  285. .goods-wrapper2 {
  286. padding: 0 10rpx 8rpx;
  287. .item {
  288. flex: 0 0 50%;
  289. min-width: 0;
  290. padding: 0 10rpx 20rpx;
  291. margin: 0;
  292. }
  293. .title {
  294. margin-top: 16rpx;
  295. font-size: 28rpx;
  296. line-height: 28rpx;
  297. color: #282828;
  298. }
  299. .price-box {
  300. width: auto;
  301. height: auto;
  302. margin: 16rpx 0 0;
  303. background: none;
  304. font-family: SemiBold;
  305. font-size: 24rpx;
  306. line-height: 40rpx;
  307. color: #666666;
  308. }
  309. .image {
  310. width: 28rpx;
  311. height: 28rpx;
  312. margin-right: 4rpx;
  313. }
  314. .num {
  315. color: var(--view-theme);
  316. }
  317. .point {
  318. font-weight: 600;
  319. font-size: 40rpx;
  320. }
  321. }
  322. .goods-wrapper0 {
  323. padding: 0 0 32rpx 20rpx;
  324. }
  325. .scroll-view {
  326. white-space: nowrap;
  327. padding: 20rpx 0 20rpx 20rpx;
  328. border-radius: 16rpx 0 0 16rpx;
  329. background: #FFFFFF;
  330. .item {
  331. display: inline-block;
  332. width: 224rpx;
  333. margin: 0 20rpx 0 0;
  334. }
  335. .price-box {
  336. display: inline-flex;
  337. width: auto;
  338. height: 36rpx;
  339. padding: 0 12rpx;
  340. border-radius: 2rpx 20rpx 20rpx 20rpx;
  341. margin: 16rpx 0 0;
  342. background: linear-gradient(90deg, var(--view-theme) 0%, var(--view-gradient) 100%);
  343. font-family: SemiBold;
  344. font-size: 22rpx;
  345. color: #FFFFFF;
  346. }
  347. .point {
  348. font-weight: 600;
  349. font-size: 26rpx;
  350. }
  351. }
  352. </style>