From 293bdab16ef217cf02416c0e0ffeca36a0c69e6d Mon Sep 17 00:00:00 2001
From: xuxueyang <xuxy@fengyuntec.com>
Date: 星期二, 20 八月 2024 15:52:35 +0800
Subject: [PATCH] update 更新质检的操作界面和接口

---
 sub_pages/partner/delivery/delivery-detail.vue |  191 +++++++++++++++++++++++++++++++++++++++++------
 sub_pages/partner/delivery/delivery.vue        |   33 ++++++-
 2 files changed, 193 insertions(+), 31 deletions(-)

diff --git a/sub_pages/partner/delivery/delivery-detail.vue b/sub_pages/partner/delivery/delivery-detail.vue
index 23e7fe5..cae20ce 100644
--- a/sub_pages/partner/delivery/delivery-detail.vue
+++ b/sub_pages/partner/delivery/delivery-detail.vue
@@ -19,10 +19,11 @@
 					checkRemarks: '',
 					deductAmount: 0,
 				},
-				check_status: [{
-						label: '退回',
-						value: 'back'
-					},
+				check_status: [
+					// {
+					// 	label: '退回',
+					// 	value: 'back'
+					// },
 					{
 						label: '降级',
 						value: 'reduce'
@@ -32,14 +33,28 @@
 						value: 'lack'
 					},
 					{
+						label: '补货',
+						value: 'replace'
+					},
+					{
 						label: '完成',
 						value: 'ok'
 					}
-				]
+				],
+				target_levels: [],
 			};
 		},
 		async onLoad(options) {
 			this.id = options.id || ''
+
+			this.$http.request('get', '/api/code/value', {
+				params: {
+					type: 'FLOWER_LEVEL'
+				}
+			}).then(res => {
+				var data = res.data || []
+				this.target_levels = data
+			})
 			await this.init()
 
 		},
