Przeglądaj źródła

登录,收货地址

guhongwei 2 lat temu
rodzic
commit
ca270646fc
4 zmienionych plików z 76 dodań i 12 usunięć
  1. 1 1
      pages.json
  2. 51 5
      pages/login/index.vue
  3. 18 4
      pagesMy/address/add.vue
  4. 6 2
      pagesMy/address/index.vue

+ 1 - 1
pages.json

@@ -158,7 +158,7 @@
 				{
 					"path": "address/add",
 					"style": {
-						"navigationBarTitleText": "新增收货地址"
+						"navigationBarTitleText": "修改地址"
 					}
 				},
 				{

+ 51 - 5
pages/login/index.vue

@@ -1,7 +1,7 @@
 <template>
 	<mobile-frame>
 		<view class="main">
-			<view class="one">
+			<!-- <view class="one">
 				<text>{{type==0?'短信验证码登录':'手机号密码登录'}}</text>
 			</view>
 			<view class="two">
@@ -47,6 +47,22 @@
 						<text class="iconfont icon-weixin"></text>
 					</view>
 				</view>
+			</view> -->
+			<view class="wx">
+				<view class="wx_1">
+					<text class="iconfont icon-weixin"></text>
+				</view>
+				<view class="wx_2">
+					<button size="mini" @tap="otherLogin('wx')">微信信任登录</button>
+				</view>
+				<view class="wx_3">
+					<checkbox-group @change="changeAgree">
+						<label>
+							<checkbox :checked="agree" />
+							<text @tap.stop="toAgree()">我已阅读并同意“用户协议”和“隐私政策”</text>
+						</label>
+					</checkbox-group>
+				</view>
 			</view>
 		</view>
 		<uni-popup ref="dialogShow" type="dialog">
@@ -125,11 +141,11 @@
 					{
 						text: '微信',
 						value: 0
-					},
-					{
-						text: '短信验证',
-						value: 1
 					}
+					// {
+					// 	text: '短信验证',
+					// 	value: 1
+					// }
 				],
 			};
 		},
@@ -688,6 +704,36 @@
 
 			}
 		}
+
+		.wx {
+			text-align: center;
+			margin: 25vw 0 0 0;
+
+			.wx_1 {
+				margin: 0 0 5vw 0;
+
+				text {
+					font-size: 50px;
+				}
+			}
+
+			.wx_2 {
+				button {
+					background: var(--f35BColor);
+					color: var(--fffColor);
+					font-size: var(--font16Size);
+				}
+			}
+
+			.wx_3 {
+				position: absolute;
+				bottom: 10vw;
+				width: 100vw;
+				text-align: center;
+				font-size: 12px;
+			}
+
+		}
 	}
 
 	.yzm {

+ 18 - 4
pagesMy/address/add.vue

@@ -102,7 +102,8 @@
 		},
 		onLoad: function(e) {
 			const that = this;
-			that.$set(that, `id`, e && e.id || '');
+			that.$set(that, `id`, e.id || '635f13fc42e87c7a2880ed52');
+			that.searchPor();
 			that.watchLogin();
 		},
 		onShow: function() {
@@ -114,7 +115,6 @@
 				}
 			})
 		},
-		onUnload: function() {},
 		methods: {
 			// 监听用户是否登录
 			watchLogin() {
@@ -128,6 +128,10 @@
 							if (that.id) {
 								let arr = await that.$api(`/address/${that.id}`, 'GET')
 								if (arr.errcode == '0') {
+									let index = that.provinceList.findIndex((i) => i.name == arr.data.province);
+									if (index) {
+										that.proChange(parseFloat(index));
+									}
 									that.$set(that, `form`, arr.data)
 								}
 							} else {
@@ -137,7 +141,7 @@
 								})
 							}
 						}
-						that.searchPor();
+
 					},
 					fail: function(err) {
 						uni.reLaunch({
@@ -198,8 +202,15 @@
 			// 选择省份
 			proChange(e) {
 				const that = this;
-				let data = that.provinceList[e.detail.value];
+				let index = 0;
+				if (e && e.detail && e.detail.value) index = e.detail.value
+				else index = e;
+				let data = that.provinceList[index];
 				if (data) {
+					if (that.id) {
+						that.$set(that.form, `city`, '');
+						that.$set(that.form, `area`, '');
+					}
 					that.$set(that.form, `province`, data.name);
 					that.$set(that, `cityList`, data.city)
 				}
@@ -209,6 +220,9 @@
 				const that = this;
 				let data = that.cityList[e.detail.value];
 				if (data) {
+					if (that.id) {
+						that.$set(that.form, `area`, '');
+					}
 					that.$set(that.form, `city`, data.name);
 					that.$set(that, `areaList`, data.area);
 				}

+ 6 - 2
pagesMy/address/index.vue

@@ -66,11 +66,15 @@
 				scrollTop: 0,
 			};
 		},
-		onLoad: function() {
+		onLoad: function() {},
+		onShow: function() {
 			const that = this;
 			that.searchConfig();
 			that.watchLogin();
-			
+		},
+		onHide: function() {
+			const that = this;
+			that.clearPage()
 		},
 		methods: {
 			// 查询基本设置