Browse Source

修改了请求流程

feature/feature-compatible
wangkesi 7 years ago
parent
commit
3b1d398520
1 changed files with 27 additions and 17 deletions
  1. 44
      src/view/home.vue

44
src/view/home.vue

@ -153,7 +153,8 @@ export default {
provinceId: "", provinceId: "",
cityId: "", cityId: "",
alertShow: false, alertShow: false,
address: ""
address: "",
flag: false
}; };
}, },
components: { components: {
@ -172,6 +173,7 @@ export default {
methods: { methods: {
// //
getName() { getName() {
console.log(1);
let arr = this.addressValue[2].split("&") || ""; let arr = this.addressValue[2].split("&") || "";
this.districtId = arr[0]; this.districtId = arr[0];
this.merchantNo = arr[2]; this.merchantNo = arr[2];
@ -203,7 +205,10 @@ export default {
}, },
// //
change(name) { change(name) {
this.addressValue = name;
if (this.flag) {
console.log(1);
this.addressValue = name;
}
}, },
// //
getGoodsList() { getGoodsList() {
@ -281,6 +286,7 @@ export default {
this.merchantNo = 2; this.merchantNo = 2;
//id //id
this.districtId = "440106000"; this.districtId = "440106000";
this.addressValue = [];
this.getGoodsList(); this.getGoodsList();
} }
this.show = false; this.show = false;
@ -317,13 +323,18 @@ export default {
.then(res => { .then(res => {
if (res.data.allAddress && res.data.userAddress) { if (res.data.allAddress && res.data.userAddress) {
this.addressData = res.data.allAddress; this.addressData = res.data.allAddress;
this.flag = true;
let data = res.data; let data = res.data;
this.provinceId = data.userAddress.provinceId;
this.cityId = data.userAddress.cityId;
this.districtId = data.userAddress.districtId;
// this.provinceId = data.userAddress.provinceId;
this.cityId = data.userAddress.cityId
? data.userAddress.cityId
: this.cityId;
this.districtId = data.userAddress.districtId
? data.userAddress.districtId
: this.districtId;
this.defaultCity = data.userAddress.districtName this.defaultCity = data.userAddress.districtName
? data.userAddress.districtName ? data.userAddress.districtName
: "天河区";
: this.defaultCity;
this.merchantNo = data.userAddress.merchantNo; this.merchantNo = data.userAddress.merchantNo;
if ( if (
data.userAddress.type != 1 && data.userAddress.type != 1 &&
@ -386,17 +397,17 @@ export default {
getId() { getId() {
let str = localStorage.getItem("cityName") || ""; let str = localStorage.getItem("cityName") || "";
if (!str) { if (!str) {
return;
} else {
let arr = str.split(",");
console.log(arr);
this.addressValue = arr;
this.provinceId = arr[0].split("&")[0];
this.cityId = arr[1].split("&")[0];
let cityNameArr = arr[2].split("&");
this.districtId = cityNameArr[0];
this.defaultCity = cityNameArr[1];
this.merchantNo = cityNameArr[2];
} }
let arr = str.split(",");
console.log(arr);
this.addressValue = arr;
this.provinceId = arr[0].split("&")[0];
this.cityId = arr[1].split("&")[0];
let cityNameArr = arr[2].split("&");
this.districtId = cityNameArr[0];
this.defaultCity = cityNameArr[1];
this.merchantNo = cityNameArr[2];
}, },
getData() { getData() {
let get = async () => { let get = async () => {
@ -414,7 +425,6 @@ export default {
// this.getdefaultAddress(); // this.getdefaultAddress();
// this.getAddress(); // this.getAddress();
// this.getLocation(); // this.getLocation();
console.log(2);
this.getData(); this.getData();
this.ShareWenXin(); this.ShareWenXin();
} }

Loading…
Cancel
Save