xiaoe_mp_npm 1.0.17 → 1.0.19-test01

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 (150) hide show
  1. package/miniprogram_dist/CouponList/couponColumn/index.js +10 -1
  2. package/miniprogram_dist/GoodsItem/index.js +283 -20
  3. package/miniprogram_dist/GoodsItem/index.scss +25 -1
  4. package/miniprogram_dist/GoodsItem/index.wxml +36 -8
  5. package/miniprogram_dist/GoodsItem/index.wxss +88 -0
  6. package/miniprogram_dist/LiveGoodsList/index.js +29 -4
  7. package/miniprogram_dist/LiveGoodsList/index.wxml +7 -4
  8. package/miniprogram_dist/Task/TaskBubble/index.js +146 -146
  9. package/miniprogram_dist/Task/TaskBubble/index.json +3 -3
  10. package/miniprogram_dist/Task/TaskBubble/index.scss +125 -125
  11. package/miniprogram_dist/Task/TaskBubble/index.wxml +22 -22
  12. package/miniprogram_dist/Task/TaskIcon/index.js +29 -29
  13. package/miniprogram_dist/Task/TaskIcon/index.json +4 -4
  14. package/miniprogram_dist/Task/TaskIcon/index.scss +70 -70
  15. package/miniprogram_dist/Task/TaskIcon/index.wxml +5 -5
  16. package/miniprogram_dist/Task/TaskPopup/component/RewardList/index.js +39 -39
  17. package/miniprogram_dist/Task/TaskPopup/component/RewardList/index.json +6 -6
  18. package/miniprogram_dist/Task/TaskPopup/component/RewardList/index.scss +39 -39
  19. package/miniprogram_dist/Task/TaskPopup/component/RewardList/index.wxml +19 -19
  20. package/miniprogram_dist/Task/TaskPopup/component/TaskItem/index.json +5 -5
  21. package/miniprogram_dist/Task/TaskPopup/component/TaskItem/index.scss +139 -139
  22. package/miniprogram_dist/Task/TaskPopup/component/TaskItem/index.wxml +47 -47
  23. package/miniprogram_dist/Task/TaskPopup/component/TaskItem/index.wxs +7 -7
  24. package/miniprogram_dist/Task/TaskPopup/component/TaskList/index.json +7 -7
  25. package/miniprogram_dist/Task/TaskPopup/component/TaskList/index.scss +66 -66
  26. package/miniprogram_dist/Task/TaskPopup/component/TaskType/index.json +9 -9
  27. package/miniprogram_dist/Task/TaskPopup/component/TaskType/index.scss +62 -62
  28. package/miniprogram_dist/Task/TaskPopup/index.json +8 -8
  29. package/miniprogram_dist/Task/TaskPopup/index.scss +140 -140
  30. package/miniprogram_dist/Task/taskReceivePopup/coupon/index.js +52 -52
  31. package/miniprogram_dist/Task/taskReceivePopup/coupon/index.json +6 -6
  32. package/miniprogram_dist/Task/taskReceivePopup/coupon/index.scss +91 -91
  33. package/miniprogram_dist/Task/taskReceivePopup/coupon/index.wxml +58 -58
  34. package/miniprogram_dist/Task/taskReceivePopup/coupon/index.wxs +48 -48
  35. package/miniprogram_dist/Task/taskReceivePopup/customPrizes/index.js +44 -44
  36. package/miniprogram_dist/Task/taskReceivePopup/customPrizes/index.json +6 -6
  37. package/miniprogram_dist/Task/taskReceivePopup/customPrizes/index.scss +106 -106
  38. package/miniprogram_dist/Task/taskReceivePopup/customPrizes/index.wxml +38 -38
  39. package/miniprogram_dist/Task/taskReceivePopup/customPrizes/index.wxs +48 -48
  40. package/miniprogram_dist/Task/taskReceivePopup/index.js +34 -34
  41. package/miniprogram_dist/Task/taskReceivePopup/index.json +13 -13
  42. package/miniprogram_dist/Task/taskReceivePopup/index.wxml +25 -25
  43. package/miniprogram_dist/Task/taskReceivePopup/integral/index.js +61 -61
  44. package/miniprogram_dist/Task/taskReceivePopup/integral/index.json +6 -6
  45. package/miniprogram_dist/Task/taskReceivePopup/integral/index.scss +60 -60
  46. package/miniprogram_dist/Task/taskReceivePopup/integral/index.wxml +12 -12
  47. package/miniprogram_dist/TeacherGoodsList/index.js +41 -7
  48. package/miniprogram_dist/TeacherGoodsList/index.scss +10 -1
  49. package/miniprogram_dist/TeacherGoodsList/index.wxml +21 -15
  50. package/miniprogram_dist/TeacherGoodsList/index.wxss +10 -1
  51. package/miniprogram_dist/common/api/liveGoodsList.js +19 -5
  52. package/package.json +1 -1
  53. package/src/AliveInvite/LiveRoomVertical/index.wxss +252 -252
  54. package/src/CollectionAddress/index.wxss +5 -5
  55. package/src/ConfirmOrder/components/AddressEdit/index.wxss +120 -120
  56. package/src/ConfirmOrder/components/AddressManage/index.wxss +98 -98
  57. package/src/ConfirmOrder/components/AddressSelect/index.wxss +67 -67
  58. package/src/ConfirmOrder/components/ChoosePicker/index.wxss +18 -18
  59. package/src/ConfirmOrder/components/GoodsInfo/components/GoodsCommerce/components/entityGiftList/index.wxss +45 -45
  60. package/src/ConfirmOrder/components/GoodsInfo/components/GoodsCommerce/components/entityItem/index.wxss +100 -100
  61. package/src/ConfirmOrder/components/GoodsInfo/components/GoodsCommerce/index.wxss +55 -55
  62. package/src/ConfirmOrder/components/GoodsInfo/components/ImageData/index.wxss +13 -13
  63. package/src/ConfirmOrder/components/Header/index.wxss +26 -26
  64. package/src/ConfirmOrder/components/IntegralSelect/componenets/integralTips/index.wxss +85 -85
  65. package/src/ConfirmOrder/components/Invoice/components/InvoiceSelect/index.wxss +155 -155
  66. package/src/ConfirmOrder/components/Invoice/components/InvoiceTip/index.wxss +51 -51
  67. package/src/ConfirmOrder/components/ModeSelect/index.wxss +44 -44
  68. package/src/ConfirmOrder/components/PickupSelect/index.wxss +22 -22
  69. package/src/ConfirmOrder/components/SelectSite/index.wxss +82 -82
  70. package/src/ConfirmOrder/components/Shipper/index.wxss +76 -76
  71. package/src/ConfirmOrder/components/ShipperEdit/index.wxss +78 -78
  72. package/src/ConfirmOrder/components/WechatAddress/index.wxss +22 -22
  73. package/src/ConfirmOrder/index.wxss +5 -5
  74. package/src/CouponList/couponColumn/index.js +10 -1
  75. package/src/CouponList/couponMsg/index.wxss +3 -3
  76. package/src/GoodsItem/index.js +283 -20
  77. package/src/GoodsItem/index.scss +25 -1
  78. package/src/GoodsItem/index.wxml +36 -8
  79. package/src/GoodsItem/index.wxss +91 -0
  80. package/src/LiveGoodsList/index.js +29 -4
  81. package/src/LiveGoodsList/index.wxml +7 -4
  82. package/src/PayComplete/Components/CouponItem/index.wxss +122 -122
  83. package/src/PayComplete/Components/Header/index.wxss +27 -27
  84. package/src/PayComplete/Components/LeadGroup/index.wxss +33 -33
  85. package/src/PayComplete/Components/PayGifts/index.wxss +157 -157
  86. package/src/PayComplete/Components/PayState/earnIntegral/index.wxss +23 -23
  87. package/src/PayComplete/Components/PayState/index.wxss +20 -20
  88. package/src/PayComplete/index.wxss +27 -27
  89. package/src/PayModule/wechatLoading/index.wxss +57 -57
  90. package/src/Recommend/index.wxss +110 -110
  91. package/src/Sku/Header/index.wxss +27 -27
  92. package/src/Sku/goods-info/index.wxss +52 -52
  93. package/src/Sku/index/index.wxss +52 -52
  94. package/src/Sku/row-item/index.wxss +50 -50
  95. package/src/Sku/step/index.wxss +11 -11
  96. package/src/Task/TaskBubble/index.js +146 -146
  97. package/src/Task/TaskBubble/index.json +3 -3
  98. package/src/Task/TaskBubble/index.scss +125 -125
  99. package/src/Task/TaskBubble/index.wxml +22 -22
  100. package/src/Task/TaskBubble/index.wxss +289 -289
  101. package/src/Task/TaskIcon/index.js +29 -29
  102. package/src/Task/TaskIcon/index.json +4 -4
  103. package/src/Task/TaskIcon/index.scss +70 -70
  104. package/src/Task/TaskIcon/index.wxml +5 -5
  105. package/src/Task/TaskIcon/index.wxss +130 -130
  106. package/src/Task/TaskPopup/component/RewardList/index.js +39 -39
  107. package/src/Task/TaskPopup/component/RewardList/index.json +6 -6
  108. package/src/Task/TaskPopup/component/RewardList/index.scss +39 -39
  109. package/src/Task/TaskPopup/component/RewardList/index.wxml +19 -19
  110. package/src/Task/TaskPopup/component/RewardList/index.wxss +18 -18
  111. package/src/Task/TaskPopup/component/TaskItem/index.json +5 -5
  112. package/src/Task/TaskPopup/component/TaskItem/index.scss +139 -139
  113. package/src/Task/TaskPopup/component/TaskItem/index.wxml +47 -47
  114. package/src/Task/TaskPopup/component/TaskItem/index.wxs +7 -7
  115. package/src/Task/TaskPopup/component/TaskItem/index.wxss +394 -394
  116. package/src/Task/TaskPopup/component/TaskList/index.json +7 -7
  117. package/src/Task/TaskPopup/component/TaskList/index.scss +66 -66
  118. package/src/Task/TaskPopup/component/TaskList/index.wxss +118 -118
  119. package/src/Task/TaskPopup/component/TaskType/index.json +9 -9
  120. package/src/Task/TaskPopup/component/TaskType/index.scss +62 -62
  121. package/src/Task/TaskPopup/component/TaskType/index.wxss +110 -110
  122. package/src/Task/TaskPopup/index.json +8 -8
  123. package/src/Task/TaskPopup/index.scss +140 -140
  124. package/src/Task/taskReceivePopup/coupon/index.js +52 -52
  125. package/src/Task/taskReceivePopup/coupon/index.json +6 -6
  126. package/src/Task/taskReceivePopup/coupon/index.scss +91 -91
  127. package/src/Task/taskReceivePopup/coupon/index.wxml +58 -58
  128. package/src/Task/taskReceivePopup/coupon/index.wxs +48 -48
  129. package/src/Task/taskReceivePopup/coupon/index.wxss +187 -187
  130. package/src/Task/taskReceivePopup/customPrizes/index.js +44 -44
  131. package/src/Task/taskReceivePopup/customPrizes/index.json +6 -6
  132. package/src/Task/taskReceivePopup/customPrizes/index.scss +106 -106
  133. package/src/Task/taskReceivePopup/customPrizes/index.wxml +38 -38
  134. package/src/Task/taskReceivePopup/customPrizes/index.wxs +48 -48
  135. package/src/Task/taskReceivePopup/index.js +34 -34
  136. package/src/Task/taskReceivePopup/index.json +13 -13
  137. package/src/Task/taskReceivePopup/index.wxml +25 -25
  138. package/src/Task/taskReceivePopup/index.wxss +1 -1
  139. package/src/Task/taskReceivePopup/integral/index.js +61 -61
  140. package/src/Task/taskReceivePopup/integral/index.json +6 -6
  141. package/src/Task/taskReceivePopup/integral/index.scss +60 -60
  142. package/src/Task/taskReceivePopup/integral/index.wxml +12 -12
  143. package/src/Task/taskReceivePopup/integral/index.wxss +94 -94
  144. package/src/TeacherGoodsList/index.js +41 -7
  145. package/src/TeacherGoodsList/index.scss +10 -1
  146. package/src/TeacherGoodsList/index.wxml +21 -15
  147. package/src/TeacherGoodsList/index.wxss +12 -1
  148. package/src/common/api/liveGoodsList.js +19 -5
  149. package/src/common/css/theme.wxss +16 -16
  150. package/src/miniprogram_npm/miniprogram-computed/index.js +1 -0
