Commit 6f2e41a3 by 前端

fixed

1 parent 089669a9
import api from '~/utils/request/request'
module.exports = {
/**根据商户查询商户下级列表 */
findSubordinateListByPage(data) {
return api.post({
method: `merchants.api.open.findSubordinateListByPage`,
...data
})
}
}
\ No newline at end of file
import {
setSessionId,
setUserInfo
setUserInfo,
setSubMerchant
} from '~/utils/cache/storageApi'
import USERAPI from '~/api/usersApi/index'
const setRouteData = targetPath => {
......@@ -32,21 +33,34 @@ const selectAccountLogin = ({
message
}) => {
if (code == '0') {
console.log(data)
setLoginInfo(data.loginUserInfoList[0], data.sessionId)
} else wx.$api.showToast(message || '系统异常')
})
}
/**获取门店号下的全部门店 */
const findSubordinateListByPage = (userInfo)=> {
return new Promise(resolve=>{
USERAPI.findSubordinateListByPage({pageSize:10000,pageNum:1,merchantId:userInfo.merchantId,apiProjectName:'rop-merchants'}).then(res=>{
const list = res.data||[]
const merchant = list.map(i=>i.merchantNo)
setSubMerchant(merchant)
resolve()
})
})
}
/**设置登录信息 */
const setLoginInfo = (userInfo, sessionId) => {
const setLoginInfo = async (userInfo, sessionId) => {
if (!userInfo) {
wx.$api.showToast('仅支持服务商类型账户登录')
wx.$api.showToast('账户错误')
return
}
// 自动创建服务中心
// initServiceCenter()
setUserInfo(userInfo)
setSessionId(sessionId)
try {
await findSubordinateListByPage(userInfo)
} catch (error) {
}
loginSuccess()
}
const initServiceCenter = () => {
......
......@@ -37,6 +37,7 @@ Page({
// wx.$storage.rm('fileList')
wx.$storage.rm('sessionId')
wx.$storage.rm('userInfo')
wx.$storage.rm('subMerchant')
wx.$storage.rm('auto_login_object')
wx.$storage.rm('posterId')
wx.$storage.rm("mock_data")
......
......@@ -83,53 +83,16 @@ Component({
crowdOrderObj: {}
})
},
// 众筹数据处理
dealCrowdObj(data) {
let _obj = {
totalNum: data.activityTotal,
totalOrderCount: data.orderTotal,
totalAmount: data.totalAmount,
activityList: data.activityList || []
}
_obj.activityList.forEach(k => {
// 时间
k.time = k.startTime.slice(0, 16).replace(/-/g, '.') + ' - ' + k.endTime.slice(0, 16).replace(/-/g, '.')
let startTimeFormat = k.startTime.slice(0, 10).replace(/-/g, '/') + ' 00:00:00'
let nowDateFormat = new Date().toLocaleDateString().replace(/-/g, '/') + ' 23:59:59'
// activityStatus 1:未开始 2:进行中 3:已结束
switch (k.activityStatus) {
case 1:
k.interDays = parseInt((new Date(startTimeFormat).getTime() - new Date().getTime()) / (1000 * 60 * 60 * 24)) + 1
k.realTime = '-'
break
case 2:
let endTimeFormat = k.endTime.slice(0, 10).replace(/-/g, '/') + ' 23:59:59'
k.interDays = parseInt((new Date().getTime() - new Date(startTimeFormat).getTime()) / (1000 * 60 * 60 * 24)) + 1
k.toEndDays = parseInt((new Date(endTimeFormat).getTime() - new Date(nowDateFormat).getTime()) / (1000 * 60 * 60 * 24)) + 1
k.realTime = k.realStartTime?.slice(0, 16).replace(/-/g, '.') + ' - ' + '已开始' + k.interDays + '天'
break
case 3:
k.interDays = parseInt((new Date(nowDateFormat).getTime() - new Date(k.endTime.replace(/-/g, '/')).getTime()) / (1000 * 60 * 60 * 24)) + 1
k.realTime = (k.realStartTime?.slice(0, 16).replace(/-/g, '.') || '') + ' - ' + (k.realEndTime?.slice(0, 16).replace(/-/g, '.') || '')
break
}
})
this.setData({
crowdOrderObj: _obj
})
},
getBusiStatistics(isReset = false, isBusiTab = false) {
let sortTabModule = this.selectComponent('#sortTab')
if (sortTabModule && isBusiTab) {
sortTabModule.resetAllAsc()
}
let sortSearchData = sortTabModule ? sortTabModule.dealParams() : {}
let { userInfo } = wx.$storage.get()
let { subMerchant } = wx.$storage.get()
let params = {
...sortSearchData,
merchantIds: userInfo.subLoginUser.permissionMerchantIds,
merchantIds: subMerchant,
}
outputApi.getBusiStatistics(params).then(res => {
this.resetBusiData()
......
......@@ -55,7 +55,7 @@ Page({
init() {
this.setUserInfo()
this.getMerchantRange()
this.getMockInfo()
// this.getMockInfo()
},
setUserInfo() {
let { userInfo } = wx.$storage.get()
......
......@@ -119,6 +119,8 @@
]
}
},
"setting": {},
"setting": {
"urlCheck": false
},
"projectname": "store-assistant-assemble"
}
\ No newline at end of file
......@@ -12,6 +12,12 @@ export function setSessionId(sessionId) {
export function getUserInfo() {
return $Storage.get('userInfo')
}
export function getSubMerchant() {
return $Storage.get('subMerchant')
}
export function setSubMerchant(data) {
$Storage.set('subMerchant', data)
}
export function setUserInfo(data) {
console.log(data)
$Storage.set('userInfo', data)
......
export const IMG_URL = 'https://img02.glsx.com.cn/weapp/resource/saas/business-assistant/'
export const IMG_URL_STORE = 'https://img02.glsx.com.cn/weapp/resource/miniprogram/'
// 缓存get方法为空的默认指定值
export const DEFAULT_GET_STORAGEKEY = ['sessionId', 'merchantId', 'userInfo']
export const DEFAULT_GET_STORAGEKEY = ['sessionId', 'merchantId', 'userInfo','subMerchant']
// 缓存get方法key的对应才映射值
export const STORAGE_OBJECTkEY = {
......@@ -18,7 +18,8 @@ export const STORAGE_OBJECTkEY = {
disLikeRecordFlag: 'disLikeRecordFlag',
fileList: 'fileList',
posterId: 'posterId',
mock_data: 'mock_data'
mock_data: 'mock_data',
subMerchant: 'subMerchant'
}
export const IMG_VERSION = () => {
......
......@@ -111,19 +111,23 @@ const domain = {
},
dev: {
dj: 'https://dj.dev.glsx.com.cn',
scrm: 'https://scrm.dev.glsx.com.cn'
scrm: 'https://scrm.dev.glsx.com.cn',
merchant: "http://rop-merchant.dev.glsx.com.cn",
},
uat: {
dj: 'https://dj.test.glsx.com.cn',
scrm: 'https://scrm.test.glsx.com.cn'
scrm: 'https://scrm.test.glsx.com.cn',
merchant: "https://rop-merchant.test.glsx.com.cn"
},
prod: {
dj: 'https://dj.glsx.com.cn',
scrm: 'https://scrm.glsx.com.cn'
scrm: 'https://scrm.glsx.com.cn',
merchant: "https://commodity.glsx.com.cn"
},
preRelease: {
dj: 'https://dj.beta.glsx.com.cn',
scrm: 'https://scrm.beta.glsx.com.cn'
scrm: 'https://scrm.beta.glsx.com.cn',
merchant: "https://rop-merchant.beta.glsx.com.cn"
}
}[target[index]]
......@@ -145,7 +149,8 @@ const pathEnum = {
business: '/rop-scrm-entmicro/',
stoassistant: '/rop-scrm-stoassistant/',
assistant: '/rop-scrm-stoassistant/',
busassistant: '/rop-scrm-busassistant/'
busassistant: '/rop-scrm-busassistant/',
'rop-merchants': '/rop-merchants/'
}
const defaultMerchantId = {
ip: '44184606',
......
......@@ -45,6 +45,7 @@ class Request {
if (code == 20 || code == 21) {
wx.$storage.rm('sessionId')
wx.$storage.rm('userInfo')
wx.$storage.rm('subMerchant')
const thisPage = wx.$router.getPageInstance(),
autoLoginObject = wx.$storage.get('auto_login_object')
if (thisPage.route == 'login/loading/loading') {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!