Moss 1 рік тому
батько
коміт
21f5609d01

+ 3 - 3
.env.development

@@ -2,10 +2,10 @@
 NODE_ENV = 'development'
 
 # URL地址
-VUE_APP_BASE_URL = 'https://knowledge.zfire.top'
+VUE_APP_BASE_URL = 'https://jiasm.zfire.top'
 
 # API
-VUE_APP_BASE_API = '/api'
+VUE_APP_BASE_API = '/recycleapi'
 
 # PATH
-VUE_APP_BASE_PATH = '/'
+VUE_APP_BASE_PATH = '/'

+ 38 - 1
src/common/utils/util.js

@@ -95,7 +95,44 @@ export const uploadImg = async function(file) {
   })
 }
 
+export const getArea = function(str) {
+	let area = {}
+	let index11 = 0
+	let index1 = str.indexOf("省")
+	if (index1 == -1) {
+	  index11 = str.indexOf("自治区")
+	  if (index11 != -1) {
+	    area.Province = str.substring(0, index11 + 3)
+	  } else {
+	    area.Province = str.substring(0, 0)
+	  }
+	} else {
+	  area.Province = str.substring(0, index1 + 1)
+	}
+				 
+	let index2 = str.indexOf("市")
+	if (index11 == -1) {
+	  area.City = str.substring(index11 + 1, index2 + 1)
+	} else {
+	  if (index11 == 0) {
+	    area.City = str.substring(index1 + 1, index2 + 1)
+	  } else {
+	    area.City = str.substring(index11 + 3, index2 + 1)
+	  }
+	}
+				 
+	let index3 = str.lastIndexOf("区")
+	if (index3 == -1) {
+	  index3 = str.indexOf("县")
+	  area.Country = str.substring(index2 + 1, index3 + 1)
+	} else {
+	  area.Country = str.substring(index2 + 1, index3 + 1)
+	}
+	return area;
+}
+
 export default {
   getUserInfo,
-  uploadImg
+  uploadImg,
+  getArea
 };

+ 86 - 0
src/components/Loading.vue

@@ -0,0 +1,86 @@
+<template>
+	<view>
+		<view v-if="type === 1">
+			<u-empty
+				mode="list"
+				icon="/static/images/common/empty_data.png"
+				:text="loadStatus === 1 ? loadText : showText"
+				v-if="dataList.length < 1">
+			</u-empty>
+			<view class="loadmore" v-else>
+				<u-loadmore :status="loadStatus | statusFilter" />
+			</view>
+		</view>
+		
+		<view v-if="type === 2">
+			<u-empty
+				mode="list"
+				icon="/static/images/common/empty_data.png"
+				:text="loadStatus === 1 ? loadText : showText"
+				v-if="dataList.length < 1">
+			</u-empty>
+		</view>
+		
+		<view v-if="type === 3">
+			<u-loading-page :loading-text="loadText" :loading="loadStatus === 1"></u-loading-page>
+			<u-empty
+				mode="list"
+				icon="/static/images/common/empty_data.png"
+				:text="showText"
+				v-if="loadStatus === 2">
+			</u-empty>
+		</view>
+	</view>
+</template>
+
+<script>
+	export default {
+		filters: {
+			statusFilter(val) {
+				const MAP = {
+					0: 'loadmore',
+					1: 'loading',
+					2: 'nomore',
+				}
+				return MAP[val];
+			}
+		},
+		
+		props: {
+			type: {
+				type: Number,
+				default: 1, // 1=分页列表,2=普通列表,3=其他/详情
+			},
+			loadStatus: {
+				type: Number,
+				default: 0 // 0=未加载=loadmore,1=加载中=loading,2=没有更多数据=nomore
+			},
+			dataList: {
+				type: Array,
+				default: []
+			},
+			showText: {
+				type: String,
+				default: '暂无数据'
+			},
+			loadText: {
+				type: String,
+				default: '加载中...'
+			}
+		},
+		data() {
+			return{
+				
+			}
+		}
+	}
+</script>
+
+<style lang="scss" scoped>
+	.loadmore {
+		padding: 20rpx 0;
+		.u-loadmore {
+			margin: 0;
+		}
+	}
+</style>

