Browse Source

寄件更改(半完成)

sunChengjie 11 months ago
parent
commit
3bc8025c92
3 changed files with 198 additions and 65 deletions
  1. 2 2
      src/api/index.js
  2. 187 62
      src/pages/express.vue
  3. 9 1
      src/pages/myaddressbook.vue

+ 2 - 2
src/api/index.js

@@ -9,12 +9,12 @@ export function employee_login(data, config) {
 }
 
 // 寄件-寄件人信息
-export function getSendInfo(data) {
+export function getSendInfo(data, config) {
     return request({
         url: '/tianzong/client/without/getSendInfo',
         method: 'post',
         data: data,
-        emulateJSON: true
+        ...config,
     })
 }
 

+ 187 - 62
src/pages/express.vue

@@ -14,12 +14,14 @@
 					<div class="jjaddress" style="width: 100vw;">
 						<p style="flex: none;">寄</p>
 						<div>
-
-							<div class="address">
+							<van-field class="font-heigth" v-model="SendInfoValue.name" label="姓名" name="pattern"
+								placeholder="自动填充" />
+							<van-field class="font-heigth" v-model="SendInfoValue.phone" label="手机号" name="pattern"
+								placeholder="自动填充" />
+							<div class="address font-heigth">
 								<div class="address_label">地址</div>
 								<div class="address_text">{{ SendInfoValue.address }}</div>
 							</div>
-							<van-field v-model="SendInfoValue.phone" label="手机号" name="pattern" placeholder="自动填充" />
 						</div>
 					</div>
 					<!-- <div class="dzb" @click="link(1)">
@@ -31,10 +33,21 @@
 					<div class="jjaddress">
 						<p style="background: #fa9c22; flex:none;">收</p>
 						<div>
-							<van-field v-model="transmitMessageVlaue.addresseeName" name="" label="姓名"
-								placeholder="自动填充" />
-							<van-field v-model="transmitMessageVlaue.addresseePhone" label="手机号" name="pattern"
+							<van-field class="font-heigth" @click="changeAdderInfo"
+								v-model="transmitMessageVlaue.addresseeName" name="" label="姓名" placeholder="自动填充" />
+							<van-field class="font-heigth" @click="changeAdderInfo"
+								v-model="transmitMessageVlaue.addresseePhone" label="手机号" name="pattern"
 								placeholder="自动填充" />
+							<div class="address font-heigth" @click="changeAdderInfo">
+								<div class="address_label">地址</div>
+								<div class="address_label" style="color: #ccc;"
+									v-if="transmitMessageVlaue.addresseeProvince == undefined">自动填充
+								</div>
+								<div class="address_text" v-else>{{ transmitMessageVlaue.addresseeProvince }}{{
+									transmitMessageVlaue.addresseeCity }}{{ transmitMessageVlaue.addresseeCounty }}{{
+										transmitMessageVlaue.addresseeAddrInfo }}
+								</div>
+							</div>
 						</div>
 					</div>
 					<div class="dzb" @click="link(2)">
@@ -43,7 +56,6 @@
 					</div>
 				</div>
 			</div>
-
 		</div>
 
 		<!-- 快递公司 -->
@@ -75,7 +87,7 @@
 						<p>
 							<van-field name="Kilogram" style="padding: 0px;">
 								<template #input>
-									<van-stepper v-model="Kilogram" max="10"></van-stepper>
+									<van-stepper v-model="Kilogram" max="100"></van-stepper>
 								</template>
 							</van-field>
 						</p>
@@ -87,7 +99,7 @@
 						<p>
 							<van-field name="stepper" style="padding: 0px;">
 								<template #input>
-									<van-stepper v-model="stepper" max="10"></van-stepper>
+									<van-stepper v-model="stepper" max="100"></van-stepper>
 								</template>
 							</van-field>
 						</p>
@@ -140,6 +152,39 @@
 			<van-button type="info" color="#00c4b8" @click="save()">立即寄件</van-button>
 		</div>
 
+		<!-- 填写地址 -->
+
+		<van-popup position="bottom" :style="{ height: '70%' }" v-model="adderInfoShow" class="whrite_add">
+			<div class="recognition">
+				<van-cell-group inset>
+					<van-field style="height: auto;" v-model="discernMessage" rows="1" label="识别" type="textarea"
+						placeholder="请粘贴,点击识别(姓名、手机号、省、市、区、详细地址间请输入空格)" />
+				</van-cell-group>
+				<div style="background-color: white;width: 100%;height: .8rem;padding-top: .2rem;">
+					<van-button @click="shibie()" style="width: 15%;height: .6rem;float: right; margin-right: .2rem;"
+						color="#00c4b8" block type="info" size="small">识别</van-button>
+				</div>
+			</div>
+
+			<div class="adderMessage">
+				<p style="font-size: 16px;text-align: center;margin-bottom: 16px;">{{ title }}</p>
+				<van-form @submit="onSubmit">
+					<van-field v-model="discern.name" name="姓名" label="姓名" placeholder="自动填充"
+						:rules="[{ required: false }]" />
+					<van-field v-model="discern.phone" maxlength="11" type="number" name="手机" label="手机"
+						placeholder="自动填充" :rules="[{ required: false }]" />
+					<van-field readonly clickable name="area" :value="discern.proDisTown" label="省市区镇"
+						placeholder="自动填充" />
+					<van-field v-model="discern.address" maxlength="50" name="详细地址" label="详细地址" placeholder="自动填充"
+						:rules="[{ required: false }]" />
+					<div style="margin-top: 16px;">
+						<van-button :disabled="disabled" color="#00c4b8" block type="info"
+							native-type="submit">保存</van-button>
+					</div>
+				</van-form>
+			</div>
+		</van-popup>
+
 		<!-- 弹窗物品类型 -->
 		<van-popup v-model="wpshow" position="bottom">
 			<van-picker title="物品类型" show-toolbar :columns="wplist" @confirm="onConfirm1" @cancel="wpshow = false" />
@@ -169,11 +214,13 @@
 <script>
 import areaList from "@/script/areas.js"
 import { Toast } from 'vant';
-import { saveMailDo, getSendInfo, geLogisticsList, getListOfPrinters, storagePrintSmallTab, getWxConfig } from '../api/index'
+import { saveMailDo, getSendInfo, geLogisticsList, getListOfPrinters, } from '../api/index'
+import { spiltAddress, editUserAddressInfoById } from '../api/addressBoook'
 export default {
 
 	data() {
 		return {
+			qweqwe: '',
 			titlename: "寄件",
 			wptype: "物品",//物品类型
 			addresstype: "顾客邮购",//地址类型
@@ -198,7 +245,6 @@ export default {
 			expressInfo: "1",//快递公司传值
 			columns: [],//快递公司列表
 			columns2: ["个人件", "公司件"],
-			// transmitMessageVlaue: {},
 			declaredValue: '0', //声明价值
 			showPicker2: false,
 			goodOrderNo: '',//商品订单编号
@@ -218,6 +264,19 @@ export default {
 			printerShow: false,//打印机出现
 			printerName: '',//选中的打印机名称
 			printerId: '',//选中的打印机id
+			adderInfoShow: false,//收件人信息弹框
+			discernMessage: '',//识别信息
+			discern: {
+				name: '',
+				phone: '',
+				province: '',
+				city: '',
+				district: '',
+				town: '',
+				address: '',
+				proDisTown: '',
+			},//识别后的信息
+			disabled: false,//确定按钮的使用
 		}
 	},
 	created: function () {
@@ -225,7 +284,7 @@ export default {
 		this.geLogisticsListAPIList()
 	},
 	async mounted() {
-		const res = await getSendInfo({ userId: localStorage.getItem("userId") })
+		const res = await getSendInfo({ userId: localStorage.getItem("userId") }, { emulateJSON: true, loading: true, message: '获取寄件人信息...' })
 		if (res.code == 444) {
 			Toast(res.msg)
 		} else {
@@ -290,6 +349,94 @@ export default {
 
 		},
 
+		// 收件人信息弹框
+		changeAdderInfo() {
+			this.adderInfoShow = true
+		},
+		async shibie() {
+			if (this.discernMessage == '') {
+				Toast('请粘贴地址')
+				return
+			}
+			const res = await spiltAddress({ address: this.discernMessage })
+			if (res.prov) {
+				this.discern.name = res.per
+				this.discern.phone = res.tel
+				this.discern.province = res.prov
+				this.discern.city = res.city
+				this.discern.district = res.district
+				this.discern.town = res.town
+				this.discern.address = res.addr_info
+				this.discern.proDisTown = res.prov + res.city + res.district + res.town
+			} else {
+				Toast('请求失败')
+			}
+			console.log(res, 'res')
+		},
+		// 保存修改收件人信息
+		async onSubmit() {
+			if (this.discern.name == '' || this.discern.name == undefined) {
+				Toast('请输入姓名')
+				return
+			}
+
+			if (this.discern.phone == '' || this.discern.phone == undefined) {
+				Toast('请填写手机号')
+				return
+			}
+
+			if (this.discern.phone != '' && this.discern.phone != undefined) {
+				let regPhone = new RegExp(this.$store.state.regPhone)
+				if (!regPhone.test(this.discern.phone)) {
+					Toast('手机号格式不正确')
+					return
+				}
+			}
+
+			if (this.discern.province == '' || this.discern.province == undefined) {
+				Toast('请输入省')
+				return
+			}
+			if (this.discern.city == '' || this.discern.city == undefined) {
+				Toast('请输入市')
+				return
+			}
+			if (this.discern.district == '' || this.discern.district == undefined) {
+				Toast('请输入区')
+				return
+			}
+			if (this.discern.city == '' || this.discern.city == undefined) {
+				Toast('请输入镇')
+				return
+			}
+
+			if (this.discern.address == '' || this.discern.address == undefined) {
+				Toast('请输入详细地址')
+				return
+			}
+			this.adderInfoShow = false
+
+			this.transmitMessageVlaue.addresseeProvince = this.discern.province
+			this.transmitMessageVlaue.addresseeCity = this.discern.city
+			this.transmitMessageVlaue.addresseeCounty = this.discern.district
+			this.transmitMessageVlaue.addresseeName = this.discern.name
+			this.transmitMessageVlaue.addresseePhone = this.discern.phone
+
+			this.discern = {
+				name: '',
+				phone: '',
+				province: '',
+				city: '',
+				district: '',
+				town: '',
+				address: '',
+				proDisTown: '',
+			}
+			this.discernMessage = ''
+
+		},
+
+
 		// 财务核销码哦icon扫描
 		async vxSearchIcon() {
 			console.log('123')
@@ -297,8 +444,6 @@ export default {
 				needResult: 1, // 默认为0,扫描结果由微信处理,1则直接返回扫描结果,
 				scanType: ["qrCode", "barCode"], // 可以指定扫二维码还是一维码,默认二者都有
 				success: (res) => {
-					//alert(res)
-					console.log(res, '==============')
 					var result = res.resultStr; // 当needResult 为 1 时,扫码返回的结果
 					if (result.indexOf(",") != -1) {
 						let result1 = res.resultStr.split(",");
@@ -348,11 +493,6 @@ export default {
 		// 选择物品确定
 		onConfirm1(e) {//确定
 			this.wptype = e
-			// if (this.wptype == '文件') {
-			// 	this.max = '10'
-			// } else {
-			// 	this.max = '1'
-			// }
 			this.wpshow = false
 		},
 		// 选择付款方式确定
@@ -407,10 +547,6 @@ export default {
 				Toast('请选择付款方式')
 				return
 			}
-			// if (this.authorization == '' & this.SendInfoValue.isVerification == 1) {
-			// 	Toast('请填写财务核销码')
-			// 	return
-			// }
 			let payWay = ''
 			let mainType = ''
 			if (this.pricetype == "自费(个人件)") {
@@ -429,7 +565,6 @@ export default {
 
 			const getPrinters = await getListOfPrinters({})
 			if (getPrinters.data.length == []) {
-				// return this.shipServe()
 				return Toast('请先绑定打印机')
 			}
 			if (getPrinters.code == 0) {
@@ -458,34 +593,12 @@ export default {
 				Toast('系统异常')
 			}
 			return
-
-
 		},
 
 		async onPrinter(e) {
-			console.log(e, 'eeeeeeeeeeeeeee')
-			// const toask = this.$toast.loading({
-			// 	duration: 0, // 持续展示 toast
-			// 	forbidClick: true,
-			// 	message: '加载中',
-			// });
 			this.printerName = e.printerName;
 			this.printerId = e.id;
-
 			await this.shipServe(e.id)
-
-			// 开始走打印机面单
-			// try {
-			// 	const res = await storagePrintSmallTab({ printId: e.id })
-			// 	if (res.msg == 'success') {
-			// 		Toast('打印成功')
-			// 	}
-			// 	console.log(res, '最后')
-			// 	this.printerShow = false;
-			// } catch (error) {
-
-			// }
-			// toask.clear();
 		},
 
 		async shipServe(printId) {
@@ -520,7 +633,7 @@ export default {
 				expressWeight: this.Kilogram,//公斤
 				expressPrice: this.declaredValue,//价值
 				phone: this.SendInfoValue.phone,//寄件人手机号
-				addresseeName: this.transmitMessageVlaue.addresseeName,//件人姓名
+				addresseeName: this.transmitMessageVlaue.addresseeName,//件人姓名
 				addresseePhone: this.transmitMessageVlaue.addresseePhone,//收件人手机号
 				verificationCode: this.authorization, //财务核销码
 				printId: printId
@@ -593,6 +706,7 @@ export default {
 
 			.jj {
 				display: flex;
+				align-items: center;
 				// justify-content: space-between;
 				padding: .2rem 0rem;
 
@@ -613,7 +727,7 @@ export default {
 
 					.van-cell::after {
 						margin-left: -16px;
-						// width: 100%;
+						width: 100%;
 					}
 
 
@@ -634,15 +748,8 @@ export default {
 
 					div {
 
-						//font-weight: bold;
-						p:nth-of-type(1) {
-							font-size: .24rem;
-							color: #333;
-							margin-bottom: .2rem;
-						}
-
-						p:nth-of-type(2) {
-							font-size: .3rem;
+						.font-heigth {
+							padding: 4px 0;
 						}
 					}
 				}
@@ -650,13 +757,12 @@ export default {
 				.dzb {
 					text-align: center;
 					border-left: .01rem solid #ededed;
-					padding-left: .3rem;
-					width: 36px;
+					padding-left: .2rem;
+					width: 42px;
 
 					img {
 						width: .39rem;
 						height: .42rem;
-						padding-top: .2rem;
 					}
 
 					p {
@@ -888,14 +994,33 @@ export default {
 }
 
 .whrite_add {
-	width: 6.6rem;
-	padding: .4rem .2rem;
+	width: 100vw;
+	background-color: #f8f8f8;
+
+	.recognition {
+
+		padding: .3rem;
+
+		/deep/.van-field__value {
+			input {
+				text-align: right;
+			}
+
+		}
+	}
+
+	.adderMessage {
+		padding: 0rem .3rem;
+	}
 
 	/deep/.van-field__value {
 		input {
 			text-align: right;
 		}
+	}
 
+	/deep/ .van-field--min-height .van-field__control {
+		min-height: 72px;
 	}
 
 	/deep/.van-popup__close-icon--top-right {

+ 9 - 1
src/pages/myaddressbook.vue

@@ -9,7 +9,9 @@
 							<p style="background: #00c4b8;">收</p>
 							<div :id="'copytkl' + item.id">
 								<p>{{ item.addresseeName }} {{ item.addresseePhone }}</p>
-								<p>{{ item.addresseeAddress }} </p>
+								<p>{{ item.addresseeProvince }}{{
+									item.addresseeCity }}{{ item.addresseeCounty }}{{
+										item.addresseeAddrInfo }} </p>
 							</div>
 						</div>
 						<div class="cz">
@@ -134,6 +136,12 @@ export default {
 			transmitMessageVlaue.createTime = item.createTime
 			transmitMessageVlaue.id = item.id
 			transmitMessageVlaue.userId = item.userId
+			transmitMessageVlaue.addresseeAddrInfo = item.addresseeAddrInfo
+			transmitMessageVlaue.addresseeCity = item.addresseeCity
+			transmitMessageVlaue.addresseeCounty = item.addresseeCounty
+			transmitMessageVlaue.addresseeProvince = item.addresseeProvince
+			transmitMessageVlaue.addresseeTown = item.addresseeTown
+			transmitMessageVlaue.sendNum = item.sendNum
 			this.$store.commit('getTransmitMessageVlaue', transmitMessageVlaue);
 			this.$router.push({ path: "/Express" })
 		},