Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
7
7-Eleven
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
高淑倩
7-Eleven
Commits
342d5723
Commit
342d5723
authored
May 04, 2020
by
谢中龙
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
包邮券
parent
9545ae6c
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
241 additions
and
61 deletions
+241
-61
selectCoupon.js
src/component/selectCoupon/selectCoupon.js
+36
-15
index.js
src/config/index.js
+2
-2
confirmOrder.js
src/pages/confirmOrder/confirmOrder.js
+98
-4
confirmOrder.wxml
src/pages/confirmOrder/confirmOrder.wxml
+15
-1
confirmOrder.wxss
src/pages/confirmOrder/confirmOrder.wxss
+27
-0
couponDetail.js
src/pages/couponDetail/couponDetail.js
+7
-5
couponDetail.wxml
src/pages/couponDetail/couponDetail.wxml
+25
-3
coupons.js
src/pages/coupons/coupons.js
+29
-1
project.config.json
src/project.config.json
+2
-30
No files found.
src/component/selectCoupon/selectCoupon.js
View file @
342d5723
...
...
@@ -37,23 +37,44 @@ Component({
const
{
couponList
}
=
this
.
data
if
(
couponList
.
length
)
{
couponList
.
map
(
coupon
=>
{
coupon
.
couponDTOS
.
forEach
(
item
=>
{
item
.
checked
=
false
couponList
[
0
].
couponDTOS
[
0
]
?
couponList
[
0
].
couponDTOS
[
0
].
checked
=
true
:
item
[
0
].
checked
=
true
item
.
couponDiscount
=
coupon
.
couponDiscount
item
.
title
=
coupon
.
couponSettingDTO
.
title
item
.
type
=
coupon
.
couponSettingDTO
.
type
item
.
faceAmount
=
coupon
.
couponSettingDTO
.
faceAmount
item
.
takeCouponBgimg
=
coupon
.
couponSettingDetailDTO
.
style
.
takeCouponBgimg
// notice 格式
item
.
newNotice
=
item
&&
item
.
notice
?
JSON
.
parse
(
item
.
notice
)
:
''
for
(
let
i
in
item
.
newNotice
)
{
if
(
item
.
newNotice
[
i
].
type
==
1
)
{
item
.
newNotice
[
i
].
value
=
item
.
startTime
.
substring
(
0
,
10
)
+
' 至 '
+
item
.
endTime
.
substring
(
0
,
10
)
//处理coupon.couponDTOS有的时候
if
(
coupon
.
couponDTOS
){
coupon
.
couponDTOS
.
forEach
(
item
=>
{
item
.
checked
=
false
couponList
[
0
].
couponDTOS
[
0
]
?
couponList
[
0
].
couponDTOS
[
0
].
checked
=
true
:
item
[
0
].
checked
=
true
item
.
couponDiscount
=
coupon
.
couponDiscount
item
.
title
=
coupon
.
couponSettingDTO
.
title
item
.
type
=
coupon
.
couponSettingDTO
.
type
item
.
faceAmount
=
coupon
.
couponSettingDTO
.
faceAmount
item
.
takeCouponBgimg
=
coupon
.
couponSettingDetailDTO
.
style
.
takeCouponBgimg
// notice 格式
item
.
newNotice
=
item
&&
item
.
notice
?
JSON
.
parse
(
item
.
notice
)
:
''
for
(
let
i
in
item
.
newNotice
)
{
if
(
item
.
newNotice
[
i
].
type
==
1
)
{
item
.
newNotice
[
i
].
value
=
item
.
startTime
.
substring
(
0
,
10
)
+
' 至 '
+
item
.
endTime
.
substring
(
0
,
10
)
}
}
});
}
else
{
coupon
.
couponDTOS
=
[];
coupon
.
newNotice
=
coupon
.
notice
?
JSON
.
parse
(
coupon
.
notice
)
:
''
for
(
let
i
in
coupon
.
newNotice
)
{
if
(
coupon
.
newNotice
[
i
].
type
==
1
)
{
coupon
.
newNotice
[
i
].
value
=
coupon
.
startTime
.
substring
(
0
,
10
)
+
' 至 '
+
coupon
.
endTime
.
substring
(
0
,
10
)
}
}
})
})
let
obj
=
{
id
:
coupon
.
cardNo
,
checked
:
false
,
couponDiscount
:
coupon
.
couponDiscount
,
title
:
coupon
.
title
,
takeCouponBgimg
:
coupon
.
takeCouponBgimg
,
newNotice
:
coupon
.
newNotice
,
}
coupon
.
couponDTOS
=
[
obj
];
}
});
wxService
.
nextTick
(()
=>
{
this
.
setData
({
...
...
src/config/index.js
View file @
342d5723
...
...
@@ -6,7 +6,7 @@
// 修改 BRANCH_ID 为对应的商户id
// app.js 中brandId 修改为对应
const
PROJECT_ENV
=
'
dev
'
// 生产 prod, 开发 dev, 测试 test , 测试门户 test_store, 预生产 pre
const
PROJECT_ENV
=
'
test
'
// 生产 prod, 开发 dev, 测试 test , 测试门户 test_store, 预生产 pre
//仅生产环境时 配置 :
//3001 3001 , wx313ec36b710125d4 有直播
//2006 泰华 , wx40fec8944623c8b3 有直播
...
...
@@ -26,7 +26,7 @@ const PROJECT_ENV = 'dev' // 生产 prod, 开发 dev, 测试 test , 测试门户
//2002 巴黎贝甜 wx21968cb3a486d4ab
//2014 包小姐与鞋先生 wxa00302e2f53dd9c5
const
BRANCH_ID
=
100
1
const
BRANCH_ID
=
100
2
const
isMall
=
true
// const needMock = '' //
...
...
src/pages/confirmOrder/confirmOrder.js
View file @
342d5723
...
...
@@ -66,6 +66,11 @@ wxService.page({
point
:
0
,
pointAmount
:
0
},
//包邮券列表
postalCouponList
:
[],
currentPostalCoupon
:
null
,
showSelectPostalCoupon
:
false
,
},
//获取积分抵扣配置信息
...
...
@@ -88,6 +93,26 @@ wxService.page({
}
});
},
//获取我的包邮券列表
getMyPostalCouponList
(){
let
params
=
{};
params
.
status
=
1
;
params
.
couponType
=
2
;
this
.
data
.
postalCouponList
=
[];
wxService
.
post
(
`/coupon/coupon/listWithMember4Mina?number=1&size=1000000`
,
params
).
then
(
res
=>
{
if
(
!
res
)
return
false
const
{
result
,
data
}
=
res
.
data
if
(
result
==
0
){
let
list
=
data
.
content
?
data
.
content
:
[];
this
.
data
.
postalCouponList
=
list
;
this
.
setData
({
postalCouponList
:
this
.
data
.
postalCouponList
});
}
});
},
/**
* 生命周期函数--监听页面加载
...
...
@@ -203,6 +228,7 @@ wxService.page({
//获取备注信息
this
.
getLocalRemarkInfo
();
this
.
getMyPostalCouponList
();
},
//获取备注信息
...
...
@@ -364,6 +390,49 @@ wxService.page({
// 实付款
this
.
setPayPrice
();
},
//选择完包邮券
updatePostalCoupon
(
e
){
if
(
!
e
.
detail
)
{
this
.
setData
({
currentPostalCoupon
:
null
,
},()
=>
{
this
.
reCallPreview
();
});
}
else
{
let
detail
=
e
.
detail
;
this
.
getCouponInfo
(
detail
.
id
);
}
},
//获取优惠券详情
getCouponInfo
(
id
){
wxService
.
post
(
`/coupon/coupon/get?cardNo=
${
id
}
`
).
then
(
res
=>
{
const
{
result
,
data
}
=
res
.
data
if
(
result
==
0
){
data
.
faceAmount
=
data
.
couponSetting
.
faceAmount
;
data
.
postalDiscountPrice
=
'0.00'
;
data
.
couponSettingId
=
data
.
couponSetting
.
couponSettingId
;
this
.
data
.
currentPostalCoupon
=
data
;
}
else
{
this
.
data
.
currentPostalCoupon
=
null
;
}
this
.
setData
({
currentPostalCoupon
:
this
.
data
.
currentPostalCoupon
,
}
,
()
=>
{
//计算一下价格
this
.
reCallPreview
();
});
});
},
//选择包邮券
onTapSelectPostalCoupon
(){
this
.
setData
({
showSelectPostalCoupon
:
true
,
});
},
//计算显示订单价格
setPayPrice
()
{
const
{
...
...
@@ -377,7 +446,22 @@ wxService.page({
let
newCurrentCoupon
=
currentCoupon
?
currentCoupon
:
0
let
orderCoupon
=
parseFloat
(
newCurrentCoupon
)
// 优惠券价格
let
plusPrice
=
isSelect
?
plusMemberPrice
:
0
// plus
let
calCouponPrice
=
orderCoupon
?
orderCoupon
:
defalutCoupon
let
calCouponPrice
=
orderCoupon
?
orderCoupon
:
defalutCoupon
;
//获取包邮券信息
let
postalCouponInfo
=
this
.
data
.
currentPostalCoupon
;
let
freight
=
this
.
data
.
currentOrderList
.
freight
;
let
postalDiscountPrice
=
0
;
if
(
postalCouponInfo
){
//计算包邮券后运费
if
(
parseInt
(
freight
*
100
)
>
postalCouponInfo
.
faceAmount
){
postalDiscountPrice
=
parseFloat
(
postalCouponInfo
.
faceAmount
/
10
/
10
).
toFixed
(
2
);
// postalCouponInfo.postalDiscountPrice = parseFloat(postalCouponInfo.faceAmount/10/10).toFixed(2);
}
else
{
postalDiscountPrice
=
freight
;
}
}
//获取计算优惠后的价格
let
promotionPrice
=
(
orderInitPrice
-
coouponDiscount
)
>
0
?
(
orderInitPrice
-
coouponDiscount
)
:
0
;
...
...
@@ -386,11 +470,16 @@ wxService.page({
promotionPrice
=
promotionPrice
*
1
-
this
.
data
.
pointDeductMoney
*
1
;
}
//看一下是否使用了包邮券
if
(
this
.
data
.
currentPostalCoupon
){
promotionPrice
=
promotionPrice
*
1
-
postalDiscountPrice
*
1
;
postalCouponInfo
.
postalDiscountPrice
=
postalDiscountPrice
;
}
// 实际价格 - 优惠价 + plus
this
.
setData
({
// orderPrice: Math.round(orderInitPrice - orderCoupon)
// orderPrice: orderInitPrice - orderCoupon + plusPrice
orderPrice
:
promotionPrice
+
plusPrice
orderPrice
:
promotionPrice
+
plusPrice
,
currentPostalCoupon
:
postalCouponInfo
,
})
},
//提交按钮
...
...
@@ -949,6 +1038,11 @@ wxService.page({
}
}
//处理包邮券信息
if
(
this
.
data
.
currentPostalCoupon
){
params
.
postCouponSettingId
=
this
.
data
.
currentPostalCoupon
.
couponSettingId
;
}
let
_this
=
this
;
let
url
=
isSelect
?
'/sale/payment/merged/buyer/bill'
:
'/sale/trade/buyer/bill'
wxService
.
post
(
`
${
url
}
`
,
params
).
then
(
res
=>
{
...
...
src/pages/confirmOrder/confirmOrder.wxml
View file @
342d5723
...
...
@@ -172,7 +172,17 @@
</view>
</view>
</view>
<!-- 包邮券 -->
<view class="postal-coupon" bindtap="onTapSelectPostalCoupon" wxLif="{{currentOrderList.freight > 0}}">
<text class="price-label">包邮券</text>
<view class="postal-info" >
<text class="{{currentPostalCoupon ? 'show-price' : ''}}">{{postalCouponList.length == 0 ? '无可用包邮券' : (
currentPostalCoupon ? '-' + currentPostalCoupon.postalDiscountPrice : '选择包邮券'
)}}</text>
<image class="arrow-right" mode="aspectFit" src="/assets/imgs/7_1_0/arrow-right.png" />
</view>
</view>
<!-- 运费 -->
<view class="coupon">
<view>
<text class="price-label">运费</text>
...
...
@@ -181,6 +191,7 @@
</view>
</view>
</view>
<!-- 积分 -->
<view class="coupon" wx:if="{{isSelect}}">
<view>
<text class="price-label">{{plusMemberName}}</text>
...
...
@@ -255,5 +266,7 @@
<!-- <go-home/> -->
<!-- <floatNav bind:getAuth="_getUserInfo" bind:updatePage="updatePage" /> -->
<select-coupon show="{{showSelectCoupon}}" bind:updateCoupon="updateCoupon" coupon-list="{{couponDiscountPreviews}}" />
<!-- 选择包邮券 -->
<select-coupon show="{{showSelectPostalCoupon}}" bind:updateCoupon="updatePostalCoupon" coupon-list="{{postalCouponList}}" />
<!-- 积分抵扣规则 -->
<point-deduct-rule showDialog="{{pointDeductRuleShow}}" ruleImg="{{pointDeductRuleUrl}}"/>
\ No newline at end of file
src/pages/confirmOrder/confirmOrder.wxss
View file @
342d5723
...
...
@@ -543,4 +543,30 @@
width: 26rpx;
height: 26rpx;
margin-right: 10rpx;
}
.postal-coupon{
display: flex;
align-items: center;
justify-content: space-between;
padding: 24rpx 20rpx;
border-bottom: 1px solid rgba(151, 151, 151, 0.3);
}
.postal-coupon .postal-info{
display: flex;
align-items: center;
justify-content: flex-end;
font-size: 22rpx;
color: #999999;
}
.postal-coupon .postal-info .show-price{
color: #cb3c3c !important;
}
.postal-coupon .postal-info image{
width: 13rpx;
height: 21rpx;
margin-left: 8rpx;
}
\ No newline at end of file
src/pages/couponDetail/couponDetail.js
View file @
342d5723
...
...
@@ -69,7 +69,7 @@ wxService.page({
},
//获取包邮券详情
getPostalVoucherInfo
(
id
){
this
.
getNormalCouponInfo
(
id
);
},
//获取优惠券相信
getNormalCouponInfo
(
id
){
...
...
@@ -79,19 +79,21 @@ wxService.page({
wx
.
hideLoading
()
data
.
coupon
.
startTime
=
data
.
coupon
.
startTime
.
substring
(
0
,
10
)
data
.
coupon
.
endTime
=
data
.
coupon
.
endTime
.
substring
(
0
,
10
)
data
.
coupon_name
=
data
.
couponSetting
.
title
;
data
.
couponSetting
.
notice
=
JSON
.
parse
(
data
.
couponSetting
.
notice
)
for
(
let
i
in
data
.
couponSetting
.
notice
){
if
(
data
.
couponSetting
.
notice
[
i
].
type
==
1
){
data
.
couponSetting
.
notice
[
i
].
value
=
data
.
coupon
.
startTime
.
substring
(
0
,
10
)
+
' 至 '
+
data
.
coupon
.
endTime
.
substring
(
0
,
10
)
}
}
this
.
setData
({
couponDetail
:
data
})
this
.
setData
({
couponDetail
:
data
});
}
}).
finally
(()
=>
{
wx
.
hideLoading
()
})
})
;
},
//展示券码
...
...
src/pages/couponDetail/couponDetail.wxml
View file @
342d5723
...
...
@@ -45,9 +45,7 @@
<view class='coupon-name fs-28'>{{payCouponInfo.coupon_name}}</view>
<view class='coupon-desc fs-28'>{{payCouponInfo.startTime}} 至 {{payCouponInfo.endTime}}</view>
</view>
<view class='coupon-code fs-24' bindtap="handelPresentCouponCode" wx:if="{{!couponType}}">出示券码</view>
<view class='coupon-code fs-24' wx:if="{{couponType == 1}}">支付券</view>
<view class='coupon-code fs-24' wx:if="{{couponType == 2}}">包邮券</view>
<view class='coupon-code fs-24'>支付券</view>
</view>
<view class='integral-detail'>
<view class='integral-list' wx:for="{{payCouponInfo.notice}}" wx:key="*this">
...
...
@@ -58,6 +56,30 @@
</view>
</view>
<!-- 包邮券 -->
<view class='page-integral-detail' wx:if="{{couponType == 2}}">
<view class='coupon-wrap'>
<view class='coupon-list'>
<image class='coupon-bg'
src='https://img3.bigaka.com/prd/3001/202003/20200309/300109875abd-15b0-4de3-9673-18d2d1ee4e20.png' />
<view class='coupon-img'>
<image wx:if="{{couponDetail.indexImgUrl}}" src='{{couponDetail.indexImgUrl}}' mode="aspectFit"/>
<image wx:else src='https://img3.bigaka.com/prd/3001/202003/20200309/30018086c13a-4579-47ed-a16e-c74cb8010c1d.png' />
</view>
<view class='coupon-info'>
<view class='coupon-name fs-28'>{{couponDetail.couponSetting.title}}</view>
<view class='coupon-desc fs-28'>{{couponDetail.coupon.startTime}} 至 {{couponDetail.coupon.endTime}}</view>
</view>
<view class='coupon-code fs-24'>包邮券</view>
</view>
<view class='integral-detail'>
<view class='integral-list' wx:for="{{couponDetail.couponSetting.notice}}" wx:key="*this">
<text class='integral-title'>{{item.label}}</text>
<text class='integral-desc wpl'>{{item.value}}</text>
</view>
</view>
</view>
</view>
<!--goHome-->
<go-home/>
...
...
src/pages/coupons/coupons.js
View file @
342d5723
...
...
@@ -44,7 +44,7 @@ wxService.page({
}
else
if
(
current
==
2
){
//包邮券
this
.
getPosCouponList
();
}
}
,
/**
...
...
@@ -61,6 +61,8 @@ wxService.page({
this
.
getCouponList
(
1
,
10
,
1
);
//获取支付券
this
.
getPayCouponList
();
//获取包邮券
this
.
getPosCouponList
();
},
//跳转到卡券详情
handelPresentCouponDetail
(
e
)
{
...
...
@@ -88,6 +90,7 @@ wxService.page({
let
params
=
{};
params
.
status
=
1
;
params
.
couponType
=
1
;
this
.
data
.
couponList
=
[];
wxService
.
post
(
`/coupon/coupon/listWithMember4Mina?number=1&size=1000000`
,
params
).
then
(
res
=>
{
...
...
@@ -111,6 +114,31 @@ wxService.page({
wx
.
hideLoading
();
})
},
//获取包邮券
getPosCouponList
(){
let
params
=
{};
params
.
status
=
1
;
params
.
couponType
=
2
;
this
.
data
.
couponList
=
[];
wxService
.
post
(
`/coupon/coupon/listWithMember4Mina?number=1&size=1000000`
,
params
).
then
(
res
=>
{
if
(
!
res
)
return
false
const
{
result
,
data
}
=
res
.
data
if
(
result
==
0
){
wx
.
hideLoading
()
// 处理时间显示
if
(
!
data
.
content
)
return
false
data
.
content
.
forEach
(
item
=>
{
item
.
startTime
=
item
.
startTime
.
substring
(
0
,
10
)
item
.
endTime
=
item
.
endTime
.
substring
(
0
,
10
)
});
this
.
setData
({
postalVoucherList
:
data
.
content
,
});
}
});
},
//获取支付券列表
getPayCouponList
(){
wxService
.
get
(
`/coupon/wechatCoupon/queryCouponList`
).
then
(
res
=>
{
...
...
src/project.config.json
View file @
342d5723
...
...
@@ -13,7 +13,7 @@
},
"compileType"
:
"miniprogram"
,
"libVersion"
:
"2.8.2"
,
"appid"
:
"wx
c3b64b09b1d3dfc2
"
,
"appid"
:
"wx
ac09792264c49b5c
"
,
"projectname"
:
"%E5%BE%AE%E5%95%86%E5%9F%8E"
,
"debugOptions"
:
{
"hidedInDevtools"
:
[]
...
...
@@ -566,7 +566,7 @@
"id"
:
77
,
"name"
:
"领取中心优惠券详情"
,
"pathName"
:
"subPackage/page/pages/couponCenterInfo/couponCenterInfo"
,
"query"
:
""
,
"query"
:
"
id=706914649421123584
"
,
"scene"
:
null
},
{
...
...
@@ -645,34 +645,6 @@
"pathName"
:
"pages/pointList/pointList"
,
"query"
:
""
,
"scene"
:
null
},
{
"id"
:
89
,
"name"
:
"支付券信息"
,
"pathName"
:
"subPackageA/page/pages/payCardInfo/payCardInfo"
,
"query"
:
"id=704753070554353664"
,
"scene"
:
null
},
{
"id"
:
-1
,
"name"
:
"现金购买券列表"
,
"pathName"
:
"subPackageA/page/pages/moneyBuyCoupon/moneyBugCoupon"
,
"query"
:
""
,
"scene"
:
null
},
{
"id"
:
91
,
"name"
:
"现金购买券详情"
,
"pathName"
:
"subPackageA/page/pages/moneyBuyCouponInfo/moneyBuyCouponInfo"
,
"query"
:
"id=704317444864479232"
,
"scene"
:
null
},
{
"id"
:
-1
,
"name"
:
"优惠券购买记录"
,
"pathName"
:
"subPackageA/page/pages/moneyBuyCouponRecords/moneyBuyCouponRecords"
,
"query"
:
""
,
"scene"
:
null
}
]
}
...
...
Write
Preview
Markdown
is supported
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