xiaoe_mp_npm 1.0.6 → 1.0.7-alpha2
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.
- package/.gitlab-ci.yml +44 -44
- package/miniprogram_dist/ConfirmOrder/components/AddressSelect/index.js +160 -160
- package/miniprogram_dist/ConfirmOrder/components/ChoosePicker/index.js +115 -115
- package/miniprogram_dist/ConfirmOrder/components/ConfirmOrderContent/index.js +890 -890
- package/miniprogram_dist/ConfirmOrder/components/ConfirmOrderContent/index.json +23 -23
- package/miniprogram_dist/ConfirmOrder/components/ConfirmOrderContent/index.scss +44 -44
- package/miniprogram_dist/ConfirmOrder/components/ConfirmOrderContent/index.wxml +188 -188
- package/miniprogram_dist/ConfirmOrder/components/GoodsInfo/components/CopGoodsList/index.js +129 -129
- package/miniprogram_dist/ConfirmOrder/components/GoodsInfo/components/CopGoodsList/index.json +8 -8
- package/miniprogram_dist/ConfirmOrder/components/GoodsInfo/components/CopGoodsList/index.scss +58 -58
- package/miniprogram_dist/ConfirmOrder/components/GoodsInfo/components/CopGoodsList/index.wxml +25 -25
- package/miniprogram_dist/ConfirmOrder/components/GoodsInfo/index.js +448 -448
- package/miniprogram_dist/ConfirmOrder/components/GoodsInfo/index.json +9 -9
- package/miniprogram_dist/ConfirmOrder/components/GoodsInfo/index.scss +222 -222
- package/miniprogram_dist/ConfirmOrder/components/GoodsInfo/index.wxml +81 -81
- package/miniprogram_dist/ConfirmOrder/components/IntegralSelect/index.scss +90 -90
- package/miniprogram_dist/ConfirmOrder/components/Invoice/index.scss +60 -60
- package/miniprogram_dist/ConfirmOrder/components/LeaveWord/index.scss +39 -39
- package/miniprogram_dist/ConfirmOrder/components/PayBar/index.js +249 -249
- package/miniprogram_dist/ConfirmOrder/components/PayBar/index.scss +61 -61
- package/miniprogram_dist/ConfirmOrder/components/PayDetail/index.scss +40 -40
- package/miniprogram_dist/ConfirmOrder/components/PickupSelect/index.js +89 -89
- package/miniprogram_dist/ConfirmOrder/components/PickupSelect/index.wxml +13 -13
- package/miniprogram_dist/ConfirmOrder/components/SvipSelect/SvipSelect.js +99 -99
- package/miniprogram_dist/ConfirmOrder/components/SvipSelect/SvipSelect.json +6 -6
- package/miniprogram_dist/ConfirmOrder/components/SvipSelect/SvipSelect.scss +150 -150
- package/miniprogram_dist/ConfirmOrder/components/SvipSelect/SvipSelect.wxml +39 -39
- package/miniprogram_dist/ConfirmOrder/components/SvipSelect/filter.wxs +6 -6
- package/miniprogram_dist/ConfirmOrder/index.js +110 -110
- package/miniprogram_dist/CopGoodsCard/constans.js +462 -462
- package/miniprogram_dist/CopGoodsCard/index.js +147 -147
- package/miniprogram_dist/CopGoodsCard/index.json +2 -2
- package/miniprogram_dist/CopGoodsCard/index.scss +100 -100
- package/miniprogram_dist/CopGoodsCard/index.wxml +20 -20
- package/miniprogram_dist/CouponList/components/CouponItem/index.css +1715 -1715
- package/miniprogram_dist/CouponList/components/CouponItem/index.js +325 -319
- package/miniprogram_dist/CouponList/components/CouponItem/index.min.css +1 -1
- package/miniprogram_dist/CouponList/components/CouponItem/index.scss +591 -591
- package/miniprogram_dist/CouponList/components/CouponItem/index.wxml +199 -199
- package/miniprogram_dist/CouponList/couponColumn/index.js +176 -176
- package/miniprogram_dist/CouponList/couponColumn/index.scss +117 -117
- package/miniprogram_dist/CouponList/couponColumn/index.wxml +39 -39
- package/miniprogram_dist/CouponReceivePopup/index.js +72 -72
- package/miniprogram_dist/CouponReceivePopup/index.json +5 -5
- package/miniprogram_dist/CouponReceivePopup/index.scss +99 -99
- package/miniprogram_dist/CouponReceivePopup/index.wxml +85 -85
- package/miniprogram_dist/CustomPopup/index.js +82 -82
- package/miniprogram_dist/CustomPopup/index.wxml +25 -25
- package/miniprogram_dist/GoodsItem/index.js +745 -745
- package/miniprogram_dist/GoodsItem/index.scss +524 -524
- package/miniprogram_dist/GoodsItem/index.wxml +173 -173
- package/miniprogram_dist/GoodsItem/index.wxs +18 -18
- package/miniprogram_dist/GoodsRecommend/fun.wxs +37 -37
- package/miniprogram_dist/GoodsRecommend/index.js +91 -91
- package/miniprogram_dist/GoodsRecommend/index.json +3 -3
- package/miniprogram_dist/GoodsRecommend/index.less +129 -129
- package/miniprogram_dist/GoodsRecommend/index.scss +162 -162
- package/miniprogram_dist/GoodsRecommend/index.wxml +47 -47
- package/miniprogram_dist/LiveGoodsList/Header/index.scss +78 -78
- package/miniprogram_dist/LiveGoodsList/index.js +821 -821
- package/miniprogram_dist/LiveGoodsList/index.scss +92 -92
- package/miniprogram_dist/LiveGoodsList/index.wxml +106 -106
- package/miniprogram_dist/PayModule/button/index.scss +44 -44
- package/miniprogram_dist/PayModule/index/index.js +264 -264
- package/miniprogram_dist/Task/TaskBubble/index.js +117 -117
- package/miniprogram_dist/Task/TaskBubble/index.json +3 -3
- package/miniprogram_dist/Task/TaskBubble/index.scss +125 -125
- package/miniprogram_dist/Task/TaskBubble/index.wxml +22 -22
- package/miniprogram_dist/Task/TaskIcon/index.js +29 -29
- package/miniprogram_dist/Task/TaskIcon/index.json +4 -4
- package/miniprogram_dist/Task/TaskIcon/index.scss +70 -70
- package/miniprogram_dist/Task/TaskIcon/index.wxml +5 -5
- package/miniprogram_dist/Task/TaskPopup/component/RewardList/index.js +39 -39
- package/miniprogram_dist/Task/TaskPopup/component/RewardList/index.json +6 -6
- package/miniprogram_dist/Task/TaskPopup/component/RewardList/index.scss +39 -39
- package/miniprogram_dist/Task/TaskPopup/component/RewardList/index.wxml +19 -19
- package/miniprogram_dist/Task/TaskPopup/component/TaskItem/index.js +207 -207
- package/miniprogram_dist/Task/TaskPopup/component/TaskItem/index.json +5 -5
- package/miniprogram_dist/Task/TaskPopup/component/TaskItem/index.scss +139 -139
- package/miniprogram_dist/Task/TaskPopup/component/TaskItem/index.wxml +43 -43
- package/miniprogram_dist/Task/TaskPopup/component/TaskItem/index.wxs +7 -7
- package/miniprogram_dist/Task/TaskPopup/component/TaskList/index.js +146 -146
- package/miniprogram_dist/Task/TaskPopup/component/TaskList/index.json +7 -7
- package/miniprogram_dist/Task/TaskPopup/component/TaskList/index.scss +66 -66
- package/miniprogram_dist/Task/TaskPopup/component/TaskList/index.wxml +39 -39
- package/miniprogram_dist/Task/TaskPopup/component/TaskType/index.js +75 -75
- package/miniprogram_dist/Task/TaskPopup/component/TaskType/index.json +9 -9
- package/miniprogram_dist/Task/TaskPopup/component/TaskType/index.scss +59 -59
- package/miniprogram_dist/Task/TaskPopup/component/TaskType/index.wxml +42 -42
- package/miniprogram_dist/Task/TaskPopup/index.js +113 -113
- package/miniprogram_dist/Task/TaskPopup/index.json +8 -8
- package/miniprogram_dist/Task/TaskPopup/index.scss +113 -113
- package/miniprogram_dist/Task/TaskPopup/index.wxml +67 -67
- package/miniprogram_dist/Task/taskReceivePopup/coupon/index.js +52 -52
- package/miniprogram_dist/Task/taskReceivePopup/coupon/index.json +6 -6
- package/miniprogram_dist/Task/taskReceivePopup/coupon/index.scss +91 -91
- package/miniprogram_dist/Task/taskReceivePopup/coupon/index.wxml +53 -53
- package/miniprogram_dist/Task/taskReceivePopup/coupon/index.wxs +48 -48
- package/miniprogram_dist/Task/taskReceivePopup/index.js +30 -30
- package/miniprogram_dist/Task/taskReceivePopup/index.json +11 -11
- package/miniprogram_dist/Task/taskReceivePopup/index.wxml +18 -18
- package/miniprogram_dist/Task/taskReceivePopup/integral/index.js +37 -37
- package/miniprogram_dist/Task/taskReceivePopup/integral/index.json +6 -6
- package/miniprogram_dist/Task/taskReceivePopup/integral/index.scss +60 -60
- package/miniprogram_dist/Task/taskReceivePopup/integral/index.wxml +17 -17
- package/miniprogram_dist/TeacherGoodsList/index.js +825 -825
- package/miniprogram_dist/TeacherGoodsList/index.json +9 -9
- package/miniprogram_dist/TeacherGoodsList/index.scss +145 -145
- package/miniprogram_dist/TeacherGoodsList/index.wxml +110 -110
- package/miniprogram_dist/common/api/confirmOrder.js +223 -223
- package/miniprogram_dist/common/api/couponlist.js +2 -63
- package/miniprogram_dist/common/api/liveGoodsList.js +89 -89
- package/miniprogram_dist/common/api/sku.js +73 -73
- package/miniprogram_dist/common/utils/index.js +69 -69
- package/miniprogram_dist/coupon/components/CouponItem/index.less +208 -208
- package/miniprogram_dist/coupon/components/CouponItem/index.scss +246 -246
- package/miniprogram_dist/coupon/components/CouponSelect/index.scss +330 -330
- package/miniprogram_dist/coupon/index.js +248 -248
- package/miniprogram_dist/coupon/index.scss +83 -83
- package/package.json +78 -78
- package/src/ConfirmOrder/components/AddressSelect/index.js +160 -160
- package/src/ConfirmOrder/components/ChoosePicker/index.js +115 -115
- package/src/ConfirmOrder/components/ConfirmOrderContent/index.js +890 -890
- package/src/ConfirmOrder/components/ConfirmOrderContent/index.json +23 -23
- package/src/ConfirmOrder/components/ConfirmOrderContent/index.scss +44 -44
- package/src/ConfirmOrder/components/ConfirmOrderContent/index.wxml +188 -188
- package/src/ConfirmOrder/components/ConfirmOrderContent/index.wxss +51 -51
- package/src/ConfirmOrder/components/GoodsInfo/components/CopGoodsList/index.js +129 -129
- package/src/ConfirmOrder/components/GoodsInfo/components/CopGoodsList/index.json +8 -8
- package/src/ConfirmOrder/components/GoodsInfo/components/CopGoodsList/index.scss +58 -58
- package/src/ConfirmOrder/components/GoodsInfo/components/CopGoodsList/index.wxml +25 -25
- package/src/ConfirmOrder/components/GoodsInfo/components/CopGoodsList/index.wxss +1 -1
- package/src/ConfirmOrder/components/GoodsInfo/index.js +448 -448
- package/src/ConfirmOrder/components/GoodsInfo/index.json +9 -9
- package/src/ConfirmOrder/components/GoodsInfo/index.scss +222 -222
- package/src/ConfirmOrder/components/GoodsInfo/index.wxml +81 -81
- package/src/ConfirmOrder/components/GoodsInfo/index.wxss +673 -673
- package/src/ConfirmOrder/components/IntegralSelect/index.scss +90 -90
- package/src/ConfirmOrder/components/IntegralSelect/index.wxss +218 -218
- package/src/ConfirmOrder/components/Invoice/index.scss +60 -60
- package/src/ConfirmOrder/components/Invoice/index.wxss +93 -93
- package/src/ConfirmOrder/components/LeaveWord/index.scss +39 -39
- package/src/ConfirmOrder/components/LeaveWord/index.wxss +34 -34
- package/src/ConfirmOrder/components/PayBar/index.js +249 -249
- package/src/ConfirmOrder/components/PayBar/index.scss +61 -61
- package/src/ConfirmOrder/components/PayBar/index.wxss +108 -108
- package/src/ConfirmOrder/components/PayDetail/index.scss +40 -40
- package/src/ConfirmOrder/components/PayDetail/index.wxss +50 -50
- package/src/ConfirmOrder/components/PickupSelect/index.js +89 -89
- package/src/ConfirmOrder/components/PickupSelect/index.wxml +13 -13
- package/src/ConfirmOrder/components/SvipSelect/SvipSelect.js +99 -99
- package/src/ConfirmOrder/components/SvipSelect/SvipSelect.json +6 -6
- package/src/ConfirmOrder/components/SvipSelect/SvipSelect.scss +150 -150
- package/src/ConfirmOrder/components/SvipSelect/SvipSelect.wxml +39 -39
- package/src/ConfirmOrder/components/SvipSelect/SvipSelect.wxss +266 -266
- package/src/ConfirmOrder/components/SvipSelect/filter.wxs +6 -6
- package/src/ConfirmOrder/index.js +110 -110
- package/src/CopGoodsCard/constans.js +462 -462
- package/src/CopGoodsCard/index.js +147 -147
- package/src/CopGoodsCard/index.json +2 -2
- package/src/CopGoodsCard/index.scss +100 -100
- package/src/CopGoodsCard/index.wxml +20 -20
- package/src/CopGoodsCard/index.wxss +1 -1
- package/src/CouponList/components/CouponItem/index.css +1715 -1715
- package/src/CouponList/components/CouponItem/index.js +325 -319
- package/src/CouponList/components/CouponItem/index.min.css +1 -1
- package/src/CouponList/components/CouponItem/index.scss +591 -591
- package/src/CouponList/components/CouponItem/index.wxml +199 -199
- package/src/CouponList/components/CouponItem/index.wxss +1715 -1715
- package/src/CouponList/couponColumn/index.js +176 -176
- package/src/CouponList/couponColumn/index.scss +117 -117
- package/src/CouponList/couponColumn/index.wxml +39 -39
- package/src/CouponList/couponColumn/index.wxss +265 -265
- package/src/CouponReceivePopup/index.js +72 -72
- package/src/CouponReceivePopup/index.json +5 -5
- package/src/CouponReceivePopup/index.scss +99 -99
- package/src/CouponReceivePopup/index.wxml +85 -85
- package/src/CouponReceivePopup/index.wxss +1 -1
- package/src/CustomPopup/index.js +82 -82
- package/src/CustomPopup/index.wxml +25 -25
- package/src/GoodsItem/index.js +745 -745
- package/src/GoodsItem/index.scss +524 -524
- package/src/GoodsItem/index.wxml +173 -173
- package/src/GoodsItem/index.wxs +18 -18
- package/src/GoodsItem/index.wxss +1935 -1935
- package/src/GoodsRecommend/fun.wxs +37 -37
- package/src/GoodsRecommend/index.js +91 -91
- package/src/GoodsRecommend/index.json +3 -3
- package/src/GoodsRecommend/index.less +129 -129
- package/src/GoodsRecommend/index.scss +162 -162
- package/src/GoodsRecommend/index.wxml +47 -47
- package/src/GoodsRecommend/index.wxss +537 -537
- package/src/LiveGoodsList/Header/index.scss +78 -78
- package/src/LiveGoodsList/Header/index.wxss +190 -190
- package/src/LiveGoodsList/index.js +821 -821
- package/src/LiveGoodsList/index.scss +92 -92
- package/src/LiveGoodsList/index.wxml +106 -106
- package/src/LiveGoodsList/index.wxss +230 -230
- package/src/PayModule/button/index.scss +44 -44
- package/src/PayModule/button/index.wxss +58 -58
- package/src/PayModule/index/index.js +264 -264
- package/src/Sku/commSelect/index.wxss +54 -54
- package/src/Task/TaskBubble/index.js +117 -117
- package/src/Task/TaskBubble/index.json +3 -3
- package/src/Task/TaskBubble/index.scss +125 -125
- package/src/Task/TaskBubble/index.wxml +22 -22
- package/src/Task/TaskBubble/index.wxss +289 -289
- package/src/Task/TaskIcon/index.js +29 -29
- package/src/Task/TaskIcon/index.json +4 -4
- package/src/Task/TaskIcon/index.scss +70 -70
- package/src/Task/TaskIcon/index.wxml +5 -5
- package/src/Task/TaskIcon/index.wxss +130 -130
- package/src/Task/TaskPopup/component/RewardList/index.js +39 -39
- package/src/Task/TaskPopup/component/RewardList/index.json +6 -6
- package/src/Task/TaskPopup/component/RewardList/index.scss +39 -39
- package/src/Task/TaskPopup/component/RewardList/index.wxml +19 -19
- package/src/Task/TaskPopup/component/RewardList/index.wxss +18 -18
- package/src/Task/TaskPopup/component/TaskItem/index.js +207 -207
- package/src/Task/TaskPopup/component/TaskItem/index.json +5 -5
- package/src/Task/TaskPopup/component/TaskItem/index.scss +139 -139
- package/src/Task/TaskPopup/component/TaskItem/index.wxml +43 -43
- package/src/Task/TaskPopup/component/TaskItem/index.wxs +7 -7
- package/src/Task/TaskPopup/component/TaskItem/index.wxss +394 -394
- package/src/Task/TaskPopup/component/TaskList/index.js +146 -146
- package/src/Task/TaskPopup/component/TaskList/index.json +7 -7
- package/src/Task/TaskPopup/component/TaskList/index.scss +66 -66
- package/src/Task/TaskPopup/component/TaskList/index.wxml +39 -39
- package/src/Task/TaskPopup/component/TaskList/index.wxss +118 -118
- package/src/Task/TaskPopup/component/TaskType/index.js +75 -75
- package/src/Task/TaskPopup/component/TaskType/index.json +9 -9
- package/src/Task/TaskPopup/component/TaskType/index.scss +59 -59
- package/src/Task/TaskPopup/component/TaskType/index.wxml +42 -42
- package/src/Task/TaskPopup/component/TaskType/index.wxss +98 -98
- package/src/Task/TaskPopup/index.js +113 -113
- package/src/Task/TaskPopup/index.json +8 -8
- package/src/Task/TaskPopup/index.scss +113 -113
- package/src/Task/TaskPopup/index.wxml +67 -67
- package/src/Task/TaskPopup/index.wxss +306 -306
- package/src/Task/taskReceivePopup/coupon/index.js +52 -52
- package/src/Task/taskReceivePopup/coupon/index.json +6 -6
- package/src/Task/taskReceivePopup/coupon/index.scss +91 -91
- package/src/Task/taskReceivePopup/coupon/index.wxml +53 -53
- package/src/Task/taskReceivePopup/coupon/index.wxs +48 -48
- package/src/Task/taskReceivePopup/coupon/index.wxss +187 -187
- package/src/Task/taskReceivePopup/index.js +30 -30
- package/src/Task/taskReceivePopup/index.json +11 -11
- package/src/Task/taskReceivePopup/index.wxml +18 -18
- package/src/Task/taskReceivePopup/index.wxss +1 -1
- package/src/Task/taskReceivePopup/integral/index.js +37 -37
- package/src/Task/taskReceivePopup/integral/index.json +6 -6
- package/src/Task/taskReceivePopup/integral/index.scss +60 -60
- package/src/Task/taskReceivePopup/integral/index.wxml +17 -17
- package/src/Task/taskReceivePopup/integral/index.wxss +94 -94
- package/src/TeacherGoodsList/index.js +825 -825
- package/src/TeacherGoodsList/index.json +9 -9
- package/src/TeacherGoodsList/index.scss +145 -145
- package/src/TeacherGoodsList/index.wxml +110 -110
- package/src/TeacherGoodsList/index.wxss +196 -196
- package/src/common/api/confirmOrder.js +223 -223
- package/src/common/api/couponlist.js +2 -63
- package/src/common/api/liveGoodsList.js +89 -89
- package/src/common/api/sku.js +73 -73
- package/src/common/utils/index.js +69 -69
- package/src/coupon/components/CouponItem/index.less +208 -208
- package/src/coupon/components/CouponItem/index.scss +246 -246
- package/src/coupon/components/CouponItem/index.wxss +821 -821
- package/src/coupon/components/CouponSelect/index.scss +330 -330
- package/src/coupon/components/CouponSelect/index.wxss +1132 -1132
- package/src/coupon/index.js +248 -248
- package/src/coupon/index.scss +83 -83
- package/src/coupon/index.wxss +216 -216
package/src/GoodsItem/index.js
CHANGED
|
@@ -1,745 +1,745 @@
|
|
|
1
|
-
/*
|
|
2
|
-
* @Descripttion:
|
|
3
|
-
* @version:
|
|
4
|
-
* @Author: conlinchen
|
|
5
|
-
* @Date: 2021-10-28 18:17:48
|
|
6
|
-
* @LastEditors: conlinchen
|
|
7
|
-
* @LastEditTime: 2021-11-18 19:49:11
|
|
8
|
-
*/
|
|
9
|
-
import { debounce, rpxToVmin } from "../common/utils/index"
|
|
10
|
-
import { getUserPermission, getUserPermissionNew, snapCheck, snapCheckNew } from "../common/api/liveGoodsList"
|
|
11
|
-
import {
|
|
12
|
-
ASSOCIATION,
|
|
13
|
-
PUNCH_CARD
|
|
14
|
-
} from "../common/utils/constants.js";
|
|
15
|
-
|
|
16
|
-
const { utils, sensorLog } = require("live-mp-tools");
|
|
17
|
-
import { showGoods } from "../common/api/liveGoodsList"
|
|
18
|
-
|
|
19
|
-
const computedBehavior = require('miniprogram-computed').behavior
|
|
20
|
-
|
|
21
|
-
Component({
|
|
22
|
-
behaviors: [computedBehavior],
|
|
23
|
-
options: {
|
|
24
|
-
addGlobalClass: true,
|
|
25
|
-
},
|
|
26
|
-
/**
|
|
27
|
-
* 组件的属性列表
|
|
28
|
-
*/
|
|
29
|
-
properties: {
|
|
30
|
-
goodsInfo: {
|
|
31
|
-
type: Object,
|
|
32
|
-
value: {},
|
|
33
|
-
observer(newVal) {
|
|
34
|
-
// 商品没有的话,不处理
|
|
35
|
-
if (!newVal.id) return
|
|
36
|
-
//超级会员全免权益
|
|
37
|
-
let svipAllFree = newVal.resource_rights_type === 1
|
|
38
|
-
let currentActive = ''
|
|
39
|
-
if (svipAllFree) {
|
|
40
|
-
currentActive = '超级会员'
|
|
41
|
-
} else {
|
|
42
|
-
currentActive = newVal.currentActive
|
|
43
|
-
}
|
|
44
|
-
//IOS小程序端 ios小程序商品列表 直播、线下课、班课、实物商品可买,其他知识商品不可买,需不显示价格 点击去抢购后按现网逻辑跳转至小程序的商品详情
|
|
45
|
-
let info = wx.getSystemInfoSync()
|
|
46
|
-
let IOSMiniProgramCanBuy = [4, 29, 35, 21, 69].indexOf(newVal.resource_type) > -1 //true-能买 false-不能买
|
|
47
|
-
let isIOS = info.platform === 'ios'
|
|
48
|
-
console.log("platform", info.platform, isIOS)
|
|
49
|
-
const pages = getCurrentPages();
|
|
50
|
-
const currentPage = pages[pages.length - 1];
|
|
51
|
-
const url = `/${currentPage.route}`;
|
|
52
|
-
//预热开始时间
|
|
53
|
-
let startTime = newVal.start_at && new Date(newVal.start_at.replace(/-/g, "/")) || new Date()
|
|
54
|
-
let time = startTime.getTime() - newVal.sec_kill_preheat_time * 1000
|
|
55
|
-
let preHeatTime = new Date(time) || new Date()
|
|
56
|
-
|
|
57
|
-
let hasPreheat = newVal.sec_kill_is_preheat === 1
|
|
58
|
-
|
|
59
|
-
let startTime2 = newVal.start_at && new Date(newVal.start_at.replace(/-/g, "/")) || new Date()
|
|
60
|
-
let nowTime = new Date().getTime()
|
|
61
|
-
let preheating = hasPreheat && nowTime > preHeatTime.getTime() && startTime2.getTime() > nowTime
|
|
62
|
-
let isSeckill = currentActive === '秒杀'
|
|
63
|
-
let checked = newVal.is_display_package === 1
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
this.setData({
|
|
67
|
-
goodsItem: newVal,
|
|
68
|
-
currentActive,
|
|
69
|
-
IOSMiniProgramCanBuy,
|
|
70
|
-
isIOS,
|
|
71
|
-
page_path: url,
|
|
72
|
-
preHeatTime,
|
|
73
|
-
preheating,
|
|
74
|
-
isSeckill,
|
|
75
|
-
checked
|
|
76
|
-
}, () => {
|
|
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)
|
|
82
|
-
this.setData({
|
|
83
|
-
isOver,
|
|
84
|
-
})
|
|
85
|
-
this.countTime()
|
|
86
|
-
})
|
|
87
|
-
}
|
|
88
|
-
},
|
|
89
|
-
sending: {
|
|
90
|
-
type: Boolean,
|
|
91
|
-
value: false
|
|
92
|
-
},
|
|
93
|
-
explainingGoods: {
|
|
94
|
-
type: Object,
|
|
95
|
-
value: {}
|
|
96
|
-
},
|
|
97
|
-
isInElive: {
|
|
98
|
-
type: Boolean,
|
|
99
|
-
value: false
|
|
100
|
-
},
|
|
101
|
-
aliveInfo: {
|
|
102
|
-
type: Object,
|
|
103
|
-
value: {},
|
|
104
|
-
},
|
|
105
|
-
// 是否去客服内支付
|
|
106
|
-
allContactPay: {
|
|
107
|
-
type: Boolean,
|
|
108
|
-
value: false
|
|
109
|
-
},
|
|
110
|
-
//店铺设置是否展示券后价
|
|
111
|
-
coupon_switch: {
|
|
112
|
-
type: Boolean,
|
|
113
|
-
value: false
|
|
114
|
-
},
|
|
115
|
-
envName: {
|
|
116
|
-
type: String,
|
|
117
|
-
value: ""
|
|
118
|
-
},
|
|
119
|
-
sensorReportParams: {
|
|
120
|
-
type: Object,
|
|
121
|
-
value: {}
|
|
122
|
-
},
|
|
123
|
-
current_role: {
|
|
124
|
-
type: String,
|
|
125
|
-
value: 'student'
|
|
126
|
-
},
|
|
127
|
-
isFullScreen: {
|
|
128
|
-
type: Boolean,
|
|
129
|
-
value: false
|
|
130
|
-
},
|
|
131
|
-
style: {
|
|
132
|
-
type: String,
|
|
133
|
-
value: ''
|
|
134
|
-
},
|
|
135
|
-
index: {
|
|
136
|
-
type: Number,
|
|
137
|
-
value: -1
|
|
138
|
-
},
|
|
139
|
-
// 是否是新带货接口灰度
|
|
140
|
-
isGrayMarketing: {
|
|
141
|
-
type: Boolean,
|
|
142
|
-
value: false
|
|
143
|
-
},
|
|
144
|
-
isManage: {
|
|
145
|
-
type: Boolean,
|
|
146
|
-
value: false
|
|
147
|
-
},
|
|
148
|
-
sendingGoodId: {
|
|
149
|
-
type: String,
|
|
150
|
-
value: '',
|
|
151
|
-
},
|
|
152
|
-
},
|
|
153
|
-
|
|
154
|
-
lifetimes: {
|
|
155
|
-
// 生命周期函数,可以为函数,或一个在methods段中定义的方法名
|
|
156
|
-
attached: function () {
|
|
157
|
-
|
|
158
|
-
},
|
|
159
|
-
moved: function () { },
|
|
160
|
-
detached: function () { },
|
|
161
|
-
},
|
|
162
|
-
|
|
163
|
-
/**
|
|
164
|
-
* 组件的初始数据
|
|
165
|
-
*/
|
|
166
|
-
data: {
|
|
167
|
-
time: '',
|
|
168
|
-
goodsItem: {},
|
|
169
|
-
currentActive: '',
|
|
170
|
-
IOSMiniProgramCanBuy: false,
|
|
171
|
-
isIOS: false,
|
|
172
|
-
page_path: '',
|
|
173
|
-
preHeatTime: '',
|
|
174
|
-
isSeckill: false,
|
|
175
|
-
checked: false,
|
|
176
|
-
switchLoading: false,
|
|
177
|
-
imageRadius: rpxToVmin(16),
|
|
178
|
-
isOver: false, //是否已抢光
|
|
179
|
-
},
|
|
180
|
-
computed: {
|
|
181
|
-
showPreferentialPrice(properties) {
|
|
182
|
-
// 券后价小于展示价格的时候展示券后价; coupon_switch B端店铺设置 是否展示券后价,err_code === 0 是正常,非0表示券后价相关接口报错了,去抢购按钮展示为查看详情
|
|
183
|
-
//超级会员全免权益
|
|
184
|
-
let svipAllFree = properties.goodsInfo.resource_rights_type === 1
|
|
185
|
-
//免费的情况下不展示券后价
|
|
186
|
-
let isFree = svipAllFree || properties.goodsInfo.priceShow === 0
|
|
187
|
-
let showPreferentialPrice = properties.coupon_switch && properties.goodsInfo.preferential_price < properties.goodsInfo.priceShow && !properties.goodsInfo.err_code && !isFree
|
|
188
|
-
return showPreferentialPrice
|
|
189
|
-
},
|
|
190
|
-
params_url(data) {
|
|
191
|
-
if (!Object.keys(data.goodsItem).length) {
|
|
192
|
-
return ''
|
|
193
|
-
} else {
|
|
194
|
-
// 后端规则拼接参数规则:$ => ?、@ => &
|
|
195
|
-
// 商品带货链接需拼接多一个aliveId
|
|
196
|
-
const aliveId = data.aliveInfo.alive_id
|
|
197
|
-
const url = data.goodsItem.target_url.replaceAll('&', "@")
|
|
198
|
-
const link = url.replaceAll('?', "$")
|
|
199
|
-
// 判断后端返回链接是否已拼接(如:?type= )参数,兼容 aliveId 拼接符
|
|
200
|
-
const symbol = url.indexOf('?') !== -1 ? '@' : '$'
|
|
201
|
-
return `${data.page_path}?type=1&link=${link}${symbol}aliveId=${aliveId}&title=${data.goodsItem.title}`
|
|
202
|
-
}
|
|
203
|
-
},
|
|
204
|
-
isStudent(properties) {
|
|
205
|
-
return properties.current_role === 'student'
|
|
206
|
-
},
|
|
207
|
-
//超过99999不够位置展示划线价,只能不要孩子了
|
|
208
|
-
showPriceLine(data) {
|
|
209
|
-
return data.goodsItem.priceLine > 0 && (data.goodsItem.priceShow < 100000 || !data.showPreferentialPrice)
|
|
210
|
-
},
|
|
211
|
-
showPrice(data) {
|
|
212
|
-
return data.isIOS && data.IOSMiniProgramCanBuy && data.goodsItem.priceShow !== 0 || !data.isIOS && data.goodsItem.priceShow !== 0
|
|
213
|
-
},
|
|
214
|
-
// 是否为安卓设备
|
|
215
|
-
isAndroid() {
|
|
216
|
-
let info = wx.getSystemInfoSync()
|
|
217
|
-
return info.platform === 'android'
|
|
218
|
-
},
|
|
219
|
-
//讲解中的商品
|
|
220
|
-
isShowExamplaining(properties) {
|
|
221
|
-
return properties.explainingGoods && properties.explainingGoods.resource_id === properties.goodsItem.resource_id;
|
|
222
|
-
},
|
|
223
|
-
//销量/订阅。只有 实物商品 21 、专栏 6、大专栏 8、会员 5 展示,受B端店铺设置(hide_sub_count):隐藏商品销量控制 0-显示 1-隐藏
|
|
224
|
-
hasSaleNum(data) {
|
|
225
|
-
return !data.goodsItem.hide_sub_count && data.goodsItem.order_num > 0
|
|
226
|
-
},
|
|
227
|
-
//销量/订阅。只有 实物商品 21 、专栏 6、大专栏 8、会员 5 展示
|
|
228
|
-
saleNum(data) {
|
|
229
|
-
//实物商品
|
|
230
|
-
if (data.goodsItem.resource_type === 21 || data.goodsItem.resource_type === 41 || data.goodsItem.resource_type === 68) {
|
|
231
|
-
return ' 已售 ' + (data.goodsItem.order_num || 0)
|
|
232
|
-
} else if (data.goodsItem.resource_type === 6 || data.goodsItem.resource_type === 8 || data.goodsItem.resource_type === 5) {
|
|
233
|
-
return ' 订阅 ' + (data.goodsItem.order_num || 0)
|
|
234
|
-
} else {
|
|
235
|
-
return ''
|
|
236
|
-
}
|
|
237
|
-
},
|
|
238
|
-
btnTxt(data) {
|
|
239
|
-
// 以下各种情况,按去查看 -> 已抢光 -> 查看详情 -> 免费领取 -> 券后 -> 去抢购 优先级展示
|
|
240
|
-
// 超级会员全免权益
|
|
241
|
-
let svipAllFree = data.goodsItem.resource_rights_type === 1
|
|
242
|
-
if (data.allContactPay || (data.isIOS && !data.IOSMiniProgramCanBuy)) {
|
|
243
|
-
// IOS小程序中不能买的展示去查看,跳转到小程序客服
|
|
244
|
-
return "去查看"
|
|
245
|
-
} else if (data.isOver) {
|
|
246
|
-
// 库存为0,已售罄
|
|
247
|
-
return "已抢光"
|
|
248
|
-
} else if (data.goodsItem.err_code) {
|
|
249
|
-
// 券后价接口报错,领取不了优惠券的情况
|
|
250
|
-
return "查看详情"
|
|
251
|
-
} else if (svipAllFree || data.goodsItem.priceShow === 0) {
|
|
252
|
-
// 超级会员全免或者0元商品
|
|
253
|
-
return "免费领取"
|
|
254
|
-
} else if (data.showPreferentialPrice) {
|
|
255
|
-
// 展示券后价
|
|
256
|
-
return "购买"
|
|
257
|
-
} else {
|
|
258
|
-
return "购买"
|
|
259
|
-
}
|
|
260
|
-
},
|
|
261
|
-
//当前适用的活动或者超级会员,活动价低就是活动,会员价低就是超级会员,超级会员全免,肯定最低,适用超级会员
|
|
262
|
-
// "限时折扣",
|
|
263
|
-
// "好友助力",
|
|
264
|
-
// "裂变海报",
|
|
265
|
-
// "拼团",
|
|
266
|
-
// "涨粉神器",
|
|
267
|
-
// "秒杀",
|
|
268
|
-
// "超级会员",
|
|
269
|
-
//是否开启了预热 1-开启 0-未开启
|
|
270
|
-
hasPreheat(data) {
|
|
271
|
-
return data.goodsItem.sec_kill_is_preheat === 1
|
|
272
|
-
},
|
|
273
|
-
//秒杀开始时间
|
|
274
|
-
startTime(data) {
|
|
275
|
-
return data.goodsItem.start_at && new Date(data.goodsItem.start_at.replace(/-/g, "/")) || new Date()
|
|
276
|
-
},
|
|
277
|
-
//超级会员
|
|
278
|
-
isSupperVip(data) {
|
|
279
|
-
return data.currentActive === '超级会员'
|
|
280
|
-
},
|
|
281
|
-
//秒杀活动需要预约
|
|
282
|
-
isAppointment(data) {
|
|
283
|
-
data.goodsItem.appointment = 1 //mock
|
|
284
|
-
return data.goodsItem.appointment === 1
|
|
285
|
-
},
|
|
286
|
-
secText(data) {
|
|
287
|
-
if (data.isSeckill && data.preheating) {
|
|
288
|
-
return `秒杀活动将在 ${data.time} 后开始`
|
|
289
|
-
} else {
|
|
290
|
-
return ''
|
|
291
|
-
}
|
|
292
|
-
},
|
|
293
|
-
filterSrc(data) {
|
|
294
|
-
return utils.replaceCDN(data.goodsItem.img_url, '?imageMogr2/thumbnail/400x400>/ignore-error/1')
|
|
295
|
-
},
|
|
296
|
-
|
|
297
|
-
// 已售百分比
|
|
298
|
-
percentage(data) {
|
|
299
|
-
if (data.isOver) return 100
|
|
300
|
-
// 无库存 拼团、限时抢购
|
|
301
|
-
if (!data.goodsItem.activity_stock) return 28
|
|
302
|
-
let num = 0
|
|
303
|
-
num = (data.goodsItem.activity_order_num / data.goodsItem.activity_stock) * 100
|
|
304
|
-
// 有库存时,最低占40%
|
|
305
|
-
return num <= 40 ? 40 : num
|
|
306
|
-
},
|
|
307
|
-
// 商品剩余数量
|
|
308
|
-
residueQuantity(data) {
|
|
309
|
-
let formatNum = (num) => {
|
|
310
|
-
if (!num || isNaN(num)) return num
|
|
311
|
-
num = Number(num)
|
|
312
|
-
if (Math.abs(num) >= 100000000) {
|
|
313
|
-
num = num / 100000000
|
|
314
|
-
return this.isDecimals(Math.floor(num * 100) / 100) ? Math.floor(num * 100) / 100 + '亿' : num + '亿'
|
|
315
|
-
} else if (Math.abs(num) >= 10000) {
|
|
316
|
-
num = num / 10000
|
|
317
|
-
return this.isDecimals(Math.floor(num * 100) / 100) ? Math.floor(num * 100) / 100 + '万' : num + '万'
|
|
318
|
-
} else {
|
|
319
|
-
return num
|
|
320
|
-
}
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
// "已抢光"
|
|
324
|
-
if (data.isOver) return '已抢光'
|
|
325
|
-
|
|
326
|
-
// 没有库存 - 已开抢
|
|
327
|
-
if (!data.goodsItem.activity_stock) return '已开抢'
|
|
328
|
-
|
|
329
|
-
return `仅剩${formatNum(data.goodsItem.activity_stock - data.goodsItem.activity_order_num)}件`
|
|
330
|
-
},
|
|
331
|
-
// 配送方式(-1:全部 1:快递配送 2:自提)
|
|
332
|
-
distributionWay(data) {
|
|
333
|
-
let text = ''
|
|
334
|
-
switch (data.goodsItem.distribution_pattern) {
|
|
335
|
-
case -1:
|
|
336
|
-
text = '自提·快递'
|
|
337
|
-
break
|
|
338
|
-
case 1:
|
|
339
|
-
text = '快递'
|
|
340
|
-
break
|
|
341
|
-
case 2:
|
|
342
|
-
text = '自提'
|
|
343
|
-
break
|
|
344
|
-
default:
|
|
345
|
-
text = ''
|
|
346
|
-
break
|
|
347
|
-
}
|
|
348
|
-
return text
|
|
349
|
-
},
|
|
350
|
-
distributionPattern(data) {
|
|
351
|
-
return [-1,1,2].indexOf(data.goodsItem.distribution_pattern) !== -1
|
|
352
|
-
}
|
|
353
|
-
},
|
|
354
|
-
/**
|
|
355
|
-
* 组件的方法列表
|
|
356
|
-
*/
|
|
357
|
-
methods: {
|
|
358
|
-
snapUpCheck: debounce(function () {
|
|
359
|
-
this.showToast('努力加载中')
|
|
360
|
-
this.triggerEvent('sendNewMsg')
|
|
361
|
-
let { aliveInfo, sensorReportParams, goodsInfo, isFullScreen } = this.properties
|
|
362
|
-
sensorLog.sensors.track('click_butt', {
|
|
363
|
-
page_id: 'e_alive#mini#first#alive_room',
|
|
364
|
-
page_name: '直播间页面',
|
|
365
|
-
l_program: '鹅直播',
|
|
366
|
-
page_path: '鹅直播#小程序#首页#直播间页面',
|
|
367
|
-
page_button: "列表去抢购",
|
|
368
|
-
client: "小程序",
|
|
369
|
-
goods_id: goodsInfo.id,
|
|
370
|
-
app_id: aliveInfo.app_id,
|
|
371
|
-
c_user_id: aliveInfo.user_id,
|
|
372
|
-
union_id: wx.getStorageSync('userInfo').universal_union_id,
|
|
373
|
-
current_role: sensorReportParams.current_role,
|
|
374
|
-
resource_id: aliveInfo.alive_id,
|
|
375
|
-
$url_path: `alive/${aliveInfo.alive_id}`,
|
|
376
|
-
type: sensorReportParams.type,
|
|
377
|
-
cmm1: sensorReportParams.alive_type,
|
|
378
|
-
cmm2: sensorReportParams.version_type,
|
|
379
|
-
comm2: sensorReportParams.pay_type,
|
|
380
|
-
cmm3: isFullScreen ? '全屏' : '非全屏'
|
|
381
|
-
})
|
|
382
|
-
// 线下课29课时包42/拼团 --判断权益
|
|
383
|
-
if ([29, 42].indexOf(this.data.goodsItem.resource_type) > -1 || this.data.goodsItem.activity_type === 6) {
|
|
384
|
-
this.judgePermission()
|
|
385
|
-
return
|
|
386
|
-
}
|
|
387
|
-
let params = {
|
|
388
|
-
id: this.data.goodsItem.id,
|
|
389
|
-
resource_id: this.data.goodsItem.resource_id,
|
|
390
|
-
resource_type: this.data.goodsItem.resource_type,
|
|
391
|
-
price: this.data.goodsItem.price,
|
|
392
|
-
app_id: this.data.aliveInfo.app_id,
|
|
393
|
-
user_id: this.data.aliveInfo.user_id,
|
|
394
|
-
coupon_id: this.data.goodsItem.coupon_id,
|
|
395
|
-
alive_id: this.data.aliveInfo.alive_id
|
|
396
|
-
}
|
|
397
|
-
const url = this.properties.isGrayMarketing ? snapCheckNew : snapCheck
|
|
398
|
-
url(params).then(res => {
|
|
399
|
-
this.hideToast()
|
|
400
|
-
let { code, data } = res.data
|
|
401
|
-
if (code === 0) {
|
|
402
|
-
if (data.err_msg) {
|
|
403
|
-
this.showToast(data.err_msg)
|
|
404
|
-
}
|
|
405
|
-
if (data.is_sec_kill_toast) {
|
|
406
|
-
this.showToast("秒杀活动开始,您未预约,需以原价购买!")
|
|
407
|
-
}
|
|
408
|
-
if (data.is_goods_detail === 1) {
|
|
409
|
-
this.judgePermission(data.is_has_permission)
|
|
410
|
-
} else if (data.is_more_sku === 1) {
|
|
411
|
-
this.showSku()
|
|
412
|
-
} else {
|
|
413
|
-
this.showConfirmOrder(data.sku)
|
|
414
|
-
}
|
|
415
|
-
} else {
|
|
416
|
-
this.showToast("网络繁忙,请稍后再试")
|
|
417
|
-
}
|
|
418
|
-
})
|
|
419
|
-
}, 1000, true),
|
|
420
|
-
cardToDetails() {
|
|
421
|
-
if (!this.data.isStudent) { return }
|
|
422
|
-
let { aliveInfo, sensorReportParams, goodsInfo, isFullScreen } = this.properties
|
|
423
|
-
sensorLog.sensors.track('click_butt', {
|
|
424
|
-
page_id: 'e_alive#mini#first#alive_room',
|
|
425
|
-
page_name: '直播间页面',
|
|
426
|
-
l_program: '鹅直播',
|
|
427
|
-
page_path: '鹅直播#小程序#首页#直播间页面',
|
|
428
|
-
page_button: "列表空白热区",
|
|
429
|
-
client: "小程序",
|
|
430
|
-
goods_id: goodsInfo.id,
|
|
431
|
-
product_name: goodsInfo.title,
|
|
432
|
-
app_id: aliveInfo.app_id,
|
|
433
|
-
c_user_id: aliveInfo.user_id,
|
|
434
|
-
union_id: wx.getStorageSync('userInfo').universal_union_id,
|
|
435
|
-
current_role: sensorReportParams.current_role,
|
|
436
|
-
resource_id: aliveInfo.alive_id,
|
|
437
|
-
$url_path: `alive/${aliveInfo.alive_id}`,
|
|
438
|
-
type: sensorReportParams.type,
|
|
439
|
-
cmm1: sensorReportParams.alive_type,
|
|
440
|
-
cmm2: sensorReportParams.version_type,
|
|
441
|
-
comm2: sensorReportParams.pay_type,
|
|
442
|
-
cmm3: isFullScreen ? '全屏' : '非全屏'
|
|
443
|
-
})
|
|
444
|
-
this.judgePermission()
|
|
445
|
-
},
|
|
446
|
-
// 点击空白热区进来判断权益,或者接口返回有权益的时候进来判断跳转路径
|
|
447
|
-
judgePermission: debounce(async function (permission) {
|
|
448
|
-
// 实物21 有价优惠券41 超级会员23 可多次购买,没有权益说法,直接拉起客服;直播商品有没有权益都是去详情页。
|
|
449
|
-
if ([41, 21, 23, 4].indexOf(Number(this.data.goodsItem.resource_type)) > -1) {
|
|
450
|
-
this.toDetails()
|
|
451
|
-
return
|
|
452
|
-
}
|
|
453
|
-
|
|
454
|
-
if (permission !== 0 && permission !== 1) {
|
|
455
|
-
permission = await this.getUserPermission()
|
|
456
|
-
}
|
|
457
|
-
|
|
458
|
-
console.log("permission", permission)
|
|
459
|
-
// 有权益的情况下
|
|
460
|
-
if (permission) {
|
|
461
|
-
// 电子书20/班课35 鹅学习不支持,无权益的情况下,内嵌h5, 有权益TOAST提示
|
|
462
|
-
if ([20, 35].indexOf(this.data.goodsItem.resource_type) > -1) {
|
|
463
|
-
this.showToast('您已拥有该课程,小程序内暂不支持学习此课程')
|
|
464
|
-
} else {
|
|
465
|
-
// 弹出提示去小程序学习 有三种可能 -圈子小程序 -小鹅通小程序 -打卡小程序
|
|
466
|
-
this.showdialog(this.data.goodsItem)
|
|
467
|
-
}
|
|
468
|
-
} else {
|
|
469
|
-
// 没有权益的情况下 直播商品去直播详情页,其他拉起客服
|
|
470
|
-
this.toDetails()
|
|
471
|
-
}
|
|
472
|
-
}, 1000, true),
|
|
473
|
-
getUserPermission() {
|
|
474
|
-
return new Promise((resolve, reject) => {
|
|
475
|
-
let params = {
|
|
476
|
-
id: this.data.goodsItem.id,
|
|
477
|
-
app_id: this.data.aliveInfo.app_id,
|
|
478
|
-
user_id: this.data.aliveInfo.user_id,
|
|
479
|
-
}
|
|
480
|
-
const url = this.properties.isGrayMarketing ? getUserPermissionNew : getUserPermission
|
|
481
|
-
url(params).then((res) => {
|
|
482
|
-
let { code, data } = res.data
|
|
483
|
-
if (code === 0) {
|
|
484
|
-
resolve(!!data.auth_state)
|
|
485
|
-
}
|
|
486
|
-
})
|
|
487
|
-
})
|
|
488
|
-
},
|
|
489
|
-
showConfirmOrder(sku) {
|
|
490
|
-
//带货列表返回的 resource_id就是业务侧的spu_id
|
|
491
|
-
// 返回的id,就是业务侧的resource_id
|
|
492
|
-
let params = {
|
|
493
|
-
id: this.data.goodsItem.resource_id,
|
|
494
|
-
spu_id: this.data.goodsItem.resource_id,
|
|
495
|
-
resource_type: this.data.goodsItem.resource_type,
|
|
496
|
-
resource_id: this.data.goodsItem.id,
|
|
497
|
-
spu_type: this.data.goodsItem.spu_type,
|
|
498
|
-
sku,
|
|
499
|
-
count: 1,
|
|
500
|
-
isAlive: 1,
|
|
501
|
-
aliveId: this.data.aliveInfo.alive_id,
|
|
502
|
-
isCollectCoupons: this.data.showPreferentialPrice
|
|
503
|
-
}
|
|
504
|
-
this.triggerEvent("showConfirmOrder", params)
|
|
505
|
-
},
|
|
506
|
-
showSku() {
|
|
507
|
-
let params = {
|
|
508
|
-
spuId: this.data.goodsItem.resource_id,
|
|
509
|
-
isCollectCoupons: this.data.showPreferentialPrice
|
|
510
|
-
}
|
|
511
|
-
this.triggerEvent("showSku", params)
|
|
512
|
-
},
|
|
513
|
-
showdialog() {
|
|
514
|
-
this.triggerEvent('showDialog', this.data.goodsItem)
|
|
515
|
-
},
|
|
516
|
-
sendNewMsg() {
|
|
517
|
-
this.triggerEvent('sendNewMsg')
|
|
518
|
-
},
|
|
519
|
-
showToast(title = '') {
|
|
520
|
-
wx.showToast({
|
|
521
|
-
title,
|
|
522
|
-
icon: "none",
|
|
523
|
-
duration: 1000
|
|
524
|
-
})
|
|
525
|
-
},
|
|
526
|
-
hideToast() {
|
|
527
|
-
wx.hideToast()
|
|
528
|
-
},
|
|
529
|
-
countTime() {
|
|
530
|
-
if (!this.data.isSeckill || !this.data.preheating) { //不是秒杀活动 或者不在预热中不倒计时
|
|
531
|
-
return
|
|
532
|
-
}
|
|
533
|
-
//获取当前时间
|
|
534
|
-
let date = new Date();
|
|
535
|
-
let now = date.getTime();
|
|
536
|
-
//截止时间
|
|
537
|
-
let deadline = new Date(this.data.startTime);
|
|
538
|
-
let end = deadline.getTime();
|
|
539
|
-
//剩余时间
|
|
540
|
-
let time = end - now;
|
|
541
|
-
//定义变量 d,h,m,s保存倒计时的时间
|
|
542
|
-
let d = 0, h = 0, m = 0, s = 0;
|
|
543
|
-
if (time >= 0) {
|
|
544
|
-
d = Math.floor(time / 1000 / 60 / 60 / 24);
|
|
545
|
-
h = Math.floor(time / 1000 / 60 / 60 % 24);
|
|
546
|
-
m = Math.floor(time / 1000 / 60 % 60);
|
|
547
|
-
s = Math.floor(time / 1000 % 60);
|
|
548
|
-
h = d > 0 ? h + 24 * d : h
|
|
549
|
-
h = h < 10 ? '0' + h : h
|
|
550
|
-
m = m < 10 ? '0' + m : m
|
|
551
|
-
s = s < 10 ? '0' + s : s
|
|
552
|
-
this.setData({
|
|
553
|
-
time: h + ":" + m + ":" + s
|
|
554
|
-
})
|
|
555
|
-
}
|
|
556
|
-
//递归每秒调用countTime方法,显示动态时间效果
|
|
557
|
-
let that = this
|
|
558
|
-
if (!(d === 0 && h === 0 && m === 0 && s === 0)) { //秒杀活动还未到时间
|
|
559
|
-
setTimeout(() => that.countTime(), 1000)
|
|
560
|
-
}
|
|
561
|
-
},
|
|
562
|
-
handleContact(e) {
|
|
563
|
-
console.log("点击了去查看")
|
|
564
|
-
},
|
|
565
|
-
formatUrl(goodsInfo) {
|
|
566
|
-
var url = ''
|
|
567
|
-
var jumpUrl = ''
|
|
568
|
-
if (typeof goodsInfo == 'object' && Object.keys(goodsInfo).length > 0) {
|
|
569
|
-
url = goodsInfo.target_url
|
|
570
|
-
jumpUrl = goodsInfo.target_url
|
|
571
|
-
} else {
|
|
572
|
-
url = this.data.goodsItem.target_url
|
|
573
|
-
jumpUrl = this.data.goodsItem.target_url //跳转链接
|
|
574
|
-
}
|
|
575
|
-
//跳转链接 带上参数
|
|
576
|
-
let queryIndex = url.indexOf("?"); //查询索引位置
|
|
577
|
-
if (queryIndex === -1) {
|
|
578
|
-
jumpUrl += "?"; //问号不存在,则拼接问号
|
|
579
|
-
} else {
|
|
580
|
-
url.length - 1 !== queryIndex ? (jumpUrl += "&") : ""; //问号是否不在末尾位置? 进行&拼接 :不处理
|
|
581
|
-
}
|
|
582
|
-
jumpUrl = `${jumpUrl}live_room=1&success=1&aliveId=${this.data.aliveInfo.alive_id}`;
|
|
583
|
-
if (![0, 2, 3].includes(this.data.aliveInfo.alive_state)) {
|
|
584
|
-
jumpUrl += `&is_living=1&unique_type=elive`;
|
|
585
|
-
}
|
|
586
|
-
return encodeURIComponent(jumpUrl)
|
|
587
|
-
},
|
|
588
|
-
toDetails() {
|
|
589
|
-
// 直播商品-去详情页,其他商品-拉起客服
|
|
590
|
-
let { title, img_url, target_url } = this.data.goodsItem
|
|
591
|
-
let params = encodeURIComponent(`img_url=${img_url}&title=${title}¶ms_url=${this.data.params_url}`)
|
|
592
|
-
console.log("urlurlurl", `/page/customerService/customerService?params=${params}`)
|
|
593
|
-
if (this.data.goodsItem.resource_type === 4) {
|
|
594
|
-
wx && wx.redirectTo({
|
|
595
|
-
url: `/pages/webView/webView?appId=${this.properties.aliveInfo.app_id}&aliveId=${this.data.goodsItem.id}&refreshAliveId=${this.properties.aliveInfo.alive_id}`,
|
|
596
|
-
})
|
|
597
|
-
|
|
598
|
-
} else {
|
|
599
|
-
// PC 复制链接
|
|
600
|
-
const { isPC, isDevtools } = getApp().globalData.system
|
|
601
|
-
if (isPC || isDevtools) {
|
|
602
|
-
this.copyLink(target_url)
|
|
603
|
-
return
|
|
604
|
-
}
|
|
605
|
-
// 暂时屏蔽内嵌H5详情页,拉起客服
|
|
606
|
-
wx && wx.navigateTo({
|
|
607
|
-
url: '/page/customerService/customerService' + `?params=${params}`
|
|
608
|
-
})
|
|
609
|
-
}
|
|
610
|
-
},
|
|
611
|
-
//judgePermission里面 showDialog 外部弹窗调用
|
|
612
|
-
toMiniProgram(goodsInfo) {
|
|
613
|
-
let { aliveInfo, sensorReportParams } = this.properties
|
|
614
|
-
sensorLog.sensors.track('click_butt', {
|
|
615
|
-
page_id: 'e_alive#mini#first#alive_room',
|
|
616
|
-
page_name: '直播间页面',
|
|
617
|
-
l_program: '鹅直播',
|
|
618
|
-
page_path: '鹅直播#小程序#首页#直播间页面',
|
|
619
|
-
page_button: "前往",
|
|
620
|
-
app_id: aliveInfo.app_id,
|
|
621
|
-
c_user_id: aliveInfo.user_id,
|
|
622
|
-
union_id: wx.getStorageSync('userInfo').universal_union_id,
|
|
623
|
-
current_role: sensorReportParams.current_role,
|
|
624
|
-
resource_id: aliveInfo.alive_id,
|
|
625
|
-
$url_path: `alive/${aliveInfo.alive_id}`,
|
|
626
|
-
type: sensorReportParams.type,
|
|
627
|
-
cmm1: sensorReportParams.alive_type,
|
|
628
|
-
cmm2: sensorReportParams.version_type,
|
|
629
|
-
comm2: sensorReportParams.pay_type
|
|
630
|
-
})
|
|
631
|
-
let spu_type = goodsInfo.spu_type
|
|
632
|
-
switch (spu_type) {
|
|
633
|
-
case ASSOCIATION:
|
|
634
|
-
this.toAssociation(goodsInfo);
|
|
635
|
-
break;
|
|
636
|
-
case PUNCH_CARD:
|
|
637
|
-
this.toPunchCard(goodsInfo);
|
|
638
|
-
break;
|
|
639
|
-
default:
|
|
640
|
-
this.toXiaoeLearn(goodsInfo);
|
|
641
|
-
break;
|
|
642
|
-
}
|
|
643
|
-
},
|
|
644
|
-
toXiaoeLearn(goodsInfo) {
|
|
645
|
-
let { aliveInfo } = this.properties
|
|
646
|
-
let h5_url = this.formatUrl(goodsInfo)
|
|
647
|
-
var path
|
|
648
|
-
// 音频 视频
|
|
649
|
-
if (goodsInfo.resource_type === 2 || goodsInfo.resource_type === 3) {
|
|
650
|
-
path = `/pages/index/authorizePage?user_id=${aliveInfo.user_id}&app_id=${aliveInfo.app_id}&resource_id=${goodsInfo.id}&unique_type=elive`
|
|
651
|
-
} else {
|
|
652
|
-
// 其他
|
|
653
|
-
path = `/pages/index/authorizePage?user_id=${aliveInfo.user_id}&app_id=${aliveInfo.app_id}&h5_url=${h5_url}`
|
|
654
|
-
}
|
|
655
|
-
let params = {
|
|
656
|
-
appId: "wxa3589f1193170aa3",
|
|
657
|
-
path,
|
|
658
|
-
}
|
|
659
|
-
if (this.properties.envName == 'inside' || this.properties.envName == 'test') { //开发环境 测试环境 加上这个参数可以跳转去鹅学习体验版
|
|
660
|
-
params.appId = 'wx9eb4d7b3f2a3e003'
|
|
661
|
-
params.envVersion = 'trial'
|
|
662
|
-
}
|
|
663
|
-
wx.navigateToMiniProgram(params)
|
|
664
|
-
},
|
|
665
|
-
toPunchCard(goodsInfo) {
|
|
666
|
-
let { aliveInfo } = this.properties
|
|
667
|
-
let path = `/pages-participate-progress/pages/participate/participate?app_id=${aliveInfo.app_id}&&activity_id=${goodsInfo.resource_id}`
|
|
668
|
-
let params = {
|
|
669
|
-
appId: "wx839728854b1e23ad", //现网
|
|
670
|
-
path,
|
|
671
|
-
}
|
|
672
|
-
if (this.properties.envName == 'inside') { //开发环境
|
|
673
|
-
params.appId = 'wx802f346b1c7dcdd9'
|
|
674
|
-
} else if (this.properties.envName == 'test') { // 测试环境
|
|
675
|
-
params.appId = 'wx778bc88236be97d9'
|
|
676
|
-
}
|
|
677
|
-
wx.navigateToMiniProgram(params)
|
|
678
|
-
},
|
|
679
|
-
toAssociation(goodsInfo) {
|
|
680
|
-
let { aliveInfo } = this.properties
|
|
681
|
-
let path = `/pages-community/pages/home/index?appId=${aliveInfo.app_id}&&communityId=${goodsInfo.resource_id}`
|
|
682
|
-
let params = {
|
|
683
|
-
appId: "wxd0ad7e76d51ae4cc",
|
|
684
|
-
path,
|
|
685
|
-
}
|
|
686
|
-
if (this.properties.envName == 'inside') {
|
|
687
|
-
params.appId = 'wx52419e90dc6dd535' //开发环境
|
|
688
|
-
} else if (this.properties.envName == 'test') { //测试环境
|
|
689
|
-
params.appId = 'wxb245d452213c48c9' //测试环境
|
|
690
|
-
}
|
|
691
|
-
wx.navigateToMiniProgram(params)
|
|
692
|
-
},
|
|
693
|
-
sendGoodsCard(e) {
|
|
694
|
-
let dataset = e.currentTarget.dataset;
|
|
695
|
-
// 触发父组件的send
|
|
696
|
-
this.triggerEvent('sendGoodsCard', {
|
|
697
|
-
datas: dataset
|
|
698
|
-
});
|
|
699
|
-
},
|
|
700
|
-
changeShowType() {
|
|
701
|
-
if (this.data.goodsItem.teacher_auth != 2) {
|
|
702
|
-
this.showToast('暂无权限')
|
|
703
|
-
return
|
|
704
|
-
}
|
|
705
|
-
this.setData({
|
|
706
|
-
switchLoading: true
|
|
707
|
-
})
|
|
708
|
-
let params = {
|
|
709
|
-
alive_id: this.properties.aliveInfo.alive_id,
|
|
710
|
-
app_id: this.properties.aliveInfo.app_id,
|
|
711
|
-
resource_id: this.data.goodsItem.id,
|
|
712
|
-
is_display_package: this.data.checked ? 0 : 1
|
|
713
|
-
};
|
|
714
|
-
showGoods(params).then((res) => {
|
|
715
|
-
console.log(res, "resres")
|
|
716
|
-
let { code } = res.data
|
|
717
|
-
if (code === 0) {
|
|
718
|
-
this.setData({
|
|
719
|
-
switchLoading: false,
|
|
720
|
-
checked: !this.data.checked
|
|
721
|
-
})
|
|
722
|
-
this.showToast('操作成功')
|
|
723
|
-
} else {
|
|
724
|
-
this.setData({
|
|
725
|
-
switchLoading: false
|
|
726
|
-
})
|
|
727
|
-
}
|
|
728
|
-
})
|
|
729
|
-
},
|
|
730
|
-
stopEvent() {
|
|
731
|
-
return
|
|
732
|
-
},
|
|
733
|
-
copyLink(link) {
|
|
734
|
-
wx.setClipboardData({
|
|
735
|
-
data: link,
|
|
736
|
-
success() {
|
|
737
|
-
wx.showToast({
|
|
738
|
-
title: '商品链接已复制,请用浏览器打开',
|
|
739
|
-
icon: 'none',
|
|
740
|
-
})
|
|
741
|
-
},
|
|
742
|
-
})
|
|
743
|
-
}
|
|
744
|
-
}
|
|
745
|
-
})
|
|
1
|
+
/*
|
|
2
|
+
* @Descripttion:
|
|
3
|
+
* @version:
|
|
4
|
+
* @Author: conlinchen
|
|
5
|
+
* @Date: 2021-10-28 18:17:48
|
|
6
|
+
* @LastEditors: conlinchen
|
|
7
|
+
* @LastEditTime: 2021-11-18 19:49:11
|
|
8
|
+
*/
|
|
9
|
+
import { debounce, rpxToVmin } from "../common/utils/index"
|
|
10
|
+
import { getUserPermission, getUserPermissionNew, snapCheck, snapCheckNew } from "../common/api/liveGoodsList"
|
|
11
|
+
import {
|
|
12
|
+
ASSOCIATION,
|
|
13
|
+
PUNCH_CARD
|
|
14
|
+
} from "../common/utils/constants.js";
|
|
15
|
+
|
|
16
|
+
const { utils, sensorLog } = require("live-mp-tools");
|
|
17
|
+
import { showGoods } from "../common/api/liveGoodsList"
|
|
18
|
+
|
|
19
|
+
const computedBehavior = require('miniprogram-computed').behavior
|
|
20
|
+
|
|
21
|
+
Component({
|
|
22
|
+
behaviors: [computedBehavior],
|
|
23
|
+
options: {
|
|
24
|
+
addGlobalClass: true,
|
|
25
|
+
},
|
|
26
|
+
/**
|
|
27
|
+
* 组件的属性列表
|
|
28
|
+
*/
|
|
29
|
+
properties: {
|
|
30
|
+
goodsInfo: {
|
|
31
|
+
type: Object,
|
|
32
|
+
value: {},
|
|
33
|
+
observer(newVal) {
|
|
34
|
+
// 商品没有的话,不处理
|
|
35
|
+
if (!newVal.id) return
|
|
36
|
+
//超级会员全免权益
|
|
37
|
+
let svipAllFree = newVal.resource_rights_type === 1
|
|
38
|
+
let currentActive = ''
|
|
39
|
+
if (svipAllFree) {
|
|
40
|
+
currentActive = '超级会员'
|
|
41
|
+
} else {
|
|
42
|
+
currentActive = newVal.currentActive
|
|
43
|
+
}
|
|
44
|
+
//IOS小程序端 ios小程序商品列表 直播、线下课、班课、实物商品可买,其他知识商品不可买,需不显示价格 点击去抢购后按现网逻辑跳转至小程序的商品详情
|
|
45
|
+
let info = wx.getSystemInfoSync()
|
|
46
|
+
let IOSMiniProgramCanBuy = [4, 29, 35, 21, 69].indexOf(newVal.resource_type) > -1 //true-能买 false-不能买
|
|
47
|
+
let isIOS = info.platform === 'ios'
|
|
48
|
+
console.log("platform", info.platform, isIOS)
|
|
49
|
+
const pages = getCurrentPages();
|
|
50
|
+
const currentPage = pages[pages.length - 1];
|
|
51
|
+
const url = `/${currentPage.route}`;
|
|
52
|
+
//预热开始时间
|
|
53
|
+
let startTime = newVal.start_at && new Date(newVal.start_at.replace(/-/g, "/")) || new Date()
|
|
54
|
+
let time = startTime.getTime() - newVal.sec_kill_preheat_time * 1000
|
|
55
|
+
let preHeatTime = new Date(time) || new Date()
|
|
56
|
+
|
|
57
|
+
let hasPreheat = newVal.sec_kill_is_preheat === 1
|
|
58
|
+
|
|
59
|
+
let startTime2 = newVal.start_at && new Date(newVal.start_at.replace(/-/g, "/")) || new Date()
|
|
60
|
+
let nowTime = new Date().getTime()
|
|
61
|
+
let preheating = hasPreheat && nowTime > preHeatTime.getTime() && startTime2.getTime() > nowTime
|
|
62
|
+
let isSeckill = currentActive === '秒杀'
|
|
63
|
+
let checked = newVal.is_display_package === 1
|
|
64
|
+
|
|
65
|
+
|
|
66
|
+
this.setData({
|
|
67
|
+
goodsItem: newVal,
|
|
68
|
+
currentActive,
|
|
69
|
+
IOSMiniProgramCanBuy,
|
|
70
|
+
isIOS,
|
|
71
|
+
page_path: url,
|
|
72
|
+
preHeatTime,
|
|
73
|
+
preheating,
|
|
74
|
+
isSeckill,
|
|
75
|
+
checked
|
|
76
|
+
}, () => {
|
|
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)
|
|
82
|
+
this.setData({
|
|
83
|
+
isOver,
|
|
84
|
+
})
|
|
85
|
+
this.countTime()
|
|
86
|
+
})
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
sending: {
|
|
90
|
+
type: Boolean,
|
|
91
|
+
value: false
|
|
92
|
+
},
|
|
93
|
+
explainingGoods: {
|
|
94
|
+
type: Object,
|
|
95
|
+
value: {}
|
|
96
|
+
},
|
|
97
|
+
isInElive: {
|
|
98
|
+
type: Boolean,
|
|
99
|
+
value: false
|
|
100
|
+
},
|
|
101
|
+
aliveInfo: {
|
|
102
|
+
type: Object,
|
|
103
|
+
value: {},
|
|
104
|
+
},
|
|
105
|
+
// 是否去客服内支付
|
|
106
|
+
allContactPay: {
|
|
107
|
+
type: Boolean,
|
|
108
|
+
value: false
|
|
109
|
+
},
|
|
110
|
+
//店铺设置是否展示券后价
|
|
111
|
+
coupon_switch: {
|
|
112
|
+
type: Boolean,
|
|
113
|
+
value: false
|
|
114
|
+
},
|
|
115
|
+
envName: {
|
|
116
|
+
type: String,
|
|
117
|
+
value: ""
|
|
118
|
+
},
|
|
119
|
+
sensorReportParams: {
|
|
120
|
+
type: Object,
|
|
121
|
+
value: {}
|
|
122
|
+
},
|
|
123
|
+
current_role: {
|
|
124
|
+
type: String,
|
|
125
|
+
value: 'student'
|
|
126
|
+
},
|
|
127
|
+
isFullScreen: {
|
|
128
|
+
type: Boolean,
|
|
129
|
+
value: false
|
|
130
|
+
},
|
|
131
|
+
style: {
|
|
132
|
+
type: String,
|
|
133
|
+
value: ''
|
|
134
|
+
},
|
|
135
|
+
index: {
|
|
136
|
+
type: Number,
|
|
137
|
+
value: -1
|
|
138
|
+
},
|
|
139
|
+
// 是否是新带货接口灰度
|
|
140
|
+
isGrayMarketing: {
|
|
141
|
+
type: Boolean,
|
|
142
|
+
value: false
|
|
143
|
+
},
|
|
144
|
+
isManage: {
|
|
145
|
+
type: Boolean,
|
|
146
|
+
value: false
|
|
147
|
+
},
|
|
148
|
+
sendingGoodId: {
|
|
149
|
+
type: String,
|
|
150
|
+
value: '',
|
|
151
|
+
},
|
|
152
|
+
},
|
|
153
|
+
|
|
154
|
+
lifetimes: {
|
|
155
|
+
// 生命周期函数,可以为函数,或一个在methods段中定义的方法名
|
|
156
|
+
attached: function () {
|
|
157
|
+
|
|
158
|
+
},
|
|
159
|
+
moved: function () { },
|
|
160
|
+
detached: function () { },
|
|
161
|
+
},
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* 组件的初始数据
|
|
165
|
+
*/
|
|
166
|
+
data: {
|
|
167
|
+
time: '',
|
|
168
|
+
goodsItem: {},
|
|
169
|
+
currentActive: '',
|
|
170
|
+
IOSMiniProgramCanBuy: false,
|
|
171
|
+
isIOS: false,
|
|
172
|
+
page_path: '',
|
|
173
|
+
preHeatTime: '',
|
|
174
|
+
isSeckill: false,
|
|
175
|
+
checked: false,
|
|
176
|
+
switchLoading: false,
|
|
177
|
+
imageRadius: rpxToVmin(16),
|
|
178
|
+
isOver: false, //是否已抢光
|
|
179
|
+
},
|
|
180
|
+
computed: {
|
|
181
|
+
showPreferentialPrice(properties) {
|
|
182
|
+
// 券后价小于展示价格的时候展示券后价; coupon_switch B端店铺设置 是否展示券后价,err_code === 0 是正常,非0表示券后价相关接口报错了,去抢购按钮展示为查看详情
|
|
183
|
+
//超级会员全免权益
|
|
184
|
+
let svipAllFree = properties.goodsInfo.resource_rights_type === 1
|
|
185
|
+
//免费的情况下不展示券后价
|
|
186
|
+
let isFree = svipAllFree || properties.goodsInfo.priceShow === 0
|
|
187
|
+
let showPreferentialPrice = properties.coupon_switch && properties.goodsInfo.preferential_price < properties.goodsInfo.priceShow && !properties.goodsInfo.err_code && !isFree
|
|
188
|
+
return showPreferentialPrice
|
|
189
|
+
},
|
|
190
|
+
params_url(data) {
|
|
191
|
+
if (!Object.keys(data.goodsItem).length) {
|
|
192
|
+
return ''
|
|
193
|
+
} else {
|
|
194
|
+
// 后端规则拼接参数规则:$ => ?、@ => &
|
|
195
|
+
// 商品带货链接需拼接多一个aliveId
|
|
196
|
+
const aliveId = data.aliveInfo.alive_id
|
|
197
|
+
const url = data.goodsItem.target_url.replaceAll('&', "@")
|
|
198
|
+
const link = url.replaceAll('?', "$")
|
|
199
|
+
// 判断后端返回链接是否已拼接(如:?type= )参数,兼容 aliveId 拼接符
|
|
200
|
+
const symbol = url.indexOf('?') !== -1 ? '@' : '$'
|
|
201
|
+
return `${data.page_path}?type=1&link=${link}${symbol}aliveId=${aliveId}&title=${data.goodsItem.title}`
|
|
202
|
+
}
|
|
203
|
+
},
|
|
204
|
+
isStudent(properties) {
|
|
205
|
+
return properties.current_role === 'student'
|
|
206
|
+
},
|
|
207
|
+
//超过99999不够位置展示划线价,只能不要孩子了
|
|
208
|
+
showPriceLine(data) {
|
|
209
|
+
return data.goodsItem.priceLine > 0 && (data.goodsItem.priceShow < 100000 || !data.showPreferentialPrice)
|
|
210
|
+
},
|
|
211
|
+
showPrice(data) {
|
|
212
|
+
return data.isIOS && data.IOSMiniProgramCanBuy && data.goodsItem.priceShow !== 0 || !data.isIOS && data.goodsItem.priceShow !== 0
|
|
213
|
+
},
|
|
214
|
+
// 是否为安卓设备
|
|
215
|
+
isAndroid() {
|
|
216
|
+
let info = wx.getSystemInfoSync()
|
|
217
|
+
return info.platform === 'android'
|
|
218
|
+
},
|
|
219
|
+
//讲解中的商品
|
|
220
|
+
isShowExamplaining(properties) {
|
|
221
|
+
return properties.explainingGoods && properties.explainingGoods.resource_id === properties.goodsItem.resource_id;
|
|
222
|
+
},
|
|
223
|
+
//销量/订阅。只有 实物商品 21 、专栏 6、大专栏 8、会员 5 展示,受B端店铺设置(hide_sub_count):隐藏商品销量控制 0-显示 1-隐藏
|
|
224
|
+
hasSaleNum(data) {
|
|
225
|
+
return !data.goodsItem.hide_sub_count && data.goodsItem.order_num > 0
|
|
226
|
+
},
|
|
227
|
+
//销量/订阅。只有 实物商品 21 、专栏 6、大专栏 8、会员 5 展示
|
|
228
|
+
saleNum(data) {
|
|
229
|
+
//实物商品
|
|
230
|
+
if (data.goodsItem.resource_type === 21 || data.goodsItem.resource_type === 41 || data.goodsItem.resource_type === 68) {
|
|
231
|
+
return ' 已售 ' + (data.goodsItem.order_num || 0)
|
|
232
|
+
} else if (data.goodsItem.resource_type === 6 || data.goodsItem.resource_type === 8 || data.goodsItem.resource_type === 5) {
|
|
233
|
+
return ' 订阅 ' + (data.goodsItem.order_num || 0)
|
|
234
|
+
} else {
|
|
235
|
+
return ''
|
|
236
|
+
}
|
|
237
|
+
},
|
|
238
|
+
btnTxt(data) {
|
|
239
|
+
// 以下各种情况,按去查看 -> 已抢光 -> 查看详情 -> 免费领取 -> 券后 -> 去抢购 优先级展示
|
|
240
|
+
// 超级会员全免权益
|
|
241
|
+
let svipAllFree = data.goodsItem.resource_rights_type === 1
|
|
242
|
+
if (data.allContactPay || (data.isIOS && !data.IOSMiniProgramCanBuy)) {
|
|
243
|
+
// IOS小程序中不能买的展示去查看,跳转到小程序客服
|
|
244
|
+
return "去查看"
|
|
245
|
+
} else if (data.isOver) {
|
|
246
|
+
// 库存为0,已售罄
|
|
247
|
+
return "已抢光"
|
|
248
|
+
} else if (data.goodsItem.err_code) {
|
|
249
|
+
// 券后价接口报错,领取不了优惠券的情况
|
|
250
|
+
return "查看详情"
|
|
251
|
+
} else if (svipAllFree || data.goodsItem.priceShow === 0) {
|
|
252
|
+
// 超级会员全免或者0元商品
|
|
253
|
+
return "免费领取"
|
|
254
|
+
} else if (data.showPreferentialPrice) {
|
|
255
|
+
// 展示券后价
|
|
256
|
+
return "购买"
|
|
257
|
+
} else {
|
|
258
|
+
return "购买"
|
|
259
|
+
}
|
|
260
|
+
},
|
|
261
|
+
//当前适用的活动或者超级会员,活动价低就是活动,会员价低就是超级会员,超级会员全免,肯定最低,适用超级会员
|
|
262
|
+
// "限时折扣",
|
|
263
|
+
// "好友助力",
|
|
264
|
+
// "裂变海报",
|
|
265
|
+
// "拼团",
|
|
266
|
+
// "涨粉神器",
|
|
267
|
+
// "秒杀",
|
|
268
|
+
// "超级会员",
|
|
269
|
+
//是否开启了预热 1-开启 0-未开启
|
|
270
|
+
hasPreheat(data) {
|
|
271
|
+
return data.goodsItem.sec_kill_is_preheat === 1
|
|
272
|
+
},
|
|
273
|
+
//秒杀开始时间
|
|
274
|
+
startTime(data) {
|
|
275
|
+
return data.goodsItem.start_at && new Date(data.goodsItem.start_at.replace(/-/g, "/")) || new Date()
|
|
276
|
+
},
|
|
277
|
+
//超级会员
|
|
278
|
+
isSupperVip(data) {
|
|
279
|
+
return data.currentActive === '超级会员'
|
|
280
|
+
},
|
|
281
|
+
//秒杀活动需要预约
|
|
282
|
+
isAppointment(data) {
|
|
283
|
+
data.goodsItem.appointment = 1 //mock
|
|
284
|
+
return data.goodsItem.appointment === 1
|
|
285
|
+
},
|
|
286
|
+
secText(data) {
|
|
287
|
+
if (data.isSeckill && data.preheating) {
|
|
288
|
+
return `秒杀活动将在 ${data.time} 后开始`
|
|
289
|
+
} else {
|
|
290
|
+
return ''
|
|
291
|
+
}
|
|
292
|
+
},
|
|
293
|
+
filterSrc(data) {
|
|
294
|
+
return utils.replaceCDN(data.goodsItem.img_url, '?imageMogr2/thumbnail/400x400>/ignore-error/1')
|
|
295
|
+
},
|
|
296
|
+
|
|
297
|
+
// 已售百分比
|
|
298
|
+
percentage(data) {
|
|
299
|
+
if (data.isOver) return 100
|
|
300
|
+
// 无库存 拼团、限时抢购
|
|
301
|
+
if (!data.goodsItem.activity_stock) return 28
|
|
302
|
+
let num = 0
|
|
303
|
+
num = (data.goodsItem.activity_order_num / data.goodsItem.activity_stock) * 100
|
|
304
|
+
// 有库存时,最低占40%
|
|
305
|
+
return num <= 40 ? 40 : num
|
|
306
|
+
},
|
|
307
|
+
// 商品剩余数量
|
|
308
|
+
residueQuantity(data) {
|
|
309
|
+
let formatNum = (num) => {
|
|
310
|
+
if (!num || isNaN(num)) return num
|
|
311
|
+
num = Number(num)
|
|
312
|
+
if (Math.abs(num) >= 100000000) {
|
|
313
|
+
num = num / 100000000
|
|
314
|
+
return this.isDecimals(Math.floor(num * 100) / 100) ? Math.floor(num * 100) / 100 + '亿' : num + '亿'
|
|
315
|
+
} else if (Math.abs(num) >= 10000) {
|
|
316
|
+
num = num / 10000
|
|
317
|
+
return this.isDecimals(Math.floor(num * 100) / 100) ? Math.floor(num * 100) / 100 + '万' : num + '万'
|
|
318
|
+
} else {
|
|
319
|
+
return num
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
// "已抢光"
|
|
324
|
+
if (data.isOver) return '已抢光'
|
|
325
|
+
|
|
326
|
+
// 没有库存 - 已开抢
|
|
327
|
+
if (!data.goodsItem.activity_stock) return '已开抢'
|
|
328
|
+
|
|
329
|
+
return `仅剩${formatNum(data.goodsItem.activity_stock - data.goodsItem.activity_order_num)}件`
|
|
330
|
+
},
|
|
331
|
+
// 配送方式(-1:全部 1:快递配送 2:自提)
|
|
332
|
+
distributionWay(data) {
|
|
333
|
+
let text = ''
|
|
334
|
+
switch (data.goodsItem.distribution_pattern) {
|
|
335
|
+
case -1:
|
|
336
|
+
text = '自提·快递'
|
|
337
|
+
break
|
|
338
|
+
case 1:
|
|
339
|
+
text = '快递'
|
|
340
|
+
break
|
|
341
|
+
case 2:
|
|
342
|
+
text = '自提'
|
|
343
|
+
break
|
|
344
|
+
default:
|
|
345
|
+
text = ''
|
|
346
|
+
break
|
|
347
|
+
}
|
|
348
|
+
return text
|
|
349
|
+
},
|
|
350
|
+
distributionPattern(data) {
|
|
351
|
+
return [-1,1,2].indexOf(data.goodsItem.distribution_pattern) !== -1
|
|
352
|
+
}
|
|
353
|
+
},
|
|
354
|
+
/**
|
|
355
|
+
* 组件的方法列表
|
|
356
|
+
*/
|
|
357
|
+
methods: {
|
|
358
|
+
snapUpCheck: debounce(function () {
|
|
359
|
+
this.showToast('努力加载中')
|
|
360
|
+
this.triggerEvent('sendNewMsg')
|
|
361
|
+
let { aliveInfo, sensorReportParams, goodsInfo, isFullScreen } = this.properties
|
|
362
|
+
sensorLog.sensors.track('click_butt', {
|
|
363
|
+
page_id: 'e_alive#mini#first#alive_room',
|
|
364
|
+
page_name: '直播间页面',
|
|
365
|
+
l_program: '鹅直播',
|
|
366
|
+
page_path: '鹅直播#小程序#首页#直播间页面',
|
|
367
|
+
page_button: "列表去抢购",
|
|
368
|
+
client: "小程序",
|
|
369
|
+
goods_id: goodsInfo.id,
|
|
370
|
+
app_id: aliveInfo.app_id,
|
|
371
|
+
c_user_id: aliveInfo.user_id,
|
|
372
|
+
union_id: wx.getStorageSync('userInfo').universal_union_id,
|
|
373
|
+
current_role: sensorReportParams.current_role,
|
|
374
|
+
resource_id: aliveInfo.alive_id,
|
|
375
|
+
$url_path: `alive/${aliveInfo.alive_id}`,
|
|
376
|
+
type: sensorReportParams.type,
|
|
377
|
+
cmm1: sensorReportParams.alive_type,
|
|
378
|
+
cmm2: sensorReportParams.version_type,
|
|
379
|
+
comm2: sensorReportParams.pay_type,
|
|
380
|
+
cmm3: isFullScreen ? '全屏' : '非全屏'
|
|
381
|
+
})
|
|
382
|
+
// 线下课29课时包42/拼团 --判断权益
|
|
383
|
+
if ([29, 42].indexOf(this.data.goodsItem.resource_type) > -1 || this.data.goodsItem.activity_type === 6) {
|
|
384
|
+
this.judgePermission()
|
|
385
|
+
return
|
|
386
|
+
}
|
|
387
|
+
let params = {
|
|
388
|
+
id: this.data.goodsItem.id,
|
|
389
|
+
resource_id: this.data.goodsItem.resource_id,
|
|
390
|
+
resource_type: this.data.goodsItem.resource_type,
|
|
391
|
+
price: this.data.goodsItem.price,
|
|
392
|
+
app_id: this.data.aliveInfo.app_id,
|
|
393
|
+
user_id: this.data.aliveInfo.user_id,
|
|
394
|
+
coupon_id: this.data.goodsItem.coupon_id,
|
|
395
|
+
alive_id: this.data.aliveInfo.alive_id
|
|
396
|
+
}
|
|
397
|
+
const url = this.properties.isGrayMarketing ? snapCheckNew : snapCheck
|
|
398
|
+
url(params).then(res => {
|
|
399
|
+
this.hideToast()
|
|
400
|
+
let { code, data } = res.data
|
|
401
|
+
if (code === 0) {
|
|
402
|
+
if (data.err_msg) {
|
|
403
|
+
this.showToast(data.err_msg)
|
|
404
|
+
}
|
|
405
|
+
if (data.is_sec_kill_toast) {
|
|
406
|
+
this.showToast("秒杀活动开始,您未预约,需以原价购买!")
|
|
407
|
+
}
|
|
408
|
+
if (data.is_goods_detail === 1) {
|
|
409
|
+
this.judgePermission(data.is_has_permission)
|
|
410
|
+
} else if (data.is_more_sku === 1) {
|
|
411
|
+
this.showSku()
|
|
412
|
+
} else {
|
|
413
|
+
this.showConfirmOrder(data.sku)
|
|
414
|
+
}
|
|
415
|
+
} else {
|
|
416
|
+
this.showToast("网络繁忙,请稍后再试")
|
|
417
|
+
}
|
|
418
|
+
})
|
|
419
|
+
}, 1000, true),
|
|
420
|
+
cardToDetails() {
|
|
421
|
+
if (!this.data.isStudent) { return }
|
|
422
|
+
let { aliveInfo, sensorReportParams, goodsInfo, isFullScreen } = this.properties
|
|
423
|
+
sensorLog.sensors.track('click_butt', {
|
|
424
|
+
page_id: 'e_alive#mini#first#alive_room',
|
|
425
|
+
page_name: '直播间页面',
|
|
426
|
+
l_program: '鹅直播',
|
|
427
|
+
page_path: '鹅直播#小程序#首页#直播间页面',
|
|
428
|
+
page_button: "列表空白热区",
|
|
429
|
+
client: "小程序",
|
|
430
|
+
goods_id: goodsInfo.id,
|
|
431
|
+
product_name: goodsInfo.title,
|
|
432
|
+
app_id: aliveInfo.app_id,
|
|
433
|
+
c_user_id: aliveInfo.user_id,
|
|
434
|
+
union_id: wx.getStorageSync('userInfo').universal_union_id,
|
|
435
|
+
current_role: sensorReportParams.current_role,
|
|
436
|
+
resource_id: aliveInfo.alive_id,
|
|
437
|
+
$url_path: `alive/${aliveInfo.alive_id}`,
|
|
438
|
+
type: sensorReportParams.type,
|
|
439
|
+
cmm1: sensorReportParams.alive_type,
|
|
440
|
+
cmm2: sensorReportParams.version_type,
|
|
441
|
+
comm2: sensorReportParams.pay_type,
|
|
442
|
+
cmm3: isFullScreen ? '全屏' : '非全屏'
|
|
443
|
+
})
|
|
444
|
+
this.judgePermission()
|
|
445
|
+
},
|
|
446
|
+
// 点击空白热区进来判断权益,或者接口返回有权益的时候进来判断跳转路径
|
|
447
|
+
judgePermission: debounce(async function (permission) {
|
|
448
|
+
// 实物21 有价优惠券41 超级会员23 可多次购买,没有权益说法,直接拉起客服;直播商品有没有权益都是去详情页。
|
|
449
|
+
if ([41, 21, 23, 4].indexOf(Number(this.data.goodsItem.resource_type)) > -1) {
|
|
450
|
+
this.toDetails()
|
|
451
|
+
return
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
if (permission !== 0 && permission !== 1) {
|
|
455
|
+
permission = await this.getUserPermission()
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
console.log("permission", permission)
|
|
459
|
+
// 有权益的情况下
|
|
460
|
+
if (permission) {
|
|
461
|
+
// 电子书20/班课35 鹅学习不支持,无权益的情况下,内嵌h5, 有权益TOAST提示
|
|
462
|
+
if ([20, 35].indexOf(this.data.goodsItem.resource_type) > -1) {
|
|
463
|
+
this.showToast('您已拥有该课程,小程序内暂不支持学习此课程')
|
|
464
|
+
} else {
|
|
465
|
+
// 弹出提示去小程序学习 有三种可能 -圈子小程序 -小鹅通小程序 -打卡小程序
|
|
466
|
+
this.showdialog(this.data.goodsItem)
|
|
467
|
+
}
|
|
468
|
+
} else {
|
|
469
|
+
// 没有权益的情况下 直播商品去直播详情页,其他拉起客服
|
|
470
|
+
this.toDetails()
|
|
471
|
+
}
|
|
472
|
+
}, 1000, true),
|
|
473
|
+
getUserPermission() {
|
|
474
|
+
return new Promise((resolve, reject) => {
|
|
475
|
+
let params = {
|
|
476
|
+
id: this.data.goodsItem.id,
|
|
477
|
+
app_id: this.data.aliveInfo.app_id,
|
|
478
|
+
user_id: this.data.aliveInfo.user_id,
|
|
479
|
+
}
|
|
480
|
+
const url = this.properties.isGrayMarketing ? getUserPermissionNew : getUserPermission
|
|
481
|
+
url(params).then((res) => {
|
|
482
|
+
let { code, data } = res.data
|
|
483
|
+
if (code === 0) {
|
|
484
|
+
resolve(!!data.auth_state)
|
|
485
|
+
}
|
|
486
|
+
})
|
|
487
|
+
})
|
|
488
|
+
},
|
|
489
|
+
showConfirmOrder(sku) {
|
|
490
|
+
//带货列表返回的 resource_id就是业务侧的spu_id
|
|
491
|
+
// 返回的id,就是业务侧的resource_id
|
|
492
|
+
let params = {
|
|
493
|
+
id: this.data.goodsItem.resource_id,
|
|
494
|
+
spu_id: this.data.goodsItem.resource_id,
|
|
495
|
+
resource_type: this.data.goodsItem.resource_type,
|
|
496
|
+
resource_id: this.data.goodsItem.id,
|
|
497
|
+
spu_type: this.data.goodsItem.spu_type,
|
|
498
|
+
sku,
|
|
499
|
+
count: 1,
|
|
500
|
+
isAlive: 1,
|
|
501
|
+
aliveId: this.data.aliveInfo.alive_id,
|
|
502
|
+
isCollectCoupons: this.data.showPreferentialPrice
|
|
503
|
+
}
|
|
504
|
+
this.triggerEvent("showConfirmOrder", params)
|
|
505
|
+
},
|
|
506
|
+
showSku() {
|
|
507
|
+
let params = {
|
|
508
|
+
spuId: this.data.goodsItem.resource_id,
|
|
509
|
+
isCollectCoupons: this.data.showPreferentialPrice
|
|
510
|
+
}
|
|
511
|
+
this.triggerEvent("showSku", params)
|
|
512
|
+
},
|
|
513
|
+
showdialog() {
|
|
514
|
+
this.triggerEvent('showDialog', this.data.goodsItem)
|
|
515
|
+
},
|
|
516
|
+
sendNewMsg() {
|
|
517
|
+
this.triggerEvent('sendNewMsg')
|
|
518
|
+
},
|
|
519
|
+
showToast(title = '') {
|
|
520
|
+
wx.showToast({
|
|
521
|
+
title,
|
|
522
|
+
icon: "none",
|
|
523
|
+
duration: 1000
|
|
524
|
+
})
|
|
525
|
+
},
|
|
526
|
+
hideToast() {
|
|
527
|
+
wx.hideToast()
|
|
528
|
+
},
|
|
529
|
+
countTime() {
|
|
530
|
+
if (!this.data.isSeckill || !this.data.preheating) { //不是秒杀活动 或者不在预热中不倒计时
|
|
531
|
+
return
|
|
532
|
+
}
|
|
533
|
+
//获取当前时间
|
|
534
|
+
let date = new Date();
|
|
535
|
+
let now = date.getTime();
|
|
536
|
+
//截止时间
|
|
537
|
+
let deadline = new Date(this.data.startTime);
|
|
538
|
+
let end = deadline.getTime();
|
|
539
|
+
//剩余时间
|
|
540
|
+
let time = end - now;
|
|
541
|
+
//定义变量 d,h,m,s保存倒计时的时间
|
|
542
|
+
let d = 0, h = 0, m = 0, s = 0;
|
|
543
|
+
if (time >= 0) {
|
|
544
|
+
d = Math.floor(time / 1000 / 60 / 60 / 24);
|
|
545
|
+
h = Math.floor(time / 1000 / 60 / 60 % 24);
|
|
546
|
+
m = Math.floor(time / 1000 / 60 % 60);
|
|
547
|
+
s = Math.floor(time / 1000 % 60);
|
|
548
|
+
h = d > 0 ? h + 24 * d : h
|
|
549
|
+
h = h < 10 ? '0' + h : h
|
|
550
|
+
m = m < 10 ? '0' + m : m
|
|
551
|
+
s = s < 10 ? '0' + s : s
|
|
552
|
+
this.setData({
|
|
553
|
+
time: h + ":" + m + ":" + s
|
|
554
|
+
})
|
|
555
|
+
}
|
|
556
|
+
//递归每秒调用countTime方法,显示动态时间效果
|
|
557
|
+
let that = this
|
|
558
|
+
if (!(d === 0 && h === 0 && m === 0 && s === 0)) { //秒杀活动还未到时间
|
|
559
|
+
setTimeout(() => that.countTime(), 1000)
|
|
560
|
+
}
|
|
561
|
+
},
|
|
562
|
+
handleContact(e) {
|
|
563
|
+
console.log("点击了去查看")
|
|
564
|
+
},
|
|
565
|
+
formatUrl(goodsInfo) {
|
|
566
|
+
var url = ''
|
|
567
|
+
var jumpUrl = ''
|
|
568
|
+
if (typeof goodsInfo == 'object' && Object.keys(goodsInfo).length > 0) {
|
|
569
|
+
url = goodsInfo.target_url
|
|
570
|
+
jumpUrl = goodsInfo.target_url
|
|
571
|
+
} else {
|
|
572
|
+
url = this.data.goodsItem.target_url
|
|
573
|
+
jumpUrl = this.data.goodsItem.target_url //跳转链接
|
|
574
|
+
}
|
|
575
|
+
//跳转链接 带上参数
|
|
576
|
+
let queryIndex = url.indexOf("?"); //查询索引位置
|
|
577
|
+
if (queryIndex === -1) {
|
|
578
|
+
jumpUrl += "?"; //问号不存在,则拼接问号
|
|
579
|
+
} else {
|
|
580
|
+
url.length - 1 !== queryIndex ? (jumpUrl += "&") : ""; //问号是否不在末尾位置? 进行&拼接 :不处理
|
|
581
|
+
}
|
|
582
|
+
jumpUrl = `${jumpUrl}live_room=1&success=1&aliveId=${this.data.aliveInfo.alive_id}`;
|
|
583
|
+
if (![0, 2, 3].includes(this.data.aliveInfo.alive_state)) {
|
|
584
|
+
jumpUrl += `&is_living=1&unique_type=elive`;
|
|
585
|
+
}
|
|
586
|
+
return encodeURIComponent(jumpUrl)
|
|
587
|
+
},
|
|
588
|
+
toDetails() {
|
|
589
|
+
// 直播商品-去详情页,其他商品-拉起客服
|
|
590
|
+
let { title, img_url, target_url } = this.data.goodsItem
|
|
591
|
+
let params = encodeURIComponent(`img_url=${img_url}&title=${title}¶ms_url=${this.data.params_url}`)
|
|
592
|
+
console.log("urlurlurl", `/page/customerService/customerService?params=${params}`)
|
|
593
|
+
if (this.data.goodsItem.resource_type === 4) {
|
|
594
|
+
wx && wx.redirectTo({
|
|
595
|
+
url: `/pages/webView/webView?appId=${this.properties.aliveInfo.app_id}&aliveId=${this.data.goodsItem.id}&refreshAliveId=${this.properties.aliveInfo.alive_id}`,
|
|
596
|
+
})
|
|
597
|
+
|
|
598
|
+
} else {
|
|
599
|
+
// PC 复制链接
|
|
600
|
+
const { isPC, isDevtools } = getApp().globalData.system
|
|
601
|
+
if (isPC || isDevtools) {
|
|
602
|
+
this.copyLink(target_url)
|
|
603
|
+
return
|
|
604
|
+
}
|
|
605
|
+
// 暂时屏蔽内嵌H5详情页,拉起客服
|
|
606
|
+
wx && wx.navigateTo({
|
|
607
|
+
url: '/page/customerService/customerService' + `?params=${params}`
|
|
608
|
+
})
|
|
609
|
+
}
|
|
610
|
+
},
|
|
611
|
+
//judgePermission里面 showDialog 外部弹窗调用
|
|
612
|
+
toMiniProgram(goodsInfo) {
|
|
613
|
+
let { aliveInfo, sensorReportParams } = this.properties
|
|
614
|
+
sensorLog.sensors.track('click_butt', {
|
|
615
|
+
page_id: 'e_alive#mini#first#alive_room',
|
|
616
|
+
page_name: '直播间页面',
|
|
617
|
+
l_program: '鹅直播',
|
|
618
|
+
page_path: '鹅直播#小程序#首页#直播间页面',
|
|
619
|
+
page_button: "前往",
|
|
620
|
+
app_id: aliveInfo.app_id,
|
|
621
|
+
c_user_id: aliveInfo.user_id,
|
|
622
|
+
union_id: wx.getStorageSync('userInfo').universal_union_id,
|
|
623
|
+
current_role: sensorReportParams.current_role,
|
|
624
|
+
resource_id: aliveInfo.alive_id,
|
|
625
|
+
$url_path: `alive/${aliveInfo.alive_id}`,
|
|
626
|
+
type: sensorReportParams.type,
|
|
627
|
+
cmm1: sensorReportParams.alive_type,
|
|
628
|
+
cmm2: sensorReportParams.version_type,
|
|
629
|
+
comm2: sensorReportParams.pay_type
|
|
630
|
+
})
|
|
631
|
+
let spu_type = goodsInfo.spu_type
|
|
632
|
+
switch (spu_type) {
|
|
633
|
+
case ASSOCIATION:
|
|
634
|
+
this.toAssociation(goodsInfo);
|
|
635
|
+
break;
|
|
636
|
+
case PUNCH_CARD:
|
|
637
|
+
this.toPunchCard(goodsInfo);
|
|
638
|
+
break;
|
|
639
|
+
default:
|
|
640
|
+
this.toXiaoeLearn(goodsInfo);
|
|
641
|
+
break;
|
|
642
|
+
}
|
|
643
|
+
},
|
|
644
|
+
toXiaoeLearn(goodsInfo) {
|
|
645
|
+
let { aliveInfo } = this.properties
|
|
646
|
+
let h5_url = this.formatUrl(goodsInfo)
|
|
647
|
+
var path
|
|
648
|
+
// 音频 视频
|
|
649
|
+
if (goodsInfo.resource_type === 2 || goodsInfo.resource_type === 3) {
|
|
650
|
+
path = `/pages/index/authorizePage?user_id=${aliveInfo.user_id}&app_id=${aliveInfo.app_id}&resource_id=${goodsInfo.id}&unique_type=elive`
|
|
651
|
+
} else {
|
|
652
|
+
// 其他
|
|
653
|
+
path = `/pages/index/authorizePage?user_id=${aliveInfo.user_id}&app_id=${aliveInfo.app_id}&h5_url=${h5_url}`
|
|
654
|
+
}
|
|
655
|
+
let params = {
|
|
656
|
+
appId: "wxa3589f1193170aa3",
|
|
657
|
+
path,
|
|
658
|
+
}
|
|
659
|
+
if (this.properties.envName == 'inside' || this.properties.envName == 'test') { //开发环境 测试环境 加上这个参数可以跳转去鹅学习体验版
|
|
660
|
+
params.appId = 'wx9eb4d7b3f2a3e003'
|
|
661
|
+
params.envVersion = 'trial'
|
|
662
|
+
}
|
|
663
|
+
wx.navigateToMiniProgram(params)
|
|
664
|
+
},
|
|
665
|
+
toPunchCard(goodsInfo) {
|
|
666
|
+
let { aliveInfo } = this.properties
|
|
667
|
+
let path = `/pages-participate-progress/pages/participate/participate?app_id=${aliveInfo.app_id}&&activity_id=${goodsInfo.resource_id}`
|
|
668
|
+
let params = {
|
|
669
|
+
appId: "wx839728854b1e23ad", //现网
|
|
670
|
+
path,
|
|
671
|
+
}
|
|
672
|
+
if (this.properties.envName == 'inside') { //开发环境
|
|
673
|
+
params.appId = 'wx802f346b1c7dcdd9'
|
|
674
|
+
} else if (this.properties.envName == 'test') { // 测试环境
|
|
675
|
+
params.appId = 'wx778bc88236be97d9'
|
|
676
|
+
}
|
|
677
|
+
wx.navigateToMiniProgram(params)
|
|
678
|
+
},
|
|
679
|
+
toAssociation(goodsInfo) {
|
|
680
|
+
let { aliveInfo } = this.properties
|
|
681
|
+
let path = `/pages-community/pages/home/index?appId=${aliveInfo.app_id}&&communityId=${goodsInfo.resource_id}`
|
|
682
|
+
let params = {
|
|
683
|
+
appId: "wxd0ad7e76d51ae4cc",
|
|
684
|
+
path,
|
|
685
|
+
}
|
|
686
|
+
if (this.properties.envName == 'inside') {
|
|
687
|
+
params.appId = 'wx52419e90dc6dd535' //开发环境
|
|
688
|
+
} else if (this.properties.envName == 'test') { //测试环境
|
|
689
|
+
params.appId = 'wxb245d452213c48c9' //测试环境
|
|
690
|
+
}
|
|
691
|
+
wx.navigateToMiniProgram(params)
|
|
692
|
+
},
|
|
693
|
+
sendGoodsCard(e) {
|
|
694
|
+
let dataset = e.currentTarget.dataset;
|
|
695
|
+
// 触发父组件的send
|
|
696
|
+
this.triggerEvent('sendGoodsCard', {
|
|
697
|
+
datas: dataset
|
|
698
|
+
});
|
|
699
|
+
},
|
|
700
|
+
changeShowType() {
|
|
701
|
+
if (this.data.goodsItem.teacher_auth != 2) {
|
|
702
|
+
this.showToast('暂无权限')
|
|
703
|
+
return
|
|
704
|
+
}
|
|
705
|
+
this.setData({
|
|
706
|
+
switchLoading: true
|
|
707
|
+
})
|
|
708
|
+
let params = {
|
|
709
|
+
alive_id: this.properties.aliveInfo.alive_id,
|
|
710
|
+
app_id: this.properties.aliveInfo.app_id,
|
|
711
|
+
resource_id: this.data.goodsItem.id,
|
|
712
|
+
is_display_package: this.data.checked ? 0 : 1
|
|
713
|
+
};
|
|
714
|
+
showGoods(params).then((res) => {
|
|
715
|
+
console.log(res, "resres")
|
|
716
|
+
let { code } = res.data
|
|
717
|
+
if (code === 0) {
|
|
718
|
+
this.setData({
|
|
719
|
+
switchLoading: false,
|
|
720
|
+
checked: !this.data.checked
|
|
721
|
+
})
|
|
722
|
+
this.showToast('操作成功')
|
|
723
|
+
} else {
|
|
724
|
+
this.setData({
|
|
725
|
+
switchLoading: false
|
|
726
|
+
})
|
|
727
|
+
}
|
|
728
|
+
})
|
|
729
|
+
},
|
|
730
|
+
stopEvent() {
|
|
731
|
+
return
|
|
732
|
+
},
|
|
733
|
+
copyLink(link) {
|
|
734
|
+
wx.setClipboardData({
|
|
735
|
+
data: link,
|
|
736
|
+
success() {
|
|
737
|
+
wx.showToast({
|
|
738
|
+
title: '商品链接已复制,请用浏览器打开',
|
|
739
|
+
icon: 'none',
|
|
740
|
+
})
|
|
741
|
+
},
|
|
742
|
+
})
|
|
743
|
+
}
|
|
744
|
+
}
|
|
745
|
+
})
|