Commit e890b396 by zhangxw

分包修改

1 parent 7a112769
Showing 55 changed files with 185 additions and 77 deletions
......@@ -68,20 +68,6 @@
]
},
{
"root": "packagesList/mineDetail",
"name": "mineDetail",
"pages": [
"pages/messageBox",
"pages/customerManagement",
"pages/clue",
"pages/staffManage/staffList/staffList",
"pages/serviceManage/serviceList/serviceList",
"pages/staffManage/createStaff/createStaff",
"pages/staffManage/selectConnectionPage/selectConnectionPage",
"pages/successPage/successPage"
]
},
{
"root": "packagesList/apply",
"name": "apply",
"pages": [
......@@ -94,13 +80,27 @@
"pages": [
"pages/apply"
]
},
{
"root": "packageMine/pages",
"name": "packageMine",
"pages": [
"messageBox/messageBox",
"customerManagement/customerManagement",
"clue/clue",
"staffManage/staffList/staffList",
"serviceManage/serviceList/serviceList",
"staffManage/createStaff/createStaff",
"staffManage/selectConnectionPage/selectConnectionPage",
"successPage/successPage"
]
}
],
"preloadRule": {
"pages/tab/mine/mine": {
"network": "all",
"packages": [
"mineDetail"
"packageMine"
]
},
"pages/tab/index/index": {
......
......@@ -6,7 +6,20 @@ Component({
properties: {
show: Boolean,
connectionList: Array,
tabBarStyle: String
tabBarStyle: String,
selectedConnectionList: {
type: Array,
observer: function(n) {
let { connectionList } = this.data
if (n?.length) {
connectionList.map(val => {
if (n.findIndex(item => item.connectionCode == val.connectionCode) > -1) val.checked = true
return val
})
}
this.setData({connectionList})
}
}
},
/**
......@@ -26,7 +39,7 @@ Component({
// 不可操作选项
if (item.disabled) return
connectionList.forEach(v => {
if (v.serviceCode == item.serviceCode) v.checked = !v.checked
if (v.connectionCode == item.connectionCode) v.checked = !v.checked
})
this.setData({
connectionList
......
......@@ -32,6 +32,9 @@
color: #666;
box-sizing: border-box;
padding: 0 24rpx;
display: flex;
align-items: center;
justify-content: center;
.text-center {
font-size: 24rpx;
border-radius: 12rpx;
......
......@@ -16,7 +16,7 @@
<image src="/images/clear.png" class="search-clear" bindtap="clear" />
</block>
</view>
<view class="search text-center" bindtap="showConfirm">
<view class="search" bindtap="showConfirm">
<view class="text-center">搜索</view>
</view>
</view>
......
......@@ -23,20 +23,20 @@ Component({
*/
methods: {
select(e) {
let { index } = e.currentTarget.dataset
let { item } = e.currentTarget.dataset
let { serviceList } = this.data
serviceList.forEach((item, ind) => {
if (index == ind) {
item.act = true
serviceList.forEach((val, ind) => {
if (item.serviceCode == val.serviceCode) {
val.act = true
} else {
item.act = false
val.act = false
}
})
this.setData({
serviceList,
selectInfo: serviceList[index] || {}
selectInfo: item || {}
})
this.triggerEvent('hiddenSelectConfirm', serviceList[index])
this.triggerEvent('hiddenSelectConfirm', item)
},
input(e) {
let { serviceList } = this.data
......
......@@ -32,6 +32,9 @@
color: #666;
box-sizing: border-box;
padding: 0 24rpx;
display: flex;
align-items: center;
justify-content: center;
.text-center {
font-size: 24rpx;
border-radius: 12rpx;
......
......@@ -16,7 +16,7 @@
<image src="/images/clear.png" class="search-clear" bindtap="clear" />
</block>
</view>
<view class="search text-center" bindtap="showConfirm">
<view class="search" bindtap="showConfirm">
<view class="text-center">搜索</view>
</view>
</view>
......@@ -35,7 +35,7 @@
<block wx:for="{{serviceList}}" wx:key="index">
<view
class="service-items text-hide {{item.act?'active':''}}"
data-index="{{index}}"
data-item="{{item}}"
bindtap="select">
{{item.serviceName}}
</view>
......
{
"component": true,
"usingComponents": {
"msg-box": "../components/msgBox/msgBox",
"tab": "../components/Tab/Tab"
"msg-box": "../../components/msgBox/msgBox",
"tab": "../../components/Tab/Tab"
},
"navigationStyle": "custom"
}
// packagesList/mineDetail/pages/staffManage/createStaff/createStaff.js
import { behavior as computedBehavior } from "~/utils/lib/miniprogram-computed";
Page({
behaviors: [computedBehavior],
/**
* 页面的初始数据
......@@ -17,13 +19,15 @@ Page({
label: '员工姓名',
props: 'staffName',
type: 'input',
placeholder: '请输入员工姓名'
placeholder: '请输入员工姓名',
maxLength: 20
}, {
label: '手机号码',
tips: '(登录凭证)',
props: 'mobile',
props: 'staffMobile',
type: 'input',
placeholder: '请输入手机号码'
placeholder: '请输入手机号码',
maxLength: 11
}, {
label: '可见客户',
props: 'connectionIds',
......@@ -99,8 +103,25 @@ Page({
serviceName: '广东嘀加八号快乐酷爱咖哩鸡服务中心咖哩鸡服务中心咖哩鸡服务中心',
time: '2022.10.03'
}],
formData: {},
showServiceConfirm: false
formData: {
connectionValue: '全部'
},
showServiceConfirm: false,
toastList: {
selectServiceInfo: '所属服务中心不能为空',
staffName: '员工姓名不能为空',
staffMobile: '手机号码不能为空'
}
},
watch: {
'formData.selectServiceInfo.serviceCode': function (e) {
// 将可见客户置为全部
this.setData({
'formData.connectionValue': '全部',
'formData.selectedConnectionList': []
})
}
},
/**
......@@ -111,8 +132,10 @@ Page({
onRoute(options) {
this.setData({
addOrEdit: options?.type
addOrEdit: options?.info ? 'edit' : 'add',
formData: options?.info || {connectionValue: '全部'}
})
console.log(this.data.formData)
},
/**
......@@ -147,6 +170,7 @@ Page({
// 选择服务中心/客户
jump(e) {
let { formData } = this.data
let { type } = e.currentTarget.dataset
switch(type) {
// 选择服务中心
......@@ -154,23 +178,59 @@ Page({
this.hiddenSelectConfirm()
break
case 2:
wx.$router.go('packagesList.selectConnectionPage')
if (!formData.selectServiceInfo) return wx.$api.showToast('请先选择所属服务中心')
wx.$router.go('packagesList.selectConnectionPage', this.data.formData)
}
},
hiddenSelectConfirm(e) {
let selectServiceInfo = e?.detail
console.log(selectServiceInfo)
this.setData({ showServiceConfirm: !this.data.showServiceConfirm })
if (!selectServiceInfo) return
this.setData({
showServiceConfirm: !this.data.showServiceConfirm,
'formData.selectServiceInfo': selectServiceInfo,
'formData.serviceValue': selectServiceInfo?.serviceName
})
},
input(e) {
const { value } = e.detail,
{ name } = e.currentTarget.dataset
this.setData({
[`formData.${name}`]: value
})
},
// 校验
checkRequired(obj) {
console.log(obj)
let target = ['selectServiceInfo', 'staffName', 'staffMobile']
try {
target.map(key => {
if (!obj[key]) {
throw key
}
})
} catch (error) {
return error
}
return false
},
// 提交
handleConfirm() {
let { addOrEdit } = this.data
let { addOrEdit, formData, toastList } = this.data
const phoneRex = /^[1]([3-9])[0-9]{9}$/
let key = this.checkRequired(formData)
if (key) {
wx.$api.showToast(toastList[key])
return
}
if (!phoneRex.test(formData?.staffMobile)) {
wx.$api.showToast('请输入正确的手机号')
return
}
console.log(formData)
let message = addOrEdit == 'add' ? '是否确定创建员工?' : '是否确定修改员工信息?'
wx.showModal({
title: '提示',
......
......@@ -11,7 +11,10 @@
<input
type="text"
placeholder="{{item.placeholder}}"
class="input"
class="input"
bindinput="input"
data-name="{{item.props}}"
maxlength="{{item.maxLength}}"
value="{{formData[item.props]}}"
placeholder-class="input-placeholder" />
</view>
......
var formatMobile = function (item) {
return item.substring(0,3)+" " + item.substring(3,7) +" "+item.substring(7)
}
module.exports = {
formatMobile: formatMobile
}
\ No newline at end of file
......@@ -7,7 +7,7 @@ Page({
data: {
showConnectionConfirm: false,
connectionList: [{
serviceCode: 1,
connectionCode: 1,
staffName: '马保国',
staffMobile: '13645674567',
serviceName: '广东嘀加1号服务中心',
......@@ -15,104 +15,104 @@ Page({
checked: true,
disabled: true
}, {
serviceCode: 2,
connectionCode: 2,
staffName: '马保国',
staffMobile: '13645674567',
serviceName: '广东嘀加2号服务',
time: '2022.10.03'
}, {
serviceCode: 3,
connectionCode: 3,
staffName: '马保国',
staffMobile: '13645674567',
serviceName: '广东嘀加3号服务',
time: '2022.10.03'
}, {
serviceCode: 4,
connectionCode: 4,
staffName: '马保国',
staffMobile: '13645674567',
serviceName: '广东嘀加4号服务中心',
time: '2022.10.03'
}, {
serviceCode: 5,
connectionCode: 5,
staffName: '马保国',
staffMobile: '13645674567',
serviceName: '广东嘀加5号服务中心',
time: '2022.10.03'
}, {
serviceCode: 6,
connectionCode: 6,
staffName: '马保国',
staffMobile: '13645674567',
serviceName: '广东嘀加八号快乐酷爱咖哩鸡服务中心咖哩鸡服务中心咖哩鸡服务中心',
time: '2022.10.03'
}, {
serviceCode: 7,
connectionCode: 7,
staffName: '马保国',
staffMobile: '13645674567',
serviceName: '广东嘀加八号快乐酷爱咖哩鸡服务中心咖哩鸡服务中心咖哩鸡服务中心',
time: '2022.10.03'
}, {
serviceCode: 8,
connectionCode: 8,
staffName: '马保国',
staffMobile: '13645674567',
serviceName: '广东嘀加八号快乐酷爱咖哩鸡服务中心咖哩鸡服务中心咖哩鸡服务中心',
time: '2022.10.03'
}, {
serviceCode: 9,
connectionCode: 9,
staffName: '马保国',
staffMobile: '13645674567',
serviceName: '广东嘀加八号快乐酷爱咖哩鸡服务中心咖哩鸡服务中心咖哩鸡服务中心',
time: '2022.10.03'
}, {
serviceCode: 10,
connectionCode: 10,
staffName: '马保国',
staffMobile: '13645674567',
serviceName: '广东嘀加八号快乐酷爱咖哩鸡服务中心咖哩鸡服务中心咖哩鸡服务中心',
time: '2022.10.03'
}, {
serviceCode: 11,
connectionCode: 11,
staffName: '马保国',
staffMobile: '13645674567',
serviceName: '广东嘀加八号快乐酷爱咖哩鸡服务中心咖哩鸡服务中心咖哩鸡服务中心',
time: '2022.10.03'
}, {
serviceCode: 12,
connectionCode: 12,
staffName: '马保国',
staffMobile: '13645674567',
serviceName: '广东嘀加八号快乐酷爱咖哩鸡服务中心咖哩鸡服务中心咖哩鸡服务中心',
time: '2022.10.03'
}, {
serviceCode: 13,
connectionCode: 13,
staffName: '马保国',
staffMobile: '13645674567',
serviceName: '123456',
time: '2022.10.03',
disabled: true
}, {
serviceCode: 14,
connectionCode: 14,
staffName: '马保国',
staffMobile: '13645674567',
serviceName: '广东嘀加八号快乐酷爱咖哩鸡服务中心咖哩鸡服务中心咖哩鸡服务中心',
time: '2022.10.03'
}, {
serviceCode: 15,
connectionCode: 15,
staffName: '马保国',
staffMobile: '13645674567',
serviceName: '广东嘀加八号快乐酷爱咖哩鸡服务中心咖哩鸡服务中心咖哩鸡服务中心',
time: '2022.10.03'
}, {
serviceCode: 16,
connectionCode: 16,
staffName: '马保国',
staffMobile: '13645674567',
serviceName: '广东嘀加八号快乐酷爱咖哩鸡服务中心咖哩鸡服务中心咖哩鸡服务中心',
time: '2022.10.03'
}, {
serviceCode: 17,
connectionCode: 17,
staffName: '马保国',
staffMobile: '13645674567',
serviceName: '广东嘀加八号快乐酷爱咖哩鸡服务中心咖哩鸡服务中心咖哩鸡服务中心',
time: '2022.10.03'
}, {
serviceCode: 18,
connectionCode: 18,
staffName: '马保国',
staffMobile: '13645674567',
serviceName: '789',
......@@ -138,6 +138,23 @@ Page({
},
onRoute(options) {
let { selectType } = this.data
selectType.map(v => {
// 未指定可见客户
if (options?.selectedConnectionList.length == 0 && v.type == 0) {
v.active = true
} else if (options?.selectedConnectionList.length > 0 && v.type == 1) {
v.active = true
this.setData({
showConnectionList: true
})
}
return v
})
this.setData({selectType, selectedConnectionList: options?.selectedConnectionList || []})
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
......@@ -160,13 +177,13 @@ Page({
},
changeType(e) {
let { index } = e.currentTarget.dataset
let { type } = e.currentTarget.dataset
let { selectType, showConnectionList } = this.data
selectType.forEach((v, ind) => {
if (index == ind && v.active) return showConnectionList = !showConnectionList
if (index == ind && !v.active) {
if (type == v.type && v.active) return showConnectionList = !showConnectionList
if (type == v.type && !v.active) {
v.active = true
if (index == 1) showConnectionList = true
if (type == 1) showConnectionList = true
else showConnectionList = false
}
else v.active = false
......@@ -207,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.selectedIds': selectedConnectionList
'formData.selectedConnectionList': selectedConnectionList
})
this.back()
},
......
......@@ -4,14 +4,14 @@
</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-index="{{index}}">
<view class="flex_class" wx:for="{{selectType}}" 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" />
</view>
</view>
<view class="flex1">
<view class="label {{index == 1?'lable_border':''}}">{{item.label}}<glsx-image wx:if="{{index == 1}}" src="personal/arrow_right.png" class="arrow_up {{showConnectionList ? 'arrow_down' : ''}}" /></view>
<view class="label {{item.type == 1?'lable_border':''}}">{{item.label}}<glsx-image wx:if="{{item.type == 1}}" src="personal/arrow_right.png" class="arrow_up {{showConnectionList ? 'arrow_down' : ''}}" /></view>
<view class="tips" wx:if="{{item.tips}}">{{item.tips}}</view>
</view>
</view>
......@@ -27,4 +27,4 @@
<view class="btn-cancel" bindtap="handleConfirm" bindtap="back">取消</view>
</view>
</view>
<select-connection-confirm show="{{showConnectionConfirm}}" bind:selectConfirm="selectConfirm" connectionList="{{connectionList}}" tabBarStyle="{{tabBarStyle}}"></select-connection-confirm>
<select-connection-confirm show="{{showConnectionConfirm}}" selectedConnectionList="{{selectedConnectionList || []}}" bind:selectConfirm="selectConfirm" connectionList="{{connectionList}}" tabBarStyle="{{tabBarStyle}}"></select-connection-confirm>
......@@ -131,8 +131,9 @@ Page({
// }
// }
// })
let type = e.currentTarget.dataset
wx.$router.go('packagesList.createStaff', type)
let dataset = e.currentTarget.dataset
console.log(dataset)
wx.$router.go('packagesList.createStaff', dataset)
},
/**
......
<!--packagesList/mineDetail/pages/staffManage/staffManage.wxml-->
<wxs src="../index.wxs" module="format" />
<view class="staff-list-page">
<view class="btn_box" bindtap="jump" data-type="add">
<view class="btn_box" bindtap="jump">
<glsx-image src="index/apply.png" class="icon" />
<text>创建新员工</text>
</view>
<view class="content-box" wx:if="{{!staffList.length}}">
<view class="content-box" wx:if="{{staffList.length}}">
<view class="title-box">
<view class="title">员工数量:<text class="number">{{total}}</text></view>
<view class="select-btn">
......@@ -23,14 +24,14 @@
style="height:calc(100vh - 148rpx - 110rpx);"
refresher-threshold="104"
refresher-triggered="{{triggered}}">
<view class="item-box" wx:for="{{staffList}}" wx:key="index" bindtap="jump" data-type="edit">
<view class="item-box" wx:for="{{staffList}}" wx:key="index" bindtap="jump" data-info="{{item}}">
<view class="top">
<view class="message">
<glsx-image wx:if="{{!item.avatarUrl}}" src="personal/staff_defalut_avatar.png" class="avatar"/>
<image wx:else src="{{item.avatarUrl}}" class="avatar"></image>
<view class="message-text">
<view class="name">{{item.staffName}}</view>
<view class="mobile">{{item.staffMobile}}</view>
<view class="mobile">{{format.formatMobile(item.staffMobile)}}</view>
</view>
</view>
<glsx-image src="personal/arrow_right.png" class="arrow_right" />
......
......@@ -23,27 +23,27 @@ Page({
test: `/personal/icon2.png`,
boxItemList: [{
name: '消息盒子',
path: 'packagesList.messageBox',
path: 'packageMine.messageBox',
hasRedPot: true,
isRead: false
}, {
name: '看线索',
path: 'packagesList.clue',
path: 'packageMine.clue',
hasRedPot: true,
isRead: false
}, {
name: '服务中心管理',
path: 'packagesList.serviceList',
path: 'packageMine.serviceList',
hasRedPot: true,
isRead: false
}, {
name: '员工管理',
path: 'packagesList.staffList',
path: 'packageMine.staffList',
hasRedPot: true,
isRead: false
}, {
name: '客户管理',
path: 'packagesList.customerManagement'
path: 'packageMine.customerManagement'
}],
isShowService: false,
},
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!