You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
88 lines
2.4 KiB
88 lines
2.4 KiB
import http from '../utils/http/index.js'
|
|
import store from '@/store/index'
|
|
let areaCache = null
|
|
/**
|
|
* 获取省市区街道
|
|
* @returns array
|
|
*/
|
|
export function getArea(data = {}) {
|
|
return new Promise((resolve, reject) => {
|
|
if (areaCache) {
|
|
resolve(areaCache)
|
|
} else {
|
|
http.get({ url: '/yyt-uec/get/regions', data }).then((res) => {
|
|
if (res) {
|
|
areaCache = res
|
|
resolve(res)
|
|
} else {
|
|
resolve(null)
|
|
}
|
|
})
|
|
}
|
|
})
|
|
}
|
|
|
|
let baseInfo = null
|
|
|
|
// 处理store同步问题
|
|
function syncStore(res) {
|
|
if (res.enterpriseList && res.enterpriseList.length > 0) {
|
|
let supplierInfo = res.enterpriseList[0]
|
|
store.commit('setSupplierInfo', {
|
|
id: supplierInfo.id,
|
|
name: supplierInfo.name,
|
|
fddEnterpriseStatus: supplierInfo.fddEnterpriseStatus,
|
|
supplierId: supplierInfo.supplier.id
|
|
})
|
|
store.commit('setUserInfo', { name: supplierInfo.employeeName, userId: res.userId, mobile: res.mobile, avatar: null })
|
|
}
|
|
}
|
|
/**
|
|
* 获取当前账号的基础信息
|
|
* @param {object} data 参数,暂时不需要,可以传{}
|
|
* @param {boolean} refresh 是否强制刷新,默认false拿缓存数据
|
|
* @returns object
|
|
*/
|
|
export function getBaseInfo(data = {}, refresh = false) {
|
|
return new Promise((resolve, reject) => {
|
|
if (!refresh && baseInfo) {
|
|
resolve(baseInfo)
|
|
} else {
|
|
http.get({ url: '/yyt-uec/get/base-info', data }, { hideLoading: true }).then((res) => {
|
|
if (res) {
|
|
baseInfo = res
|
|
syncStore(res)
|
|
resolve(res)
|
|
} else {
|
|
resolve(null)
|
|
}
|
|
})
|
|
}
|
|
})
|
|
}
|
|
|
|
/**
|
|
* 获取当前账号的企业实名认证地址
|
|
* @param {object} data 参数 enterpriseId
|
|
*/
|
|
export function getVerifyUrl(data = {}) {
|
|
return http.post({ url: '/yyt-uec/get/fdd-enterprise-verify-url?enterpriseId=' + data.enterpriseId, data })
|
|
}
|
|
|
|
/**
|
|
* 生成担保合同的签约地址,同意纸盘商只需要签约一次即可
|
|
* @param {object} data 参数 mallSupplierId
|
|
*/
|
|
export function getGuaranteeContract(data = {}) {
|
|
return http.post({ url: '/yyt-uec/create/supplier/guarantee-contract?mallSupplierId=' + data.mallSupplierId, data })
|
|
}
|
|
/**
|
|
* 转换合同成图片
|
|
* @param {object} data 图片地址链接 fileUrl
|
|
*/
|
|
export function transformFileToImg(data) {
|
|
http.get({
|
|
url: '/document/get/enterprise-documents/file-image-base64',
|
|
data: data
|
|
})
|
|
}
|