pointsMall.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527
  1. <template>
  2. <view v-show="!isSortType">
  3. <common-wrapper :config="configData">
  4. <view class="pointsMall" :style="[pointsMallStyle, goodsWrapperStyle]">
  5. <view
  6. class="acea-row row-middle row-between header"
  7. :style="[headerStyle]"
  8. >
  9. <view
  10. v-if="dataConfig.titleConfig.tabVal"
  11. class="title"
  12. :style="[titleStyle]"
  13. >{{ dataConfig.titleTxtConfig.value }}</view
  14. >
  15. <easy-loadimage
  16. v-else
  17. mode="widthFix"
  18. :image-src="titleImage"
  19. width="176rpx"
  20. height="32rpx"
  21. ></easy-loadimage>
  22. <view class="more" :style="[buttonStyle]" @click="goPointsMall">
  23. <text>{{ $t(`更多`) }}</text>
  24. <text
  25. class="iconfont icon-ic_rightarrow"
  26. :style="[buttonStyle]"
  27. ></text>
  28. </view>
  29. </view>
  30. <view>
  31. <view
  32. v-if="dataConfig.goodStyleConfig.tabVal == 0"
  33. class="goods-wrapper0"
  34. >
  35. <scroll-view class="scroll-view" scroll-x="true">
  36. <view
  37. class="item"
  38. v-for="item in goodsList"
  39. :key="item.id"
  40. @click="goGoodsDetails(item.id)"
  41. >
  42. <easy-loadimage
  43. mode="widthFix"
  44. :image-src="item.image"
  45. width="224rpx"
  46. height="224rpx"
  47. :borderRadius="goodsImage"
  48. ></easy-loadimage>
  49. <view
  50. class="price-box acea-row row-middle"
  51. :style="[priceBoxStyle]"
  52. >
  53. <view class="point">{{ item.price }}</view>
  54. <view class="">{{ $t(`积分`) }}</view>
  55. </view>
  56. </view>
  57. </scroll-view>
  58. </view>
  59. <view
  60. v-else-if="dataConfig.goodStyleConfig.tabVal == 1"
  61. class="goods-wrapper"
  62. >
  63. <view class="acea-row goods-list">
  64. <view
  65. class="item"
  66. v-for="item in goodsList"
  67. :key="item.id"
  68. @click="goGoodsDetails(item.id)"
  69. >
  70. <easy-loadimage
  71. :image-src="item.image"
  72. width="100%"
  73. height="212rpx"
  74. :borderRadius="goodsImage"
  75. ></easy-loadimage>
  76. <view
  77. class="price-box acea-row row-middle"
  78. :style="[priceBoxStyle]"
  79. >
  80. <view class="acea-row row-middle">
  81. <image
  82. class="image"
  83. :src="`${imgHost}/statics/images/newVip3.png`"
  84. mode="aspectFit"
  85. ></image>
  86. <text class="num" :style="[numStyle]">{{
  87. item.price
  88. }}</text>
  89. </view>
  90. </view>
  91. <view class="title line1" :style="[goodsTitleStyle]">{{
  92. item.title
  93. }}</view>
  94. </view>
  95. </view>
  96. </view>
  97. <view
  98. v-else-if="dataConfig.goodStyleConfig.tabVal == 2"
  99. class="goods-wrapper2"
  100. >
  101. <view class="acea-row goods-list">
  102. <view
  103. class="item"
  104. v-for="item in goodsList"
  105. :key="item.id"
  106. @click="goGoodsDetails(item.id)"
  107. >
  108. <easy-loadimage
  109. :image-src="item.image"
  110. width="100%"
  111. height="324rpx"
  112. :borderRadius="goodsImage"
  113. ></easy-loadimage>
  114. <view class="title line2" :style="[goodsTitleStyle]">{{
  115. item.title
  116. }}</view>
  117. <view
  118. class="price-box acea-row row-middle"
  119. :style="[priceBoxStyle]"
  120. >
  121. <view class="">
  122. <image
  123. class="image"
  124. :src="`${imgHost}/statics/images/newVip3.png`"
  125. mode="aspectFit"
  126. ></image>
  127. <text class="num point" :style="[numStyle]">{{
  128. item.price
  129. }}</text>
  130. </view>
  131. </view>
  132. </view>
  133. </view>
  134. </view>
  135. </view>
  136. </view>
  137. </common-wrapper>
  138. </view>
  139. </template>
  140. <script>
  141. import commonWrapper from "./commonWrapper.vue";
  142. import { getStoreIntegralList } from "@/api/activity.js";
  143. import { HTTP_REQUEST_URL } from "@/config/app";
  144. export default {
  145. components: { commonWrapper },
  146. props: {
  147. dataConfig: {
  148. type: Object,
  149. default: () => {},
  150. },
  151. isSortType: {
  152. type: String | Number,
  153. default: 0,
  154. },
  155. },
  156. data() {
  157. return {
  158. imgHost: HTTP_REQUEST_URL,
  159. goodsList: [],
  160. };
  161. },
  162. computed: {
  163. configData() {
  164. return {
  165. ...this.dataConfig,
  166. paddingConfig: this.dataConfig.paddingConfig || {
  167. isAll: false,
  168. valList: [
  169. {
  170. val: this.dataConfig.topConfig
  171. ? this.dataConfig.topConfig.val
  172. : 0,
  173. },
  174. {
  175. val: this.dataConfig.prConfig ? this.dataConfig.prConfig.val : 0,
  176. },
  177. {
  178. val: this.dataConfig.bottomConfig
  179. ? this.dataConfig.bottomConfig.val
  180. : 0,
  181. },
  182. {
  183. val: this.dataConfig.prConfig ? this.dataConfig.prConfig.val : 0,
  184. },
  185. ],
  186. },
  187. marginConfig: this.dataConfig.marginConfig || {
  188. isAll: false,
  189. valList: [
  190. {
  191. val: this.dataConfig.mbConfig ? this.dataConfig.mbConfig.val : 0,
  192. },
  193. {
  194. val: 0,
  195. },
  196. {
  197. val: 0,
  198. },
  199. {
  200. val: 0,
  201. },
  202. ],
  203. },
  204. };
  205. },
  206. headerStyle() {
  207. let background = `linear-gradient(90deg, ${this.dataConfig.headerBgColor.color[0].item} 0%, ${this.dataConfig.headerBgColor.color[1].item} 100%)`;
  208. if (this.dataConfig.styleConfig.tabVal) {
  209. background = `url(${this.dataConfig.imgBgConfig.url})`;
  210. }
  211. return {
  212. "background-image": background,
  213. };
  214. },
  215. goodsWrapperStyle() {
  216. let color = this.dataConfig.moduleColor2.color;
  217. if (this.dataConfig.styleConfig.tabVal) {
  218. color = this.dataConfig.moduleColor.color;
  219. }
  220. return {
  221. "background-image": `linear-gradient(270deg, ${color[0].item} 0%, ${color[1].item} 100%)`,
  222. };
  223. },
  224. pointsMallStyle() {
  225. let borderRadius = `${this.dataConfig.fillet.val * 2}rpx`;
  226. if (this.dataConfig.fillet.type) {
  227. borderRadius = `${this.dataConfig.fillet.valList[0].val * 2}rpx ${
  228. this.dataConfig.fillet.valList[1].val * 2
  229. }rpx ${this.dataConfig.fillet.valList[3].val * 2}rpx ${
  230. this.dataConfig.fillet.valList[2].val * 2
  231. }rpx`;
  232. }
  233. return {
  234. "border-radius": borderRadius,
  235. };
  236. },
  237. buttonStyle() {
  238. let color = this.dataConfig.headerBntColor2.color[0].item;
  239. if (this.dataConfig.styleConfig.tabVal) {
  240. color = this.dataConfig.headerBntColor.color[0].item;
  241. }
  242. return {
  243. "font-size": this.dataConfig.bntNumber.val * 2 + "rpx",
  244. color: color,
  245. };
  246. },
  247. titleImage() {
  248. let url = this.dataConfig.imgConfig2.url;
  249. if (this.dataConfig.styleConfig.tabVal) {
  250. url = this.dataConfig.imgConfig.url;
  251. }
  252. return url;
  253. },
  254. titleStyle() {
  255. let titleText = this.dataConfig.titleText;
  256. return {
  257. fontStyle: !titleText.tabVal
  258. ? "normal"
  259. : titleText.tabList[titleText.tabVal].style,
  260. fontWeight: !titleText.tabVal ? "bold" : "normal",
  261. color: this.dataConfig.titleColor.color[0].item,
  262. fontSize: this.dataConfig.titleNumber.val * 2 + "rpx",
  263. };
  264. },
  265. goodsImage() {
  266. let borderRadius = `${this.dataConfig.filletImg.val * 2}rpx`;
  267. if (this.dataConfig.filletImg.type) {
  268. borderRadius = `${this.dataConfig.filletImg.valList[0].val * 2}rpx ${
  269. this.dataConfig.filletImg.valList[1].val * 2
  270. }rpx ${this.dataConfig.filletImg.valList[3].val * 2}rpx ${
  271. this.dataConfig.filletImg.valList[2].val * 2
  272. }rpx`;
  273. }
  274. return borderRadius;
  275. },
  276. priceBoxStyle() {
  277. let styleConfig = this.dataConfig.styleConfig.tabVal;
  278. let goodStyleConfig = this.dataConfig.goodStyleConfig.tabVal;
  279. let goodsUnitPriceColor2 =
  280. this.dataConfig.goodsUnitPriceColor2.color[0].item;
  281. let goodsUnitPriceColor =
  282. this.dataConfig.goodsUnitPriceColor.color[0].item;
  283. let styleObject = {};
  284. if (this.dataConfig.toneConfig.tabVal) {
  285. if (goodStyleConfig) {
  286. styleObject["color"] = !styleConfig
  287. ? goodsUnitPriceColor2
  288. : goodsUnitPriceColor;
  289. } else {
  290. styleObject[
  291. "background"
  292. ] = `linear-gradient(90deg, ${this.dataConfig.priceBgColor.color[0].item} 0%, ${this.dataConfig.priceBgColor.color[1].item} 100%)`;
  293. styleObject["color"] = this.dataConfig.goodsPriceColor.color[0].item;
  294. }
  295. } else {
  296. if (goodStyleConfig && !styleConfig) {
  297. styleObject["color"] = "#282828";
  298. } else {
  299. styleObject["color"] = "#fff";
  300. }
  301. }
  302. return styleObject;
  303. },
  304. goodsTitleStyle() {
  305. let styleConfig = this.dataConfig.styleConfig.tabVal;
  306. let goodStyleConfig = this.dataConfig.goodStyleConfig.tabVal;
  307. let color1 = this.dataConfig.goodsNameColor.color[0].item;
  308. let color2 = this.dataConfig.goodsNameColor2.color[0].item;
  309. let color = color2;
  310. if (!styleConfig) {
  311. color = !goodStyleConfig ? color2 : color1;
  312. }
  313. return {
  314. color: color,
  315. };
  316. },
  317. // 数字样式
  318. numStyle() {
  319. let styleConfig = this.dataConfig.styleConfig.tabVal;
  320. let goodStyleConfig = this.dataConfig.goodStyleConfig.tabVal;
  321. let color1 = this.dataConfig.goodsPriceColor.color[0].item;
  322. let color2 = this.dataConfig.goodsPriceColor2.color[0].item;
  323. let styleObject = {};
  324. let color = color1;
  325. if (!styleConfig) {
  326. color = !goodStyleConfig ? color1 : color2;
  327. }
  328. if (this.dataConfig.toneConfig.tabVal) {
  329. styleObject["color"] = color;
  330. } else {
  331. if (!goodStyleConfig || styleConfig) {
  332. styleObject["color"] = "#fff";
  333. } else {
  334. styleObject["color"] = "var(--view-theme)";
  335. }
  336. }
  337. return styleObject;
  338. },
  339. },
  340. mounted() {
  341. this.getStoreIntegralList();
  342. },
  343. methods: {
  344. getStoreIntegralList() {
  345. let limit = this.$config.LIMIT;
  346. getStoreIntegralList({
  347. page: 1,
  348. limit:
  349. this.dataConfig.numberConfig.val >= limit
  350. ? limit
  351. : this.dataConfig.numberConfig.val,
  352. }).then((res) => {
  353. this.goodsList = res.data;
  354. });
  355. },
  356. goPointsMall() {
  357. uni.navigateTo({
  358. url: `/pages/points_mall/index`,
  359. });
  360. },
  361. goGoodsDetails(id) {
  362. uni.navigateTo({
  363. url: `/pages/points_mall/integral_goods_details?id=${id}`,
  364. });
  365. },
  366. },
  367. };
  368. </script>
  369. <style lang="scss" scoped>
  370. .pointsMall {
  371. background: #ffffff;
  372. overflow: hidden;
  373. }
  374. .header {
  375. height: 96rpx;
  376. padding: 0 24rpx;
  377. background-repeat: no-repeat;
  378. background-size: 100% 100%;
  379. .title {
  380. font-weight: 500;
  381. font-size: 32rpx;
  382. color: #333333;
  383. }
  384. .more {
  385. font-size: 24rpx;
  386. color: #999999;
  387. .iconfont {
  388. font-size: 24rpx;
  389. }
  390. }
  391. }
  392. .goods-wrapper {
  393. .goods-list {
  394. padding: 20rpx 10rpx 12rpx;
  395. .item {
  396. flex: 0 0 33.33%;
  397. min-width: 0;
  398. padding: 0 10rpx 20rpx;
  399. margin: 0;
  400. }
  401. .price-box {
  402. width: auto;
  403. height: auto;
  404. margin: 16rpx 0 0;
  405. background: none;
  406. font-family: SemiBold;
  407. font-size: 24rpx;
  408. line-height: 40rpx;
  409. color: #666666;
  410. }
  411. .image {
  412. width: 28rpx;
  413. height: 28rpx;
  414. margin-right: 8rpx;
  415. }
  416. .num {
  417. color: var(--view-theme);
  418. }
  419. .title {
  420. margin-top: 4rpx;
  421. font-size: 26rpx;
  422. line-height: 36rpx;
  423. color: #282828;
  424. }
  425. }
  426. }
  427. .goods-wrapper2 {
  428. padding: 0 10rpx 8rpx;
  429. .item {
  430. flex: 0 0 50%;
  431. min-width: 0;
  432. padding: 0 10rpx 20rpx;
  433. margin: 0;
  434. }
  435. .title {
  436. margin-top: 16rpx;
  437. font-size: 28rpx;
  438. line-height: 28rpx;
  439. color: #282828;
  440. }
  441. .price-box {
  442. width: auto;
  443. height: auto;
  444. margin: 16rpx 0 0;
  445. background: none;
  446. font-family: SemiBold;
  447. font-size: 24rpx;
  448. line-height: 40rpx;
  449. color: #666666;
  450. }
  451. .image {
  452. width: 28rpx;
  453. height: 28rpx;
  454. margin-right: 4rpx;
  455. }
  456. .num {
  457. color: var(--view-theme);
  458. }
  459. .point {
  460. font-weight: 600;
  461. font-size: 40rpx;
  462. }
  463. }
  464. .goods-wrapper0 {
  465. padding: 0 0 32rpx 20rpx;
  466. }
  467. .scroll-view {
  468. box-sizing: border-box;
  469. white-space: nowrap;
  470. padding: 20rpx;
  471. border-radius: 16rpx 0 0 16rpx;
  472. background: #ffffff;
  473. .item {
  474. display: inline-block;
  475. width: 224rpx;
  476. margin: 0 20rpx 0 0;
  477. &:last-child {
  478. margin: 0;
  479. }
  480. }
  481. .price-box {
  482. display: inline-flex;
  483. width: auto;
  484. height: 36rpx;
  485. padding: 0 12rpx;
  486. border-radius: 2rpx 20rpx 20rpx 20rpx;
  487. margin: 16rpx 0 0;
  488. background: linear-gradient(
  489. 90deg,
  490. var(--view-theme) 0%,
  491. var(--view-gradient) 100%
  492. );
  493. font-family: SemiBold;
  494. font-size: 22rpx;
  495. color: #ffffff;
  496. }
  497. .point {
  498. font-weight: 600;
  499. font-size: 26rpx;
  500. }
  501. }
  502. </style>