|
@@ -313,20 +313,66 @@ Page({
|
|
|
})
|
|
|
},
|
|
|
/* 设置是否使用返利金 */
|
|
|
- async changeRebateUsed() {
|
|
|
+ changeRebateUsed() {
|
|
|
if (this.data.detail.status != '新建') return wx.showToast({
|
|
|
title: '当前订单状态不可设置!',
|
|
|
icon: "none"
|
|
|
})
|
|
|
- this.setData({
|
|
|
- "detail.rebate_used": this.data.detail.rebate_used == 1 ? 0 : 1
|
|
|
+ let amount = (this.data.detail.order_rebate_userate / 100) * this.data.detail.amount; //最大可用金额
|
|
|
+ let rebatebalance = this.data.detail.rebatebalance; //返利金账户余额
|
|
|
+ _Http.basic({
|
|
|
+ "id": 20230218225002,
|
|
|
+ "content": {
|
|
|
+ "sa_orderid": this.data.sa_orderid, //订单金额
|
|
|
+ "isused": this.data.detail.rebate_used == 1 ? 0 : 1, //是否使用
|
|
|
+ "rebateamount": rebatebalance > amount ? amount : rebatebalance //返利金使用金额
|
|
|
+ }
|
|
|
+ }).then(res => {
|
|
|
+ console.log('设置启用返利金', res)
|
|
|
+ if (res.msg != '成功') {
|
|
|
+ wx.showToast({
|
|
|
+ title: res.msg,
|
|
|
+ icon: "none"
|
|
|
+ });
|
|
|
+ this.setData({
|
|
|
+ "detail.rebate_used": this.data.detail.rebate_used
|
|
|
+ })
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ this.getDetail(true, false)
|
|
|
+ })
|
|
|
+ },
|
|
|
+ /* 修改返利金 */
|
|
|
+ setRebate_amount(e = 0) {
|
|
|
+ let value = e.detail.value;
|
|
|
+ let rebatebalance = this.data.detail.rebatebalance; //返利金账户余额
|
|
|
+ value = value > rebatebalance ? rebatebalance : value;
|
|
|
+ let amount = (this.data.detail.order_rebate_userate / 100) * this.data.detail.amount; //最大可用金额
|
|
|
+ _Http.basic({
|
|
|
+ "id": 20230218225002,
|
|
|
+ "content": {
|
|
|
+ "sa_orderid": this.data.sa_orderid, //订单金额
|
|
|
+ "isused": 1, //是否使用
|
|
|
+ "rebateamount": value > amount ? amount : value
|
|
|
+ }
|
|
|
+ }, false).then(res => {
|
|
|
+ console.log('设置返利金', res)
|
|
|
+ if (res.msg != '成功') {
|
|
|
+ wx.showToast({
|
|
|
+ title: res.msg,
|
|
|
+ icon: "none"
|
|
|
+ });
|
|
|
+ this.setData({
|
|
|
+ "detail.accountclass.rebate_amount": this.data.detail.accountclass.rebate_amount
|
|
|
+ })
|
|
|
+ return;
|
|
|
+ };
|
|
|
+ this.getDetail(false, false)
|
|
|
+ if (value > amount || amount == 0) wx.showToast({
|
|
|
+ title: "返利金最大可使用" + amount + "元",
|
|
|
+ icon: "none"
|
|
|
+ })
|
|
|
})
|
|
|
- let res = await this.changeDetail();
|
|
|
- if (res.msg != '成功') {
|
|
|
- this.setData({
|
|
|
- "detail.rebate_used": this.data.detail.rebate_used == 1 ? 0 : 1
|
|
|
- });
|
|
|
- }
|
|
|
},
|
|
|
/* 删除订单 */
|
|
|
deleteItem() {
|