intergralShop.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658
  1. <!-- 积分 -->
  2. <template>
  3. <view class="groupBox" :style="[...boxPadding]">
  4. <view class="group" :style="[...boxStyle]">
  5. <view class="group-top acea-row row-middle row-between" :style="[bgImgStyle]">
  6. <view class="group-top-left acea-row">
  7. <image v-if="selectStyle == 0" :src="logoUrl" alt="" class="logo"></image>
  8. <view v-else class="titleFont" :style="[...headerTitleConfig]">{{ titleConfig }}</view>
  9. </view>
  10. <view class="group-top-right" :style="[headerBtnColor]" @click="toIntergralList">
  11. 更多
  12. <text class="iconfont icon-xiangyou" :style="[headerBtnColor]"></text>
  13. </view>
  14. </view>
  15. <!-- 样式一 -->
  16. <view class="group-bottom two acea-row grid-list" v-if="listStyle == 0"
  17. :style="[...boxBgStyle]">
  18. <view v-for="(item, index) in goodList" :key="index" @click="goGoodsDetail(item)">
  19. <view class="group-bottom-left">
  20. <view class="img acea-row row-center row-middle big-img relative" :style="[contentStyle]">
  21. <view v-show="item.stock===0" class="sellOut">已售罄</view>
  22. <easy-loadimage :image-src="item.image" width="322rpx" height="322rpx"
  23. :radius="10"></easy-loadimage>
  24. </view>
  25. </view>
  26. <view class="two-item">
  27. <view class="title acea-row line-heightOne mb-24">
  28. <text class="line1" :style="[nameColor]">{{item.name}}</text>
  29. </view>
  30. <PointsPrice :pointsPrice="item" :pointsGoodsStyle="hotPointsStyle">
  31. </PointsPrice>
  32. </view>
  33. </view>
  34. </view>
  35. <!-- 样式二 -->
  36. <view class="group-bottom three acea-row grid-three" v-if="listStyle == 1" :style="[...boxBgStyle]">
  37. <view v-for="(item, index) in goodList" :key="index" class="three-box" @click="goGoodsDetail(item)">
  38. <view class="group-bottom-left mb-20">
  39. <view class="img acea-row row-center row-middle three-img relative" :style="[contentStyle]">
  40. <view v-show="item.stock===0" class="sellOut">已售罄</view>
  41. <easy-loadimage :image-src="item.image" width="208rpx" height="208rpx"
  42. :radius="10"></easy-loadimage>
  43. </view>
  44. </view>
  45. <PointsPrice :pointsPrice="item" :pointsGoodsStyle="hotPointsStyle1" v-model="isShowSamll">
  46. </PointsPrice>
  47. <view class="two-item mt-10">
  48. <view class="title acea-row line-heightOne">
  49. <text class="line1" :style="[nameColor]">{{item.name}}</text>
  50. </view>
  51. </view>
  52. </view>
  53. </view>
  54. <!-- 样式三 -->
  55. <view class="group-bottom four acea-row " v-if="listStyle == 2" :style="[...boxBgStyle]">
  56. <scroll-view scroll-x="true" class="scroll_view">
  57. <view v-for="(item, index) in goodList" :key="index" class="four-item" :style="[fourStyle]"
  58. @click="goGoodsDetail(item)">
  59. <view class="group-bottom-left mb-20">
  60. <view class="img acea-row row-center row-middle four-img relative" :style="[contentStyle]">
  61. <view v-show="item.stock===0" class="sellOut">已售罄</view>
  62. <easy-loadimage :image-src="item.image" width="224rpx" height="224rpx"
  63. :radius="10"></easy-loadimage>
  64. </view>
  65. </view>
  66. <PointsPrice :pointsPrice="item" :pointsGoodsStyle="hotPointsStyle1" v-model="isShowSamll">
  67. </PointsPrice>
  68. </view>
  69. </scroll-view>
  70. </view>
  71. </view>
  72. </view>
  73. </template>
  74. <script>
  75. import {
  76. mapState,
  77. mapGetters
  78. } from 'vuex';
  79. let app = getApp();
  80. import {
  81. integralProductHotApi
  82. } from '@/api/activity.js'
  83. import easyLoadimage from '@/components/base/easy-loadimage.vue';
  84. import PointsPrice from '@/components/PointsPrice.vue';
  85. import {
  86. goProductDetail
  87. } from "@/libs/order";
  88. export default {
  89. name: 'homeIntergral',
  90. components: {
  91. easyLoadimage,
  92. PointsPrice
  93. },
  94. props: {
  95. dataConfig: {
  96. type: Object,
  97. default: () => {}
  98. },
  99. },
  100. computed: {
  101. //容器样式
  102. //最外层盒子的样式
  103. boxStyle() {
  104. return [{
  105. 'border-radius': this.dataConfig.bgStyle.val ? 2 * this.dataConfig.bgStyle.val + 'rpx' : '0'
  106. },
  107. {
  108. margin: 0 + ' ' + 2 * this.dataConfig.lrConfig.val +
  109. 'rpx' + ' ' +
  110. 0
  111. },
  112. ];
  113. },
  114. //边距
  115. boxPadding() {
  116. return [{
  117. padding: 2 * this.dataConfig.upConfig.val + 'rpx' + ' ' + '0px' + ' ' + 2 * this.dataConfig
  118. .downConfig
  119. .val +
  120. 'rpx',
  121. },
  122. {
  123. margin: 2 * this.dataConfig.mbConfig.val + 'rpx' + ' ' + 0 + ' ' + 0
  124. },
  125. ]
  126. },
  127. //背景颜色
  128. boxBgStyle() {
  129. return [{
  130. background: `linear-gradient(to right,${this.dataConfig.contentBgColor.color[0].item}, ${this.dataConfig.contentBgColor.color[1].item})`,
  131. },
  132. {
  133. gap: `${2*this.dataConfig.contentConfig.val}rpx`
  134. }
  135. ];
  136. },
  137. fourStyle() {
  138. return {
  139. 'margin-right': this.listStyle == 2 ? `${2*this.dataConfig.contentConfig.val}rpx` : ''
  140. }
  141. },
  142. //头部按钮颜色
  143. headerBtnColor() {
  144. return {
  145. color: this.dataConfig.headerBtnColor.color[0].item,
  146. };
  147. },
  148. //商品名称颜色
  149. nameColor() {
  150. return {
  151. color: this.dataConfig.nameColor.color[0].item,
  152. };
  153. },
  154. //拼团价格颜色
  155. priceColor() {
  156. return {
  157. color: this.dataConfig.themeStyleConfig.tabVal?this.dataConfig.priceColor.color[0].item:this.themeColor,
  158. };
  159. },
  160. //图片圆角
  161. contentStyle() {
  162. return {
  163. 'border-radius': this.dataConfig.contentStyle.val ? 2 * this.dataConfig.contentStyle.val + 'rpx' : '0',
  164. };
  165. },
  166. //样式一内容边距
  167. contentConfig() {
  168. return {
  169. 'margin-top': 2 * this.dataConfig.contentConfig.val + 'rpx',
  170. };
  171. },
  172. //背景图片
  173. bgImgStyle() {
  174. return {
  175. 'background-image': this.selectBgImg == 0 ? `url(${this.bgImgUrl})` :
  176. `linear-gradient(to right,${this.dataConfig.bgColor.color[0].item}, ${this.dataConfig.bgColor.color[1].item})`,
  177. };
  178. },
  179. //标题文字格式
  180. headerTitleConfig() {
  181. return [{
  182. 'font-weight': this.headerTitleStyle == 0 ? 600 : ''
  183. },
  184. {
  185. 'font-style': this.headerTitleStyle == 2 ? 'italic' : 'normal'
  186. },
  187. {
  188. color: this.dataConfig.headerTitleColor.color[0].item,
  189. }
  190. ]
  191. }
  192. },
  193. data() {
  194. return {
  195. isShowSamll: true,
  196. listStyle: 0,
  197. logoUrl: null,
  198. groupBtnShow: true,
  199. selectStyle: '',
  200. titleConfig: '',
  201. selectBgImg: '',
  202. bgImgUrl: '',
  203. headerTitleStyle: 0,
  204. old: {
  205. scrollTop: 0
  206. },
  207. goodList: [],
  208. hotPointsStyle: {
  209. iconStyle: {
  210. width: '32rpx',
  211. height: '32rpx'
  212. },
  213. priceStyle: {
  214. fontSize: '32rpx',
  215. },
  216. unitStyle: {
  217. fontSize: '28rpx',
  218. },
  219. priceColor: this.priceColor
  220. },
  221. hotPointsStyle1: {
  222. iconStyle: {
  223. width: '28rpx',
  224. height: '28rpx'
  225. },
  226. priceStyle: {
  227. fontSize: '28rpx',
  228. },
  229. unitStyle: {
  230. fontSize: '24rpx',
  231. },
  232. priceColor: this.priceColor
  233. },
  234. themeColor:this.$options.filters.filterTheme(app.globalData.theme)
  235. }
  236. },
  237. created() {
  238. this.setConfig()
  239. this.getStoreIntegral()
  240. },
  241. methods: {
  242. //跳商品详情
  243. goGoodsDetail(item) {
  244. goProductDetail(item.id, 0, '', 1)
  245. },
  246. //热门推荐
  247. getStoreIntegral() {
  248. integralProductHotApi({
  249. page: 1,
  250. limit: 6,
  251. }).then(res => {
  252. this.goodList = res.data.list;
  253. this.integral = res.data.integral;
  254. })
  255. },
  256. toIntergralList() {
  257. uni.navigateTo({
  258. url: '/pages/activity/points_mall/index'
  259. })
  260. },
  261. setConfig() {
  262. this.listStyle = this.dataConfig.itemStyle.tabVal;
  263. this.logoUrl = this.dataConfig.logoConfig.url;
  264. this.selectStyle = this.dataConfig.selectStyle.tabVal;
  265. this.titleConfig = this.dataConfig.titleConfig.val;
  266. this.selectBgImg = this.dataConfig.selectBgImg.tabVal;
  267. this.bgImgUrl = this.dataConfig.bgImg.url;
  268. this.headerTitleStyle = this.dataConfig.headerTitleStyle.tabVal;
  269. this.hotPointsStyle.priceColor = {
  270. color: this.dataConfig.themeStyleConfig.tabVal?this.dataConfig.priceColor.color[0].item:this.themeColor,
  271. }
  272. this.hotPointsStyle1.priceColor = {
  273. color: this.dataConfig.themeStyleConfig.tabVal?this.dataConfig.priceColor.color[0].item:this.themeColor,
  274. }
  275. },
  276. },
  277. }
  278. </script>
  279. <style lang="scss" scoped>
  280. .groupBox {
  281. overflow: hidden;
  282. .group {
  283. overflow: hidden;
  284. .group-top {
  285. width: 100%;
  286. height: 100rpx;
  287. background-repeat: no-repeat;
  288. background-size: cover;
  289. padding: 0 24rpx;
  290. .group-top-left {
  291. .logo {
  292. width: 154rpx;
  293. height: 32rpx;
  294. }
  295. .interval {
  296. width: 0rpx;
  297. height: 32rpx;
  298. border: 2rpx solid rgba(255, 255, 255, 0.6);
  299. margin-left: 10rpx;
  300. }
  301. .pinkHead {
  302. width: 108rpx;
  303. height: 36rpx;
  304. }
  305. .num {
  306. height: 32rpx;
  307. line-height: 32rpx;
  308. font-size: 26rpx;
  309. color: #FFFFFF;
  310. }
  311. }
  312. .group-top-right {
  313. height: 32rpx;
  314. line-height: 32rpx;
  315. font-size: 24rpx;
  316. .icon-xuanze {
  317. font-size: 24rpx;
  318. }
  319. }
  320. }
  321. .group-bottom {
  322. width: 100%;
  323. padding: 20rpx;
  324. .img {
  325. //width: 240rpx;
  326. // height: 240rpx;
  327. // background: #F3F9FF;
  328. .shan {
  329. // width: 130rpx;
  330. // height: 100rpx;
  331. }
  332. }
  333. .big-img.img {
  334. width: 100%;
  335. height: 322rpx;
  336. }
  337. .three-img.img {
  338. width: 100%;
  339. // height: 200rpx;
  340. }
  341. .four-img {
  342. //width: 240rpx;
  343. height: 240rpx;
  344. }
  345. .group-bottom-right {
  346. width: 400rpx;
  347. .right-top {
  348. .title {
  349. font-size: 28rpx;
  350. color: #333333;
  351. }
  352. .pink {
  353. margin-top: 16rpx;
  354. font-size: 22rpx;
  355. .people {
  356. color: #fff;
  357. padding: 4rpx 12rpx;
  358. border-radius: 8rpx 0 0 8rpx;
  359. }
  360. .groupNum {
  361. color: #E93323;
  362. background: rgba(211, 56, 42, 0.1);
  363. padding: 4rpx 12rpx;
  364. border-radius: 0 8rpx 8rpx 0;
  365. }
  366. }
  367. }
  368. .right-bottom {
  369. .price {
  370. .pinkNum {
  371. image {
  372. vertical-align: middle;
  373. }
  374. .pinkNum-num {
  375. font-weight: 600;
  376. font-size: 36rpx;
  377. }
  378. }
  379. .num {
  380. color: #999999;
  381. }
  382. }
  383. .btnBox {
  384. margin-top: 16rpx;
  385. font-size: 22rpx;
  386. .btn {
  387. padding: 12rpx 20rpx;
  388. border-radius: 50rpx;
  389. }
  390. }
  391. }
  392. }
  393. }
  394. .group-bottom.two {
  395. .two-item {
  396. width: 100%;
  397. .title {
  398. margin-top: 16rpx;
  399. .numPink {
  400. color: #ffffff;
  401. padding: 4rpx 12rpx;
  402. border-radius: 0 8rpx 8rpx 0;
  403. font-size: 22rpx;
  404. width: 82rpx;
  405. }
  406. .line1 {
  407. width: 300rpx;
  408. margin-left: 10rpx;
  409. }
  410. }
  411. .two-item-bottom {
  412. margin-top: 20rpx;
  413. .pinkNum {
  414. .num {
  415. font-weight: 600;
  416. font-size: 36rpx;
  417. }
  418. }
  419. .otNum {
  420. font-size: 26rpx;
  421. color: #999999;
  422. text-decoration-line: line-through;
  423. }
  424. .btnBox {
  425. margin-top: 16rpx;
  426. font-size: 22rpx;
  427. .btn {
  428. padding: 12rpx 24rpx;
  429. border-radius: 50rpx;
  430. }
  431. }
  432. }
  433. }
  434. }
  435. .group-bottom.three {
  436. .numPink {
  437. position: absolute;
  438. color: #ffffff;
  439. padding: 4rpx 12rpx;
  440. border-radius: 0 8rpx 8rpx 0;
  441. font-size: 22rpx;
  442. }
  443. .two-item {
  444. width: 100%;
  445. .title {
  446. width: 100%;
  447. .numPink {
  448. color: #ffffff;
  449. padding: 4rpx 12rpx;
  450. border-radius: 0 8rpx 8rpx 0;
  451. font-size: 22rpx;
  452. width: 82rpx;
  453. }
  454. .line1 {
  455. width: 200rpx;
  456. margin-left: 10rpx;
  457. }
  458. }
  459. .two-item-bottom {
  460. margin-top: 20rpx;
  461. // width: 100%;
  462. .pinkNum {
  463. .num {
  464. font-weight: 600;
  465. font-size: 36rpx;
  466. }
  467. }
  468. .otNum {
  469. font-size: 26rpx;
  470. color: #999999;
  471. text-decoration-line: line-through;
  472. }
  473. .btnBox {
  474. margin-top: 16rpx;
  475. font-size: 22rpx;
  476. .btn {
  477. padding: 12rpx 24rpx;
  478. border-radius: 50rpx;
  479. }
  480. }
  481. }
  482. }
  483. }
  484. .group-bottom.four {
  485. overflow: hidden;
  486. flex-wrap: nowrap;
  487. position: relative;
  488. .numPink {
  489. position: absolute;
  490. color: #ffffff;
  491. padding: 4rpx 12rpx;
  492. border-radius: 0 8rpx 8rpx 0;
  493. font-size: 22rpx;
  494. }
  495. .two-item {
  496. width: 224rpx;
  497. .title {
  498. margin-top: 18rpx;
  499. .numPink {
  500. color: #ffffff;
  501. padding: 4rpx 12rpx;
  502. border-radius: 0 8rpx 8rpx 0;
  503. font-size: 22rpx;
  504. width: 82rpx;
  505. }
  506. .line1 {
  507. width: 210rpx;
  508. margin-left: 10rpx;
  509. }
  510. }
  511. .two-item-bottom {
  512. margin-top: 20rpx;
  513. .pinkNum {
  514. .num {
  515. font-weight: 600;
  516. font-size: 36rpx;
  517. }
  518. }
  519. .otNum {
  520. font-size: 26rpx;
  521. text-decoration-line: line-through;
  522. }
  523. .btnBox {
  524. margin-top: 16rpx;
  525. font-size: 22rpx;
  526. .btn {
  527. padding: 12rpx 24rpx;
  528. border-radius: 50rpx;
  529. }
  530. }
  531. }
  532. }
  533. }
  534. }
  535. .price {
  536. display: flex;
  537. flex-direction: column;
  538. justify-content: flex-end;
  539. }
  540. .grid-list {
  541. //display: grid !important;
  542. grid-template-columns: repeat(2, 1fr);
  543. grid-template-rows: auto;
  544. width: 100%;
  545. }
  546. .grid-three {
  547. //display: grid !important;
  548. grid-template-columns: repeat(3, 1fr);
  549. grid-template-rows: auto;
  550. width: 100%;
  551. //justify-content: space-between;
  552. .three-box {
  553. width: 208rpx;
  554. }
  555. }
  556. }
  557. .f-s-16 {
  558. font-size: 32rpx !important;
  559. }
  560. .f-s-14 {
  561. font-size: 28rpx !important;
  562. }
  563. .titleFont {
  564. font-size: 32rpx !important;
  565. }
  566. .priceNum-img {
  567. width: 28rpx;
  568. height: 28rpx;
  569. margin-right: 8rpx
  570. }
  571. .semiBold {
  572. font-weight: 600;
  573. }
  574. .scroll_view {
  575. white-space: nowrap;
  576. .four-item {
  577. display: inline-block;
  578. color: #999999;
  579. }
  580. }
  581. </style>