提交 eb44da87 编写于 作者: api工厂's avatar api工厂

添加收货地址增加智能识别、下单增加积分抵扣选择

上级 38b786c8
module.exports = {
version: '10.2.1',
note: '调整移动端后台bug', // 这个为版本描述,无需修改
version: '10.2.2',
note: '添加收货地址增加智能识别、下单增加积分抵扣选择', // 这个为版本描述,无需修改
subDomain: 'tz', // 此处改成你自己的专属域名。什么是专属域名?请看教程 https://www.it120.cc/help/qr6l4m.html
sdkAppID: 1400450467, // 腾讯实时音视频应用编号,请看教程 https://www.it120.cc/help/nxoqsl.html
}
\ No newline at end of file
......@@ -26,7 +26,9 @@ Page({
pageIsEnd: false,
bindMobileStatus: 0 // 0 未判断 1 已绑定手机号码 2 未绑定手机号码
bindMobileStatus: 0, // 0 未判断 1 已绑定手机号码 2 未绑定手机号码
userScore: 0, // 用户可用积分
deductionScore: '0' // 本次交易抵扣的积分数
},
onShow(){
if (this.data.pageIsEnd) {
......@@ -87,7 +89,8 @@ Page({
const res = await WXAPI.userAmount(wx.getStorageSync('token'))
if (res.code == 0) {
this.setData({
balance: res.data.balance
balance: res.data.balance,
userScore: res.data.score
})
}
},
......@@ -143,7 +146,8 @@ Page({
token: loginToken,
goodsJsonStr: that.data.goodsJsonStr,
remark: remark,
peisongType: that.data.peisongType
peisongType: that.data.peisongType,
deductionScore: this.data.deductionScore
};
if (that.data.kjId) {
postData.kjid = that.data.kjId
......@@ -253,6 +257,26 @@ Page({
})
coupons = res.data.couponUserList
}
// 计算积分抵扣规则 userScore
let scoreDeductionRules = res.data.scoreDeductionRules
if (scoreDeductionRules) {
// 如果可叠加,计算可抵扣的最大积分数
scoreDeductionRules.forEach(ele => {
if (ele.loop) {
let loopTimes = Math.floor(that.data.userScore / ele.score) // 按剩余积分取最大
let loopTimesMax = Math.floor((res.data.amountTotle + res.data.deductionMoney) / ele.money) // 按金额取最大
if (loopTimes > loopTimesMax) {
loopTimes = loopTimesMax
}
ele.score = ele.score * loopTimes
ele.money = ele.money * loopTimes
}
})
// 剔除积分数为0的情况
scoreDeductionRules = scoreDeductionRules.filter(ele => {
return ele.score > 0
})
}
that.setData({
totalScoreToPay: res.data.score,
......@@ -261,7 +285,9 @@ Page({
yunPrice: res.data.amountLogistics,
hasNoCoupons,
coupons,
couponAmount: res.data.couponAmount
deductionMoney: res.data.deductionMoney,
couponAmount: res.data.couponAmount,
scoreDeductionRules
});
that.data.pageIsEnd = false
return;
......@@ -508,4 +534,17 @@ Page({
})
}
},
deductionScoreChange(event) {
this.setData({
deductionScore: event.detail,
})
this.processYunfei()
},
deductionScoreClick(event) {
const { name } = event.currentTarget.dataset;
this.setData({
deductionScore: name,
})
this.processYunfei()
},
})
\ No newline at end of file
......@@ -5,7 +5,7 @@
<view class="title">申请获取以下权限</view>
<view class="profile">授权绑定手机号码</view>
<view class="btn">
<van-button type="primary" block round open-type="getPhoneNumber" bind:getphonenumber="getPhoneNumber">绑定手机号码</van-button>
<van-button type="primary" block round open-type="getPhoneNumber" bind:getphonenumberd="getPhoneNumber">绑定手机号码</van-button>
</view>
</view>
</block>
......@@ -102,10 +102,23 @@
</view>
</view>
<van-cell-group custom-class="box-v2">
<van-cell wx:if="{{ yunPrice }}" title="运费" value="{{yunPrice}}" />
<van-cell wx:if="{{couponAmount}}" title="优惠金额" value="-{{couponAmount}}" />
<van-cell wx:if="{{balance}}" title="账户余额" value="{{balance}}" />
<!-- 选择积分抵扣 -->
<van-radio-group wx:if="{{ scoreDeductionRules && scoreDeductionRules.length > 0 }}" value="{{ deductionScore }}" bind:change="deductionScoreChange">
<van-cell-group title="积分抵扣">
<van-cell title="不使用积分" clickable data-name="0" bind:click="deductionScoreClick">
<van-radio slot="right-icon" name="0" />
</van-cell>
<van-cell wx:for="{{scoreDeductionRules}}" wx:key="id" title="使用{{ item.score }}积分抵扣¥{{ item.money }}" clickable data-name="{{ item.score }}" bind:click="deductionScoreClick">
<van-radio slot="right-icon" name="{{ item.score }}" />
</van-cell>
</van-cell-group>
</van-radio-group>
<van-cell-group title="小计">
<van-cell wx:if="{{ yunPrice }}" title="运费" value="¥{{yunPrice}}" />
<van-cell wx:if="{{deductionMoney}}" title="积分抵扣" value="-¥{{deductionMoney}}" />
<van-cell wx:if="{{couponAmount}}" title="优惠金额" value="-¥{{couponAmount}}" />
<van-cell wx:if="{{balance}}" title="账户余额" value="¥{{balance}}" />
</van-cell-group>
<view class="bottom-box"></view>
<van-submit-bar
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册