|
@@ -41,10 +41,10 @@
|
|
|
<p><small>本单金额: </small>{{tool.formatAmount(data.amount - rebateamount,2)}}</p>
|
|
|
</div>
|
|
|
<div v-if="(data.type === '标准订单' || data.type === '特殊订单') && isusedrebate === 1">
|
|
|
- <el-checkbox v-model="checked" :true-label="1" :false-label="0">使用返利金</el-checkbox>
|
|
|
- <div v-if="checked" class="flex-align-center">
|
|
|
- <p class="inline-16"><b>返利金余额:{{tool.formatAmount(defaultData.rebatebalance,2)}}</b></p>
|
|
|
- <el-input class="inline-16" size="mini" style="width:150px" v-model="rebateamount" @blur="useRebate" placeholder="输入使用金额"></el-input>
|
|
|
+ <el-checkbox v-model="data.rebate_used" :true-label="1" :false-label="0" @change="rebateUsedChange">使用返利金</el-checkbox>
|
|
|
+ <div v-if="data.rebate_used" class="flex-align-center">
|
|
|
+ <p class="inline-16"><b>返利金余额:{{tool.formatAmount(data.rebateamount,2)}}</b></p>
|
|
|
+ <el-input class="inline-16" size="mini" style="width:150px" v-model="data.rebatebalance" @blur="useRebate(data.rebatebalance)" placeholder="输入使用金额"></el-input>
|
|
|
<small>(返利金最高使用比例{{data.order_rebate_userate}})</small>
|
|
|
<!-- <small>(返利金最高使用比例{{data.order_rebate_userate}},本单上限:{{tool.formatAmount(data.amount * data.order_rebate_userate / 100,2)}})</small>-->
|
|
|
</div>
|
|
@@ -364,9 +364,9 @@ export default {
|
|
|
this.$emit('onSuccess')
|
|
|
})
|
|
|
},
|
|
|
- async useRebate () {
|
|
|
+ async useRebate (e) {
|
|
|
let that = this
|
|
|
- if (this.rebateamount > this.defaultData.rebatebalance ||this.rebateamount > (this.data.amount * this.data.order_rebate_userate / 100) ) return this.$message({
|
|
|
+ /*if (this.rebateamount > this.defaultData.rebatebalance ||this.rebateamount > (this.data.amount * this.data.order_rebate_userate ) ) return this.$message({
|
|
|
message:`余额不足或已超过可用上限!`,
|
|
|
type:function () {
|
|
|
that.rebateamount = 0
|
|
@@ -388,7 +388,31 @@ export default {
|
|
|
if (res.code === 0) this.$message({
|
|
|
message:`使用返利金失败!${res.msg}`,
|
|
|
type:'error'
|
|
|
- })
|
|
|
+ })*/
|
|
|
+
|
|
|
+ /* 修改返利金 */
|
|
|
+ let rebatebalance = e;
|
|
|
+ let amount = this.data.order_rebate_userate * this.data.defaultamount;//最大可用金额
|
|
|
+ const res = await this.$api.requested({
|
|
|
+ "id":20230218225002,
|
|
|
+ "content":{
|
|
|
+ "sa_orderid":this.data.sa_orderid,//订单金额
|
|
|
+ "isused":1,//是否使用
|
|
|
+ "rebateamount":rebatebalance>amount?amount:rebatebalance
|
|
|
+ }
|
|
|
+ })
|
|
|
+ if(res.data=='成功'){
|
|
|
+ if(rebatebalance>amount){
|
|
|
+ this.data.rebatebalance=amount
|
|
|
+ this.$message({
|
|
|
+ message: '返利金最大可用值'+ amount,
|
|
|
+ type: 'warning'
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ this.$message.error(res.msg);
|
|
|
+ }
|
|
|
+
|
|
|
},
|
|
|
// 查询站点是否使用返利金
|
|
|
async queryUsedrebate () {
|
|
@@ -416,6 +440,27 @@ export default {
|
|
|
async selectOptions () {
|
|
|
const res = await this.$store.dispatch('optiontypeselect','saletype')
|
|
|
this.saleroptions = res.data
|
|
|
+ },
|
|
|
+ async rebateUsedChange(){
|
|
|
+ console.log(this.data)
|
|
|
+
|
|
|
+
|
|
|
+ if(this.data.status != '新建') return 1
|
|
|
+
|
|
|
+
|
|
|
+ let amount = parseInt(this.data.order_rebate_userate * this.data.defaultamount); //最大可用金额
|
|
|
+ let rebatebalance = this.data.rebatebalance; //返利金账户余额
|
|
|
+ const res = await this.$api.requested({
|
|
|
+ "id": 20230218225002,
|
|
|
+ "content": {
|
|
|
+ "sa_orderid": this.data.sa_orderid, //订单金额
|
|
|
+ "isused": this.data.rebate_used == 1 ? 0 : 1, //是否使用
|
|
|
+ "rebateamount": rebatebalance > amount ? amount : rebatebalance //返利金使用金额
|
|
|
+ }
|
|
|
+ })
|
|
|
+ console.log(res)
|
|
|
+ this.data.rebate_used = res.msg !== '成功' ? this.data.rebate_used == 0?1:0:this.data.rebate_used
|
|
|
+
|
|
|
}
|
|
|
},
|
|
|
}
|