瀏覽代碼

地址页面更换;
增加vuex文件;

郭鹏飞 9 月之前
父節點
當前提交
3482158c0a

+ 1 - 1
src/api/index.js

@@ -475,7 +475,7 @@ export function getCityList(data) {
 }
 
 // 获取部门车费
-export function tFareSetting(data) {
+export function getFareSetting(data) {
     return request({
         method: 'get',
         url: '/tFareSetting/selectAll',

+ 1 - 5
src/components/date/select_time.vue

@@ -26,7 +26,6 @@
 				<view class="btn" v-else>
 					选择上门时间
 				</view>
-
 			</view>
 		</view>
 	</view>
@@ -90,10 +89,6 @@
 				let date = this.selectDay + ' ' + this.selectTim
 				this.$emit('dateSend', date);
 			}
-		},
-		mounted() {
-
-
 		}
 	}
 </script>
@@ -105,6 +100,7 @@
 		position: fixed;
 		top: 0;
 		left: 0;
+		z-index: 10075;
 		background: rgba(0, 0, 0, 0.4);
 
 		.content {

+ 3 - 0
src/main.js

@@ -15,6 +15,9 @@ Vue.prototype.$globalData = {
 	publicUrl: baseUrl
 }
 
+import store from './store'
+Vue.prototype.$store = store
+
 Vue.config.productionTip = false
 
 App.mpType = 'app'

+ 29 - 38
src/pages.json

@@ -7,24 +7,13 @@
 	},
 	"pages": [
 		{
-			"path": "pages/demo/settings",
+			"path": "pages/demo/order-detail",
 			"style": {
-				"navigationBarTitleText": "demo",
-				"navigationStyle": "custom"
-			}
-		},
-		{
-			"path": "pages/moments/index",
-			"style": {
-				"navigationBarTitleText": "demo",
-				"navigationStyle": "custom"
-			}
-		},
-		{
-			"path": "pages/moments/add",
-			"style": {
-				"navigationBarTitleText": "demo",
-				"navigationStyle": "custom"
+				"navigationBarTitleText": "广誉源",
+				"app-plus": {
+					"softinputNavBar": "none",
+					"titleNView": false
+				}  
 			}
 		},
 		{
@@ -248,37 +237,39 @@
 				}  
 			}
 		},
-		//添加地址
 		{
-			"path": "pages/my/add_address",
+			"path": "pages/address/index",
 			"style": {
-				"navigationBarTitleText": "添加地址",
-				"navigationBarBackgroundColor": "#2cb8d4",
-				"navigationBarTextStyle": "white",
-				"app-plus": {
-					"softinputNavBar": "none",
-					"titleNView": false
-				}  
+				"navigationBarTitleText": "我的地址",
+				"navigationStyle": "custom"
 			}
 		},
-		//选择地址
 		{
-			"path": "pages/my/select_position",
+			"path": "pages/address/address-edit",
 			"style": {
-				"navigationBarTitleText": "选择地址",
-				"navigationBarBackgroundColor": "#2cb8d4",
-				"navigationBarTextStyle": "white",
-				"app-plus": {
-					"softinputNavBar": "none",
-					"titleNView": false
-				}  
+				"navigationBarTitleText": "编辑地址",
+				"navigationStyle": "custom"
 			}
 		},
