presale.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542
  1. <template>
  2. <view v-if="productList.length">
  3. <common-wrapper :config="configData">
  4. <view>
  5. <!-- 预售头部 -->
  6. <view
  7. class="w-full h-96 px-24 flex-between-center bg-cover"
  8. :style="[headerStyle]"
  9. >
  10. <view class="flex-y-center">
  11. <text
  12. class="fs-32 lh-44rpx fw-500"
  13. :style="[titleStyle]"
  14. v-if="titleConfig"
  15. >{{ titleTxtConfig }}</text
  16. >
  17. <image :src="titleImg" class="w-140 h-32" v-else></image>
  18. <text class="fs-28 text--w111-ccc px-16" :style="[dividerColor]"
  19. >|</text
  20. >
  21. <text class="fs-26 text--w111-999 lh-36rpx" :style="[tipsColor]">{{
  22. tipTxt
  23. }}</text>
  24. </view>
  25. <view
  26. class="flex-y-center fs-24 text--w111-999"
  27. :style="[headerBntColor]"
  28. @tap="goPage('/pages/activity/presell/index')"
  29. >
  30. <text>{{ rightBntTxt }}</text>
  31. <text
  32. class="iconfont icon-ic_rightarrow fs-24"
  33. :style="[headerBntColor]"
  34. ></text>
  35. </view>
  36. </view>
  37. <!-- 预售列表 -->
  38. <!-- 单列 -->
  39. <view
  40. class="pt-32 pr-20 pb-32 pl-20 bg--w111-fff"
  41. :style="[boxContentStyle]"
  42. v-if="goodStyleConfig == 0"
  43. >
  44. <view
  45. class="w-full flex justify-between item"
  46. v-for="(item, index) in productList"
  47. :key="index"
  48. @tap="goDetails(item)"
  49. >
  50. <easy-loadimage
  51. :image-src="item.image"
  52. width="240rpx"
  53. height="240rpx"
  54. :borderRadius="imgStyle"
  55. ></easy-loadimage>
  56. <view class="flex-1 flex-col justify-between pl-20 h-240">
  57. <view
  58. class="w-full fs-28 h-80 lh-40rpx line2"
  59. :style="[productStyle]"
  60. v-if="checkboxInfo.includes(0)"
  61. >{{ item.store_name }}</view
  62. >
  63. <view
  64. class="flex w-full h-68 rd-8rpx relative"
  65. :style="{ background: dataConfig.goodsBntColor.color[0].item }"
  66. v-if="!showBtn"
  67. >
  68. <view
  69. class="flex-y-center pl-20 fs-22 btn-left"
  70. :style="{ color: dataConfig.goodsBntColor.color[0].item }"
  71. >
  72. <!-- v-if="checkboxInfo.includes(2)" -->
  73. <baseMoney
  74. :money="item.price"
  75. symbolSize="26"
  76. integerSize="40"
  77. decimalSize="26"
  78. weight
  79. preFix="预售:"
  80. preFixSize="22"
  81. :textColor="priceColor"
  82. :color="priceColor"
  83. ></baseMoney>
  84. </view>
  85. <view
  86. class="flex-center fs-26 fw-bold text--w111-fff btn-right"
  87. :style="[btnBgColor]"
  88. >{{ item.presale_pay_status | filterType }}</view
  89. >
  90. <image
  91. class="shandian"
  92. src="@/static/images/presale.png"
  93. ></image>
  94. </view>
  95. </view>
  96. </view>
  97. </view>
  98. <!-- 两列 -->
  99. <view
  100. class="grid-column-2 grid-gap-22rpx pt-32 pr-20 pb-32 pl-20"
  101. :style="[boxContentStyle]"
  102. v-if="goodStyleConfig == 1"
  103. >
  104. <view
  105. v-for="(item, index) in productList"
  106. :key="index"
  107. @tap="goDetails(item)"
  108. >
  109. <easy-loadimage
  110. :image-src="item.image"
  111. width="100%"
  112. height="324rpx"
  113. :borderRadius="imgStyle"
  114. ></easy-loadimage>
  115. <view
  116. class="w-full line2 mt-16 fs-28 lh-40rpx"
  117. :style="[productStyle]"
  118. v-if="checkboxInfo.includes(0)"
  119. >{{ item.store_name }}</view
  120. >
  121. <view class="flex justify-between items-end mt-10">
  122. <view class="flex-col">
  123. <baseMoney
  124. :money="item.price"
  125. symbolSize="24"
  126. integerSize="36"
  127. decimalSize="36"
  128. weight
  129. :color="priceColor"
  130. v-if="checkboxInfo.includes(2)"
  131. ></baseMoney>
  132. <text
  133. class="text-line fs-26 text--w111-999 pt-14 Regular"
  134. :style="[otPriceColor]"
  135. >{{ $t(`¥`) }}{{ item.ot_price }}</text
  136. >
  137. </view>
  138. <view
  139. class="w-144 h-56 rd-30rpx flex-center fs-24 text--w111-fff bg--w111-E93323"
  140. v-if="!showBtn"
  141. :style="[btnBgColor]"
  142. >去预定</view
  143. >
  144. </view>
  145. </view>
  146. </view>
  147. <!-- 三列 -->
  148. <view
  149. class="grid-column-3 grid-gap-18rpx pt-32 pr-20 pb-32 pl-20"
  150. :style="[boxContentStyle]"
  151. v-if="goodStyleConfig == 2"
  152. >
  153. <view
  154. v-for="(item, index) in productList"
  155. :key="index"
  156. @tap="goDetails(item)"
  157. >
  158. <easy-loadimage
  159. :image-src="item.image"
  160. width="100%"
  161. height="212rpx"
  162. :borderRadius="imgStyle"
  163. ></easy-loadimage>
  164. <view
  165. class="w-full line1 mt-16 fs-26"
  166. :style="[productStyle]"
  167. v-if="checkboxInfo.includes(0)"
  168. >{{ item.store_name }}</view
  169. >
  170. <view class="flex items-baseline mt-12">
  171. <baseMoney
  172. :money="item.price"
  173. symbolSize="24"
  174. integerSize="36"
  175. decimalSize="36"
  176. weight
  177. :color="priceColor"
  178. preFix="预售价"
  179. preFixSize="22"
  180. :textColor="priceColor"
  181. v-if="checkboxInfo.includes(2)"
  182. ></baseMoney>
  183. </view>
  184. <view
  185. class="text-line fs-24 text--w111-999 Regular lh-32rpx"
  186. :style="[otPriceColor]"
  187. v-if="checkboxInfo.includes(3)"
  188. >{{ $t(`¥`) }}{{ item.ot_price }}</view
  189. >
  190. </view>
  191. </view>
  192. <!-- 滑动 -->
  193. <scroll-view
  194. scroll-x="true"
  195. show-scrollbar="false"
  196. class="white-nowrap vertical-middle w-full pt-32 pb-32"
  197. :style="[boxContentStyle]"
  198. v-if="goodStyleConfig == 3"
  199. >
  200. <view
  201. class="inline-block ml-20"
  202. v-for="(item, index) in productList"
  203. :key="index"
  204. @tap="goDetails(item)"
  205. >
  206. <easy-loadimage
  207. :image-src="item.image"
  208. width="224rpx"
  209. height="224rpx"
  210. :borderRadius="imgStyle"
  211. ></easy-loadimage>
  212. <view
  213. class="w-222 line1 mt-16 fs-26"
  214. :style="[productStyle]"
  215. v-if="checkboxInfo.includes(0)"
  216. >{{ item.store_name }}</view
  217. >
  218. <view class="flex items-baseline mt-12">
  219. <baseMoney
  220. :money="item.price"
  221. symbolSize="24"
  222. integerSize="36"
  223. decimalSize="36"
  224. weight
  225. :color="priceColor"
  226. preFix="预售价"
  227. preFixSize="22"
  228. :textColor="priceColor"
  229. v-if="checkboxInfo.includes(2)"
  230. ></baseMoney>
  231. </view>
  232. <view
  233. class="text-line fs-24 text--w111-999 Regular lh-32rpx"
  234. :style="[otPriceColor]"
  235. v-if="checkboxInfo.includes(3)"
  236. >{{ $t(`¥`) }}{{ item.ot_price }}</view
  237. >
  238. </view>
  239. </scroll-view>
  240. </view>
  241. </common-wrapper>
  242. </view>
  243. </template>
  244. <script>
  245. import commonWrapper from "./commonWrapper.vue";
  246. import { getAdvancellList } from "@/api/activity.js";
  247. export default {
  248. components: { commonWrapper },
  249. name: "presale",
  250. props: {
  251. dataConfig: {
  252. type: Object,
  253. default: () => {},
  254. },
  255. isSortType: {
  256. type: String | Number,
  257. default: 0,
  258. },
  259. },
  260. filters: {
  261. filterType(val) {
  262. let obj = {
  263. 1: "未开始",
  264. 2: "进行中",
  265. 3: "已结束",
  266. };
  267. return obj[val];
  268. },
  269. },
  270. data() {
  271. return {
  272. productList: [],
  273. };
  274. },
  275. computed: {
  276. configData() {
  277. return {
  278. ...this.dataConfig,
  279. paddingConfig: this.dataConfig.paddingConfig || {
  280. isAll: false,
  281. valList: [
  282. {
  283. val: this.dataConfig.topConfig
  284. ? this.dataConfig.topConfig.val
  285. : 0,
  286. },
  287. {
  288. val: this.dataConfig.prConfig ? this.dataConfig.prConfig.val : 0,
  289. },
  290. {
  291. val: this.dataConfig.bottomConfig
  292. ? this.dataConfig.bottomConfig.val
  293. : 0,
  294. },
  295. {
  296. val: this.dataConfig.prConfig ? this.dataConfig.prConfig.val : 0,
  297. },
  298. ],
  299. },
  300. marginConfig: this.dataConfig.marginConfig || {
  301. isAll: false,
  302. valList: [
  303. {
  304. val: this.dataConfig.mbConfig ? this.dataConfig.mbConfig.val : 0,
  305. },
  306. {
  307. val: 0,
  308. },
  309. {
  310. val: 0,
  311. },
  312. {
  313. val: 0,
  314. },
  315. ],
  316. },
  317. };
  318. },
  319. titleStyle() {
  320. let titleText = this.dataConfig.titleText;
  321. return {
  322. fontStyle: !titleText.tabVal
  323. ? "normal"
  324. : titleText.tabList[titleText.tabVal].style,
  325. fontWeight: !titleText.tabVal ? "bold" : "normal",
  326. color: this.dataConfig.titleColor.color[0].item,
  327. fontSize: this.dataConfig.titleNumber.val * 2 + "rpx",
  328. };
  329. },
  330. // boxStyle(){
  331. // return {
  332. // padding: `${this.dataConfig.topConfig.val * 2}rpx ${this.dataConfig.prConfig.val * 2}rpx ${this.dataConfig.bottomConfig.val * 2}rpx`,
  333. // marginTop: `${this.dataConfig.mbConfig.val * 2}rpx`,
  334. // background: this.dataConfig.bottomBgColor.color[0].item,
  335. // }
  336. // },
  337. boxContentStyle() {
  338. let br = `${this.dataConfig.fillet.val * 2}rpx`;
  339. let borderRadius = `0 0 ${br} ${br}`;
  340. if (this.dataConfig.fillet.type) {
  341. borderRadius = `0 0 ${this.dataConfig.fillet.valList[3].val * 2}rpx ${
  342. this.dataConfig.fillet.valList[2].val * 2
  343. }rpx`;
  344. }
  345. return {
  346. borderRadius,
  347. background: `linear-gradient(90deg, ${this.dataConfig.moduleColor.color[0].item} 0%, ${this.dataConfig.moduleColor.color[1].item} 100%)`,
  348. };
  349. },
  350. /*商品模板*/
  351. goodStyleConfig() {
  352. return this.dataConfig.goodStyleConfig.tabVal;
  353. },
  354. styleConfig() {
  355. return this.dataConfig.styleConfig.tabVal;
  356. },
  357. headerStyle() {
  358. let br = `${this.dataConfig.fillet.val * 2}rpx`,
  359. borderRadius = "",
  360. imgBgUrl = this.dataConfig.imgBgConfig.url;
  361. if (this.dataConfig.fillet.type) {
  362. borderRadius = `${this.dataConfig.fillet.valList[0].val * 2}rpx ${
  363. this.dataConfig.fillet.valList[1].val * 2
  364. }rpx 0 0`;
  365. } else {
  366. borderRadius = `${br} ${br} 0 0`;
  367. }
  368. return {
  369. backgroundImage: this.styleConfig
  370. ? "url(" + imgBgUrl + ")"
  371. : `linear-gradient(90deg,${this.dataConfig.headerBgColor.color[0].item} 0%,${this.dataConfig.headerBgColor.color[1].item} 100%)`,
  372. borderRadius,
  373. };
  374. },
  375. /*标题是文本还是图片*/
  376. titleConfig() {
  377. return this.dataConfig.titleConfig.tabVal;
  378. },
  379. /*标题文本*/
  380. titleTxtConfig() {
  381. return this.dataConfig.titleTxtConfig.value;
  382. },
  383. /*标题图片*/
  384. titleImg() {
  385. return this.styleConfig ? this.titleUrl : this.titleColorUrl;
  386. },
  387. titleColorUrl() {
  388. return this.dataConfig.imgColorConfig.url;
  389. },
  390. titleUrl() {
  391. return this.dataConfig.imgConfig.url;
  392. },
  393. /*标题提示文字*/
  394. tipsColor() {
  395. return {
  396. color: this.styleConfig
  397. ? this.dataConfig.tipsColor.color[0].item
  398. : this.dataConfig.tipsColor2.color[0].item,
  399. };
  400. },
  401. /*分割线颜色*/
  402. dividerColor() {
  403. return {
  404. color: this.dataConfig.dividerColor.color[0].item,
  405. };
  406. },
  407. /*头部提示语文本*/
  408. tipTxt() {
  409. return this.dataConfig.tipTxtConfig.value;
  410. },
  411. /*头部按钮文本*/
  412. rightBntTxt() {
  413. return this.dataConfig.rightBntConfig.value;
  414. },
  415. /*头部按钮样式*/
  416. headerBntColor() {
  417. return {
  418. color: this.styleConfig
  419. ? this.dataConfig.headerBntColor.color[0].item
  420. : this.dataConfig.headerBntColor2.color[0].item,
  421. fontSize: `${this.dataConfig.bntNumber.val * 2}rpx`,
  422. };
  423. },
  424. /*商品图片圆角样式*/
  425. imgStyle() {
  426. let borderRadius = `${this.dataConfig.filletImg.val * 2}rpx`;
  427. if (this.dataConfig.filletImg.type) {
  428. borderRadius = `${this.dataConfig.filletImg.valList[0].val * 2}rpx ${
  429. this.dataConfig.filletImg.valList[1].val * 2
  430. }rpx ${this.dataConfig.filletImg.valList[3].val * 2}rpx ${
  431. this.dataConfig.filletImg.valList[2].val * 2
  432. }rpx`;
  433. }
  434. return borderRadius;
  435. },
  436. /*商品名称样式*/
  437. productStyle() {
  438. return {
  439. color: this.dataConfig.goodsNameColor.color[0].item,
  440. fontWeight: this.dataConfig.goodsName.tabVal ? "normal" : "bold",
  441. };
  442. },
  443. /* 展示信息 */
  444. checkboxInfo() {
  445. return this.dataConfig.checkboxInfo.type;
  446. },
  447. /* 价格颜色 */
  448. priceColor() {
  449. return this.dataConfig.toneConfig.tabVal
  450. ? this.dataConfig.presalePriceColor.color[0].item
  451. : "var(--view-theme)";
  452. },
  453. /* 划线价颜色 */
  454. otPriceColor() {
  455. return this.dataConfig.goodsPriceColor.color[0].item;
  456. },
  457. showBtn() {
  458. return this.dataConfig.presaleConfig.tabVal;
  459. },
  460. /* 按钮颜色 */
  461. btnBgColor() {
  462. return {
  463. background: this.dataConfig.toneConfig.tabVal
  464. ? `linear-gradient(90deg,${this.dataConfig.goodsBntColor.color[0].item} 0%,${this.dataConfig.goodsBntColor.color[1].item} 100%)`
  465. : "linear-gradient(90deg, var(--view-theme) 0%, var(--view-gradient) 100%)",
  466. };
  467. },
  468. /*商品数量*/
  469. numberConfig() {
  470. return this.dataConfig.numberConfig.val;
  471. },
  472. },
  473. mounted() {
  474. this.getList();
  475. },
  476. methods: {
  477. goPage(url) {
  478. uni.navigateTo({
  479. url,
  480. });
  481. },
  482. getList() {
  483. let limit = this.$config.LIMIT;
  484. getAdvancellList({
  485. page: 1,
  486. limit: this.numberConfig >= limit ? limit : this.numberConfig,
  487. time_type: 0,
  488. }).then((res) => {
  489. this.productList = res.data.list;
  490. });
  491. },
  492. goDetails(item) {
  493. uni.navigateTo({
  494. url: `/pages/activity/goods_details/index?id=${item.id}&type=6`,
  495. });
  496. },
  497. },
  498. };
  499. </script>
  500. <style lang="scss">
  501. .Regular {
  502. font-family: "Regular";
  503. }
  504. .bg-cover {
  505. background-repeat: no-repeat;
  506. background-size: 100% 100%;
  507. }
  508. .item ~ .item {
  509. margin-top: 32rpx;
  510. }
  511. .badge {
  512. width: 152rpx;
  513. height: 26rpx;
  514. background: linear-gradient(90deg, #ff7931 0%, #e93323 100%);
  515. border-radius: 20rpx;
  516. display: inline-flex;
  517. justify-content: center;
  518. align-items: center;
  519. margin: 16rpx 0;
  520. }
  521. .btn-left {
  522. width: 60%;
  523. border-radius: 8rpx 0 0 8rpx;
  524. background: rgba(255, 255, 255, 0.9);
  525. }
  526. .btn-right {
  527. width: 40%;
  528. border-radius: 0 8rpx 8rpx 0;
  529. }
  530. .shandian {
  531. width: 48rpx;
  532. height: 74rpx;
  533. position: absolute;
  534. // transform: scale(1.1);
  535. left: 60%;
  536. top: 0;
  537. margin-top: -2rpx;
  538. margin-left: -22rpx;
  539. }
  540. </style>