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 \ No newline at end of file
...@@ -177,5 +177,14 @@ class UsersApi { ...@@ -177,5 +177,14 @@ class UsersApi {
} }
) )
} }
/**根据商户查询商户下级列表 */
findSubordinateListByPage(data) {
return api.post({
method: `merchants.api.open.findSubordinateListByPage`,
...data,
},false,'merchant')
}
} }
export default UsersApi export default UsersApi
\ No newline at end of file \ No newline at end of file
import { import {
setSessionId, setSessionId,
setUserInfo setUserInfo,
setSubMerchant
} from '~/utils/cache/storageApi' } from '~/utils/cache/storageApi'
import USERAPI from '~/api/usersApi/index' import USERAPI from '~/api/usersApi/index'
const setRouteData = targetPath => { const setRouteData = targetPath => {
...@@ -32,21 +33,34 @@ const selectAccountLogin = ({ ...@@ -32,21 +33,34 @@ const selectAccountLogin = ({
message message
}) => { }) => {
if (code == '0') { if (code == '0') {
console.log(data)
setLoginInfo(data.loginUserInfoList[0], data.sessionId) setLoginInfo(data.loginUserInfoList[0], data.sessionId)
} else wx.$api.showToast(message || '系统异常') } 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) { if (!userInfo) {
wx.$api.showToast('仅支持服务商类型账户登录') wx.$api.showToast('账户错误')
return return
} }
// 自动创建服务中心
// initServiceCenter()
setUserInfo(userInfo) setUserInfo(userInfo)
setSessionId(sessionId) setSessionId(sessionId)
try {
await findSubordinateListByPage(userInfo)
} catch (error) {
}
loginSuccess() loginSuccess()
} }
const initServiceCenter = () => { const initServiceCenter = () => {
......
...@@ -37,6 +37,7 @@ Page({ ...@@ -37,6 +37,7 @@ Page({
// wx.$storage.rm('fileList') // wx.$storage.rm('fileList')
wx.$storage.rm('sessionId') wx.$storage.rm('sessionId')
wx.$storage.rm('userInfo') wx.$storage.rm('userInfo')
wx.$storage.rm('subMerchant')
wx.$storage.rm('auto_login_object') wx.$storage.rm('auto_login_object')
wx.$storage.rm('posterId') wx.$storage.rm('posterId')
wx.$storage.rm("mock_data") wx.$storage.rm("mock_data")
......
...@@ -83,53 +83,16 @@ Component({ ...@@ -83,53 +83,16 @@ Component({
crowdOrderObj: {} 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) { getBusiStatistics(isReset = false, isBusiTab = false) {
let sortTabModule = this.selectComponent('#sortTab') let sortTabModule = this.selectComponent('#sortTab')
if (sortTabModule && isBusiTab) { if (sortTabModule && isBusiTab) {
sortTabModule.resetAllAsc() sortTabModule.resetAllAsc()
} }
let sortSearchData = sortTabModule ? sortTabModule.dealParams() : {} let sortSearchData = sortTabModule ? sortTabModule.dealParams() : {}
let { userInfo } = wx.$storage.get() let { subMerchant } = wx.$storage.get()
let params = { let params = {
...sortSearchData, ...sortSearchData,
merchantIds: userInfo.subLoginUser.permissionMerchantIds, merchantIds: subMerchant,
} }
outputApi.getBusiStatistics(params).then(res => { outputApi.getBusiStatistics(params).then(res => {
this.resetBusiData() this.resetBusiData()
......
...@@ -55,7 +55,7 @@ Page({ ...@@ -55,7 +55,7 @@ Page({
init() { init() {
this.setUserInfo() this.setUserInfo()
this.getMerchantRange() this.getMerchantRange()
this.getMockInfo() // this.getMockInfo()
}, },
setUserInfo() { setUserInfo() {
let { userInfo } = wx.$storage.get() let { userInfo } = wx.$storage.get()
......
...@@ -119,6 +119,8 @@ ...@@ -119,6 +119,8 @@
] ]
} }
}, },
"setting": {}, "setting": {
"urlCheck": false
},
"projectname": "store-assistant-assemble" "projectname": "store-assistant-assemble"
} }
\ No newline at end of file \ No newline at end of file
...@@ -12,6 +12,12 @@ export function setSessionId(sessionId) { ...@@ -12,6 +12,12 @@ export function setSessionId(sessionId) {
export function getUserInfo() { export function getUserInfo() {
return $Storage.get('userInfo') return $Storage.get('userInfo')
} }
export function getSubMerchant() {
return $Storage.get('subMerchant')
}
export function setSubMerchant(data) {
$Storage.set('subMerchant', data)
}
export function setUserInfo(data) { export function setUserInfo(data) {
console.log(data) console.log(data)
$Storage.set('userInfo', data) $Storage.set('userInfo', data)
......
export const IMG_URL = 'https://img02.glsx.com.cn/weapp/resource/saas/business-assistant/' 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/' export const IMG_URL_STORE = 'https://img02.glsx.com.cn/weapp/resource/miniprogram/'
// 缓存get方法为空的默认指定值 // 缓存get方法为空的默认指定值
export const DEFAULT_GET_STORAGEKEY = ['sessionId', 'merchantId', 'userInfo'] export const DEFAULT_GET_STORAGEKEY = ['sessionId', 'merchantId', 'userInfo','subMerchant']
// 缓存get方法key的对应才映射值 // 缓存get方法key的对应才映射值
export const STORAGE_OBJECTkEY = { export const STORAGE_OBJECTkEY = {
...@@ -18,7 +18,8 @@ export const STORAGE_OBJECTkEY = { ...@@ -18,7 +18,8 @@ export const STORAGE_OBJECTkEY = {
disLikeRecordFlag: 'disLikeRecordFlag', disLikeRecordFlag: 'disLikeRecordFlag',
fileList: 'fileList', fileList: 'fileList',
posterId: 'posterId', posterId: 'posterId',
mock_data: 'mock_data' mock_data: 'mock_data',
subMerchant: 'subMerchant'
} }
export const IMG_VERSION = () => { export const IMG_VERSION = () => {
......
...@@ -111,19 +111,23 @@ const domain = { ...@@ -111,19 +111,23 @@ const domain = {
}, },
dev: { dev: {
dj: 'https://dj.dev.glsx.com.cn', 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: { uat: {
dj: 'https://dj.test.glsx.com.cn', 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: { prod: {
dj: 'https://dj.glsx.com.cn', 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: { preRelease: {
dj: 'https://dj.beta.glsx.com.cn', 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]] }[target[index]]
...@@ -145,7 +149,8 @@ const pathEnum = { ...@@ -145,7 +149,8 @@ const pathEnum = {
business: '/rop-scrm-entmicro/', business: '/rop-scrm-entmicro/',
stoassistant: '/rop-scrm-stoassistant/', stoassistant: '/rop-scrm-stoassistant/',
assistant: '/rop-scrm-stoassistant/', assistant: '/rop-scrm-stoassistant/',
busassistant: '/rop-scrm-busassistant/' busassistant: '/rop-scrm-busassistant/',
'rop-merchants': '/rop-merchants/'
} }
const defaultMerchantId = { const defaultMerchantId = {
ip: '44184606', ip: '44184606',
......
...@@ -45,6 +45,7 @@ class Request { ...@@ -45,6 +45,7 @@ class Request {
if (code == 20 || code == 21) { if (code == 20 || code == 21) {
wx.$storage.rm('sessionId') wx.$storage.rm('sessionId')
wx.$storage.rm('userInfo') wx.$storage.rm('userInfo')
wx.$storage.rm('subMerchant')
const thisPage = wx.$router.getPageInstance(), const thisPage = wx.$router.getPageInstance(),
autoLoginObject = wx.$storage.get('auto_login_object') autoLoginObject = wx.$storage.get('auto_login_object')
if (thisPage.route == 'login/loading/loading') { 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!