-		//评论
 		{
-			"path": "pages/my/remember",
+			"path": "pages/moments/index",
 			"style": {
-				"navigationBarTitleText": "评论商户",
+				"navigationBarTitleText": "社区动态",
+				"navigationStyle": "custom"
+			}
+		},
+		{
+			"path": "pages/moments/add",
+			"style": {
+				"navigationBarTitleText": "发布动态",
+				"navigationStyle": "custom"
+			}
+		},
+		//选择地址
+		{
+			"path": "pages/my/select_position",
+			"style": {
+				"navigationBarTitleText": "选择地址",
 				"navigationBarBackgroundColor": "#2cb8d4",
 				"navigationBarTextStyle": "white",
 				"app-plus": {

+ 77 - 39
src/pages/demo/address-edit.vue → src/pages/address/address-edit.vue

@@ -1,6 +1,6 @@
 <template>
     <view class="page-container">
-        <u-navbar title="编辑地址" :autoBack="true" placeholder border></u-navbar>
+        <!-- <u-navbar title="编辑地址" :autoBack="true" placeholder border></u-navbar> -->
 
         <view class="content-body">
             <view class="header-row">
@@ -17,27 +17,28 @@
                 labelWidth="140rpx" 
 				:model="form" :rules="rules"
 			>
-                <view v-if="!addressData.name" class="location-box empty-state" @click="chooseLocation">
-                    <text>选择收货地址</text>
+                <view v-if="!form.address" class="location-box empty-state" @click="chooseLocation">
+                    <text>选择地址</text>
                     <u-icon name="arrow-right" color="#00e0b5" size="14" style="margin-left: 6rpx;"></u-icon>
                 </view>
 
                 <view v-else class="location-box filled-state">
                     <view class="addr-info">
-                        <view class="addr-name">{{ addressData.name }}</view>
-                        <view class="addr-detail">{{ addressData.address }}</view>
+                        <view class="addr-name">{{ form.name }}</view>
+                        <view class="addr-detail">{{ form.address }}</view>
                     </view>
                     <view class="edit-btn" @click="chooseLocation">
                         修改地址
                     </view>
-                    <!-- 隐藏的表单项,用于校验 -->
-                    <u-form-item prop="address" style="display: none;"></u-form-item>
                 </view>
 
                 <view class="form-section">
-                    <u-form-item label="详细地址" prop="detail">
+                    <!-- 隐藏的表单项,用于校验 -->
+                    <u-form-item prop="address" style="display: none;"></u-form-item>
+
+                    <u-form-item label="详细地址" prop="atlasAdd">
                         <view class="input-wrapper">
-                            <u-input v-model="form.detail" placeholder="小区、写字楼、门牌号等" border="none"
+                            <u-input v-model="form.atlasAdd" placeholder="小区、写字楼、门牌号等" border="none"
                                 fontSize="14px"></u-input>
                         </view>
                     </u-form-item>
@@ -48,9 +49,9 @@
                         </view>
                     </u-form-item>
 
-                    <u-form-item label="手机号" prop="mobile">
+                    <u-form-item label="手机号" prop="phone">
                         <view class="input-wrapper">
-                            <u-input v-model="form.mobile" placeholder="手机号" type="number" border="none"
+                            <u-input v-model="form.phone" placeholder="手机号" type="number" border="none"
                                 fontSize="14px"></u-input>
                         </view>
                     </u-form-item>
@@ -68,25 +69,39 @@
 </template>
 
 <script>
+import {
+    addUpdate,
+    updateAdd,
+    addDetails,
+    defaultAdd
+} from '@/api/index';
 export default {
     data() {
         return {
+            query: {},
             isDefault: false, // 是否默认地址
-            // 定位数据
-            addressData: {
-                name: '信达国际金融中心',
-                address: '山西省太原市万柏林区迎泽西大街86号'
-            },
             form: {
-                detail: '',
-                mobile: '',
+                phone: '',
                 userName: '',
+                atlasAdd: '',
             },
             rules: {
-				city: [
+				phone: [
 					{
 						required: true,
-						message: '请输入首选城市',
+						message: '请输入手机号',
+						trigger: ['blur', 'change']
+					},
+                    {
+                        pattern: /^1([3589]\d|4[01456879]|6[0-9]|7[0-8])\d{8}$/, 
+                        message: '请输入正确的手机号格式', 
+                        trigger: ['blur', 'change']
+					}
+				],
+				userName: [
+					{
+						required: true,
+						message: '请输入姓名',
 						trigger: ['blur', 'change']
 					}
 				],
@@ -94,36 +109,59 @@ export default {
 				address: [{ required: true, message: '请选择地址信息', trigger: ['change'] }],
             }
         };
+    },
+    onLoad(query) {
+        this.query = query;
+        if (query.id) this.getData(); else this.isDefault = true;
     },
 	onReady() {
 		// 页面加载完成后为表单设置规则
 		this.$refs.uForm.setRules(this.rules);
 	},
     methods: {
-        // 模拟选择地图定位
+        getData() {
+            addDetails({
+                id: this.query.id
+            }).then(res => {
+                this.form = res.data.data;
+                this.isDefault = this.form.type == 1;
+            });
+        },
+        // 选择地图定位
         chooseLocation() {
-            uni.showToast({ title: '打开地图选点...', icon: 'none' });
-            // 实际开发中调用 uni.chooseLocation
-            // uni.chooseLocation({
-            //   success: (res) => {
-            //     this.addressData = {
-            //       name: res.name,
-            //       address: res.address
-            //     };
-            //   }
-            // });
-
-            // 仅演示切换状态:
-            if (!this.addressData.name) {
-                this.addressData = { name: '测试地点', address: '测试详细地址...' };
-            }
+            uni.chooseLocation({
+                success: (res) => {
+                    // form赋值
+                    this.form = {
+                        ...this.form,
+                        name: res.name,
+                        address: res.address,
+                        latitude: res.latitude,
+                        longitude: res.longitude,
+                    }
+                }
+            });
         },
         onSubmit() {
             this.$refs.uForm.validate().then(res => {
-                console.log('保存', this.form, this.addressData);
-				uni.$u.toast('校验通过')
+                let api = addUpdate;
+                let params = {
+                    ...this.form,
+                    type: this.isDefault ? 1: 0,
+                    openid: uni.getStorageSync('wx_copenid'),
+                };
+                // console.log('保存', params);
+                if (this.query.id) api = updateAdd;
+                api(params).then(res => {
+                    uni.$u.toast(res.data.msg);
+                    if (res.data.code == 200) {
+                        setTimeout(() => {
+                            uni.navigateBack();
+                        }, 500);
+                    }
+                });
 			}).catch(errors => {
-                console.log(errors)
+                // console.log(errors)
                 let f = errors.some(item => ['address'].indexOf(item.field) !== -1);
 				if (f) uni.$u.toast(errors[0].message);
 			})

+ 246 - 0
src/pages/address/index.vue

@@ -0,0 +1,246 @@
+<template>
+	<view class="page-container">
+		<!-- 自定义导航栏 -->
+		<!-- <u-navbar title="我的地址" :autoBack="true" :placeholder="true"></u-navbar> -->
+
+		<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>
+							</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" /> -->
+							</view>
+						</view>
+					</view>
+				</u-radio-group>
+			</view>
+
+			<!-- 底部操作栏 -->
+			<view class="footer-bar" slot="bottom">
+				<u-button
+					text="新增地址信息"
+					@click="onAdd"
+				></u-button>
+			</view>
+		</z-paging>
+	</view>
+</template>
+
+<script>
+import {
+	delAdd,
+	addList,
+	defaultAdd,
+	addDetails,
+	updateOrder,
+} from '@/api/index.js';
+export default {
+	data() {
+		return {
+			query: {},
+			dataList: [],
+			selected: '',
+		}
+	},
+	computed: {
+		initParams() {
+			let params = {
+				appUserId: uni.getStorageSync('user')?.userInfo?.id,
+				// defaultFlag: 1
+			};
+			return params;
+		}
+	},
+	onLoad(query) {
+		this.query = query;
+	},
+	onShow() {
+		this.canReset && this.$refs.paging.reload();
+		this.canReset = true;
+	},
+	methods: {
+		// 获取数据
+		queryList(pageNo, pageSize) {
+			let params = {
+				current: pageNo,
+				size: pageSize,
+				openId: uni.getStorageSync('wx_copenid'),
+			}
+			addList(params).then(res => {
+				if (res.data.code === 200) {
+					this.selected = res.data.data.find(item => item.type == 1)?.id;
+					this.$refs.paging.complete(res.data.data);
+				} else {
+					this.$refs.paging.complete(false);
+				}
+			});
+		},
+		// 设置默认
+		onChange(e) {
+			defaultAdd({
+				id: e,
+				openId: uni.getStorageSync('wx_copenid'),
+			}).then(res => {
+				if (res.data.code === 200) {
+					this.$refs.paging.reload();
+				} else {
+					uni.$u.toast(res.data.msg);
+				}
+			});
+		},
+		// 编辑
+		onEdit(item) {
+			let params = {
+				id: item.id,
+			};
+			let str = uni.$u.queryParams(params);
+			uni.navigateTo({
+				url: `/pages/address/address-edit${str}`
+			});
+		},
+		// 删除
+		onDel(item) {
+			uni.showModal({
+				title: '确认删除',
+				content: `确定要删除该条数据吗?`,
+				success: (res) => {
+					if (res.confirm) {
+						delAdd({ idList: item.id }).then(res => {
+							uni.$u.toast(res.data.msg);
+							if (res.data.code == 200) {
+								this.$refs.paging.reload();
+							}
+						});
+					}
+				}
+			});
+		},
+		// 添加
+		onAdd() {
+			uni.navigateTo({
+				url: `/pages/address/address-edit`
+			});
+		},
+		// 点选
+		onClick(item) {
+			console.log(item)
+			if (this.query.name === '支付订单' && this.query.orderNo) {
+				let params = {
+					cId: this.query.orderNo,
+					cName: item.userName,
+					cPhone: item.phone,
+					name: item.name,
+					address: item.address,
+					atlasAdd: item.atlasAdd,
+					latitude: item.latitude,
+					longitude: item.longitude,
+				}
+				updateOrder(params).then(res => {
+					if (res.data.code == 200) {
+						uni.navigateBack();
+					} else {
+						uni.$u.toast(res.data.msg);
+					}
+				});
+			}
+		},
+	}
+}
+</script>
+
+<style scoped lang="scss">
+.page-container {
+	height: 100vh;
+	display: flex;
+	flex-direction: column;
+}
+.main-list {
+	flex: 1;
+	padding: 24rpx;
+	.mitem {
+		padding: 20rpx;
+		margin-bottom: 24rpx;
+		background: #FFFFFF;
+		box-shadow: 0 4rpx 16rpx 0 rgba(176,176,176,0.05);;
+		border-radius: 12rpx;
+		.item-line {
+			display: flex;
+			align-items: center;
+		}
+		.info-box {
+			flex: 1;
+			.atext {
+				font-weight: 400;
+				font-size: 30rpx;
+				color: #333;
+			}
+			.btext {
+				font-weight: 400;
+				font-size: 28rpx;
+				color: #2F3437;
+				margin-top: 12rpx;
+			}
+			.name {
+				font-weight: 500;
+				margin-right: 10rpx;
+			}
+		}
+		.actions {
+			font-weight: 400;
+			font-size: 28rpx;
+			color: var(--theme-color);
+			display: flex;
+			align-items: center;
+			justify-content: space-between;
+			.right {
+				gap: 24rpx;
+				display: flex;
+				align-items: center;
+			}
+		}
+		.default {
+			font-weight: 400;
+			font-size: 28rpx;
+			color: #F35031;
+			margin-left: 20rpx;
+			padding: 2rpx 12rpx;
+			background: rgba(243,80,49,0.1);
+			border-radius: 8rpx;
+		}
+	}
+}
+
+.footer-bar {
+	::v-deep .u-button {
+		height: 76rpx;
+		font-weight: 500;
+		font-size: 28rpx;
+		color: #FFFFFF;
+		margin: 0;
+		background: var(--theme-color);
+		border-radius: 8rpx;
+	}
+}
+</style>

+ 50 - 9
src/pages/demo/settings.vue

@@ -1,10 +1,10 @@
 <template>
     <view class="settings-container">
         <view class="card-box user-info flex">
-            <u-avatar :src="userInfo.avatar" size="100rpx" default-url="/static/common/avatar.png"></u-avatar>
+            <u-avatar :src="dataInfo.cIcon" size="100rpx" default-url="/static/common/avatar.png"></u-avatar>
             <view class="info">
-                <view class="name">{{ userInfo.nickname }}</view>
-                <view class="date">{{ userInfo.regDate }} 注册</view>
+                <view class="name">{{ dataInfo.cNickName }}</view>
+                <view class="date">{{ dataInfo.createTime }} 注册</view>
             </view>
         </view>
 
@@ -23,7 +23,7 @@
         </view>
 
         <view class="card-box">
-            <u-cell title="客服电话" value="4006565666" :border="false"></u-cell>
+            <u-cell title="客服电话" :value="dataInfo.mobile" :border="false" @click="onPhoneCall(dataInfo.mobile)"></u-cell>
         </view>
 
         <view class="footer-bar">
@@ -45,15 +45,20 @@
 </template>
 
 <script>
+import {
+    logout,
+    getInfo,
+} from '@/api/index.js';
 import ServiceTimePicker from '@/components/picker/service-time.vue';
 export default {
     components: { ServiceTimePicker },
     data() {
         return {
-            userInfo: {
-                avatar: 'https://cdn.uviewui.com/uview/album/1.jpg', 
-                nickname: '赵青青',
-                regDate: '2025.10.01'
+            dataInfo: {
+                cIcon: 'https://cdn.uviewui.com/uview/album/1.jpg', 
+                cNickName: '赵青青',
+                createTime: '2025.10.01',
+                mobile: ''
             },
 
             occupiedTimes: [
@@ -64,14 +69,50 @@ export default {
             ],
         }
     },
+    onShow() {
+		this.getData();
+    },
     methods: {
         handleTimeConfirm(val) {
             // val 是一个数组: ['2026-01-02 12:10', '2026-01-02 14:10']
             console.log('获取到的数据:', val);
+        },
+		// 用户数据
+		getData() {
+			this.dataInfo = {};
+			getInfo().then(res => {
+				if (res.data.code == 200) {
+					this.dataInfo = res.data.data;
+					uni.setStorageSync('wx_copenid', res.data.data.cOpenid);
+				}
+			})
+		},
+        onPhoneCall(n) {
+            if (!n) return;
+            uni.makePhoneCall({
+                phoneNumber: n 
+            });
         },
         onLogout() {
             this.$refs.stp.show = true;
-            // uni.showModal({ title: '提示', content: '确定退出登录吗?' });
+            return;
+            uni.showModal({
+				title: '确定退出登录吗',
+				success: (res) => {
+					if (res.confirm) {
+						logout().then(res => {
+							if (res.data.code == 200) {
+								uni.removeStorageSync('access-token')
+								this.$router.go(0)
+								uni.showToast({
+									title: '已退出登录',
+									icon: 'none'
+								})
+							}
+						});
+					}
+				}
+			});
         }
     }
 }

+ 4 - 4
src/pages/identify/details.vue

@@ -206,13 +206,13 @@ export default {
 							uni.showModal({
 								title: '提示',
 								content: '你还没有添加地址哦!是否去添加?',
-								confirmText: '确定', // 确定按钮的文字
-								cancelText: '取消', // 取消按钮的文字
-								success(res) {
+								confirmText: '确定', 
+								cancelText: '取消', 
+								success: (res) => {
 									if (res.confirm) {
 										setTimeout(() => {
 											uni.navigateTo({
-												url: '../my/add_address?type=1'
+												url: '/pages/address/address-edit?type=1'
 											})
 										}, 100)
 										// 用户点击确定按钮后的操作

+ 3 - 3
src/pages/identify/identify.vue

@@ -457,13 +457,13 @@
 					uni.showModal({
 						title: '提示',
 						content: '你还没有添加地址哦!是否去添加?',
-						confirmText: '确定', // 确定按钮的文字
-						cancelText: '取消', // 取消按钮的文字
+						confirmText: '确定', 
+						cancelText: '取消', 
 						success(res) {
 							if (res.confirm) {
 								setTimeout(() => {
 									uni.navigateTo({
-										url: '../my/add_address'
+										url: '/pages/address/address-edit'
 									})
 								}, 100)
 								// 用户点击确定按钮后的操作

文件差異過大導致無法顯示
+ 350 - 510
src/pages/identify/pay_order.vue


+ 1 - 1
src/pages/index/details.vue

@@ -266,7 +266,7 @@
 			// 				if (res.confirm) {
 			// 					setTimeout(() => {
 			// 						uni.navigateTo({
-			// 							url: '../my/add_address'
+			// 							url: '/pages/address/address-edit'
 			// 						})
 			// 					}, 100)
 			// 					// 用户点击确定按钮后的操作

+ 0 - 302
src/pages/my/add_address.vue

@@ -1,302 +0,0 @@
-<template>
-	<view class="addAddress">
-		<view class="form">
-			<view class="head">
-				<span>地址信息</span>
-				<view class="checked_box" @click="goExhibits">
-					<!-- <view class="checked" v-if="item.type == 0"></view> -->
-					<view class="select" v-if="type == 0">
-						<image src="../../static/identify/round.png" mode=""></image>
-					</view>
-					<view class="select" v-else>
-						<image src="../../static/identify/select.png" mode=""></image>
-					</view>
-					默认地址
-				</view>
-			</view>
-			<view class="item">
-				<view class="title">
-					姓名
-				</view>
-				<view class="inp">
-					<input class="weui-input" name="input" v-model="form.userName" placeholder="输入您的姓名" />
-				</view>
-			</view>
-			<view class="item">
-				<view class="title">
-					手机号
-				</view>
-				<view class="inp">
-					<input class="weui-input" placeholder="手机号" v-model="form.phone" />
-				</view>
-			</view>
-			<view class="item">
-				<view class="title">
-					所在地区
-				</view>
-				<view class="inp" @click="getAddress" v-if="form.address !== ''">
-					<!-- 	<input class="weui-input" name="input" v-model="form.userName" placeholder="姓名(必填)" /> -->
-					{{form.address}}{{form.name}}
-				</view>
-				<view class="inp street" @click="getAddress" v-else>
-					省、市、区、街道
-				</view>
-			</view>
-			<view class="item">
-				<view class="title">
-					详细地址
-				</view>
-				<view class="inp">
-					<input class="weui-input" name="input" v-model="form.atlasAdd" placeholder="列:1号楼一层101室" />
-				</view>
-			</view>
-		</view>
-		<view class="addbtn">
-			<button type="primary" @click="save">{{btnName}}</button>
-		</view>
-	</view>
-</template>
-<script>
-	import {
-		addUpdate,
-		addDetails,
-		updateAdd,
-		addList,
-		defaultAdd
-	} from '../../api/index'
-	export default {
-		data() {
-			return {
-				btnName: '保存',
-				type: 0,
-				form: {
-					userName: '',
-					phone: '',
-					atlasAdd: '',
-					openid: '',
-					type: 0,
-					latitude: '',
-					longitude: '',
-					name: '',
-					address: '',
-				},
-				pos_name: '',
-				latitude: '',
-				longitude: '',
-				requestBody: {},
-				err: '',
-				saveAddress: {
-					latitude: '',
-					longitude: '',
-					name: '',
-					address: '',
-				},
-			}
-		},
-		methods: { //设为默认地址
-			goExhibits() {
-				// this.checkedIndex = index
-				var id = {
-					id: this.id,
-					openid: uni.getStorageSync('wx_copenid'),
-				}
-				defaultAdd(id).then(res => {
-					if (res.data.code == 200) {
-						this.getList()
-						uni.showToast({
-							title: '设置默认地址成功!',
-							icon: 'none'
-						})
-					}
-				})
-			},
-			getAddress() {
-				uni.chooseLocation({
-					success: res => {
-						this.form.name = res.name;
-						this.form.latitude = res.latitude;
-						this.form.longitude = res.longitude;
-						this.form.address = res.address
-					}
-				});
-			},
-			save() {
-				this.form.openid = uni.getStorageSync('wx_copenid')
-				// this.form.address = JSON.stringify(this.saveAddress)
-				if (this.form.userName === '') {
-					uni.showToast({
-						title: '请输入姓名',
-						icon: 'none'
-					})
-					return
-				}
-				if (!/^1[3456789]\d{9}$/.test(this.form.phone)) {
-					uni.showToast({
-						title: '请输入正确的手机号',
-						icon: 'none'
-					});
-					return;
-				}
-				if (this.form.address == '') {
-					uni.showToast({
-						title: '请选择地址',
-						icon: 'none'
-					});
-					return;
-				}
-				if (this.btnName == '修改地址') {
-					// this.form.type = 
-					updateAdd(this.form).then(res => {
-						if (res.data.code == 200) {
-							uni.showToast({
-								title: '修改成功',
-							})
-							setTimeout(function() {
-								uni.navigateBack()
-							}, 500)
-						}
-					})
-				} else {
-					this.form.type = this.type
-					// this.requestBody = this.form
-					addUpdate(this.form).then(res => {
-						// console.log(res,"添加成功之后的数据")
-						if (res.data.code == 200) {
-							uni.showToast({
-								title: '添加成功',
-							})
-							setTimeout(function() {
-								uni.navigateBack()
-							}, 500)
-						} else {
-
-							this.err = res.msg
-						}
-					})
-				}
-
-
-			}
-			// onChooseLocation() {
-			// 	uni.navigateTo({
-			// 		url: './select_position'
-			// 	})
-			// },
-		},
-		mounted() {},
-		onShow() {
-			uni.getLocation({
-				type: 'wgs84',
-				success: function(res) {}
-			});
-		},
-		onLoad(options) {
-
-			this.type = options.type
-			if (options.id) {
-				addDetails({
-					id: options.id
-				}).then(res => {
-					this.form = res.data.data,
-						// this.saveAddress = JSON.parse(res.data.data.address),
-						// this.address = JSON.parse(res.data.data.address),
-						this.btnName = '修改地址',
-						console.log(this.saveAddress)
-				})
-			} else {}
-
-		},
-	}
-</script>
-
-<style lang="scss" scoped>
-	.addAddress {
-		background-color: #f8f8f8;
-		height: 100vh;
-		padding: 40rpx 32rpx;
-		box-sizing: border-box;
-	}
-
-	.head {
-		width: 100%;
-		display: flex;
-		justify-content: space-between;
-		margin-bottom: 20px;
-
-		.checked_box {
-			width: 128rpx;
-			display: flex;
-			align-items: center;
-			font-size: 24rpx;
-
-			.select {
-				display: flex;
-				align-items: center;
-
-				image {
-					width: 24rpx;
-					height: 24rpx;
-					margin-right: 8rpx;
-				}
-			}
-
-		}
-	}
-
-	.form {
-		background: #FFFFFF;
-		box-shadow: 0px 4rpx 12rpx 0px rgba(88, 209, 187, 0.05);
-		border-radius: 20rpx 20rpx 20rpx 20rpx;
-		padding: 32rpx 24rpx;
-
-		.item {
-			width: 100%;
-			display: flex;
-			align-items: center;
-			font-size: 26rpx;
-			margin-bottom: 20rpx;
-
-			.title {
-				width: 104rpx;
-				color: #333333;
-				margin-right: 20rpx;
-			}
-
-			.inp {
-				flex: 1;
-				height: 64rpx;
-				border-radius: 8rpx 8rpx 8rpx 8rpx;
-				border: 2rpx solid #EEEEEE;
-				padding-left: 24rpx;
-
-			}
-
-			.street {
-				font-size: 26rpx;
-				color: #999999;
-				line-height: 64rpx;
-			}
-		}
-	}
-
-	.addbtn {
-		position: fixed;
-		bottom: 30px;
-		width: 100%;
-		// background-color: #fff;
-		// border-top: 1px solid #ccc;
-		padding-top: 15px;
-		padding-bottom: 10px;
-
-		button {
-			margin: 0 50px;
-			background: linear-gradient(90deg, #1AD7CE 0%, #21C9C1 100%);
-			border-radius: 106rpx;
-		}
-	}
-
-	::v-deep.weui-input {
-		height: 100%;
-		font-size: 26rpx;
-	}
-</style>

+ 10 - 10
src/pages/my/engineerCenter.vue

@@ -313,9 +313,9 @@
 				}
 				getMerchantData(openid).then(res => {
 					console.log(res)
-					this.address = res.data.data.name
-					this.cJsId = res.data.data.id
-					if (res.data.code == 200) {
+					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
 						this.id = res.data.data.id
 						if (res.data.data.nStatus2 == '-1') { //未上岗
@@ -323,14 +323,14 @@
 						} else if (res.data.data.nStatus2 == '0') { //以上
 							this.isWork = true
 						}
+						let data = {
+							cJsId: this.cJsId
+						}
+						waitOrder(data).then(res => {
+							console.log(res)
+							this.orderNum = res.data.data
+						})
 					}
-					let data = {
-						cJsId: this.cJsId
-					}
-					waitOrder(data).then(res => {
-						console.log(res)
-						this.orderNum = res.data.data
-					})
 				})
 			},
 			qrCodeShow() {

+ 13 - 9
src/pages/my/my.vue

@@ -60,13 +60,13 @@
 		<view class="card-box">
 			<view class="card-header">
 				<text class="card-title">我的订单</text>
-				<view class="more flex">
+				<view class="more flex" @click="goToPage({ path: '/pages/order/order', code: 100 }, 'tab')">
 					<text>全部</text>
 					<u-icon name="arrow-right" size="24rpx" top="1" color="#999"></u-icon>
 				</view>
 			</view>
 			<view class="order-card">
-				<view class="item" v-for="(item, index) in orderIcons" :key="index" @click="goToPage(item)">
+				<view class="item" v-for="(item, index) in orderIcons" :key="index" @click="goToPage(item, 'tab')">
 					<u-badge v-if="item.badge > 0" absolute
 						:value="item.badge" 
 						:offset="[-4, -10]"
@@ -141,13 +141,13 @@ export default {
 			// 审核
 			auditStatus: -1,
 			orderIcons: [
-				{ title: '待付款', icon: '/static/other/feedback.png', path: '', badge: 0 },
-				{ title: '进行中', icon: '/static/other/home.png', path: '', badge: 0 },
-				{ title: '待评价', icon: '/static/other/personal.png', path: '', badge: 0 },
-				{ title: '已取消', icon: '/static/other/complain.png', path: '', badge: 0 },
+				{ title: '待付款', icon: '/static/other/feedback.png', path: '/pages/order/order', code: -1, badge: 0 },
+				{ title: '进行中', icon: '/static/other/home.png', path: '/pages/order/order', code: 10, badge: 0 },
+				{ title: '待评价', icon: '/static/other/personal.png', path: '/pages/order/order', code: 4, badge: 0 },
+				{ title: '已取消', icon: '/static/other/complain.png', path: '/pages/order/order', code: -10, badge: 0 },
 			],
 			moreFunctions: [
-				{ title: '地址管理', icon: '/static/other/address.png', path: '/pages/my/remember' },
+				{ title: '地址管理', icon: '/static/other/address.png', path: '/pages/address/index' },
 				{ title: '招商合作', icon: '/static/other/feedback.png', path: '/pages/join/teamwork' },
 				{ title: '商户入驻', icon: '/static/other/home.png', path: '/pages/join/first_join' },
 				{ title: '商户中心', icon: '/static/other/personal.png', path: '/pages/my/engineerCenter' },
@@ -247,7 +247,7 @@ export default {
 			})
 		},
 		// 功能区跳转
-		goToPage(item) {
+		goToPage(item, type = 'to') {
 			// console.log(`跳转到: ${item.title}`);
 			if (item.path) {
 				if (!this.$utils.checkLogin({ type: 'modal' })) return;
@@ -260,7 +260,11 @@ export default {
 					uni.$u.toast(text);
 					return;
 				}
-				uni.navigateTo({ url: item.path });
+				// 订单为tab页面,需要特定处理
+				if (item.path === '/pages/order/order') {
+					this.$store.dispatch('setOrderTab', item.code);
+				}
+				uni.$u.route({ url: item.path, type });
 			} else {
 				uni.$u.toast('开发中');
 			}

+ 0 - 347
src/pages/my/remember.vue

@@ -1,347 +0,0 @@
-<template>
-	<view class="listAll">
-		<!-- <navbar pageName="地址管理"></navbar> -->
-		<view class="list" v-if="list.length == 0">
-			<view class="nodata">
-				<image src="../../static/identify/logo.png" mode=""></image>
-				<view>还没有录入地址呦~</view>
-			</view>
-			<!-- 			<ul v-else>
-				<li v-for="(item,index) in list" :key="index" :class="item.type == 1? 'active' : ''" @click="goExhibits(item,item.id,index)">
-					<view class="checked"></view>
-					<view class="add" >
-						<view class="address">
-							{{item.address}}{{item.name}}{{item.atlasAdd}}
-						</view>
-						<view class="namePhone">{{item.userName}}  <span>{{item.phone}}</span></view>
-					</view>
-					<view class="edior">
-						<view class="edit" @click.stop="edit(item.id)">编辑</view>
-						<view class="del" @click.stop="del(item.id,item.type)">删除</view>
-					</view>
-				</li>
-			</ul> -->
-		</view>
-		<view class="address_list" v-else>
-			<view class="address" v-for="(item,index) in list" :key="index">
-				<!-- <view class="checked"></view> -->
-				<view class="add">
-					<view class="data">
-						{{item.address}} {{item.name}} {{item.atlasAdd}}
-					</view>
-					<view class="checked_box" @click="goExhibits(item,item.id,index)">
-						<!-- <view class="checked" v-if="item.type == 0"></view> -->
-						<view class="select" v-if="item.type == 0">
-							<image src="../../static/identify/round.png" mode=""></image>
-						</view>
-						<view class="select" v-else>
-							<image src="../../static/identify/select.png" mode=""></image>
-						</view>
-						默认地址
-					</view>
-					<!-- <view class="namePhone">{{item.userName}} <span>{{item.phone}}</span></view> -->
-				</view>
-				<view class="edior">
-					<view class="left">
-						{{item.userName}} <span>{{item.phone}}</span>
-					</view>
-					<view class="right">
-						<image src="../../static/identify/edit.png" mode="" style="margin-right: 20rpx;" @click.stop="edit(item.id)"></image>
-						<image src="../../static/identify/delete.png" mode="" @click.stop="del(item.id,item.type)"></image>
-					</view>
-				</view>
-				<!-- <view class="edior">
-					<view class="edit" @click.stop="edit(item.id)">编辑</view>
-					<view class="del" @click.stop="del(item.id,item.type)">删除</view>
-				</view> -->
-			</view>
-		</view>
-
-		<view class="addbtn">
-			<button type="primary" @click="addAddress">新增地址</button>
-		</view>
-	</view>
-</template>
-
-<script>
-	import {
-		addList,
-		delAdd,
-		defaultAdd,
-		updateOrder,
-		addDetails
-	} from '../.././api/index.js'
-	export default {
-		data() {
-			return {
-				list: [],
-				checkedIndex: 0,
-				title: '',
-				orderId: '',
-				address: {},
-				cName: '',
-				Cphone: ''
-			}
-		},
-		methods: {
-			getList() {
-				var that = this
-				var data = {
-					openId: uni.getStorageSync('wx_copenid'),
-				}
-				addList(data).then(res => {
-					// res.data.data.forEach((element, index) => {
-					// 	element.address = JSON.parse(element.address)
-					// 	if (element.type == 1) {
-					// 		this.checkedIndex = index,
-					// 			this.address = JSON.stringify(element.address),
-					// 			this.cName = element.userName,
-					// 			this.Cphone = element.phone
-					// 	}
-					// });
-					this.list = res.data.data
-				}).catch(err => {})
-			},
-			//设为默认地址
-			goExhibits(item, id, index) {
-				this.checkedIndex = index
-				var id = {
-					id: id,
-					openid: uni.getStorageSync('wx_copenid'),
-				}
-				defaultAdd(id).then(res => {
-					if (this.title == '支付订单') {
-						addDetails(id).then(res => {
-							if (res.data.code == 200) {
-								var data = {
-									cId: this.orderId,
-									name: res.data.data.name,
-									address: res.data.data.address,
-									latitude: res.data.data.latitude,
-									longitude: res.data.data.longitude,
-									atlasAdd: res.data.data.atlasAdd,
-									cName: res.data.data.userName,
-									cPhone: res.data.data.phone
-								}
-								updateOrder(data).then(res => {
-									if (res.data.code == 200) {
-										uni.navigateBack()
-									} else {
-										uni.showToast({
-											title: res.data.msg,
-											icon: 'none'
-										})
-									}
-								})
-								setTimeout(() => {
-									// uni.navigateBack()
-								}, 2000)
-							}
-						})
-					} else {
-						if (res.data.code == 200) {
-							this.getList()
-							uni.showToast({
-								title: '设置默认地址成功!',
-								icon: 'none'
-							})
-
-						}
-					}
-
-				})
-			},
-			//编辑地址
-			edit(id,type) {
-				uni.navigateTo({
-					url: './add_address?id=' + id+ '&type=' + type
-				})
-			},
-			//删除地址
-			del(id, type) {
-				if (type == 1) {
-					uni.showModal({
-						title: '提示',
-						content: '默认地址不能删除',
-						confirmText: '确定', // 确定按钮的文字
-						cancelText: '取消', // 取消按钮的文字
-					})
-					return
-				}
-				var id = id
-				let that = this
-				uni.showModal({
-					title: '提示',
-					content: '确定删除该地址吗?',
-					confirmText: '确定', // 确定按钮的文字
-					cancelText: '取消', // 取消按钮的文字
-					success(res) {
-						if (res.confirm) {
-							delAdd({
-								idList: id
-							}).then(res => {
-								if (res.data.code == 200) {
-									// this.$router.go(0)
-									that.getList()
-									uni.showToast({
-										title: '删除成功',
-										icon: 'success',
-										duration: 1000
-									})
-								}
-							})
-						} else if (res.cancel) {
-
-						}
-
-					}
-				})
-
-			},
-			//新增地址
-			addAddress() {
-				var type = 0
-				if (this.list.length < 1) {
-					type = 1
-				} else {
-					type = 0
-				}
-				uni.navigateTo({
-					// url: '../../my/addAddress/addAddress?type=' +type,
-					url: './add_address?type=' + type,
-				})
-			},
-		},
-		onLoad(options) {
-			this.title = options.name
-			this.orderId = options.orderNo
-		},
-		onShow() {
-			this.getList()
-		}
-	}
-</script>
-
-<style lang="scss" scoped>
-	.listAll {
-		height: 100vh;
-		background-color: #f8f8f8;
-		padding: 32rpx;
-		box-sizing: border-box;
-	}
-
-	.list {
-
-		padding: 32rpx;
-
-		// li.active {
-		// 	.checked {
-		// 		background-color: #2cb8d4;
-		// 		box-shadow: inset 0 0 5rpx 10rpx #fff;
-		// 	}
-		// }
-
-		.nodata {
-			text-align: center;
-			padding-top: 200rpx;
-			color: #666;
-			image {
-				width: 400rpx;
-				height: 400rpx;
-				margin-bottom: 20rpx;
-			}
-		}
-	}
-
-	.address_list {
-		width: 100%;
-
-		.address {
-			width: 100%;
-			// height: 82rpx;
-			background: #FFFFFF;
-			box-shadow: 0px 2rpx 6rpx 0px rgba(88, 209, 187, 0.05);
-			border-radius: 10rpx 10rpx 10rpx 10rpx;
-			padding: 32rpx 24rpx;
-			margin-bottom: 30rpx;
-			box-sizing: border-box;
-			.add {
-				flex: 1;
-				// padding-right: 30px;
-				display: flex;
-				align-items: start;
-				justify-content: space-between;
-				margin-bottom: 16rpx;
-				.data {
-					// width: 75%;
-					flex: 1;
-					font-size: 32rpx;
-					color: #333;
-					font-weight: bold;
-					margin-bottom: 10rpx;
-				}
-
-				.checked_box {
-					width: 128rpx;
-					display: flex;
-					align-items: center;
-					font-size: 24rpx;
-					.select{
-						display: flex;
-						align-items: center;
-						image{
-							width: 24rpx;
-							height: 24rpx;
-							margin-right:8rpx ;
-						}
-					}
-					
-				}
-				.namePhone {
-					font-size: 28rpx;
-
-					span {
-						color: #a4a6a8;
-						margin-left: 15rpx;
-					}
-				}
-			}
-
-			.edior {
-				display: flex;
-				align-items: center;
-				justify-content: space-between;
-				.left{
-				font-size: 26rpx;
-					span{
-						font-size: 26rpx;
-						color: #999999;
-						margin-left: 20rpx;
-					}
-				}
-				.right{
-					image{
-						width: 20px;
-						height: 20px;
-					}
-				}
-			}
-		}
-	}
-
-	.addbtn {
-		position: fixed;
-		bottom: 0;
-		width: 100%;
-		background-color: #fff;
-		border-top: 1px solid #ccc;
-		padding-top: 15px;
-		padding-bottom: 30px;
-
-		button {
-			margin: 0 50px;
-			background-color: #2cb8d4;
-			border-radius: 50px;
-		}
-	}
-</style>

+ 13 - 9
src/pages/order/order.vue

@@ -85,13 +85,8 @@ export default {
 			isLogin: false,
 		}
 	},
-	onLoad() {
-		const value = uni.getStorageSync('wx_copenid');
-		if (value == '') {
-			this.isLogin = false
-		} else {
-			this.isLogin = true
-		}
+	onLoad(query) {
+		this.isLogin = !!uni.getStorageSync('wx_copenid');
 	},
 	onShow() {
 		this.getStatus()
@@ -184,8 +179,17 @@ export default {
 		getStatus() {
 			getStatusList().then(res => {
 				this.statusList = res.data.data,
-				this.nStatus = ''
-			})
+				this.nStatus = '';
+				// 判断其它页面跳转过来
+				let orderTab = this.$store.state.other.orderTab;
+				if (orderTab !== '') {
+					let i = this.statusList.findIndex(item => item.code === orderTab);
+					// 请求数据
+					this.onTabChange(orderTab, i);
+					// 赋值完成后清除
+					this.$store.dispatch('setOrderTab', '');
+				}
+			});
 		},
 		// 切换订单
 		onTabChange(code, index) {

+ 15 - 0
src/store/index.js

@@ -0,0 +1,15 @@
+import Vue from 'vue';
+import Vuex from 'vuex';
+import user from './modules/user';
+import other from './modules/other';
+
+Vue.use(Vuex);
+
+const store = new Vuex.Store({
+	modules: {
+		user,
+		other
+	},
+});
+
+export default store;

+ 19 - 0
src/store/modules/other.js

@@ -0,0 +1,19 @@
+
+const other = {
+	state: {
+		orderTab: '',
+	},
+	mutations: {
+		SET_ORDERTAB: (state, payload) => {
+			state.orderTab = payload;
+		},
+	},
+	actions: {
+		// 订单页的标签栏
+		setOrderTab({ commit, state }, payload) {
+			commit('SET_ORDERTAB', payload);
+		},
+	}
+}
+
+export default other;

+ 120 - 0
src/store/modules/user.js

@@ -0,0 +1,120 @@
+import { wechatLogin } from '@/api/index';
+
+const LOGIN_EXPIRE = 3 * 24 * 60 * 60 * 1000;
+const user = {
+	state: {
+		user: {},
+		token: '',
+		openId: '',
+		// 是否需要刷新,比如登录返回、页面操作返回上一页
+		needRefresh: false,
+	},
+	mutations: {
+		SET_TOKEN: (state, token) => {
+			state.token = token
+			uni.setStorageSync('token', token)
+			// #ifdef MP-WEIXIN || H5
+			if (token) uni.setStorageSync('expireTime', Date.now() + LOGIN_EXPIRE);
+			// #endif
+		},
+		SET_USER: (state, user) => {
+			state.user = user
+			uni.setStorageSync('user', user)
+		},
+		SET_OPENID: (state, openId) => {
+			state.openId = openId
+			uni.setStorageSync('openId', openId)
+		},
+		SET_NEED_REFRESH: (state, payload) => {
+			state.needRefresh = payload
+		},
+	},
+	actions: {
+		// 登录
+		login({ commit, dispatch }, payload) {
+			return new Promise((resolve, reject) => {
+				let { isBack = 0, ...forms } = payload;
+				// deviceId和loginCity,为业务注销账号时增加
+				let params = {
+					...forms,
+					deviceId: uni.getStorageSync('deviceId'),
+					loginCity: uni.getStorageSync('city')
+				};
+				clientLoginNew(params).then((res) => {
+					if (res.code == 200) {
+						if (res.result.userInfo.delFlag == 1) {
+							uni.showModal({
+								title: '温馨提示',
+								content: '该账号近期已注销,如有疑问请联系客服',
+								showCancel: false,
+								confirmText: '知道了',
+								confirmColor: '#0879FF',
+							});
+							return;
+						}
+						commit('SET_USER', res.result)
+						commit('SET_TOKEN', res.result.token)
+						commit('SET_REFRESH_TOKEN', res.result.refreshToken)
+						commit('SET_AREACODE', { 
+							params: { areaCname: uni.getStorageSync('city') },
+							storageKey: 'cityCode'
+						})
+						
+						uni.showToast({
+							icon: 'none',
+							title: '登录成功'
+						})
+						if (isBack == 1) {
+							commit('SET_NEED_REFRESH', true);
+							// #ifdef MP-WEIXIN
+							uni.navigateBack({ delta: 2 });
+							// #endif
+							// #ifndef MP-WEIXIN
+							uni.navigateBack();
+							// #endif
+						} else if (isBack == 0) {
+							uni.switchTab({
+								url: '/pages/home/home'
+							});
+						}
+					} else if (res.code == 504) {
+						eventBus.emit('openPage');
+					} else if (res.code == 500) {
+						uni.$u.toast(res.message);
+					}
+
+					resolve(res)
+				}).catch(error => {
+					reject(error)
+				})
+			})
+		},
+		// 页面刷新标识
+		setRefresh({ commit, state }, payload) {
+			commit('SET_NEED_REFRESH', payload)
+		},
+		// 登出
+		logOut({ commit }) {
+			return new Promise(resolve => {
+				commit('SET_USER', '')
+				commit('SET_TOKEN', '')
+				commit('SET_REFRESH_TOKEN', '')
+				commit('SET_OPENID', '')
+
+				// #ifdef MP-WEIXIN
+				uni.switchTab({
+					url: '/pages/home/home'
+				});
+				// #endif
+				// #ifndef MP-WEIXIN
+				uni.reLaunch({
+					url: '/pages/login/login'
+				});
+				// #endif
+				resolve()
+			})
+		},
+	}
+}
+
+export default user

部分文件因文件數量過多而無法顯示