瀏覽代碼

fix: 暂存

GGDemo 1 月之前
父節點
當前提交
4c1a6a71a5
共有 2 個文件被更改,包括 358 次插入340 次删除
  1. 355 337
      pages/waybillDeliveryOrder/index.vue
  2. 3 3
      unpackage/dist/cache/.vite/deps/_metadata.json

+ 355 - 337
pages/waybillDeliveryOrder/index.vue

@@ -1,7 +1,7 @@
 <template>
 	<view class="list">
-		<uni-search-bar @confirm="search" :focus="true" v-model="searchValue" @blur="blur" @focus="focus" @input="input" @cancel="cancel" @clear="clear"></uni-search-bar>
-		<!-- <uni-easyinput v-model="valiFormData.orderNum" placeholder="请输入单号" suffixIcon="scan" :focus="focusType" @iconClick="scan" /> -->
+		<!-- <uni-search-bar @confirm="search" :focus="true" v-model="searchValue" @blur="blur" @focus="focus" @input="input" @cancel="cancel" @clear="clear"></uni-search-bar> -->
+		<uni-easyinput v-model="searchValue" placeholder="请输入单号" suffixIcon="scan" :focus="focus" @iconClick="scanInput" />
 		<view class="item" v-for="(item, i) in waybillDelivery">
 			<view class="order-no">
 				<text>
