|
@@ -9,10 +9,10 @@
|
|
|
size="80%">
|
|
|
<div slot="title">
|
|
|
<div class="flex-align-center">
|
|
|
- <p><span style="font-size:14px">订单合计:</span><span style="color:red;font-size:16px;"><b>¥ {{tool.formatAmount(data.amount,2)}}</b></span></p>
|
|
|
- <!-- <label style="font-size:14px;margin-left:10px" for="">备注:</label>
|
|
|
- <input class="order__note__input" v-model="defaultData.remarks" type="text" placeholder="请输入订单备注"> -->
|
|
|
- <p>运费:{{data.amount > freefreightamount >= 0?'当前订单免运费':`订单满${freefreightamount}元免运费,当前还差${freefreightamount - data.amount}元`}}</p>
|
|
|
+ <p><span style="font-size:14px">订单合计:</span><span style="color:red;font-size:16px;"><b>¥ {{tool.formatAmount(data.defaultamount,2)}}</b></span></p>
|
|
|
+ </div>
|
|
|
+ <div class="flex-align-center">
|
|
|
+ <p style="font-size: 13px !important;color: #8888;font-weight: normal">{{data.amount > freefreightamount?'当前订单免运费':`订单满${freefreightamount}元免运费,当前还差${freefreightamount - data.amount}元`}}</p>
|
|
|
</div>
|
|
|
</div>
|
|
|
<div class="drawer__panel">
|
|
@@ -32,14 +32,14 @@
|
|
|
<div class="flex-align-center">
|
|
|
<p class="inline-16"><small>账户余额: </small><b>¥{{tool.formatAmount(defaultData.accountclass.balance?defaultData.accountclass.balance:0,2)}}</b></p>
|
|
|
<p class="inline-16"><small>账户名称: </small>{{defaultData.accountclass.accountname?defaultData.accountclass.accountname:'未选择账户'}}</p>
|
|
|
- <p><small>本单金额: </small>{{tool.formatAmount(data.amount - rebateamount,2)}}</p>
|
|
|
+ <p><small>本单金额: </small>{{data.rebate_used ? tool.formatAmount(data.defaultamount - rebateamount,2) : data.defaultamount}}</p>
|
|
|
</div>
|
|
|
<div v-if="(data.type === '标准订单' || data.type === '特殊订单') && isusedrebate === 1">
|
|
|
- <el-checkbox v-model="checked" :true-label="1" :false-label="0">使用返利金</el-checkbox>
|
|
|
+ <el-checkbox v-model="checked" :true-label="1" :false-label="0" @change="rebateUsedChange">使用返利金</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>
|
|
|
- <small>(返利金最高使用比例{{data.order_rebate_userate}}%,本单上限:{{tool.formatAmount(data.amount * data.order_rebate_userate / 100,2)}})</small>
|
|
|
+ <el-input class="inline-16" size="mini" style="width:150px" v-model="data.rebateamount" @blur="useRebate(data.rebateamount)" placeholder="输入使用金额"></el-input>
|
|
|
+ <small>(返利金最高使用比例{{data.order_rebate_userate}})</small>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -173,15 +173,15 @@
|
|
|
<div class="mt-10">
|
|
|
<div>
|
|
|
<p class="normal-title inline-16">订单产品</p>
|
|
|
- <el-button type="text" size="mini" @click="addMoreProduct">{{setcol === 12?'关闭选择':'添加产品'}}</el-button>
|
|
|
+ <!-- <el-button type="text" size="mini" @click="addMoreProduct">{{setcol === 12?'关闭选择':'添加产品'}}</el-button> -->
|
|
|
</div>
|
|
|
<el-row :gutter="10">
|
|
|
<el-col :span="setcol">
|
|
|
<product-list ref="prolist" :data="data" :type="'edit'" @onSuccess="onEditSuccess"></product-list>
|
|
|
</el-col>
|
|
|
- <el-col :span="24 - setcol">
|
|
|
+ <!-- <el-col :span="24 - setcol">
|
|
|
<add-product ref="addpro" :data="data" @onConfirm="onConfirm"></add-product>
|
|
|
- </el-col>
|
|
|
+ </el-col> -->
|
|
|
</el-row>
|
|
|
</div>
|
|
|
</div>
|
|
@@ -213,6 +213,7 @@ export default {
|
|
|
inject:['thisDetail'],
|
|
|
data () {
|
|
|
return {
|
|
|
+ freefreightamount:'',
|
|
|
checked:0,
|
|
|
visible:false,
|
|
|
visible1:false,
|
|
@@ -249,10 +250,28 @@ export default {
|
|
|
methods:{
|
|
|
async queryBasicInfo () {
|
|
|
const res = await this.$api.requested({
|
|
|
- "id":20220920084001,"content":{},
|
|
|
+ "id":20220920084001,"content":{
|
|
|
+ sys_enterpriseid:this.data.sys_enterpriseid
|
|
|
+ },
|
|
|
})
|
|
|
this.freefreightamount = res.data.freefreightamount
|
|
|
},
|
|
|
+ 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
|
|
|
+ },
|
|
|
onShow () {
|
|
|
this.initPage()
|
|
|
},
|
|
@@ -267,7 +286,11 @@ export default {
|
|
|
this.selectOptions()
|
|
|
|
|
|
this.checked = this.data.rebate_used
|
|
|
- this.rebateamount = this.data.rebateamount
|
|
|
+ if (this.data.rebateamount > this.data.defaultamount) {
|
|
|
+ this.rebateamount = this.tool.formatAmount(+this.data.defaultamount / 2)
|
|
|
+ } else {
|
|
|
+ this.rebateamount = this.data.rebateamount
|
|
|
+ }
|
|
|
},
|
|
|
// 收货信息:合作企业联系人
|
|
|
async receiveAddress (fn) {
|
|
@@ -326,8 +349,10 @@ export default {
|
|
|
this.tool.showMessage(res,()=>{
|
|
|
this.$emit('onSuccess')
|
|
|
if (this.data.type === '标准订单' || this.data.type === '特殊订单') {
|
|
|
- this.isusedrebate === 1?this.useRebate():""
|
|
|
+ this.isusedrebate === 1?this.useRebate(this.data.rebateamount):""
|
|
|
}
|
|
|
+ console.log('触发');
|
|
|
+
|
|
|
this.drawer = false
|
|
|
})
|
|
|
},
|
|
@@ -361,31 +386,32 @@ 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({
|
|
|
- message:`余额不足或已超过可用上限!`,
|
|
|
- type:function () {
|
|
|
- that.rebateamount = 0
|
|
|
- return 'error'
|
|
|
- }()
|
|
|
- })
|
|
|
- if (this.rebateamount == null) return this.$message({
|
|
|
- message:"返利金不能为空",
|
|
|
- type:'error'
|
|
|
- })
|
|
|
+ /* 修改返利金 */
|
|
|
+ let rebateamount = 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": this.checked, //是否使用
|
|
|
- "rebateamount": this.rebateamount //返利金使用金额
|
|
|
- },
|
|
|
- })
|
|
|
- if (res.code === 0) this.$message({
|
|
|
- message:`使用返利金失败!${res.msg}`,
|
|
|
- type:'error'
|
|
|
- })
|
|
|
+ "id":20230218225002,
|
|
|
+ "content":{
|
|
|
+ "sa_orderid":this.data.sa_orderid,//订单金额
|
|
|
+ "isused":1,//是否使用
|
|
|
+ "rebateamount":rebateamount>amount?amount:rebateamount
|
|
|
+ }
|
|
|
+ })
|
|
|
+ if(res.data=='成功'){
|
|
|
+ this.$emit('onSuccess')
|
|
|
+ this.initPage()
|
|
|
+ if(rebateamount>amount){
|
|
|
+ this.data.rebateamount=amount
|
|
|
+ this.$message({
|
|
|
+ message: '返利金最大可用值'+ amount,
|
|
|
+ type: 'warning'
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ this.$message.error(res.msg);
|
|
|
+ }
|
|
|
},
|
|
|
// 查询站点是否使用返利金
|
|
|
async queryUsedrebate () {
|