Commit b6aa6829 by zhangxw

部分联调

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