diff --git a/pages/customer/index.js b/pages/customer/index.js index 7451b1c..5969fab 100644 --- a/pages/customer/index.js +++ b/pages/customer/index.js @@ -352,7 +352,7 @@ Page({ } }, - //客户顶级 + //客户等级 changeLevel(e){ let level = '' diff --git a/pages/order/index.js b/pages/order/index.js index 86dfe47..193b6b4 100644 --- a/pages/order/index.js +++ b/pages/order/index.js @@ -7,62 +7,17 @@ Page({ value: '', focus: false, }, - sourcetabindex: -1, - a_id: '', - c_time:'', - u_id:'', - r_time: '', + key:'',//tab状态值 + list: [],//客户列表 pageNo: 1, noData: false, end: false, load: true, loading: false, - flag: 0, - tab_list: [], - tag_list: [], - activityList: [], - isShowScreen:false, - isShowDropDown:false, - form:'', - isRefresh:false, - status_pid:-2, - status_id:'', - tag_id:'', - user_list: [], - objUser_list: [], - userindex:-1, - serviceindex: -1, - - isShowMessage:false, - isShowSort:false, - isClickSort:false, - timeSlot:[ - { - title:'今天', - }, - { - title:'昨天', - }, - { - title:'近七天', - }, - { - title:'近三十天', - }, - ], - testDriveIndex:0, - testDrive:[ - { - title:'全部', - }, - { - title:'是', - }, - { - title:'否', - }, - ], - timeSlotIndex:0, + flag:1, + isShowMessage:false,//是否显示短信弹窗 + content:'',//短信内容 + isRefresh:false,//判断返回是否需要刷新 }, onLoad: function (options) { for (let key in options) { @@ -70,22 +25,73 @@ Page({ [key]: options[key] }) } - this.getCustomerTab() + this.getAppCustomersTabs() + }, + + //客户-tab + getAppCustomersTabs() { + _.apiQuery.getAppCustomersTabs().then(res => { + this.setData({ + tab:res.data, + key:this.data.key==''?res.data[0].key:this.data.key, + }) + + this.getAppCustomers() + + wx.stopPullDownRefresh() + }); }, //切换tab changeTab(e){ this.setData({ - status_pid: this.data.tab[e.currentTarget.dataset.index].id, + key: this.data.tab[e.currentTarget.dataset.index].key, }) this.searchSubmit() }, + //获取客户列表 + getAppCustomers() { + this.setData({ + load: false, + loading: true, + }) + let params = {}; + params['page'] = this.data.pageNo; + params['size'] = 10; + params['status'] = this.data.key; + if(this.data.searchInp.value != ''){ + params['keyword'] = this.data.searchInp.value; + } + _.apiQuery.getAppCustomers(params).then(res => { + this.setData({ + flag: this.data.flag - 1 + }) + if (!this.data.flag) { + this.setData({ + pageNo: this.data.pageNo + 1, + list: this.data.list.concat(res.data.list), + load: true, + loading: false, + }) + if (res.data.total == 0) { + this.setData({ + noData: true + }) + } else if (this.data.list.length == res.data.total) { + this.setData({ + end: true + }) + } + } + wx.stopPullDownRefresh() + }); + }, + //拨打客户电话Yx call(e) { let params = {}; params['id'] = e.currentTarget.dataset.id; - params['type'] = e.currentTarget.dataset.type; _.apiQuery.getAppYx(params).then(res=>{ if(!!res.data.service_msg){ this.setData({ @@ -99,22 +105,22 @@ Page({ } }) }, - //拨打客户电话Xz - callXz(e) { - let params = {}; - params['id'] = e.currentTarget.dataset.id; - params['type'] = e.currentTarget.dataset.type; - _.apiQuery.getAppXz(params).then(res=>{ - if(!!res.data.service_msg){ - this.setData({ - isShowNote:true, - notemsg:res.data.service_msg, - }) - }else{ - wx.makePhoneCall({ - phoneNumber: res.data.mobile, - }) - } + + // 输入 + searchInput(e){ + this.setData({ + 'searchInp.value': e.detail.value + }) + }, + searchFocus(){ + this.setData({ + 'searchInp.focus': true, + }) + }, + + searchBlur() { + this.setData({ + 'searchInp.focus': false, }) }, @@ -129,201 +135,7 @@ Page({ loading: false, flag: this.data.flag + 1 }) - this.getAppCustomer() - }, - - //客多宝-tab - getCustomerTab() { - let params = {}; - params['biz_id'] = !!this.data.bizid?this.data.bizid:'0'; - _.apiQuery.getCustomerTab(params).then(res => { - this.setData({ - tab_list:res.data.tab_list, - tag_list:res.data.tag_list, - }) - - if(!!this.data.type){ - let tab_list = res.data.tab_list - tab_list.forEach((item, index)=>{ - if(item.value == this.data.type){ - this.setData({ - sourcetabindex:index, - }) - } - }); - }else{ - this.setData({ - type:res.data.tab_list[0].value, - sourcetabindex:0, - }) - } - - this.getCustomerStatus() - - if(this.data.sourcetabindex>-1&&this.data.tab_list[this.data.sourcetabindex].value==2){ - this.getAppSytactivity() - } - - wx.stopPullDownRefresh() - }); - }, - - //活动列表 - getAppSytactivity() { - let params = {}; - params['page'] = 1; - params['size'] = 50; - params['type'] = 0; - if(!!this.data.bizid){ - params['biz_id'] = this.data.bizid; - } - _.apiQuery.getAppSytactivity(params).then(res => { - this.setData({ - activityList: res.data.list, - }) - }); - }, - - //客多宝列表 - getAppCustomer() { - this.setData({ - load: false, - loading: true, - }) - let params = {}; - if(this.data.isRefresh){ - params['page'] = 1; - params['size'] = (this.data.pageNo - 1)*10; - }else{ - params['page'] = this.data.pageNo; - params['size'] = 10; - } - params['biz_id'] = !!this.data.bizid?this.data.bizid:'0'; - - params['type'] = this.data.type; - if(this.data.searchInp.value != ''){ - params['keyword'] = this.data.searchInp.value; - } - if(this.data.a_id != ''){ - params['a_id'] = this.data.a_id; - } - if(this.data.c_time != ''){ - params['c_time'] = this.data.c_time; - } - if(this.data.u_id != ''){ - params['ubid'] = this.data.u_id; - } - if(this.data.r_time != ''){ - params['r_time'] = this.data.r_time; - } - if(this.data.status_pid != -2){ - params['status_pid'] = this.data.status_pid; - } - if(this.data.status_id != ''){ - params['status_id'] = this.data.status_id; - } - if(this.data.tag_id != ''){ - params['tag_id'] = this.data.tag_id; - } - _.apiQuery.getAppCustomer(params).then(res => { - console.log(res) - this.setData({ - flag: this.data.flag - 1 - }) - if (!this.data.flag) { - if(this.data.isRefresh){ - this.setData({ - total: res.data.total, - list: res.data.list, - load: true, - loading: false, - isRefresh: false, - }) - }else{ - this.setData({ - total: res.data.total, - pageNo: this.data.pageNo + 1, - list: this.data.list.concat(res.data.list), - load: true, - loading: false, - }) - } - if (res.data.total == 0) { - this.setData({ - noData: true - }) - } else if (this.data.list.length == res.data.total) { - this.setData({ - end: true - }) - } - } - wx.stopPullDownRefresh() - }); - }, - bindEndDateChange: function(e) { - this.setData({ - r_time: e.detail.value - }) - this.searchSubmit() - }, - - //状态tab - getCustomerStatus(){ - let params = {}; - params['type'] = this.data.type; - _.apiQuery.getCustomerStatus(params).then(res=>{ - - this.setData({ - if_ub:res.data.rolevel, - tab:res.data.list, - status_pid: this.data.status_pid == -2?res.data.list[0].id:this.data.status_pid - }) - - this.searchSubmit() - }) - }, - - //选择标签 - changeTag(e){ - this.setData({ - tag_id: e.currentTarget.dataset.id, - }) - this.searchSubmit() - }, - - bindUserPicker(e) { - this.setData({ - userindex: e.detail.value - }) - }, - - //隐藏高级搜索 - hidesearch() { - this.setData({ - isShowSort: false - }) - }, - - //显示高级搜索 - showSort(){ - this.setData({ - isClickSort: true, - isShowSort: !this.data.isShowSort - }) - }, - - //单选 - radioPicker(e){ - if(e.currentTarget.dataset.type == 'timeSlot'){ - this.setData({ - timeSlotIndex:e.currentTarget.dataset.index, - }) - } else if(e.currentTarget.dataset.type == 'testDrive'){ - this.setData({ - testDriveIndex:e.currentTarget.dataset.index, - }) - } + this.getAppCustomers() }, //显示短信弹框 @@ -331,6 +143,7 @@ Page({ this.setData({ messageId:e.currentTarget.dataset.id, isShowMessage:true, + content:'', }) }, @@ -341,6 +154,43 @@ Page({ }) }, + //输入 + inputTx(e) { + this.setData({ + submitFlag: false, + [e.currentTarget.dataset.key]: e.detail.value + }) + }, + + //发短信 + postAppSmsCustomer(){ + if (this.data.submitFlag) return; + if (this.data.content == '') { + wx.showToast({ + title: '请填写短信内容', + icon: 'none' + }) + } else { + this.setData({ + submitFlag: true, + }) + let params = {}; + params['id'] = this.data.messageId; + params['content'] = this.data.content; + _.apiQuery.postAppSmsCustomer(params).then(res=>{ + this.setData({ + isShowMessage:false, + submitFlag:false, + content:'', + }) + wx.showToast({ + title: res.msg, + icon: 'none' + }) + }) + } + }, + //推送链接 pushLink(e){ if(e.currentTarget.dataset.url){ @@ -349,7 +199,7 @@ Page({ }, //页面相关事件处理函数--监听用户下拉动作 - onPullDownRefresh: function () { + onPullDownRefresh(){ this.setData({ list: [], pageNo: 1, @@ -359,16 +209,16 @@ Page({ loading: false, flag: this.data.flag + 1 }) - this.getAppCustomer() + this.getAppCustomers() }, //页面上拉触底事件的处理函数 - onReachBottom: function () { + onReachBottom(){ if (this.data.noData || this.data.end||!this.data.load) return; this.setData({ flag: this.data.flag + 1 }) - this.getAppCustomer() + this.getAppCustomers() }, }) \ No newline at end of file diff --git a/pages/order/index.wxml b/pages/order/index.wxml index a664615..dc8f632 100644 --- a/pages/order/index.wxml +++ b/pages/order/index.wxml @@ -3,17 +3,17 @@ - + - - {{item.title}} + + {{item.name}} - - {{item.title}} + + {{item.name}} @@ -31,44 +31,37 @@ - + - {{item.cust_name}} - (*382) + {{item.name}} + ({{item.mobile}}) - 合同签订 + + {{tag}} + + + ... + - + - - 品牌车型 - 东风EX1 - - - 付款方式 - 东风EX1 - - - 代办车牌 - 东风EX1 - - - 定金金额 - 东风EX1 - - - 订单日期 - 东风EX1 - + + + + {{key}} + {{value}} + + +