@@ -53,35 +68,111 @@
 
 			},
 			async clickCheck(item, status) {
+				if (status === 'ok') {
+					//完成质检,不用上传东西
+					await this.$message.confirm('确定完成此商品的质检')
+					this.$message.showLoading()
+					const {
+						code,
+						data
+					} = await this.$http.request('get', '/api/delivery/check/info/' + status, {
+						params: {
+							orderItemId: item.id
+						}
+					})
+					this.$message.hideLoading()
+					if (code === 0) {
+						this.$message.showToast('操作成功')
+						setTimeout(() => {
+							this.init()
+						}, 500)
+					}
+					return
+				}
 				this.form = {
-					id: item.id || '',
+					// id: item.id || '',
+					// status: status,
+					// statusStr: '',
+					// checkImageList: item.checkImageList || [],
+					// checkRemarks: item.checkRemarks || '',
+					// deductAmount: item.deductAmount || 0,
+
+					orderItemId: item.id || '',
+
 					status: status,
 					statusStr: '',
-					checkImageList: item.checkImageList || [],
-					checkRemarks: item.checkRemarks || '',
-					deductAmount: item.deductAmount || 0,
+					num: 0,
+					remarks: '',
+
+
 				}
+				if (status === 'reduce') {
+					this.form = {
+						...this.form,
+						pictureList: [item.id],
+						deductAmount: 0,
+						targetLevel: '',
+						checkImageList: [],
+					}
+				}
+
+
 				this.check_status.forEach(tmp => {
 					if (tmp.value === this.form.status) {
 						this.form.statusStr = tmp.label
 					}
 				})
-				//显示
-				this.$refs.popup_form.open()
+
+				//20240819更新一下操作情况
+				//先获取详情,再设置参数
+				this.$message.showLoading()
+				const {
+					code,
+					data
+				} = await this.$http.request('get', '/api/delivery/check/info/' + status, {
+					params: {
+						orderItemId: item.id
+					}
+				})
+				this.$message.hideLoading()
+				if (code === 0) {
+					this.$message.showToast('操作成功')
+					this.form = {
+						...this.form,
+						...(data || {})
+					}
+					//显示
+					this.$refs.popup_form.open()
+
+				}
 
 			},
 			async submitCheck() {
-				if (isNaN(parseFloat(this.form.deductAmount)) || this.form.deductAmount < 0) {
-					this.$message.showToast('扣款金额需要大于等于0')
-					return
+				if (this.form.status == 'reduce') {
+					if (isNaN(parseFloat(this.form.deductAmount)) || this.form.deductAmount < 0) {
+						this.$message.showToast('扣款金额需要大于等于0')
+						return
+					}
+					if (isNaN(parseInt(this.form.num)) || this.form.num < 0) {
+						this.$message.showToast('数量需要大于等于0')
+						return
+					}
 				}
+				if (this.form.status == 'replace' || this.form.status == 'lack') {
+					if (isNaN(parseInt(this.form.num)) || this.form.num < 0) {
+						this.$message.showToast('数量需要大于等于0')
+						return
+					}
+				}
+
+
+				// '/api/delivery/list/view/check'
 				this.$message.showLoading()
 				const {
 					code
-				} = await this.$http.request('post', '/api/delivery/list/view/check', {
+				} = await this.$http.request('post', '/api/delivery/check/info/do/' + this.form.status, {
 					data: {
-						...this.form,
-						deductAmount: parseFloat(this.form.deductAmount) || 0
+						...this.form
 					}
 				})
 				this.$message.hideLoading()
@@ -90,7 +181,7 @@
 					this.$refs.popup_form.close()
 					setTimeout(() => {
 						this.init()
-					}, 200)
+					}, 500)
 				}
 			},
 			async init() {
@@ -240,15 +331,32 @@
 					<uni-icons class="close" type="closeempty" @click="closeCheckForm"></uni-icons>
 				</view>
 				<view class="submit form">
-					<view class="form-item">
+					<view class="form-item" v-if="form.status==='reduce'">
 						<view class="form-item-label require">
-							质检备注
+							降级等级
 						</view>
 						<view class="form-item-value">
-							<input v-model="form.checkRemarks" placeholder="请输入质检备注" class="form-input"></input>
+							<view class="value-item" @click="()=>{
+									if(form.targetLevel!==query.value){
+										form.targetLevel = each.value
+									}																																						
+								}" :class="[form.targetLevel==each.value?'cur':'']" v-for="(each, j) in target_levels" :key="j">
+								{{ each.label || '-' }}
+							</view>
+
 						</view>
 					</view>
-					<view class="form-item">
+					<view class="form-item"
+						v-if="form.status==='reduce' || form.status==='replace' || form.status==='lack'">
+						<view class="form-item-label require">
+							数量
+						</view>
+						<view class="form-item-value">
+							<input v-model="form.num" placeholder="请输入数量" type="number" class="form-input"></input>
+
+						</view>
+					</view>
+					<view class="form-item" v-if="form.status==='reduce'">
 						<view class="form-item-label require">
 							扣款金额
 						</view>
@@ -258,7 +366,16 @@
 
 						</view>
 					</view>
-					<view class="form-item">
+					<view class="form-item"
+						v-if="form.status==='reduce'||form.status==='replace' || form.status==='lack'">
+						<view class="form-item-label require">
+							质检备注
+						</view>
+						<view class="form-item-value">
+							<input v-model="form.remarks" placeholder="请输入质检备注" class="form-input"></input>
+						</view>
+					</view>
+					<view class="form-item" v-if="form.status==='reduce'">
 						<view class="form-item-label require">
 							图片
 						</view>
@@ -289,7 +406,7 @@
 			border-radius: 4rpx;
 			border: 2rpx dashed #CECECE;
 		}
