Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
jinli gu
Litemall
Commits
aa35328a
Unverified
Commit
aa35328a
authored
Oct 10, 2019
by
linlinjava
Committed by
GitHub
Oct 10, 2019
Browse files
Merge pull request #282 from beaver383/master
小程序同步修改优惠券问题
parents
9a50a793
6cb8bc4d
Changes
3
Hide whitespace changes
Inline
Side-by-side
litemall-wx/pages/checkout/checkout.js
View file @
aa35328a
...
...
@@ -17,6 +17,7 @@ Page({
cartId
:
0
,
addressId
:
0
,
couponId
:
0
,
userCouponId
:
0
,
message
:
''
,
grouponLinkId
:
0
,
//参与的团购,如果是发起则为0
grouponRulesId
:
0
//团购规则ID
...
...
@@ -32,6 +33,7 @@ Page({
cartId
:
that
.
data
.
cartId
,
addressId
:
that
.
data
.
addressId
,
couponId
:
that
.
data
.
couponId
,
userCouponId
:
that
.
data
.
userCouponId
,
grouponRulesId
:
that
.
data
.
grouponRulesId
}).
then
(
function
(
res
)
{
if
(
res
.
errno
===
0
)
{
...
...
@@ -47,6 +49,7 @@ Page({
orderTotalPrice
:
res
.
data
.
orderTotalPrice
,
addressId
:
res
.
data
.
addressId
,
couponId
:
res
.
data
.
couponId
,
userCouponId
:
res
.
data
.
userCouponId
,
grouponRulesId
:
res
.
data
.
grouponRulesId
,
});
}
...
...
@@ -90,6 +93,10 @@ Page({
if
(
couponId
===
""
)
{
couponId
=
0
;
}
var
userCouponId
=
wx
.
getStorageSync
(
'
userCouponId
'
);
if
(
userCouponId
===
""
)
{
userCouponId
=
0
;
}
var
grouponRulesId
=
wx
.
getStorageSync
(
'
grouponRulesId
'
);
if
(
grouponRulesId
===
""
)
{
grouponRulesId
=
0
;
...
...
@@ -103,6 +110,7 @@ Page({
cartId
:
cartId
,
addressId
:
addressId
,
couponId
:
couponId
,
userCouponId
:
userCouponId
,
grouponRulesId
:
grouponRulesId
,
grouponLinkId
:
grouponLinkId
});
...
...
@@ -131,6 +139,7 @@ Page({
cartId
:
this
.
data
.
cartId
,
addressId
:
this
.
data
.
addressId
,
couponId
:
this
.
data
.
couponId
,
userCouponId
:
this
.
data
.
userCouponId
,
message
:
this
.
data
.
message
,
grouponRulesId
:
this
.
data
.
grouponRulesId
,
grouponLinkId
:
this
.
data
.
grouponLinkId
...
...
litemall-wx/pages/ucenter/couponSelect/couponSelect.js
View file @
aa35328a
...
...
@@ -8,6 +8,7 @@ Page({
couponList
:
[],
cartId
:
0
,
couponId
:
0
,
userCouponId
:
0
,
grouponLinkId
:
0
,
scrollTop
:
0
},
...
...
@@ -46,6 +47,11 @@ Page({
couponId
=
0
;
}
var
userCouponId
=
wx
.
getStorageSync
(
'
userCouponId
'
);
if
(
!
userCouponId
)
{
userCouponId
=
0
;
}
var
grouponRulesId
=
wx
.
getStorageSync
(
'
grouponRulesId
'
);
if
(
!
grouponRulesId
)
{
grouponRulesId
=
0
;
...
...
@@ -54,6 +60,7 @@ Page({
this
.
setData
({
cartId
:
cartId
,
couponId
:
couponId
,
userCouponId
:
userCouponId
,
grouponRulesId
:
grouponRulesId
});
...
...
@@ -116,8 +123,14 @@ Page({
grouponRulesId
:
that
.
data
.
grouponRulesId
,
}).
then
(
function
(
res
)
{
if
(
res
.
errno
===
0
)
{
let
list
=
[];
for
(
var
i
=
0
;
i
<
res
.
data
.
list
.
length
;
i
++
)
{
if
(
res
.
data
.
list
[
i
].
available
)
{
list
.
push
(
res
.
data
.
list
[
i
]);
}
}
that
.
setData
({
couponList
:
res
.
data
.
list
couponList
:
list
});
}
wx
.
hideToast
();
...
...
@@ -126,7 +139,8 @@ Page({
},
selectCoupon
:
function
(
e
)
{
try
{
wx
.
setStorageSync
(
'
couponId
'
,
e
.
currentTarget
.
dataset
.
id
);
wx
.
setStorageSync
(
'
couponId
'
,
e
.
currentTarget
.
dataset
.
cid
);
wx
.
setStorageSync
(
'
userCouponId
'
,
e
.
currentTarget
.
dataset
.
id
);
}
catch
(
error
)
{
}
...
...
@@ -137,6 +151,7 @@ Page({
// 如果优惠券ID设置-1,则表示订单不使用优惠券
try
{
wx
.
setStorageSync
(
'
couponId
'
,
-
1
);
wx
.
setStorageSync
(
'
userCouponId
'
,
-
1
);
}
catch
(
error
)
{
}
...
...
litemall-wx/pages/ucenter/couponSelect/couponSelect.wxml
View file @
aa35328a
...
...
@@ -4,7 +4,7 @@
<view class="unselect" bindtap='unselectCoupon'>不选择优惠券</view>
<view class="item" wx:for="{{couponList}}" wx:for-index="index" wx:for-item="item" wx:key="id" bindtap="selectCoupon" data-id="{{item.id}}">
<view class="item" wx:for="{{couponList}}" wx:for-index="index" wx:for-item="item" wx:key="id" bindtap="selectCoupon" data-id="{{item.id}}"
data-cid="{{item.cid}}"
>
<view class="tag">{{item.tag}}</view>
<view class="content">
<view class="left">
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment