瀏覽代碼

地址以及虚拟地址的联调;

郭鹏飞 8 月之前
父節點
當前提交
2911188cb8

+ 3 - 2
src/api/address.js

@@ -61,7 +61,7 @@ export function getAddrById(data) {
 export function getVirtualAddrByPhone(data) {
     return request({
         method: 'get',
-        url: '/tAddress/getVirtualAddressByPhone',
+        url: '/tAddress/wx/getVirtualAddressByPhone',
         data
     });
 }
@@ -77,9 +77,10 @@ export function netVirtualAddrAdd(data) {
 
 // 删除虚拟地址
 export function netVirtualAddrDel(data) {
+    let str = uni.$u.queryParams(data);
     return request({
         method: 'delete',
-        url: '/tAddress/deleteVirtualAddress',
+        url: `/tAddress/deleteVirtualAddress${str}`,
         data
     });
 }

+ 1 - 1
src/api/index.js

@@ -286,7 +286,7 @@ export function getCollect(data) {
 export function getJsLocation(data) {
     return request({
         method: 'post',
-        url: '/api/js/v1/wx/updateLocation',
+        url: '/api/js/v1/wx/updateLocation/f',
         data
     });
 }

+ 27 - 25
src/pages/address/index.vue

@@ -6,34 +6,36 @@
 		<z-paging ref="paging" bg-color="#f8f8f8" v-model="dataList" @query="queryList">
 			<view class="main-list">
 				<u-radio-group v-model="selected" placement="column" activeColor="#0879FF" @change="onChange">
-					<view class="mitem" v-for="(item, i) in dataList" :key="i">
-						<view class="info-box" @click="onClick(item)">
-							<view class="item-line atext">
-								<text class="name">{{ item.userName }}</text>
-								<text>{{ item.phone }}</text>
-								<template v-if="query.orderNo && item.type == 1">
-									<view class="default">默认</view>
-								</template>
-							</view>
-							<view class="btext" v-if="!!item.address">
-								<text>{{ item.name }} - </text>
-								<text>{{ item.address }}</text>
-								<text>{{ item.atlasAdd }}</text>
+					<template v-for="(item, i) in dataList">
+						<view class="mitem" :key="i" v-if="item.type != 2">
+							<view class="info-box" @click="onClick(item)">
+								<view class="item-line atext">
+									<text class="name">{{ item.userName }}</text>
+									<text>{{ item.phone }}</text>
+									<template v-if="query.orderNo && item.type == 1">
+										<view class="default">默认</view>
+									</template>
+								</view>
+								<view class="btext" v-if="!!item.address">
+									<text>{{ item.name }} - </text>
+									<text>{{ item.address }}</text>
+									<text>{{ item.atlasAdd }}</text>
+								</view>
 							</view>
-						</view>
-						<u-line length="100%" color="#eee" margin="14rpx 0 18rpx"></u-line>
-						<view class="actions">
-							<template v-if="!query.orderNo">
-								<u-radio :name="item.id" shape="square" label="设为常用地址" labelSize="26rpx"></u-radio>
-							</template>
-							<view class="right">
-								<text @click="onEdit(item)">编辑</text>
-								<text @click="onDel(item)">删除</text>
-								<!-- <image src="/static/identify/edit.png" />
-								<image src="/static/identify/delete.png" /> -->
+							<u-line length="100%" color="#eee" margin="14rpx 0 18rpx"></u-line>
+							<view class="actions">
+								<template v-if="!query.orderNo">
+									<u-radio :name="item.id" shape="square" label="设为常用地址" labelSize="26rpx"></u-radio>
+								</template>
+								<view class="right">
+									<text @click="onEdit(item)">编辑</text>
+									<text @click="onDel(item)">删除</text>
+									<!-- <image src="/static/identify/edit.png" />
+									<image src="/static/identify/delete.png" /> -->
+								</view>
 							</view>
 						</view>
-					</view>
+					</template>
 				</u-radio-group>
 			</view>
 

+ 33 - 15
src/pages/address/virtual.vue

@@ -105,17 +105,24 @@ export default {
 		this.query = query;
 	},
 	onShow() {
-		// this.getData();
+		let sl = uni.getStorageSync('staffLocation');
+		if (sl) {
+			this.selected = sl.addrId;
+			this.currentLocation = sl.address + sl.name;
+		}
+		this.getData();
 	},
 	methods: {
 		getData() {
-			getVirtualAddrByPhone({ phone: '19834500372' }).then(res => {
-				// console.log(1, res)
+			getVirtualAddrByPhone({ phone: this.query.phone }).then(res => {
+				if (res.data.code === 200) {
+					this.addressList = res.data.data;
+				}
 			});
 		},
 		// 选择地址(单选逻辑)
 		onChange(e) {
-			console.log(e)
+			// console.log(e)
 		},
 		// 点击我的位置
 		chooseLocation() {
@@ -144,17 +151,28 @@ export default {
 			const selected = this.addressList.find(item => item.id === this.selected);
 			if(selected) {
 				console.log('保存选中的地址:', selected);
-				// let params = {
-				// 	name: selected.name,
-				// 	address: selected.address,
-				// 	latitude: selected.latitude,
-				// 	longitude: selected.longitude,
-				// 	cOpenId: uni.getStorageSync('wx_copenid')
-				// }
-				// // 更新商户的位置
-				// getJsLocation(params).then(res => {
-				// 	uni.navigateBack();
-				// });
+				let params = {
+					id: this.query.id,
+					cPhone: this.query.phone,
+					name: selected.name,
+					address: selected.address,
+					latitude: selected.latitude,
+					longitude: selected.longitude,
+					cOpenId: uni.getStorageSync('wx_copenid')
+				}
+				// 更新商户的位置
+				getJsLocation(params).then(res => {
+                    uni.setStorageSync('staffLocation', {
+						addrId: selected.id,
+						name: selected.name,
+						address: selected.address,
+						latitude: selected.latitude,
+						longitude: selected.longitude,
+					});
+					if (res.data.code === 200) {
+						uni.navigateBack();
+					}
+				});
 			} else {
 				uni.$u.toast('请选择一个地址');
 			}

+ 1 - 0
src/pages/join/staff.vue

@@ -272,6 +272,7 @@ export default {
 		onSelect(e) {
 			this.form.city = e.value[0].label
 			this.form.deptId = e.value[0].value
+			this.show = false
 		},
 	},
 	mounted() {

+ 42 - 62
src/pages/staff/index.vue

@@ -2,14 +2,14 @@
 	<view class="center">
 		<view class="head">
 			<view class="left">
-				<image :src="$globalData.publicUrl+infoData.cPortrait" mode=""></image>
+				<image :src="$globalData.publicUrl + infoData.cPortrait" mode=""></image>
 			</view>
 			<view class="middle">
 				<view class="name">
-					{{infoData.cNickName}}
+					{{ infoData.cNickName || infoData.cName }}
 				</view>
 				<view class="address">
-					{{address}}
+					{{ infoData.address }} {{ infoData.name }}
 				</view>
 			</view>
 			<view class="right" @click="goAddress">
@@ -74,27 +74,43 @@
 				其他功能
 			</view>
 			<view class="fun_box">
-				<view class="function" @click="goOrder">
-					<image src="/static/other/order.png" mode=""></image>
-					<span class="order_num" v-if="orderNum>0">{{orderNum}}</span>
-					订单
-				</view>
-				<view class="function" @click="goFree">
-					<image src="/static/other/set.png" mode=""></image>
-					设置免车费
-				</view>
-				<view class="function" @click="goEdit">
-					<image src="/static/other/edit.png" mode=""></image>
-					编辑资料
-				</view>
-				<view class="function" @click="qrCodeShow">
-					<image src="/static/other/code.png" mode=""></image>
-					我的分销码
-				</view>
-				<view class="function" @click="qrCodeShow">
-					<image src="/static/other/contract.png" mode=""></image>
-					合同签订
-				</view>
+				<u-grid :border="false" col="5">
+					<u-grid-item>
+						<view class="function" @click="goOrder">
+							<u-badge absolute
+								:value="orderNum" 
+								:offset="[-4, -10]"
+								:customStyle="{ zIndex: 1 }"
+							></u-badge>
+							<image src="/static/other/icon-order.png" mode=""></image>
+							<text>订单</text>
+						</view>
+					</u-grid-item>
+					<u-grid-item>
+						<view class="function" @click="goFree">
+							<image src="/static/other/icon-set.png" mode=""></image>
+							<text>设置免车费</text>
+						</view>
+					</u-grid-item>
+					<u-grid-item>
+						<view class="function" @click="goEdit">
+							<image src="/static/other/icon-edit.png" mode=""></image>
+							<text>编辑资料</text>
+						</view>
+					</u-grid-item>
+					<u-grid-item>
+						<view class="function" @click="qrCodeShow">
+							<image src="/static/other/icon-code.png" mode=""></image>
+							<text>我的分销码</text>
+						</view>
+					</u-grid-item>
+					<u-grid-item>
+						<view class="function" @click="qrCodeShow">
+							<image src="/static/other/icon-contract.png" mode=""></image>
+							<text>合同签订</text>
+						</view>
+					</u-grid-item>
+				</u-grid>
 			</view>
 		</view>
 		<view class="work">
@@ -167,7 +183,6 @@
 				infoData: {},
 				cJsId: '',
 				onLine: '',
-				address: '',
 				orderNum: 0,
 				isAddBlank: false,
 				active: 0,
@@ -209,7 +224,6 @@
 				getMerchantData(params).then(res => {
 					if (res.data.code == 200 && res.data.data) {
 						this.cJsId = res.data.data.id
-						this.address = res.data.data.name
 						this.infoData = res.data.data
 						if (res.data.data.nStatus2 == '-1') { //未上岗
 							this.isWork = false
@@ -271,30 +285,13 @@
 			// 更换位置
 			goAddress() {
 				let str = uni.$u.queryParams({
+					id: this.cJsId,
 					name: this.infoData.cNickName,
 					phone: this.infoData.cPhone
 				});
 				uni.navigateTo({
 					url: `/pages/address/virtual${str}`
 				});
-				return;
-				uni.chooseLocation({
-					success: res => {
-						this.address = res.address;
-
-						let params = {
-							name: res.name,
-							address: this.address,
-							latitude: res.latitude,
-							longitude: res.longitude,
-							cOpenId: uni.getStorageSync('wx_copenid')
-						}
-						// 更新商户的位置
-						getJsLocation(params).then(res => {
-							this.getData();
-						});
-					}
-				});
 			},
 			// 报警
 			onWarning() {
@@ -651,33 +648,16 @@
 
 		.fun_box {
 			width: 100%;
-			display: flex;
-			justify-content: space-around;
 
 			.function {
 				font-size: 24rpx;
 				color: #2F3437;
 				line-height: 28rpx;
 				display: flex;
-				flex-direction: column;
 				align-items: center;
+				flex-direction: column;
 				position: relative;
 
-				.order_num {
-					position: absolute;
-					top: -10rpx;
-					right: -20rpx;
-					// width: 30rpx;
-					padding: 0px 10rpx;
-					height: 30rpx;
-					background-color: #fa3534;
-					border-radius: 30rpx;
-					color: #ffffff;
-					display: flex;
-					// align-items: center;
-					justify-content: center;
-				}
-
 				image {
 					width: 64rpx;
 					height: 64rpx;

二進制
src/static/other/icon-address.png


+ 0 - 0
src/static/other/code.png → src/static/other/icon-code.png


+ 0 - 0
src/static/other/contract.png → src/static/other/icon-contract.png


+ 0 - 0
src/static/other/edit.png → src/static/other/icon-edit.png


+ 0 - 0
src/static/other/order.png → src/static/other/icon-order.png


+ 0 - 0
src/static/other/set.png → src/static/other/icon-set.png