Przeglądaj źródła

fix: 派送列表暂存

GGDemo 1 miesiąc temu
rodzic
commit
49e0457410

+ 207 - 89
pages/waybillDeliveryOrder/index.vue

@@ -1,15 +1,43 @@
 <template>
 	<view class="list">
 		<view class="item" v-for="(item, i) in waybillDelivery">
-			<text class="code" :style="{ color: item.status ? 'green' : '#666' }">
-				{{ item.orderNum }}
-				{{ item.type }}
-			</text>
-			<uni-icons v-if="item.status" type="checkmarkempty" class="status" size="16" color="green"></uni-icons>
-			<text class="status fail" v-else>F</text>
-			<text style="margin-left: 10rpx; font-weight: 300">
-				{{ '\r\n' + item.createTime }}
-			</text>
+			<view class="order-no">
+				<text>
+					{{ item.order_no }}
+				</text>
+				<image @click="copyOrderNo(item.order_no)" class="icon" src="/static/copy.png" mode="aspectFill" />
+			</view>
+			<view class="address-info">
+				<view class="info">
+					<view class="user">
+						<text >
+							{{item.address.first_name + ' ' + item.address.last_name}}
+							{{'+'+item.address.mobile_code + ' ' + item.address.mobile}}
+						</text>
+						<image @click="callPhone(item.address.mobile_code +' '+ item.address.mobile)" class="icon"
+							src="/static/call.png" mode="aspectFill" />
+					</view>
+					<view>
+						<text class="address">
+							<text class="city">{{item.address.city}}</text>
+							{{item.address.zip_code}}
+						</text>
+						<image @click="copyOrderNo(item.address.zip_code)" class="icon" src="/static/copy.png"
+							mode="aspectFill" />
+					</view>
+				</view>
+				<view class="info">
+
+				</view>
+			</view>
+			<view></view>
+			<view class="operations">
+				<button v-for="(operation, i) in item.operations" :key="i" @click="resetForm" type="info"
+					size="mini">{{operation.text}}</button>
+			</view>
+
+
+
 		</view>
 
 		<view v-if="waybillDelivery.length === 0" class="is-empty">暂无派送单</view>
@@ -29,94 +57,184 @@
 </template>
 
 <script setup lang="ts">
