|
|
@@ -4,12 +4,10 @@
|
|
|
<div class="order-manage-wrap" v-if="!$util.isEmpty(detailInfo)">
|
|
|
<div class="card-wrap">
|
|
|
<div class="card-tit">
|
|
|
- 花材信息
|
|
|
-
|
|
|
- <el-button @click="" style="margin-left:200px;">使用填单价</el-button>
|
|
|
+ 花材信息 (按 Esc 关闭窗口)
|
|
|
+ <el-button @click="" style="margin-left:80px;">使用填单价</el-button>
|
|
|
<el-button @click="" style="margin-left:20px;">使用自带价</el-button>
|
|
|
<el-button type="primary" @click="addItme()" style="margin-left:20px;">添加花材</el-button>
|
|
|
-
|
|
|
</div>
|
|
|
<div class="card-body">
|
|
|
<el-table :data="detailInfo.product">
|
|
|
@@ -41,7 +39,11 @@
|
|
|
|
|
|
<el-table-column label="操作">
|
|
|
<template slot-scope="scope">
|
|
|
- <el-button type="primary" @click="" size="mini">删除</el-button>
|
|
|
+
|
|
|
+ <el-popconfirm title="确认删除?" @confirm="confirmDel(scope.row)" @onConfirm="confirmDel(scope.row)">
|
|
|
+ <el-button size="small" type="primary" slot="reference">删除</el-button>
|
|
|
+ </el-popconfirm>
|
|
|
+
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
|
|
|
@@ -80,8 +82,15 @@
|
|
|
</div>
|
|
|
<div style="margin-left:80px;margin-top:20px;">
|
|
|
<el-button @click="">取消</el-button>
|
|
|
- <el-button @click="" style="margin-left:50px;">保存</el-button>
|
|
|
- <el-button type="primary" @click="" style="margin-left:50px;">确认提交</el-button>
|
|
|
+
|
|
|
+ <el-popconfirm title="确认保存?" @confirm="savePrice()" @onConfirm="savePrice()" style="margin-left:80px;">
|
|
|
+ <el-button slot="reference">保存</el-button>
|
|
|
+ </el-popconfirm>
|
|
|
+
|
|
|
+ <el-popconfirm title="确认要提交?" @confirm="commitItem()" @onConfirm="commitItem()" style="margin-left:80px;">
|
|
|
+ <el-button type="primary" slot="reference">确认提交</el-button>
|
|
|
+ </el-popconfirm>
|
|
|
+
|
|
|
</div>
|
|
|
</div>
|
|
|
<div v-else v-loading="loading" style="height:800px;"></div>
|
|
|
@@ -140,6 +149,62 @@ export default {
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
+ commitItem(){
|
|
|
+ let product = []
|
|
|
+ let hasError = false
|
|
|
+ let that = this
|
|
|
+ let hasLessCostPrice = false
|
|
|
+ if (this.detailInfo && this.detailInfo.product) {
|
|
|
+ for (const item of this.detailInfo.product) {
|
|
|
+ if(item.currentHdPrice.length <= 0){
|
|
|
+ this.$message.error('请填写价格,价格要大于0')
|
|
|
+ hasError = true;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ if(this.$util.isEmpty(item.xhNum) || Number(item.xhNum) < 0){
|
|
|
+ this.$message.error('请填写到货数,没有填0')
|
|
|
+ hasError = true;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ let num = item.xhNum ? Number(item.xhNum) : 0
|
|
|
+ let price = item.currentHdPrice ? Number(item.currentHdPrice) : 0
|
|
|
+ let productId = item.productId || 0
|
|
|
+ product = [...product,{productId,price,num}]
|
|
|
+ if(Number(item.cost)>Number(item.currentHdPrice)){
|
|
|
+ hasLessCostPrice = true
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if(hasLessCostPrice == true && this.lessCostCould == 0){
|
|
|
+ this.$message.error('有售价低于成本,请打开允许设置')
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ if(hasError == true){
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ this.$service.order.arrival({id:that.arrivalData.id,product:JSON.stringify(product),packCost:that.packCost,sendCost:that.sendCost}).then(res=>{
|
|
|
+ this.$message.success('提交成功')
|
|
|
+ this.closeFn()
|
|
|
+ })
|
|
|
+ },
|
|
|
+ savePrice(){
|
|
|
+ if(this.$util.isEmpty(this.detailInfo.product)){
|
|
|
+ this.$message.error('没有花材信息')
|
|
|
+ return false
|
|
|
+ }
|
|
|
+ const data = this.detailInfo.product.map(ele => {
|
|
|
+ return { orderSn: ele.orderSn, xhNum:ele.xhNum,xhUnitPrice:ele.currentHdPrice,id:ele.id}
|
|
|
+ })
|
|
|
+ this.$service.orderItem.modifyBookItem({data:data,id:this.detailInfo.id,packCost:this.packCost,sendCost:this.sendCost}).then(res=>{
|
|
|
+ this.$message.success('修改成功')
|
|
|
+ })
|
|
|
+ },
|
|
|
+ confirmDel(info){
|
|
|
+ this.$service.orderItem.delItem({ id:this.arrivalData.id,smallId:info.id}).then(res => {
|
|
|
+ this.$message.success('删除成功')
|
|
|
+ this.init()
|
|
|
+ })
|
|
|
+ },
|
|
|
addItme(){
|
|
|
this.$emit('addNewItem',this.arrivalData)
|
|
|
},
|