-		
+
 		.delivery-order-item {
 			.title {
 				font-weight: 600;
@@ -393,6 +510,32 @@
 					height: 36rpx;
 					line-height: 36rpx;
 				}
+
+				.value-item {
+					min-width: 152rpx;
+					width: fit-content;
+					text-align: center;
+					height: 58rpx;
+					background: #F1F5F2;
+					border-radius: 36rpx;
+					margin-bottom: 18rpx;
+					font-weight: 400;
+					font-size: 28rpx;
+					line-height: 58rpx;
+					padding: 8rpx 24rpx;
+					color: #33a868;
+					margin-left: 6rpx;
+					margin-right: 6rpx;
+					border: 2rpx solid #F1F5F2;
+				}
+
+				.value-item.cur {
+					background: #E1F0E7;
+					border-radius: 36rpx;
+					border: 2rpx solid #20613D;
+					color: #20613D;
+
+				}
 			}
 		}
 
diff --git a/sub_pages/partner/delivery/delivery.vue b/sub_pages/partner/delivery/delivery.vue
index 7f172f5..b57b313 100644
--- a/sub_pages/partner/delivery/delivery.vue
+++ b/sub_pages/partner/delivery/delivery.vue
@@ -12,7 +12,7 @@
 				},
 				show_select_station: false,
 				show_select_status: false,
-
+				selecttoday: true,
 				columns_station: [],
 				status_columns: [],
 			}
@@ -21,7 +21,8 @@
 			this.query.stationId = options.stationId || ''
 			this.query.stationName = options.stationName || ''
 
-			this.listApi = '/api/delivery/list/today'
+			// this.listApi = '/api/delivery/list/today'
+			this.listApi = '/api/delivery/check/list/today'
 			this.getList()
 			// this.$http.request('get', '/api/station/list', {
 			// 	params: {}
@@ -53,6 +54,18 @@
 			uni.stopPullDownRefresh()
 		},
 		methods: {
+			changeSelecrRange() {
+				this.selecttoday = !this.selecttoday
+
+				this.$nextTick(() => {
+					if (this.selecttoday) {
+						this.listApi = '/api/supplier/delivery/list/today'
+					} else {
+						this.listApi = '/api/supplier/delivery/list'
+					}
+					this.refreshList()
+				})
+			},
 			callTel(tel) {
 				if (tel) {
 					uni.makePhoneCall({
@@ -81,12 +94,12 @@
 				})
 			},
 			async compelete(item) {
-				await this.$message.confirm("是否完成此单质检")
-
+				await this.$message.confirm("是否一键完成此单的质检")
+				// '/api/delivery/list/view/complete'
 				const {
 					code,
 					data
-				} = await this.$http.request('get', '/api/delivery/list/view/complete', {
+				} = await this.$http.request('get', '/api/delivery/check/list/complete', {
 					params: {
 						id: item.id
 					}
@@ -97,7 +110,7 @@
 					setTimeout(async () => {
 						await tmp.refreshList()
 						tmp.$forceUpdate()
-					}, 200)
+					}, 500)
 				}
 			}
 		}
@@ -116,6 +129,12 @@
 					</u-input>
 				</view>
 			</view>
+			<!-- <view class="m-t-12">
+				<view class="m-l-a m-r-20 w-fit flex">
+					<radio :checked="selecttoday" @click="changeSelecrRange"></radio>
+					<view>只查看今日</view>
+				</view>
+			</view> -->
 			<view class="search-container m-t-12 flex">
 				<view class="flex1 input">
 					<u-input placeholder="请输入货位号" v-model="query.warehouseLocationCode">
@@ -187,7 +206,7 @@
 					<view class="line-gray"></view>
 					<view class="flex buttons">
 						<view class="button button-1 m-l-a m-r-15"
-							v-if="item.status==='ARRIVED'||item.status==='PENDING'" @click="compelete(item)">质检完成</view>
+							v-if="item.status==='ARRIVED'||item.status==='PENDING'" @click="compelete(item)">一键质检</view>
 						<view class="button button-0 m-l-a m-r-0" @click="toDetail(item)">
 							{{(item.status==='ARRIVED'||item.status==='PENDING')?'前往质检':'查看详情'}}
 						</view>

--
Gitblit v1.9.3