Răsfoiți Sursa

确认发货与确认提交

shish 1 an în urmă
părinte
comite
d65a62c544

+ 16 - 0
ghs/src/service/order-item/index.js

@@ -13,5 +13,21 @@ export class OrderItemService extends BaseService {
 		});
 		});
 	}
 	}
 
 
+	delItem(data) {
+		return this.request({
+			url: '/del-item',
+			method: 'POST',
+			data: data
+		});
+	}
+
+	modifyBookItem(data) {
+		return this.request({
+			url: '/modify-book-item',
+			method: 'POST',
+			data: data
+		});
+	}
+
 }
 }
 export default new OrderItemService();
 export default new OrderItemService();

+ 8 - 0
ghs/src/service/order/index.js

@@ -5,6 +5,14 @@ import { baseUrl } from '@/config/env';
 @Service('order')
 @Service('order')
 export class OrderService extends BaseService {
 export class OrderService extends BaseService {
 
 
+	arrival(data) {
+		return this.request({
+			url: '/arrival',
+			method: 'POST',
+			data: data
+		});
+	}
+
 	arrivalDetail(data) {
 	arrivalDetail(data) {
 		return this.request({
 		return this.request({
 			url: '/arrival-detail',
 			url: '/arrival-detail',

+ 72 - 7
ghs/src/views/order/components/arrival.vue

@@ -4,12 +4,10 @@
 			<div class="order-manage-wrap" v-if="!$util.isEmpty(detailInfo)">
 			<div class="order-manage-wrap" v-if="!$util.isEmpty(detailInfo)">
 				<div class="card-wrap">
 				<div class="card-wrap">
 					<div class="card-tit">
 					<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 @click="" style="margin-left:20px;">使用自带价</el-button>
 						<el-button type="primary" @click="addItme()" style="margin-left:20px;">添加花材</el-button>
 						<el-button type="primary" @click="addItme()" style="margin-left:20px;">添加花材</el-button>
-
 					</div>
 					</div>
 					<div class="card-body">
 					<div class="card-body">
 						<el-table :data="detailInfo.product">
 						<el-table :data="detailInfo.product">
@@ -41,7 +39,11 @@
 
 
 							<el-table-column label="操作">
 							<el-table-column label="操作">
 								<template slot-scope="scope">
 								<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>
 								</template>
 							</el-table-column>
 							</el-table-column>
 
 
@@ -80,8 +82,15 @@
 	      		</div>
 	      		</div>
 				<div style="margin-left:80px;margin-top:20px;">
 				<div style="margin-left:80px;margin-top:20px;">
 					<el-button @click="">取消</el-button>
 					<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>
 			</div>
 			<div v-else  v-loading="loading" style="height:800px;"></div>
 			<div v-else  v-loading="loading" style="height:800px;"></div>
@@ -140,6 +149,62 @@ export default {
 		}
 		}
 	},
 	},
 	methods: {
 	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(){
 		addItme(){
 			this.$emit('addNewItem',this.arrivalData)
 			this.$emit('addNewItem',this.arrivalData)
 		},
 		},

+ 0 - 1
ghsApp/src/pagesOrder/arrival.vue

@@ -237,7 +237,6 @@ export default {
 						let num = item.xhNum ? Number(item.xhNum) : 0
 						let num = item.xhNum ? Number(item.xhNum) : 0
 						let price = item.currentHdPrice ? Number(item.currentHdPrice) : 0
 						let price = item.currentHdPrice ? Number(item.currentHdPrice) : 0
 						let productId = item.productId || 0
 						let productId = item.productId || 0
-						let unitType = 
 						product = [...product,{productId,price,num}]
 						product = [...product,{productId,price,num}]
 						if(Number(item.cost)>Number(item.currentHdPrice)){
 						if(Number(item.cost)>Number(item.currentHdPrice)){
 							hasLessCostPrice = true
 							hasLessCostPrice = true