cyy-vue-material 7.0.19 → 7.0.21

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/dist/index.js +1 -1
  2. package/package.json +34 -34
  3. package/src/App.vue +149 -149
  4. package/src/api/http.js +16 -16
  5. package/src/api/index.js +21 -21
  6. package/src/api/urlQuery.js +20 -20
  7. package/src/common/js/constant.js +5 -5
  8. package/src/common/js/index.js +1 -1
  9. package/src/components/vop-label.vue +29 -29
  10. package/src/index.dev.js +4 -4
  11. package/src/package/cyy-ArsenalActivity/components/u-cont-down.vue +316 -316
  12. package/src/package/cyy-ArsenalActivity/components/u-line-progress.vue +150 -150
  13. package/src/package/cyy-ArsenalActivity/cyy-ArsenalActivity.vue +820 -820
  14. package/src/package/cyy-ArsenalCarousel/cyy-ArsenalCarousel.vue +137 -137
  15. package/src/package/cyy-ArsenalClass/cyy-ArsenalClass.vue +564 -564
  16. package/src/package/cyy-ArsenalMyNavigation/cyy-ArsenalMyNavigation.vue +128 -125
  17. package/src/package/cyy-ArsenalMyTop/cyy-ArsenalMyTop.vue +211 -211
  18. package/src/package/cyy-ArsenalNavigation/cyy-ArsenalNavigation.vue +236 -236
  19. package/src/package/cyy-ArsenalPicture/cyy-ArsenalPicture.vue +228 -228
  20. package/src/package/cyy-ArsenalPromotion/cyy-ArsenalPromotion.vue +913 -899
  21. package/src/package/cyy-ArsenalRecommend/cyy-ArsenalRecommend.vue +56 -56
  22. package/src/package/cyy-ArsenalTop/cyy-ArsenalTop.vue +328 -328
  23. package/src/package/cyy-collocation/cyy-collocation.vue +639 -639
  24. package/src/package/cyy-goods/cyy-goods.vue +317 -317
  25. package/src/package/cyy-goodsOne/consult.vue +267 -267
  26. package/src/package/cyy-goodsOne/cyy-goodsOne.vue +217 -217
  27. package/src/package/cyy-image/cyy-image.vue +64 -64
  28. package/src/package/cyy-live/cyy-live.vue +196 -196
  29. package/src/package/cyy-new-product/cyy-new-product.vue +834 -834
  30. package/src/package/cyy-notice/cyy-notice.vue +137 -137
  31. package/src/package/cyy-search/cyy-search.vue +57 -57
  32. package/src/package/cyy-slider/cyy-slider.vue +117 -117
  33. package/src/package/cyy-title/cyy-title.vue +38 -38
  34. package/src/package/cyy-video/cyy-video.vue +49 -49
  35. package/src/package/index.js +21 -21
  36. package/src/utils/checkEnv.js +16 -16
  37. package/src/utils/fetchFactory.js +100 -100
  38. package/src/utils/index.js +2 -2
