|
@@ -3,6 +3,7 @@
|
|
|
v-loading="load"
|
|
|
:title="data.length <= 1 ? '订单发货' : '订单发货(批量逐一发货)'"
|
|
|
:visible.sync="drawer"
|
|
|
+ @close="close"
|
|
|
:direction="direction"
|
|
|
size="50%">
|
|
|
<div class="content">
|
|
@@ -10,6 +11,7 @@
|
|
|
<el-pagination
|
|
|
background
|
|
|
:page-size="1"
|
|
|
+ :current-page="currentOrder + 1"
|
|
|
layout="prev, pager, next"
|
|
|
@current-change="currentChange"
|
|
|
:total="data.length">
|
|
@@ -23,7 +25,8 @@
|
|
|
<div class="deli-footer">
|
|
|
<div class="d-left">
|
|
|
<div class="estimate-total">
|
|
|
- 订单小计<span class="total">¥{{data[currentOrder] && currentPrice[data[currentOrder].omsOrderIds]?currentPrice[data[currentOrder].omsOrderIds].estimateFreight:'0.00'}}</span> <span class="detail">明细></span>
|
|
|
+ 订单小计<span class="total">¥{{data[currentOrder] && currentPrice[data[currentOrder].omsOrderIds]?currentPrice[data[currentOrder].omsOrderIds].estimateFreight:'0.00'}}</span>
|
|
|
+ <!-- <span class="detail">明细></span> -->
|
|
|
</div>
|
|
|
<!-- <div class="estimate-total">
|
|
|
预计总价<span class="total">¥48.00</span>
|
|
@@ -32,7 +35,11 @@
|
|
|
<el-checkbox v-model="checked">已读并同意《XXX电子运单协议》</el-checkbox>
|
|
|
</div>
|
|
|
</div>
|
|
|
- <div class="send-btn" @click="btn" :class="{'stopBtn':stopHandle}">确认</div>
|
|
|
+ <div class="btn-box">
|
|
|
+ <div class="send-btn" @click="btn" :class="{'stopBtn':stopHandle}">一键发货</div>
|
|
|
+ <div class="send-btn" @click="nextBtn" :class="{'stopBtn':stopHandle}" v-if="data.length > 1">确认,下一单</div>
|
|
|
+ </div>
|
|
|
+
|
|
|
</div>
|
|
|
</el-drawer>
|
|
|
</template>
|
|
@@ -52,12 +59,21 @@ export default class BatchbyOneModal extends Vue {
|
|
|
checked=false;
|
|
|
data:Array<any>=[];
|
|
|
currentOrder=0;
|
|
|
+ isSuccess=false;
|
|
|
stopHandle=false;
|
|
|
load = false;
|
|
|
priceObj:any={};
|
|
|
currentPrice:any={};
|
|
|
setShow(v:boolean){
|
|
|
this.drawer=v;
|
|
|
+ this.priceObj={};
|
|
|
+ this.currentPrice={};
|
|
|
+ this.isSuccess = false;
|
|
|
+ }
|
|
|
+ close(){
|
|
|
+ if(this.isSuccess){
|
|
|
+ this.$emit('handleSuccess');
|
|
|
+ }
|
|
|
}
|
|
|
editResult(v:any){
|
|
|
this.data[this.currentOrder] = v;
|
|
@@ -72,9 +88,12 @@ export default class BatchbyOneModal extends Vue {
|
|
|
this.currentOrder = v-1;
|
|
|
this.$forceUpdate();
|
|
|
this.$nextTick(()=>{
|
|
|
- (this.$refs.info as any).setValue(this.data[this.currentOrder]);
|
|
|
+ this.setInfo();
|
|
|
})
|
|
|
}
|
|
|
+ setInfo(){
|
|
|
+ (this.$refs.info as any).setValue(this.data[this.currentOrder]);
|
|
|
+ }
|
|
|
setValue(data:Array<any>){
|
|
|
this.data = [];
|
|
|
this.stopHandle = false;
|
|
@@ -135,7 +154,9 @@ export default class BatchbyOneModal extends Vue {
|
|
|
return (((1 + Math.random()) * 0x10000) | 0).toString(16).substring(1);
|
|
|
}
|
|
|
btn(){
|
|
|
+ this.currentOrder = 0;
|
|
|
if(this.stopHandle){
|
|
|
+ this.$message('库存不足!')
|
|
|
return
|
|
|
}
|
|
|
if(!this.checked){
|
|
@@ -151,7 +172,7 @@ export default class BatchbyOneModal extends Vue {
|
|
|
return
|
|
|
}
|
|
|
if(this.data.length > 1){
|
|
|
- this.currentOrder = 0;
|
|
|
+
|
|
|
let ids='';
|
|
|
for(const item of this.data){
|
|
|
if(!item.orderType || !item.tmsShipmentConsignor){
|
|
@@ -166,26 +187,34 @@ export default class BatchbyOneModal extends Vue {
|
|
|
}).then(() => {
|
|
|
this.setOnEditOrderInfo(ids);
|
|
|
this.sendGoods(this.data[0]);
|
|
|
- // let i = 0;
|
|
|
- // for(const item of this.data){
|
|
|
- // if(i == 0){
|
|
|
- // this.sendGoods(item);
|
|
|
- // }else{
|
|
|
- // this.getStoreCount(item,this.getPriceInfo);
|
|
|
- // }
|
|
|
- // i++;
|
|
|
- // }
|
|
|
+
|
|
|
}).catch(() => {});
|
|
|
}else{
|
|
|
this.sendGoods(this.data[0]);
|
|
|
- // for(const item of this.data){
|
|
|
- // this.sendGoods(item);
|
|
|
- // }
|
|
|
}
|
|
|
}else{
|
|
|
this.sendGoods(this.data[0]);
|
|
|
}
|
|
|
}
|
|
|
+ nextBtn(){
|
|
|
+ if(this.stopHandle){
|
|
|
+ this.$message('库存不足!')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if(!this.checked){
|
|
|
+ this.$message('请阅读并同意运单协议!')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if(!this.data[this.currentOrder].tmsShipmentAddress || !this.data[this.currentOrder].tmsShipmentConsignor){
|
|
|
+ this.$message("请编辑订单信息");
|
|
|
+ return
|
|
|
+ }
|
|
|
+ if(!this.currentPrice[this.data[this.currentOrder].omsOrderIds]){
|
|
|
+ this.$message('请选择价格!')
|
|
|
+ return
|
|
|
+ }
|
|
|
+ this.sendGoods(this.data[this.currentOrder],true);
|
|
|
+ }
|
|
|
//查库存
|
|
|
getStoreCount(item:any,callback?:Function){
|
|
|
let params:any={};
|
|
@@ -193,7 +222,9 @@ export default class BatchbyOneModal extends Vue {
|
|
|
params.skuIds=[]
|
|
|
if(item.subItem){
|
|
|
for(const i of item.subItem){
|
|
|
- params.skuIds.push(i.omsOrderItemId)
|
|
|
+ if(params.skuIds.indexOf(i.omsOrderItemId) == -1){
|
|
|
+ params.skuIds.push(i.omsOrderItemId)
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
this.load = true;
|
|
@@ -202,8 +233,11 @@ export default class BatchbyOneModal extends Vue {
|
|
|
let m='';
|
|
|
for(const i of item.subItem){
|
|
|
for(const d of res.data){
|
|
|
- if(i.omsOrderItemId == d.skuid && d.inventory <=0){
|
|
|
+ let s = Number(d.inventory) - Number(d.useInventory) - Number(i.tmsQuantity);
|
|
|
+ if(i.omsOrderItemId == d.skuid && s < 0){
|
|
|
m = m ? m + ',' + i.name : i.name;
|
|
|
+ }else{
|
|
|
+ d.inventory = subtract(d.inventory, i.tmsQuantity);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -221,7 +255,10 @@ export default class BatchbyOneModal extends Vue {
|
|
|
})
|
|
|
}
|
|
|
//发货
|
|
|
- sendGoods(item:any){
|
|
|
+ sendGoods(item:any,isNext?:boolean){
|
|
|
+ if(!item){
|
|
|
+ return
|
|
|
+ }
|
|
|
let params:any=(this as any).$lodash.cloneDeep(item);
|
|
|
if(this.priceObj[item.omsOrderIds]){
|
|
|
try{
|
|
@@ -236,19 +273,29 @@ export default class BatchbyOneModal extends Vue {
|
|
|
addmultiple(params).then((res:any) => {
|
|
|
this.load = false;
|
|
|
if(res.code == 200){
|
|
|
+ this.isSuccess = true;
|
|
|
+ this.$message({
|
|
|
+ message:'订单:'+item.omsOrderIds+'发货成功!',
|
|
|
+ type:'success'
|
|
|
+ })
|
|
|
this.currentOrder ++;
|
|
|
+
|
|
|
if(this.currentOrder < this.data.length){
|
|
|
- let item:any = this.data[this.currentOrder];
|
|
|
- if(this.currentPrice[item.omsOrderIds]){
|
|
|
- this.sendGoods(item);
|
|
|
- }else{
|
|
|
- this.getStoreCount(item,this.getPriceInfo);
|
|
|
+ if(!isNext){
|
|
|
+ let item:any = this.data[this.currentOrder];
|
|
|
+ if(this.currentPrice[item.omsOrderIds]){
|
|
|
+ this.sendGoods(item);
|
|
|
+ }else{
|
|
|
+ this.getStoreCount(item,this.getPriceInfo);
|
|
|
+ }
|
|
|
}
|
|
|
+ this.setInfo();
|
|
|
+ }else{
|
|
|
+ this.drawer=false;
|
|
|
}
|
|
|
this.$forceUpdate();
|
|
|
}
|
|
|
}).catch(() => {
|
|
|
-
|
|
|
this.load = false;
|
|
|
})
|
|
|
}
|
|
@@ -351,7 +398,7 @@ export default class BatchbyOneModal extends Vue {
|
|
|
bottom: 0;
|
|
|
z-index: 10;
|
|
|
.d-left{
|
|
|
- width: 70%;
|
|
|
+ width: 50%;
|
|
|
.estimate-total{
|
|
|
font-size: 14px;
|
|
|
padding-bottom: 4px;
|
|
@@ -370,6 +417,7 @@ export default class BatchbyOneModal extends Vue {
|
|
|
width: 120px;
|
|
|
height: 40px;
|
|
|
line-height: 40px;
|
|
|
+ margin-left: 16px;
|
|
|
border-radius: 8px;
|
|
|
background: linear-gradient(129.2deg, rgba(22,132,252,1) 9.81%,rgba(93,167,249,1) 97.4%);
|
|
|
color: rgba(255, 255, 255, 100);
|
|
@@ -381,6 +429,12 @@ export default class BatchbyOneModal extends Vue {
|
|
|
.stopBtn{
|
|
|
opacity: 0.7;
|
|
|
}
|
|
|
+ .btn-box{
|
|
|
+ width: 50%;
|
|
|
+ display: flex;
|
|
|
+ justify-content: flex-end;
|
|
|
+ align-items: center;
|
|
|
+ }
|
|
|
}
|
|
|
.space{
|
|
|
height: 80px;
|