xiaoe_mp_npm 0.1.1 → 0.1.3

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 (52) hide show
  1. package/.gitlab-ci.yml +1 -1
  2. package/miniprogram_dist/{LiveGoodsList/GoodsItem → GoodsItem}/index.js +36 -9
  3. package/miniprogram_dist/GoodsItem/index.json +6 -0
  4. package/miniprogram_dist/GoodsItem/index.less +249 -0
  5. package/{src/LiveGoodsList → miniprogram_dist}/GoodsItem/index.wxml +24 -13
  6. package/miniprogram_dist/{LiveGoodsList/GoodsItem → GoodsItem}/index.wxss +48 -27
  7. package/miniprogram_dist/LiveGoodsList/Header/index.wxml +1 -1
  8. package/miniprogram_dist/LiveGoodsList/index.js +9 -4
  9. package/miniprogram_dist/LiveGoodsList/index.json +1 -1
  10. package/miniprogram_dist/LiveGoodsList/index.less +0 -6
  11. package/miniprogram_dist/LiveGoodsList/index.wxml +0 -1
  12. package/miniprogram_dist/LiveGoodsList/index.wxss +0 -6
  13. package/miniprogram_dist/Lottery/components/LotteryInfo/index.js +12 -9
  14. package/miniprogram_dist/Lottery/components/LotteryPopups/index.js +19 -0
  15. package/miniprogram_dist/TeacherGoodsList/Header/index.js +36 -0
  16. package/{src/LiveGoodsList/GoodsItem → miniprogram_dist/TeacherGoodsList/Header}/index.json +1 -1
  17. package/miniprogram_dist/TeacherGoodsList/Header/index.less +47 -0
  18. package/miniprogram_dist/TeacherGoodsList/Header/index.wxml +27 -0
  19. package/miniprogram_dist/TeacherGoodsList/Header/index.wxss +45 -0
  20. package/miniprogram_dist/TeacherGoodsList/README.md +10 -0
  21. package/miniprogram_dist/TeacherGoodsList/index.js +269 -0
  22. package/miniprogram_dist/TeacherGoodsList/index.json +8 -0
  23. package/miniprogram_dist/TeacherGoodsList/index.less +53 -0
  24. package/miniprogram_dist/TeacherGoodsList/index.wxml +49 -0
  25. package/miniprogram_dist/TeacherGoodsList/index.wxss +50 -0
  26. package/package.json +1 -1
  27. package/src/{LiveGoodsList/GoodsItem → GoodsItem}/index.js +36 -9
  28. package/src/GoodsItem/index.json +6 -0
  29. package/src/GoodsItem/index.less +249 -0
  30. package/{miniprogram_dist/LiveGoodsList → src}/GoodsItem/index.wxml +24 -13
  31. package/src/{LiveGoodsList/GoodsItem → GoodsItem}/index.wxss +48 -27
  32. package/src/LiveGoodsList/Header/index.wxml +1 -1
  33. package/src/LiveGoodsList/index.js +9 -4
  34. package/src/LiveGoodsList/index.json +1 -1
  35. package/src/LiveGoodsList/index.less +0 -6
  36. package/src/LiveGoodsList/index.wxml +0 -1
  37. package/src/LiveGoodsList/index.wxss +0 -6
  38. package/src/Lottery/components/LotteryInfo/index.js +12 -9
  39. package/src/Lottery/components/LotteryPopups/index.js +19 -0
  40. package/src/TeacherGoodsList/Header/index.js +36 -0
  41. package/{miniprogram_dist/LiveGoodsList/GoodsItem → src/TeacherGoodsList/Header}/index.json +1 -1
  42. package/src/TeacherGoodsList/Header/index.less +47 -0
  43. package/src/TeacherGoodsList/Header/index.wxml +27 -0
  44. package/src/TeacherGoodsList/Header/index.wxss +45 -0
  45. package/src/TeacherGoodsList/README.md +10 -0
  46. package/src/TeacherGoodsList/index.js +269 -0
  47. package/src/TeacherGoodsList/index.json +8 -0
  48. package/src/TeacherGoodsList/index.less +53 -0
  49. package/src/TeacherGoodsList/index.wxml +49 -0
  50. package/src/TeacherGoodsList/index.wxss +50 -0
  51. package/miniprogram_dist/LiveGoodsList/GoodsItem/index.less +0 -228
  52. package/src/LiveGoodsList/GoodsItem/index.less +0 -228
