Commit 93ddcb34 by chenwq

联调

1 parent b72de2ff
import api from '~/utils/request/request'
// 分页查询客户管理列表
const getCustomerList = data => {
return api.post(
{
method: 'scrm.api.busassistant.merchantCustomer.page',
...data
}
)
}
// 保存客户管理信息
const saveCustomer = data => {
return api.post(
{
method: 'scrm.api.busassistant.merchantCustomer.save',
...data
}
)
}
// 修改客户管理信息
const updateCustomer = data => {
return api.post(
{
method: 'scrm.api.busassistant.merchantCustomer.update',
...data
}
)
}
// 查询客户销售顾问列表
const getEmployeeList = data => {
return api.post(
{
method: 'scrm.api.busassistant.merchantCustomer.employee.list',
...data
}
)
}
// 创建邀请销售顾问二维码
const getInviteCode = data => {
return api.post(
{
method: 'scrm.api.busassistant.merchantCustomer.inviteCode',
...data
}
)
}
export default {
getCustomerList,
saveCustomer,
updateCustomer,
getEmployeeList,
getInviteCode
}
\ No newline at end of file
import api from '~/utils/request/request'
// 查询服务中心列表-不分页
const getAllServiceList = data => {
return api.post(
{
method: 'scrm.api.busassistant.serviceCenter.listByServiceMerchantId',
...data
}
)
}
// 分页查询服务中心列表
const getServiceList = data => {
return api.post(
......@@ -31,6 +41,7 @@ const updateService = data => {
}
export default {
getAllServiceList,
getServiceList,
saveService,
updateService
......
// packageMine/pages/customerManagement/customerList/customerList.js
import { IMG_URL } from '~/utils/constantData'
import mineCustomerApi from '~/api/mineApi/mineCustomer'
Page({
/**
......@@ -12,50 +13,10 @@ Page({
serviceName: '全部服务中心'
},
popupShow: false,
customerList: [{
merchantId: '4400000',
merchantName: '嘀加鹏辉奥迪4S店',
contactName: '张三',
phone: '15718122929',
serviceCenterMerchantId: '1',
serviceCenterName: '广东嘀加八号服务中心',
createdDate: '2022.10.03',
employeeNum: '2',
sceneList: []
}, {
merchantId: '4400000',
merchantName: '嘀加鹏辉奥迪4S店',
contactName: '张三',
phone: '15718122929',
serviceCenterMerchantId: '1',
serviceCenterName: '广东嘀加八号服务中心',
createdDate: '2022.10.03',
employeeNum: '1',
sceneList: []
}, {
merchantId: '4400000',
merchantName: '嘀加鹏辉奥迪4S店',
contactName: '张三',
phone: '15718122929',
serviceCenterMerchantId: '1',
serviceCenterName: '广东嘀加八号服务中心',
createdDate: '2022.10.03',
employeeNum: '4',
sceneList: []
}, {
merchantId: '4400000',
merchantName: '嘀加鹏辉奥迪4S店',
contactName: '张三',
phone: '15718122929',
serviceCenterMerchantId: '1',
serviceCenterName: '广东嘀加八号服务中心',
createdDate: '2022.10.03',
employeeNum: '0',
sceneList: []
}],
total: 15,
customerList: [],
total: -1,
pageCof: {
currentPage: 1,
pageNum: 1,
pageSize: 10
}
},
......@@ -70,8 +31,7 @@ Page({
// 邀请销售
handleSale(e) {
let { target } = e.currentTarget.dataset
console.log(target, 'target---')
wx.$router.go('packageMine.saleList', { serviceCenterMerchantId: target.serviceCenterMerchantId })
wx.$router.go('packageMine.saleList', target)
},
handleEdit(e) {
......@@ -83,6 +43,33 @@ Page({
wx.$router.go('packageMine.editCustomer', params)
},
handleSearch() {
this.setData({
['pageCof.pageNum']: 1,
total: -1
})
this.getList()
},
getList() {
let { customerList, pageCof, total } = this.data
if (total == customerList.length) {
return true
}
let params = {
...pageCof
}
mineCustomerApi.getCustomerList(params).then(res => {
let { list, total } = res
this.setData({
customerList: pageCof.pageNum == 1 ? (list || []) : customerList.concat(list || []),
['pageCof.pageNum']: pageCof.pageNum + 1,
triggered: false,
total
})
})
},
/**
* 生命周期函数--监听页面加载
*/
......@@ -101,7 +88,7 @@ Page({
* 生命周期函数--监听页面显示
*/
onShow() {
this.getList()
},
/**
......
......@@ -7,7 +7,7 @@
</view>
<view class="content-box" wx:if="{{customerList.length}}">
<view class="title-box">
<view class="title">客户数量:<text class="number">{{total}}</text></view>
<view class="title">客户数量:<text class="number">{{total < 0 ? 0 : total}}</text></view>
<view class="select-btn">
<view class="type" bindtap="filterTypeFn">
<text>{{selectInfo.serviceName}}</text>
......@@ -15,7 +15,7 @@
</view>
</view>
</view>
<scroll-view scroll-y enable-back-to-top refresher-enabled="{{true}}" bindrefresherrefresh="search" bindscrolltolower="onBottomRefresh" class="list" style="height:calc(100vh - 148rpx - 110rpx);" refresher-threshold="104" refresher-triggered="{{triggered}}">
<scroll-view scroll-y enable-back-to-top refresher-enabled="{{true}}" bindrefresherrefresh="handleSearch" bindscrolltolower="getList" class="list" style="height:calc(100vh - 148rpx - 110rpx);" refresher-threshold="104" refresher-triggered="{{triggered}}">
<view class="item-box" wx:for="{{customerList}}" wx:key="index" bindtap="handleEdit" data-type="edit" data-target="{{item}}">
<view class="top">
<view class="message">
......@@ -37,19 +37,19 @@
<glsx-image wx:if="{{item.employeeNum > 2}}" class="employee-img img-3" src="personal/staff_defalut_avatar.png" />
</view>
<view>+{{item.employeeNum}}</view>
<view class="look-btn">查看</view>
<view class="look-btn" data-target="{{item}}" catchtap="handleSale">查看</view>
</view>
</view>
<view class="employee-btn" data-target="{{item}}" catchtap="handleSale">邀请销售顾问</view>
</view>
<view class="bottom">
<view class="service_name">
所属:{{item.serviceCenterName}}
所属:{{item.serviceCenterMerchantName}}
</view>
<view class="time">{{item.createdDate}}</view>
</view>
</view>
<view class="bottomTips" wx:if="{{customerList.length>10}}">到底啦!</view>
<view class="bottomTips" wx:if="{{customerList.length == total}}">到底啦!</view>
</scroll-view>
</view>
......
const phoneRex = /^[1]([3-9])[0-9]{9}$/
const formRule = {
serviceCenterMerchantId: [{ required: true, message: '请选择所属服务中心' }],
merchantName: [{ required: true, message: '客户名称不能为空' }],
contactName: [{ required: true, message: '联系人不能为空' }],
phone: [
......@@ -14,8 +15,8 @@ const formRule = {
const formItems = [{
label: '所属服务中心',
props: 'selectServiceInfo',
valueFn: 'serviceValue',
props: 'serviceCenterMerchantId',
valueFn: 'serviceCenterMerchantName',
type: 'select',
placeholder: '请选择服务中心',
pageType: 1
......
// packageMine/pages/customerManagement/editCustomer/editCustomer.js
import constantData from './constant/data'
import { scenceList } from '~/pages/tab/index/constant/data'
import { IMG_URL } from '~/utils/constantData'
import mineServiceApi from '~/api/mineApi/mineService'
import mineCustomerApi from '~/api/mineApi/mineCustomer'
Page({
/**
* 页面的初始数据
*/
data: {
IMGURL: IMG_URL,
addOrEdit: '',
formData: {},
formItems: constantData.formItems,
apiNameObj: {
'add': 'saveCustomer',
'edit': 'updateCustomer'
},
// 服务中心-选择
selectInfo: {},
showServiceConfirm: false,
serviceList: [],
// 场景业务
scenceList,
},
getAllServiceList() {
mineServiceApi.getAllServiceList({}).then(res => {
console.log(res)
this.setData({
serviceList: res || []
})
})
},
handleSceneClick(e) {
let { idx } = e.currentTarget.dataset
this.setData({
['scenceList[' + idx + '].isCheck']: !this.data.scenceList[idx].isCheck
})
},
// 选择服务中心/客户
jump(e) {
let { addOrEdit } = this.data
if(addOrEdit == 'edit') {
return true
}
let { type } = e.currentTarget.dataset
switch (type) {
// 选择服务中心
case 1:
this.hiddenSelectConfirm()
break
}
},
// 服务中心
hiddenSelectConfirm(e) {
let selectInfo = e?.detail
this.setData({ showServiceConfirm: !this.data.showServiceConfirm })
if (!selectInfo) return
this.setData({
selectInfo: selectInfo,
'formData.serviceCenterMerchantId': selectInfo?.yqMerchantId,
'formData.serviceCenterMerchantName': selectInfo?.yqMerchantName
})
},
handleInput(e) {
......@@ -19,14 +77,31 @@ Page({
})
},
dealScene() {
let arr = []
let { scenceList } = this.data
scenceList.forEach(item => {
if (item.isCheck) {
arr.push(item.sceneCode)
}
})
return arr
},
handleConfirm() {
let { addOrEdit, formData } = this.data
let { apiNameObj, addOrEdit, formData } = this.data
formData.sceneList = this.dealScene()
let validObj = wx.$util.checkRule(formData, constantData.formRule)
if (validObj) {
wx.$api.showToast(validObj.message)
return
}
if (!formData.sceneList.length) {
wx.$api.showToast('请选择场景')
return
}
let message = addOrEdit == 'add' ? '是否确定客户?' : '是否确定修改客户?'
delete formData.serviceCenterMerchantName
wx.showModal({
title: '提示',
content: message,
......@@ -36,9 +111,16 @@ Page({
success(res) {
if (res.confirm) {
// 创建/编辑接口
if (addOrEdit == 'add') {
wx.$router.redirectTo('packageMine.successPage?page=customer')
}
mineCustomerApi[apiNameObj[addOrEdit]](formData).then(res => {
if (addOrEdit == 'add') {
wx.$router.redirectTo('packageMine.successPage?page=customer')
} else {
wx.$api.showToast('修改成功')
setTimeout(() => {
wx.$router.reLaunch('packageMine.customerList')
}, 1000)
}
})
}
}
})
......@@ -48,13 +130,31 @@ Page({
* 生命周期函数--监听页面加载
*/
onLoad(options) {
let { scenceList } = this.data
wx.$router.getData(res => {
let { addOrEdit, target } = res
this.setData({
addOrEdit,
formData: target || {}
formData: {
...target,
oldPhone: target?.phone
}
})
if (addOrEdit == 'edit') {
wx.setNavigationBarTitle({ title: '编辑客户' })
scenceList.forEach(item => {
item.isCheck = target.sceneList.findIndex(k => k == item.sceneCode) != -1
})
this.setData({
scenceList,
selectInfo: {
yqMerchantId: target.serviceCenterMerchantId,
yqMerchantName: target.serviceCenterMerchantName
}
})
}
})
this.getAllServiceList()
},
/**
......
{
"usingComponents": {}
"navigationBarTitleText": "创建客户",
"usingComponents": {
"select-service-confirm": "../../../components/selectServiceConfirm/selectServiceConfirm"
}
}
\ No newline at end of file
......@@ -71,4 +71,92 @@
background: var(--btnColor);
border-radius: 8rpx;
}
}
\ No newline at end of file
}
.flex {
display: flex;
}
.scene {
text-align: center;
width: 100%;
}
.scene-item {
box-sizing: border-box;
position: relative;
width: 25%;
/* flex: 1; */
background: #F7F8FC;
margin-right: 4rpx;
font-size: 18rpx;
color: #8A8C90;
/* padding: 32rpx 0 28rpx; */
padding: 24rpx 0 18rpx;
border-radius: 12rpx;
font-weight: 500;
border: 2rpx solid #F7F8FC;
/* margin-bottom: 20rpx; */
}
.scene-item:last-child {
margin-right: 0;
}
.check-icon {
position: absolute;
top: 0;
right: 0;
width: 30rpx;
height: 22rpx;
}
.scene-title {
width: 100rpx;
font-size: 24rpx;
font-weight: 600;
text-align: center;
color: #323436;
}
.scene-item:nth-child(2) .scene-title {
width: 120rpx;
}
/* 选中 - start */
.active.scene-item {
background-image: linear-gradient(144deg, #F0F7FF 0%, #FFFFFF 73%);
border: 2rpx solid #3666FE;
border-radius: 12rpx;
}
/* 选中 - end */
.title-box {
height: 68rpx;
display: flex;
justify-content: center;
align-items: center;
margin: 10rpx 0 4rpx;
}
.scene-title.on-open {
color: #8A8C90;
}
.no-open-img {
position: relative;
}
.scene-img {
width: 92rpx;
height: 64rpx;
}
.lock-img {
width: 92rpx;
height: 64rpx;
}
/* .notOpened {
color: #8A8C90;
} */
\ No newline at end of file
......@@ -13,10 +13,20 @@
<glsx-image src="personal/arrow_right.png" class="arrow_right" />
</view>
<view wx:if="{{item.type == 'business'}}">
<view class="flex scene">
<view class="scene-item {{item.isCheck ? 'active' : ''}}" wx:for="{{scenceList}}" wx:key="index" bindtap="handleSceneClick" data-idx="{{index}}" data-scenecode="{{item.sceneCode}}">
<glsx-image wx:if="{{item.isCheck}}" src="personal/scene-check.png" class="check-icon" />
<image webp class="scene-img" src="{{IMGURL}}output/caracticon0{{item.sceneid + 1}}.png?v={{img_version}}"></image>
<view class="title-box">
<view class="scene-title">{{item.name}}</view>
</view>
</view>
</view>
</view>
</block>
</view>
<view class="isFullSucreen btn">
<view class="btn-blue" bindtap="handleConfirm">{{addOrEdit == 'add' ? '提交' : '保存'}}</view>
</view>
</view>
\ No newline at end of file
</view>
<select-service-confirm show="{{showServiceConfirm}}" tabBarStyle="{{tabBarStyle}}" serviceList="{{serviceList}}" selectInfo="{{formData.selectInfo}}" bind:hiddenSelectConfirm="hiddenSelectConfirm"></select-service-confirm>
\ No newline at end of file
// packageMine/pages/customerManagement/saleList/saleList.js
import { IMG_URL } from '~/utils/constantData'
import mineCustomerApi from '~/api/mineApi/mineCustomer'
Page({
/**
......@@ -8,20 +9,18 @@ Page({
data: {
IMG_URL,
bgUrl: `${IMG_URL}/personal/empty_tran.png`,
saleList: [{
merchantName: '刘权',
phone: '15718122929',
departmentName: '销售部',
merchantCustomerName: '广东嘀加鹏辉奥迪4S店',
createdDate: '2022.10.03'
}],
total: 15,
searchForm: {
serviceCenterMerchantId: ''
},
saleList: [],
total: -1,
customerInfo: {},
// 邀请销售
isPopupShow: false,
popupVal: ''
popupVal: '',
// 提示
isTipShow: false,
tipObj: {
inviteUrl: '',
qrcodeUrl: ''
}
},
handlePopup() {
......@@ -39,7 +38,57 @@ Page({
},
handlePopupConfirm() {
this.handlePopup()
this.setData({
isPopupShow: !this.data.isPopupShow
})
this.getInviteCode()
},
getList() {
let { customerInfo } = this.data
mineCustomerApi.getEmployeeList({ merchantId: customerInfo.merchantId }).then(res => {
console.log(res)
this.setData({
saleList: res
})
})
},
getInviteCode() {
let { customerInfo } = this.data
let sceneStr = ''
let sceneToNum = {
'SC001': 0,
'SC002': 1,
'SC003': 2,
'SC004': 3,
}
if (!customerInfo.sceneList || !customerInfo.sceneList.length) {
wx.$api.showToast('缺少场景值')
return true
}
wx.$api.showLoading('加载中...')
customerInfo.sceneList.forEach(item => {
sceneStr = sceneStr + (sceneStr ? (',' + sceneToNum[item]) : sceneToNum[item])
})
let params = {
merchantId: customerInfo.serviceCenterMerchantId,
staffLabel: sceneStr
}
mineCustomerApi.getInviteCode(params).then(res => {
console.log(res)
this.setData({
tipObj: res || {}
})
this.handleShow()
wx.$api.hideLoading()
})
},
handleShow() {
this.setData({
isTipShow: !this.data.isTipShow
})
},
/**
......@@ -47,11 +96,10 @@ Page({
*/
onLoad(options) {
wx.$router.getData(res => {
console.log(res)
let { serviceCenterMerchantId } = res
this.setData({
['searchForm.serviceCenterMerchantId']: serviceCenterMerchantId
customerInfo: res
})
this.getList()
})
},
......
{
"navigationBarTitleText": "销售顾问",
"usingComponents": {}
}
\ No newline at end of file
......@@ -41,42 +41,6 @@
color: var(--btnColor)
}
}
// .select-btn {
// box-sizing: border-box;
// padding: 16rpx 0;
// display: flex;
// align-items: center;
// z-index: 2;
// background-color: #f2f3f7;
// .type {
// margin-left: 8px;
// display: flex;
// justify-content: center;
// align-items: center;
// padding: 0 16rpx;
// height: 24px;
// line-height: 24px;
// background: #ffffff;
// border-radius: 14px;
// font-size: 12px;
// color: #8a8c90;
// text {
// max-width: 360rpx;
// overflow: hidden;
// text-overflow: ellipsis;
// white-space: nowrap;
// }
// .point {
// margin-left: 2px;
// width: 12px;
// height: 12px;
// }
// }
// }
}
.item-box {
......@@ -167,4 +131,107 @@
.popup-active {
background: #F0F7FF;
}
// 提示
.layout {
position: fixed;
top: 0;
right: 0;
bottom: 0;
left: 0;
width: 100vw;
height: 100vh;
z-index: 998;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
}
.bg {
position: absolute;
width: 100%;
height: 100%;
z-index: -1;
background: rgba(0, 0, 0, .8);
}
.content {
position: relative;
text-align: center;
box-sizing: border-box;
// background-image: linear-gradient(180deg, #F7F9FF 0%, #FFFFFF 54%);
}
.content.code {
width: 558rpx;
height: 648rpx;
background: #FFFFFF;
border-radius: 16rpx;
.img-box {
padding: 60rpx;
image {
width: 440rpx;
height: 440rpx;
}
}
.code-btn {
display: flex;
justify-content: center;
align-items: center;
height: 90rpx;
line-height: 90rpx;
background: #F7F8FA;
font-size: 32rpx;
color: #3666FE;
.icon-long-press {
width: 40rpx;
height: 40rpx;
margin-right: 12rpx;
}
}
}
.content.link {
width: 614rpx;
height: 440rpx;
background: #FFFFFF;
border-radius: 32rpx;
.title {
height: 110rpx;
line-height: 110rpx;
text-align: center;
font-weight: 600;
font-size: 32rpx;
color: #323436;
border-bottom: 2rpx solid #F5F6F7;
}
.link-content {
font-size: 32rpx;
color: #323436;
padding: 64rpx 82rpx;
}
.link-btn {
height: 110rpx;
line-height: 110rpx;
font-size: 32rpx;
color: #3666FE;
text-align: center;
border-top: 2rpx solid #F5F6F7;
}
}
.close {
margin-top: 60rpx;
width: 64rpx;
height: 64rpx;
}
\ No newline at end of file
......@@ -6,7 +6,7 @@
</view>
<view class="content-box" wx:if="{{saleList.length}}">
<view class="title-box">
<view class="title">销售顾问:<text class="number">{{total}}</text></view>
<view class="title">销售顾问:<text class="number">{{saleList.length}}</text></view>
</view>
<scroll-view scroll-y enable-back-to-top refresher-enabled="{{true}}" bindrefresherrefresh="search" bindscrolltolower="onBottomRefresh" class="list" style="height:calc(100vh - 148rpx - 110rpx);" refresher-threshold="104" refresher-triggered="{{triggered}}">
<view class="item-box" wx:for="{{saleList}}" wx:key="index">
......@@ -41,4 +41,26 @@
<popup show="{{isPopupShow}}" title="请选择邀请方式" height="36%" bindconfirm="handlePopupConfirm" bindhidePopup="handlePopup">
<view class="popup-row {{popupVal == 'code' ? 'popup-active' : ''}}" data-val="code" bindtap="handlePopupChoose">二维码邀请</view>
<view class="popup-row {{popupVal == 'link' ? 'popup-active' : ''}}" data-val="link" bindtap="handlePopupChoose">链接邀请</view>
</popup>
\ No newline at end of file
</popup>
<!-- 提示 -->
<view wx:if="{{isTipShow}}" class="layout">
<view class="bg" bindtap="handleShow" />
<view wx:if="{{popupVal == 'code'}}" class="content code">
<view class="img-box">
<image src="{{tipObj.qrcodeUrl}}" show-menu-by-longpress></image>
</view>
<view class="code-btn">
<glsx-image src="personal/icon-long-press.png" class="icon-long-press" />
长按图片转发
</view>
</view>
<view wx:if="{{popupVal == 'link'}}" class="content link">
<view class="title">提示</view>
<view class="link-content">
<view>已自动复制邀请链接至剪贴板,</view>
<view>请前往微信粘贴发送</view>
</view>
<view class="link-btn" bindtap="handleShow">确定</view>
</view>
<image wx:if="{{popupVal == 'code'}}" src="{{IMG_URL}}index/close.png" class="close" bindtap="handleShow"></image>
</view>
\ No newline at end of file
......@@ -77,6 +77,8 @@ Page({
this.setData({
formItems
})
} else {
wx.setNavigationBarTitle({ title: '编辑服务中心' })
}
})
},
......
{
"navigationBarTitleText": "创建服务中心",
"usingComponents": {}
}
\ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!