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
4d84cc0b
Commit
4d84cc0b
authored
Apr 11, 2020
by
谢中龙
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
抵用券优惠之后金额为负数
parent
2029db4c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
1196 additions
and
1175 deletions
+1196
-1175
confirmOrder.js
src/pages/confirmOrder/confirmOrder.js
+1047
-995
confirmOrder.wxml
src/pages/confirmOrder/confirmOrder.wxml
+149
-180
No files found.
src/pages/confirmOrder/confirmOrder.js
View file @
4d84cc0b
...
@@ -6,1081 +6,1132 @@ const utils = require('../../utils/util')
...
@@ -6,1081 +6,1132 @@ const utils = require('../../utils/util')
const
envInfo
=
require
(
'../../config/index'
).
envInfo
;
const
envInfo
=
require
(
'../../config/index'
).
envInfo
;
wxService
.
page
({
wxService
.
page
({
/**
/**
* 页面的初始数据
* 页面的初始数据
*/
*/
data
:
{
data
:
{
couponId
:
null
,
// 当前选中优惠券 id
couponId
:
null
,
// 当前选中优惠券 id
couponSettingId
:
null
,
// 当前选中plus优惠券 id
couponSettingId
:
null
,
// 当前选中plus优惠券 id
checkByPremium
:
false
,
checkByPremium
:
false
,
addressInfo
:
[],
addressInfo
:
[],
showSelectCoupon
:
false
,
showSelectCoupon
:
false
,
skuIds
:
[],
skuIds
:
[],
trolleySku2Buy
:
Array
,
trolleySku2Buy
:
Array
,
currentOrderList
:
Array
,
currentOrderList
:
Array
,
isSelect
:
false
,
isSelect
:
false
,
selectPrice
:
''
,
selectPrice
:
''
,
noSelectPrice
:
''
,
noSelectPrice
:
''
,
plusSpread
:
''
,
plusSpread
:
''
,
goodsAddress
:
false
,
goodsAddress
:
false
,
uAddress
:
{
uAddress
:
{
name
:
''
,
name
:
''
,
phone
:
''
,
phone
:
''
,
address
:
''
,
address
:
''
,
},
citys
:
null
,
cityView
:
''
,
multiIndex
:
[
0
,
0
,
0
],
selectCityName
:
[
''
,
''
],
wxAddress
:
false
,
currentCoupon
:
''
,
orderPrice
:
null
,
// 订单金额
orderInitPrice
:
0
,
plusMemberPrice
:
0
,
// plus 默认价
plusMemberName
:
''
,
defalutCoupon
:
''
,
useNotUserCoupon
:
false
,
defalutCouponId
:
''
,
// 默认第一项
addressId
:
''
,
// 收货地址id
totalGoodsPrice
:
0
,
buyerRemark
:
''
,
//备注信息
currentType
:
'delivery'
,
//delivery 快递 selfPickUp 门店自提
storeInfo
:
{
storeName
:
''
,
storeId
:
''
,
storeAddress
:
''
,
storeCode
:
''
},
orderStoreInfo
:
null
,
couponDiscountPreviews
:
[],
},
/**
* 生命周期函数--监听页面加载
*/
onLoad
:
function
(
options
)
{
wx
.
hideShareMenu
();
this
.
getMyLocationInfo
();
},
},
//输入
citys
:
null
,
onInput
(
e
){
cityView
:
''
,
let
key
=
e
.
target
.
dataset
.
name
;
multiIndex
:
[
0
,
0
,
0
],
let
value
=
e
.
detail
.
value
;
selectCityName
:
[
''
,
''
],
this
.
data
.
uAddress
[
key
]
=
value
;
wxAddress
:
false
,
currentCoupon
:
''
,
orderPrice
:
null
,
// 订单金额
orderInitPrice
:
0
,
plusMemberPrice
:
0
,
// plus 默认价
plusMemberName
:
''
,
defalutCoupon
:
''
,
useNotUserCoupon
:
false
,
defalutCouponId
:
''
,
// 默认第一项
addressId
:
''
,
// 收货地址id
totalGoodsPrice
:
0
,
buyerRemark
:
''
,
//备注信息
currentType
:
'delivery'
,
//delivery 快递 selfPickUp 门店自提
storeInfo
:
{
storeName
:
''
,
storeId
:
''
,
storeAddress
:
''
,
storeCode
:
''
},
},
////获取位置信息并获取附近门店信息
orderStoreInfo
:
null
,
getMyLocationInfo
(
cb
)
{
couponDiscountPreviews
:
[],
let
_this
=
this
;
},
if
(
!
envInfo
.
isNeedGetLocation
)
{
return
;
}
//获取本地缓存的地址信息
/**
let
myLocation
=
wx
.
getStorageSync
(
'myLocation'
)
?
wx
.
getStorageSync
(
'myLocation'
)
:
null
;
* 生命周期函数--监听页面加载
if
(
!
myLocation
)
{
*/
wx
.
getLocation
({
onLoad
:
function
(
options
)
{
type
:
'wgs84'
,
wx
.
hideShareMenu
();
success
(
res
)
{
this
.
getMyLocationInfo
();
const
latitude
=
res
.
latitude
},
const
longitude
=
res
.
longitude
//输入
let
obj
=
{
onInput
(
e
)
{
latitude
:
latitude
,
let
key
=
e
.
target
.
dataset
.
name
;
longitude
:
longitude
,
let
value
=
e
.
detail
.
value
;
}
this
.
data
.
uAddress
[
key
]
=
value
;
wx
.
setStorageSync
(
'myLocation'
,
obj
);
},
_this
.
getMyStoreInfoByPosition
(
latitude
,
longitude
);
////获取位置信息并获取附近门店信息
}
getMyLocationInfo
(
cb
)
{
});
let
_this
=
this
;
if
(
!
envInfo
.
isNeedGetLocation
)
{
return
;
}
return
;
//获取本地缓存的地址信息
let
myLocation
=
wx
.
getStorageSync
(
'myLocation'
)
?
wx
.
getStorageSync
(
'myLocation'
)
:
null
;
if
(
!
myLocation
)
{
wx
.
getLocation
({
type
:
'wgs84'
,
success
(
res
)
{
const
latitude
=
res
.
latitude
const
longitude
=
res
.
longitude
let
obj
=
{
latitude
:
latitude
,
longitude
:
longitude
,
}
wx
.
setStorageSync
(
'myLocation'
,
obj
);
_this
.
getMyStoreInfoByPosition
(
latitude
,
longitude
);
}
}
});
this
.
getMyStoreInfoByPosition
(
myLocation
.
latitude
,
myLocation
.
longitude
);
return
;
},
}
//获取附近门店信息
getMyStoreInfoByPosition
(
latitude
,
longitude
)
{
wxService
.
post
(
`/sale/trade/buyer/getMemberStore?latitude=
${
latitude
}
&longitude=
${
longitude
}
`
).
then
(
res
=>
{
if
(
res
)
{
if
(
res
.
data
.
result
==
0
)
{
let
obj
=
res
.
data
.
data
?
res
.
data
.
data
:
null
;
if
(
obj
)
{
this
.
data
.
orderStoreInfo
=
{
storeId
:
obj
.
storeId
,
storeInfo
:
obj
.
storeInfo
}
}
}
}
});
},
/**
* 生命周期函数--监听页面显示
*/
onShow
:
function
()
{
let
pages
=
getCurrentPages
();
let
currPage
=
pages
[
pages
.
length
-
1
];
const
{
trolleySku2Buy
}
=
this
.
options
;
let
tradeDto
=
{
trolleySku2Buy
:
JSON
.
parse
(
trolleySku2Buy
)
}
// 下单 && 计算优惠价
this
.
getMyStoreInfoByPosition
(
myLocation
.
latitude
,
myLocation
.
longitude
);
this
.
setData
({
},
trolleySku2Buy
:
tradeDto
.
trolleySku2Buy
//获取附近门店信息
},
()
=>
{
getMyStoreInfoByPosition
(
latitude
,
longitude
)
{
this
.
initCitys
()
wxService
.
post
(
`/sale/trade/buyer/getMemberStore?latitude=
${
latitude
}
&longitude=
${
longitude
}
`
).
then
(
res
=>
{
// 地址列表
if
(
res
)
{
if
(
this
.
data
.
currentType
==
'delivery'
)
{
if
(
res
.
data
.
result
==
0
)
{
this
.
getAddressList
()
let
obj
=
res
.
data
.
data
?
res
.
data
.
data
:
null
;
}
if
(
obj
)
{
else
{
this
.
data
.
orderStoreInfo
=
{
// 获取本地选择的门店信息
storeId
:
obj
.
storeId
,
this
.
getLocalStoreInfo
();
storeInfo
:
obj
.
storeInfo
}
}
});
}
}
}
});
},
/**
* 生命周期函数--监听页面显示
*/
onShow
:
function
()
{
let
pages
=
getCurrentPages
();
let
currPage
=
pages
[
pages
.
length
-
1
];
const
{
trolleySku2Buy
}
=
this
.
options
;
let
tradeDto
=
{
trolleySku2Buy
:
JSON
.
parse
(
trolleySku2Buy
)
}
//获取备注信息
// 下单 && 计算优惠价
this
.
getLocalRemarkInfo
();
this
.
setData
({
},
trolleySku2Buy
:
tradeDto
.
trolleySku2Buy
},
()
=>
{
this
.
initCitys
()
// 地址列表
if
(
this
.
data
.
currentType
==
'delivery'
)
{
this
.
getAddressList
()
}
else
{
// 获取本地选择的门店信息
this
.
getLocalStoreInfo
();
}
});
//获取备注信息
//获取备注信息
getLocalRemarkInfo
()
{
this
.
getLocalRemarkInfo
();
this
.
data
.
buyerRemark
=
wx
.
getStorageSync
(
'orderRemark'
);
},
this
.
setData
({
buyerRemark
:
this
.
data
.
buyerRemark
})
},
//输入备注
//获取备注信息
onTapInputRemark
()
{
getLocalRemarkInfo
()
{
wx
.
navigateTo
({
this
.
data
.
buyerRemark
=
wx
.
getStorageSync
(
'orderRemark'
);
url
:
'/pages/remark/remark'
,
this
.
setData
({
});
buyerRemark
:
this
.
data
.
buyerRemark
},
})
},
onUnload
()
{
//输入备注
wx
.
removeStorageSync
(
'orderRemark'
);
onTapInputRemark
()
{
wx
.
removeStorageSync
(
'choosedStoreInfo'
);
wx
.
navigateTo
({
},
url
:
'/pages/remark/remark'
,
});
//获取本地选择的门店信息
},
getLocalStoreInfo
()
{
let
storeInfo
=
wx
.
getStorageSync
(
'choosedStoreInfo'
)
?
wx
.
getStorageSync
(
'choosedStoreInfo'
)
:
null
;
if
(
storeInfo
)
{
this
.
data
.
storeInfo
.
storeId
=
storeInfo
.
id
;
this
.
data
.
storeInfo
.
storeName
=
storeInfo
.
name
;
this
.
data
.
storeInfo
.
storeAddress
=
storeInfo
.
storeFullAddress
;
this
.
data
.
storeInfo
.
storeCode
=
storeInfo
.
code
;
}
else
{
this
.
data
.
storeInfo
=
{
storeName
:
''
,
storeId
:
''
,
storeAddress
:
''
,
storeCode
:
''
,
}
}
this
.
setData
({
onUnload
()
{
storeInfo
:
this
.
data
.
storeInfo
wx
.
removeStorageSync
(
'orderRemark'
);
});
wx
.
removeStorageSync
(
'choosedStoreInfo'
);
},
const
{
memberId
}
=
wx
.
getStorageSync
(
'_baseUserInfo'
);
//获取本地选择的门店信息
const
{
trolleySku2Buy
,
checkByPremium
}
=
this
.
data
;
getLocalStoreInfo
()
{
let
params
=
{
checkByPremium
,
trolleySku2Buy
};
let
storeInfo
=
wx
.
getStorageSync
(
'choosedStoreInfo'
)
?
wx
.
getStorageSync
(
'choosedStoreInfo'
)
:
null
;
params
.
orderType
=
4
;
if
(
storeInfo
)
{
params
.
storeId
=
this
.
data
.
storeInfo
.
storeId
;
this
.
data
.
storeInfo
.
storeId
=
storeInfo
.
id
;
this
.
calPreferentialPrice
(
params
)
this
.
data
.
storeInfo
.
storeName
=
storeInfo
.
name
;
},
this
.
data
.
storeInfo
.
storeAddress
=
storeInfo
.
storeFullAddress
;
this
.
data
.
storeInfo
.
storeCode
=
storeInfo
.
code
;
}
else
{
this
.
data
.
storeInfo
=
{
storeName
:
''
,
storeId
:
''
,
storeAddress
:
''
,
storeCode
:
''
,
}
}
//切换tab
this
.
setData
({
onTapChangeType
(
e
)
{
storeInfo
:
this
.
data
.
storeInfo
let
type
=
e
.
currentTarget
.
dataset
.
type
;
});
this
.
setData
({
currentType
:
type
});
if
(
type
==
'delivery'
)
{
const
{
this
.
getAddressList
()
memberId
}
}
=
wx
.
getStorageSync
(
'_baseUserInfo'
);
else
{
const
{
this
.
getLocalStoreInfo
();
trolleySku2Buy
,
}
checkByPremium
},
}
=
this
.
data
;
//选择门店去
let
params
=
{
onTapSelectStore
()
{
checkByPremium
,
wx
.
navigateTo
({
trolleySku2Buy
url
:
'/subPackage/page/pages/chooseStore/chooseStore?isFrom=order'
,
};
});
params
.
orderType
=
4
;
},
params
.
storeId
=
this
.
data
.
storeInfo
.
storeId
;
//订单备注输入
this
.
calPreferentialPrice
(
params
)
onBuyerRemarkInput
(
e
)
{
},
this
.
data
.
buyerRemark
=
e
.
detail
.
value
;
this
.
setData
({
buyerRemark
:
this
.
data
.
buyerRemark
});
},
// select 传过来
updateCoupon
(
e
)
{
// faceAmount 抵用多少钱(分) 1 抵用券 2 折扣券 3 定额券
if
(
!
e
.
detail
)
{
this
.
setData
({
useNotUserCoupon
:
true
,
defalutCoupon
:
0
,
couponId
:
''
,
couponSettingId
:
''
,
defalutCouponId
:
''
,
currentCoupon
:
0
,
},
()
=>
{
this
.
setPayPrice
();
this
.
reCallPreview
();
});
return
}
const
{
faceAmount
,
type
,
id
,
couponDiscount
,
sid
}
=
e
.
detail
const
{
defalutCouponId
}
=
this
.
data
const
{
orderPrice
}
=
this
.
data
// couponId---id couponSettingId --sid
let
finCouponId
=
id
?
id
:
sid
let
finCouponName
=
id
?
'couponId'
:
'couponSettingId'
;
if
(
type
==
1
)
{
this
.
setData
({
useNotUserCoupon
:
false
,
defalutCoupon
:
true
,
defalutCouponId
:
finCouponId
?
''
:
defalutCouponId
,
[
finCouponName
]:
finCouponId
,
// couponId: id,
haveCoupon
:
true
,
currentCoupon
:
`
${
parseFloat
(
faceAmount
/
10
/
10
).
toFixed
(
2
)}
元`
},()
=>
{
this
.
reCallPreview
();
})
}
else
if
(
type
==
2
)
{
// let discounPrice = (faceAmount / 100) * (orderPrice)
// let spread = Math.round(orderPrice - discounPrice)
this
.
setData
({
defalutCoupon
:
true
,
useNotUserCoupon
:
false
,
[
finCouponName
]:
finCouponId
,
defalutCouponId
:
finCouponId
?
''
:
defalutCouponId
,
// couponId: id,
haveCoupon
:
true
,
currentCoupon
:
`
${
couponDiscount
}
元`
},()
=>
{
this
.
reCallPreview
();
});
}
else
if
(
type
==
3
){
//定额券
this
.
setData
({
//切换tab
defalutCoupon
:
true
,
onTapChangeType
(
e
)
{
useNotUserCoupon
:
false
,
let
type
=
e
.
currentTarget
.
dataset
.
type
;
defalutCouponId
:
finCouponId
?
''
:
defalutCouponId
,
this
.
setData
({
[
finCouponName
]:
finCouponId
,
currentType
:
type
haveCoupon
:
true
,
});
currentCoupon
:
`
${
couponDiscount
}
元`
},()
=>
{
this
.
reCallPreview
();
})
}
// 实付款
if
(
type
==
'delivery'
)
{
this
.
getAddressList
()
}
else
{
this
.
getLocalStoreInfo
();
}
},
//选择门店去
onTapSelectStore
()
{
wx
.
navigateTo
({
url
:
'/subPackage/page/pages/chooseStore/chooseStore?isFrom=order'
,
});
},
//订单备注输入
onBuyerRemarkInput
(
e
)
{
this
.
data
.
buyerRemark
=
e
.
detail
.
value
;
this
.
setData
({
buyerRemark
:
this
.
data
.
buyerRemark
});
},
// select 传过来
updateCoupon
(
e
)
{
// faceAmount 抵用多少钱(分) 1 抵用券 2 折扣券 3 定额券
if
(
!
e
.
detail
)
{
this
.
setData
({
useNotUserCoupon
:
true
,
defalutCoupon
:
0
,
couponId
:
''
,
couponSettingId
:
''
,
defalutCouponId
:
''
,
currentCoupon
:
0
,
},
()
=>
{
this
.
setPayPrice
();
this
.
setPayPrice
();
},
this
.
reCallPreview
();
setPayPrice
()
{
});
const
{
currentCoupon
,
orderInitPrice
,
isSelect
,
plusMemberPrice
,
defalutCoupon
}
=
this
.
data
return
let
newCurrentCoupon
=
currentCoupon
?
currentCoupon
:
0
}
let
orderCoupon
=
parseFloat
(
newCurrentCoupon
)
// 优惠券价格
const
{
let
plusPrice
=
isSelect
?
plusMemberPrice
:
0
// plus
faceAmount
,
let
calCouponPrice
=
orderCoupon
?
orderCoupon
:
defalutCoupon
type
,
id
,
couponDiscount
,
sid
}
=
e
.
detail
const
{
defalutCouponId
}
=
this
.
data
const
{
orderPrice
}
=
this
.
data
// couponId---id couponSettingId --sid
let
finCouponId
=
id
?
id
:
sid
let
finCouponName
=
id
?
'couponId'
:
'couponSettingId'
;
if
(
type
==
1
)
{
this
.
setData
({
useNotUserCoupon
:
false
,
defalutCoupon
:
true
,
defalutCouponId
:
finCouponId
?
''
:
defalutCouponId
,
[
finCouponName
]:
finCouponId
,
// couponId: id,
haveCoupon
:
true
,
currentCoupon
:
`
${
parseFloat
(
faceAmount
/
10
/
10
).
toFixed
(
2
)}
元`
},
()
=>
{
this
.
reCallPreview
();
})
}
else
if
(
type
==
2
)
{
// let discounPrice = (faceAmount / 100) * (orderPrice)
// let spread = Math.round(orderPrice - discounPrice)
this
.
setData
({
defalutCoupon
:
true
,
useNotUserCoupon
:
false
,
[
finCouponName
]:
finCouponId
,
defalutCouponId
:
finCouponId
?
''
:
defalutCouponId
,
// couponId: id,
haveCoupon
:
true
,
currentCoupon
:
`
${
couponDiscount
}
元`
},
()
=>
{
this
.
reCallPreview
();
});
}
else
if
(
type
==
3
)
{
//定额券
// 实际价格 - 优惠价 + plus
this
.
setData
({
this
.
setData
({
defalutCoupon
:
true
,
// orderPrice: Math.round(orderInitPrice - orderCoupon)
useNotUserCoupon
:
false
,
// orderPrice: orderInitPrice - orderCoupon + plusPrice
defalutCouponId
:
finCouponId
?
''
:
defalutCouponId
,
orderPrice
:
orderInitPrice
-
calCouponPrice
+
plusPrice
[
finCouponName
]:
finCouponId
,
})
haveCoupon
:
true
,
},
currentCoupon
:
`
${
couponDiscount
}
元`
//提交按钮
},
()
=>
{
formSubmit
(
e
)
{
this
.
reCallPreview
();
//判断是不是开卡了
})
if
(
this
.
data
.
orderingMustOpenCard
)
{
}
let
baseInfo
=
wx
.
getStorageSync
(
'_baseUserInfo'
);
if
(
!
baseInfo
)
{
wx
.
showToast
({
title
:
'你还未登录,请先去登录'
,
icon
:
'none'
});
return
;
}
let
memberActivateStatus
=
baseInfo
.
memberActivateStatus
;
// 实付款
if
(
!
memberActivateStatus
)
{
this
.
setPayPrice
();
wx
.
showModal
({
},
title
:
'下单开卡提示'
,
setPayPrice
()
{
content
:
'对不起,需要您先开卡后才能下单,点击确定去开卡'
,
const
{
showCancel
:
true
,
currentCoupon
,
confirmText
:
'确定'
,
orderInitPrice
,
confirmColor
:
'#cb3c3c'
,
isSelect
,
success
:
function
(
res
)
{
plusMemberPrice
,
if
(
res
.
confirm
)
{
defalutCoupon
//跳去开卡
}
=
this
.
data
wxService
.
openCard
();
let
newCurrentCoupon
=
currentCoupon
?
currentCoupon
:
0
}
let
orderCoupon
=
parseFloat
(
newCurrentCoupon
)
// 优惠券价格
else
if
(
res
.
cancel
)
{
let
plusPrice
=
isSelect
?
plusMemberPrice
:
0
// plus
let
calCouponPrice
=
orderCoupon
?
orderCoupon
:
defalutCoupon
//获取计算优惠后的价格
let
promotionPrice
=
(
orderInitPrice
-
calCouponPrice
)
>
0
?
(
orderInitPrice
-
calCouponPrice
)
:
0
;
// 实际价格 - 优惠价 + plus
this
.
setData
({
// orderPrice: Math.round(orderInitPrice - orderCoupon)
// orderPrice: orderInitPrice - orderCoupon + plusPrice
orderPrice
:
promotionPrice
+
plusPrice
})
},
//提交按钮
formSubmit
(
e
)
{
//判断是不是开卡了
if
(
this
.
data
.
orderingMustOpenCard
)
{
let
baseInfo
=
wx
.
getStorageSync
(
'_baseUserInfo'
);
if
(
!
baseInfo
)
{
wx
.
showToast
({
title
:
'你还未登录,请先去登录'
,
icon
:
'none'
});
return
;
}
}
let
memberActivateStatus
=
baseInfo
.
memberActivateStatus
;
}
if
(
!
memberActivateStatus
)
{
})
wx
.
showModal
({
title
:
'下单开卡提示'
,
content
:
'对不起,需要您先开卡后才能下单,点击确定去开卡'
,
showCancel
:
true
,
confirmText
:
'确定'
,
confirmColor
:
'#cb3c3c'
,
success
:
function
(
res
)
{
if
(
res
.
confirm
)
{
//跳去开卡
wxService
.
openCard
();
}
else
if
(
res
.
cancel
)
{
return
;
}
}
}
})
return
;
}
}
//判断是不是快递配送
if
(
this
.
data
.
currentType
==
'delivery'
)
{
const
{
goodsAddress
}
=
this
.
data
// 保存地址 && 支付
if
(
goodsAddress
)
{
if
(
!
this
.
data
.
uAddress
.
name
)
{
wx
.
showToast
({
title
:
`请输入收货人姓名`
,
icon
:
'none'
})
return
false
;
}
if
(
!
this
.
data
.
uAddress
.
phone
)
{
wx
.
showToast
({
title
:
`请输入收货人电话`
,
icon
:
'none'
})
return
false
;
}
if
(
!
this
.
data
.
cityView
)
{
wx
.
showToast
({
title
:
`请选择收货地区`
,
icon
:
'none'
})
return
false
;
}
if
(
!
this
.
data
.
uAddress
.
address
)
{
wx
.
showToast
({
title
:
`请输入收货详细地址`
,
icon
:
'none'
})
return
false
;
}
}
//判断是不是快递配送
if
(
this
.
data
.
currentType
==
'delivery'
)
{
const
{
goodsAddress
}
=
this
.
data
// 保存地址 && 支付
if
(
goodsAddress
)
{
if
(
!
this
.
data
.
uAddress
.
name
)
{
wx
.
showToast
({
title
:
`请输入收货人姓名`
,
icon
:
'none'
})
return
false
;
}
if
(
!
this
.
data
.
uAddress
.
phone
)
{
wx
.
showToast
({
title
:
`请输入收货人电话`
,
icon
:
'none'
})
return
false
;
}
if
(
!
this
.
data
.
cityView
)
{
wx
.
showToast
({
title
:
`请选择收货地区`
,
icon
:
'none'
})
return
false
;
}
if
(
!
this
.
data
.
uAddress
.
address
)
{
wx
.
showToast
({
title
:
`请输入收货详细地址`
,
icon
:
'none'
})
return
false
;
}
const
{
memberId
}
=
wx
.
getStorageSync
(
'_baseUserInfo'
)
const
{
this
.
setData
({
memberId
params
:
{
}
=
wx
.
getStorageSync
(
'_baseUserInfo'
)
userId
:
memberId
,
this
.
setData
({
name
:
this
.
data
.
uAddress
.
name
,
params
:
{
phone
:
this
.
data
.
uAddress
.
phone
,
userId
:
memberId
,
province
:
this
.
data
.
params
.
province
,
name
:
this
.
data
.
uAddress
.
name
,
city
:
this
.
data
.
params
.
city
,
phone
:
this
.
data
.
uAddress
.
phone
,
district
:
this
.
data
.
params
.
district
,
province
:
this
.
data
.
params
.
province
,
address
:
this
.
data
.
uAddress
.
address
,
city
:
this
.
data
.
params
.
city
,
type
:
this
.
data
.
isSelect
?
1
:
0
district
:
this
.
data
.
params
.
district
,
}
address
:
this
.
data
.
uAddress
.
address
,
});
type
:
this
.
data
.
isSelect
?
1
:
0
}
});
wx
.
showLoading
({
wx
.
showLoading
({
title
:
'加载中'
title
:
'加载中'
});
});
wxService
.
post
(
`/member/addressManage/save`
,
this
.
data
.
params
).
then
(
res
=>
{
wxService
.
post
(
`/member/addressManage/save`
,
this
.
data
.
params
).
then
(
res
=>
{
const
{
result
}
=
res
.
data
const
{
if
(
result
==
0
)
{
result
wx
.
hideLoading
()
}
=
res
.
data
wx
.
showToast
({
if
(
result
==
0
)
{
title
:
`保存成功`
,
wx
.
hideLoading
()
icon
:
'none'
wx
.
showToast
({
});
title
:
`保存成功`
,
icon
:
'none'
});
this
.
data
.
addressId
=
res
.
data
.
data
;
this
.
data
.
addressId
=
res
.
data
.
data
;
this
.
setData
({
this
.
setData
({
addressId
:
this
.
data
.
addressId
addressId
:
this
.
data
.
addressId
});
});
// 调起支付
// 调起支付
this
.
handelGobuy
()
}
})
}
else
{
// 调起支付
this
.
handelGobuy
()
}
}
else
{
this
.
handelGobuy
()
this
.
handelGobuy
()
}
}
},
})
initCitys
()
{
}
else
{
let
cityData
=
[];
// 调起支付
//热风地址库特殊处理
this
.
handelGobuy
()
if
(
envInfo
.
brandId
==
2010
)
{
}
//由于地址框太大了,现在先用热风的一个
}
else
{
cityData
=
city
.
default
;
this
.
handelGobuy
()
}
}
else
{
},
cityData
=
city
.
default
;
initCitys
()
{
}
let
cityData
=
[];
//热风地址库特殊处理
if
(
envInfo
.
brandId
==
2010
)
{
//由于地址框太大了,现在先用热风的一个
cityData
=
city
.
default
;
}
else
{
cityData
=
city
.
default
;
}
let
province
=
[]
let
cityList
=
[]
let
district
=
[]
cityData
.
forEach
((
item
)
=>
{
province
.
push
(
item
.
value
)
})
cityData
[
0
].
children
.
forEach
((
cityItem
)
=>
{
cityList
.
push
(
cityItem
.
value
)
cityItem
.
children
.
forEach
((
districtItem
)
=>
{
district
.
push
(
districtItem
.
value
)
})
})
this
.
setData
({
citys
:
[
province
,
cityList
,
district
]
})
},
bindMultiPickerChange
(
e
)
{
const
citys
=
this
.
data
.
citys
const
multiIndex
=
e
.
detail
.
value
if
(
citys
)
{
const
cityView
=
[
citys
[
0
][
multiIndex
[
0
]],
citys
[
1
][
multiIndex
[
1
]],
citys
[
2
][
multiIndex
[
2
]]].
join
(
' '
)
let
province
=
[]
this
.
setData
({
let
cityList
=
[]
multiIndex
,
let
district
=
[]
cityView
,
'params.province'
:
citys
[
0
][
multiIndex
[
0
]],
'params.city'
:
citys
[
1
][
multiIndex
[
1
]],
'params.district'
:
citys
[
2
][
multiIndex
[
2
]]
})
}
},
bindMultiPickerColumnChange
(
e
)
{
const
detail
=
e
.
detail
const
index
=
detail
.
value
let
cityName
=
''
let
cityData
=
city
.
default
let
province
=
[]
let
cityList
=
[]
let
district
=
[]
switch
(
detail
.
column
)
{
case
0
:
cityName
=
this
.
data
.
citys
[
0
][
index
]
this
.
data
.
selectCityName
[
0
]
=
cityName
cityData
.
forEach
((
item
)
=>
{
cityData
.
forEach
((
item
)
=>
{
province
.
push
(
item
.
value
)
if
(
item
.
value
==
cityName
)
{
})
item
.
children
.
forEach
((
cityItem
)
=>
{
cityData
[
0
].
children
.
forEach
((
cityItem
)
=>
{
cityList
.
push
(
cityItem
.
value
)
cityList
.
push
(
cityItem
.
value
)
cityItem
.
children
.
forEach
((
districtItem
)
=>
{
cityItem
.
children
.
forEach
((
districtItem
)
=>
{
district
.
push
(
districtItem
.
value
)
district
.
push
(
districtItem
.
value
)
})
})
})
}
})
})
this
.
setData
({
this
.
setData
({
citys
:
[
province
,
cityList
,
district
]
'citys[1]'
:
cityList
,
'citys[2]'
:
district
})
})
},
break
bindMultiPickerChange
(
e
)
{
case
1
:
const
citys
=
this
.
data
.
citys
cityName
=
this
.
data
.
citys
[
1
][
index
]
const
multiIndex
=
e
.
detail
.
value
this
.
data
.
selectCityName
[
1
]
=
cityName
if
(
citys
)
{
cityData
.
forEach
((
item
)
=>
{
const
cityView
=
[
citys
[
0
][
multiIndex
[
0
]],
citys
[
1
][
multiIndex
[
1
]],
citys
[
2
][
multiIndex
[
2
]]].
join
(
' '
)
item
.
children
.
forEach
((
cityItem
)
=>
{
if
(
cityName
==
cityItem
.
value
)
{
cityItem
.
children
.
forEach
((
districtItem
)
=>
{
district
.
push
(
districtItem
.
value
)
})
}
})
})
this
.
setData
({
'citys[2]'
:
[...
district
]
})
break
default
:
break
}
},
//勾选购买vip时
handelChangeSelectVip
()
{
this
.
setData
({
isSelect
:
!
this
.
data
.
isSelect
},
()
=>
{
const
{
isSelect
}
=
this
.
data
this
.
setData
({
checkByPremium
:
isSelect
,
defalutCoupon
:
0
,
couponId
:
''
,
couponSettingId
:
''
,
defalutCouponId
:
''
},
()
=>
{
this
.
reCallPreview
();
// 获取默认付费会员设置
this
.
getPremiumDefault
()
})
});
},
// /premium/getDefault
getPremiumDefault
()
{
wx
.
showLoading
({
title
:
'加载中'
})
wxService
.
get
(
`/sale/premium/getDefault`
).
then
(
res
=>
{
if
(
res
)
{
const
{
result
,
data
}
=
res
.
data
if
(
result
==
0
)
{
wx
.
hideLoading
()
this
.
setData
({
plusMemberPrice
:
data
.
price
,
plusMemberName
:
data
.
name
},
()
=>
{
// 实付款
this
.
setPayPrice
()
})
}
}
})
},
// 默认地址
selectAddress
()
{
wxService
.
router
(
'/pages/myAddress/myAddress?isFrom=order'
)
},
//拼接字段重新调用preview
reCallPreview
()
{
const
{
trolleySku2Buy
,
checkByPremium
,
addressId
,
addressInfo
}
=
this
.
data
let
params
=
{
checkByPremium
,
trolleySku2Buy
,
}
// 增加门店自提和快递配送判断
if
(
this
.
data
.
currentType
==
'delivery'
)
{
params
.
addressId
=
addressId
?
addressId
:
addressInfo
.
id
// 微信地址 or 地址id
params
.
orderType
=
1
;
}
else
{
params
.
orderType
=
4
;
params
.
storeId
=
this
.
data
.
storeInfo
.
storeId
;
}
this
.
calPreferentialPrice
(
params
)
// 重新计算优惠价
// 获取默认付费会员设置
this
.
getPremiumDefault
()
},
// 计算优惠价
calPreferentialPrice
(
params
)
{
wx
.
showLoading
({
title
:
'加载中'
});
//如果有couponId需要在预览接口传过去
if
(
this
.
data
.
couponId
)
{
params
.
couponId
=
this
.
data
.
couponId
;
}
wxService
.
post
(
`/sale/trade/buyer/preview`
,
params
).
then
(
res
=>
{
if
(
res
)
{
const
{
result
,
data
}
=
res
.
data
if
(
result
==
0
)
{
wx
.
hideLoading
()
let
skuList
=
data
.
tradePreviewSkus
;
let
sum
=
0
skuList
.
forEach
((
item
,
index
)
=>
{
// item.price
sum
+=
skuList
[
index
].
price
*
skuList
[
index
].
count
;
});
this
.
data
.
totalGoodsPrice
=
sum
;
// 初始化商品价格
const
{
isSelect
}
=
this
.
data
if
(
isSelect
)
{
this
.
setData
({
this
.
setData
({
multiIndex
,
selectPrice
:
sum
cityView
,
'params.province'
:
citys
[
0
][
multiIndex
[
0
]],
'params.city'
:
citys
[
1
][
multiIndex
[
1
]],
'params.district'
:
citys
[
2
][
multiIndex
[
2
]]
})
})
}
}
else
{
},
bindMultiPickerColumnChange
(
e
)
{
const
detail
=
e
.
detail
const
index
=
detail
.
value
let
cityName
=
''
let
cityData
=
city
.
default
let
province
=
[]
let
cityList
=
[]
let
district
=
[]
switch
(
detail
.
column
)
{
case
0
:
cityName
=
this
.
data
.
citys
[
0
][
index
]
this
.
data
.
selectCityName
[
0
]
=
cityName
cityData
.
forEach
((
item
)
=>
{
if
(
item
.
value
==
cityName
)
{
item
.
children
.
forEach
((
cityItem
)
=>
{
cityList
.
push
(
cityItem
.
value
)
cityItem
.
children
.
forEach
((
districtItem
)
=>
{
district
.
push
(
districtItem
.
value
)
})
})
}
})
this
.
setData
({
'citys[1]'
:
cityList
,
'citys[2]'
:
district
})
break
case
1
:
cityName
=
this
.
data
.
citys
[
1
][
index
]
this
.
data
.
selectCityName
[
1
]
=
cityName
cityData
.
forEach
((
item
)
=>
{
item
.
children
.
forEach
((
cityItem
)
=>
{
if
(
cityName
==
cityItem
.
value
)
{
cityItem
.
children
.
forEach
((
districtItem
)
=>
{
district
.
push
(
districtItem
.
value
)
})
}
})
})
this
.
setData
({
'citys[2]'
:
[...
district
]
})
break
default
:
break
}
},
//勾选购买vip时
handelChangeSelectVip
()
{
this
.
setData
({
isSelect
:
!
this
.
data
.
isSelect
},
()
=>
{
const
{
isSelect
}
=
this
.
data
this
.
setData
({
this
.
setData
({
checkByPremium
:
isSelect
,
noSelectPrice
:
sum
defalutCoupon
:
0
,
couponId
:
''
,
couponSettingId
:
''
,
defalutCouponId
:
''
},
()
=>
{
this
.
reCallPreview
();
// 获取默认付费会员设置
this
.
getPremiumDefault
()
})
})
});
}
},
//如果没有couponId则认为是第一次进来没有自己选择优惠券
// /premium/getDefault
if
(
!
this
.
data
.
couponId
)
{
getPremiumDefault
()
{
if
(
!
this
.
data
.
useNotUserCoupon
)
{
wx
.
showLoading
({
//获取优惠券信息
title
:
'加载中'
let
defalutCoupon
=
data
&&
data
.
couponDiscountPreviews
.
length
&&
})
data
.
couponDiscountPreviews
[
0
].
couponSettingDTO
.
type
==
1
?
wxService
.
get
(
`/sale/premium/getDefault`
).
then
(
res
=>
{
data
&&
data
.
couponDiscountPreviews
.
length
&&
if
(
res
)
{
data
.
couponDiscountPreviews
[
0
].
couponSettingDTO
.
faceAmount
/
100
:
data
&&
const
{
result
,
data
}
=
res
.
data
data
.
couponDiscountPreviews
.
length
&&
data
.
couponDiscountPreviews
[
0
]
&&
if
(
result
==
0
)
{
data
.
couponDiscountPreviews
[
0
].
couponDiscount
;
wx
.
hideLoading
()
let
defalutCouponId
=
data
&&
data
.
couponDiscountPreviews
.
length
&&
this
.
setData
({
data
.
couponDiscountPreviews
[
0
]
&&
data
.
couponDiscountPreviews
[
0
].
couponDTOS
[
0
]
&&
plusMemberPrice
:
data
.
price
,
data
.
couponDiscountPreviews
[
0
].
couponDTOS
[
0
].
id
||
''
;
plusMemberName
:
data
.
name
let
couponSettingId
=
data
&&
data
.
couponDiscountPreviews
.
length
&&
},
()
=>
{
data
.
couponDiscountPreviews
[
0
]
&&
data
.
couponDiscountPreviews
[
0
].
couponDTOS
[
0
]
&&
// 实付款
data
.
couponDiscountPreviews
[
0
].
couponDTOS
[
0
].
couponSettingId
||
''
;
this
.
setPayPrice
()
data
.
couponDiscountPreviews
=
data
.
couponDiscountPreviews
?
data
.
couponDiscountPreviews
:
[];
})
this
.
data
.
couponDiscountPreviews
=
data
.
couponDiscountPreviews
;
}
// id / couponSettingId
this
.
setData
({
currentOrderList
:
data
,
couponDiscountPreviews
:
this
.
data
.
couponDiscountPreviews
,
defalutCoupon
:
defalutCoupon
,
defalutCouponId
:
defalutCouponId
,
couponSettingId
:
couponSettingId
,
orderInitPrice
:
data
.
amount
,
totalGoodsPrice
:
this
.
data
.
totalGoodsPrice
},
()
=>
{
// 实付款
this
.
setPayPrice
()
})
}
}
})
//用户取消使用优惠券
},
else
{
// 默认地址
this
.
setData
({
selectAddress
()
{
currentOrderList
:
data
,
wxService
.
router
(
'/pages/myAddress/myAddress?isFrom=order'
)
orderInitPrice
:
data
.
amount
,
},
totalGoodsPrice
:
this
.
data
.
totalGoodsPrice
//拼接字段重新调用preview
},
()
=>
{
reCallPreview
()
{
// 实付款
const
{
trolleySku2Buy
,
checkByPremium
,
addressId
,
addressInfo
}
=
this
.
data
this
.
setPayPrice
()
})
let
params
=
{
}
checkByPremium
,
}
else
{
trolleySku2Buy
,
//重新调用之后 不刷新优惠券列表
this
.
setData
({
currentOrderList
:
data
,
defalutCoupon
:
this
.
data
.
defalutCoupon
,
defalutCouponId
:
this
.
data
.
defalutCouponId
,
couponSettingId
:
this
.
data
.
couponSettingId
,
orderInitPrice
:
data
.
amount
,
totalGoodsPrice
:
this
.
data
.
totalGoodsPrice
},
()
=>
{
// 实付款
this
.
setPayPrice
()
})
}
}
}
}
});
},
//跳转购买
handelGobuy
()
{
// 第一项 defalutCouponId couponId/
const
{
isSelect
,
defalutCoupon
,
trolleySku2Buy
,
couponId
,
couponSettingId
,
addressId
,
addressInfo
,
defalutCouponId
,
}
=
this
.
data
;
// 增加门店自提和快递配送判断
let
finCouponName
,
finCouponId
if
(
this
.
data
.
currentType
==
'delivery'
)
{
if
(
!
defalutCoupon
)
{
params
.
addressId
=
addressId
?
addressId
:
addressInfo
.
id
// 微信地址 or 地址id
finCouponName
=
'couponId'
params
.
orderType
=
1
;
finCouponId
=
''
}
}
else
{
else
{
// 当前选中 哪一个id couponSettingId
params
.
orderType
=
4
;
// 默认券存在 id settingId
params
.
storeId
=
this
.
data
.
storeInfo
.
storeId
;
let
currentCouponId
// couponId / 第一项 id
if
(
defalutCouponId
)
{
finCouponId
=
defalutCouponId
finCouponName
=
'couponId'
}
else
{
currentCouponId
=
couponId
?
couponId
:
couponSettingId
finCouponName
=
couponId
?
'couponId'
:
'couponSettingId'
finCouponId
=
currentCouponId
}
}
}
this
.
calPreferentialPrice
(
params
)
// 重新计算优惠价
let
params
=
{
// 获取默认付费会员设置
[
finCouponName
]:
finCouponId
,
this
.
getPremiumDefault
()
// couponId: couponId? couponId : defalutCouponId,
},
trolleySku2Buy
,
// 计算优惠价
buyerRemark
:
this
.
data
.
buyerRemark
,
calPreferentialPrice
(
params
)
{
}
wx
.
showLoading
({
title
:
'加载中'
//判断是快递下单还是自提下单
});
if
(
this
.
data
.
currentType
==
'delivery'
)
{
params
.
orderType
=
1
;
//如果有couponId需要在预览接口传过去
params
.
addressId
=
addressId
?
addressId
:
addressInfo
.
id
// 微信地址 or 地址id
if
(
this
.
data
.
couponId
){
params
.
couponId
=
this
.
data
.
couponId
;
//判断addressId是不是有
if
(
!
params
.
addressId
)
{
wx
.
showToast
({
title
:
'请添加地址或选择地址'
,
icon
:
'none'
})
return
;
}
}
}
else
{
wxService
.
post
(
`/sale/trade/buyer/preview`
,
params
).
then
(
res
=>
{
params
.
orderType
=
4
;
if
(
res
)
{
params
.
storeId
=
this
.
data
.
storeInfo
.
storeId
;
const
{
result
,
data
}
=
res
.
data
params
.
storeCode
=
this
.
data
.
storeInfo
.
storeCode
;
if
(
result
==
0
)
{
params
.
storeName
=
this
.
data
.
storeInfo
.
storeName
;
wx
.
hideLoading
()
if
(
!
params
.
storeId
)
{
let
skuList
=
data
.
tradePreviewSkus
;
wx
.
showToast
({
let
sum
=
0
title
:
'门店自提需要选择门店'
,
skuList
.
forEach
((
item
,
index
)
=>
{
icon
:
'none'
// item.price
})
sum
+=
skuList
[
index
].
price
*
skuList
[
index
].
count
;
return
;
});
}
}
this
.
data
.
totalGoodsPrice
=
sum
;
this
.
getBill
(
params
)
// 下单
// 初始化商品价格
},
const
{
isSelect
}
=
this
.
data
// 下单
getBill
(
params
)
{
let
_this
=
this
;
wx
.
showLoading
({
title
:
'正在下单..'
});
if
(
isSelect
)
{
const
{
this
.
setData
({
isSelect
selectPrice
:
sum
}
=
this
.
data
;
})
//增加订单备注信息
}
else
{
params
.
buyerRemark
=
this
.
data
.
buyerRemark
;
this
.
setData
({
//下单之前先做校验
noSelectPrice
:
sum
this
.
checkOrder
(
params
).
then
(
result
=>
{
})
if
(
result
)
{
}
let
data
=
result
.
data
.
data
?
result
.
data
.
data
:
[];
//如果没有couponId则认为是第一次进来没有自己选择优惠券
if
(
data
.
length
==
0
)
{
if
(
!
this
.
data
.
couponId
)
{
this
.
order
(
isSelect
,
params
);
if
(
!
this
.
data
.
useNotUserCoupon
){
}
else
{
//获取优惠券信息
//有商品限购了,组织提示语
let
defalutCoupon
=
data
&&
data
.
couponDiscountPreviews
.
length
&&
let
tips
=
'根据限购规则以下商品限购:
\
r
\
n'
;
data
.
couponDiscountPreviews
[
0
].
couponSettingDTO
.
type
==
1
?
let
tempObj
=
data
[
0
];
data
&&
data
.
couponDiscountPreviews
.
length
&&
//每人限购
data
.
couponDiscountPreviews
[
0
].
couponSettingDTO
.
faceAmount
/
100
:
data
&&
if
(
tempObj
.
limitType
==
1
)
{
data
.
couponDiscountPreviews
.
length
&&
data
.
couponDiscountPreviews
[
0
]
&&
tips
=
`商品"
${
tempObj
.
productName
}
"每人限购
${
tempObj
.
limitNum
}
件`
;
data
.
couponDiscountPreviews
[
0
].
couponDiscount
;
}
let
defalutCouponId
=
data
&&
data
.
couponDiscountPreviews
.
length
&&
//每次限购
data
.
couponDiscountPreviews
[
0
]
&&
data
.
couponDiscountPreviews
[
0
].
couponDTOS
[
0
]
&&
else
if
(
tempObj
.
limitType
==
2
)
{
data
.
couponDiscountPreviews
[
0
].
couponDTOS
[
0
].
id
||
''
;
tips
=
`商品"
${
tempObj
.
productName
}
"每次限购
${
tempObj
.
limitNum
}
件`
;
let
couponSettingId
=
data
&&
data
.
couponDiscountPreviews
.
length
&&
data
.
couponDiscountPreviews
[
0
]
&&
data
.
couponDiscountPreviews
[
0
].
couponDTOS
[
0
]
&&
data
.
couponDiscountPreviews
[
0
].
couponDTOS
[
0
].
couponSettingId
||
''
;
data
.
couponDiscountPreviews
=
data
.
couponDiscountPreviews
?
data
.
couponDiscountPreviews
:
[];
this
.
data
.
couponDiscountPreviews
=
data
.
couponDiscountPreviews
;
// id / couponSettingId
this
.
setData
({
currentOrderList
:
data
,
couponDiscountPreviews
:
this
.
data
.
couponDiscountPreviews
,
defalutCoupon
:
defalutCoupon
,
defalutCouponId
:
defalutCouponId
,
couponSettingId
:
couponSettingId
,
orderInitPrice
:
data
.
amount
,
totalGoodsPrice
:
this
.
data
.
totalGoodsPrice
},
()
=>
{
// 实付款
this
.
setPayPrice
()
})
}
//用户取消使用优惠券
else
{
this
.
setData
({
currentOrderList
:
data
,
orderInitPrice
:
data
.
amount
,
totalGoodsPrice
:
this
.
data
.
totalGoodsPrice
},
()
=>
{
// 实付款
this
.
setPayPrice
()
})
}
}
else
{
//重新调用之后 不刷新优惠券列表
this
.
setData
({
currentOrderList
:
data
,
defalutCoupon
:
this
.
data
.
defalutCoupon
,
defalutCouponId
:
this
.
data
.
defalutCouponId
,
couponSettingId
:
this
.
data
.
couponSettingId
,
orderInitPrice
:
data
.
amount
,
totalGoodsPrice
:
this
.
data
.
totalGoodsPrice
},
()
=>
{
// 实付款
this
.
setPayPrice
()
})
}
}
}
}
});
},
//跳转购买
handelGobuy
()
{
// 第一项 defalutCouponId couponId/
const
{
isSelect
,
defalutCoupon
,
trolleySku2Buy
,
couponId
,
couponSettingId
,
addressId
,
addressInfo
,
defalutCouponId
,
}
=
this
.
data
;
let
finCouponName
,
finCouponId
wx
.
showModal
({
if
(
!
defalutCoupon
)
{
title
:
'商品限购提醒'
,
finCouponName
=
'couponId'
content
:
tips
,
finCouponId
=
''
confirmText
:
'好的'
,
}
else
{
confirmColor
:
'#cb3c3c'
,
// 当前选中 哪一个id couponSettingId
showCancel
:
false
,
// 默认券存在 id settingId
success
(
confirm
)
{
let
currentCouponId
// couponId / 第一项 id
if
(
confirm
.
confirm
)
{
if
(
defalutCouponId
)
{
wx
.
navigateBack
({
finCouponId
=
defalutCouponId
delta
:
1
finCouponName
=
'couponId'
});
}
else
{
}
currentCouponId
=
couponId
?
couponId
:
couponSettingId
},
finCouponName
=
couponId
?
'couponId'
:
'couponSettingId'
})
finCouponId
=
currentCouponId
}
}
}
}
});
},
//下单
order
(
isSelect
,
params
)
{
if
(
this
.
data
.
orderStoreInfo
)
{
if
(
this
.
data
.
orderStoreInfo
.
storeId
)
{
params
.
storeId
=
this
.
data
.
orderStoreInfo
.
storeId
;
}
if
(
this
.
data
.
orderStoreInfo
.
storeInfo
)
{
params
.
storeInfo
=
this
.
data
.
orderStoreInfo
.
storeInfo
;
}
}
let
params
=
{
let
_this
=
this
;
[
finCouponName
]:
finCouponId
,
let
url
=
isSelect
?
'/sale/payment/merged/buyer/bill'
:
'/sale/trade/buyer/bill'
// couponId: couponId? couponId : defalutCouponId,
wxService
.
post
(
`
${
url
}
`
,
params
).
then
(
res
=>
{
trolleySku2Buy
,
if
(
res
)
{
buyerRemark
:
this
.
data
.
buyerRemark
,
const
{
}
result
,
data
}
=
res
.
data
let
tradeId
=
data
.
tradeId
;
wx
.
removeStorageSync
(
'choosedStoreInfo'
);
wx
.
removeStorageSync
(
'orderRemark'
);
if
(
result
==
0
)
{
delete
data
.
appId
let
amount
=
data
.
amount
||
0
;
if
(
amount
>
0
)
{
wx
.
requestPayment
(
Object
.
assign
({
success
(
res
)
{
wx
.
hideLoading
()
//消息订阅
let
baseUserInfo
=
wx
.
getStorageSync
(
'_baseUserInfo'
);
wxService
.
post
(
`
${
'/merchant/message/wxSubMsgMapping/getListByParams'
}
`
,
{
scenarioIds
:
[
'ordersend'
,
'orderconfirm'
],
sourceFrom
:
2
,
switchType
:
3
}).
then
(
res
=>
{
let
tempArr
=
res
.
data
.
data
?
res
.
data
.
data
:
[];
let
currentType
=
_this
.
data
.
currentType
;
if
(
tempArr
.
length
==
0
)
{
wx
.
redirectTo
({
url
:
`/subPackage/page/pages/paymentStatus/paymentStatus?status=S&amount=
${
amount
}
&type=
${
currentType
}
`
,
});
return
;
}
//判断是快递下单还是自提下单
let
tempids
=
[];
if
(
this
.
data
.
currentType
==
'delivery'
)
{
tempArr
.
map
(
item
=>
{
params
.
orderType
=
1
;
tempids
.
push
(
item
.
templateId
)
;
params
.
addressId
=
addressId
?
addressId
:
addressInfo
.
id
// 微信地址 or 地址id
});
//判断addressId是不是有
wx
.
requestSubscribeMessage
({
if
(
!
params
.
addressId
)
{
tmplIds
:
tempids
,
wx
.
showToast
({
success
:
(
res
)
=>
{
title
:
'请添加地址或选择地址'
,
for
(
let
i
=
0
;
i
<
tempArr
.
length
;
i
++
)
{
icon
:
'none'
wxService
.
post
(
`
${
'/merchant/message/wxSubMsgSubscride/member/subscribe'
}
`
,
{
businessId
:
tradeId
,
memberId
:
baseUserInfo
.
memberId
,
scenarioId
:
tempArr
[
i
].
scenarioId
,
templateId
:
tempArr
[
i
].
templateId
}).
then
(
resp
=>
{});
}
},
complete
:
(
res
)
=>
{
wx
.
redirectTo
({
url
:
`/subPackage/page/pages/paymentStatus/paymentStatus?status=S&amount=
${
amount
}
&type=
${
currentType
}
`
,
});
}
})
}).
catch
(
err
=>
{
let
currentType
=
_this
.
data
.
currentType
;
wx
.
redirectTo
({
url
:
`/subPackage/page/pages/paymentStatus/paymentStatus?status=S&amount=
${
amount
}
&type=
${
currentType
}
`
,
});
})
})
return
;
},
}
fail
(
res
)
{
}
wx
.
hideLoading
();
else
{
params
.
orderType
=
4
;
params
.
storeId
=
this
.
data
.
storeInfo
.
storeId
;
params
.
storeCode
=
this
.
data
.
storeInfo
.
storeCode
;
params
.
storeName
=
this
.
data
.
storeInfo
.
storeName
;
if
(
!
params
.
storeId
)
{
wx
.
showToast
({
wx
.
showToast
({
title
:
'门店自提需要选择门店'
,
title
:
'支付已取消'
,
icon
:
'none'
icon
:
'none'
})
});
return
;
if
(
_this
.
data
.
currentType
==
'delivery'
)
{
}
wx
.
redirectTo
({
}
url
:
'/pages/order/order'
,
});
this
.
getBill
(
params
)
// 下单
}
else
{
},
wx
.
redirectTo
({
// 下单
url
:
'/subPackage/page/pages/selfPickUpOrderList/selfPickUpOrderList'
,
getBill
(
params
)
{
});
let
_this
=
this
;
wx
.
showLoading
({
title
:
'正在下单..'
});
const
{
isSelect
}
=
this
.
data
;
//增加订单备注信息
params
.
buyerRemark
=
this
.
data
.
buyerRemark
;
//下单之前先做校验
this
.
checkOrder
(
params
).
then
(
result
=>
{
if
(
result
)
{
let
data
=
result
.
data
.
data
?
result
.
data
.
data
:
[];
if
(
data
.
length
==
0
)
{
this
.
order
(
isSelect
,
params
);
}
else
{
//有商品限购了,组织提示语
let
tips
=
'根据限购规则以下商品限购:
\
r
\
n'
;
let
tempObj
=
data
[
0
];
//每人限购
if
(
tempObj
.
limitType
==
1
)
{
tips
=
`商品"
${
tempObj
.
productName
}
"每人限购
${
tempObj
.
limitNum
}
件`
;
}
//每次限购
else
if
(
tempObj
.
limitType
==
2
)
{
tips
=
`商品"
${
tempObj
.
productName
}
"每次限购
${
tempObj
.
limitNum
}
件`
;
}
wx
.
showModal
({
title
:
'商品限购提醒'
,
content
:
tips
,
confirmText
:
'好的'
,
confirmColor
:
'#cb3c3c'
,
showCancel
:
false
,
success
(
confirm
)
{
if
(
confirm
.
confirm
)
{
wx
.
navigateBack
({
delta
:
1
});
}
},
})
}
}
}
},
data
.
wxParams
));
}
else
{
if
(
_this
.
data
.
currentType
==
'delivery'
)
{
wx
.
redirectTo
({
url
:
'/pages/order/order'
,
});
}
else
{
wx
.
redirectTo
({
url
:
'/subPackage/page/pages/selfPickUpOrderList/selfPickUpOrderList'
,
});
}
}
});
}
},
//下单
order
(
isSelect
,
params
)
{
if
(
this
.
data
.
orderStoreInfo
)
{
if
(
this
.
data
.
orderStoreInfo
.
storeId
)
{
params
.
storeId
=
this
.
data
.
orderStoreInfo
.
storeId
;
}
if
(
this
.
data
.
orderStoreInfo
.
storeInfo
)
{
params
.
storeInfo
=
this
.
data
.
orderStoreInfo
.
storeInfo
;
}
}
}
}
});
},
//校验订单中商品限购情况
checkOrder
(
params
)
{
return
wxService
.
post
(
`/sale/trade/buyer/bill/before/check`
,
params
);
},
// 获取地址列表
getAddressList
()
{
const
{
memberId
}
=
wx
.
getStorageSync
(
'_baseUserInfo'
);
const
{
trolleySku2Buy
,
checkByPremium
}
=
this
.
data
;
let
params
=
{
checkByPremium
,
trolleySku2Buy
};
params
.
orderType
=
1
;
let
_this
=
this
;
wxService
.
post
(
`/member/addressManage/getall`
,
{
let
url
=
isSelect
?
'/sale/payment/merged/buyer/bill'
:
'/sale/trade/buyer/bill'
userId
:
memberId
wxService
.
post
(
`
${
url
}
`
,
params
).
then
(
res
=>
{
}).
then
(
res
=>
{
if
(
res
)
{
if
(
!
res
)
return
false
;
const
{
result
,
data
}
=
res
.
data
let
hasDefalut
=
wx
.
getStorageSync
(
'_defalutAddress'
);
let
tradeId
=
data
.
tradeId
;
let
{
wx
.
removeStorageSync
(
'choosedStoreInfo'
);
result
,
wx
.
removeStorageSync
(
'orderRemark'
);
data
if
(
result
==
0
)
{
}
=
res
.
data
delete
data
.
appId
if
(
result
==
0
)
{
let
amount
=
data
.
amount
||
0
;
//看看本地是不是有已经选择的地址了
if
(
amount
>
0
){
if
(
!
hasDefalut
)
{
// 无
wx
.
requestPayment
(
Object
.
assign
({
//看一下地址列表中是不是有默认地址
success
(
res
)
{
let
defaultInAddressList
=
null
;
wx
.
hideLoading
()
data
=
data
?
data
:
[];
//消息订阅
data
.
forEach
(
item
=>
{
let
baseUserInfo
=
wx
.
getStorageSync
(
'_baseUserInfo'
);
item
.
fullArea
=
item
.
province
+
' '
+
item
.
city
+
' '
+
item
.
district
wxService
.
post
(
`
${
'/merchant/message/wxSubMsgMapping/getListByParams'
}
`
,
{
if
(
item
.
type
==
1
)
{
scenarioIds
:
[
'ordersend'
,
'orderconfirm'
],
defaultInAddressList
=
item
sourceFrom
:
2
,
switchType
:
3
}).
then
(
res
=>
{
let
tempArr
=
res
.
data
.
data
?
res
.
data
.
data
:
[];
let
currentType
=
_this
.
data
.
currentType
;
if
(
tempArr
.
length
==
0
){
wx
.
redirectTo
({
url
:
`/subPackage/page/pages/paymentStatus/paymentStatus?status=S&amount=
${
amount
}
&type=
${
currentType
}
`
,
});
return
;
}
let
tempids
=
[];
tempArr
.
map
(
item
=>
{
tempids
.
push
(
item
.
templateId
);
});
wx
.
requestSubscribeMessage
({
tmplIds
:
tempids
,
success
:
(
res
)
=>
{
for
(
let
i
=
0
;
i
<
tempArr
.
length
;
i
++
){
wxService
.
post
(
`
${
'/merchant/message/wxSubMsgSubscride/member/subscribe'
}
`
,
{
businessId
:
tradeId
,
memberId
:
baseUserInfo
.
memberId
,
scenarioId
:
tempArr
[
i
].
scenarioId
,
templateId
:
tempArr
[
i
].
templateId
}).
then
(
resp
=>
{});
}
},
complete
:
(
res
)
=>
{
wx
.
redirectTo
({
url
:
`/subPackage/page/pages/paymentStatus/paymentStatus?status=S&amount=
${
amount
}
&type=
${
currentType
}
`
,
});
}
})
}).
catch
(
err
=>
{
let
currentType
=
_this
.
data
.
currentType
;
wx
.
redirectTo
({
url
:
`/subPackage/page/pages/paymentStatus/paymentStatus?status=S&amount=
${
amount
}
&type=
${
currentType
}
`
,
});
})
},
fail
(
res
)
{
wx
.
hideLoading
();
wx
.
showToast
({
title
:
'支付已取消'
,
icon
:
'none'
});
if
(
_this
.
data
.
currentType
==
'delivery'
)
{
wx
.
redirectTo
({
url
:
'/pages/order/order'
,
});
}
else
{
wx
.
redirectTo
({
url
:
'/subPackage/page/pages/selfPickUpOrderList/selfPickUpOrderList'
,
});
}
}
},
data
.
wxParams
));
}
else
{
if
(
_this
.
data
.
currentType
==
'delivery'
)
{
wx
.
redirectTo
({
url
:
'/pages/order/order'
,
});
}
else
{
wx
.
redirectTo
({
url
:
'/subPackage/page/pages/selfPickUpOrderList/selfPickUpOrderList'
,
});
}
}
}
}
}
});
});
},
//校验订单中商品限购情况
checkOrder
(
params
)
{
return
wxService
.
post
(
`/sale/trade/buyer/bill/before/check`
,
params
);
},
// 获取地址列表
getAddressList
()
{
const
{
memberId
}
=
wx
.
getStorageSync
(
'_baseUserInfo'
);
const
{
trolleySku2Buy
,
checkByPremium
}
=
this
.
data
;
let
params
=
{
checkByPremium
,
trolleySku2Buy
};
params
.
orderType
=
1
;
wxService
.
post
(
`/member/addressManage/getall`
,
{
userId
:
memberId
}).
then
(
res
=>
{
if
(
!
res
)
return
false
;
let
hasDefalut
=
wx
.
getStorageSync
(
'_defalutAddress'
);
let
{
result
,
data
}
=
res
.
data
if
(
result
==
0
)
{
//看看本地是不是有已经选择的地址了
if
(
!
hasDefalut
)
{
// 无
//看一下地址列表中是不是有默认地址
let
defaultInAddressList
=
null
;
data
=
data
?
data
:
[];
data
.
forEach
(
item
=>
{
item
.
fullArea
=
item
.
province
+
' '
+
item
.
city
+
' '
+
item
.
district
if
(
item
.
type
==
1
)
{
defaultInAddressList
=
item
}
});
if
(
defaultInAddressList
)
{
if
(
defaultInAddressList
)
{
this
.
data
.
addressId
=
defaultInAddressList
?
defaultInAddressList
.
id
:
''
;
this
.
data
.
addressId
=
defaultInAddressList
?
defaultInAddressList
.
id
:
''
;
this
.
data
.
addressInfo
=
defaultInAddressList
;
this
.
data
.
addressInfo
=
defaultInAddressList
;
params
.
addressId
=
this
.
data
.
addressId
;
params
.
addressId
=
this
.
data
.
addressId
;
}
}
this
.
setData
({
this
.
setData
({
addressInfo
:
this
.
data
.
addressInfo
,
addressInfo
:
this
.
data
.
addressInfo
,
addressId
:
this
.
data
.
addressId
,
addressId
:
this
.
data
.
addressId
,
goodsAddress
:
params
.
addressId
?
false
:
true
,
goodsAddress
:
params
.
addressId
?
false
:
true
,
});
});
}
}
else
{
// 有已经选择的地址了
else
{
// 有已经选择的地址了
let
defaultInAddressList
=
null
;
let
defaultInAddressList
=
null
;
//判断地址列表中是不是已经把这个地址删除了
//判断地址列表中是不是已经把这个地址删除了
let
id
=
hasDefalut
.
id
;
let
id
=
hasDefalut
.
id
;
let
filterArr
=
data
.
filter
(
item
=>
item
.
id
==
id
);
let
filterArr
=
data
.
filter
(
item
=>
item
.
id
==
id
);
if
(
filterArr
.
length
>
0
)
{
if
(
filterArr
.
length
>
0
)
{
defaultInAddressList
=
hasDefalut
defaultInAddressList
=
hasDefalut
}
else
{
// 无
}
//此时已经没有 看看是不是有默认地址 有则默认选中
else
{
// 无
data
=
data
?
data
:
[];
//此时已经没有 看看是不是有默认地址 有则默认选中
data
.
forEach
(
item
=>
{
data
=
data
?
data
:
[];
item
.
fullArea
=
item
.
province
+
' '
+
item
.
city
+
' '
+
item
.
district
data
.
forEach
(
item
=>
{
if
(
item
.
type
==
1
)
{
item
.
fullArea
=
item
.
province
+
' '
+
item
.
city
+
' '
+
item
.
district
defaultInAddressList
=
item
if
(
item
.
type
==
1
)
{
}
defaultInAddressList
=
item
});
}
}
});
}
if
(
defaultInAddressList
)
{
if
(
defaultInAddressList
)
{
this
.
data
.
addressId
=
defaultInAddressList
?
defaultInAddressList
.
id
:
''
;
this
.
data
.
addressId
=
defaultInAddressList
?
defaultInAddressList
.
id
:
''
;
this
.
data
.
addressInfo
=
defaultInAddressList
;
this
.
data
.
addressInfo
=
defaultInAddressList
;
params
.
addressId
=
this
.
data
.
addressId
;
params
.
addressId
=
this
.
data
.
addressId
;
}
}
this
.
setData
({
this
.
setData
({
addressInfo
:
this
.
data
.
addressInfo
,
addressInfo
:
this
.
data
.
addressInfo
,
addressId
:
this
.
data
.
addressId
,
addressId
:
this
.
data
.
addressId
,
goodsAddress
:
params
.
addressId
?
false
:
true
,
goodsAddress
:
params
.
addressId
?
false
:
true
,
});
});
}
}
//校验当前选择的地址是否还有效 (判断是否是老地址,如果是的话 弹出提示,让用户去修改地址)
//校验当前选择的地址是否还有效 (判断是否是老地址,如果是的话 弹出提示,让用户去修改地址)
//校验地址库
//校验地址库
this
.
validateAddress
();
this
.
validateAddress
();
this
.
calPreferentialPrice
(
params
)
this
.
calPreferentialPrice
(
params
)
}
}
}).
finally
(()
=>
{
});
}).
finally
(()
=>
{});
},
},
//获取微信地址
//获取微信地址
chooseWxAddress
()
{
chooseWxAddress
()
{
const
{
memberId
}
=
wx
.
getStorageSync
(
'_baseUserInfo'
)
const
{
wx
.
chooseAddress
({
memberId
success
:
(
res
)
=>
{
}
=
wx
.
getStorageSync
(
'_baseUserInfo'
)
res
.
name
=
res
.
userName
wx
.
chooseAddress
({
res
.
phone
=
res
.
telNumber
success
:
(
res
)
=>
{
res
.
fullArea
=
res
.
provinceName
+
res
.
cityName
+
res
.
countyName
res
.
name
=
res
.
userName
res
.
address
=
res
.
detailInfo
;
res
.
phone
=
res
.
telNumber
res
.
city
=
res
.
cityName
;
res
.
fullArea
=
res
.
provinceName
+
res
.
cityName
+
res
.
countyName
res
.
district
=
res
.
countyName
;
res
.
address
=
res
.
detailInfo
;
res
.
province
=
res
.
provinceName
;
res
.
city
=
res
.
cityName
;
this
.
setData
({
res
.
district
=
res
.
countyName
;
goodsAddress
:
false
,
res
.
province
=
res
.
provinceName
;
wxAddress
:
true
,
this
.
setData
({
addressInfo
:
res
,
goodsAddress
:
false
,
params
:
{
wxAddress
:
true
,
userId
:
memberId
,
addressInfo
:
res
,
name
:
res
.
userName
,
params
:
{
phone
:
res
.
telNumber
,
userId
:
memberId
,
province
:
res
.
provinceName
,
name
:
res
.
userName
,
city
:
res
.
cityName
,
phone
:
res
.
telNumber
,
district
:
res
.
countyName
,
province
:
res
.
provinceName
,
address
:
res
.
detailInfo
,
city
:
res
.
cityName
,
type
:
0
district
:
res
.
countyName
,
}
address
:
res
.
detailInfo
,
});
type
:
0
}
});
wxService
.
post
(
`/member/addressManage/save`
,
this
.
data
.
params
).
then
(
res
=>
{
wxService
.
post
(
`/member/addressManage/save`
,
this
.
data
.
params
).
then
(
res
=>
{
const
{
result
,
data
}
=
res
.
data
const
{
if
(
result
==
0
)
{
result
,
wx
.
hideLoading
();
data
this
.
data
.
addressInfo
.
fullArea
=
this
.
data
.
addressInfo
.
provinceName
+
' '
+
}
=
res
.
data
this
.
data
.
addressInfo
.
cityName
+
' '
+
this
.
data
.
addressInfo
.
countyName
if
(
result
==
0
)
{
this
.
data
.
addressInfo
.
id
=
data
;
wx
.
hideLoading
();
wx
.
setStorageSync
(
'_defalutAddress'
,
this
.
data
.
addressInfo
)
this
.
data
.
addressInfo
.
fullArea
=
this
.
data
.
addressInfo
.
provinceName
+
' '
+
this
.
data
.
addressInfo
.
cityName
+
' '
+
this
.
data
.
addressInfo
.
countyName
this
.
data
.
addressInfo
.
id
=
data
;
wx
.
setStorageSync
(
'_defalutAddress'
,
this
.
data
.
addressInfo
)
this
.
setData
({
this
.
setData
({
addressId
:
data
,
addressId
:
data
,
goodsAddress
:
true
,
goodsAddress
:
true
,
},
()
=>
{
},
()
=>
{
this
.
getAddressList
();
this
.
getAddressList
();
})
})
}
}
}).
finally
(()
=>
{
}).
finally
(()
=>
{
wx
.
hideLoading
()
wx
.
hideLoading
()
})
},
fail
:
function
(
err
)
{
console
.
log
(
err
)
}
})
})
},
},
fail
:
function
(
err
)
{
console
.
log
(
err
)
}
})
},
//选择优惠券
//选择优惠券
selectCoupon
()
{
selectCoupon
()
{
this
.
setData
({
this
.
setData
({
showSelectCoupon
:
true
showSelectCoupon
:
true
})
})
},
},
//校验地址库 原因是地址库发生过改变 老用户之前维护过地址 但是地址可能对不上影响邮费 若发现地址不对这里强制提示用户去更新
//校验地址库 原因是地址库发生过改变 老用户之前维护过地址 但是地址可能对不上影响邮费 若发现地址不对这里强制提示用户去更新
validateAddress
(){
validateAddress
()
{
if
(
this
.
data
.
addressId
){
if
(
this
.
data
.
addressId
)
{
let
province
=
this
.
data
.
addressInfo
.
province
,
let
province
=
this
.
data
.
addressInfo
.
province
,
cityName
=
this
.
data
.
addressInfo
.
city
,
cityName
=
this
.
data
.
addressInfo
.
city
,
district
=
this
.
data
.
addressInfo
.
district
;
district
=
this
.
data
.
addressInfo
.
district
;
let
defaultCities
=
city
.
default
;
let
defaultCities
=
city
.
default
;
//先处理省份
//先处理省份
let
filterProvince
=
defaultCities
.
filter
(
item
=>
item
.
value
==
province
);
let
filterProvince
=
defaultCities
.
filter
(
item
=>
item
.
value
==
province
);
if
(
filterProvince
.
length
==
0
){
if
(
filterProvince
.
length
==
0
)
{
//省份地址维护不对 提示用户去改
//省份地址维护不对 提示用户去改
this
.
showEditAddressModal
(
this
.
data
.
addressId
);
}
else
{
//檢查市
let
filterCity
=
filterProvince
[
0
].
children
.
filter
(
item
=>
item
.
value
==
cityName
);
if
(
filterCity
.
length
==
0
)
{
//市维护的地址不对 提示用户去修改
this
.
showEditAddressModal
(
this
.
data
.
addressId
);
this
.
showEditAddressModal
(
this
.
data
.
addressId
);
}
}
else
{
else
{
//检查区是否正确
//檢查市
let
filterDistinct
=
filterCity
[
0
].
children
.
filter
(
item
=>
item
.
value
==
district
);
let
filterCity
=
filterProvince
[
0
].
children
.
filter
(
item
=>
item
.
value
==
cityName
);
if
(
filterDistinct
.
length
==
0
)
{
if
(
filterCity
.
length
==
0
){
//区维护的地址不对 提示用户去修改
//市维护的地址不对 提示用户去修改
this
.
showEditAddressModal
(
this
.
data
.
addressId
);
this
.
showEditAddressModal
(
this
.
data
.
addressId
);
}
}
else
{
//检查区是否正确
let
filterDistinct
=
filterCity
[
0
].
children
.
filter
(
item
=>
item
.
value
==
district
);
if
(
filterDistinct
.
length
==
0
){
//区维护的地址不对 提示用户去修改
this
.
showEditAddressModal
(
this
.
data
.
addressId
);
}
}
}
}
}
}
}
,
}
//展示地址修改弹框
},
showEditAddressModal
(
addressId
){
//展示地址修改弹框
wx
.
showModal
(
{
showEditAddressModal
(
addressId
)
{
title
:
'地址更改提示'
,
wx
.
showModal
({
content
:
`您好,因地址库的修改,您当前的收货地址需要重新编辑才可下单,请先编辑此地址。感谢您的配合~`
,
title
:
'地址更改提示'
,
showCancel
:
false
,
content
:
`您好,因地址库的修改,您当前的收货地址需要重新编辑才可下单,请先编辑此地址。感谢您的配合~`
,
confirmText
:
'去更改'
,
showCancel
:
false
,
confirmColor
:
'#cb3c3c
'
,
confirmText
:
'去更改
'
,
success
(
res
)
{
confirmColor
:
'#cb3c3c'
,
if
(
res
.
confirm
)
{
success
(
res
)
{
wxService
.
router
(
`/pages/addAddress/addAddress?id=
${
addressId
}
&from=order`
)
if
(
res
.
confirm
)
{
}
wxService
.
router
(
`/pages/addAddress/addAddress?id=
${
addressId
}
&from=order`
)
}
}
})
}
},
})
},
});
});
\ No newline at end of file
src/pages/confirmOrder/confirmOrder.wxml
View file @
4d84cc0b
...
@@ -4,82 +4,54 @@
...
@@ -4,82 +4,54 @@
<view class="page-confirm-order">
<view class="page-confirm-order">
<!-- 选择方式 -->
<!-- 选择方式 -->
<view class="deliveryType" wx:if="{{isOpenSelfMention}}">
<view class="deliveryType" wx:if="{{isOpenSelfMention}}">
<view class="de-type-item {{currentType == 'delivery' ? 'active' : ''}}"
<view class="de-type-item {{currentType == 'delivery' ? 'active' : ''}}" data-type="delivery" bindtap="onTapChangeType">快递配送</view>
data-type="delivery" bindtap="onTapChangeType">快递配送</view>
<view class="de-type-item {{currentType == 'selfPickUp' ? 'active' : ''}}" data-type="selfPickUp" bindtap="onTapChangeType">门店自提</view>
<view class="de-type-item {{currentType == 'selfPickUp' ? 'active' : ''}}"
data-type="selfPickUp" bindtap="onTapChangeType">门店自提</view>
</view>
</view>
<form>
<form>
<!-- 快递地址 -->
<!-- 快递地址 -->
<view class="address-wrap" wx:if="{{currentType == 'delivery'}}">
<view class="address-wrap" wx:if="{{currentType == 'delivery'}}">
<block wx:if="{{goodsAddress}}">
<block wx:if="{{goodsAddress}}">
<view class="address-section">
<view class="address-section">
<input class="address-input" name="name"
<input class="address-input" name="name" data-name="name" value='{{uAddress.name}}' bindinput='onInput' placeholder="请输入收货人姓名" />
data-name="name" value='{{uAddress.name}}'
<input class="address-input" name="phone" data-name="phone" bindinput='onInput' value='{{uAddress.phone}}' placeholder="请输入手机号码" />
bindinput='onInput'
</view>
placeholder="请输入收货人姓名" />
<view class="address-section">
<input class="address-input" name="phone"
<picker class="address-input address-picker" mode="multiSelector" bindchange="bindMultiPickerChange" bindcolumnchange="bindMultiPickerColumnChange" value="{{multiIndex}}" range="{{citys}}">
data-name="phone"
<view class="form-picker" style="padding-top: 8rpx;" wx:if="{{cityView}}">
bindinput='onInput'
{{cityView}}
value='{{uAddress.phone}}'
</view>
placeholder="请输入手机号码" />
<view wx:if="{{!cityView}}">
</view>
<input class='form-input' placeholder-class="placeholder-picker" style="padding-top: 8rpx;" type="text" disabled placeholder="所在区域" />
<view class="address-section">
</view>
<picker
</picker>
class="address-input address-picker"
</view>
mode="multiSelector"
<view class="address-section">
bindchange="bindMultiPickerChange"
<input class="address-input address-detail" name="address" bindinput='onInput' data-name="address" value='{{uAddress.address}}' placeholder="请输入路名门牌号" />
bindcolumnchange="bindMultiPickerColumnChange"
</view>
value="{{multiIndex}}"
</block>
range="{{citys}}"
<block wx:if="{{!goodsAddress}}">
>
<view class="address-list" bindtap="selectAddress">
<view class="form-picker" style="padding-top: 8rpx;" wx:if="{{cityView}}">
<view class="address-info">
{{cityView}}
<view>
</view>
<image class="defalut-add-img" src="{{addressInfo.type == 1 ? 'https://img3.bigaka.com/prd/3001/202003/20200309/3001f7a6186d-6882-422c-a77c-61b8291c091a.png' : 'https://img3.bigaka.com/prd/3001/202003/20200309/300129705d0a-bf5c-4b2f-aedd-0c3fc9f78ba1.png'}}"
<view wx:if="{{!cityView}}">
/>
<input
<text class="user-name">{{addressInfo.name}}</text>
class='form-input'
<text class="phone-number">{{addressInfo.phone}}</text>
placeholder-class="placeholder-picker"
</view>
style="padding-top: 8rpx;"
<view class="address-list-detail">
type="text"
{{addressInfo.fullArea}} {{addressInfo.address}}
disabled
</view>
placeholder="所在区域"
<view class="arrow-right-wrap">
/>
<image class="arrow-right" src="/assets/imgs/7_1_0/arrow-right.png" />
</view>
</view>
</picker>
</view>
</view>
</view>
<view class="address-section">
</block>
<input class="address-input address-detail"
<view class="wx-address" bindtap="chooseWxAddress" wx:if="{{canUseWechatAddress}}">
name="address"
+ 使用微信地址
bindinput='onInput'
</view>
data-name="address"
</view>
value='{{uAddress.address}}'
placeholder="请输入路名门牌号" />
</view>
</block>
<block wx:if="{{!goodsAddress}}">
<view class="address-list" bindtap="selectAddress">
<view class="address-info">
<view>
<image class="defalut-add-img"
src="{{addressInfo.type == 1 ? 'https://img3.bigaka.com/prd/3001/202003/20200309/3001f7a6186d-6882-422c-a77c-61b8291c091a.png' : 'https://img3.bigaka.com/prd/3001/202003/20200309/300129705d0a-bf5c-4b2f-aedd-0c3fc9f78ba1.png'}}" />
<text class="user-name">{{addressInfo.name}}</text>
<text class="phone-number">{{addressInfo.phone}}</text>
</view>
<view class="address-list-detail">
{{addressInfo.fullArea}} {{addressInfo.address}}
</view>
<view class="arrow-right-wrap">
<image class="arrow-right" src="/assets/imgs/7_1_0/arrow-right.png" />
</view>
</view>
</view>
</block>
<view class="wx-address" bindtap="chooseWxAddress" wx:if="{{canUseWechatAddress}}">
+ 使用微信地址
</view>
</view>
<!-- 自提门店地址 -->
<!-- 自提门店地址 -->
<view class="pick-up" wx:if="{{currentType == 'selfPickUp'}}">
<view class="pick-up" wx:if="{{currentType == 'selfPickUp'}}">
<!-- <view class="address-title">提货地址</view> -->
<!-- <view class="address-title">提货地址</view> -->
...
@@ -102,104 +74,104 @@
...
@@ -102,104 +74,104 @@
</view>
</view>
</view>
</view>
<view class="address-line">
<view class="address-line">
<image src="/assets/imgs/7_1_0/address-line.png" />
<image src="/assets/imgs/7_1_0/address-line.png" />
</view>
</view>
<!-- 分割线 -->
<!-- 分割线 -->
<view class="gray-line" />
<view class="gray-line" />
<!-- 商品列表 -->
<!-- 商品列表 -->
<view class="pro-wrap">
<view class="pro-wrap">
<block wx:for="{{currentOrderList.tradePreviewSkus}}" wx:key="*this">
<block wx:for="{{currentOrderList.tradePreviewSkus}}" wx:key="*this">
<view class="pro-list">
<view class="pro-list">
<image class="pro-img" src="{{item.skuImgUrl}}" />
<image class="pro-img" src="{{item.skuImgUrl}}" />
<view class="pro-info">
<view class="pro-info">
<view class="pro-name">{{item.productName}}</view>
<view class="pro-name">{{item.productName}}</view>
<view class="pro-desc">
<view class="pro-desc">
规格 {{item.skuSpec}}
规格 {{item.skuSpec}}
</view>
</view>
<view class="pro-price">
<view class="pro-price">
<text class="price">¥{{item.price}}</text>
<text class="price">¥{{item.price}}</text>
<text class="number">x {{item.count}}</text>
<text class="number">x {{item.count}}</text>
</view>
</view>
</view>
</view>
</view>
</view>
</block>
</block>
</view>
</view>
<!-- 分割线 -->
<!-- 分割线 -->
<view class="gray-line" />
<view class="gray-line" />
<!-- 商品合计 -->
<!-- 商品合计 -->
<view class="pro-sum">
<view class="pro-sum">
<view class="vip-info" wx:if="{{!isVip && plusIsOpen}}">
<view class="vip-info" wx:if="{{!isVip && plusIsOpen}}">
<view class="vip-left">
<view class="vip-left">
<view class="left-top">
<view class="left-top">
<image class="top-image"
<image class="top-image" src="https://img3.bigaka.com/prd/3001/202003/20200309/3001a3933408-de10-4029-861f-f8fb5de26092.png" />
src="https://img3.bigaka.com/prd/3001/202003/20200309/3001a3933408-de10-4029-861f-f8fb5de26092.png" /
>
<text>现在勾选成为vip,享受更多优惠</text
>
<text>现在勾选成为vip,享受更多优惠</text
>
</view
>
</view
>
<view class="left-bottom"
>
<view class="left-bottom"
>
<text>vip可尊享更多权益</text
>
<text>vip可尊享更多权益</text
>
<!-- <image class="bottom-image" src="/assets/imgs/7_1_0/explain.png" /> --
>
<!-- <image class="bottom-image" src="/assets/imgs/7_1_0/explain.png" /> --
>
</view
>
</view>
</view>
</view
>
<view class="vip-right df" bindtap="handelChangeSelectVip"
>
<view class="vip-right df" bindtap="handelChangeSelectVip
">
<view class="right-check-status
">
<view class="right-check-status"
>
<image class="check-status-img" src="{{isSelect ? '/assets/imgs/7_1_0/08_22/trade-success.png' : '/assets/imgs/7_1_0/08_22/trade-unsel.png'}}" /
>
<image class="check-status-img" src="{{isSelect ? '/assets/imgs/7_1_0/08_22/trade-success.png' : '/assets/imgs/7_1_0/08_22/trade-unsel.png'}}" /
>
</view
>
</view
>
<view class="right-check-tips {{isSelect? 'tip-check' : 'tip-un-check'}}"
>
<view class="right-check-tips {{isSelect? 'tip-check' : 'tip-un-check'}}">
<image class="select-check-open {{isSelect? 'tip-check' : 'tip-un-check'}}" src="{{isSelect ? 'https://img3.bigaka.com/prd/3001/202003/20200309/3001ab6df057-e550-446c-a641-c5dcd8dbb51e.png' : 'https://img3.bigaka.com/prd/3001/202003/20200309/3001e6e3414a-3f8e-4100-b9da-7f852d842235.png'}}"
<image class="select-check-open {{isSelect? 'tip-check' : 'tip-un-check'}}" src="{{isSelect ? 'https://img3.bigaka.com/prd/3001/202003/20200309/3001ab6df057-e550-446c-a641-c5dcd8dbb51e.png' : 'https://img3.bigaka.com/prd/3001/202003/20200309/3001e6e3414a-3f8e-4100-b9da-7f852d842235.png'}}"
/>
/>
</view>
</view>
</view>
</view>
</view>
</view>
<view class="order-sum">
<view class="order-sum">
<view class="order-price">
<view class="order-price">
<view class="pro-total-price">
<view class="pro-total-price">
<text class="price-label">商品合计</text>
<text class="price-label">商品合计</text>
<text class="total-price">¥{{utils.numberFormat(totalGoodsPrice)}}</text>
<text class="total-price">¥{{utils.numberFormat(totalGoodsPrice)}}</text>
</view>
</view>
<view class="plus-price" wx:if="{{isSelect}}">
<view class="plus-price" wx:if="{{isSelect}}">
<view class="plus-info">
<view class="plus-info">
<text class="price-label">plus会员价</text>
<text class="price-label">plus会员价</text>
<text class="member-price">-¥{{utils.numberFormat(noSelectPrice - selectPrice)}}</text>
<text class="member-price">-¥{{utils.numberFormat(noSelectPrice - selectPrice)}}</text>
</view>
</view>
<text class="plus-member-price total-price">¥{{plusMemberPrice}}</text>
<text class="plus-member-price total-price">¥{{plusMemberPrice}}</text>
</view>
</view>
</view>
</view>
<view class="coupon">
<view class="coupon">
<view>
<view>
<text class="price-label">活动折扣</text>
<text class="price-label">活动折扣</text>
<text class="total-price">¥{{utils.numberFormat(currentOrderList.promotionDiscount)}}</text>
<text class="total-price">¥{{utils.numberFormat(currentOrderList.promotionDiscount)}}</text>
</view>
</view>
</view>
</view>
<view class="coupon">
<view class="coupon">
<!-- class='coupon-items' -->
<!-- class='coupon-items' -->
<view bindtap="selectCoupon">
<view bindtap="selectCoupon">
<text class="price-label">优惠券</text>
<text class="price-label">优惠券</text>
<view class="select-coupon"
>
<view class="select-coupon"
>
<text class="{{defalutCoupon ? 'coupon-price' : 'no-coupon'}}">{{defalutCoupon ? (currentCoupon ? '-' + currentCoupon : '-' + defalutCoupon): (currentOrderList.couponDiscountPreviews.length == 0 ? '无可使用优惠券' : '选择优惠券')}}</text>
<text class="{{defalutCoupon ? 'coupon-price' : 'no-coupon'}}">{{defalutCoupon ? (currentCoupon ? '-' + currentCoupon : '-' + defalutCoupon): (currentOrderList.couponDiscountPreviews.length == 0 ? '无可使用优惠券' : '选择优惠券')}}</text>
<image class="arrow-right" src="/assets/imgs/7_1_0/arrow-right.png" />
<image class="arrow-right" src="/assets/imgs/7_1_0/arrow-right.png" />
</view>
</view>
</view>
</view>
</view>
</view>
<view class="coupon">
<view class="coupon">
<view>
<view>
<text class="price-label">运费</text>
<text class="price-label">运费</text>
<view class="select-coupon" bindtap="selectCoupon">
<view class="select-coupon" bindtap="selectCoupon">
<text class="no-coupon">¥{{currentOrderList.freight}}</text>
<text class="no-coupon">¥{{currentOrderList.freight}}</text>
</view>
</view>
</view>
</view>
</view>
</view>
<view class="coupon" wx:if="{{isSelect}}">
<view class="coupon" wx:if="{{isSelect}}">
<view>
<view>
<text class="price-label">{{plusMemberName}}</text>
<text class="price-label">{{plusMemberName}}</text>
<text class="vip-desc"> (不可使用任何优惠或积分)</text>
<text class="vip-desc"> (不可使用任何优惠或积分)</text>
<view class="select-coupon">
<view class="select-coupon">
<text class="coupon-price">+¥{{plusMemberPrice}}</text>
<text class="coupon-price">+¥{{plusMemberPrice}}</text>
<!--<image class="arrow-right" src="/assets/imgs/7_1_0/arrow-right.png" />-->
<!--<image class="arrow-right" src="/assets/imgs/7_1_0/arrow-right.png" />-->
</view>
</view>
</view>
</view>
</view>
</view>
<!-- 配送方式 -->
<!-- 配送方式 -->
<!-- <view class="deliveryType">
<!-- <view class="deliveryType">
<view class="de-title">配送方式</view>
<view class="de-title">配送方式</view>
...
@@ -239,10 +211,10 @@
...
@@ -239,10 +211,10 @@
</view>
</view>
</view>
</view>
</view>
</view>
</view>
</view>
<!-- <view class="pro-footer">
<!-- <view class="pro-footer">
<view class="cost">
<view class="cost">
<text class="cost-label">实付款:</text>
<text class="cost-label">实付款:</text>
<text class="cost-price">¥{{utils.numberFormat(orderPrice)}}</text>
<text class="cost-price">¥{{utils.numberFormat(orderPrice)}}</text>
...
@@ -254,17 +226,13 @@
...
@@ -254,17 +226,13 @@
<view class="footer-btns">
<view class="footer-btns">
<view class="order-price-info">
<view class="order-price-info">
<text class="cost-label">实付款:</text>
<text class="cost-label">实付款:</text>
<text class="cost-price">¥{{utils.numberFormat(orderPrice)}}</text>
<text class="cost-price">¥{{utils.numberFormat(orderPrice)}}</text>
</view>
</view>
<button bind:tap="formSubmit" class="theme-color">立即购买</button>
<button bind:tap="formSubmit" class="theme-color">立即购买</button>
</view>
</view>
</form>
</form>
</view>
</view>
<!--goHome-->
<!--goHome-->
<go-home/>
<go-home/>
<floatNav bind:getAuth="_getUserInfo" bind:updatePage="updatePage"/>
<floatNav bind:getAuth="_getUserInfo" bind:updatePage="updatePage" />
<select-coupon
<select-coupon show="{{showSelectCoupon}}" bind:updateCoupon="updateCoupon" coupon-list="{{couponDiscountPreviews}}" />
show="{{showSelectCoupon}}"
\ No newline at end of file
bind:updateCoupon="updateCoupon"
coupon-list="{{couponDiscountPreviews}}"/>
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