Browse Source

修改地址

shish 8 months ago
parent
commit
91987d52b2

+ 5 - 1
ghsApp/src/api/order/index.js

@@ -277,4 +277,8 @@ export const scanPay = data => https.get("/order/scan-pay", data);
 //扫码付款结果查询
 export const scanPayCheck = data => https.get("/order/scan-pay-check", data);
 
-export const getScanPayList = data => https.get("/scan-pay/list", data);
+export const getScanPayList = data => https.get("/scan-pay/list", data);
+
+export const modifyAddress = data => {
+	return https.post('/order/modify-address', data)
+}

+ 2 - 1
ghsApp/src/pages.json

@@ -119,7 +119,8 @@
 				{"path": "refundAllList","style": {"navigationBarTitleText": "售后记录", "enablePullDownRefresh": false}},
 				{"path": "bookChange","style": {"navigationBarTitleText": "变动记录", "enablePullDownRefresh": false}},
 				{"path": "combine","style": {"navigationBarTitleText": "分配结果", "enablePullDownRefresh": false}},
-				{"path": "printWlList","style": {"navigationBarTitleText": "打印物流列表", "enablePullDownRefresh": false}}
+				{"path": "printWlList","style": {"navigationBarTitleText": "打印物流列表", "enablePullDownRefresh": false}},
+				{"path": "modify","style": {"navigationBarTitleText": "修改地址", "enablePullDownRefresh": false}}
 			]
 		},
 		{

+ 5 - 1
ghsApp/src/pagesOrder/detail.vue

@@ -16,8 +16,9 @@
 						<i @click.stop="callUp(detailInfo.customMobile)" class="iconfont icondianhua1"></i>
 						<i @click.stop="navigateTo(detailInfo.lat,detailInfo.long,detailInfo.customName)" class="iconfont icondianhua"></i>
 					</view>
-					<button class="admin-button-com bule middle copy-address" @click.stop="copyCustom(detailInfo)">复制地址</button>
 				</view>
+				<button class="admin-button-com bule middle copy-address" style="position: absolute;top:90upx;right:28upx;" @click.stop="copyCustom(detailInfo)">复制地址</button>
+				<button class="admin-button-com default middle" style="position: absolute;top:180upx;right:28upx;" @click.stop="modifyAddress(detailInfo)">修改地址</button>
 			</view>
 
 			<view class="flex-space title" v-if="Number(detailInfo.sendStatus)>-2">配送进度</view>
@@ -828,6 +829,9 @@ export default {
 		goCustom(){
 			this.$util.pageTo({url: '/pagesClient/member/detail?id='+this.detailInfo.customId})
 		},
+		modifyAddress(){
+			this.$util.pageTo({url: '/pagesOrder/modify?id='+this.detailInfo.id})
+		},
 		copyCustom(detailInfo){
 			let customName = detailInfo.customName
 			let customMobile = detailInfo.customMobile

+ 205 - 0
ghsApp/src/pagesOrder/modify.vue

@@ -0,0 +1,205 @@
+<template>
+	<view class="app-content">
+		<form @submit="formSubmit">
+			<view class="module-com input-line-wrap">
+
+				<tui-list-cell class="line-cell" :hover="false" v-if="hasMap == 1">
+					<view class="tui-title">地址类型</view>
+					<button :class="[couldNavigation==1?'blue':'default']" class="admin-button-com middle" @click.stop="setStyle(1)" style="width:180upx;">支持导航</button>
+					<button :class="[couldNavigation==0?'blue':'default']" class="admin-button-com middle" style="width:180upx;margin-left:70upx;" @click.stop="setStyle(0)">不用导航</button>
+				</tui-list-cell>
+
+				<tui-list-cell class="line-cell" :hover="false" :arrow="true" @click="openAddres">
+					<view class="tui-title">城市</view>
+					<view class="tui-input" v-if="form.province || form.city">{{ form.province + '-' + form.city }}</view>
+					<view class="tui-placeholder" v-else>请选择</view>
+					<input v-model="form.province" name="province" hidden />
+				</tui-list-cell>
+
+				<tui-list-cell v-if="couldNavigation == 1" class="line-cell" :hover="false" :arrow="true" @click="selectRegion">
+					<view class="tui-title">地址</view>
+					<view v-if="form.address" class="tui-input">{{ form.address }}</view>
+					<view v-else class="tui-placeholder">请填写地址</view>
+					<input v-model="form.address" name="address" hidden />
+				</tui-list-cell>
+				<tui-list-cell v-else class="line-cell" :hover="false">
+					<view class="tui-title">地址</view>
+					<input v-model="form.address" placeholder-class="phcolor" class="tui-input" name="address" placeholder="请填写地址" />
+				</tui-list-cell>
+				<tui-list-cell class="line-cell" :hover="false">
+					<view class="tui-title ">门牌</view>
+					<input v-model="form.floor" placeholder-class="phcolor" class="tui-input" name="floor" placeholder="楼号门牌号,建议填写,方便查找"/>
+				</tui-list-cell>
+			</view>
+			<view class="confirm-btn">
+				<button class="admin-button-com big blue" formType="submit">提交</button>
+			</view>
+		</form>
+		<!-- 省市联动 -->
+		<simple-address ref="simpleAddress" :pickerValueDefault="cityPickerValueDefault" @onConfirm="onCityConfirm"></simple-address>
+		<!-- 选择地区 -->
+		<app-area-sel :show.sync="showRegion" :city="form.city" @change="changeAreaFn" />
+	</view>
+</template>
+
+<script>
+import TuiListCell from '@/components/plugin/list-cell'
+import SimpleAddress from '@/components/plugin/simple-address'
+import AppAreaSel from '@/components/app-area-sel'
+const form = require('@/utils/formValidation.js')
+import { modifyAddress } from '@/api/order'
+import {getHasMap} from "@/api/express"
+export default {
+	name: 'modify',
+	components: {
+		TuiListCell,
+		SimpleAddress,
+		AppAreaSel
+	},
+	data() {
+		return {
+			form: {
+				province: '',
+				city: '',
+				dist: '',
+				address: '',
+				floor: '',
+				showAddress:''
+			},
+			region:{lat:'',long:''},
+			regionData: {
+				lat: 0,
+				long: 0
+			},
+			cityPickerValueDefault: [0, 0],
+			showRegion: false,
+			hasMap: 0,
+			couldNavigation:1
+		}
+	},
+	onLoad() {
+	},
+	methods: {
+		setStyle(flag){
+			this.couldNavigation = flag
+			this.form.address = ''
+		},
+		onHere(){
+			this.form.province = '云南省'
+			this.form.city = '昆明市'
+		},
+		init() {
+			getHasMap().then(res=>{
+				this.hasMap = res.data.hasMap
+				if(this.hasMap == 0){
+					this.couldNavigation = 0
+				}else{
+					this.couldNavigation = 1
+				}
+			})
+		},
+		//省市联动
+		openAddres() {
+			this.$refs.simpleAddress.open()
+		},
+		onCityConfirm(e) {
+			this.form.province = e.provinceName
+			this.form.city = e.cityName
+			this.form.address = ''
+			this.form.showAddress = ''
+			this.region.lat = ''
+			this.region.long = ''
+		},
+		selectRegion() {
+			if (!this.form.city) {
+				this.$msg('请先选择城市!')
+				return false
+			}
+			this.showRegion = true
+		},
+		changeAreaFn(e) {
+			let locationStr = e.location
+			let fruits = locationStr.split(",").map(fruit => fruit.trim())
+
+			this.region.lat = fruits[1]
+			this.region.long = fruits[0]
+			this.form.showAddress = e.address
+			this.form.address = e.name
+
+			// 提取地区信息,按遇到第一个"市"字后,把"市"后面的字符串作为地区
+			const districtStr = e.district || '';
+			const cityIndex = districtStr.indexOf('市');
+			this.form.dist = cityIndex !== -1 ? districtStr.substring(cityIndex + 1) : districtStr;
+		},
+		confirmFn() {
+			let that = this
+			this.form.id = this.option.id ? this.option.id : 0
+			this.form = {...this.form, ...this.region}
+			uni.showLoading({mask:true})
+			modifyAddress(this.form).then(res=>{
+				if(res.code == 1){
+					that.$msg('修改成功')
+					setTimeout(() => {
+						uni.navigateBack({})
+					}, 1200)
+				}
+			})
+		},
+		formSubmit(e) {
+			let rules = [
+				{
+					name: 'province',
+					rule: ['required'],
+					msg: ['请选择城市']
+				},
+				{
+					name: 'address',
+					rule: ['required'],
+					msg: ['请填选地址']
+				}
+			]
+			let formData = e.detail.value
+			let checkRes = form.validation(formData, rules)
+			if (!checkRes) {
+				this.confirmFn()
+			} else {
+				this.$msg(checkRes)
+			}
+		},
+	}
+}
+</script>
+<style lang="scss" scoped>
+	.app-content {
+		min-height: calc(100vh - 20upx);
+		padding-top: 20upx;
+	}
+	.prompt-text {
+		color: $fontColor3;
+		padding-left: 30upx;
+		margin-bottom: 30upx;
+	}
+	.module-com {
+		margin-bottom: 20upx;
+		.member-wrap {
+			.member-det {
+				font-size: 24upx;
+				margin-left: 20upx;
+			}
+		}
+		.remark-wrap {
+			align-items: flex-start;
+			.remark {
+				height: 180upx;
+			}
+		}
+	}
+	// 按钮
+	.confirm-btn {
+		width: calc(100% - 60upx);
+		margin: 60upx 30upx 20upx;
+		.admin-button-com {
+			width: 100%;
+		}
+	}
+</style>