Authored by wenjiekong

联系信息做了一点

... ... @@ -12,6 +12,21 @@ const getUserInfo = uid => {
});
};
const getUserContactInfo = uid => {
return api.get('', {
method: 'web.passport.getUserContacts',
uid: uid
});
};
const getProviceCityInfo = (parentId = 0) => {
return api.get('', {
method: 'app.address.provinces',
id: parentId
});
}
module.exports = {
getUserInfo
getUserInfo,
getUserContactInfo
};
... ...
... ... @@ -119,14 +119,42 @@ const getBirthday = (birthday) => {
monthArr: monthArr,
dayArr: dayArr
};
};
/**
* 联动取地区信息
*/
const getProviceCityInfo = (parentId = 0) => {
let addressInfo = userApi.getProviceCityInfo(parentId) || '',
res = [{value:0}],
defaultText;
if (parentId.length === 2) {
defaultText = '请选择省份';
}else if ($parentId.length === 4) {
defaultText = '请选择市';
}else {
defaultText = '请选择区县';
}
res[0].text = defaultText;
if (addressInfo.code == 200) {
for (let i = addressInfo.data.length - 1; i >= 0; i--) {
res.push({
value: addressInfo.data.id,
text: addressInfo.data.caption
});
}
}
return res;
}
const getUserInfo = (channel, uid) => {
return api.all([
headerModel.requestHeaderData(channel),
userApi.getUserInfo(uid)
userApi.getUserInfo(uid),
userApi.getUserContactInfo(uid)
]).then(result => {
let finalResult = {},
headerData = {},
... ... @@ -155,7 +183,7 @@ const getUserInfo = (channel, uid) => {
gender = userInfo.gender || 3;
birthday = userInfo.birthday || '';
profession = userInfo.profession || 0;
income = userInfoincome !== undefined ? userInfo.income : 0;
income = userInfo.income || 0;
}
genderArr = configData.gender;
... ... @@ -246,6 +274,65 @@ const getUserInfo = (channel, uid) => {
}
};
}
if (result[2].code === 200) {
let contactInfo = result[2].data || '',
finalResult.contactInfo = {
subTitle: '联系信息',
submitId: 'contact-info',
region: {
labelText: '来自:',
selects: [
{
key: 'province',
options: $userContactInfo['handleProvince'],
},
{
key: 'city',
options: $userContactInfo['handleCity']
},
{
key: 'areaCode',
options: $userContactInfo['handleArea']
}
],
},
details: [
{
'labelText': '固定电话:',
'key': 'phone',
'value': $userContactInfo['phone'],
'tips': '如: 010-82831245'
},
{
'labelText': '手机号码:',
'key': 'mobile',
'value': $userContactInfo['mobile'],
'tips': '填写手机号便于接收发货和收货通知'
},
{
'labelText': 'QQ:',
'key': 'qq',
'value': $userContactInfo['qq'],
'tips': '填写QQ方便您的好友联系你'
},
{
'longInput': true,
'labelText': '联系地址:',
'key': 'fullAddress',
'value': $userContactInfo['fullAddress'],
'tips': '请填写详细地址'
},
{
'labelText': '邮编:',
'key': 'zipCode',
'value': $userContactInfo['zipCode'],
'tips': '请输入收货人所在地邮编号'
},
],
},
}
... ...