@@ -101,7 +101,16 @@ Component({
101
101
  if (marketInfo?.length > 0) {
102
102
  switch (type) {
103
103
  case "couponConfList":
104
- couponsList.push(...marketInfo);
104
+ let haveItemStatus = false;
105
+ marketInfo.map(item => {
106
+ for (let index = 0; index < couponsList.length; index++) {
107
+ if (item.id === couponsList[index].id) {
108
+ haveItemStatus = true;
109
+ break;
110
+ }
111
+ }
112
+ });
113
+ if (!haveItemStatus) couponsList.push(...marketInfo);
105
114
  break;
106
115
  case "couponUpdateList":
107
116
  marketInfo.map((item) => {
@@ -7,14 +7,22 @@
7
7
  * @LastEditTime: 2021-11-18 19:49:11
8
8
  */
9
9
  import { debounce, rpxToVmin } from "../common/utils/index"
10
- import { getUserPermission, getUserPermissionNew, snapCheck, snapCheckNew } from "../common/api/liveGoodsList"
10
+ import {
11
+ getUserPermission,
12
+ getUserPermissionNew,
13
+ snapCheck,
14
+ snapCheckNew,
15
+ showGoods,
16
+ requestChangeShow,
17
+ setGoodsSellOut,
18
+ getGoodValue
19
+ } from "../common/api/liveGoodsList"
11
20
  import {
12
21
  ASSOCIATION,
13
22
  PUNCH_CARD
14
23
  } from "../common/utils/constants.js";
15
24
 
16
25
  const { utils, sensorLog } = require("live-mp-tools");
17
- import { showGoods } from "../common/api/liveGoodsList"
18
26
 
19
27
  const computedBehavior = require('miniprogram-computed').behavior
20
28
 
@@ -74,13 +82,17 @@ Component({
74
82
  isSeckill,
75
83
  checked
76
84
  }, () => {
77
- const isOver =
78
- newVal.stock === 0 ||
79
- (newVal.is_activity &&
80
- (newVal.activity_type === 8 || newVal.activity_type === 3) &&
81
- newVal.activity_stock - newVal.activity_order_num === 0)
85
+ const isSoldOut = +newVal.is_sell_out === 1;
86
+ const isRealOver = newVal.stock === 0 ||
87
+ (newVal.is_activity &&
88
+ (newVal.activity_type === 8 || newVal.activity_type === 3) &&
89
+ newVal.activity_stock - newVal.activity_order_num === 0);
90
+ const isOver = isSoldOut || isRealOver;
91
+
82
92
  this.setData({
83
93
  isOver,
94
+ isSoldOut,
95
+ isRealOver,
84
96
  })
85
97
  this.countTime()
86
98
  })
@@ -145,6 +157,10 @@ Component({
145
157
  type: Boolean,
146
158
  value: false
147
159
  },
160
+ visibleSwitchStatusBtn: {
161
+ type: Boolean,
162
+ value: false
163
+ },
148
164
  sendingGoodId: {
149
165
  type: String,
150
166
  value: '',
@@ -176,6 +192,9 @@ Component({
176
192
  switchLoading: false,
177
193
  imageRadius: rpxToVmin(16),
178
194
  isOver: false, //是否已抢光
195
+ isSoldOut: false, //商品是否设置已售罄
196
+ isRealOver: false, //商品是否为非手动售罄下的,真实抢光
197
+ changeStateLoading: false, // 修改状态 loading(如售罄状态、显示状态)
179
198
  },
180
199
  computed: {
181
200
  showPreferentialPrice(properties) {
@@ -235,16 +254,22 @@ Component({
235
254
  return ''
236
255
  }
237
256
  },
257
+ // 点击去查看
258
+ isNeedToContact(data) {
259
+ return Boolean(data.allContactPay || (data.isIOS && !data.IOSMiniProgramCanBuy))
260
+ },
238
261
  btnTxt(data) {
239
262
  // 以下各种情况,按去查看 -> 已抢光 -> 查看详情 -> 免费领取 -> 券后 -> 去抢购 优先级展示
240
263
  // 超级会员全免权益
241
264
  let svipAllFree = data.goodsItem.resource_rights_type === 1
242
- if (data.allContactPay || (data.isIOS && !data.IOSMiniProgramCanBuy)) {
243
- // IOS小程序中不能买的展示去查看,跳转到小程序客服
244
- return "去查看"
265
+ if (data.isSoldOut && !data.isStudent) {
266
+ return "已售罄"
245
267
  } else if (data.isOver) {
246
268
  // 库存为0,已售罄
247
269
  return "已抢光"
270
+ } else if (data.allContactPay || (data.isIOS && !data.IOSMiniProgramCanBuy)) {
271
+ // IOS小程序中不能买的展示去查看,跳转到小程序客服
272
+ return "去查看"
248
273
  } else if (data.goodsItem.err_code) {
249
274
  // 券后价接口报错,领取不了优惠券的情况
250
275
  return "查看详情"
@@ -293,10 +318,15 @@ Component({
293
318
  filterSrc(data) {
294
319
  return utils.replaceCDN(data.goodsItem.img_url, '?imageMogr2/thumbnail/400x400>/ignore-error/1')
295
320
  },
296
-
321
+ // 是否展示已抢完
322
+ // 学员端:已设置售罄、或者已抢完
323
+ // 讲师端:已抢完,且未设置已售罄
324
+ isSellOut({ isStudent, isOver, isRealOver }) {
325
+ return isStudent ? isOver : isRealOver;
326
+ },
297
327
  // 已售百分比
298
328
  percentage(data) {
299
- if (data.isOver) return 100
329
+ if (data.isSellOut) return 100
300
330
  // 无库存 拼团、限时抢购
301
331
  if (!data.goodsItem.activity_stock) return 28
302
332
  let num = 0
@@ -321,7 +351,7 @@ Component({
321
351
  }
322
352
 
323
353
  // "已抢光"
324
- if (data.isOver) return '已抢光'
354
+ if (data.isSellOut) return '已抢光'
325
355
 
326
356
  // 没有库存 - 已开抢
327
357
  if (!data.goodsItem.activity_stock) return '已开抢'
@@ -355,8 +385,59 @@ Component({
355
385
  * 组件的方法列表
356
386
  */
357
387
  methods: {
358
- snapUpCheck: debounce(function () {
359
- this.showToast('努力加载中')
388
+ async checkSellOut() {
389
+ // 非真实抢光,需要拿最新状态判断下
390
+ if (this.data.isRealOver) return;
391
+
392
+ if (this.data.isNeedToContact) {
393
+ const goodsStatusRes = await this.getGoodsStatus()
394
+
395
+ if (!goodsStatusRes) return
396
+
397
+ // 更新售罄状态
398
+ const is_sell_out = +goodsStatusRes.is_sell_out
399
+ this.triggerEvent('changeGoodsState', {
400
+ index: this.properties.index,
401
+ type: 'is_sell_out',
402
+ state: is_sell_out,
403
+ });
404
+
405
+ if (is_sell_out) {
406
+ return wx.showToast({
407
+ title: '很遗憾, 手慢抢光了',
408
+ icon: 'none',
409
+ duration: 3000,
410
+ })
411
+ }
412
+
413
+ this.toDetails()
414
+ } else {
415
+ this.snapUpCheck()
416
+ }
417
+ },
418
+ snapUpCheck: debounce(async function () {
419
+ !this.data.isOver && this.showToast('努力加载中')
420
+
421
+ const goodsStatusRes = await this.getGoodsStatus()
422
+
423
+ if (!goodsStatusRes) return
424
+
425
+ // 更新售罄状态
426
+ const is_sell_out = +goodsStatusRes.is_sell_out
427
+ this.triggerEvent('changeGoodsState', {
428
+ index: this.properties.index,
429
+ type: 'is_sell_out',
430
+ state: is_sell_out,
431
+ });
432
+
433
+ if (is_sell_out) {
434
+ return wx.showToast({
435
+ title: '很遗憾, 手慢抢光了',
436
+ icon: 'none',
437
+ duration: 3000,
438
+ })
439
+ }
440
+
360
441
  this.triggerEvent('sendNewMsg')
361
442
  let { aliveInfo, sensorReportParams, goodsInfo, isFullScreen } = this.properties
362
443
  sensorLog.sensors.track('click_butt', {
@@ -417,6 +498,42 @@ Component({
417
498
  }
418
499
  })
419
500
  }, 1000, true),
501
+ getGoodsStatus() {
502
+ if (this.data.isRealOver) {
503
+ wx.showToast({
504
+ title: '很遗憾, 手慢抢光了',
505
+ icon: 'none',
506
+ duration: 3000,
507
+ })
508
+
509
+ return Promise.resolve(null)
510
+ }
511
+
512
+ const { id, spu_id, resource_id } = this.data.goodsItem
513
+ const { user_id, app_id, alive_id } = this.properties.aliveInfo
514
+
515
+ return getGoodValue({
516
+ spu_id: spu_id || id,
517
+ user_id,
518
+ app_id,
519
+ alive_id,
520
+ resource_id: id || resource_id,
521
+ }, true)
522
+ .then((res) => {
523
+ res = res.data || {}
524
+
525
+ if (res.code === 0 && res.data) {
526
+ return res.data
527
+ } else {
528
+ this.showToast(res?.msg || res?.data?.msg || '获取商品状态失败')
529
+ return null
530
+ }
531
+ })
532
+ .catch(() => {
533
+ this.showToast('获取商品状态失败')
534
+ return null
535
+ })
536
+ },
420
537
  cardToDetails() {
421
538
  if (!this.data.isStudent) { return }
422
539
  let { aliveInfo, sensorReportParams, goodsInfo, isFullScreen } = this.properties
@@ -445,6 +562,26 @@ Component({
445
562
  },
446
563
  // 点击空白热区进来判断权益,或者接口返回有权益的时候进来判断跳转路径
447
564
  judgePermission: debounce(async function (permission) {
565
+ const goodsStatusRes = await this.getGoodsStatus()
566
+
567
+ if (!goodsStatusRes) return
568
+
569
+ // 更新售罄状态
570
+ const is_sell_out = +goodsStatusRes.is_sell_out
571
+ this.triggerEvent('changeGoodsState', {
572
+ index: this.properties.index,
573
+ type: 'is_sell_out',
574
+ state: is_sell_out,
575
+ });
576
+
577
+ if (is_sell_out) {
578
+ return wx.showToast({
579
+ title: '很遗憾, 手慢抢光了',
580
+ icon: 'none',
581
+ duration: 3000,
582
+ })
583
+ }
584
+
448
585
  // 实物21 有价优惠券41 超级会员23 可多次购买,没有权益说法,直接拉起客服;直播商品有没有权益都是去详情页。
449
586
  if ([41, 21, 23, 4].indexOf(Number(this.data.goodsItem.resource_type)) > -1) {
450
587
  this.toDetails()
@@ -455,7 +592,6 @@ Component({
455
592
  permission = await this.getUserPermission()
456
593
  }
457
594
 
458
- console.log("permission", permission)
459
595
  // 有权益的情况下
460
596
  if (permission) {
461
597
  // 电子书20/班课35 鹅学习不支持,无权益的情况下,内嵌h5, 有权益TOAST提示
@@ -486,10 +622,10 @@ Component({
486
622
  })
487
623
  })
488
624
  },
489
- showConfirmOrder(sku) {
625
+ async showConfirmOrder(sku) {
490
626
  //带货列表返回的 resource_id就是业务侧的spu_id
491
627
  // 返回的id,就是业务侧的resource_id
492
- let params = {
628
+ const params = {
493
629
  id: this.data.goodsItem.resource_id,
494
630
  spu_id: this.data.goodsItem.resource_id,
495
631
  resource_type: this.data.goodsItem.resource_type,
@@ -501,6 +637,7 @@ Component({
501
637
  aliveId: this.data.aliveInfo.alive_id,
502
638
  isCollectCoupons: this.data.showPreferentialPrice
503
639
  }
640
+
504
641
  this.triggerEvent("showConfirmOrder", params)
505
642
  },
506
643
  showSku() {
@@ -645,7 +782,7 @@ Component({
645
782
  let { aliveInfo } = this.properties
646
783
  let h5_url = this.formatUrl(goodsInfo)
647
784
  var path
648
- // 音频 视频
785
+ // 音频 视频
649
786
  if (goodsInfo.resource_type === 2 || goodsInfo.resource_type === 3) {
650
787
  path = `/pages/index/authorizePage?user_id=${aliveInfo.user_id}&app_id=${aliveInfo.app_id}&resource_id=${goodsInfo.id}&unique_type=elive`
651
788
  } else {
@@ -690,6 +827,133 @@ Component({
690
827
  }
691
828
  wx.navigateToMiniProgram(params)
692
829
  },
830
+ // 商品设置售罄/取消售罄
831
+ async changeSoldOut() {
832
+ if (this.data.changeStateLoading) return this.showToast('状态更改中,请稍后');
833
+
834
+ const confirmPromise = () => new Promise(resolve => {
835
+ wx.showModal({
836
+ title: '确认售罄?',
837
+ content: '标记售罄后不影响实际库存,仅在用户端展示商品已抢光,无法购买',
838
+ confirmText: '确认',
839
+ cancelText: '取消',
840
+ confirmColor: '#1472FF',
841
+ success: (res) => {
842
+ if (res.confirm) {
843
+ return resolve(true);
844
+ } else if (res.cancel) {
845
+ return resolve(false);
846
+ }
847
+ },
848
+ fail: () => resolve(false),
849
+ });
850
+ });
851
+
852
+ const isConfirmOperation = this.data.isSoldOut || await confirmPromise();
853
+
854
+ if (!isConfirmOperation) return;
855
+
856
+ const { alive_id, app_id, user_id } = this.properties.aliveInfo;
857
+ const {
858
+ goodsItem,
859
+ isSoldOut,
860
+ } = this.data;
861
+ const params = {
862
+ alive_id,
863
+ app_id,
864
+ resource_id: goodsItem.id,
865
+ is_sell_out: isSoldOut ? 0 : 1, // 该商品是否售罄 1-已售罄 0-未售罄
866
+ user_id,
867
+ token: wx.getStorageSync('login_data').token,
868
+ };
869
+
870
+ this.setData({
871
+ changeStateLoading: true,
872
+ });
873
+
874
+ const res = await setGoodsSellOut(params, false).catch(error => ({ data: { code: -1, msg: error?.message || error || '操作失败' } }));
875
+
876
+ this.setData({
877
+ changeStateLoading: false,
878
+ });
879
+
880
+ const { data: { code, msg } } = res;
881
+
882
+ if (code !== 0) {
883
+ return this.showToast(msg);
884
+ }
885
+
886
+ // 更新售罄状态
887
+ this.triggerEvent('changeGoodsState', {
888
+ index: this.properties.index,
889
+ type: 'is_sell_out',
890
+ state: params.is_sell_out,
891
+ });
892
+ this.showToast('操作成功');
893
+ },
894
+ // 商品设置显示/隐藏
895
+ async changeVisible() {
896
+ if (this.data.changeStateLoading) return this.showToast('状态更改中,请稍后');
897
+
898
+ // 确认隐藏商品弹窗
899
+ const confirmPromise = () => new Promise(resolve => {
900
+ wx.showModal({
901
+ title: '确认隐藏吗',
902
+ content: '用户端商品列表不展示已隐藏商品,讲师仍可通过讲解发送商品',
903
+ confirmText: '确认',
904
+ cancelText: '取消',
905
+ confirmColor: '#1472FF',
906
+ success: (res) => {
907
+ if (res.confirm) {
908
+ return resolve(true);
909
+ } else if (res.cancel) {
910
+ return resolve(false);
911
+ }
912
+ },
913
+ fail: () => resolve(false),
914
+ });
915
+ });
916
+
917
+ // 已隐藏的商品可以直接调用接口显示,已显示的需要弹窗提示
918
+ const isConfirmOperation = !this.data.goodsItem.is_display_package || await confirmPromise();
919
+
920
+ if (!isConfirmOperation) return;
921
+
922
+ // 确认隐藏/显示,格式化参数、调用接口处理
923
+ const { alive_id, app_id } = this.properties.aliveInfo;
924
+ const { id, true_type, is_display_package } = this.data.goodsItem;
925
+ const params = {
926
+ alive_id,
927
+ app_id,
928
+ resource_ids: [{ id, type: true_type }],
929
+ is_display_package: +is_display_package ? 0 : 1,
930
+ token: wx.getStorageSync('login_data').token,
931
+ };
932
+
933
+ this.setData({
934
+ changeStateLoading: true,
935
+ });
936
+
937
+ const res = await requestChangeShow(params, false).catch(error => ({ data: { code: -1, msg: error?.message || error || '操作失败' } }));
938
+
939
+ this.setData({
940
+ changeStateLoading: false,
941
+ });
942
+
943
+ const { data: { code, msg } } = res;
944
+
945
+ if (code !== 0) {
946
+ return this.showToast(msg);
947
+ }
948
+
949
+ // 更新商品显示、隐藏状态
950
+ this.triggerEvent('changeGoodsState', {
951
+ index: this.properties.index,
952
+ type: 'is_display_package',
953
+ state: params.is_display_package,
954
+ });
955
+ this.showToast('操作成功');
956
+ },
693
957
  sendGoodsCard(e) {
694
958
  let dataset = e.currentTarget.dataset;
695
959
  // 触发父组件的send
@@ -712,7 +976,6 @@ Component({
712
976
  is_display_package: this.data.checked ? 0 : 1
713
977
  };
714
978
  showGoods(params).then((res) => {
715
- console.log(res, "resres")
716
979
  let { code } = res.data
717
980
  if (code === 0) {
718
981
  this.setData({
@@ -1,4 +1,4 @@
1
- @import "..\\common\\css\\theme.wxss";
1
+ @import "../common/css/theme.wxss";
2
2
 
3
3
  $deviceWidth: 750;
4
4
  @function vmin($rpx) {
@@ -469,6 +469,30 @@ $deviceWidth: 750;
469
469
  .full-hide-tip{
470
470
  width: 100%;
471
471
  }
472
+ .option-btn-wrap {
473
+ display: flex;
474
+ align-items: center;
475
+ justify-content: flex-end;
476
+ margin-top: vmin(16);
477
+
478
+ .option-btn {
479
+ font-size: vmin(24);
480
+ border-radius: vmin(8);
481
+ width: vmin(128);
482
+ height: vmin(56);
483
+ margin-right: vmin(24);
484
+ display: flex;
485
+ justify-content: center;
486
+ align-items: center;
487
+ font-weight: bold;
488
+ color: #333;
489
+ border: vmin(1) solid #cccccc;
490
+
491
+ &:last-of-type {
492
+ margin-right: 0;
493
+ }
494
+ }
495
+ }
472
496
  }
473
497
 
474
498
  @keyframes turn {
@@ -1,7 +1,7 @@
1
- <!--
1
+ <!--
2
2
  /*
3
- * @Descripttion:
4
- * @version:
3
+ * @Descripttion:
4
+ * @version:
5
5
  * @Author: conlinchen
6
6
  * @Date: 2021-10-28 18:17:48
7
7
  * @LastEditors: conlinchen
@@ -31,7 +31,8 @@
31
31
  </view>
32
32
  <view class="text">讲解中</view>
33
33
  </view>
34
- <view class="is-over" wx:if="{{isOver}}">- 已抢光 -</view>
34
+ <view class="is-over" wx:if="{{!isStudent && isSoldOut}}">- 已售罄 -</view>
35
+ <view class="is-over" wx:elif="{{isOver}}">- 已抢光 -</view>
35
36
  </view>
36
37
  <view class="right {{isManage?'manage-right':''}}">
37
38
  <!-- 标题 -->
@@ -122,9 +123,9 @@
122
123
  send-message-path="{{params_url}}"
123
124
  >{{ btnTxt }}</button>
124
125
  <!-- 库存为0的情况 -->
125
- <view class="no-stock-btn" wx:if="{{ btnTxt === '已抢光' }}" catchtap="()=>{}">{{ btnTxt }}</view>
126
+ <view class="no-stock-btn" wx:if="{{ btnTxt === '已抢光' || btnTxt === '已售罄' }}" catchtap="checkSellOut">{{ btnTxt }}</view>
126
127
  <!-- 正常情况 -->
127
- <view class="buy-btn" catchtap="snapUpCheck" wx:if="{{ btnTxt === '购买' }}">{{ btnTxt }}</view>
128
+ <view class="buy-btn" catchtap="snapUpCheck" wx:elif="{{ btnTxt === '购买' }}">{{ btnTxt }}</view>
128
129
  <!-- 0元商品/超级会员免费/券后价、领券接口熔断的情况 -->
129
130
  <view
130
131
  class="buy-btn"
@@ -144,7 +145,7 @@
144
145
  </text>
145
146
  </view>-->
146
147
  </block>
147
- <block wx:elif="{{!isManage && !isStudent}}">
148
+ <block wx:elif="{{!isManage && !isStudent && !visibleSwitchStatusBtn}}">
148
149
  <view
149
150
  class="buy-btn-teacher {{ sendingGoodId === goodsItem.id ? 'cancel-explain-bg' : 'explain-bg' }}"
150
151
  catchtap="sendGoodsCard"
@@ -159,7 +160,7 @@
159
160
  class="load"
160
161
  src="https://commonresource-1252524126.cdn.xiaoeknow.com/image/lik3ojn20167.png"
161
162
  />
162
- {{ sendingGoodId === goodsItem.id ? '结束讲解' : '讲解' }}
163
+ {{ sendingGoodId === goodsItem.id ? '结束讲解' : '讲解' }}
163
164
  </view>
164
165
  </block>
165
166
  <!-- 购买按钮 end -->
@@ -170,4 +171,31 @@
170
171
  class="hide-tip {{isFullScreen?'full-hide-tip':''}}"
171
172
  wx:if="{{!goodsItem.is_display_package && !isStudent}}"
172
173
  >用户端已隐藏该商品</view>
174
+ <block wx:if="{{visibleSwitchStatusBtn}}">
175
+ <view class="option-btn-wrap">
176
+ <view
177
+ class="option-btn"
178
+ catch:tap="changeSoldOut"
179
+ data-item="{{goodsItem}}"
180
+ data-type="10"
181
+ data-index="{{index}}"
182
+ data-id="{{goodsItem.id}}"
183
+ data-isExplain="{{changeStateLoading}}"
184
+ >
185
+ {{ isSoldOut ? '取消售罄' : '售罄' }}
186
+ </view>
187
+
188
+ <view
189
+ class="option-btn"
190
+ catch:tap="changeVisible"
191
+ data-item="{{goodsItem}}"
192
+ data-type="10"
193
+ data-index="{{index}}"
194
+ data-id="{{goodsItem.id}}"
195
+ data-isExplain="{{changeStateLoading}}"
196
+ >
197
+ {{ goodsItem.is_display_package ? '隐藏' : '显示' }}
198
+ </view>
199
+ </view>
200
+ </block>
173
201
  </view>
@@ -490,6 +490,28 @@
490
490
  .goods-item .full-hide-tip {
491
491
  width: 100%;
492
492
  }
493
+ .goods-item .option-btn-wrap {
494
+ display: flex;
495
+ align-items: center;
496
+ justify-content: flex-end;
497
+ margin-top: 2.13333vmin;
498
+ }
499
+ .goods-item .option-btn-wrap .option-btn {
500
+ font-size: 3.2vmin;
501
+ border-radius: 1.06667vmin;
502
+ width: 17.06667vmin;
503
+ height: 7.46667vmin;
504
+ margin-right: 3.2vmin;
505
+ display: flex;
506
+ justify-content: center;
507
+ align-items: center;
508
+ font-weight: bold;
509
+ color: #333;
510
+ border: 0.13333vmin solid #cccccc;
511
+ }
512
+ .goods-item .option-btn-wrap .option-btn:last-of-type {
513
+ margin-right: 0;
514
+ }
493
515
  @media screen and (min-width: 768px) and (orientation: portrait) {
494
516
  .goods-item {
495
517
  display: flex;
@@ -946,6 +968,28 @@
946
968
  .goods-item .full-hide-tip {
947
969
  width: 100%;
948
970
  }
971
+ .goods-item .option-btn-wrap {
972
+ display: flex;
973
+ align-items: center;
974
+ justify-content: flex-end;
975
+ margin-top: 1.04167vmin;
976
+ }
977
+ .goods-item .option-btn-wrap .option-btn {
978
+ font-size: 1.5625vmin;
979
+ border-radius: 0.52083vmin;
980
+ width: 8.33333vmin;
981
+ height: 3.64583vmin;
982
+ margin-right: 1.5625vmin;
983
+ display: flex;
984
+ justify-content: center;
985
+ align-items: center;
986
+ font-weight: bold;
987
+ color: #333;
988
+ border: 0.0651vmin solid #cccccc;
989
+ }
990
+ .goods-item .option-btn-wrap .option-btn:last-of-type {
991
+ margin-right: 0;
992
+ }
949
993
  }
950
994
  @media screen and (min-height: 630px) and (orientation: landscape) {
951
995
  .goods-item {
@@ -1403,6 +1447,28 @@
1403
1447
  .goods-item .full-hide-tip {
1404
1448
  width: 100%;
1405
1449
  }
1450
+ .goods-item .option-btn-wrap {
1451
+ display: flex;
1452
+ align-items: center;
1453
+ justify-content: flex-end;
1454
+ margin-top: 1.26984vmin;
1455
+ }
1456
+ .goods-item .option-btn-wrap .option-btn {
1457
+ font-size: 1.90476vmin;
1458
+ border-radius: 0.63492vmin;
1459
+ width: 10.15873vmin;
1460
+ height: 4.44444vmin;
1461
+ margin-right: 1.90476vmin;
1462
+ display: flex;
1463
+ justify-content: center;
1464
+ align-items: center;
1465
+ font-weight: bold;
1466
+ color: #333;
1467
+ border: 0.07937vmin solid #cccccc;
1468
+ }
1469
+ .goods-item .option-btn-wrap .option-btn:last-of-type {
1470
+ margin-right: 0;
1471
+ }
1406
1472
  }
1407
1473
  @media screen and (min-height: 768px) and (orientation: landscape) {
1408
1474
  .goods-item {
@@ -1860,4 +1926,26 @@
1860
1926
  .goods-item .full-hide-tip {
1861
1927
  width: 100%;
1862
1928
  }
1929
+ .goods-item .option-btn-wrap {
1930
+ display: flex;
1931
+ align-items: center;
1932
+ justify-content: flex-end;
1933
+ margin-top: 1.04167vmin;
1934
+ }
1935
+ .goods-item .option-btn-wrap .option-btn {
1936
+ font-size: 1.5625vmin;
1937
+ border-radius: 0.52083vmin;
1938
+ width: 8.33333vmin;
1939
+ height: 3.64583vmin;
1940
+ margin-right: 1.5625vmin;
1941
+ display: flex;
1942
+ justify-content: center;
1943
+ align-items: center;
1944
+ font-weight: bold;
1945
+ color: #333;
1946
+ border: 0.0651vmin solid #cccccc;
1947
+ }
1948
+ .goods-item .option-btn-wrap .option-btn:last-of-type {
1949
+ margin-right: 0;
1950
+ }
1863
1951
  }