Commit b72de2ff by zhangxw

联调

1 parent 873b8a25
......@@ -83,5 +83,15 @@ class mineApi {
}
)
}
// 获取当前服务中心下的客户列表
getConnectionListByServiceAPI(data) {
return api.post(
{
method: 'scrm.api.busassistant.merchantCustomer.listByServiceCenterMerchantId',
...data
}
)
}
}
export default mineApi
......@@ -13,7 +13,7 @@ Component({
let { connectionList } = this.data
if (n?.length) {
connectionList.map(val => {
if (n.findIndex(item => item.connectionCode == val.connectionCode) > -1) val.checked = true
if (n.findIndex(item => item.merchantId == val.merchantId) > -1) val.checked = true
return val
})
}
......@@ -39,7 +39,7 @@ Component({
// 不可操作选项
if (item.disabled) return
connectionList.forEach(v => {
if (v.connectionCode == item.connectionCode) v.checked = !v.checked
if (v.merchantId == item.merchantId) v.checked = !v.checked
})
this.setData({
connectionList
......
......@@ -120,7 +120,7 @@
padding-bottom: env(safe-area-inset-bottom) !important;
}
.btn {
position: fixed;
position: sticky;
bottom: 16rpx;
left: 0;
width: calc(100% - 64rpx);
......
......@@ -47,7 +47,7 @@
<glsx-image src="login/radio.png" class="radio_class" />
</block>
</view>
<view class="item-text {{item.disabled?'disabled_text':''}}">{{item.serviceName}}</view>
<view class="item-text {{item.disabled?'disabled_text':''}}">{{item.merchantName}}</view>
</view>
</block>
</view>
......
......@@ -12,7 +12,6 @@ Component({
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
......
......@@ -15,9 +15,10 @@ Component({
if (n) {
let { serviceRange, selectInfo } = this.data
let activeIndex = serviceRange.findIndex(v => v.yqMerchantId == selectInfo.yqMerchantId)
if (serviceRange.length) serviceRange.unshift({yqMerchantId: '', yqMerchantName: '全部'})
serviceRange.forEach((item, ind) => {
item.show = true
if (activeIndex == ind) {
if (activeIndex == (ind - 1)) {
item.act = true
} else {
item.act = false
......@@ -47,7 +48,7 @@ Component({
observers: {
serviceRange: function (e) {
this.setData({
serviceList: e
serviceList: e || []
})
}
},
......@@ -66,13 +67,13 @@ Component({
}
return item.act
})
if (!actObj) {
return wx.$api.showToast({
title: '请选择服务中心',
icon: 'error'
})
} else {
if (actObj.yqMerchantId == '' && actObj.yqMerchantName == '全部') actObj.yqMerchantName = '全部服务中心'
this.changePicker(actObj)
}
},
......
......@@ -2,6 +2,7 @@
import constantData from './constant/data'
import { behavior as computedBehavior } from "~/utils/lib/miniprogram-computed"
import mineApi from '~/api/mineApi/index'
import Util from '~/utils/util'
Page({
behaviors: [computedBehavior],
......@@ -13,18 +14,23 @@ Page({
serviceList: [],
formItems: constantData.formItems,
formData: {
selectedConnectionList: [],
connectionValue: '全部'
selectedConnectionIds: [],
connectionValue: '全部',
visualType: 0
},
showServiceConfirm: false
},
watch: {
'formData.selectInfo.yqMerchantId': function (e) {
// 获取当前服务中心下的客户列表
this.getConnectionList(e)
let { optionsInfo } = this.data
if (e == optionsInfo?.merchantNo) return
// 将可见客户置为全部
this.setData({
'formData.connectionValue': '全部',
'formData.selectedConnectionList': []
'formData.selectedConnectionIds': []
})
}
},
......@@ -40,9 +46,20 @@ Page({
onRoute(options) {
// 选择可见客户回退
if (!options.info) return
let optionsInfo = options?.info || {}
let data = options?.info ? {
...options?.info,
selectInfo: {yqMerchantId: optionsInfo.merchantNo, yqMerhcantName: optionsInfo.merchantName},
serviceValue: optionsInfo.merchantName,
visualType: optionsInfo.visualType || 0,
connectionValue: optionsInfo.visualType == 1 ? `已选${optionsInfo.visibleMerchantNo?.split(',')?.length}位客户`: '全部',
selectedConnectionIds: optionsInfo.visibleMerchantNo?.split(',')
} : {}
this.setData({
addOrEdit: options?.info ? 'edit' : 'add',
formData: options?.info
'formItems[0].disabled': options?.info ? true : false,
formData: data,
optionsInfo: Util.deepClone(optionsInfo)
})
},
......@@ -67,6 +84,21 @@ Page({
})
},
// 获取服务中心下的客户列表
getConnectionList(e) {
mineApi.getConnectionListByServiceAPI({
serviceCenterMerchantId: e
}).then(res => {
// 全部客户
let { allConnectionIds, copyFormData } = this.data
allConnectionIds = res?.map(val => {return val.merchantId})
this.setData({
allConnectionIds
})
})
},
getSelectList() {
// 获取服务中心
mineApi.getServiceCenterListAPI({}).then(res => {
......@@ -75,8 +107,6 @@ Page({
serviceList: data
})
})
// 获取全部客户
},
back() {
......@@ -91,7 +121,8 @@ Page({
// 选择服务中心/客户
jump(e) {
let { formData } = this.data
let { type } = e.currentTarget.dataset
let { type, disabled } = e.currentTarget.dataset
if (disabled) return
switch(type) {
// 选择服务中心
case 1:
......@@ -124,7 +155,7 @@ Page({
// 提交
handleConfirm() {
let { addOrEdit, formData } = this.data
let { addOrEdit, formData, allConnectionIds } = this.data
let validObj = wx.$util.checkRule(formData, constantData.formRule)
if (validObj) {
wx.$api.showToast(validObj.message)
......@@ -132,11 +163,12 @@ Page({
}
let params = {
merchantNo: formData?.selectInfo?.yqMerchantId,
staffUuid: '',
staffUuid: formData?.staffUuid,
staffName: formData?.staffName,
staffPhone: formData?.staffPhone,
createdSource: 3, // 创建来源 固定3 生意助手
visibleMerchantNoList: []
visualType: formData?.visualType,
visibleMerchantNoList: formData?.visualType == 0 ? allConnectionIds : formData?.selectedConnectionIds
}
let message = addOrEdit == 'add' ? '是否确定创建员工?' : '是否确定修改员工信息?'
wx.showModal({
......@@ -151,7 +183,7 @@ Page({
let requestEvent = addOrEdit == 'add' ? 'createStaffAPI' : 'updateStaffAPI'
mineApi[requestEvent](params).then(res => {
if (addOrEdit == 'add') {
wx.$router.redirectTo('packageMine.successPage')
wx.$router.redirectTo('packageMine.successPage?page=staff')
} else {
wx.$router.back()
}
......
......@@ -18,10 +18,10 @@
value="{{formData[item.props]}}"
placeholder-class="input-placeholder" />
</view>
<view class="select-box" wx:if="{{item.type == 'select'}}" bindtap="jump" data-type="{{item.pageType}}">
<view class="select-box" wx:if="{{item.type == 'select'}}" bindtap="jump" data-type="{{item.pageType}}" data-disabled="{{item.disabled}}">
<view class="name" wx:if="{{formData[item.valueFn]}}">{{formData[item.valueFn]}}</view>
<view class="placeholder-text" wx:else>{{item.placeholder}}</view>
<glsx-image src="personal/arrow_right.png" class="arrow_right" />
<glsx-image src="personal/arrow_right.png" wx:if="{{!item.disabled}}" class="arrow_right" />
</view>
</block>
</view>
......
var formatMobile = function (item) {
return item.substring(0,3)+" " + item.substring(3,7) +" "+item.substring(7)
return item ? item.substring(0,3)+" " + item.substring(3,7) +" "+item.substring(7) : ' '
}
module.exports = {
......
// packagesList/mineDetail/pages/staffManage/selectConnectionPage/selectConnectionPage.js
import mineApi from '~/api/mineApi/index'
Page({
/**
......@@ -6,119 +7,8 @@ Page({
*/
data: {
showConnectionConfirm: false,
connectionList: [{
connectionCode: 1,
staffName: '马保国',
staffMobile: '13645674567',
serviceName: '广东嘀加1号服务中心',
time: '2022.10.03',
checked: true,
disabled: true
}, {
connectionCode: 2,
staffName: '马保国',
staffMobile: '13645674567',
serviceName: '广东嘀加2号服务',
time: '2022.10.03'
}, {
connectionCode: 3,
staffName: '马保国',
staffMobile: '13645674567',
serviceName: '广东嘀加3号服务',
time: '2022.10.03'
}, {
connectionCode: 4,
staffName: '马保国',
staffMobile: '13645674567',
serviceName: '广东嘀加4号服务中心',
time: '2022.10.03'
}, {
connectionCode: 5,
staffName: '马保国',
staffMobile: '13645674567',
serviceName: '广东嘀加5号服务中心',
time: '2022.10.03'
}, {
connectionCode: 6,
staffName: '马保国',
staffMobile: '13645674567',
serviceName: '广东嘀加八号快乐酷爱咖哩鸡服务中心咖哩鸡服务中心咖哩鸡服务中心',
time: '2022.10.03'
}, {
connectionCode: 7,
staffName: '马保国',
staffMobile: '13645674567',
serviceName: '广东嘀加八号快乐酷爱咖哩鸡服务中心咖哩鸡服务中心咖哩鸡服务中心',
time: '2022.10.03'
}, {
connectionCode: 8,
staffName: '马保国',
staffMobile: '13645674567',
serviceName: '广东嘀加八号快乐酷爱咖哩鸡服务中心咖哩鸡服务中心咖哩鸡服务中心',
time: '2022.10.03'
}, {
connectionCode: 9,
staffName: '马保国',
staffMobile: '13645674567',
serviceName: '广东嘀加八号快乐酷爱咖哩鸡服务中心咖哩鸡服务中心咖哩鸡服务中心',
time: '2022.10.03'
}, {
connectionCode: 10,
staffName: '马保国',
staffMobile: '13645674567',
serviceName: '广东嘀加八号快乐酷爱咖哩鸡服务中心咖哩鸡服务中心咖哩鸡服务中心',
time: '2022.10.03'
}, {
connectionCode: 11,
staffName: '马保国',
staffMobile: '13645674567',
serviceName: '广东嘀加八号快乐酷爱咖哩鸡服务中心咖哩鸡服务中心咖哩鸡服务中心',
time: '2022.10.03'
}, {
connectionCode: 12,
staffName: '马保国',
staffMobile: '13645674567',
serviceName: '广东嘀加八号快乐酷爱咖哩鸡服务中心咖哩鸡服务中心咖哩鸡服务中心',
time: '2022.10.03'
}, {
connectionCode: 13,
staffName: '马保国',
staffMobile: '13645674567',
serviceName: '123456',
time: '2022.10.03',
disabled: true
}, {
connectionCode: 14,
staffName: '马保国',
staffMobile: '13645674567',
serviceName: '广东嘀加八号快乐酷爱咖哩鸡服务中心咖哩鸡服务中心咖哩鸡服务中心',
time: '2022.10.03'
}, {
connectionCode: 15,
staffName: '马保国',
staffMobile: '13645674567',
serviceName: '广东嘀加八号快乐酷爱咖哩鸡服务中心咖哩鸡服务中心咖哩鸡服务中心',
time: '2022.10.03'
}, {
connectionCode: 16,
staffName: '马保国',
staffMobile: '13645674567',
serviceName: '广东嘀加八号快乐酷爱咖哩鸡服务中心咖哩鸡服务中心咖哩鸡服务中心',
time: '2022.10.03'
}, {
connectionCode: 17,
staffName: '马保国',
staffMobile: '13645674567',
serviceName: '广东嘀加八号快乐酷爱咖哩鸡服务中心咖哩鸡服务中心咖哩鸡服务中心',
time: '2022.10.03'
}, {
connectionCode: 18,
staffName: '马保国',
staffMobile: '13645674567',
serviceName: '789',
time: '2022.10.03'
}],
selectType: [{
connectionList: [],
selectTypeList: [{
label: '全部',
tips: '所有客户可见',
type: 0,
......@@ -139,20 +29,20 @@ Page({
},
onRoute(options) {
let { selectType } = this.data
selectType.map(v => {
let { selectTypeList } = this.data
selectTypeList.map(v => {
// 未指定可见客户
if (options?.selectedConnectionList.length == 0 && v.type == 0) {
if (options?.visualType == v.type) {
v.active = true
} else if (options?.selectedConnectionList.length > 0 && v.type == 1) {
v.active = true
this.setData({
if (v.type == 1) this.setData({
showConnectionList: true
})
}
return v
})
this.setData({selectType, selectedConnectionList: options?.selectedConnectionList || []})
this.setData({selectTypeList})
// 获取服务中心下的客户数据
this.getConnectionList(options)
},
/**
......@@ -176,10 +66,21 @@ Page({
})
},
getConnectionList(options) {
mineApi.getConnectionListByServiceAPI({
serviceCenterMerchantId: options?.selectInfo?.yqMerchantId
}).then(res => {
this.setData({
connectionList: res || [],
selectedConnectionList: res?.filter(val => { return options?.selectedConnectionIds.length && options.selectedConnectionIds.includes(val.merchantId + '') }) || []
})
})
},
changeType(e) {
let { type } = e.currentTarget.dataset
let { selectType, showConnectionList } = this.data
selectType.forEach((v, ind) => {
let { selectTypeList, showConnectionList } = this.data
selectTypeList.forEach((v, ind) => {
if (type == v.type && v.active) return showConnectionList = !showConnectionList
if (type == v.type && !v.active) {
v.active = true
......@@ -189,7 +90,7 @@ Page({
else v.active = false
})
this.setData({
selectType,
selectTypeList,
showConnectionList
})
},
......@@ -213,8 +114,8 @@ Page({
// 确定
handleConfirm() {
let { selectType, selectedConnectionList } = this.data
let arr = selectType.filter(v => v.active) || []
let { selectTypeList, selectedConnectionList } = this.data
let arr = selectTypeList.filter(v => v.active) || []
if (!arr.length || (arr.find(v => v.active && v.type == 1) && !selectedConnectionList?.length)) return wx.showToast({
title: '请选择可见客户',
icon: 'none',
......@@ -223,8 +124,9 @@ Page({
const currentPages = getCurrentPages()
let prevPage = currentPages[currentPages.length - 2]
prevPage.setData({
'formData.connectionValue': arr.find(v => v.active && v.type == 0) ? '全部' : `已选择${selectedConnectionList?.length}位客户`,
'formData.selectedConnectionList': arr.find(v => v.active && v.type == 0) ? [] : selectedConnectionList
'formData.connectionValue': arr.find(v => v.active)?.type == 0 ? '全部' : `已选择${selectedConnectionList?.length}位客户`,
'formData.selectedConnectionIds': selectedConnectionList.map(val => { return val.merchantId }),
'formData.visualType': arr.find(v => v.active)?.type || 0
})
this.back()
},
......
......@@ -58,8 +58,8 @@
padding-bottom: 28rpx;
display: flex;
align-items: center;
justify-content: space-between;
flex-flow: wrap;
gap: 12rpx;
.item{
height: 54rpx;
line-height: 54rpx;
......@@ -68,7 +68,6 @@
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
margin-bottom: 12rpx;
padding: 0 20rpx;
}
}
......
......@@ -4,7 +4,7 @@
</navigation-bar>
<view class="select-connection-page" style="padding-top:{{tabBarStyle}}px;">
<view class="select-content">
<view class="flex_class" wx:for="{{selectType}}" wx:key="index" bindtap="changeType" data-type="{{item.type}}">
<view class="flex_class" wx:for="{{selectTypeList}}" wx:key="index" bindtap="changeType" data-type="{{item.type}}">
<view class="checked_class">
<view hidden="{{!item.active}}">
<glsx-image src="personal/checked.png" class="checked_class" />
......@@ -18,7 +18,7 @@
<view class="connection_box" hidden="{{!showConnectionList}}">
<view class="select_btn" bindtap="showConfirm">请选择指定客户</view>
<view class="list-items" wx:if="{{selectedConnectionList.length}}">
<view class="item" wx:for="{{selectedConnectionList}}" wx:key="index">{{item.serviceName}}</view>
<view class="item" wx:for="{{selectedConnectionList}}" wx:key="index">{{item.merchantName}}</view>
</view>
</view>
</view>
......
......@@ -12,25 +12,17 @@ Page({
popupShow: false,
staffList: [],
selectInfo: {yqMerchantName: '全部服务中心'},
total: 15,
total: 0,
serviceList: [],
currentPage: 1,
allServiceIds: []
allServiceIds: [],
nothing: false,
},
/**
* 生命周期函数--监听页面加载
*/
onLoad(options) {
// 获取服务中心数据
mineApi.getServiceCenterListAPI({}).then(res => {
let data = res || []
let serviceIds = data.map(val => {return val.yqMerchantId})
this.setData({
serviceList: res || [],
allServiceIds: serviceIds
})
})
},
/**
......@@ -44,23 +36,39 @@ Page({
* 生命周期函数--监听页面显示
*/
onShow() {
// 获取员工列表
this.getList(true)
// 获取服务中心数据
mineApi.getServiceCenterListAPI({}).then(res => {
let data = res || []
let serviceIds = data.map(val => {return val.yqMerchantId})
this.setData({
serviceList: res || [],
allServiceIds: serviceIds,
currentPage: 1,
nothing: false,
total: 0
})
// 获取员工列表
this.getList(true)
})
},
getList(isReset = false) {
let { currentPage, selectInfo, allServiceIds } = this.data
let { currentPage, selectInfo, allServiceIds, nothing } = this.data
let params = {
pageSize: 10,
pageNum: currentPage,
merchantNoList: selectInfo?.yqMerchantId ? [selectInfo?.yqMerchantId] : allServiceIds
}
if (nothing) {
return
}
mineApi.getStaffListAPI(params).then(res => {
let tempList = isReset ? res || [] : this.data.staffList.concat(res || [])
let tempList = isReset ? res?.data || [] : this.data.staffList.concat(res?.data || [])
this.setData({
staffList: tempList,
currentPage: currentPage + 1,
total,
total: res.count,
nothing: res.count == tempList.length,
triggered: false
})
if (isReset) {
......@@ -77,7 +85,9 @@ Page({
search() {
this.setData({
currentPage: 1
currentPage: 1,
nothing: false,
total: 0
})
this.getList(true)
},
......@@ -93,8 +103,11 @@ Page({
getStaffList(e) {
wx.$api.hideLoading()
this.setData({
selectInfo: e.detail
selectInfo: e.detail,
nothing: false,
currentPage: 1
})
this.getList(true)
},
// 创建/编辑员工
......
......@@ -18,7 +18,7 @@
<scroll-view scroll-y
enable-back-to-top
refresher-enabled="{{true}}"
bindrefresherrefresh="getList"
bindrefresherrefresh="search"
bindscrolltolower="onBottomRefresh"
class="list"
style="height:calc(100vh - 148rpx - 110rpx);"
......@@ -31,19 +31,19 @@
<image wx:else src="{{item.avatarUrl}}" class="avatar"></image>
<view class="message-text">
<view class="name">{{item.staffName}}</view>
<view class="mobile">{{format.formatMobile(item.staffMobile)}}</view>
<view class="mobile">{{format.formatMobile(item.staffPhone)}}</view>
</view>
</view>
<glsx-image src="personal/arrow_right.png" class="arrow_right" />
</view>
<view class="bottom">
<view class="service_name">
所属:{{item.serviceName}}
所属:{{item.merchantName}}
</view>
<view class="time">{{item.time}}</view>
<view class="time">{{item.createdDate}}</view>
</view>
</view>
<view class="bottomTips" wx:if="{{staffList.length>10}}">到底啦!</view>
<view class="bottomTips" wx:if="{{nothing}}">到底啦!</view>
</scroll-view>
</view>
......
......@@ -11,6 +11,12 @@ const obj = {
primaryBtn: '邀请销售顾问',
primaryCallback: 'packageMine.editService',
cancelBtn: 'S后自动跳转我的客户'
},
staff: {
navigationTitle: '创建员工',
primaryBtn: '继续创建员工',
primaryCallback: 'packageMine.createStaff',
cancelBtn: 'S后自动跳转我的员工'
}
}
Page({
......@@ -19,12 +25,7 @@ Page({
* 页面的初始数据
*/
data: {
paramsObj: {
navigationTitle: '创建员工',
primaryBtn: '继续创建员工',
primaryCallback: 'packageMine.createStaff',
cancelBtn: 'S后自动跳转我的员工'
},
paramsObj: {},
count: 5
},
......@@ -35,6 +36,7 @@ Page({
// this.setData({
// paramsObj: options
// })
console.log(options)
if(options) {
let { page } = options
this.setData({
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!