ソースを参照

修复地址管理bug

hwb0 3 年 前
コミット
d9aac5d2bc
2 ファイル変更6 行追加3 行削除
  1. 5 2
      pages/address/create.vue
  2. 1 1
      pages/address/index.vue

+ 5 - 2
pages/address/create.vue

@@ -60,8 +60,8 @@
 		},
 
 		onLoad(options) {
-			this.addrId = options.addrId
 			if (options.addrId) {
+				this.addrId = options.addrId
 				this.getAddrDetail()
 			}
 		},
@@ -88,9 +88,12 @@
 			selectArea() {
 				this.areaShow = true
 			},
+			
+			cancel(){
+				this.areaShow = false
+			},
 
 			confirmArea(obj) {
-				// console.log(obj);
 				this.form.province = obj.province
 				this.form.provinceId = obj.provinceId
 				this.form.city = obj.city

+ 1 - 1
pages/address/index.vue

@@ -102,7 +102,7 @@
 			getDefaultId() {
 				$http.post('/api/v1/mp/user/addr/queryDefault', {}).then(res => {
 					if (res.code == 0) {
-						this.defaultId = res.data.addrId
+						this.defaultId = res && res.data && res.data.addrId
 					}
 				})
 			},