-import { reactive, ref } from 'vue';
-import { onLoad, onNavigationBarButtonTap } from '@dcloudio/uni-app';
-import { pickupWaybillDeliveryOrderURL } from '@/utils/api.js';
-const loading = ref(false);
-const token = ref();
-const waybillDelivery = ref([]);
-const messageType = ref();
-const messageText = ref();
-const messageRef = ref();
-const showRightRef = ref();
-
-const resetForm = () => {};
-const confirmForm = () => {
-	showRightRef.value.close();
-};
-
-const getHistory = () => {
-	loading.value = true;
-	uni.request({
-		url: pickupWaybillDeliveryOrderURL + '/index',
-		method: 'GET',
-		header: {
-			batoken: token.value
-		},
-		success: ({ data }: any) => {
-			loading.value = false;
-			console.log(data);
-			if (data.code == 1) {
-				waybillDelivery.value = data.data.list;
-			} else {
-				messageType.value = 'error';
-				messageText.value = data.msg;
-				messageRef.value.open();
+	import { reactive, ref } from 'vue';
+	import { onLoad, onNavigationBarButtonTap } from '@dcloudio/uni-app';
+	import { pickupWaybillDeliveryOrderURL } from '@/utils/api.js';
+	const loading = ref(false);
+	const token = ref();
+	const waybillDelivery = ref([]);
+	const messageType = ref();
+	const messageText = ref();
+	const messageRef = ref();
+	const showRightRef = ref();
+
+	const resetForm = () => { };
+	const confirmForm = () => {
+		showRightRef.value.close();
+	};
+
+	const copyOrderNo = (order_no) => {
+		uni.setClipboardData({
+			data: order_no,
+			success: function () {
+				uni.showToast({
+					title: '复制成功',
+					icon: 'success',
+					duration: 2000
+				});
+			},
+			fail: function () {
+				console.log('复制失败');
+			}
+		});
+	}
+
+	const callPhone = (phoneNumber) => {
+		console.log(phoneNumber);
+		// #ifdef APP-PLUS
+		uni.makePhoneCall({
+			phoneNumber: phoneNumber,
+			success: function () {
+				console.log("拨打电话成功!")
+			},
+			fail: function () {
+				console.log("拨打电话失败!")
 			}
-		},
-		fail: (err) => {
-			loading.value = false;
+		})
+		// #endif
+
+		// #ifdef MP-WEIXIN
+		wx.makePhoneCall({
+			phoneNumber: phoneNumber,
+			success: function () {
+				console.log("拨打电话成功!")
+			},
+			fail: function () {
+				console.log("拨打电话失败!")
+			}
+		})
+		// #endif
+	}
+
+	const getHistory = () => {
+		loading.value = true;
+		uni.request({
+			url: pickupWaybillDeliveryOrderURL + '/index',
+			method: 'GET',
+			header: {
+				batoken: token.value
+			},
+			success: ({ data } : any) => {
+				loading.value = false;
+				console.log(data);
+				if (data.code == 1) {
+					waybillDelivery.value = data.data.list;
+				} else {
+					messageType.value = 'error';
+					messageText.value = data.msg;
+					messageRef.value.open();
+				}
+			},
+			fail: (err) => {
+				loading.value = false;
+			}
+		});
+	};
+	onLoad(() => {
+		token.value = uni.getStorageSync('token');
+		getHistory();
+	});
+	onNavigationBarButtonTap((event) => {
+		if (event.index === 0) {
+			showRightRef.value.open();
 		}
 	});
-};
-onLoad(() => {
-	token.value = uni.getStorageSync('token');
-	getHistory();
-});
-onNavigationBarButtonTap((event) => {
-	if (event.index === 0) {
-		showRightRef.value.open();
-	}
-});
 </script>
 
 <style lang="scss" scoped>
-.list {
-	margin: 0 auto;
-	display: flex;
-	flex-direction: column;
-	// justify-content: center;
-	align-items: center;
-	flex: 1;
-	// width: 100%;
-	.item {
-		margin-top: 20rpx;
-		width: 95%;
-		box-shadow: 0 5rpx 15rpx rgba(0, 0, 0, 0.2);
-		text-align: center;
-		border-radius: 10rpx;
-		// display: inline-block;
-		background-color: #fff;
-	}
-}
-.button-group {
-	margin-top: 15px;
-	display: flex;
-	flex-direction: row;
-	justify-content: space-around;
-
-	button {
+	.list {
+		margin: 0 auto;
 		display: flex;
+		flex-direction: column;
+		// justify-content: center;
 		align-items: center;
-		justify-content: center;
-		height: 35px;
-		width: 50%;
-		margin-left: 10px;
-		font-size: 16rpx;
+		flex: 1;
+
+		// width: 100%;
+		.item {
+			margin-top: 20rpx;
+			width: 95%;
+			box-shadow: 0 5rpx 15rpx rgba(0, 0, 0, 0.2);
+			border-radius: 20rpx;
+			background-color: #fff;
+
+			.order-no {
+				padding: 14rpx;
+				font-size: 16rpx;
+			}
+
+			.icon {
+				margin-left: 5rpx;
+				width: 24rpx;
+				height: 24rpx;
+			}
+
+			.address-info {
+				padding: 14rpx;
+				font-size: 16rpx;
+				margin-bottom: 10rpx;
+
+				.info {
+					display: flex;
+					flex-direction: column;
+
+					.user {
+						margin-bottom: 10rpx;
+						font-weight: bold;
+					}
+
+					.address {
+						.city {
+							font-size: 30rpx;
+							font-weight: bold;
+						}
+					}
+				}
+			}
+
+		}
 	}
 
-	.uni-icons {
-		margin-right: 10px;
+	.operations {
+		display: flex;
+		flex-direction: row;
+		justify-content: flex-end;
+		width: 100%;
+
+		button {
+			font-size: 16rpx;
+			margin: 10rpx;
+		}
+	}
+
+	.button-group {
+		margin-top: 15px;
+		display: flex;
+		flex-direction: row;
+		justify-content: space-around;
+
+		button {
+			display: flex;
+			align-items: center;
+			justify-content: center;
+			height: 35px;
+			width: 50%;
+			margin-left: 10px;
+			font-size: 16rpx;
+		}
+
+		.uni-icons {
+			margin-right: 10px;
+		}
 	}
-}
-</style>
+</style>

BIN
static/call.png


BIN
static/copy.png


+ 3 - 3
unpackage/dist/cache/.vite/deps/_metadata.json

@@ -1,8 +1,8 @@
 {
-  "hash": "adf7464e",
-  "configHash": "fd42d985",
+  "hash": "dcd2c785",
+  "configHash": "942b9c46",
   "lockfileHash": "e3b0c442",
-  "browserHash": "d1f8efbb",
+  "browserHash": "23c10dde",
   "optimized": {},
   "chunks": {}
 }

+ 0 - 0
unpackage/dist/dev/.vue-devtools/frontServer.js


+ 0 - 1
unpackage/dist/dev/.vue-devtools/port.js

@@ -1 +0,0 @@
-9098