@@ -19,5 +19,13 @@ |
||
19 | 19 |
"navigateToMiniProgramAppIdList": [ |
20 | 20 |
"wxeb490c6f9b154ef9" |
21 | 21 |
], |
22 |
- "sitemapLocation": "sitemap.json" |
|
22 |
+ "sitemapLocation": "sitemap.json", |
|
23 |
+ "plugins": { |
|
24 |
+ "live-player-plugin": { |
|
25 |
+ "version": "1.0.8", |
|
26 |
+ "provider": "wx2b03c6e691cd7370" |
|
27 |
+ } |
|
28 |
+ } |
|
29 |
+ |
|
30 |
+ |
|
23 | 31 |
} |
@@ -57,7 +57,7 @@ app.routerInterceptor.checkLoginStatus({ |
||
57 | 57 |
that.setData({ |
58 | 58 |
kol: res.data.kol, |
59 | 59 |
commodities, |
60 |
- nums: Array(res.data.goods).fill(0), |
|
60 |
+ nums: Array(res.data.goods.length).fill(0), |
|
61 | 61 |
consumers: conusmers, |
62 | 62 |
pack, |
63 | 63 |
isLodding: true |
@@ -69,7 +69,8 @@ app.routerInterceptor.checkLoginStatus({ |
||
69 | 69 |
bindstepperChanged(e) { |
70 | 70 |
const { nums, commodities } = this.data |
71 | 71 |
nums[e.currentTarget.dataset.index] = e.detail |
72 |
- |
|
72 |
+ console.log(commodities) |
|
73 |
+ console.log(nums) |
|
73 | 74 |
const total = commodities.reduce( |
74 | 75 |
(accumulator, cur, index) => |
75 | 76 |
accumulator + (cur.price * 100 * nums[index]) / 100, |
@@ -14,7 +14,7 @@ |
||
14 | 14 |
<view class="user-info"> |
15 | 15 |
<image class="avatar" src="{{ kol.avatar_url }}"></image> |
16 | 16 |
<text class="nickname">{{ kol.nickname }}</text> |
17 |
- <view class="subscribe"> |
|
17 |
+ <view class="subscribe" wx:if="{{ kol.fans > 0 }}"> |
|
18 | 18 |
<text class="num">{{ kol.fans }}</text> |
19 | 19 |
<text class="label">粉丝</text> |
20 | 20 |
</view> |
@@ -50,7 +50,7 @@ |
||
50 | 50 |
<text class="bought" wx:if="{{ item.has_sale_num }}" |
51 | 51 |
>已购 {{ item.has_sale_num }}</text |
52 | 52 |
> |
53 |
- <view class="stepper-container"> |
|
53 |
+ <view class="stepper-container" wx:if="{{ item.inventory !== 0 }}"> |
|
54 | 54 |
<view class="bought-tip" wx:if="{{ index === 0 }}"> |
55 | 55 |
<text>点击 + 号,添加商品</text> |
56 | 56 |
<view class="triangle"></view> |
@@ -10,6 +10,8 @@ Page({ |
||
10 | 10 |
address: {}, |
11 | 11 |
kol: {}, |
12 | 12 |
pack_id: '', |
13 |
+ order_id: '', |
|
14 |
+ prepay_id: '', |
|
13 | 15 |
total: 0 |
14 | 16 |
}, |
15 | 17 |
|
@@ -54,6 +56,7 @@ Page({ |
||
54 | 56 |
}, |
55 | 57 |
|
56 | 58 |
confirm() { |
59 |
+ const that = this |
|
57 | 60 |
app.network.post({ |
58 | 61 |
url: app.urls.ORDER_CREATE, |
59 | 62 |
data: { |
@@ -68,6 +71,10 @@ Page({ |
||
68 | 71 |
}, |
69 | 72 |
success(res1) { |
70 | 73 |
const { wxpay_params } = res1.data |
74 |
+ that.setData({ |
|
75 |
+ order_id: res1.data.order_id, |
|
76 |
+ prepay_id: res1.data.prepay_id |
|
77 |
+ }) |
|
71 | 78 |
wx.requestPayment({ |
72 | 79 |
timeStamp: wxpay_params.timeStamp, |
73 | 80 |
nonceStr: wxpay_params.nonceStr, |
@@ -84,6 +91,17 @@ Page({ |
||
84 | 91 |
}) |
85 | 92 |
} |
86 | 93 |
}) |
94 |
+ }, |
|
95 |
+ fail: res2 => { |
|
96 |
+ if (res2.errMsg === 'requestPayment:fail cancel') { |
|
97 |
+ app.network.post({ |
|
98 |
+ url: app.urls.ORDER_CANCEL, |
|
99 |
+ data: { |
|
100 |
+ order_id: that.data.order_id, |
|
101 |
+ prepay_id: that.data.prepay_id |
|
102 |
+ } |
|
103 |
+ }) |
|
104 |
+ } |
|
87 | 105 |
} |
88 | 106 |
}) |
89 | 107 |
} |
@@ -6,5 +6,6 @@ module.exports = { |
||
6 | 6 |
MINI_USERINFO: `${config.baseURL}/api/mini/userinfo`, |
7 | 7 |
|
8 | 8 |
PACK: `${config.baseURL}/api/pack`, |
9 |
- ORDER_CREATE: `${config.baseURL}/api/pay/wx/order_create` |
|
9 |
+ ORDER_CREATE: `${config.baseURL}/api/pay/wx/order_create`, |
|
10 |
+ ORDER_CANCEL: `${config.baseURL}/api/pay/wx/order/cancel` |
|
10 | 11 |
} |