Skip to content

Commit

Permalink
fixed 下单确认页面出现2个选择使用优惠券的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
gooking committed Oct 19, 2021
1 parent 4c7bf20 commit 74980d2
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 5 deletions.
4 changes: 2 additions & 2 deletions config.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module.exports = {
version: '12.5.3',
note: '购买动态样式优化', // 这个为版本描述,无需修改
version: '12.5.4',
note: 'fixed 下单确认页面出现2个选择使用优惠券的问题', // 这个为版本描述,无需修改
subDomain: 'tz', // liu123 此处改成你自己的专属域名。什么是专属域名?请看教程 https://www.it120.cc/help/qr6l4m.html
merchantId: 951, // 商户ID,可在后台工厂设置-->商户信息查看
sdkAppID: 1400450467, // 腾讯实时音视频应用编号,请看教程 https://www.it120.cc/help/nxoqsl.html
Expand Down
2 changes: 1 addition & 1 deletion miniprogram_npm/apifm-wxapi/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ module.exports =
/* eslint-disable */
// 小程序开发api接口工具包,https://github.com/gooking/wxapi
var API_BASE_URL = 'https://api.it120.cc';
// var API_BASE_URL = 'http://192.168.1.100:8081';
// var API_BASE_URL = 'http://127.0.0.1:8081';
var subDomain = '-';
var merchantId = '0';

Expand Down
2 changes: 1 addition & 1 deletion packageFx/pages/commisionLog/index.wxml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
{{ g.commisionRecord.money }} {{g.commisionRecord.unit==0?'元':'积分'}}
<text wx:if="{{g.commisionRecord.isSettlement}}"
style='color:green;margin-left:10px;font-size:14px;'>已结算</text>
<text wx:else style='color:gray;margin-left:10px;font-size:14px;'>待结算</text>
<text wx:elif="{{ item.status != -1 }}" style='color:gray;margin-left:10px;font-size:14px;'>待结算</text>
</view>
</van-card>
<view class="goods-price">
Expand Down
26 changes: 26 additions & 0 deletions pages/to-pay-order/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,9 @@ Page({
})
}
}
shopList.forEach(ele => {
ele.hasNoCoupons = true
})
this.setData({
shopList,
goodsList,
Expand Down Expand Up @@ -329,6 +332,7 @@ Page({
let couponAmount = 0
for (let index = 0; index < shopList.length; index++) {
const curShop = shopList[index]
console.log(curShop);
postData.filterShopId = curShop.id
if (curShop.curCoupon) {
postData.couponId = curShop.curCoupon.id
Expand All @@ -349,8 +353,10 @@ Page({
totalRes.data.score += res.data.score
totalRes.data.amountReal += res.data.amountReal
totalRes.data.orderIds.push(res.data.id)
console.log('e:', e);
if (!e) {
curShop.hasNoCoupons = true
console.log(curShop);
if (res.data.couponUserList) {
curShop.hasNoCoupons = false
res.data.couponUserList.forEach(ele => {
Expand Down Expand Up @@ -416,6 +422,13 @@ Page({
});
} else {
// 单门店单商品下单
if (shopList && shopList.length == 1) {
if (shopList[0].curCoupon) {
postData.couponId = shopList[0].curCoupon.id
} else {
postData.couponId = ''
}
}
const res = await WXAPI.orderCreate(postData)
this.data.pageIsEnd = true
if (res.code != 0) {
Expand Down Expand Up @@ -445,6 +458,18 @@ Page({
}
})
coupons = res.data.couponUserList
if (shopList && shopList.length == 1 && !hasNoCoupons) {
hasNoCoupons = true
const curShop = shopList[0]
curShop.hasNoCoupons = false
curShop.curCouponShowText = '请选择使用优惠券'
curShop.coupons = res.data.couponUserList
if (res.data.couponId && res.data.couponId.length > 0) {
curShop.curCoupon = curShop.coupons.find(ele => { return ele.id == res.data.couponId[0] })
curShop.curCouponShowText = curShop.curCoupon.nameExt
}
shopList[0] = curShop
}
}
// 计算积分抵扣规则 userScore
let scoreDeductionRules = res.data.scoreDeductionRules
Expand All @@ -467,6 +492,7 @@ Page({
})
}
this.setData({
shopList,
totalScoreToPay: res.data.score,
isNeedLogistics: res.data.isNeedLogistics,
allGoodsAndYunPrice: res.data.amountReal,
Expand Down
2 changes: 1 addition & 1 deletion pages/to-pay-order/index.wxml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
</van-card>
<view class="peisong-way" hidden="{{ shop.hasNoCoupons }}">
<view class="row-box" style="border-bottom:none;">
<view class="row-label t">使用优惠券</view>
<view class="row-label t">1使用优惠券{{ shop.hasNoCoupons ? 'true' : 'false' }}</view>
</view>
<picker data-sidx="{{ shopIndex }}" bindchange="bindChangeCouponShop" range="{{ shop.coupons }}" range-key="nameExt">
<view class="row-box" style="border-bottom:none;">
Expand Down

0 comments on commit 74980d2

Please sign in to comment.