|
|
import AddressService from './AddressService.js'
|
|
|
import AddressService from './addressService.js'
|
|
|
|
|
|
// import {
|
|
|
// logEvent,
|
...
|
...
|
@@ -28,7 +28,7 @@ Page({ |
|
|
current_page_name: 'addressManager',
|
|
|
current_page_param: '',
|
|
|
|
|
|
//data for edit page
|
|
|
//data for edit page
|
|
|
editeAddressPage: {
|
|
|
currentEditMode: modeAdd,
|
|
|
_consignee: "",
|
...
|
...
|
@@ -36,7 +36,9 @@ Page({ |
|
|
_detailAddress: "",
|
|
|
_area_code: 0,
|
|
|
_address: "",
|
|
|
_id: "",},
|
|
|
_id: "",
|
|
|
_is_default: "N",
|
|
|
},
|
|
|
|
|
|
currentSelectedIndex: -1,
|
|
|
addType: 'none' // normal or wechat
|
...
|
...
|
@@ -216,6 +218,7 @@ Page({ |
|
|
let area_code = e.currentTarget.dataset.area_code;
|
|
|
let address = e.currentTarget.dataset.address;
|
|
|
let detailAddress = e.currentTarget.dataset.detail_address;
|
|
|
let is_default = e.currentTarget.dataset.is_default;
|
|
|
let newEditeAddressPage = Object.assign(this.data.editeAddressPage, {
|
|
|
_consignee: consignee,
|
|
|
_mobile: mobile,
|
...
|
...
|
@@ -224,7 +227,9 @@ Page({ |
|
|
_detailAddress: detailAddress,
|
|
|
_page_name: '编辑地址',
|
|
|
_id: id,
|
|
|
currentEditMode: modeEdit,});
|
|
|
currentEditMode: modeEdit,
|
|
|
_is_default: is_default,
|
|
|
});
|
|
|
|
|
|
var timestamp = Date.parse(new Date());
|
|
|
try {
|
...
|
...
|
@@ -277,7 +282,6 @@ Page({ |
|
|
},
|
|
|
|
|
|
addButtonTapped: function() {
|
|
|
console.log('===============');
|
|
|
|
|
|
// if (app.globalData.userInfo.uid == 0 || app.globalData.userInfo.uid == undefined){
|
|
|
// //未登录状态
|
...
|
...
|
@@ -305,7 +309,7 @@ Page({ |
|
|
// })
|
|
|
// return;
|
|
|
// }
|
|
|
console.log('===============');
|
|
|
|
|
|
let newEditeAddressPage = Object.assign(this.data.editeAddressPage, {
|
|
|
currentEditMode: modeAdd,
|
|
|
_consignee: "",
|
...
|
...
|
@@ -418,10 +422,9 @@ Page({ |
|
|
|
|
|
let api = new AddressService().yohoApi();
|
|
|
api.fetchAddressList(params)
|
|
|
.then(json => {
|
|
|
console.log(json)
|
|
|
if (json && json.code && json.code == 200) {
|
|
|
this.data.items = json.data
|
|
|
.then(data => {
|
|
|
if (data) {
|
|
|
this.data.items = data
|
|
|
let currentSelectedIndex = -1;
|
|
|
this.data.items.map((item, index) => {
|
|
|
if (this.data.address_id == item.address_id) {
|
...
|
...
|
|