Commit ef146d95 by 程默

fix

parent 454ebd88
......@@ -82,6 +82,6 @@ module.exports = merge(baseWebpackConfig, {
// inject: true
// }),
new FriendlyErrorsPlugin(),
new UglifyJsPlugin({ sourceMap: true })
// new UglifyJsPlugin({ sourceMap: true })
]
})
import { requestPOST, requestGET } from "@/utils/request.js";
console.log(process.env, '-----------------config------')
// wx
export default {
getUserAddressList(options) {
return requestPOST(`${process.env.OLSHOP_URL}/user/get_user_address_list`, options)
},
addOrEditAddress(options) {
return requestPOST(`${process.env.OLSHOP_URL}/user/add_or_edit_address`, options)
},
}
......@@ -3,7 +3,8 @@
"pages/index/main",
"pages/login/main",
"pages/wxPay/main",
"pages/counter/main"
"pages/counter/main",
"pages/address/main"
],
"window": {
"backgroundTextStyle": "light",
......
<template>
<div>
<p>获取微信地址</p>
</div>
</template>
<script>
import area from "@/utils/app.area.js";
import addres from "@/api/userAddress";
export default {
data() {
return {
options: "",
weChatInfo: "",
userAddressReq: {
provinceCode: "",
cityCode: "", //需传入城市code
districtCode: "",
zipcode: "",
consignee: "",
address: "",
mobilephone: "",
isDefaultShipping: 0
},
areaResult: {
provinceName: "",
cityName: "",
areaName: ""
},
areaList: area,
province_list: area.province_list,
city_list: area.city_list,
county_list: area.county_list,
provinceTwoKey: 0
};
},
onLoad(options) {
Object.assign(this.$data, this.$options.data());
this.options = options;
let that = this;
wx.chooseAddress({
success(res) {
that.disposeAddress(res);
}
});
},
methods: {
disposeAddress(val) {
if (val) {
this.weChatInfo = val;
this.userAddressReq.address = this.weChatInfo.detailInfo;
this.userAddressReq.zipcode = this.weChatInfo.postalCode;
this.userAddressReq.consignee = this.weChatInfo.userName;
this.userAddressReq.mobilephone = this.weChatInfo.telNumber;
this.areaResult.provinceName = this.weChatInfo.provinceName;
this.areaResult.cityName = this.weChatInfo.cityName;
this.areaResult.areaName = this.weChatInfo.countyName;
// 省code
if (this.areaResult.provinceName == "内蒙古自治区") {
this.areaResult.provinceName = "内蒙古";
}
if (this.areaResult.provinceName == "广西壮族自治区") {
this.areaResult.provinceName = "广西";
}
if (this.areaResult.provinceName == "西藏自治区") {
this.areaResult.provinceName = "西藏";
}
if (this.areaResult.provinceName == "宁夏回族自治区") {
this.areaResult.provinceName = "宁夏";
}
if (this.areaResult.provinceName == "新疆维吾尔自治区") {
this.areaResult.provinceName = "新疆";
}
Object.keys(this.province_list).forEach(key => {
if (this.areaResult.provinceName == this.province_list[key]) {
this.userAddressReq.provinceCode = key;
this.provinceTwoKey = key.slice(0, 2);
}
});
// 市code
Object.keys(this.city_list).forEach(key => {
if (this.areaResult.cityName == this.city_list[key]) {
if (this.provinceTwoKey == key.slice(0, 2)) {
this.userAddressReq.cityCode = key;
}
}
});
// 区code
Object.keys(this.county_list).forEach(key => {
if (this.areaResult.areaName == this.county_list[key]) {
if (this.provinceTwoKey == key.slice(0, 2)) {
this.userAddressReq.districtCode = key;
}
}
});
addres.getUserAddressList().then(res => {
if (res.data.code == 200) {
let list = res.data.data.list;
if (!list.length > 0) {
this.userAddressReq.isDefaultShipping = 1;
} else {
this.userAddressReq.isDefaultShipping = 0;
}
addres.addOrEditAddress(this.userAddressReq).then(res => {
if (res.data.code == 200) {
this.options.back += encodeURIComponent("&mpAddress=1");
console.log("!!!!!!!!!!!!!",this.options.back);
wx.reLaunch({
url: `../index/main?from=address&backpath=${this.options.back}`
});
} else {
}
});
}
});
}
}
}
};
</script>
<style>
</style>
\ No newline at end of file
import Vue from 'vue';
import App from './index';
const app=new Vue(App);
app.$mount();
\ No newline at end of file
{
"navigetionBarTitleText":"获取地址"
}
\ No newline at end of file
......@@ -79,6 +79,11 @@ export default {
wx.removeStorage({
key: "openid"
});
} else if (options.from && options.from == "address") {
this.link = decodeURIComponent(options.backpath);
console.log('???',this.link)
this.page = "";
this.params = "";
} else if (options.from == "wxPay") {
//来自支付页面
this.page = options.backpath;
......
......@@ -102,7 +102,7 @@ export default {
if (res.data.data.isHaveUnion == "true") {
//有账号
this.isHaveUnion = true;
this.backParams += `&sessionid=${res.data.data.sessionId}`;
this.backParams += `&sessionid=${res.data.data.sessionId}&needCertified=${res.data.data.NEED_CERTIFIED}`;
this.NEED_CERTIFIED = res.data.data.NEED_CERTIFIED;
wx.setStorage({
key: "sessionid",
......@@ -150,7 +150,7 @@ export default {
console.log("check", res);
if (res.data.data.isHaveUnion == "true") {
this.NEED_CERTIFIED = res.data.data.NEED_CERTIFIED;
this.backParams += `&sessionid=${res.data.data.sessionId}`;
this.backParams += `&sessionid=${res.data.data.sessionId}&needCertified=${res.data.data.NEED_CERTIFIED}`;
wx.setStorage({
key: "sessionid",
data: res.data.data.sessionId
......@@ -223,7 +223,7 @@ export default {
//绑定成功
if (res.data.code == 200) {
this.NEED_CERTIFIED = res.data.data.NEED_CERTIFIED;
this.backParams += `&sessionid=${res.data.data.sessionId}`;
this.backParams += `&sessionid=${res.data.data.sessionId}&needCertified=${res.data.data.NEED_CERTIFIED}`;
wx.setStorage({
key: "sessionid",
data: res.data.data.sessionId
......
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment