From 9f0f5d7767506658ab5ca47ba8ff4ede423e47e3 Mon Sep 17 00:00:00 2001
From: zhangwei <1504152376@qq.com>
Date: 星期三, 22 一月 2025 10:10:45 +0800
Subject: [PATCH] -

---
 src/pages/order/detail.vue |   60 ++++++++++++++++++++++++++++++++++++++++--------------------
 1 files changed, 40 insertions(+), 20 deletions(-)

diff --git a/src/pages/order/detail.vue b/src/pages/order/detail.vue
index ace65a2..b786f04 100644
--- a/src/pages/order/detail.vue
+++ b/src/pages/order/detail.vue
@@ -1,7 +1,7 @@
 <template>
 	<view class="">
 		<scroll-view enable-flex="true">
-			<view class="list chuany-flex chuany-flex-direction chuany-align-center c-p-b-30">
+			<view class="list chuany-flex chuany-flex-direction chuany-align-center c-p-b-30" @click='toEdit'>
 				<view class="content c-p-b-18">
 					<view
 						class="bgblue c-p-l-18 c-p-r-18 c-p-b-10 c-p-t-10 chuany-flex chuany-justify-between chuany-font30">
@@ -56,13 +56,13 @@
 								{{detailItem.workerType==0?'鍏�/灏忔椂':'鍏�/浠�'}}
 							</text> -->
 						</view>
-						<view class="">
+						<view class="" @click.stop="manageOrder(detailItem)">
 							<!-- <up-tag class='c-m-r-10' text="涓嬫灦" shape="circle" type="error" size='mini'
 							v-if="detailItem.orderStatus==0" @click.stop="deleteOrder(detailItem)"></up-tag> -->
 							<up-button class='c-m-r-10' :text="detailItem.isEn?'涓嬫灦':'涓婃灦'" shape="circle"
 								:loading='isLoading' :loadingText="detailItem.isEn?'涓嬫灦涓�':'涓婃灦涓�'"
-								v-if="detailItem.orderStatus==0" :type="detailItem.isEn?'error':'primary'" size='mini'
-								@click.stop="manageOrder(detailItem)"></up-button>
+								v-if="detailItem.orderStatus==0" :type="detailItem.isEn?'error':'primary'"
+								size='mini'></up-button>
 							<!-- <up-tag text="鍘绘姠娲�" type="warning" shape="circle"></up-tag> -->
 							<!-- <up-tag text="鍘绘姠娲�" type="warning" shape="circle"></up-tag> -->
 						</view>
@@ -90,7 +90,7 @@
 							<template #right-icon v-else class="chuany-flex">
 								<template class="" v-if="item.workPrice&&!item.showEdit">
 									<up-text type="error"
-										:text="item.workerType==0?`${item.workPrice}鍏�/灏忔椂`:`${item.workPrice}鍏�/浠禶 "
+										:text="detailItem.workerType==0?`${item.workPrice}鍏�/灏忔椂`:`${item.workPrice}鍏�/浠禶 "
 										size='14'></up-text>
 									<up-icon name="edit-pen" @click='isShow(item)'></up-icon>
 								</template>
@@ -182,12 +182,12 @@
 		let {
 			orderid
 		} = option
-		getOrder(orderid)
 		orderIdVal = orderid
-		console.log(option, '========orderid', orderid);
 		// detailItem.value = JSON.parse($db.get('detailItem'))
 	})
-
+	onShow(() => {
+		getOrder(orderIdVal)
+	})
 	const click = () => {
 
 	}
@@ -308,25 +308,39 @@
 		})
 	}
 	const manageOrder = (item) => {
+
 		let obj = {
 			orderId: item.id
 		}
-		isLoading.value = true
 		if (item.isEn) {
-			$api.deleteOrder(obj).then(res => {
-				if (res.code == 1) {
-					$util.showToast({
-						title: '涓嬫灦鎴愬姛锛�'
-					})
-					getOrder(orderIdVal)
-				} else {
-					$util.showToast({
-						title: res.error
-					})
+			uni.showModal({
+				title: '鎻愮ず',
+				content: '纭涓嬫灦璇ュ伐浣滃悧锛熶笅鏋跺悗灏嗗垹闄ょ浉鍏虫暟鎹紒',
+				success: function(res) {
+					if (res.confirm) {
+						// 鎵ц纭鍚庣殑鎿嶄綔
+						isLoading.value = true
+						$api.deleteOrder(obj).then(req => {
+							if (req.code == 1) {
+								$util.showToast({
+									title: '涓嬫灦鎴愬姛锛�'
+								})
+								getOrder(orderIdVal)
+							} else {
+								$util.showToast({
+									title: req.error
+								})
+							}
+							isLoading.value = false
+						})
+					} else {
+						// 鎵ц鍙栨秷鍚庣殑鎿嶄綔
+					}
 				}
-				isLoading.value = false
 			})
 		} else {
+			item.OldId = item.id
+			item.id = 0
 			$api.saveOrder(item).then(res => {
 				if (res.code == 1) {
 					$util.showToast({
@@ -343,6 +357,12 @@
 			})
 		}
 	}
+	const toEdit = () => {
+		$db.set('editItem', detailItem.value)
+		uni.navigateTo({
+			url: `/pages/release/index`
+		})
+	}
 </script>
 
 <style lang='scss'>

--
Gitblit v1.9.1