@@ -1,899 +1,913 @@
1
- <template>
2
- <div>
3
- <div>
4
- <div
5
- class="classTitle"
6
- :style="{ backgroundColor: props.bgColor }"
7
- v-if="scrollTop > 20 || isLc"
8
- >
9
- <span
10
- class="classTitleItem"
11
- v-for="(ele, index) in classDomainList"
12
- :key="ele.goodsClassId"
13
- :style="{
14
- height: props.navigationHeight + 'px',
15
- lineHeight: props.navigationHeight + 'px',
16
- fontSize: props.navigationFontSize + 'px',
17
- }"
18
- >
19
- <span
20
- class="classSpan"
21
- @click="checkClass(index)"
22
- :style="{
23
- background:
24
- checkClassIndex === index ? props.getBgColor : props.bgColor,
25
- color:
26
- checkClassIndex === index
27
- ? props.getfontColor
28
- : props.fontColor,
29
- }"
30
- >{{ ele.goodsChangeClassName }}</span
31
- >
32
- </span>
33
- </div>
34
- <scroll-view
35
- scroll-y="true"
36
- scroll-with-animation="true"
37
- @scroll="handleScroll"
38
- :scroll-into-view="targetId"
39
- style="height: 100vh"
40
- >
41
- <template v-if="props.headImg">
42
- <img v-if="isLc" class="headerImg" :src="props.headImg" />
43
- <image
44
- v-else
45
- class="headerImg"
46
- :src="props.headImg"
47
- mode="widthFix"
48
- ></image>
49
- </template>
50
- <div class="classContent">
51
- <div
52
- class="classContentItem"
53
- v-for="(ele, index) in classDomainList"
54
- :key="ele.goodsClassId"
55
- :id="'item-' + index"
56
- >
57
- <div
58
- v-if="!ele.classfooterImg"
59
- class="classContentSpan"
60
- :style="{
61
- paddingTop: ele.titleMt + 'px',
62
- paddingBottom: ele.titleBt + 'px',
63
- backgroundColor: ele.bgColor,
64
- }"
65
- >
66
- <img
67
- style="
68
- display: inline-block;
69
- width: 15px;
70
- height: 15px;
71
- margin-right: 2px;
72
- margin-top: 3px;
73
- "
74
- v-if="ele.iconFlag"
75
- :src="
76
- ele.goodsClassLogo
77
- ? ele.goodsClassLogo.indexOf('http') === -1
78
- ? domainNameUrl + ele.goodsClassLogo
79
- : ele.goodsClassLogo
80
- : ''
81
- "
82
- />
83
- <span
84
- v-if="ele.goodsClassNameFlag"
85
- :style="{
86
- color: ele.titleColor,
87
- fontSize: ele.titleFontSize + 'px',
88
- }"
89
- >
90
- {{ ele.goodsChangeClassName }}
91
- </span>
92
- </div>
93
- <div
94
- v-else
95
- class="classContentImgBox"
96
- :style="{
97
- paddingTop: ele.titleMt + 'px',
98
- paddingBottom: ele.titleBt + 'px',
99
- backgroundColor: ele.bgColor,
100
- }"
101
- >
102
- <img
103
- v-if="isLc"
104
- class="classContentImg"
105
- :src="ele.classfooterImg"
106
- />
107
- <image
108
- v-else
109
- class="classContentImg"
110
- :src="ele.classfooterImg"
111
- mode="widthFix"
112
- ></image>
113
- <div class="text-overlay">
114
- <img
115
- style="
116
- display: inline-block;
117
- width: 15px;
118
- height: 15px;
119
- margin-right: 2px;
120
- margin-top: 3px;
121
- "
122
- v-if="ele.iconFlag"
123
- :src="
124
- ele.goodsClassLogo
125
- ? ele.goodsClassLogo.indexOf('http') === -1
126
- ? domainNameUrl + ele.goodsClassLogo
127
- : ele.goodsClassLogo
128
- : ''
129
- "
130
- />
131
- <span
132
- v-if="ele.goodsClassNameFlag"
133
- :style="{
134
- color: ele.titleColor,
135
- fontSize: ele.titleFontSize + 'px',
136
- }"
137
- >
138
- {{ ele.goodsChangeClassName }}
139
- </span>
140
- <!-- 类型为代金券的时候显示 -->
141
- <div class="coupon" v-if="ele.promotionType == '4' && ele.couponData">
142
- <div class="left">
143
- <div class="card">代金券</div>
144
- <div class="price">面额 {{ele.couponData.condOnceNums}} 元</div>
145
- </div>
146
- <div class="right">
147
- <div class="right-container">
148
- <span class="discount">满{{ele.couponData.condAmount}}减 {{ ele.couponData.condOnceNums }}</span>
149
- <span class="date">{{getTime(ele.couponData.receiveStart)}}至{{ getTime(ele.couponData.receiveEnd) }}</span>
150
- </div>
151
- <!-- <span class="not_btn">已领取</span>
152
- <span class="not_btn">已超期</span> -->
153
- <span class="get_btn" @click="getWelfare(ele.goodsClassId)">点击领取</span>
154
- </div>
155
- </div>
156
- </div>
157
- </div>
158
-
159
- <!-- 商品 -->
160
- <div
161
- :class="[
162
- 'cube-container',
163
- `arrange-${ele.showTitle}`,
164
- { isLc: isLc },
165
- ]"
166
- :style="{
167
- backgroundColor: ele.goodsBgColor,
168
- }"
169
- >
170
- <div
171
- v-for="(item, index) in ele.goodsList"
172
- class="cube-item"
173
- :style="{
174
- marginTop: `${ele.goodsMt}px`,
175
- marginBottom: `${ele.goodsBt}px`,
176
- }"
177
- :key="item.skuCode"
178
- @click="goGoodsDetail(item)"
179
- >
180
- <div class="imgWrapper">
181
- <div
182
- v-if="
183
- isLc === false &&
184
- (item.goodsSupplynum <= 0 || item.goodsProperty5 === '1')
185
- "
186
- class="imgMarked"
187
- :style="{
188
- borderRadius: `${ele.borderRaduils}px`,
189
- }"
190
- >
191
- <div class="maskState">
192
- {{ getMaskState(item.goodsProperty5) }}
193
- </div>
194
- </div>
195
- <img
196
- class="goodsImg"
197
- :src="
198
- item.dataPic
199
- ? item.dataPic.indexOf('http') === -1
200
- ? domainNameUrl + item.dataPic
201
- : item.dataPic
202
- : ''
203
- "
204
- alt=""
205
- :style="{
206
- borderRadius: `${ele.borderRaduils}px`,
207
- }"
208
- />
209
- </div>
210
- <div class="goodsDescription">
211
- <div
212
- v-if="isLc === true && ele.showTitle === 2"
213
- class="specialGoodsName"
214
- :style="{
215
- marginTop: ele.goodsSpacingFlag ? '5px' : '0',
216
- marginBottom: ele.goodsSpacingFlag ? '5px' : '0',
217
- }"
218
- >
219
- {{ item.goodsName }}
220
- </div>
221
- <div
222
- v-else
223
- class="goodsName"
224
- :style="{
225
- marginTop: ele.goodsSpacingFlag ? '5px' : '0',
226
- marginBottom: ele.goodsSpacingFlag ? '5px' : '0',
227
- }"
228
- >
229
- {{ item.goodsName }}
230
- </div>
231
- <section
232
- class="footerContent"
233
- :style="{
234
- marginTop: ele.goodsSpacingFlag ? '5px' : '0',
235
- marginBottom: ele.goodsSpacingFlag ? '5px' : '0',
236
- }"
237
- >
238
- <div class="goodsPrice">
239
- ¥{{ item.pricesetNprice }}
240
- <div class="scribing" v-if="ele.underLineFlag === 1">
241
- ¥{{ item.pricesetMakeprice }}
242
- </div>
243
- </div>
244
- <div class="goodsBuy">
245
- <img
246
- src="https://rcyx-platform-test.yoxuan.vip/paas/shop/2021011200000001/2025-05-14/car.png"
247
- @click.stop="addShoppingShow(item)"
248
- style="height: 25px; width: 25px"
249
- />
250
- </div>
251
- </section>
252
- </div>
253
- </div>
254
- </div>
255
- <button class="moreBtn" v-if="!isLc" @click="loadMore(ele, index)">
256
- 查看更多
257
- </button>
258
- </div>
259
- </div>
260
- </scroll-view>
261
- <!-- -->
262
- </div>
263
- </div>
264
- </template>
265
-
266
- <script>
267
- import { isLc, getUrl, fetchGoodImpl } from "../../utils/index.js";
268
- import {
269
- find,
270
- querySkuFromJm,
271
- queryPromotionByCodeAndCheckUser,
272
- } from "../../api/index.js";
273
- import { fetchPost } from "../../api/http.js";
274
- import { query } from "../../api/urlQuery.js";
275
- import { isEmpty, isUndefined } from "lodash-es";
276
- export default {
277
- name: "cyy-ArsenalPromotion",
278
- // bgColor: "#08fc29", //标题背景颜色
279
- // goodsBgColor // 商品背景颜色
280
- // goodsClassNameFlag: 0, //分类名称显示隐藏
281
- // titleColor: "#08fc29", //分类标题颜色
282
- // titleFontSize: 20, //分类标题字号
283
- // titleMt: 20, //分类标题上边距
284
- // titleBt: 20, //分类标题下边距
285
- // iconFlag: 1, //分类Icon显示隐藏
286
- // iconSize: 20, //分类标题大小
287
- // classfooterImg: "", //分类底图
288
- // showTitle: 1, //展示风格
289
- // underLineFlag: 1, //划线价显示隐藏
290
- // borderRaduils: 1, //边角样式
291
- // goodsSpacingFlag: 1, //商品间距(有/无)
292
- // goodsMt: 20, //商品上边距
293
- // goodsBt: 20, //商品下边距
294
- // synchronousOther: false, //同步其他
295
- // changeGoodsType: 1, // 选择商品或分类商品 1分类2商品
296
- // changeGoodsStr: '', // 选择的商品数据
297
- props: {
298
- props: {
299
- compName: String, //组件名称
300
- headImg: String, //头部展示图
301
- classList: Array, //选择分类
302
- promotionType: Number, //促销类型
303
- carIcon: Number, //购物车图标
304
- bgColor: String, //导航栏背景颜色
305
- getBgColor: String, //已选导航背景颜色
306
- fontColor: String, //导航字体颜色
307
- getfontColor: String, //已选导航字体颜色
308
- navigationHeight: Number, //导航栏高度
309
- navigationFontSize: Number, //导航栏字号
310
- classDomainList: Array, //分类项配置集合
311
- },
312
- },
313
- data() {
314
- return {
315
- classTitleStyle: {
316
- height: this.props.navigationHeight + "px",
317
- lineHeight: this.props.navigationHeight + "px",
318
- fontSize: this.props.navigationFontSize + "px",
319
- },
320
- classDomainList: [],
321
- domainNameUrl: "",
322
- isLc: isLc,
323
- checkClassIndex: -1,
324
- targetId: "",
325
- scrollTop: 0,
326
- page: 1,
327
- rows: 12,
328
- };
329
- },
330
- mounted() {
331
- this.domainNameUrl = getUrl(this);
332
- this.classDomainList = JSON.parse(
333
- JSON.stringify(this.props.classDomainList)
334
- );
335
- this.initgoods();
336
- },
337
- computed: {},
338
- methods: {
339
- initgoods() {
340
- let that = this;
341
- if (isLc) {
342
- return this.LcGetGoodsList(that);
343
- }
344
- return this.getGoodsList(that);
345
- },
346
- async LcGetGoodsList(that) {
347
- // 遍历classDomainList
348
- let tempList = that.classDomainList;
349
- for (let item of tempList) {
350
- const url = `${queryPromotionByCodeAndCheckUser}?promotionCode=${item.goodsClassId}`;
351
- let result = await fetchPost(url)
352
- console.log(result,'result')
353
- // URL 中获取 channelCode
354
- const urlParams = new URLSearchParams(
355
- window.location.hash.split("?")[1] || window.location.search
356
- );
357
- const channelCode = urlParams.get("channelCode") || "";
358
- if (result && result.length > 0 && result[0].pbCode == '0003' && result[0].activationMode == '1') {
359
- console.log("代金券")
360
- item.promotionType = 4
361
- const couponData = {
362
- promotionBegintime: result[0].promotionBegintime, // 代金券开始时间
363
- promotionEndtime: result[0].promotionEndtime, // 代金券结束时间
364
- receiveStart: result[0].receiveStart, // 代金券领取开始时间
365
- receiveEnd: result[0].receiveEnd, // 代金券领取结束时间
366
- promotionFrequency: result[0].promotionFrequency, // 领取次数 0为不限制
367
- condAmount: result[0].pmPromotionConditionList[0].condAmount, // 领取条件
368
- condOnceNums: result[0].pmPromotionConditionList[0].condOnceNums // 优惠面额
369
- }
370
- item.couponData = couponData
371
- }
372
- if (result && result.length > 0 && result[0].rangeType == 5) {
373
- let skuNoList = []
374
- const firstItem = result[0];
375
- console.log(firstItem,'firstItem')
376
- firstItem.pmPromotionRangeList.forEach(item => {
377
- skuNoList.push(item.rangeCode);
378
- })
379
- console.log(skuNoList,'skuNoList')
380
- const url = `${find}?skuNo=${skuNoList.join()}&rows=12&page=1`;
381
- const res = await fetchPost(url);
382
- item.goodsList = res.list
383
- console.log(item,'商品')
384
-
385
- } else if (result && result.length > 0 && result[0].rangeType == 0) {
386
- // 全部商品
387
- const url = `${find}?rows=12&page=1`;
388
- const res = await fetchPost(url);
389
- item.goodsList = res.list
390
- console.log(item,'商品')
391
- }
392
-
393
-
394
- }
395
- that.classDomainList = tempList;
396
- },
397
- async getGoodsList(that) {
398
- console.log(that.classDomainList,'活动')
399
- // 遍历classDomainList
400
- for (let item of that.classDomainList) {
401
- // 调用getNotice方法,传入classtreeCode
402
- let params = {
403
- promotionCode: item.goodsClassId,
404
- };
405
- let result = await that.http.get(`${queryPromotionByCodeAndCheckUser}`, params);
406
- // 如果是代金券并且用户领取
407
- if (result && result.length > 0 && result[0].pbCode == '0003' && result[0].activationMode == '1') {
408
- console.log("代金券")
409
- that.$set(item, "promotionType", 4);
410
- const couponData = {
411
- promotionBegintime: result[0].promotionBegintime, // 代金券开始时间
412
- promotionEndtime: result[0].promotionEndtime, // 代金券结束时间
413
- receiveStart: result[0].receiveStart, // 代金券领取开始时间
414
- receiveEnd: result[0].receiveEnd, // 代金券领取结束时间
415
- promotionFrequency: result[0].promotionFrequency, // 领取次数 0为不限制
416
- condAmount: result[0].pmPromotionConditionList[0].condAmount, // 领取条件
417
- condOnceNums: result[0].pmPromotionConditionList[0].condOnceNums // 优惠面额
418
- }
419
- that.$set(item, "couponData", couponData);
420
- }
421
- // 部分商品
422
- if (result && result.length > 0 && result[0].rangeType == 5) {
423
- let skuNoList = []
424
- const firstItem = result[0];
425
- console.log(firstItem,'firstItem')
426
- firstItem.pmPromotionRangeList.forEach(item => {
427
- skuNoList.push(item.rangeCode);
428
- })
429
- console.log(skuNoList,'skuNoList')
430
- let paramObj = {
431
- skuNo: skuNoList.join()
432
- }
433
- const res = await that.getGoodsImpl()(this, paramObj, this.page);
434
- that.$set(item, "goodsList", res.list);
435
- that.$set(item, "skuNoList", skuNoList.join());
436
- that.$set(item, "page", 1);
437
- console.log(item,'商品')
438
-
439
- } else if (result && result.length > 0 && result[0].rangeType == 0) {
440
- // 全部商品
441
- const res = await that.getGoodsImpl()(this, {}, this.page);
442
- that.$set(item, "goodsList", res.list);
443
- that.$set(item, "page", 1);
444
- that.$set(item, "total", res.total);
445
- console.log(item,'商品')
446
- }
447
- }
448
- },
449
- async loadMore(ele, idx) {
450
- console.log(ele, idx, "加载当前活动商品");
451
- if (ele.skuNoList) {
452
- let paramObj = {
453
- skuNo: ele.skuNoList
454
- };
455
- let totalNum = ele.skuNoList.split(',').length;
456
- if (Math.ceil(totalNum / this.rows) > ele.page) {
457
- console.log("分页加载")
458
- ele.page++;
459
- const res = await this.getGoodsImpl()(this, paramObj, ele.page);
460
- this.$set(ele, "goodsList", [...ele.goodsList,...res.list]);
461
- this.$set(ele, "page",ele.page);
462
- } else {
463
- if (!isLc) {
464
- uni.$u.toast("没有更多了~");
465
- }
466
-
467
- }
468
- } else {
469
- console.log("全部商品")
470
- if (Math.ceil(ele.total / this.rows) > ele.page) {
471
- console.log("分页加载----全部商品")
472
- ele.page++;
473
- const res = await this.getGoodsImpl()(this, {}, ele.page);
474
- this.$set(ele, "goodsList", [...ele.goodsList,...res.list]);
475
- this.$set(ele, "page", ele.page);
476
- } else {
477
- if (!isLc) {
478
- uni.$u.toast("没有更多了~");
479
- }
480
- }
481
- }
482
-
483
- },
484
- getGoodsImpl() {
485
- console.log(99999);
486
- const uniIo = async (that, paramObj, page) => {
487
- const { list, total } = await that.http.get(
488
- `web/es/searchengine/find.json?rows=12&page=${page}`,
489
- paramObj
490
- );
491
- if (paramObj.hasOwnProperty('skuNo')) {
492
- const skuCodeList = paramObj.skuNo.split(",");
493
- let sortedArrays = [];
494
-
495
- skuCodeList.forEach((skuNo) => {
496
- list.forEach((item) => {
497
- if (item.skuNo === skuNo) {
498
- sortedArrays.push(item);
499
- }
500
- });
501
- });
502
- console.log("findList", sortedArrays);
503
- return { list: sortedArrays, total };
504
- } else {
505
- return { list, total };
506
- }
507
-
508
-
509
- };
510
- const fetchIO = async (that, paramObj) => {
511
- const { id, goods } = that.props;
512
- if (isEmpty(goods)) return Promise.resolve({ list: [] });
513
-
514
- const isEqualFlag = handleCache(that);
515
-
516
- if (isEqualFlag) {
517
- return Promise.resolve(fetchGoodsInfo(id));
518
- }
519
- // URL 中获取 channelCode
520
- const urlParams = new URLSearchParams(
521
- window.location.hash.split("?")[1] || window.location.search
522
- );
523
- const channelCode = urlParams.get("channelCode") || "";
524
- const saasToken = localStorage.getItem("saas-token");
525
- return await fetch(
526
- getUrl() +
527
- find +
528
- "?rows=12&page=1&skuNo=" +
529
- paramObj.skuNo +
530
- "&channelCode=" +
531
- channelCode,
532
- {
533
- method: "GET",
534
- headers: {
535
- "saas-token": saasToken,
536
- "user-agent":
537
- "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36",
538
- "Content-Type": "application/x-www-form-urlencoded;charset=UTF-8",
539
- },
540
- credentials: "include",
541
- }
542
- )
543
- .then((response) => response.json())
544
- .then((res = {}) => {
545
- setGoodsInfo(id, goods, res);
546
- console.log("Pc数据----res")
547
- return res;
548
- });
549
- };
550
-
551
- if (isLc) {
552
- return fetchIO;
553
- }
554
- return uniIo;
555
- },
556
- //点击领取优惠券
557
- async getWelfare(promotionCode) {
558
- if (!isLc) {
559
- this.$emit("getWelfare", promotionCode)
560
- }
561
- },
562
- getTime(timestamp) {
563
- let date = new Date(timestamp);
564
- // 格式化为年月日的格式
565
- let year = date.getFullYear();
566
- let month = String(date.getMonth() + 1).padStart(2, '0'); // 月份从0开始,需要加1,并且确保月份是两位数
567
- let day = String(date.getDate()).padStart(2, '0'); // 确保日期是两位数
568
- return `${year}-${month}-${day}`;
569
- },
570
- checkClass(index) {
571
- this.checkClassIndex = index;
572
- this.targetId = `item-${index}`;
573
- },
574
- addShoppingShow(el) {
575
- if (isLc) {
576
- return;
577
- }
578
- this.$emit("addShoppingShow", el);
579
- },
580
- getMaskState(state) {
581
- if (state === "1") {
582
- return "预售中";
583
- } else {
584
- return "补货中";
585
- }
586
- },
587
- getTextStyle(item) {
588
- return {
589
- color: item.titleColor || "#000000",
590
- fontSize: item.titleFontSize || "16px",
591
- };
592
- },
593
- goGoodsDetail(item) {
594
- if (isLc) {
595
- return;
596
- }
597
- const { skuCode } = item;
598
- let params = {
599
- skuNo: skuCode,
600
- };
601
- this.$routers.push("detail", params);
602
- },
603
- handleScroll(e) {
604
- this.scrollTop = e.detail.scrollTop;
605
- },
606
- },
607
- };
608
- </script>
609
- <style lang="less" scoped>
610
- .headerImg {
611
- width: 100%;
612
- }
613
- .classTitle {
614
- overflow-x: scroll;
615
- white-space: nowrap;
616
- padding: 0 12px;
617
- .classTitleItem {
618
- margin-right: 10px;
619
- .classSpan {
620
- border-radius: 20px;
621
- padding: 4px 12px;
622
- }
623
- }
624
- }
625
- .classContent {
626
- .classContentItem {
627
- .classContentSpan {
628
- display: flex;
629
- justify-content: center;
630
- padding: 30px 0;
631
- }
632
- .classContentImg {
633
- width: 100%;
634
- }
635
- .classContentImgBox {
636
- position: relative;
637
- width: 100%;
638
- .classContentImg {
639
- width: 100%;
640
- height: auto;
641
- display: block;
642
- }
643
- .text-overlay {
644
- position: absolute;
645
- top: 0;
646
- left: 0;
647
- width: 100%;
648
- height: 100%;
649
- display: flex;
650
- justify-content: center;
651
- align-items: center;
652
- flex-direction: column;
653
- .coupon {
654
- display: flex;
655
- position: relative;
656
- height: 90px;
657
- margin-top: 20px;
658
- width: 100%;
659
- padding: 3px 0;
660
- background: url('https://qjstatic.oss-cn-shanghai.aliyuncs.com/SZRC/image/youhuibg.png') no-repeat;
661
- background-size: 352px 98px;
662
- .left {
663
- width: 34%;
664
- height: 90px;
665
- display: flex;
666
- flex-direction: column;
667
- justify-content: center;
668
- align-items: center;
669
- .card {
670
- font-size: 20px;
671
- color: #eb5555;
672
- }
673
- .price {
674
- font-size: 12px;
675
- color: #888;
676
- }
677
- }
678
- .right {
679
- height: 90px;
680
- display: flex;
681
- justify-content: center;
682
- align-items: center;
683
- margin-left: 0;
684
- .right-container {
685
- display: flex;
686
- flex-direction: column;
687
- justify-content: space-around;
688
- }
689
-
690
- .date {
691
- margin-top: 15px;
692
- font-size: 12px;
693
- color: #888;
694
- }
695
- .get_btn,.not_btn {
696
- width: 68px;
697
- height: 20px;
698
- line-height: 20px;
699
- text-align: center;
700
- color: #f1f1f1;
701
- border-radius: 20px;
702
- }
703
- .get_btn {
704
- background-color: #eb5555;
705
- }
706
- .not_btn {
707
- background-color: #ccc;
708
- }
709
- }
710
- }
711
- }
712
- }
713
- }
714
- }
715
- .cube-container {
716
- display: grid;
717
- &.arrange-4 {
718
- display: flex;
719
- justify-content: space-between;
720
- flex-wrap: wrap;
721
- .cube-item {
722
- flex: 0 0 auto;
723
- width: 30%;
724
- max-width: 30%;
725
- .goodsImg {
726
- width: 100%;
727
- height: 100%;
728
- aspect-ratio: 1;
729
- }
730
- .goodsDescription {
731
- .goodsPrice {
732
- font-size: 18px;
733
- .scribing {
734
- font-size: 14px;
735
- }
736
- }
737
- .goodsName {
738
- font-size: 20px;
739
- }
740
- }
741
- }
742
- .cube-item:not(:last-child) {
743
- margin-right: 10px;
744
- }
745
- }
746
- &.arrange-3 {
747
- display: flex;
748
- overflow-x: scroll;
749
- .cube-item {
750
- flex: 0 0 auto;
751
- width: 32%;
752
- max-width: 32%;
753
- .goodsImg {
754
- width: 100%;
755
- height: 100%;
756
- aspect-ratio: 1;
757
- }
758
- .goodsDescription {
759
- .goodsPrice {
760
- font-size: 18px;
761
- .scribing {
762
- font-size: 14px;
763
- }
764
- }
765
- .goodsName {
766
- font-size: 20px;
767
- }
768
- }
769
- }
770
- .cube-item:not(:last-child) {
771
- margin-right: 10px;
772
- }
773
- }
774
- &.arrange-2 {
775
- grid-template-columns: repeat(2, 1fr);
776
- .cube-item {
777
- margin: 0 5px;
778
- .goodsImg {
779
- width: 100%;
780
- height: 100%;
781
- aspect-ratio: 1;
782
- }
783
- .goodsDescription {
784
- position: relative;
785
- .goodsName {
786
- font-size: 16px;
787
- height: 42px;
788
- width: 41vw;
789
- }
790
- .specialGoodsName {
791
- font-size: 12px;
792
- height: 42px;
793
- }
794
- .footerContent {
795
- .goodsPrice {
796
- font-size: 14px;
797
- .scribing {
798
- font-size: 12px;
799
- }
800
- }
801
- }
802
- }
803
- }
804
- }
805
- &.arrange-1 {
806
- .cube-item {
807
- display: flex;
808
- justify-content: space-around;
809
- height: 100px;
810
-
811
- .imgWrapper {
812
- .goodsImg {
813
- width: 100px;
814
- height: 100px;
815
- }
816
- }
817
-
818
- .goodsDescription {
819
- position: relative;
820
- width: 100%;
821
- margin-left: 20px;
822
- .goodsName {
823
- height: auto;
824
- font-size: 16px;
825
- }
826
- .footerContent {
827
- .goodsPrice {
828
- font-size: 16px;
829
- .scribing {
830
- font-size: 12px;
831
- }
832
- }
833
- }
834
- .goodsBuyWrapper {
835
- position: relative;
836
- .goodsBuy {
837
- position: absolute;
838
- top: 0;
839
- right: 0;
840
- }
841
- }
842
- }
843
- }
844
- }
845
-
846
- .cube-item {
847
- .imgWrapper {
848
- position: relative;
849
- text-align: center;
850
- }
851
- .imgMarked {
852
- position: absolute;
853
- top: 0;
854
- left: 0;
855
- width: 100%;
856
- height: 100%;
857
- background-color: rgba(0, 0, 0, 0.5);
858
- display: flex;
859
- justify-content: center;
860
- align-items: center;
861
- z-index: 100;
862
- .maskState {
863
- font-size: 23px;
864
- color: white;
865
- }
866
- }
867
- .goodsDescription {
868
- display: flex;
869
- flex-direction: column;
870
- justify-content: space-between;
871
- .goodsName {
872
- display: -webkit-box;
873
- -webkit-line-clamp: 2;
874
- -webkit-box-orient: vertical;
875
- overflow: hidden;
876
- text-overflow: ellipsis;
877
- }
878
- .footerContent {
879
- display: flex;
880
- justify-content: space-between;
881
- align-items: flex-end;
882
- .goodsPrice {
883
- color: #f53a50;
884
- font-weight: 600;
885
- .scribing {
886
- display: inline-block;
887
- color: #ccc;
888
- text-decoration: line-through;
889
- font-weight: normal;
890
- }
891
- }
892
- }
893
-
894
- .goodsBuy {
895
- }
896
- }
897
- }
898
- }
899
- </style>
1
+ <template>
2
+ <div>
3
+ <div>
4
+ <div
5
+ class="classTitle"
6
+ :style="{ backgroundColor: props.bgColor }"
7
+ v-if="scrollTop > 20 || isLc"
8
+ >
9
+ <span
10
+ class="classTitleItem"
11
+ v-for="(ele, index) in classDomainList"
12
+ :key="ele.goodsClassId"
13
+ :style="{
14
+ height: props.navigationHeight + 'px',
15
+ lineHeight: props.navigationHeight + 'px',
16
+ fontSize: props.navigationFontSize + 'px',
17
+ }"
18
+ >
19
+ <span
20
+ v-if="ele.goodsList && ele.goodsList.length > 0"
21
+ class="classSpan"
22
+ @click="checkClass(index)"
23
+ :style="{
24
+ background:
25
+ checkClassIndex === index ? props.getBgColor : props.bgColor,
26
+ color:
27
+ checkClassIndex === index
28
+ ? props.getfontColor
29
+ : props.fontColor,
30
+ }"
31
+ >{{ ele.goodsChangeClassName }}</span
32
+ >
33
+ </span>
34
+ </div>
35
+ <scroll-view
36
+ scroll-y="true"
37
+ scroll-with-animation="true"
38
+ @scroll="handleScroll"
39
+ :scroll-into-view="targetId"
40
+ style="height: 100vh"
41
+ >
42
+ <template v-if="props.headImg">
43
+ <img v-if="isLc" class="headerImg" :src="props.headImg" />
44
+ <image
45
+ v-else
46
+ class="headerImg"
47
+ :src="props.headImg"
48
+ mode="widthFix"
49
+ ></image>
50
+ </template>
51
+ <div class="classContent">
52
+ <div
53
+ class="classContentItem"
54
+ v-for="(ele, index) in classDomainList"
55
+ :key="ele.goodsClassId"
56
+ :id="'item-' + index"
57
+ >
58
+ <div v-if="ele.goodsList && ele.goodsList.length > 0">
59
+ <div
60
+ v-if="!ele.classfooterImg"
61
+ class="classContentSpan"
62
+ :style="{
63
+ paddingTop: ele.titleMt + 'px',
64
+ paddingBottom: ele.titleBt + 'px',
65
+ backgroundColor: ele.bgColor,
66
+ }"
67
+ >
68
+ <img
69
+ style="
70
+ display: inline-block;
71
+ width: 15px;
72
+ height: 15px;
73
+ margin-right: 2px;
74
+ margin-top: 3px;
75
+ "
76
+ v-if="ele.iconFlag"
77
+ :src="
78
+ ele.goodsClassLogo
79
+ ? ele.goodsClassLogo.indexOf('http') === -1
80
+ ? domainNameUrl + ele.goodsClassLogo
81
+ : ele.goodsClassLogo
82
+ : ''
83
+ "
84
+ />
85
+ <span
86
+ v-if="ele.goodsClassNameFlag"
87
+ :style="{
88
+ color: ele.titleColor,
89
+ fontSize: ele.titleFontSize + 'px',
90
+ }"
91
+ >
92
+ {{ ele.goodsChangeClassName }}
93
+ </span>
94
+ </div>
95
+ <div
96
+ v-else
97
+ class="classContentImgBox"
98
+ :style="{
99
+ paddingTop: ele.titleMt + 'px',
100
+ paddingBottom: ele.titleBt + 'px',
101
+ backgroundColor: ele.bgColor,
102
+ }"
103
+ >
104
+ <img
105
+ v-if="isLc"
106
+ class="classContentImg"
107
+ :src="ele.classfooterImg"
108
+ />
109
+ <image
110
+ v-else
111
+ class="classContentImg"
112
+ :src="ele.classfooterImg"
113
+ mode="widthFix"
114
+ ></image>
115
+ <div class="text-overlay">
116
+ <img
117
+ style="
118
+ display: inline-block;
119
+ width: 15px;
120
+ height: 15px;
121
+ margin-right: 2px;
122
+ margin-top: 3px;
123
+ "
124
+ v-if="ele.iconFlag"
125
+ :src="
126
+ ele.goodsClassLogo
127
+ ? ele.goodsClassLogo.indexOf('http') === -1
128
+ ? domainNameUrl + ele.goodsClassLogo
129
+ : ele.goodsClassLogo
130
+ : ''
131
+ "
132
+ />
133
+ <span
134
+ v-if="ele.goodsClassNameFlag"
135
+ :style="{
136
+ color: ele.titleColor,
137
+ fontSize: ele.titleFontSize + 'px',
138
+ }"
139
+ >
140
+ {{ ele.goodsChangeClassName }}
141
+ </span>
142
+ <!-- 类型为代金券的时候显示 -->
143
+ <div class="coupon" v-if="ele.promotionType == '4' && ele.couponData">
144
+ <div class="left">
145
+ <div class="card">代金券</div>
146
+ <div class="price">面额 {{ele.couponData.condOnceNums}} 元</div>
147
+ </div>
148
+ <div class="right">
149
+ <div class="right-container">
150
+ <span class="discount">满{{ele.couponData.condAmount}}减 {{ ele.couponData.condOnceNums }}</span>
151
+ <span class="date">{{getTime(ele.couponData.receiveStart)}}至{{ getTime(ele.couponData.receiveEnd) }}</span>
152
+ </div>
153
+ <!-- <span class="not_btn">已领取</span>
154
+ <span class="not_btn">已超期</span> -->
155
+ <span class="get_btn" @click="getWelfare(ele.goodsClassId)">点击领取</span>
156
+ </div>
157
+ </div>
158
+ </div>
159
+ </div>
160
+
161
+ <!-- 商品 -->
162
+ <div
163
+ :class="[
164
+ 'cube-container',
165
+ `arrange-${ele.showTitle}`,
166
+ { isLc: isLc },
167
+ ]"
168
+ :style="{
169
+ backgroundColor: ele.goodsBgColor,
170
+ }"
171
+ >
172
+ <div
173
+ v-for="(item, index) in ele.goodsList"
174
+ class="cube-item"
175
+ :style="{
176
+ marginTop: `${ele.goodsMt}px`,
177
+ marginBottom: `${ele.goodsBt}px`,
178
+ }"
179
+ :key="item.skuCode"
180
+ @click="goGoodsDetail(item)"
181
+ >
182
+ <div class="imgWrapper">
183
+ <div
184
+ v-if="
185
+ isLc === false &&
186
+ (item.goodsSupplynum <= 0 || item.goodsProperty5 === '1')
187
+ "
188
+ class="imgMarked"
189
+ :style="{
190
+ borderRadius: `${ele.borderRaduils}px`,
191
+ }"
192
+ >
193
+ <div class="maskState">
194
+ {{ getMaskState(item.goodsProperty5) }}
195
+ </div>
196
+ </div>
197
+ <img
198
+ class="goodsImg"
199
+ :src="
200
+ item.dataPic
201
+ ? item.dataPic.indexOf('http') === -1
202
+ ? domainNameUrl + item.dataPic
203
+ : item.dataPic
204
+ : ''
205
+ "
206
+ alt=""
207
+ :style="{
208
+ borderRadius: `${ele.borderRaduils}px`,
209
+ }"
210
+ />
211
+ </div>
212
+ <div class="goodsDescription">
213
+ <div
214
+ v-if="isLc === true && ele.showTitle === 2"
215
+ class="specialGoodsName"
216
+ :style="{
217
+ marginTop: ele.goodsSpacingFlag ? '5px' : '0',
218
+ marginBottom: ele.goodsSpacingFlag ? '5px' : '0',
219
+ }"
220
+ >
221
+ {{ item.goodsName }}
222
+ </div>
223
+ <div
224
+ v-else
225
+ class="goodsName"
226
+ :style="{
227
+ marginTop: ele.goodsSpacingFlag ? '5px' : '0',
228
+ marginBottom: ele.goodsSpacingFlag ? '5px' : '0',
229
+ }"
230
+ >
231
+ {{ item.goodsName }}
232
+ </div>
233
+ <section
234
+ class="footerContent"
235
+ :style="{
236
+ marginTop: ele.goodsSpacingFlag ? '5px' : '0',
237
+ marginBottom: ele.goodsSpacingFlag ? '5px' : '0',
238
+ }"
239
+ >
240
+ <div class="goodsPrice">
241
+ ¥{{ item.pricesetNprice }}
242
+ <div class="scribing" v-if="ele.underLineFlag === 1">
243
+ ¥{{ item.pricesetMakeprice }}
244
+ </div>
245
+ </div>
246
+ <div class="goodsBuy">
247
+ <img
248
+ src="https://rcyx-platform-test.yoxuan.vip/paas/shop/2021011200000001/2025-05-14/car.png"
249
+ @click.stop="addShoppingShow(item)"
250
+ style="height: 25px; width: 25px"
251
+ />
252
+ </div>
253
+ </section>
254
+ </div>
255
+ </div>
256
+ </div>
257
+ <button class="moreBtn" v-if="!isLc" @click="loadMore(ele, index)">
258
+ 查看更多
259
+ </button>
260
+ </div>
261
+
262
+ </div>
263
+ </div>
264
+ </scroll-view>
265
+ <!-- -->
266
+ </div>
267
+ </div>
268
+ </template>
269
+
270
+ <script>
271
+ import { isLc, getUrl, fetchGoodImpl } from "../../utils/index.js";
272
+ import {
273
+ find,
274
+ querySkuFromJm,
275
+ queryPromotionByCodeAndCheckUser,
276
+ } from "../../api/index.js";
277
+ import { fetchPost } from "../../api/http.js";
278
+ import { query } from "../../api/urlQuery.js";
279
+ import { isEmpty, isUndefined } from "lodash-es";
280
+ export default {
281
+ name: "cyy-ArsenalPromotion",
282
+ // bgColor: "#08fc29", //标题背景颜色
283
+ // goodsBgColor // 商品背景颜色
284
+ // goodsClassNameFlag: 0, //分类名称显示隐藏
285
+ // titleColor: "#08fc29", //分类标题颜色
286
+ // titleFontSize: 20, //分类标题字号
287
+ // titleMt: 20, //分类标题上边距
288
+ // titleBt: 20, //分类标题下边距
289
+ // iconFlag: 1, //分类Icon显示隐藏
290
+ // iconSize: 20, //分类标题大小
291
+ // classfooterImg: "", //分类底图
292
+ // showTitle: 1, //展示风格
293
+ // underLineFlag: 1, //划线价显示隐藏
294
+ // borderRaduils: 1, //边角样式
295
+ // goodsSpacingFlag: 1, //商品间距(有/无)
296
+ // goodsMt: 20, //商品上边距
297
+ // goodsBt: 20, //商品下边距
298
+ // synchronousOther: false, //同步其他
299
+ // changeGoodsType: 1, // 选择商品或分类商品 1分类2商品
300
+ // changeGoodsStr: '', // 选择的商品数据
301
+ props: {
302
+ props: {
303
+ compName: String, //组件名称
304
+ headImg: String, //头部展示图
305
+ classList: Array, //选择分类
306
+ promotionType: Number, //促销类型
307
+ carIcon: Number, //购物车图标
308
+ bgColor: String, //导航栏背景颜色
309
+ getBgColor: String, //已选导航背景颜色
310
+ fontColor: String, //导航字体颜色
311
+ getfontColor: String, //已选导航字体颜色
312
+ navigationHeight: Number, //导航栏高度
313
+ navigationFontSize: Number, //导航栏字号
314
+ classDomainList: Array, //分类项配置集合
315
+ },
316
+ },
317
+ data() {
318
+ return {
319
+ classTitleStyle: {
320
+ height: this.props.navigationHeight + "px",
321
+ lineHeight: this.props.navigationHeight + "px",
322
+ fontSize: this.props.navigationFontSize + "px",
323
+ },
324
+ classDomainList: [],
325
+ domainNameUrl: "",
326
+ isLc: isLc,
327
+ checkClassIndex: -1,
328
+ targetId: "",
329
+ scrollTop: 0,
330
+ page: 1,
331
+ rows: 12,
332
+ };
333
+ },
334
+ mounted() {
335
+ this.domainNameUrl = getUrl(this);
336
+ this.classDomainList = JSON.parse(
337
+ JSON.stringify(this.props.classDomainList)
338
+ );
339
+ this.initgoods();
340
+ },
341
+ computed: {},
342
+ methods: {
343
+ initgoods() {
344
+ let that = this;
345
+ if (isLc) {
346
+ return this.LcGetGoodsList(that);
347
+ }
348
+ return this.getGoodsList(that);
349
+ },
350
+ async LcGetGoodsList(that) {
351
+ // 遍历classDomainList
352
+ let tempList = that.classDomainList;
353
+ for (let item of tempList) {
354
+ const url = `${queryPromotionByCodeAndCheckUser}?promotionCode=${item.goodsClassId}`;
355
+ let result = await fetchPost(url)
356
+ console.log(result,'result')
357
+ // URL 中获取 channelCode
358
+ const urlParams = new URLSearchParams(
359
+ window.location.hash.split("?")[1] || window.location.search
360
+ );
361
+ const channelCode = urlParams.get("channelCode") || "";
362
+ if (result && result.length > 0 && result[0].pbCode == '0003' && result[0].activationMode == '1') {
363
+ console.log("代金券")
364
+ item.promotionType = 4
365
+ let condAmount = result[0].pmPromotionConditionList ? result[0].pmPromotionConditionList[0].condAmount : ''
366
+ let condOnceNums = result[0].pmPromotionConditionList ? result[0].pmPromotionConditionList[0].condOnceNums : ''
367
+ const couponData = {
368
+ promotionBegintime: result[0].promotionBegintime, // 代金券开始时间
369
+ promotionEndtime: result[0].promotionEndtime, // 代金券结束时间
370
+ receiveStart: result[0].receiveStart, // 代金券领取开始时间
371
+ receiveEnd: result[0].receiveEnd, // 代金券领取结束时间
372
+ promotionFrequency: result[0].promotionFrequency, // 领取次数 0为不限制
373
+ condAmount, // 领取条件
374
+ condOnceNums // 优惠面额
375
+ }
376
+ item.couponData = couponData
377
+ }
378
+ if (result && result.length > 0 && result[0].rangeType == 5) {
379
+ let skuNoList = []
380
+ const firstItem = result[0];
381
+ console.log(firstItem,'firstItem')
382
+ if (firstItem.pmPromotionRangeList && firstItem.pmPromotionRangeList.length > 0) {
383
+ firstItem.pmPromotionRangeList.forEach(item => {
384
+ skuNoList.push(item.rangeCode);
385
+ })
386
+ console.log(skuNoList,'skuNoList')
387
+ const url = `${find}?skuNo=${skuNoList.join()}&rows=12&page=1`;
388
+ const res = await fetchPost(url);
389
+ item.goodsList = res.list
390
+ console.log(item,'商品')
391
+ }
392
+
393
+ } else if (result && result.length > 0 && result[0].rangeType == 0) {
394
+ // 全部商品
395
+ const url = `${find}?rows=12&page=1`;
396
+ const res = await fetchPost(url);
397
+ item.goodsList = res.list
398
+ console.log(item,'商品')
399
+ }
400
+
401
+
402
+ }
403
+ that.classDomainList = tempList;
404
+ },
405
+ async getGoodsList(that) {
406
+ console.log(that.classDomainList,'活动')
407
+ // 遍历classDomainList
408
+ for (let item of that.classDomainList) {
409
+ // 调用getNotice方法,传入classtreeCode
410
+ let params = {
411
+ promotionCode: item.goodsClassId,
412
+ };
413
+ let result = await that.http.get(`${queryPromotionByCodeAndCheckUser}`, params);
414
+ // 如果是代金券并且用户领取
415
+ if (result && result.length > 0 && result[0].pbCode == '0003' && result[0].activationMode == '1') {
416
+ console.log("代金券")
417
+ that.$set(item, "promotionType", 4);
418
+ let condAmount = result[0].pmPromotionConditionList ? result[0].pmPromotionConditionList[0].condAmount : ''
419
+ let condOnceNums = result[0].pmPromotionConditionList ? result[0].pmPromotionConditionList[0].condOnceNums : ''
420
+ const couponData = {
421
+ promotionBegintime: result[0].promotionBegintime, // 代金券开始时间
422
+ promotionEndtime: result[0].promotionEndtime, // 代金券结束时间
423
+ receiveStart: result[0].receiveStart, // 代金券领取开始时间
424
+ receiveEnd: result[0].receiveEnd, // 代金券领取结束时间
425
+ promotionFrequency: result[0].promotionFrequency, // 领取次数 0为不限制
426
+ condAmount, // 领取条件
427
+ condOnceNums // 优惠面额
428
+ }
429
+ that.$set(item, "couponData", couponData);
430
+ }
431
+ // 部分商品
432
+ if (result && result.length > 0 && result[0].rangeType == 5) {
433
+ let skuNoList = []
434
+ const firstItem = result[0];
435
+ console.log(firstItem,'firstItem')
436
+ if (firstItem.pmPromotionRangeList && firstItem.pmPromotionRangeList.length > 0) {
437
+ firstItem.pmPromotionRangeList.forEach(item => {
438
+ skuNoList.push(item.rangeCode);
439
+ })
440
+ console.log(skuNoList,'skuNoList')
441
+ let paramObj = {
442
+ skuNo: skuNoList.join()
443
+ }
444
+ const res = await that.getGoodsImpl()(this, paramObj, this.page);
445
+ that.$set(item, "goodsList", res.list);
446
+ that.$set(item, "skuNoList", skuNoList.join());
447
+ that.$set(item, "page", 1);
448
+ console.log(item,'商品111')
449
+ } else {
450
+ that.$set(item, "goodsList", []);
451
+ }
452
+
453
+ } else if (result && result.length > 0 && result[0].rangeType == 0) {
454
+ // 全部商品
455
+ const res = await that.getGoodsImpl()(this, {}, this.page);
456
+ that.$set(item, "goodsList", res.list);
457
+ that.$set(item, "page", 1);
458
+ that.$set(item, "total", res.total);
459
+ console.log(item,'商品')
460
+ }
461
+ }
462
+ },
463
+ async loadMore(ele, idx) {
464
+ console.log(ele, idx, "加载当前活动商品");
465
+ if (ele.skuNoList) {
466
+ let paramObj = {
467
+ skuNo: ele.skuNoList
468
+ };
469
+ let totalNum = ele.skuNoList.split(',').length;
470
+ if (Math.ceil(totalNum / this.rows) > ele.page) {
471
+ console.log("分页加载")
472
+ ele.page++;
473
+ const res = await this.getGoodsImpl()(this, paramObj, ele.page);
474
+ this.$set(ele, "goodsList", [...ele.goodsList,...res.list]);
475
+ this.$set(ele, "page",ele.page);
476
+ } else {
477
+ if (!isLc) {
478
+ uni.$u.toast("没有更多了~");
479
+ }
480
+
481
+ }
482
+ } else {
483
+ console.log("全部商品")
484
+ if (Math.ceil(ele.total / this.rows) > ele.page) {
485
+ console.log("分页加载----全部商品")
486
+ ele.page++;
487
+ const res = await this.getGoodsImpl()(this, {}, ele.page);
488
+ this.$set(ele, "goodsList", [...ele.goodsList,...res.list]);
489
+ this.$set(ele, "page", ele.page);
490
+ } else {
491
+ if (!isLc) {
492
+ uni.$u.toast("没有更多了~");
493
+ }
494
+ }
495
+ }
496
+
497
+ },
498
+ getGoodsImpl() {
499
+ console.log(99999);
500
+ const uniIo = async (that, paramObj, page) => {
501
+ const { list, total } = await that.http.get(
502
+ `web/es/searchengine/find.json?rows=12&page=${page}`,
503
+ paramObj
504
+ );
505
+ if (paramObj.hasOwnProperty('skuNo')) {
506
+ const skuCodeList = paramObj.skuNo.split(",");
507
+ let sortedArrays = [];
508
+
509
+ skuCodeList.forEach((skuNo) => {
510
+ list.forEach((item) => {
511
+ if (item.skuNo === skuNo) {
512
+ sortedArrays.push(item);
513
+ }
514
+ });
515
+ });
516
+ console.log("findList", sortedArrays);
517
+ return { list: sortedArrays, total };
518
+ } else {
519
+ return { list, total };
520
+ }
521
+
522
+
523
+ };
524
+ const fetchIO = async (that, paramObj) => {
525
+ const { id, goods } = that.props;
526
+ if (isEmpty(goods)) return Promise.resolve({ list: [] });
527
+
528
+ const isEqualFlag = handleCache(that);
529
+
530
+ if (isEqualFlag) {
531
+ return Promise.resolve(fetchGoodsInfo(id));
532
+ }
533
+ // 从 URL 中获取 channelCode
534
+ const urlParams = new URLSearchParams(
535
+ window.location.hash.split("?")[1] || window.location.search
536
+ );
537
+ const channelCode = urlParams.get("channelCode") || "";
538
+ const saasToken = localStorage.getItem("saas-token");
539
+ return await fetch(
540
+ getUrl() +
541
+ find +
542
+ "?rows=12&page=1&skuNo=" +
543
+ paramObj.skuNo +
544
+ "&channelCode=" +
545
+ channelCode,
546
+ {
547
+ method: "GET",
548
+ headers: {
549
+ "saas-token": saasToken,
550
+ "user-agent":
551
+ "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36",
552
+ "Content-Type": "application/x-www-form-urlencoded;charset=UTF-8",
553
+ },
554
+ credentials: "include",
555
+ }
556
+ )
557
+ .then((response) => response.json())
558
+ .then((res = {}) => {
559
+ setGoodsInfo(id, goods, res);
560
+ console.log("Pc数据----res")
561
+ return res;
562
+ });
563
+ };
564
+
565
+ if (isLc) {
566
+ return fetchIO;
567
+ }
568
+ return uniIo;
569
+ },
570
+ //点击领取优惠券
571
+ async getWelfare(promotionCode) {
572
+ if (!isLc) {
573
+ this.$emit("getWelfare", promotionCode)
574
+ }
575
+ },
576
+ getTime(timestamp) {
577
+ let date = new Date(timestamp);
578
+ // 格式化为年月日的格式
579
+ let year = date.getFullYear();
580
+ let month = String(date.getMonth() + 1).padStart(2, '0'); // 月份从0开始,需要加1,并且确保月份是两位数
581
+ let day = String(date.getDate()).padStart(2, '0'); // 确保日期是两位数
582
+ return `${year}-${month}-${day}`;
583
+ },
584
+ checkClass(index) {
585
+ this.checkClassIndex = index;
586
+ this.targetId = `item-${index}`;
587
+ },
588
+ addShoppingShow(el) {
589
+ if (isLc) {
590
+ return;
591
+ }
592
+ this.$emit("addShoppingShow", el);
593
+ },
594
+ getMaskState(state) {
595
+ if (state === "1") {
596
+ return "预售中";
597
+ } else {
598
+ return "补货中";
599
+ }
600
+ },
601
+ getTextStyle(item) {
602
+ return {
603
+ color: item.titleColor || "#000000",
604
+ fontSize: item.titleFontSize || "16px",
605
+ };
606
+ },
607
+ goGoodsDetail(item) {
608
+ if (isLc) {
609
+ return;
610
+ }
611
+ const { skuCode } = item;
612
+ let params = {
613
+ skuNo: skuCode,
614
+ };
615
+ this.$routers.push("detail", params);
616
+ },
617
+ handleScroll(e) {
618
+ this.scrollTop = e.detail.scrollTop;
619
+ },
620
+ },
621
+ };
622
+ </script>
623
+ <style lang="less" scoped>
624
+ .headerImg {
625
+ width: 100%;
626
+ }
627
+ .classTitle {
628
+ overflow-x: scroll;
629
+ white-space: nowrap;
630
+ padding: 0 12px;
631
+ .classTitleItem {
632
+ margin-right: 10px;
633
+ .classSpan {
634
+ border-radius: 20px;
635
+ padding: 4px 12px;
636
+ }
637
+ }
638
+ }
639
+ .classContent {
640
+ .classContentItem {
641
+ .classContentSpan {
642
+ display: flex;
643
+ justify-content: center;
644
+ padding: 30px 0;
645
+ }
646
+ .classContentImg {
647
+ width: 100%;
648
+ }
649
+ .classContentImgBox {
650
+ position: relative;
651
+ width: 100%;
652
+ .classContentImg {
653
+ width: 100%;
654
+ height: auto;
655
+ display: block;
656
+ }
657
+ .text-overlay {
658
+ position: absolute;
659
+ top: 0;
660
+ left: 0;
661
+ width: 100%;
662
+ height: 100%;
663
+ display: flex;
664
+ justify-content: center;
665
+ align-items: center;
666
+ flex-direction: column;
667
+ .coupon {
668
+ display: flex;
669
+ position: relative;
670
+ height: 90px;
671
+ margin-top: 20px;
672
+ width: 100%;
673
+ padding: 3px 0;
674
+ background: url('https://qjstatic.oss-cn-shanghai.aliyuncs.com/SZRC/image/youhuibg.png') no-repeat;
675
+ background-size: 352px 98px;
676
+ .left {
677
+ width: 34%;
678
+ height: 90px;
679
+ display: flex;
680
+ flex-direction: column;
681
+ justify-content: center;
682
+ align-items: center;
683
+ .card {
684
+ font-size: 20px;
685
+ color: #eb5555;
686
+ }
687
+ .price {
688
+ font-size: 12px;
689
+ color: #888;
690
+ }
691
+ }
692
+ .right {
693
+ height: 90px;
694
+ display: flex;
695
+ justify-content: center;
696
+ align-items: center;
697
+ margin-left: 0;
698
+ .right-container {
699
+ display: flex;
700
+ flex-direction: column;
701
+ justify-content: space-around;
702
+ }
703
+
704
+ .date {
705
+ margin-top: 15px;
706
+ font-size: 12px;
707
+ color: #888;
708
+ }
709
+ .get_btn,.not_btn {
710
+ width: 68px;
711
+ height: 20px;
712
+ line-height: 20px;
713
+ text-align: center;
714
+ color: #f1f1f1;
715
+ border-radius: 20px;
716
+ }
717
+ .get_btn {
718
+ background-color: #eb5555;
719
+ }
720
+ .not_btn {
721
+ background-color: #ccc;
722
+ }
723
+ }
724
+ }
725
+ }
726
+ }
727
+ }
728
+ }
729
+ .cube-container {
730
+ display: grid;
731
+ &.arrange-4 {
732
+ display: flex;
733
+ justify-content: space-between;
734
+ flex-wrap: wrap;
735
+ .cube-item {
736
+ flex: 0 0 auto;
737
+ width: 30%;
738
+ max-width: 30%;
739
+ .goodsImg {
740
+ width: 100%;
741
+ height: 100%;
742
+ aspect-ratio: 1;
743
+ }
744
+ .goodsDescription {
745
+ .goodsPrice {
746
+ font-size: 18px;
747
+ .scribing {
748
+ font-size: 14px;
749
+ }
750
+ }
751
+ .goodsName {
752
+ font-size: 20px;
753
+ }
754
+ }
755
+ }
756
+ .cube-item:not(:last-child) {
757
+ margin-right: 10px;
758
+ }
759
+ }
760
+ &.arrange-3 {
761
+ display: flex;
762
+ overflow-x: scroll;
763
+ .cube-item {
764
+ flex: 0 0 auto;
765
+ width: 32%;
766
+ max-width: 32%;
767
+ .goodsImg {
768
+ width: 100%;
769
+ height: 100%;
770
+ aspect-ratio: 1;
771
+ }
772
+ .goodsDescription {
773
+ .goodsPrice {
774
+ font-size: 18px;
775
+ .scribing {
776
+ font-size: 14px;
777
+ }
778
+ }
779
+ .goodsName {
780
+ font-size: 20px;
781
+ }
782
+ }
783
+ }
784
+ .cube-item:not(:last-child) {
785
+ margin-right: 10px;
786
+ }
787
+ }
788
+ &.arrange-2 {
789
+ grid-template-columns: repeat(2, 1fr);
790
+ .cube-item {
791
+ margin: 0 5px;
792
+ .goodsImg {
793
+ width: 100%;
794
+ height: 100%;
795
+ aspect-ratio: 1;
796
+ }
797
+ .goodsDescription {
798
+ position: relative;
799
+ .goodsName {
800
+ font-size: 16px;
801
+ height: 42px;
802
+ width: 41vw;
803
+ }
804
+ .specialGoodsName {
805
+ font-size: 12px;
806
+ height: 42px;
807
+ }
808
+ .footerContent {
809
+ .goodsPrice {
810
+ font-size: 14px;
811
+ .scribing {
812
+ font-size: 12px;
813
+ }
814
+ }
815
+ }
816
+ }
817
+ }
818
+ }
819
+ &.arrange-1 {
820
+ .cube-item {
821
+ display: flex;
822
+ justify-content: space-around;
823
+ height: 100px;
824
+
825
+ .imgWrapper {
826
+ .goodsImg {
827
+ width: 100px;
828
+ height: 100px;
829
+ }
830
+ }
831
+
832
+ .goodsDescription {
833
+ position: relative;
834
+ width: 100%;
835
+ margin-left: 20px;
836
+ .goodsName {
837
+ height: auto;
838
+ font-size: 16px;
839
+ }
840
+ .footerContent {
841
+ .goodsPrice {
842
+ font-size: 16px;
843
+ .scribing {
844
+ font-size: 12px;
845
+ }
846
+ }
847
+ }
848
+ .goodsBuyWrapper {
849
+ position: relative;
850
+ .goodsBuy {
851
+ position: absolute;
852
+ top: 0;
853
+ right: 0;
854
+ }
855
+ }
856
+ }
857
+ }
858
+ }
859
+
860
+ .cube-item {
861
+ .imgWrapper {
862
+ position: relative;
863
+ text-align: center;
864
+ }
865
+ .imgMarked {
866
+ position: absolute;
867
+ top: 0;
868
+ left: 0;
869
+ width: 100%;
870
+ height: 100%;
871
+ background-color: rgba(0, 0, 0, 0.5);
872
+ display: flex;
873
+ justify-content: center;
874
+ align-items: center;
875
+ z-index: 100;
876
+ .maskState {
877
+ font-size: 23px;
878
+ color: white;
879
+ }
880
+ }
881
+ .goodsDescription {
882
+ display: flex;
883
+ flex-direction: column;
884
+ justify-content: space-between;
885
+ .goodsName {
886
+ display: -webkit-box;
887
+ -webkit-line-clamp: 2;
888
+ -webkit-box-orient: vertical;
889
+ overflow: hidden;
890
+ text-overflow: ellipsis;
891
+ }
892
+ .footerContent {
893
+ display: flex;
894
+ justify-content: space-between;
895
+ align-items: flex-end;
896
+ .goodsPrice {
897
+ color: #f53a50;
898
+ font-weight: 600;
899
+ .scribing {
900
+ display: inline-block;
901
+ color: #ccc;
902
+ text-decoration: line-through;
903
+ font-weight: normal;
904
+ }
905
+ }
906
+ }
907
+
908
+ .goodsBuy {
909
+ }
910
+ }
911
+ }
912
+ }
913
+ </style>