From d5cc6898bd227c76f34a002d24730fa45aae5231 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=80=81=E5=8F=B6?= Date: Wed, 27 Jul 2022 17:57:50 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=86=E9=85=8D=E8=AE=A2=E5=8D=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- commons/js/config.js | 8 ++- commons/js/utils/apiQuery.js | 13 ++++ pages/mine/install/staff/index.js | 7 ++- pages/order/filterList/index2.js | 95 +++++++++++++++++++++++++++++ pages/order/filterList/index2.wxml | 35 ++++++++++- pages/order/index.js | 96 ++++++++++++++++++++++++++++++ pages/order/index.wxml | 37 +++++++++++- 7 files changed, 281 insertions(+), 10 deletions(-) diff --git a/commons/js/config.js b/commons/js/config.js index e87dac3..0b4c6a9 100644 --- a/commons/js/config.js +++ b/commons/js/config.js @@ -36,7 +36,7 @@ api = { appCustomerData: "app/customers/data", //获取客户详细信息 appCusorder: "app/cusorder", //新建订单 /获取订单列表 /获取订单详情 /修改付款方式 /修改委托协议 appCusorderTabs: "app/cusorder/tabs", //获取tab - appEmployees: "app/employees", //获取客户详细信息 /获取店员列表 /更新店员信息 /删除店员 //提交离职 + appEmployees: "app/employees", //获取客户详细信息 /获取店员列表 /更新店员信息 /删除店员 appIdcard: "app/idcard", //创建申请开票信息 appUserCal: "app/user/cal", //获取用户统计 appCusorderCkcar: "app/cusorder/ckcar", //确认交付 @@ -145,7 +145,11 @@ api = { appCityArea:'app/city/area', //获取省/市/区/街道 - appEmployeesLeave:'app/employees/leave', //获取离职 + appEmployeesLeave:'app/employees/leave', //获取离职 //提交离职 + + appCusorderV2Admins:'app/cusorderV2/admins', //分配订单 + + } diff --git a/commons/js/utils/apiQuery.js b/commons/js/utils/apiQuery.js index 1848f2d..5c425ce 100644 --- a/commons/js/utils/apiQuery.js +++ b/commons/js/utils/apiQuery.js @@ -875,5 +875,18 @@ apiQuery.getAppEmployeesLeave = function (params) { }) } +//提交离职 +apiQuery.putAppEmployeesLeave = function (params) { + return new Promise(function (resolve, reject) { + HttpRequest(true, Config.api.appEmployeesLeave, 2, params, "PUT", resolve, reject) + }) +} + +//分配订单 +apiQuery.putAppCusorderV2Admins = function (params) { + return new Promise(function (resolve, reject) { + HttpRequest(true, Config.api.appCusorderV2Admins, 2, params, "PUT", resolve, reject) + }) +} export default apiQuery; \ No newline at end of file diff --git a/pages/mine/install/staff/index.js b/pages/mine/install/staff/index.js index ed00426..c1b4ad6 100644 --- a/pages/mine/install/staff/index.js +++ b/pages/mine/install/staff/index.js @@ -271,14 +271,15 @@ Page({ params['out_id'] = that.data.out_id; params['in_id'] = that.data.adviser.list[that.data.adviserIndex].id; params['transfer'] = that.data.transfer; - _.apiQuery.putAppEmployees(params).then(res => { - this.setData({ + _.apiQuery.putAppEmployeesLeave(params).then(res => { + that.setData({ isShowTransfer:false, }) wx.showToast({ - title: '预交成功', + title: '移交成功', icon: 'success' }) + that.onPullDownRefresh() }) } else if (res.cancel) { diff --git a/pages/order/filterList/index2.js b/pages/order/filterList/index2.js index 124b772..56a55bb 100644 --- a/pages/order/filterList/index2.js +++ b/pages/order/filterList/index2.js @@ -14,6 +14,11 @@ Page({ content:'',//短信内容 isRefresh:false,//判断返回是否需要刷新 v2OrderId:_.config.v2OrderId,//订单id临界切换版本 + + staffArray: [], + staffobj: [], + employeeIndex:-1,//分配销售索引 + employee_id:'',//分配销售ID }, onLoad: function (options) { for (let key in options) { @@ -26,6 +31,9 @@ Page({ wx.setNavigationBarTitle({ title: this.data.title||'订单' }) + + //销售顾问 + this.getAppUserAdmins() }, //获取订单列表 @@ -135,6 +143,93 @@ Page({ } }, + //获取销售顾问 + getAppUserAdmins(){ + let params = {}; + params['page'] = 1; + params['size'] = 1000; + _.apiQuery.getAppUserAdmins(params).then(res => { + let staffArray = [] + res.data.list.forEach(item => { + staffArray.push(item.uname) + }) + let bizArray = [] + res.data.bizs.forEach(item => { + bizArray.push(item.name) + }) + this.setData({ + staffArray:staffArray, + staffobj: res.data.list, + }) + }); + }, + + //显示分配订单 + showTransfer(e) { + this.setData({ + ids:[e.currentTarget.dataset.id], + isShowTransfer:true, + }) + }, + + //显示隐藏分配订单 + optTransfer(e) { + this.setData({ + employee_id:'', + employeeIndex:-1, + isShowTransfer:!this.data.isShowTransfer, + }) + }, + + //选择店员 + changeEmployee(e) { + let employee_id = '' + if(e.detail.value >= 0){ + employee_id = this.data.staffobj[e.detail.value].id + } + this.setData({ + employee_id, + employeeIndex:e.detail.value, + }) + }, + + //分配订单 + putAppCusorderV2Admins(){ + let that = this + if (that.data.employeeIndex == -1 ) { + wx.showToast({ + title: '请选择销售顾问', + icon: 'none' + }) + } + else{ + that.setData({ + submitFlag: true, + }) + let params = {}; + params['ids'] = that.data.ids; + params['admin_id'] = that.data.employee_id; + _.apiQuery.putAppCusorderV2Admins(params).then(res => { + + wx.showToast({ + title: '分配成功', + icon: 'success', + duration: 2000 + }) + that.setData({ + isShowTransfer:false, + submitFlag:false, + }) + that.onPullDownRefresh() + + }).catch(res=>{ + that.setData({ + submitFlag: false, + }) + }); + } + }, + //页面相关事件处理函数--监听用户下拉动作 onPullDownRefresh(){ this.setData({ diff --git a/pages/order/filterList/index2.wxml b/pages/order/filterList/index2.wxml index 62ca0fd..db39bfb 100644 --- a/pages/order/filterList/index2.wxml +++ b/pages/order/filterList/index2.wxml @@ -26,7 +26,13 @@ {{key}} - + + + {{pin.value}} + 重新分配 + + + {{lable.value}} @@ -54,7 +60,13 @@ {{key}} - {{value}} + + + {{value}} + 重新分配 + + + {{value}} @@ -80,4 +92,23 @@ + + + + + + + 销售顾问 + + 请选择 + {{staffArray[employeeIndex]}} + + + + + + + + + \ No newline at end of file diff --git a/pages/order/index.js b/pages/order/index.js index 8118357..877cc01 100644 --- a/pages/order/index.js +++ b/pages/order/index.js @@ -23,6 +23,11 @@ Page({ type:'', order_s_time:'',//开始时间 order_e_time:'',//结束时间 + + staffArray: [], + staffobj: [], + employeeIndex:-1,//分配销售索引 + employee_id:'',//分配销售ID }, onLoad: function (options) { for (let key in options) { @@ -31,6 +36,10 @@ Page({ }) } this.getAppCusorderV2Tabs() + + //销售顾问 + this.getAppUserAdmins() + }, //客户-tab @@ -218,6 +227,93 @@ Page({ }) }, + //获取销售顾问 + getAppUserAdmins(){ + let params = {}; + params['page'] = 1; + params['size'] = 1000; + _.apiQuery.getAppUserAdmins(params).then(res => { + let staffArray = [] + res.data.list.forEach(item => { + staffArray.push(item.uname) + }) + let bizArray = [] + res.data.bizs.forEach(item => { + bizArray.push(item.name) + }) + this.setData({ + staffArray:staffArray, + staffobj: res.data.list, + }) + }); + }, + + //显示分配订单 + showTransfer(e) { + this.setData({ + ids:[e.currentTarget.dataset.id], + isShowTransfer:true, + }) + }, + + //显示隐藏分配订单 + optTransfer(e) { + this.setData({ + employee_id:'', + employeeIndex:-1, + isShowTransfer:!this.data.isShowTransfer, + }) + }, + + //选择店员 + changeEmployee(e) { + let employee_id = '' + if(e.detail.value >= 0){ + employee_id = this.data.staffobj[e.detail.value].id + } + this.setData({ + employee_id, + employeeIndex:e.detail.value, + }) + }, + + //分配订单 + putAppCusorderV2Admins(){ + let that = this + if (that.data.employeeIndex == -1 ) { + wx.showToast({ + title: '请选择销售顾问', + icon: 'none' + }) + } + else{ + that.setData({ + submitFlag: true, + }) + let params = {}; + params['ids'] = that.data.ids; + params['admin_id'] = that.data.employee_id; + _.apiQuery.putAppCusorderV2Admins(params).then(res => { + + wx.showToast({ + title: '分配成功', + icon: 'success', + duration: 2000 + }) + that.setData({ + isShowTransfer:false, + submitFlag:false, + }) + that.onPullDownRefresh() + + }).catch(res=>{ + that.setData({ + submitFlag: false, + }) + }); + } + }, + //页面相关事件处理函数--监听用户下拉动作 onPullDownRefresh(){ this.setData({ diff --git a/pages/order/index.wxml b/pages/order/index.wxml index cfaeacb..b69e32c 100644 --- a/pages/order/index.wxml +++ b/pages/order/index.wxml @@ -70,7 +70,13 @@ {{key}} - + + + {{pin.value}} + 重新分配 + + + {{lable.value}} @@ -98,7 +104,13 @@ {{key}} - {{value}} + + + {{value}} + 重新分配 + + + {{value}} @@ -168,4 +180,23 @@ - \ No newline at end of file + + + + + + + 销售顾问 + + 请选择 + {{staffArray[employeeIndex]}} + + + + + + + + + + \ No newline at end of file