Browse Source

统一处理baseinfo

devlop
邓雄飞 4 years ago
parent
commit
fe3faf837e
4 changed files with 19 additions and 12 deletions
  1. 2
      apis/addUserApi.js
  2. 15
      apis/commonApi.js
  3. 10
      pages/login/index.vue
  4. 4
      pages/mine/index.vue

2
apis/addUserApi.js

@ -16,7 +16,7 @@ export function getCompanyInfoById(data) {
}) })
} }
// 根据id查询企业详细信息
// 添加客户
export function addCustomer(data) { export function addCustomer(data) {
return http.post({ return http.post({
url: '/yyt-uec/supplier/create/customer', url: '/yyt-uec/supplier/create/customer',

15
apis/commonApi.js

@ -1,4 +1,5 @@
import http from '../utils/http/index.js' import http from '../utils/http/index.js'
import store from '@/store/index'
let areaCache = null let areaCache = null
/** /**
* 获取省市区街道 * 获取省市区街道
@ -22,6 +23,20 @@ export function getArea(data = {}) {
} }
let baseInfo = 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 {object} data 参数,暂时不需要,可以传{}

10
pages/login/index.vue

@ -1,5 +1,5 @@
<template> <template>
<view>
<view style="background-color: white">
<uni-nav-bar :fixed="true" color="#ffffff" background-color="#ffffff" :status-bar="true" :border="false" left-icon="closeempty" @clickLeft="close" /> <uni-nav-bar :fixed="true" color="#ffffff" background-color="#ffffff" :status-bar="true" :border="false" left-icon="closeempty" @clickLeft="close" />
<view class="logo_area"> <view class="logo_area">
<image class="logo" src="/static/logo.png"></image> <image class="logo" src="/static/logo.png"></image>
@ -160,14 +160,6 @@ export default {
if (!res.enterpriseList || res.enterpriseList.length === 0) { if (!res.enterpriseList || res.enterpriseList.length === 0) {
go2('enterprise-info', { operation: 'add' }, true) go2('enterprise-info', { operation: 'add' }, true)
} else { } else {
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 })
go2('client') go2('client')
} }
} }

4
pages/mine/index.vue

@ -17,7 +17,7 @@
<view v-else> <view v-else>
<view class="user__name"> <view class="user__name">
<text class="name">{{ userInfo.name }}</text> <text class="name">{{ userInfo.name }}</text>
<image v-if="userInfo.fddEnterpriseStatus === fddStatus.UNCERTIFIED" class="image" src="/static/imgs/mine/certified-icon.png"></image>
<image v-if="userInfo.fddEnterpriseStatus === fddStatus.CERTIFIED_SUCCESS" class="image" src="/static/imgs/mine/certified-icon.png"></image>
<image v-else class="image" @click="certifyCompany()" src="/static/imgs/mine/non-certified-icon.png"></image> <image v-else class="image" @click="certifyCompany()" src="/static/imgs/mine/non-certified-icon.png"></image>
</view> </view>
<view style="margin-top: 10rpx"> <view style="margin-top: 10rpx">
@ -135,7 +135,7 @@
<script> <script>
import { exit, go2 } from '@/utils/hook.js' import { exit, go2 } from '@/utils/hook.js'
import { fddEnterpriseStatus } from '@/enums/index.js' import { fddEnterpriseStatus } from '@/enums/index.js'
import { getBaseInfo } from '@/apis/commonApi.js'
import { getBaseInfo, getVerifyUrl } from '@/apis/commonApi.js'
import qnDataPicker from '@/components/qn-data-picker/qn-data-picker.vue' import qnDataPicker from '@/components/qn-data-picker/qn-data-picker.vue'
import { dateTimeFormat } from '@/utils/index.js' import { dateTimeFormat } from '@/utils/index.js'
import { getOrderStatistics } from '@/apis/mineApi.js' import { getOrderStatistics } from '@/apis/mineApi.js'

Loading…
Cancel
Save