123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230 |
- const app=getApp(),utils=require("../../../utils/http");
- let page=1;
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- type:0,//0是已分配信息,1是手动分配
- cid:'',//
- resourceobj:{},
- customerlist:[],
- result: [],
- rlist:[],
- pooltype:1,//
- radio:'',
- weburl:''
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function (options) {
- this.setData({
- cid:options.rid,
- type:options.type
- })
- if(options.type==0){
- this.poolmsg();
- }else{
- this.customerfun();
- }
- this.setData({
- weburl:app.globalData.webUrl + 'applet.html#/resourcepool?orgid='+app.globalData.personMsg.binded.org_id+'&type='+this.data.type+'&cid='+this.data.cid+'&token=' + app.globalData.token + '&client_type=' + app.globalData.clientype,
- })
- },
- poolmsg:function(){
- const that=this;
- utils.$post({
- url: app.globalData.webUrl + 'api/crm_customer/cil_detail',
- header: {
- 'Authorization':'bearer '+app.globalData.token
- },
- data:{
- cilid:that.data.cid
- },
- success: function (res) {
- if(res.data.code=='0'){
- that.setData({
- resourceobj:res.data.data,
- })
- }
- }
- })
- },
- customerfun:function(){
- const that=this;
- page=1;
- utils.$post({
- url: app.globalData.webUrl + 'api/crm_customer/resourcepool',
- header: {
- 'Authorization':'bearer '+app.globalData.token
- },
- data:{
- cilid:that.data.cid,
- page:page,
- limit:15,
- },
- success: function (res) {
- if(res.data.code=='0'){
- that.setData({
- customerlist:res.data.data,
- })
- }
- }
- })
- },
- resoucredata:function(){
- const that=this;
- utils.$post({
- url: app.globalData.webUrl + "api/crm_customer/employee4resource",
- header: {
- 'Authorization':'bearer '+app.globalData.token
- },
- data:{
- org:app.globalData.personMsg.binded.org_id
- },
- success: function (res) {
- if(res.data.code=='0'){
- that.setData({
- customerlist:res.data.data
- })
- }
- }
- })
- },
- onChange(event) {
- this.setData({
- result: event.detail,
- });
- },
- onChanget(event) {
- this.setData({
- radio: event.detail,
- });
- },
- onClick(event) {
- const { name } = event.currentTarget.dataset;
- this.setData({
- radio: name,
- });
- },
- toggle(event) {
- const { index } = event.currentTarget.dataset;
- const checkbox = this.selectComponent(`.checkboxes-${index}`);
- checkbox.toggle();
- },
- selectap:function(e){
- this.setData({
- pooltype:e.currentTarget.dataset.type
- })
- if(e.currentTarget.dataset.type==2){
- this.resoucredata();
- }else{
- this.customerfun();
- }
- },
- noop() {},
- surebatchtap:function(){
- const that=this;
- wx.showModal({
- title: '分配提示',
- content: '您确定分配吗?',
- success (res) {
- if (res.confirm) {
- wx.showLoading({
- title: '分配中...',
- })
- utils.$post({
- url: app.globalData.webUrl + "api/crm_customer/resdistributing",
- header: {
- 'Authorization':'bearer '+app.globalData.token
- },
- data:{
- org_pool:'',
- emp_id:that.data.radio,
- cilid:that.data.cid,
- type:'toemp',
- targets:that.data.result.join(',')
- },
- success: function (res) {
- wx.hideLoading()
- if(res.data.code=='0'){
- wx.showToast({
- title: res.data.msg,
- icon: "none",
- duration: 2000
- });
- setTimeout(function(){
- wx.navigateBack()
- },2000)
-
-
- }else{
- wx.showToast({
- title: res.data.msg,
- icon: "none",
- duration: 2000
- });
- }
- }
- })
- }else{
- that.setData({
- batchflag:false,
- nowresourceid:'',
- result: [],
- })
- }
- }
- })
-
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady: function () {
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: function () {
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide: function () {
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload: function () {
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh: function () {
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom: function () {
- },
- /**
- * 用户点击右上角分享
- */
- })
|