@@ -26,6 +26,9 @@ const SPU_TYPE = {
26
26
  29: "线下课", //体验课也是29
27
27
  22: "分销商品",
28
28
  12: "分销商品", //暂时不做
29
+ 41: "有价优惠券",
30
+ 45: "AI互动课",
31
+ 23: "超级会员"
29
32
  }
30
33
  const MARKET_ACTIVITY_MAP = {
31
34
  3: "限时折扣",
@@ -179,6 +182,7 @@ Component({
179
182
  type: 1,
180
183
  pageSize: 200,
181
184
  page: 1,
185
+ port: 1
182
186
  }
183
187
  getGoodsList(params).then((res) => {
184
188
  console.log('2222222222')
@@ -203,7 +207,8 @@ Component({
203
207
  alive_id: this.data.aliveInfo.alive_id,
204
208
  type: 1,
205
209
  pageSize: this.data.page_size,
206
- page: this.data.page_index
210
+ page: this.data.page_index,
211
+ port: 1
207
212
  }
208
213
  getGoodsList(params).then(res=>{
209
214
  let { data, code } = res.data
@@ -283,7 +288,7 @@ Component({
283
288
  arr.push({
284
289
  active: "",
285
290
  price: e.price,
286
- weight: e.price + 0.0002,
291
+ weight: e.price + 0.0003,
287
292
  })
288
293
  // 活动管理、实物商品、有价优惠券、线下课和课时包不能设置活动库存,其他可以设置活动库存得需要判断是否还剩余活动库存;拼团也不能设置活动库存。
289
294
  let notExistNowStock = [9, 21, 41, 29, 42].indexOf(e.resource_type) > -1
@@ -302,7 +307,7 @@ Component({
302
307
  //判断超级会员价
303
308
  active: "超级会员",
304
309
  price: e.svip_price,
305
- weight: e.svip_price + 0.0003,
310
+ weight: e.svip_price + 0.0002,
306
311
  })
307
312
  arr.sort((a, b) => a.weight - b.weight)
308
313
  let svipAllFree = e.resource_rights_type === 1
@@ -320,7 +325,7 @@ Component({
320
325
  }
321
326
  e.priceLineShowInt = this.priceInt(e.priceLine) // 展示划线价的整数部分
322
327
  e.priceLineShowFlow = this.priceFlow(e.priceLine) // 展示划线的小数部分
323
- e.entityShowStock = e.resource_type === 21 && e.show_stock // 实物商品库存依赖 B端店铺设置(show_stock):详情页展示不展示剩余件数
328
+ e.entityShowStock = (e.resource_type === 21 || e.resource_type === 41) && e.show_stock // 实物商品库存依赖 B端店铺设置(show_stock):详情页展示不展示剩余件数
324
329
  e.hasStock = [29,35].indexOf(e.resource_type) > -1 || e.entityShowStock || e.now_stock // 班课、线下课、实物商品、体验课、有活动库存,满足其一即展示库存
325
330
  },
326
331
  priceInt(val){
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "component": true,
3
3
  "usingComponents": {
4
- "goods-item": "./GoodsItem/index",
4
+ "goods-item": "../GoodsItem/index",
5
5
  "header": "./Header/index",
6
6
  "custom-popup": "../CustomPopup",
7
7
  "coupon-list": "../CouponList/couponColumn/index",
@@ -1,9 +1,3 @@
1
- page {
2
- background-color: #f7f8fa;
3
- color: #323232;
4
- width: 100%;
5
- height: 100%;
6
- }
7
1
 
8
2
  .box {
9
3
  margin: 0 12px;
@@ -37,7 +37,6 @@
37
37
  bind:showSku="showSku"
38
38
  explainingGoods="{{explainingGoods}}"
39
39
  bind:showDialog="showDialog"
40
- bind:toDetails="toDetails"
41
40
  class="goods-item"
42
41
  envName="{{ENV_NAME}}"
43
42
  sensorReportParams="{{sensorReportParams}}"
@@ -1,9 +1,3 @@
1
- page {
2
- background-color: #f7f8fa;
3
- color: #323232;
4
- width: 100%;
5
- height: 100%;
6
- }
7
1
  .box {
8
2
  margin: 0 12px;
9
3
  }
@@ -124,22 +124,25 @@ Component(
124
124
  app_id: this.data.baseInfo.app_id, // 店铺id
125
125
  alive_id: this.data.baseInfo.alive_id,
126
126
  user_id: this.data.baseInfo.user_id,
127
- prize_id: this.data.prizeInfo.prize_id
127
+ prize_id: this.data.prizeInfo.prize_id,
128
+ type: 1
128
129
  }
129
130
  joinCommentLottery(params)
130
131
  .then(({data}) => {
131
- if (data.code === 0) {
132
- this.store.dispatch({type: 'set_is_ready_to_comment', payload: true})
133
- this.store.dispatch({type: 'hide_lottery_info'})
134
- if (prizeCondition === PARTICIPATION_CONDITION.SPECIFY_COMMENT) {
135
- eventBus.emit('input_change', this.data.lotteryInfo.prize_param.ext.content)
136
- }
137
- eventBus.emit('input_focus')
132
+ if (data.code !== 0) {
133
+ return Promise.reject(data);
138
134
  }
139
135
  })
140
136
  .catch(err => {
141
137
  console.error(err)
142
- })
138
+ });
139
+
140
+ this.store.dispatch({type: 'set_is_ready_to_comment', payload: true})
141
+ this.store.dispatch({type: 'hide_lottery_info'})
142
+ if (prizeCondition === PARTICIPATION_CONDITION.SPECIFY_COMMENT) {
143
+ eventBus.emit('input_change', this.data.lotteryInfo.prize_param.ext.content)
144
+ }
145
+ eventBus.emit('input_focus')
143
146
  return
144
147
  }
145
148
 
@@ -8,6 +8,7 @@ import {connect} from '../../store/index'
8
8
  import {
9
9
  fetchLotteryInfo, participateLottery, drawLottery, joinLottery
10
10
  } from '../../store/effect'
11
+ import {joinCommentLottery} from '../../../common/api/lottery'
11
12
  import eventBus from '../../eventBus'
12
13
  import countdownInstance from '../../countdown'
13
14
 
@@ -82,6 +83,22 @@ Component(
82
83
  .catch(cancel)
83
84
  })
84
85
  },
86
+ // 记录点击按钮状态,作为参与评论抽奖的前置条件(必须满足条件: 1.点击了按钮 2.发送评论)
87
+ recordLotteryJoin(type) {
88
+ joinCommentLottery({
89
+ app_id: this.data.baseInfo.app_id, // 店铺id
90
+ alive_id: this.data.baseInfo.alive_id,
91
+ user_id: this.data.baseInfo.user_id,
92
+ prize_id: this.data.lotteryInfo.current_prize_id,
93
+ type
94
+ })
95
+ .then(res=>{
96
+ if(res.code !== 0) {
97
+ return Promise.reject(res);
98
+ }
99
+ })
100
+ .catch(console.error)
101
+ },
85
102
  onSelfContentMsg() {
86
103
  getApp().globalData.$im.on(MSG_EVENT.GET_CONTENT_MSG, msg => {
87
104
  console.log('dispatch 监听所有content msg: ', msg)
@@ -91,9 +108,11 @@ Component(
91
108
 
92
109
  if (this.isAnyCommentCondition()) {
93
110
  this.store.dispatch(participateLottery())
111
+ this.recordLotteryJoin(2)
94
112
  } else if (this.isSpecifyCommentCondition()) {
95
113
  if (msg.msg_content === this.data.lotteryInfo.prize_param.ext.content) {
96
114
  this.store.dispatch(participateLottery())
115
+ this.recordLotteryJoin(2)
97
116
  }
98
117
  }
99
118
  })
@@ -0,0 +1,36 @@
1
+ /*
2
+ * @Descripttion:
3
+ * @version:
4
+ * @Author: conlinchen
5
+ * @Date: 2021-10-29 16:35:58
6
+ * @LastEditors: conlinchen
7
+ * @LastEditTime: 2021-11-01 18:34:08
8
+ */
9
+ // src/LiveGoodsList/Components/Header/index.js
10
+ Component({
11
+ /**
12
+ * 组件的属性列表
13
+ */
14
+ properties: {
15
+
16
+ },
17
+
18
+ /**
19
+ * 组件的初始数据
20
+ */
21
+ data: {
22
+
23
+ },
24
+
25
+ /**
26
+ * 组件的方法列表
27
+ */
28
+ methods: {
29
+ closePop(){
30
+ this.triggerEvent('closePop')
31
+ },
32
+ gotoPayRecords(){
33
+ return
34
+ }
35
+ }
36
+ })
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "component": true,
3
3
  "usingComponents": {
4
-
4
+ "van-icon": "@vant/weapp/icon/index"
5
5
  }
6
6
  }
@@ -0,0 +1,47 @@
1
+ .popup-header{
2
+ padding: 20rpx 32rpx;
3
+ height: 76rpx;
4
+ top: auto;
5
+ display: flex;
6
+ justify-content: space-between;
7
+ align-items: center;
8
+ background:rgba(245,245,245,1);
9
+
10
+ .head-right-txt {
11
+ display: inline-block;
12
+ text-align: right;
13
+ min-width: 104rpx;
14
+ font-size: 40rpx;
15
+ }
16
+ .popup-header-title{
17
+ color: rgba(51,51,51,1);
18
+ font-size: 16px;
19
+ font-weight: 500;
20
+ font-family: "PingFang SC";
21
+ }
22
+ .van-action-sheet__left {
23
+ color: #c8c9cc;
24
+ font-size: 22px;
25
+ line-height: inherit;
26
+ display: flex;
27
+ align-items: center;
28
+ min-width: 104rpx;
29
+
30
+ .order-icon {
31
+ display: inline-block;
32
+ width: 40rpx;
33
+ height: 40rpx;
34
+ -moz-background-size: 100% 100%;
35
+ background-size: 100% 100%;
36
+ background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABQCAYAAACOEfKtAAAACXBIWXMAACxLAAAsSwGlPZapAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAANHSURBVHgB7ZzPcdpQEId/yAwXH0IJdBCoINCBXYHlYRAcSQekAnPk34yVCuxUYDowJagEc4ADM0D2xTplkvDEaldE3m+GEYeHkD6e3q7eWwQYhvEfU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 14px;
42
+ font-weight: 500;
43
+ font-family: "PingFang SC";
44
+ margin-left: 8rpx;
45
+ }
46
+ }
47
+ }
@@ -0,0 +1,27 @@
1
+
2
+ <!--
3
+ /*
4
+ * @Descripttion:
5
+ * @version:
6
+ * @Author: conlinchen
7
+ * @Date: 2021-10-29 14:42:53
8
+ * @LastEditors: conlinchen
9
+ * @LastEditTime: 2021-11-18 18:10:59
10
+ */
11
+ -->
12
+ <view class="popup-header">
13
+ <view
14
+ class="van-action-sheet__left"
15
+ bindtap="gotoPayRecords"
16
+ >
17
+ <text class="head-left-txt"></text>
18
+ </view>
19
+ <view class="popup-header-title">商品列表</view>
20
+ <!-- <i
21
+ class="van-icon van-icon-cross van-action-sheet__close"
22
+ bindtap="closePop"
23
+ ></i> -->
24
+ <view class="head-right-txt">
25
+ <van-icon name="cross" bindtap="closePop"/>
26
+ </view>
27
+ </view>
@@ -0,0 +1,45 @@
1
+ .popup-header {
2
+ padding: 20rpx 32rpx;
3
+ height: 76rpx;
4
+ top: auto;
5
+ display: flex;
6
+ justify-content: space-between;
7
+ align-items: center;
8
+ background: #f5f5f5;
9
+ }
10
+ .popup-header .head-right-txt {
11
+ display: inline-block;
12
+ text-align: right;
13
+ min-width: 104rpx;
14
+ font-size: 40rpx;
15
+ }
16
+ .popup-header .popup-header-title {
17
+ color: #333333;
18
+ font-size: 16px;
19
+ font-weight: 500;
20
+ font-family: "PingFang SC";
21
+ }
22
+ .popup-header .van-action-sheet__left {
23
+ color: #c8c9cc;
24
+ font-size: 22px;
25
+ line-height: inherit;
26
+ display: flex;
27
+ align-items: center;
28
+ min-width: 104rpx;
29
+ }
30
+ .popup-header .van-action-sheet__left .order-icon {
31
+ display: inline-block;
32
+ width: 40rpx;
33
+ height: 40rpx;
34
+ -moz-background-size: 100% 100%;
35
+ background-size: 100% 100%;
36
+ background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAFAAAABQCAYAAACOEfKtAAAACXBIWXMAACxLAAAsSwGlPZ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HA43GdZtM8UhReLxZK+pIVyjocJvTruHDN85vxnqHa73ZtqtdqG/IO1pVnv9/vnrOIMwygFPwHK0g4OEWNPBgAAAABJRU5ErkJggg==");
37
+ }
38
+ .popup-header .van-action-sheet__left .head-left-txt {
39
+ opacity: 1;
40
+ color: #666666;
41
+ font-size: 14px;
42
+ font-weight: 500;
43
+ font-family: "PingFang SC";
44
+ margin-left: 8rpx;
45
+ }
@@ -0,0 +1,10 @@
1
+ <!--
2
+ * @Descripttion:
3
+ * @version:
4
+ * @Author: conlinchen
5
+ * @Date: 2021-11-13 15:55:49
6
+ * @LastEditors: conlinchen
7
+ * @LastEditTime: 2021-11-13 15:55:49
8
+ -->
9
+ ## 开发者:Conlin
10
+ ## 该组件的业务功能: 直播营销模块中的优惠券列表
@@ -0,0 +1,269 @@
1
+ /*
2
+ * @Descripttion:
3
+ * @version:
4
+ * @Author: conlinchen
5
+ * @Date: 2021-10-28 15:32:24
6
+ * @LastEditors: conlinchen
7
+ * @LastEditTime: 2021-11-18 19:52:02
8
+ */
9
+
10
+ import { getGoodsList, getCouponSwitch } from "../common/api/liveGoodsList"
11
+ const computedBehavior = require('miniprogram-computed').behavior
12
+
13
+ const SPU_TYPE = {
14
+ 1: "图文",
15
+ 2: "音频",
16
+ 3: "视频",
17
+ 4: "直播",
18
+ 35: "班课",
19
+ 20: "电子书",
20
+ 6: "专栏",
21
+ 8: "大专栏",
22
+ 5: "会员",
23
+ 25: "训练营",
24
+ 21: "实物商品",
25
+ 29: "线下课", //体验课也是29
26
+ 22: "分销商品",
27
+ 12: "分销商品", //暂时不做
28
+ 41: "有价优惠券",
29
+ 45: "AI互动课",
30
+ 23: "超级会员"
31
+ }
32
+ const MARKET_ACTIVITY_MAP = {
33
+ 3: "限时折扣",
34
+ 4: "好友助力",
35
+ 5: "裂变海报",
36
+ 6: "拼团",
37
+ 7: "涨粉神器",
38
+ 8: "秒杀",
39
+ }
40
+
41
+ Component({
42
+ behaviors: [computedBehavior],
43
+ properties: {
44
+ sensorReportParams: {
45
+ type: Object,
46
+ value: {}
47
+ },
48
+ aliveInfo: {
49
+ type: Object,
50
+ value: {
51
+ alive_id: 'l_61c2a4dae4b0ad9a9d6887dc',
52
+ alive_state: 2
53
+ },
54
+ },
55
+ ENV_NAME: {
56
+ type: String,
57
+ value: ""
58
+ },
59
+ showList: {
60
+ type: Boolean,
61
+ value: false,
62
+ observer(newVal){
63
+ this.setData({
64
+ show: newVal,
65
+ refreshing: newVal
66
+ })
67
+ console.log(newVal)
68
+ newVal && this.onLoad()
69
+ }
70
+ },
71
+ // 确认订单失败回调 刷新商品列表
72
+ refresh: {
73
+ type: Boolean,
74
+ value: false,
75
+ observer(newVal, oldVal){
76
+ if (newVal !== oldVal) {
77
+ console.log("refresh", newVal, oldVal)
78
+ this.onLoad()
79
+ }
80
+ }
81
+ },
82
+ },
83
+ data: {
84
+ show: false,
85
+ goodsInfo:[],
86
+ page_size: 5,
87
+ page_index: 1,
88
+ total: 0,
89
+ refreshing: false,
90
+ finishedTxt: '加载中',
91
+ finished: false,
92
+ },
93
+ lifetimes: {
94
+ // 生命周期函数,可以为函数,或一个在methods段中定义的方法名
95
+ attached: function () {
96
+
97
+ },
98
+ moved: function () { },
99
+ detached: function () { },
100
+ },
101
+ methods: {
102
+ onLoad(){
103
+ if (this._freshing) return
104
+ this._freshing = true
105
+ this.setData({
106
+ finished: false,
107
+ page_index: 1
108
+ })
109
+ this.getGoodsList()
110
+ },
111
+ onScrolltolower(){
112
+ console.log(this.data.finished, this._freshing )
113
+ if(this.scrolling){return}
114
+ this.scrolling = true
115
+ this.setData({
116
+ finishedTxt: this.data.finished ? "没有更多了" : "加载中"
117
+ })
118
+ if(this.data.finished || this._freshing){
119
+ return
120
+ }
121
+ this.getGoodsList()
122
+ },
123
+ getGoodsList(){
124
+ let params = {
125
+ alive_id: this.data.aliveInfo.alive_id,
126
+ type: 1,
127
+ pageSize: this.data.page_size,
128
+ page: this.data.page_index,
129
+ port: 2
130
+ }
131
+ getGoodsList(params).then(res=>{
132
+ let { data, code } = res.data
133
+ if (code === 0) {
134
+ var total = data[0] ? data[0].total : this.data.total
135
+ var finishedTxt = "加载中"
136
+ var finished = false
137
+
138
+ if(this._freshing){
139
+ //下拉加载直接赋值
140
+ this.formatData(data, true)
141
+ }else {
142
+ this.formatData(data)
143
+ }
144
+ // 下拉加载,且数据返回空
145
+ if(this._freshing && data.length === 0){
146
+ finishedTxt = "no-data"
147
+ }else if (this.data.goodsInfo.length >= total || data.length === 0) {
148
+ // 获取到所有数据
149
+ finished = true// 没有更多了
150
+ finishedTxt = "没有更多了"
151
+ this.setData({finishedTxt})
152
+ }else {
153
+ finishedTxt = "加载中"
154
+ }
155
+ this.setData({
156
+ refreshing: false,
157
+ page_index: this.data.page_index + 1,
158
+ finishedTxt,
159
+ finished,
160
+ total
161
+ })
162
+ this._freshing = false
163
+ this.scrolling = false
164
+ }
165
+ })
166
+ },
167
+ formatData(data, refreshing = false){
168
+ let goodsInfo = this.data.goodsInfo
169
+ data.forEach((item,index) => {
170
+ this.formatItem(item)
171
+ if (!refreshing) {
172
+ goodsInfo.push(item)
173
+ }
174
+ })
175
+ if (refreshing) {
176
+ //下拉刷新的时候直接赋值
177
+ goodsInfo = JSON.parse(JSON.stringify(data))
178
+ }
179
+ this.setData({goodsInfo})
180
+ },
181
+ formatItem(e) {
182
+ e.resourceTypeName = SPU_TYPE[e.resource_type] // 商品类型
183
+ e.leftStock = e.is_activity && e.now_stock ? e.now_stock : e.stock // 商品库存,活动中且有活动库存就用活动库存
184
+ // 处理未到活动时间的限时折扣
185
+ if (e.activity_type === 3) {
186
+ let nowTime = new Date().getTime()
187
+ let startTime = new Date(e.start_at.replace(/-/g, "/")).getTime()
188
+ let isStart = !!(nowTime - startTime > 0)
189
+ if (!isStart) {
190
+ e.is_activity = 0 // 未到活动时间的限时折扣 不参与比价
191
+ }
192
+ }
193
+ // 预热前和活动结束后的秒杀不参与比价
194
+ if (e.activity_type === 8) {
195
+ let startTime = new Date(e.start_at.replace(/-/g, "/")).getTime()
196
+ let preHeatTime = startTime - e.sec_kill_preheat_time * 1000 // 预热开始时间
197
+ let nowTime = new Date().getTime()
198
+ let isStartPreHeat = !!(nowTime - preHeatTime > 0) // 预热时间到了
199
+ let endTime = new Date(e.end_at.replace(/-/g, "/")).getTime()
200
+ let isEndSecKill = !!(nowTime - endTime > 0) // 秒杀活动结束了
201
+ if (!isStartPreHeat || isEndSecKill) {
202
+ e.is_activity = 0 // 预热前和活动结束后的秒杀 不参与比价
203
+ }
204
+ }
205
+ //展示购买价处理;取原价、营销活动价、超级会员价到一个数组从小到大排序,最低为购买价。防止价格一样,所以加了权重比较
206
+ let arr = []
207
+ arr.push({
208
+ active: "",
209
+ price: e.price,
210
+ weight: e.price + 0.0003,
211
+ })
212
+ // 活动管理、实物商品、有价优惠券、线下课和课时包不能设置活动库存,其他可以设置活动库存得需要判断是否还剩余活动库存;拼团也不能设置活动库存。
213
+ let notExistNowStock = [9, 21, 41, 29, 42].indexOf(e.resource_type) > -1
214
+ e.is_activity &&
215
+ (notExistNowStock ||
216
+ typeof e.now_stock === "number" ||
217
+ e.activity_type === 6) &&
218
+ arr.push({
219
+ //参与营销活动且有活动库存的时候加入比较 now_stock -""空字符串的时候代表已经买完 -0代表不限量
220
+ active: MARKET_ACTIVITY_MAP[e.activity_type],
221
+ price: e.activity_price,
222
+ weight: e.activity_price + 0.0001,
223
+ })
224
+ e.svip_price &&
225
+ arr.push({
226
+ //判断超级会员价
227
+ active: "超级会员",
228
+ price: e.svip_price,
229
+ weight: e.svip_price + 0.0002,
230
+ })
231
+ arr.sort((a, b) => a.weight - b.weight)
232
+ let svipAllFree = e.resource_rights_type === 1
233
+ e.priceShow = arr[0].price //展示的购买价格
234
+ e.priceShowInt = svipAllFree ? this.priceInt(e.price) : this.priceInt(e.priceShow) // 展示价格的整数部分
235
+ e.priceShowFlow = svipAllFree ? this.priceFlow(e.price) : this.priceFlow(e.priceShow) // 展示是价格的小数部分
236
+ e.preferentialShowInt = this.priceInt(e.preferential_price) // 展示券后价的整数部分
237
+ e.preferentialShowFlow = this.priceFlow(e.preferential_price) // 展示券后价的小数部分
238
+ e.currentActive = arr[0].active //当前适用得营销模式;有可能是原价,超级会员,营销活动
239
+ //展示划线价处理;有营销活动、超级会员,划线价是原价;只有原价和原划线价,划线价是原划线价;
240
+ if (e.currentActive !== "") {
241
+ e.priceLine = e.price
242
+ } else {
243
+ e.priceLine = e.line_price || 0 //未设置原划线价的时候不展示划线价
244
+ }
245
+ e.priceLineShowInt = this.priceInt(e.priceLine) // 展示划线价的整数部分
246
+ e.priceLineShowFlow = this.priceFlow(e.priceLine) // 展示划线的小数部分
247
+ e.entityShowStock = (e.resource_type === 21 || e.resource_type === 41) && e.show_stock // 实物商品库存依赖 B端店铺设置(show_stock):详情页展示不展示剩余件数
248
+ e.hasStock = [29,35].indexOf(e.resource_type) > -1 || e.entityShowStock || e.now_stock // 班课、线下课、实物商品、体验课、有活动库存,满足其一即展示库存
249
+ },
250
+ priceInt(val){
251
+ val = Number(val)
252
+ return ((val / 100 ).toFixed(2) + '').split('.')[0]
253
+ },
254
+ priceFlow(val){
255
+ val = Number(val)
256
+ return ((val / 100 ).toFixed(2) + '').split('.')[1] || '00'
257
+ },
258
+ closePop(){
259
+ this.triggerEvent("closePop")
260
+ },
261
+ preventScroll(){
262
+ return
263
+ },
264
+ sendGoodsCard(e){
265
+ console.log('sendGoodsCard',e.detail)
266
+ this.triggerEvent('sendGoodsCard',e.detail)
267
+ }
268
+ }
269
+ })
@@ -0,0 +1,8 @@
1
+ {
2
+ "component": true,
3
+ "usingComponents": {
4
+ "goods-item": "../GoodsItem/index",
5
+ "header": "./Header/index",
6
+ "custom-popup": "../CustomPopup"
7
+ }
8
+ }
@@ -0,0 +1,53 @@
1
+
2
+ .box {
3
+ margin: 0 12px;
4
+ }
5
+
6
+ .title {
7
+ margin: 0;
8
+ padding: 32px 16px 16px;
9
+ color: rgba(69, 90, 100, 0.6);
10
+ font-weight: normal;
11
+ font-size: 18px;
12
+ line-height: 20px;
13
+ text-align: center;
14
+ }
15
+
16
+ .btn {
17
+ display: block;
18
+ width: 100%;
19
+ margin: 10px 0;
20
+ background-color: #fff;
21
+ }
22
+ .page-main{
23
+ height: 100%;
24
+ }
25
+ .goods-list{
26
+ box-sizing: border-box;
27
+ min-height: 300px;
28
+ display: flex;
29
+ flex-direction: column;
30
+ height: 100%;
31
+ .finished-text{
32
+ display: flex;
33
+ justify-content: center;
34
+ color: #999;
35
+ font-size: 28rpx;
36
+ padding: 20rpx 0;
37
+ }
38
+ .no-data{
39
+ display: flex;
40
+ flex-direction: column;
41
+ align-items: center;
42
+ margin-top: 80rpx;
43
+ .no-data-png{
44
+ width: 176rpx;
45
+ height: 176rpx;
46
+ }
47
+ .no-data-text{
48
+ color: #999999;
49
+ font-size: 28rpx;
50
+ margin-top: 32rpx;
51
+ }
52
+ }
53
+ }