+ 100 - 0
src/components/custom.vue

@@ -0,0 +1,100 @@
+<template>
+	<view class="navigation" >
+		<view class="me-container" :class="bgColor">
+			<view class="me-left flex_ac">
+				<!-- <view v-if="isBack" @tap="toBack" class="iconfont icon-back"></view> -->
+				<!-- <image v-if="isBack" @tap="toBack" src="@/static/icon/back.png"></image> -->
+        <u-icon name="arrow-left" v-if="isBack" @tap="toBack"></u-icon>
+				<slot name="left"></slot>
+			</view>
+			<view class="me-content">
+				<slot name="content"></slot>
+			</view>
+			<view class="me-right">
+				<slot name="right"></slot>
+			</view>
+		</view>
+	</view>
+</template>
+
+<script>
+	export default {
+		props:{
+			isBack:{
+				type:Boolean,
+				default:true
+			},
+			bgColor:{
+				type:String,
+				default:'bg-white'
+			}
+		},
+		computed:{
+
+		},
+		data() {
+			return {
+				StatusBar:this.StatusBar,
+				CustomBar:this.CustomBar
+			};
+		},
+		methods:{
+			toBack(){
+				uni.navigateBack({
+					delta:1
+				})
+			}
+		}
+	}
+</script>
+
+<style scoped lang="scss">
+	cover-view{
+		box-sizing: border-box;
+	}
+.navigation{
+  height: 88rpx;
+	position: relative;
+	.bg-none {
+		background: none;
+	}
+	.bg-white{
+		background: #FFFFFF;
+	}
+	.bg-tran{
+		background: transparent;
+	}
+	.bg-them{
+		background: #fb5152;
+	}
+	.bg-linear {
+		background: linear-gradient(-45deg, #6da7ff 0%, #7fdaff 100%);
+	}
+	.me-container{
+		position: fixed;
+		width: 100%;
+		top: 0;
+		z-index: 1024;
+		// box-shadow: 0 1rpx 6rpx rgba(0, 0, 0, 0.1);
+		// padding: 0 30rpx;
+    height: 88rpx;
+		display: flex;
+		align-items: center;
+		justify-content: space-between;
+		.me-content{
+			position: absolute;
+			left: 50%;
+			transform: translateX(-50%);
+		}
+		.me-left{
+			image {
+				width: 32rpx;
+				height: 32rpx;
+				display: block;
+				margin-left: 30rpx;
+			}
+		}
+
+	}
+}
+</style>

+ 3 - 1
src/main.js

@@ -53,8 +53,10 @@ App.mpType = 'app'
 import api from '@/common/http/'
 Vue.prototype.$api = api
 
-import custom from '@/components/zj/custom.vue';
+import custom from '@/components/custom.vue';
+import Loading from '@/components/Loading.vue';
 Vue.component('custom', custom);
+Vue.component('Loading', Loading);
 
 import {
   getUserInfo

+ 5 - 5
src/manifest.json

@@ -13,7 +13,7 @@
     },
     "h5" : {
         "title" : "",
-        "publicPath" : "/",
+        "publicPath": "/",
         "devServer" : {
             "https" : false,
             "port" : 3000,
@@ -31,7 +31,7 @@
         },
         "router" : {
             "mode" : "history",
-            "base" : "/"
+            "base": "/"
         },
         "optimization" : {
             "prefetch" : true,
@@ -75,9 +75,9 @@
     },
     "app-plus" : {
         /* 5+App特有相关 */
-        "usingComponents" : false,
+        "usingComponents": false,
         "splashscreen" : {
-            "alwaysShowBeforeRender" : false,
+            "alwaysShowBeforeRender": false,
             "waiting" : true,
             "autoclose" : true,
             "delay" : 0
@@ -125,7 +125,7 @@
         "usingComponents" : true
     },
     "mp-baidu" : {
-        "usingComponents" : false
+        "usingComponents": false
     },
     "mp-toutiao" : {
         "usingComponents" : true

+ 12 - 0
src/pages.json

@@ -60,6 +60,18 @@
       "style": {
         "navigationBarTitleText": "我的收益"
       }
+    },
+    {
+      "path": "pages/mine/address/list",
+      "style": {
+        "navigationBarTitleText": "我的地址"
+      }
+    },
+    {
+      "path": "pages/mine/address/form",
+      "style": {
+        "navigationBarTitleText": "添加地址"
+      }
     },
     {
       "path": "pages/goods/list",

+ 536 - 0
src/pages/mine/address/form.vue

@@ -0,0 +1,536 @@
+<template>
+	<zj-page-layout :hasFooter="true">
+		<u-notice-bar direction="column" icon=" " :text="['地址信息仅用于上门服务,隐私信息将完全保密']"></u-notice-bar>
+
+		<view class="form-container">
+			<view class="clipboard">
+				<view class="box">
+					<u--textarea v-model="clipboard" border="none" placeholder="试试粘贴“收件人姓名,手机号,详细地址”,可快速识别您的用户及地址信息"></u--textarea>
+					<view class="btns">
+						<u-button text="清空" size="small" @click="clipboard = ''"></u-button>
+						<u-button type="primary" text="识别" size="small" @click="shibie"></u-button>
+					</view>
+				</view>
+			</view>
+			<view class="row">
+				<view class="title">联系人</view>
+				<view class="right input"><input type="text" placeholder="请输入联系人" v-model="formData.name"></view>
+			</view>
+			<view class="row">
+				<view class="title">手机号码</view>
+				<view class="right input"><input type="number" placeholder="请输入手机号码" v-model="formData.phone"></view>
+			</view>
+			<view class="row">
+				<view class="title">所在地区</view>
+				<view class="right">
+					<picker @change="onRegionChange" v-model="regionValue" mode="region">
+						<view class="picker">
+							<view v-if="regionValue.length">{{regionValue[0] + '/' +regionValue[1] + '/' +regionValue[2]}}</view>
+							<view v-else style="color: #666666;">请选择省/市/区</view>
+							<text class="iconfont icon-jinru"></text>
+						</view>
+					</picker>
+				</view>
+			</view>
+			<view class="row">
+				<view class="title">所在街道</view>
+				<view class="right">
+					<picker @change="onStreetChange" :value="streetValue" :range="streetList" range-key="name" :disabled="!regionValue[2]">
+						<view class="picker">
+							<view v-if="streetValue !== ''">{{streetList[streetValue].name}}</view>
+							<view v-else style="color: #666666;">请选择街道</view>
+							<text class="iconfont icon-jinru"></text>
+						</view>
+					</picker>
+				</view>
+			</view>
+
+			<view class="row">
+				<view class="title">详细地址</view>
+				<view class="right textarea">
+					<textarea placeholder="请输入详细地址" auto-height v-model="formData.address"></textarea>
+					<view class="r" @tap="getLocation"><text class="iconfont icon-dingwei1"></text>定位</view>
+				</view>
+			</view>
+			<view class="row">
+				<view class="title">门牌号</view>
+				<view class="right input"><input type="text" placeholder="请输入门牌号" maxlength="15" v-model="formData.houseNo"></view>
+			</view>
+			<view class="row mt20">
+				<view class="title">设为默认</view>
+				<view class="right default"><switch @change="switchChange" color="#3D8FFD" v-model="formData.defaultAddr" :checked="formData.defaultAddr" style="transform:scale(0.7)" /></view>
+			</view>
+		</view>
+
+		<template slot="footer">
+			<view class="footer-btn-group">
+				<u-button text="删除" @click="handleDelete" v-if="editId"></u-button>
+				<u-button text="保存" type="primary" @click="submitForm"></u-button>
+			</view>
+		</template>
+	</zj-page-layout>
+</template>
+
+<script>
+	import {mapState} from 'vuex';
+	import {getArea} from '@/common/utils/util.js';
+
+	export default {
+		data() {
+			return {
+				editId: null, // 编辑的id
+				regionValue: [], // 省市区值
+				streetList: [],
+				streetValue: '',
+				formData: { // 表单数据
+					name: '',
+					phone: '',
+					province: '',
+					city: '',
+					area: '',
+					street: '',
+					address: '',
+					houseNo: '',
+					defaultAddr: false,
+				},
+				canClickSave: true, // 能否点击提交
+				clipboard: '',
+			}
+		},
+		computed:{
+			...mapState(['userInfo', 'isLogin', 'userId'])
+		},
+		onLoad({id, addressData}) {
+			this.editId = id;
+			if(id) {
+				uni.setNavigationBarTitle({
+				  title: '编辑地址'
+				})
+				this.getAddressData();
+			}
+			if(addressData) {
+				addressData = JSON.parse(addressData);
+				this.formData = {
+					name: addressData.name,
+					phone: addressData.phone,
+					province: addressData.province,
+					city: addressData.city,
+					area: addressData.area,
+					address: addressData.address,
+					houseNo: addressData.houseNo,
+					defaultAddr: addressData.defaultAddr,
+				}
+				this.regionValue = [addressData.province, addressData.city, addressData.area];
+				this.getStreetList();
+			}
+		},
+		methods: {
+			async getRegion(address) {
+				const result = new Promise((resolve, reject) => {
+					this.$axios({
+						url: '/lbs/amap/region/query2',
+						method: 'post',
+						server: 'pc',
+						params: {
+							address
+						}
+					}).then(res => {
+						resolve(res.data);
+					})
+				})
+				return result;
+			},
+
+			async shibie() {
+				// 莫阿宝,13686123158,广东省广州市天河区棠下街道天河软件园
+				// console.log(this.smart(this.clipboard));
+				const data = this.smart(this.clipboard);
+
+				this.formData.name = data.name || '';
+				this.formData.phone = data.phone || '';
+
+				if(data.address) {
+					let addressData = await this.getRegion(data.address);
+					this.formData.province = addressData.provinceName || '';
+					this.formData.city = addressData.cityName || '';
+					this.formData.area = addressData.areaName || '';
+					this.formData.address = data.address.replace(`${addressData.provinceName || ''}${addressData.cityName || ''}${addressData.areaName || ''}${addressData.name || ''}`, '') || '';
+					this.regionValue = [addressData.provinceName || '', addressData.cityName || '', addressData.areaName || ''];
+					addressData.name && this.getStreetList(addressData.name);
+				}
+			},
+
+			smart(data) {
+				data = this.stripscript(data); //过滤特殊字符
+
+				let obj = {};
+				let copyData = JSON.parse(JSON.stringify(data)).split(" ");
+
+				copyData.forEach((item, index) => {
+					if (item) {
+						let addressObj = this.smartData(item);
+						console.log(addressObj)
+
+						obj = Object.assign(obj, addressObj);
+					}
+				});
+				return obj;
+			},
+
+			smartData(data) {
+				let smartObj = {};
+				//address=  data.replace(/\s/g, ''); //去除空格
+
+				// 手机号匹配(提取出手机号)
+				let phone = data.match(/(86-[1][0-9]{10}) | (86[1][0-9]{10})|([1][0-9]{10})/g);
+
+				// 如果存在手机号
+				if (phone) {
+					smartObj.phone = phone[0];
+
+					if(data != phone[0]) {
+						// 如果手机号是开头或结尾
+						if(data.startsWith(phone[0]) || data.endsWith(phone[0])) {
+							let remainData = data.replace(phone[0], ''); // 除了手机号,剩下的内容
+							// 如果还有剩下的内容
+							if(remainData) {
+								if (new RegExp(/省|市|区/).test(remainData)) {
+									smartObj.address = remainData;
+								} else {
+									smartObj.name = remainData;
+								}
+							}
+						}
+
+						// 如果手机号在中间
+						else {
+							let remainDatas = data.replace(phone[0], '&&').split('&&'); // 除了手机号,剩下的内容
+							for(let i = 0; i < remainDatas.length; i++) {
+								if(new RegExp(/省|市|区/).test(remainDatas[i])) {
+									smartObj.address = remainDatas[i];
+								}else {
+									smartObj.name = remainDatas[i];
+								}
+							}
+						}
+					}
+				}
+
+				// 如果不存在手机号
+				else {
+					if (new RegExp(/省|市|区/).test(data)) {
+						smartObj.address = data;
+					}
+					else {
+						smartObj.name = data;
+					}
+				}
+
+				return smartObj;
+			},
+
+			// 过滤特殊字符
+			stripscript(s) {
+				s = s.replace(/(\d{3})-(\d{4})-(\d{4})/g, "$1$2$3");
+				s = s.replace(/(\d{3}) (\d{4}) (\d{4})/g, "$1$2$3");
+				var pattern = new RegExp(
+					"[`~!@#$^&*()=|{}':;',\\[\\].<>/?~!@#¥……&*()——|{}【】‘;:”“’。,、?-]"
+				);
+				var rs = "";
+				for (var i = 0; i < s.length; i++) {
+					rs = rs + s.substr(i, 1).replace(pattern, " ");
+				}
+				rs = rs.replace(/[\r\n]/g, "");
+				return rs;
+			},
+
+
+			// 获取地址信息
+			getAddressData() {
+				this.$axios({
+					url: '/user/address/detail',
+					method: 'get',
+					params: {
+						userAddressId: this.editId
+					}
+				}).then(res => {
+					this.formData = {
+						name: res.data.name,
+						phone: res.data.phone,
+						province: res.data.province,
+						city: res.data.city,
+						area: res.data.area,
+						address: res.data.address,
+						houseNo: res.data.houseNo,
+						defaultAddr: res.data.defaultAddr,
+					}
+					this.regionValue = [res.data.province, res.data.city, res.data.area];
+					this.getStreetList(res.data.street);
+				})
+			},
+
+
+			// 地图选点
+			getLocation() {
+				let that = this;
+				uni.chooseLocation({
+				    success: function (res) {
+				        console.log(res);
+						let SSQ_value = getArea(res.address);
+						if(!SSQ_value.Province) {
+							SSQ_value.Province = SSQ_value.City;
+						}
+						that.formData.province = SSQ_value.Province;
+						that.formData.city = SSQ_value.City;
+						that.formData.area = SSQ_value.Country;
+						let regionValue = [];
+						regionValue.push(SSQ_value.Province);
+						regionValue.push(SSQ_value.City);
+						regionValue.push(SSQ_value.Country);
+						that.regionValue = regionValue;
+						that.formData.address = res.address.slice(res.address.indexOf(SSQ_value.Country) + SSQ_value.Country.length) + res.name;
+						that.getStreetList();
+						that.streetValue = '';
+						that.formData.street = '';
+				    },
+					fail: function(res) {
+						uni.getSetting({
+							success: function(res) {
+								if (!res.authSetting['scope.userLocation']) {
+									uni.showModal({
+										title: '是否授权当前位置',
+										content: '需要获取您的地理位置,请确认授权,否则地图功能将无法使用',
+										success(tip) {
+											if (tip.confirm) {
+												uni.openSetting({
+													success: function(data) {
+														if (data.authSetting["scope.userLocation"] === true) {
+															that.$successToast('授权成功');
+															setTimeout(() => {
+																that.getLocation();
+															}, 1000)
+														}
+													}
+												})
+											}
+										}
+									})
+								}
+							}
+						})
+					}
+				});
+			},
+
+			// 切换省市区
+			onRegionChange(e) {
+				console.log(e.detail);
+				this.regionValue = e.detail.value;
+				this.formData.province = this.regionValue[0];
+				this.formData.city = this.regionValue[1];
+				this.formData.area = this.regionValue[2];
+				this.getStreetList();
+				this.streetValue = '';
+			},
+
+			// 获取街道列表
+			getStreetList(street) {
+				this.$axios({
+					url: '/common/street',
+					method: 'get',
+					params: {
+						province: this.regionValue[0],
+						city: this.regionValue[1],
+						area: this.regionValue[2],
+					}
+				}).then(res => {
+					this.streetList = res.data;
+					if(street) {
+						let index = this.findElem(this.streetList, 'name', street);
+						this.streetValue = index;
+						this.formData.street = street;
+					}
+				})
+			},
+
+			// 切换街道
+			onStreetChange(e) {
+				console.log(e.detail.value);
+				this.streetValue = e.detail.value;
+				this.formData.street = this.streetList[this.streetValue].name;
+			},
+
+			findElem(array, attr, val) {
+			    for (var i = 0; i < array.length; i++) {
+			        if (array[i][attr] == val) {
+			            return i; //返回当前索引值
+			        }
+			    }
+			    return -1;
+			},
+
+			switchChange(e) {
+				console.log(e.detail.value);
+				this.formData.defaultAddr = e.detail.value;
+			},
+
+			// 验证数据
+			vailateData() {
+				if(!this.formData.name) {
+					this.$toast('请填写姓名');
+					return false;
+				}
+				if(!this.formData.phone) {
+					this.$toast('请填写手机号码');
+					return false;
+				}
+				if(!(/^1[3456789]\d{9}$/.test(this.formData.phone))) {
+					this.$toast('请填写正确的手机号码');
+					return false;
+				}
+				if(!this.formData.province) {
+					this.$toast('请选择所在地区');
+					return false;
+				}
+				if(!this.formData.street) {
+					this.$toast('请选择所在街道');
+					return false;
+				}
+				if(!this.formData.address) {
+					this.$toast('请填写详细地址');
+					return false;
+				}
+				return true;
+			},
+
+			// 提交表单
+			submitForm() {
+				if (!this.canClickSave) return false;
+				this.canClickSave = false;
+				setTimeout(() => { this.canClickSave = true }, 3000)
+				if(!this.vailateData())return;
+
+				let params = this.formData;
+				params.userId = this.userId;
+				let url = '';
+				if(this.editId) {
+					params.userAddressId = this.editId;
+					url = '/user/address/update';
+				}else {
+					url = '/user/address/save';
+				}
+				this.$axios({
+					url: url,
+					type: 'json',
+					params,
+					isLoading: 1,
+				}).then(res => {
+					this.$successToast(this.editId? '编辑成功':'添加成功');
+					this.$backPage(1, 1000);
+				})
+			},
+
+			// 删除
+			handleDelete() {
+				this.$modal({
+					content: '确定要删除该地址吗?',
+				}).then(() => {
+					this.$axios({
+						url: '/user/address/del',
+						params: {
+							userAddressId: this.editId
+						},
+						isLoading: 1,
+					}).then(res => {
+						this.$successToast('删除成功');
+						this.$backPage(1, 1000);
+					})
+				}).catch(() => {})
+			}
+		}
+	}
+</script>
+
+<style lang="scss">
+	.form-container {
+		.clipboard {
+			padding: 20rpx;
+			background: #FFFFFF;
+			.box {
+				background: #f5f5f5;
+				::v-deep .u-textarea {
+					background: none !important;
+				}
+				.btns {
+					padding: 20rpx;
+					display: flex;
+					justify-content: flex-end;
+					::v-deep .u-button {
+						width: 100rpx;
+						margin-left: 30rpx;
+						margin-right: 0;
+					}
+				}
+			}
+		}
+		.row {
+			background: #FFFFFF;
+			min-height: 88rpx;
+			padding: 0 20rpx;
+			display: flex;
+			justify-content: space-between;
+			align-items: center;
+			border-bottom: 1px solid #f5f5f5;
+			.title {
+				flex-shrink: 0;
+				width: 160rpx;
+				font-size: 28rpx;
+				color: #333333;
+			}
+			.right {
+				flex: 1;
+				width: 0;
+				input {
+					font-size: 28rpx;
+				}
+				.picker {
+					display: flex;
+					align-items: center;
+					justify-content: space-between;
+					image {
+						width: 16rpx;
+						height: 28rpx;
+					}
+				}
+			}
+			.textarea {
+				display: flex;
+				justify-content: space-between;
+				align-items: center;
+				textarea {
+					padding: 10rpx 0;
+				}
+				.r {
+					display: flex;
+					align-items: center;
+					flex-shrink: 0;
+					font-size: 24rpx;
+					color: #666666;
+					margin-left: 15rpx;
+					.iconfont {
+						font-size: 36rpx;
+						color: #999999;
+						margin-right: 4rpx;
+					}
+				}
+			}
+			.default {
+				display: flex;
+				justify-content: flex-end;
+				switch {
+					margin-right: -20rpx;
+				}
+			}
+		}
+	}
+</style>

+ 164 - 0
src/pages/mine/address/list.vue

@@ -0,0 +1,164 @@
+<template>
+	<zj-page-layout
+		:hasFooter="true"
+		:isScroll="true"
+		:refresherTriggered="refresherTriggered"
+		@refresherrefresh="refresherrefresh">
+		<view class="list-container">
+			<block v-for="(item, index) in dataList" :key='index'>
+				<view class="item" @tap="chooseAddress(index)">
+					<view class="main">
+						<view class="top">
+							<view class="default" v-if="item.defaultAddr">默认</view>
+							<view class="text">{{item.province}} {{item.city}} {{item.area}} {{item.street}}</view>
+						</view>
+						<view class="address">{{item.address}}{{item.houseNo}}</view>
+						<view class="name">{{item.name}} {{item.phone}}</view>
+					</view>
+					<text class="iconfont icon-bianji" @tap.stop="$navPage('/pages/mine/address/form?id='+item.userAddressId)"></text>
+				</view>
+			</block>
+		</view>
+
+		<Loading
+			:type="2"
+			:loadStatus="loadStatus"
+			:dataList="dataList"
+		/>
+
+		<template slot="footer">
+			<view class="footer-btn-group">
+				<u-button text="获取地址" @click="getWxAddress"></u-button>
+				<u-button text="新增地址" type="primary" @click="$navPage('/pages/mine/address/form')"></u-button>
+			</view>
+		</template>
+	</zj-page-layout>
+</template>
+
+<script>
+	import {mapState} from 'vuex';
+
+	export default {
+		data() {
+			return {
+				dataList: [], // 收货地址列表
+				loadStatus: 0,
+				refresherTriggered: false, // 下拉刷新状态
+				isChoose: false, // 是否进来选择地址
+			}
+		},
+		computed:{
+			...mapState(['userInfo', 'isLogin', 'userId'])
+		},
+		onShow() {
+			this.getList();
+		},
+		onLoad({isChoose}) {
+			this.isChoose = isChoose;
+		},
+		methods: {
+			// 触发下拉刷新
+			async refresherrefresh(e) {
+				this.refresherTriggered = true;
+				this.dataList = [];
+				this.getList();
+			},
+
+			// 获取收货地址列表
+			getList() {
+				this.loadStatus = 1;
+				this.$api.get('/user/address/list', 
+          {
+						pageNum: 1,
+						pageSize: -1,
+						userId: this.userId
+					}).then(res => {
+					this.loadStatus = 0;
+					let list = res.data.records;
+					if(list.length < 1){
+						this.loadStatus = 2;
+					}
+					this.dataList = list;
+				}).catch(() => {
+					this.loadStatus = 2;
+				}).finally(res => {
+					this.refresherTriggered = false;
+				})
+			},
+
+			// 选择地址
+			chooseAddress(index) {
+				if(!this.isChoose) {
+					return false;
+				}
+				uni.$emit('chooseAddress', this.dataList[index]);
+				this.$backPage(1);
+			},
+
+			// 获取微信收货地址
+			getWxAddress() {
+				let that = this;
+				uni.chooseAddress({
+					success(res) {
+						let params = {
+							userId: that.userId,
+							name: res.userName,
+							phone: res.telNumber,
+							province: res.provinceName,
+							city: res.cityName,
+							area: res.countyName,
+							address: res.detailInfo,
+							houseNo: '',
+						}
+						that.$navPage('/pages/mine/address/form?addressData=' + JSON.stringify(params));
+					}
+				})
+			},
+		}
+	}
+</script>
+
+<style lang="scss">
+	.list-container {
+		background: #FFFFFF;
+		.item {
+			padding: 40rpx 30rpx;
+			display: flex;
+			justify-content: space-between;
+			align-items: center;
+			border-top: 1px solid #f5f5f5;
+			.main {
+				.top {
+					display: flex;
+					align-items: center;
+					.default {
+						font-size: 22rpx;
+						color: $theme-color;
+						background: #E6F0FF;
+						padding: 6rpx 8rpx;
+						line-height: 20rpx;
+						margin-right: 12rpx;
+					}
+					.text {
+
+					}
+				}
+				.address {
+					font-size: 32rpx;
+					color: #333333;
+					line-height: 38rpx;
+					margin-top: 16rpx;
+				}
+				.name {
+					font-size: 24rpx;
+					color: $sec-font;
+					margin-top: 16rpx;
+				}
+			}
+			.iconfont {
+				font-size: 44rpx;
+				color: $sec-font;
+			}
+		}
+	}
+</style>

+ 8 - 0
src/pages/mine/guide.vue

@@ -0,0 +1,8 @@
+<template>
+</template>
+
+<script>
+</script>
+
+<style>
+</style>

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

@@ -101,7 +101,7 @@ export default {
       ],
 
       pageList: [
-        { name: '我的地址', url: '' },
+        { name: '我的地址', url: '/pages/mine/address/list' },
         { name: '防骗指南', url: '' },
         { name: '联系客服', url: 'contact' },
         { name: '隐私政策', url: '' },

+ 19 - 0
src/styles/common.scss

@@ -7,6 +7,25 @@
   position: relative;
 }
 
+.footer-btn-group {
+	padding: 25rpx 30rpx;
+	display: flex;
+	align-items: center;
+	::v-deep .u-button {
+		flex-shrink: 0;
+		font-size: 32rpx;
+		margin-right: 30rpx;
+		border-radius: 20rpx !important;
+		&:first-child {
+			flex: 1;
+		}
+		&:last-child {
+			width: 400rpx !important;
+			margin-right: 0;
+		}
+	}
+}
+
 .common-goods-list {
   .item {
     margin-top: 30rpx;

+ 27 - 3
src/styles/iconfont.css

@@ -1,9 +1,9 @@
 /* 在线链接服务仅供平台体验和调试使用,平台不承诺服务的稳定性,企业客户需下载字体包自行发布使用并做好备份。 */
 @font-face {
   font-family: 'iconfont';  /* Project id 4308323 */
-  src: url('https://at.alicdn.com/t/c/font_4308323_1lk0nfjgk3z.woff2?t=1698722688359') format('woff2'),
-       url('https://at.alicdn.com/t/c/font_4308323_1lk0nfjgk3z.woff?t=1698722688359') format('woff'),
-       url('https://at.alicdn.com/t/c/font_4308323_1lk0nfjgk3z.ttf?t=1698722688359') format('truetype');
+  src: url('https://at.alicdn.com/t/c/font_4308323_zf22lmymn5.woff2?t=1698736545710') format('woff2'),
+       url('https://at.alicdn.com/t/c/font_4308323_zf22lmymn5.woff?t=1698736545710') format('woff'),
+       url('https://at.alicdn.com/t/c/font_4308323_zf22lmymn5.ttf?t=1698736545710') format('truetype');
 }
 
 .iconfont {
@@ -14,6 +14,30 @@
   -moz-osx-font-smoothing: grayscale;
 }
 
+.icon-dingwei1:before {
+  content: "\e603";
+}
+
+.icon-dianzan2:before {
+  content: "\ec8c";
+}
+
+.icon-shoucang2:before {
+  content: "\e601";
+}
+
+.icon-shoucang:before {
+  content: "\e602";
+}
+
+.icon-dingwei:before {
+  content: "\e609";
+}
+
+.icon-bianji:before {
+  content: "\e8ac";
+}
+
 .icon-pinglun:before {
   content: "\e600";
 }

+ 2 - 1
src/uni.scss

@@ -13,8 +13,9 @@
  *
  * 如果你的项目同样使用了scss预处理,你也可以直接在你的 scss 代码中使用如下变量,同时无需 import 这个文件
  */
-
+
 /* 颜色变量 */
+$u-primary: #01C30B;
 
 /* 行为相关颜色 */
 $uni-color-primary: #007aff;