@@ -16,21 +16,24 @@
 							{{ 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" />
+						<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" />
+						<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="onButtonClick(item, operation.value)" type="info" size="mini">{{ operation.text }}</button>
+				<button v-for="(operation, i) in item.operations" :key="i" @click="onButtonClick(item, operation.value)"
+					type="info" size="mini">{{ operation.text }}</button>
 			</view>
 		</view>
 
@@ -51,367 +54,382 @@
 </template>
 
 <script setup lang="ts">
-import { reactive, ref } from 'vue';
-import { onLoad, onNavigationBarButtonTap } from '@dcloudio/uni-app';
-import { pickupWaybillDeliveryOrderURL, sendOutURL, deliveredURL, refuseURL, createTrackPodURL, cancelFedExPickUpURL } from '@/utils/api.js';
-const loading = ref(false);
-const loadingBtn = ref(false);
-const token = ref();
-const searchValue = 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
+	import { reactive, ref } from 'vue';
+	import permision from '@/common/permission.js';
+	import { onLoad, onNavigationBarButtonTap } from '@dcloudio/uni-app';
+	import { pickupWaybillDeliveryOrderURL, sendOutURL, deliveredURL, refuseURL, createTrackPodURL, cancelFedExPickUpURL } from '@/utils/api.js';
+	const loading = ref(false);
+	const loadingBtn = ref(false);
+	const token = ref();
+	const searchValue = 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('拨打电话失败!');
+			}
+		});
+		// #endif
+
+		// #ifdef MP-WEIXIN
+		wx.makePhoneCall({
+			phoneNumber: phoneNumber,
+			success: function () {
+				console.log('拨打电话成功!');
+			},
+			fail: function () {
+				console.log('拨打电话失败!');
+			}
+		});
+		// #endif
+	};
+
+	const checkPermission = async () => {
+		let status = permision.isIOS ? await permision.requestIOS('camera') : await permision.requestAndroid('android.permission.CAMERA');
+
+		if (status === null || status === 1) {
+			status = 1;
+		} else {
+			uni.showModal({
+				content: 'Camera permission required',
+				confirmText: 'Setting',
+				success: function (res) {
+					if (res.confirm) {
+						permision.gotoAppSetting();
+					}
+				}
 			});
-		},
-		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('拨打电话失败!');
-		}
-	});
-	// #endif
-
-	// #ifdef MP-WEIXIN
-	wx.makePhoneCall({
-		phoneNumber: phoneNumber,
-		success: function () {
-			console.log('拨打电话成功!');
-		},
-		fail: function () {
-			console.log('拨打电话失败!');
-		}
-	});
-	// #endif
-};
-
-const search = (res) => {
-	uni.showToast({
-		title: '搜索:' + res.value,
-		icon: 'none'
-	});
-};
-const input = (res) => {
-	console.log('----input:', res);
-};
-const clear = (res) => {
-	uni.showToast({
-		title: 'clear事件,清除值为:' + res.value,
-		icon: 'none'
-	});
-};
-const blur = (res) => {
-	uni.showToast({
-		title: 'blur事件,输入值为:' + res.value,
-		icon: 'none'
-	});
-};
-const focus = (e) => {
-	uni.showToast({
-		title: 'focus事件,输出值为:' + e.value,
-		icon: 'none'
-	});
-};
-const cancel = (res) => {
-	uni.showToast({
-		title: '点击取消,输入值为:' + res.value,
-		icon: 'none'
-	});
-};
-
-const onButtonClick = async (row, value) => {
-	if (value === 'send_out') {
-		sendOut({ id: row.id });
-	} else if (value === 'delivered') {
-		//确认送达
-		updateDelivered({ id: row.id });
-	} else if (value === 'refuse') {
-		updateRefuse({ id: row.id });
-	} else if (value === 'create_track_pod') {
-		createTrackPod({ id: row.id });
-	} else if (value === 'edit') {
-		// baTable.form.items = row;
-		// baTable.form.operate = 'edit';
-	} else if (value === 'generate_label') {
-		// baTable.form.items = row;
-		// generateLabelForm.id = row.id;
-		// generateLabelVisible.value = true;
-	} else if (value === 'fedex_appointment_pick_up') {
-		// baTable.form.items = row;
-		// baTable.form.operate = 'FedExPickUp';
-	} else if (value === 'print_get_back_label') {
-		// toPrintRetrieve(row);
-	} else if (value === 'fedex_cancel_pick_up') {
-		cancelFedExPickUp({ id: row.id });
+		return status;
 	}
-};
-
-const sendOut = (data) => {
-	loadingBtn.value = true;
-	uni.request({
-		url: sendOutURL,
-		method: 'POST',
-		header: {
-			batoken: token.value
-		},
-		data: data,
-		success: ({ data }: any) => {
-			loadingBtn.value = false;
-			messageType.value = 'success';
-			messageText.value = '发出成功';
-			messageRef.value.open();
-		},
-		fail: (err) => {
-			loadingBtn.value = false;
-			messageType.value = 'error';
-			messageText.value = '发出失败,请稍后重试';
-			messageRef.value.open();
-		}
-	});
-};
-
-const updateDelivered = (data) => {
-	loadingBtn.value = true;
-	uni.request({
-		url: deliveredURL,
-		method: 'POST',
-		header: {
-			batoken: token.value
-		},
-		data: data,
-		success: ({ data }: any) => {
-			loadingBtn.value = false;
-			messageType.value = 'success';
-			messageText.value = '确认送达成功';
-			messageRef.value.open();
-		},
-		fail: (err) => {
-			loadingBtn.value = false;
-			messageType.value = 'error';
-			messageText.value = '确认送达失败,请稍后重试';
-			messageRef.value.open();
-		}
-	});
-};
-
-const updateRefuse = (data) => {
-	loadingBtn.value = true;
-	uni.request({
-		url: refuseURL,
-		method: 'POST',
-		header: {
-			batoken: token.value
-		},
-		data: data,
-		success: ({ data }: any) => {
-			loadingBtn.value = false;
-			messageType.value = 'success';
-			messageText.value = '已拒绝签收';
-			messageRef.value.open();
-		},
-		fail: (err) => {
-			loadingBtn.value = false;
-			messageType.value = 'error';
-			messageText.value = '修改失败,请稍后重试';
-			messageRef.value.open();
-		}
-	});
-};
-
-const createTrackPod = (data) => {
-	loadingBtn.value = true;
-	uni.request({
-		url: createTrackPodURL,
-		method: 'POST',
-		header: {
-			batoken: token.value
-		},
-		data: data,
-		success: ({ data }: any) => {
-			loadingBtn.value = false;
-			messageType.value = 'success';
-			messageText.value = '同步成功';
-			messageRef.value.open();
-		},
-		fail: (err) => {
-			loadingBtn.value = false;
-			messageType.value = 'error';
-			messageText.value = '同步失败,请稍后重试';
-			messageRef.value.open();
+
+
+	const scanInput = async () => {
+		// #ifdef APP-PLUS
+		let status = await checkPermission();
+		if (status !== 1) {
+			return;
 		}
-	});
-};
-
-const cancelFedExPickUp = (data) => {
-	loadingBtn.value = true;
-	uni.request({
-		url: cancelFedExPickUpURL,
-		method: 'POST',
-		header: {
-			batoken: token.value
-		},
-		data: data,
-		success: ({ data }: any) => {
-			loadingBtn.value = false;
-			messageType.value = 'success';
-			messageText.value = '操作成功';
-			messageRef.value.open();
-		},
-		fail: (err) => {
-			loadingBtn.value = false;
-			messageType.value = 'error';
-			messageText.value = '操作失败,请稍后重试';
-			messageRef.value.open();
+		// #endif
+		uni.scanCode({
+			success: (res : any) => {
+				// valiFormData.value.order_code = res.result;
+				// onsubmit();
+			},
+			fail: (err) => {
+				// 需要注意的是小程序扫码不需要申请相机权限
+			}
+		});
+
+	};
+
+	const focus = (e) => {
+		uni.showToast({
+			title: 'focus事件,输出值为:' + e.value,
+			icon: 'none'
+		});
+	};
+
+	const onButtonClick = async (row, value) => {
+		if (value === 'send_out') {
+			sendOut({ id: row.id });
+		} else if (value === 'delivered') {
+			//确认送达
+			updateDelivered({ id: row.id });
+		} else if (value === 'refuse') {
+			updateRefuse({ id: row.id });
+		} else if (value === 'create_track_pod') {
+			createTrackPod({ id: row.id });
+		} else if (value === 'edit') {
+			// baTable.form.items = row;
+			// baTable.form.operate = 'edit';
+		} else if (value === 'generate_label') {
+			// baTable.form.items = row;
+			// generateLabelForm.id = row.id;
+			// generateLabelVisible.value = true;
+		} else if (value === 'fedex_appointment_pick_up') {
+			// baTable.form.items = row;
+			// baTable.form.operate = 'FedExPickUp';
+		} else if (value === 'print_get_back_label') {
+			// toPrintRetrieve(row);
+		} else if (value === 'fedex_cancel_pick_up') {
+			cancelFedExPickUp({ id: row.id });
 		}
-	});
-};
-
-const getList = () => {
-	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 {
+	};
+
+	const sendOut = (data) => {
+		loadingBtn.value = true;
+		uni.request({
+			url: sendOutURL,
+			method: 'POST',
+			header: {
+				batoken: token.value
+			},
+			data: data,
+			success: ({ data } : any) => {
+				loadingBtn.value = false;
+				messageType.value = 'success';
+				messageText.value = '发出成功';
+				messageRef.value.open();
+			},
+			fail: (err) => {
+				loadingBtn.value = false;
+				messageType.value = 'error';
+				messageText.value = '发出失败,请稍后重试';
+				messageRef.value.open();
+			}
+		});
+	};
+
+	const updateDelivered = (data) => {
+		loadingBtn.value = true;
+		uni.request({
+			url: deliveredURL,
+			method: 'POST',
+			header: {
+				batoken: token.value
+			},
+			data: data,
+			success: ({ data } : any) => {
+				loadingBtn.value = false;
+				messageType.value = 'success';
+				messageText.value = '确认送达成功';
+				messageRef.value.open();
+			},
+			fail: (err) => {
+				loadingBtn.value = false;
 				messageType.value = 'error';
-				messageText.value = data.msg;
+				messageText.value = '确认送达失败,请稍后重试';
 				messageRef.value.open();
 			}
-		},
-		fail: (err) => {
-			loading.value = false;
+		});
+	};
+
+	const updateRefuse = (data) => {
+		loadingBtn.value = true;
+		uni.request({
+			url: refuseURL,
+			method: 'POST',
+			header: {
+				batoken: token.value
+			},
+			data: data,
+			success: ({ data } : any) => {
+				loadingBtn.value = false;
+				messageType.value = 'success';
+				messageText.value = '已拒绝签收';
+				messageRef.value.open();
+			},
+			fail: (err) => {
+				loadingBtn.value = false;
+				messageType.value = 'error';
+				messageText.value = '修改失败,请稍后重试';
+				messageRef.value.open();
+			}
+		});
+	};
+
+	const createTrackPod = (data) => {
+		loadingBtn.value = true;
+		uni.request({
+			url: createTrackPodURL,
+			method: 'POST',
+			header: {
+				batoken: token.value
+			},
+			data: data,
+			success: ({ data } : any) => {
+				loadingBtn.value = false;
+				messageType.value = 'success';
+				messageText.value = '同步成功';
+				messageRef.value.open();
+			},
+			fail: (err) => {
+				loadingBtn.value = false;
+				messageType.value = 'error';
+				messageText.value = '同步失败,请稍后重试';
+				messageRef.value.open();
+			}
+		});
+	};
+
+	const cancelFedExPickUp = (data) => {
+		loadingBtn.value = true;
+		uni.request({
+			url: cancelFedExPickUpURL,
+			method: 'POST',
+			header: {
+				batoken: token.value
+			},
+			data: data,
+			success: ({ data } : any) => {
+				loadingBtn.value = false;
+				messageType.value = 'success';
+				messageText.value = '操作成功';
+				messageRef.value.open();
+			},
+			fail: (err) => {
+				loadingBtn.value = false;
+				messageType.value = 'error';
+				messageText.value = '操作失败,请稍后重试';
+				messageRef.value.open();
+			}
+		});
+	};
+
+	const getList = () => {
+		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');
+		getList();
+	});
+	onNavigationBarButtonTap((event) => {
+		if (event.index === 0) {
+			showRightRef.value.open();
 		}
 	});
-};
-onLoad(() => {
-	token.value = uni.getStorageSync('token');
-	getList();
-});
-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;
-	.uni-searchbar {
-		width: calc(100% - 40rpx);
-	}
-	.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;
-		}
+	.list {
+		margin: 0 auto;
+		display: flex;
+		flex-direction: column;
+		// justify-content: center;
+		align-items: center;
+		flex: 1;
 
-		.icon {
-			margin-left: 5rpx;
-			width: 24rpx;
-			height: 24rpx;
+		.uni-searchbar {
+			width: calc(100% - 40rpx);
 		}
 
-		.address-info {
-			padding: 14rpx;
-			font-size: 16rpx;
-			margin-bottom: 10rpx;
+		.item {
+			margin-top: 20rpx;
+			width: 95%;
+			box-shadow: 0 5rpx 15rpx rgba(0, 0, 0, 0.2);
+			border-radius: 20rpx;
+			background-color: #fff;
 
-			.info {
-				display: flex;
-				flex-direction: column;
+			.order-no {
+				padding: 14rpx;
+				font-size: 16rpx;
+			}
 
-				.user {
-					margin-bottom: 10rpx;
-					font-weight: bold;
-				}
+			.icon {
+				margin-left: 5rpx;
+				width: 24rpx;
+				height: 24rpx;
+			}
+
+			.address-info {
+				padding: 14rpx;
+				font-size: 16rpx;
+				margin-bottom: 10rpx;
+
+				.info {
+					display: flex;
+					flex-direction: column;
 
-				.address {
-					.city {
-						font-size: 30rpx;
+					.user {
+						margin-bottom: 10rpx;
 						font-weight: bold;
 					}
+
+					.address {
+						.city {
+							font-size: 30rpx;
+							font-weight: bold;
+						}
+					}
 				}
 			}
 		}
 	}
-}
 
-.operations {
-	display: flex;
-	flex-direction: row;
-	justify-content: flex-end;
-	width: 100%;
+	.operations {
+		display: flex;
+		flex-direction: row;
+		justify-content: flex-end;
+		width: 100%;
 
-	button {
-		font-size: 16rpx;
-		margin: 10rpx;
+		button {
+			font-size: 16rpx;
+			margin: 10rpx;
+		}
 	}
-}
 
-.button-group {
-	margin-top: 15px;
-	display: flex;
-	flex-direction: row;
-	justify-content: space-around;
-
-	button {
+	.button-group {
+		margin-top: 15px;
 		display: flex;
-		align-items: center;
-		justify-content: center;
-		height: 35px;
-		width: 50%;
-		margin-left: 10px;
-		font-size: 16rpx;
-	}
+		flex-direction: row;
+		justify-content: space-around;
 
-	.uni-icons {
-		margin-right: 10px;
+		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>

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

@@ -1,8 +1,8 @@
 {
-  "hash": "adf7464e",
-  "configHash": "fd42d985",
+  "hash": "f40f3ae4",
+  "configHash": "d35ae346",
   "lockfileHash": "e3b0c442",
-  "browserHash": "d1f8efbb",
+  "browserHash": "63a7975d",
   "optimized": {},
   "chunks": {}
 }