micro_mall_xcx/services/usercenter/fetchUsercenter.js

39 lines
1.1 KiB
JavaScript

import {
request
} from '../_utils/request';
import {
getStorage
} from '~/utils/storage'
/** 获取个人中心信息 */
export function fetchUserCenter() {
const userData = getStorage('userInfo');
return new Promise((resolve, reject) => {
request({
url: `CustomerApi/getCustomerDetails?CustomerGuid=` + userData?.customerGuid,
method: 'GET',
success: function (res) {
let data = {
userInfo: {
avatarUrl: res.data.customerAvatar,
nickName: res.data.customerNickname,
phoneNumber: res.data.customerMobilePhoneNumber,
},
collectData: {
collectCount: res.data.collectCount,
historyCount: res.data.historyCount,
waitPayCount: res.data.waitPayCount,
deliverCount: res.data.deliverCount,
packageCount: res.data.packageCount,
commentCount: res.data.commentCount,
exchangCount: res.data.exchangCount,
}
};
resolve(data);
},
fail: function (error) {
reject(error);
}
});
});
}