Commit b6aa6829 by zhangxw

部分联调

1 parent 19d169bd
......@@ -46,5 +46,42 @@ class mineApi {
// true
)
}
// 获取服务中心下拉筛选 所有服务商数据
getServiceCenterListAPI(data) {
return api.post(
{
method: 'scrm.api.busassistant.serviceCenter.listByServiceMerchantId',
...data
}
)
}
// 获取员工列表
getStaffListAPI(data) {
return api.post(
{
method: 'merchants.api.open.serviceCenter.searchStaffPage',
...data
}
)
}
// 创建员工
createStaffAPI(data) {
return api.post(
{
method: 'merchants.api.open.serviceCenter.createStaff',
...data
}
)
}
// 更新员工
updateStaffAPI(data) {
return api.post(
{
method: 'merchants.api.open.serviceCenter.updateStaff',
...data
}
)
}
}
export default mineApi
<view class="navigation-bar" id="navigation-bar" style="padding-top:{{statusBarHeight}}px;height:{{navigationBarHeight}}px;{{navStyle}}">
<block wx:if="{{!custom}}">
<view class="navigation-bar-box" wx:if="{{showNavBar}}" style="{{navigationBarStyle}}">
<block wx:if="{{SHOWBACK || customBack}}">
<block wx:if="{{SHOWBACK}}">
<view class="back " bindtap="back">
<image class="img" src="./images/icon-back.png" />
</view>
......
......@@ -7,7 +7,30 @@ Component({
* 组件的属性列表
*/
properties: {
show: Boolean,
show: {
type: Boolean,
observer: function(n) {
if (n) {
let { serviceList, selectInfo } = this.data
console.log(serviceList)
let activeIndex = serviceList.findIndex(v => v.yqMerchantId == selectInfo?.yqMerchantId)
serviceList.forEach((item, ind) => {
item.show = true
if (activeIndex == ind) {
item.act = true
} else {
item.act = false
}
this.setData({
serviceList
})
})
this.setData({
searchKeyword: ''
})
}
}
},
serviceList: Array,
selectInfo: Object,
tabBarStyle: String
......@@ -17,6 +40,7 @@ Component({
* 组件的初始数据
*/
data: {
searchKeyword: ''
},
/**
* 组件的方法列表
......@@ -26,7 +50,7 @@ Component({
let { item } = e.currentTarget.dataset
let { serviceList } = this.data
serviceList.forEach((val, ind) => {
if (item.serviceCode == val.serviceCode) {
if (item.yqMerchantId == val.yqMerchantId) {
val.act = true
} else {
val.act = false
......@@ -38,16 +62,22 @@ Component({
})
this.triggerEvent('hiddenSelectConfirm', item)
},
input(e) {
search(e) {
let { serviceList } = this.data
let { value } = e.detail
let { value } = e.currentTarget.dataset && Object.keys(e.currentTarget.dataset).length ? e.currentTarget.dataset : e.detail
serviceList.forEach(item => {
item.act = false
item.show = item.serviceCode?.includes(value)
item.show = item.yqMerchantName?.includes(value)
})
this.setData({
serviceList
})
},
input(e) {
let { value } = e.detail
this.setData({
searchKeyword: value
})
}
}
})
\ No newline at end of file
......@@ -16,7 +16,7 @@
<image src="/images/clear.png" class="search-clear" bindtap="clear" />
</block>
</view>
<view class="search" bindtap="showConfirm">
<view class="search" bindtap="search" data-value="{{searchKeyword}}">
<view class="text-center">搜索</view>
</view>
</view>
......@@ -36,8 +36,9 @@
<view
class="service-items text-hide {{item.act?'active':''}}"
data-item="{{item}}"
hidden="{{!item.show}}"
bindtap="select">
{{item.serviceName}}
{{item.yqMerchantName}}
</view>
</block>
</scroll-view>
......
// pages/tab/output/components/accountSwitchingPop/accountSwitchingPop.js
import { IMG_URL } from '~/utils/constantData.js'
import USERAPI from '~/api/usersApi/index'
import { setUserInfo } from '~/utils/cache/storageApi'
Component({
options: {
addGlobalClass: true
......@@ -15,22 +13,26 @@ Component({
value: false,
observer: function (n) {
if (n) {
let { merchantRange, selectInfo } = this.data
let activeIndex = merchantRange.findIndex(v => v.serviceCode == selectInfo.serviceCode)
merchantRange.forEach((item, ind) => {
let { serviceRange, selectInfo } = this.data
let activeIndex = serviceRange.findIndex(v => v.yqMerchantId == selectInfo.yqMerchantId)
serviceRange.forEach((item, ind) => {
item.show = true
if (activeIndex == ind) {
item.act = true
} else {
item.act = false
}
this.setData({
merchantRange
serviceRange
})
})
this.setData({
searchKeyword: ''
})
}
}
},
merchantRange: Object,
serviceRange: Object,
selectInfo: Object
},
......@@ -39,12 +41,13 @@ Component({
*/
data: {
IMG_URL,
merchantList: []
serviceList: [],
searchKeyword: ''
},
observers: {
merchantRange: function (e) {
serviceRange: function (e) {
this.setData({
merchantList: e
serviceList: e
})
}
},
......@@ -56,8 +59,8 @@ Component({
this.triggerEvent('hidePopup')
},
confirm() {
let { merchantRange, subIndex } = this.data
let actObj = merchantRange.find((item, index) => {
let { serviceRange, subIndex } = this.data
let actObj = serviceRange.find((item, index) => {
if (item.act) {
subIndex = index
}
......@@ -81,28 +84,33 @@ Component({
},
select(e) {
let { index } = e.currentTarget.dataset
let { merchantRange } = this.data
merchantRange.forEach((item, ind) => {
let { serviceRange } = this.data
serviceRange.forEach((item, ind) => {
if (index == ind) {
item.act = true
} else {
item.act = false
}
this.setData({
merchantRange
serviceRange
})
})
},
input(e) {
let { merchantRange } = this.data
let { value } = e.detail
merchantRange.forEach(item => {
search(e) {
let { serviceRange } = this.data
let { value } = e.currentTarget.dataset && Object.keys(e.currentTarget.dataset).length ? e.currentTarget.dataset : e.detail
serviceRange.forEach(item => {
item.act = false
item.show = item.serviceCode?.includes(value)
// = show
item.show = item.yqMerchantName?.includes(value)
})
this.setData({
serviceRange
})
},
input(e) {
let { value } = e.detail
this.setData({
merchantRange
searchKeyword: value
})
}
}
......
......@@ -19,7 +19,7 @@
<image src="/images/clear.png" class="search-clear" bindtap="clear" />
</block>
</view>
<view class="search text-center" bindtap="showConfirm">
<view class="search text-center" bindtap="search" data-value="{{searchKeyword}}">
<view class="text-center">搜索</view>
</view>
</view>
......@@ -34,12 +34,13 @@
style="height:100%;"
data-type="message"
refresher-triggered="{{triggered}}">
<block wx:for="{{merchantList}}" wx:key="index">
<block wx:for="{{serviceList}}" wx:key="index">
<view
class="itemCon text-hide {{item.act?'active':''}}"
data-index="{{index}}"
hidden="{{!item.show}}"
bindtap="select">
{{item.serviceName}}
{{item.yqMerchantName}}
</view>
</block>
</scroll-view>
......
const phoneRex = /^[1]([3-9])[0-9]{9}$/
const formRule = {
selectServiceInfo: [{ required: true, message: '所属服务中心不能为空' }],
selectInfo: [{ required: true, message: '所属服务中心不能为空' }],
staffName: [{ required: true, message: '员工姓名不能为空' }],
staffMobile: [
staffPhone: [
{ required: true, message: '手机号码不能为空' },
{
validator: (rule, value) => {
......@@ -14,7 +14,7 @@ const formRule = {
const formItems = [{
label: '所属服务中心',
props: 'selectServiceInfo',
props: 'selectInfo',
valueFn: 'serviceValue',
type: 'select',
placeholder: '请选择服务中心',
......@@ -28,7 +28,7 @@ const formItems = [{
}, {
label: '手机号码',
tips: '(登录凭证)',
props: 'staffMobile',
props: 'staffPhone',
type: 'input',
placeholder: '请输入手机号码',
maxLength: 11
......
// packagesList/mineDetail/pages/staffManage/createStaff/createStaff.js
import constantData from './constant/data'
import { behavior as computedBehavior } from "~/utils/lib/miniprogram-computed"
import mineApi from '~/api/mineApi/index'
Page({
behaviors: [computedBehavior],
......@@ -9,73 +10,7 @@ Page({
*/
data: {
addOrEdit: 'add',
serviceList: [{
serviceCode: 1,
staffName: '马保国',
staffMobile: '13645674567',
serviceName: '广东嘀加八号快乐酷爱咖哩鸡服务中心咖哩鸡服务中心咖哩鸡服务中心',
time: '2022.10.03'
}, {
serviceCode: 2,
staffName: '马保国',
staffMobile: '13645674567',
serviceName: '广东嘀加八号快乐酷爱咖哩鸡服务中心咖哩鸡服务中心咖哩鸡服务中心',
time: '2022.10.03'
}, {
serviceCode: 3,
staffName: '马保国',
staffMobile: '13645674567',
serviceName: '广东嘀加八号快乐酷爱咖哩鸡服务中心咖哩鸡服务中心咖哩鸡服务中心',
time: '2022.10.03'
}, {
serviceCode: 4,
staffName: '马保国',
staffMobile: '13645674567',
serviceName: '广东嘀加八号快乐酷爱咖哩鸡服务中心咖哩鸡服务中心咖哩鸡服务中心',
time: '2022.10.03'
}, {
serviceCode: 5,
staffName: '马保国',
staffMobile: '13645674567',
serviceName: '广东嘀加八号快乐酷爱咖哩鸡服务中心咖哩鸡服务中心咖哩鸡服务中心',
time: '2022.10.03'
}, {
serviceCode: 6,
staffName: '马保国',
staffMobile: '13645674567',
serviceName: '广东嘀加八号快乐酷爱咖哩鸡服务中心咖哩鸡服务中心咖哩鸡服务中心',
time: '2022.10.03'
}, {
serviceCode: 7,
staffName: '马保国',
staffMobile: '13645674567',
serviceName: '广东嘀加八号快乐酷爱咖哩鸡服务中心咖哩鸡服务中心咖哩鸡服务中心',
time: '2022.10.03'
}, {
serviceCode: 8,
staffName: '马保国',
staffMobile: '13645674567',
serviceName: '广东嘀加八号快乐酷爱咖哩鸡服务中心咖哩鸡服务中心咖哩鸡服务中心',
time: '2022.10.03'
}, {
serviceCode: 9,
staffName: '马保国',
staffMobile: '13645674567',
serviceName: '广东嘀加八号快乐酷爱咖哩鸡服务中心咖哩鸡服务中心咖哩鸡服务中心',
time: '2022.10.03'
}, {
serviceCode: 10,
staffName: '马保国',
staffMobile: '13645674567',
serviceName: '广东嘀加八号快乐酷爱咖哩鸡服务中心咖哩鸡服务中心咖哩鸡服务中心',
time: '2022.10.03'
}, {
serviceCode: 11,
staffName: '马保国',
staffMobile: '13645674567',
serviceName: '广东嘀加八号快乐酷爱咖哩鸡服务中心咖哩鸡服务中心咖哩鸡服务中心',
time: '2022.10.03'
}],
serviceList: [],
formItems: constantData.formItems,
formData: {
selectedConnectionList: [],
......@@ -85,7 +20,7 @@ Page({
},
watch: {
'formData.selectServiceInfo.serviceCode': function (e) {
'formData.selectInfo.yqMerchantId': function (e) {
// 将可见客户置为全部
this.setData({
'formData.connectionValue': '全部',
......@@ -98,11 +33,12 @@ Page({
* 生命周期函数--监听页面加载
*/
onLoad(options) {
// 获取服务中心/客户数据
this.getSelectList()
},
onRoute(options) {
// 选择可见客户回退
console.log(constantData)
if (!options.info) return
this.setData({
addOrEdit: options?.info ? 'edit' : 'add',
......@@ -131,6 +67,18 @@ Page({
})
},
getSelectList() {
// 获取服务中心
mineApi.getServiceCenterListAPI({}).then(res => {
let data = res || []
this.setData({
serviceList: data
})
})
// 获取全部客户
},
back() {
let { showServiceConfirm } = this.data
if (showServiceConfirm){
......@@ -150,18 +98,19 @@ Page({
this.hiddenSelectConfirm()
break
case 2:
if (!formData.selectServiceInfo) return wx.$api.showToast('请先选择所属服务中心')
if (!formData.selectInfo) return wx.$api.showToast('请先选择所属服务中心')
wx.$router.go('packageMine.selectConnectionPage', this.data.formData)
break
}
},
hiddenSelectConfirm(e) {
let selectServiceInfo = e?.detail
let selectInfo = e?.detail
this.setData({ showServiceConfirm: !this.data.showServiceConfirm })
if (!selectServiceInfo) return
if (!selectInfo) return
this.setData({
'formData.selectServiceInfo': selectServiceInfo,
'formData.serviceValue': selectServiceInfo?.serviceName
'formData.selectInfo': selectInfo,
'formData.serviceValue': selectInfo?.yqMerchantName
})
},
......@@ -177,10 +126,18 @@ Page({
handleConfirm() {
let { addOrEdit, formData } = this.data
let validObj = wx.$util.checkRule(formData, constantData.formRule)
// if (validObj) {
// wx.$api.showToast(validObj.message)
// return
// }
if (validObj) {
wx.$api.showToast(validObj.message)
return
}
let params = {
merchantNo: formData?.selectInfo?.yqMerchantId,
staffUuid: '',
staffName: formData?.staffName,
staffPhone: formData?.staffPhone,
createdSource: 3, // 创建来源 固定3 生意助手
visibleMerchantNoList: []
}
let message = addOrEdit == 'add' ? '是否确定创建员工?' : '是否确定修改员工信息?'
wx.showModal({
title: '提示',
......@@ -191,11 +148,14 @@ Page({
success(res) {
if (res.confirm) {
// 创建/编辑接口
if (addOrEdit == 'add') {
wx.$router.redirectTo('packageMine.successPage')
} else {
wx.$router.back()
}
let requestEvent = addOrEdit == 'add' ? 'createStaffAPI' : 'updateStaffAPI'
mineApi[requestEvent](params).then(res => {
if (addOrEdit == 'add') {
wx.$router.redirectTo('packageMine.successPage')
} else {
wx.$router.back()
}
})
}
}
})
......
......@@ -29,4 +29,4 @@
<view class="btn-blue" bindtap="handleConfirm">{{addOrEdit == 'add' ? '提交' : '保存'}}</view>
</view>
</view>
<select-service-confirm show="{{showServiceConfirm}}" tabBarStyle="{{tabBarStyle}}" serviceList="{{serviceList}}" bind:hiddenSelectConfirm="hiddenSelectConfirm"></select-service-confirm>
<select-service-confirm show="{{showServiceConfirm}}" tabBarStyle="{{tabBarStyle}}" serviceList="{{serviceList}}" selectInfo="{{formData.selectInfo}}" bind:hiddenSelectConfirm="hiddenSelectConfirm"></select-service-confirm>
......@@ -224,7 +224,7 @@ Page({
let prevPage = currentPages[currentPages.length - 2]
prevPage.setData({
'formData.connectionValue': arr.find(v => v.active && v.type == 0) ? '全部' : `已选择${selectedConnectionList?.length}位客户`,
'formData.selectedConnectionList': selectedConnectionList
'formData.selectedConnectionList': arr.find(v => v.active && v.type == 0) ? [] : selectedConnectionList
})
this.back()
},
......
// packagesList/mineDetail/pages/staffManage/staffManage.js
import { IMG_URL } from '~/utils/constantData'
import mineApi from '~/api/mineApi/index'
Page({
/**
......@@ -9,82 +10,27 @@ Page({
IMG_URL,
bgUrl: `${IMG_URL}/personal/empty_tran.png`,
popupShow: false,
staffList: [{
serviceCode: 1,
staffName: '马保国',
staffMobile: '13645674567',
serviceName: '广东嘀加八号快乐酷爱咖哩鸡服务中心咖哩鸡服务中心咖哩鸡服务中心',
time: '2022.10.03'
}, {
serviceCode: 2,
staffName: '马保国',
staffMobile: '13645674567',
serviceName: '广东嘀加八号快乐酷爱咖哩鸡服务中心咖哩鸡服务中心咖哩鸡服务中心',
time: '2022.10.03'
}, {
serviceCode: 3,
staffName: '马保国',
staffMobile: '13645674567',
serviceName: '广东嘀加八号快乐酷爱咖哩鸡服务中心咖哩鸡服务中心咖哩鸡服务中心',
time: '2022.10.03'
}, {
serviceCode: 4,
staffName: '马保国',
staffMobile: '13645674567',
serviceName: '广东嘀加八号快乐酷爱咖哩鸡服务中心咖哩鸡服务中心咖哩鸡服务中心',
time: '2022.10.03'
}, {
serviceCode: 5,
staffName: '马保国',
staffMobile: '13645674567',
serviceName: '广东嘀加八号快乐酷爱咖哩鸡服务中心咖哩鸡服务中心咖哩鸡服务中心',
time: '2022.10.03'
}, {
serviceCode: 6,
staffName: '马保国',
staffMobile: '13645674567',
serviceName: '广东嘀加八号快乐酷爱咖哩鸡服务中心咖哩鸡服务中心咖哩鸡服务中心',
time: '2022.10.03'
}, {
serviceCode: 7,
staffName: '马保国',
staffMobile: '13645674567',
serviceName: '广东嘀加八号快乐酷爱咖哩鸡服务中心咖哩鸡服务中心咖哩鸡服务中心',
time: '2022.10.03'
}, {
serviceCode: 8,
staffName: '马保国',
staffMobile: '13645674567',
serviceName: '广东嘀加八号快乐酷爱咖哩鸡服务中心咖哩鸡服务中心咖哩鸡服务中心',
time: '2022.10.03'
}, {
serviceCode: 9,
staffName: '马保国',
staffMobile: '13645674567',
serviceName: '广东嘀加八号快乐酷爱咖哩鸡服务中心咖哩鸡服务中心咖哩鸡服务中心',
time: '2022.10.03'
}, {
serviceCode: 10,
staffName: '马保国',
staffMobile: '13645674567',
serviceName: '广东嘀加八号快乐酷爱咖哩鸡服务中心咖哩鸡服务中心咖哩鸡服务中心',
time: '2022.10.03'
}, {
serviceCode: 11,
staffName: '马保国',
staffMobile: '13645674567',
serviceName: '广东嘀加八号快乐酷爱咖哩鸡服务中心咖哩鸡服务中心咖哩鸡服务中心',
time: '2022.10.03'
}],
selectInfo: {serviceName: '全部服务中心'},
total: 15
staffList: [],
selectInfo: {yqMerchantName: '全部服务中心'},
total: 15,
serviceList: [],
currentPage: 1,
allServiceIds: []
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
// 获取服务中心数据
mineApi.getServiceCenterListAPI({}).then(res => {
let data = res || []
let serviceIds = data.map(val => {return val.yqMerchantId})
this.setData({
serviceList: res || [],
allServiceIds: serviceIds
})
})
},
/**
......@@ -98,7 +44,42 @@ Page({
* 生命周期函数--监听页面显示
*/
onShow() {
// 获取员工列表
this.getList(true)
},
getList(isReset = false) {
let { currentPage, selectInfo, allServiceIds } = this.data
let params = {
pageSize: 10,
pageNum: currentPage,
merchantNoList: selectInfo?.yqMerchantId ? [selectInfo?.yqMerchantId] : allServiceIds
}
mineApi.getStaffListAPI(params).then(res => {
let tempList = isReset ? res || [] : this.data.staffList.concat(res || [])
this.setData({
staffList: tempList,
currentPage: currentPage + 1,
total,
triggered: false
})
if (isReset) {
this.setData({
scrollTop: 0
})
}
})
},
onBottomRefresh() {
this.getList()
},
search() {
this.setData({
currentPage: 1
})
this.getList(true)
},
// 筛选服务中心
......@@ -119,20 +100,21 @@ Page({
// 创建/编辑员工
jump(e) {
// 校验是否有配置服务中心
// return wx.showModal({
// title: '提示',
// content: '您尚无服务中心,请先创建服务中心',
// confirmText: '去创建',
// cancelText: '取消',
// confirmColor: '#3666FE',
// success(res) {
// if (res.confirm) {
// wx.$router.reLaunch('packageMine.creatService')
// }
// }
// })
if (!this.data.serviceList.length) {
return wx.showModal({
title: '提示',
content: '您尚无服务中心,请先创建服务中心',
confirmText: '去创建',
cancelText: '取消',
confirmColor: '#3666FE',
success(res) {
if (res.confirm) {
wx.$router.redirectTo('packageMine.editService')
}
}
})
}
let dataset = e.currentTarget.dataset
console.log(dataset)
wx.$router.go('packageMine.createStaff', dataset)
},
......
......@@ -10,7 +10,7 @@
<view class="title">员工数量:<text class="number">{{total}}</text></view>
<view class="select-btn">
<view class="type" bindtap="filterTypeFn">
<text>{{selectInfo.serviceName}}</text>
<text>{{selectInfo.yqMerchantName}}</text>
<glsx-image class="point" src="index/point.png" />
</view>
</view>
......@@ -18,7 +18,7 @@
<scroll-view scroll-y
enable-back-to-top
refresher-enabled="{{true}}"
bindrefresherrefresh="search"
bindrefresherrefresh="getList"
bindscrolltolower="onBottomRefresh"
class="list"
style="height:calc(100vh - 148rpx - 110rpx);"
......@@ -51,4 +51,4 @@
<nothing-tips tips="暂无员工~" bgColor="{{'#F2F3F7'}}" bg="{{bgUrl}}" />
</view>
</view>
<select-service-popup wx:if="{{popupShow}}" bind:hidePopup="filterTypeFn" bind:getStaffList="getStaffList" selectInfo="{{selectInfo}}" popShow="{{popupShow}}" merchantRange="{{staffList}}" />
<select-service-popup wx:if="{{popupShow}}" bind:hidePopup="filterTypeFn" bind:getStaffList="getStaffList" selectInfo="{{selectInfo}}" popShow="{{popupShow}}" serviceRange="{{serviceList}}" />
......@@ -151,7 +151,7 @@ Page({
onLoad: async function (options) {
let { userInfo } = wx.$storage.get()
let serviceMerchantId = userInfo.subLoginUser.merchantId
let serviceMerchantId = userInfo.subLoginUser?.merchantId
//解决因为使用await 异步导致数据没同步已经开始调用onshow方法
this.setData({
serviceMerchantId,
......
......@@ -93,6 +93,17 @@ const domain = {
prod: 'https://scrm.glsx.com.cn'
}[target[index]]
// 员工管理接口域名
const domain2 = {
ip: 'http://192.168.1.170:8315',
/**登录: 192.168.2.3:8315
商城: 192.168.2.3:8558 */
dev: 'http://rop-merchant.dev.glsx.com.cn',
uat: 'https://scrm.test.glsx.com.cn',
preRelease: 'https://scrm.beta.glsx.com.cn',
prod: 'https://scrm.glsx.com.cn'
}[target[index]]
const pathEnum = {
sso: '/rop-scrm-sso/',
shopmall: '/rop-scrm-shopmall/',
......@@ -107,7 +118,8 @@ const pathEnum = {
sop: '/rop-scrm-sop/',
customercollect: '/rop-scrm-bigdatautil/',
drac: '/rop-scrm-entmicro/',
busassistant: '/rop-scrm-busassistant/'
busassistant: '/rop-scrm-busassistant/',
open: '/rop-merchants/'
}
const defaultMerchantId = {
ip: '44184606',
......@@ -127,6 +139,7 @@ let mockUrl = {
module.exports = {
index,
domain,
domain2,
pathEnum,
secretKey,
defaultMerchantId,
......
import { secretKey, pathEnum, domain, sign } from './http.js'
import { secretKey, pathEnum, domain, sign, domain2 } from './http.js'
import { getSessionId } from '~/utils/cache/storageApi'
import network from '~/utils/network'
/**接口 */
......@@ -25,8 +25,10 @@ class Request {
let path = pathEnum[projectName]
if (!path) path = `/rop-scrm-${projectName}/`
params = this.getData(params)
// open 员工管理模块域名
let baseUrl = projectName == 'open' ? domain2 : domain
wx.request({
url: `${domain}${path}router?method=${params.method}`,
url: `${baseUrl}${path}router?method=${params.method}`,
data: params,
method: RequestMethods,
header,
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!