Commit 52cbc115 by 王志慧
2 parents 302c7881 94e57406
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 = () => {
......
...@@ -29,40 +29,49 @@ Component({ ...@@ -29,40 +29,49 @@ Component({
data: { data: {
dataType: { dataType: {
crowType: [{ crowType: [{
label: '转发次数', label: '产值',
value: 1 value: 1
},{
label: '转发次数',
value: 2
}, { }, {
label: '访客总数', label: '访客总数',
value: 2 value: 3
}, { }, {
label: '浏览总数', label: '浏览总数',
value: 3 value: 4
}, { }, {
label: '成交单量', label: '成交单量',
value: 4 value: 5
}, { }, {
label: '转化率', label: '转化率',
value: 5 value: 6
}], }],
boutique: [{ boutique: [{
label: '单量', label: '产值',
value: 1 value: 1
},{
label: '单量',
value: 2
}, { }, {
label: '客单量', label: '客单量',
value: 2 value: 3
}, { }, {
label: '转化率', label: '转化率',
value: 3 value: 4
}], }],
equity: [{ equity: [{
label: '成交量', label: '产值',
value: 1 value: 1
},{
label: '成交量',
value: 2
}, { }, {
label: '报价量', label: '报价量',
value: 2 value: 3
}, { }, {
label: '转化率', label: '转化率',
value: 3 value: 4
}] }]
}, },
empName: '', empName: '',
...@@ -78,6 +87,7 @@ Component({ ...@@ -78,6 +87,7 @@ Component({
showUp() { showUp() {
this.setData({show:false}) this.setData({show:false})
}, },
//选择排序
selectType(e) { selectType(e) {
const {value,label} = e.target.dataset const {value,label} = e.target.dataset
this.setData({ this.setData({
...@@ -114,7 +124,6 @@ Component({ ...@@ -114,7 +124,6 @@ Component({
// 生成对应的表格数据 // 生成对应的表格数据
getDetail(val) { getDetail(val) {
let {tabelTh,dataType,selectValue,downType} = this.data,sortKey let {tabelTh,dataType,selectValue,downType} = this.data,sortKey
console.log(tabelTh)
for(let i in tabelTh) { for(let i in tabelTh) {
if(tabelTh[i] == dataType[downType][selectValue-1].label) { if(tabelTh[i] == dataType[downType][selectValue-1].label) {
sortKey = i sortKey = i
...@@ -123,22 +132,6 @@ Component({ ...@@ -123,22 +132,6 @@ Component({
const tableData = Util.deepClone(val).sort((a,b)=>{ const tableData = Util.deepClone(val).sort((a,b)=>{
return (b[sortKey]||0)-(a[sortKey]||0) return (b[sortKey]||0)-(a[sortKey]||0)
}) })
// let obj = {
// employeeName: '员工姓名',
// orderMoneyTotal: '产值(营业额)',
// upgradeCountTotal: '单量',
// averagePrice: '客单价',
// upgradeRatio: '转化率'
// }
// obj = {
// employeeName: '员工姓名',
// orderMoneyTotal: '产值(营业额)',
// upgradeCountTotal: '转发次数',
// averagePrice: '访客总数',
// upgradeRatio: '浏览总数',
// upgradeRatio: '成交单量',
// upgradeRatio: '转化率',
// }
const sfaffList = this.formatArr(tableData, (item) => { const sfaffList = this.formatArr(tableData, (item) => {
const result = [] const result = []
const obj_keys = Object.keys(tabelTh) const obj_keys = Object.keys(tabelTh)
......
...@@ -39,7 +39,6 @@ ...@@ -39,7 +39,6 @@
.up-box { .up-box {
position: absolute; position: absolute;
width: 108rpx; width: 108rpx;
height: 160rpx;
background: #FFFFFF; background: #FFFFFF;
box-shadow: 0 0 18rpx 0 #3a596a1c; box-shadow: 0 0 18rpx 0 #3a596a1c;
border-radius: 8rpx; border-radius: 8rpx;
......
...@@ -30,7 +30,8 @@ ...@@ -30,7 +30,8 @@
<view class='item_name'>{{item.name}}</view> <view class='item_name'>{{item.name}}</view>
<view wx:for="{{item.list[item.val]}}" wx:for-item="litem" wx:for-index="lindex" wx:key="lindex" class='item_name item_desc'> <view wx:for="{{item.list[item.val]}}" wx:for-item="litem" wx:for-index="lindex" wx:key="lindex" class='item_name item_desc'>
<image wx:if="{{item.name == '员工'}}" src="{{item.list['avatarUrl' || 'shareImageUrl'][lindex]}}"></image> <image wx:if="{{item.name == '员工'}}" src="{{item.list['avatarUrl' || 'shareImageUrl'][lindex]}}"></image>
<block>{{litem||'--'}}</block> <block wx:if="{{item.name == '转化率'}}">{{litem?(downType == 'equity'?litem*100:litem)+'%': '--'}}</block>
<block wx:else>{{litem||'--'}}</block>
</view> </view>
</view> </view>
</view> </view>
......
...@@ -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!