| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279 |
- const _Http = getApp().globalData.http;
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- loading: true,
- navList: [{
- label: "我负责的",
- icon: "icon-webxialaxuanxiangjiantou",
- color: "",
- width: "",
- id: "1"
- }, {
- label: "排序",
- icon: "icon-jiangxu1",
- color: "",
- width: "",
- id: "sort"
- }, {
- label: "筛选",
- icon: "icon-shaixuan",
- color: "",
- width: "",
- id: "2"
- }],
- classShow: false,
- "content": {
- "nocache": true,
- "isExport": 0,
- "pageNumber": 1,
- "pageTotal": 1,
- "pageSize": 20,
- "where": {
- "condition": "",
- "tablefilter": {},
- // "cluetype": "业务员",
- "allocationstatus": "", //分配状态
- "status": "", //跟进状态
- "tradefield": "", //领域
- "tag": [], //标签
- },
- },
- filtrate: false
- },
- onLoad(options) {
- this.setData({
- insert: wx.getStorageSync('auth').worderclue_admin.options.some(v => v == 'insert'), //查询新增权限
- classActions: wx.getStorageSync('templetList').map((v, i) => {
- return {
- name: v.templetname,
- index: v.templetid,
- color: i == 0 ? '#3874F6' : '',
- i: i,
- }
- }),
- 'navList[0].label': wx.getStorageSync('templetList')[0].templetname,
- "content.type": wx.getStorageSync('templetList')[0].templetid,
- });
- this.getList()
- this.getClueArea()
- },
- /* 获取列表 */
- getList(init = false) {
- if (init.detail != undefined) init = init.detail;
- let content = this.data.content;
- if (init) content.pageNumber = 1;
- if (content.pageNumber > content.pageTotal) return;
- _Http.basic({
- "id": 20221101094302,
- content
- }).then(res => {
- console.log("线索管理", res)
- this.selectComponent('#ListBox').RefreshToComplete();
- if (res.msg != '成功') return wx.showToast({
- title: res.msg,
- icon: "none"
- })
- this.setData({
- loading: false,
- 'content.pageNumber': res.pageNumber + 1,
- 'content.pageTotal': res.pageTotal,
- 'content.total': res.total,
- 'content.sort': res.sort,
- list: res.pageNumber == 1 ? res.data : this.data.list.concat(res.data)
- });
- this.setListHeight();
- this.getTags();
- })
- },
- /* 获取线索状态 */
- getClueArea() {
- let filtratelist = [{
- label: "分配状态",
- index: null,
- showName: "value", //显示字段
- valueKey: "allocationstatus", //返回Key
- selectKey: "value", //传参 代表选着字段 不传参返回整个选择对象
- value: "", //选中值
- list: [{
- value: "待分配"
- }, {
- value: "已分配"
- }]
- }];
- _Http.basic({
- "classname": "sysmanage.develop.optiontype.optiontype",
- "method": "optiontypeselect",
- "content": {
- "typename": 'clueprivate'
- }
- }).then(res => {
- console.log("线索范围", res)
- if (res.msg != '成功') return wx.showToast({
- title: res.data,
- icon: "none"
- })
- filtratelist.push({
- label: "线索状态",
- index: null,
- showName: "value", //显示字段
- valueKey: "status", //返回Key
- selectKey: "value", //传参 代表选着字段 不传参返回整个选择对象
- value: "", //选中值
- list: res.data
- })
- this.setData({
- filtratelist
- })
- this.setListHeight();
- })
- _Http.basic({
- "id": 20221223141802,
- "content": {
- "pageNumber": 1,
- "pageSize": 9999,
- "where": {
- "condition": ""
- }
- }
- }, false).then(res => {
- console.log("获取领域", res)
- if (res.msg == '成功') {
- filtratelist.push({
- label: "领域",
- index: null,
- showName: "tradefield", //显示字段
- valueKey: "tradefield", //返回Key
- selectKey: "tradefield", //传参 代表选着字段 不传参返回整个选择对象
- value: "", //选中值
- list: res.data
- })
- this.setData({
- filtratelist
- })
- }
- })
- _Http.basic({
- "id": 20221013104401,
- "content": {
- "nochace": true,
- "isExport": 1,
- "pageNumber": 1,
- sys_systemtagid: 14,
- "pageSize": 1000,
- "where": {
- "condition": ""
- }
- }
- }, false).then(res => {
- console.log("获取标签", res)
- if (res.msg == '成功') {
- filtratelist.push({
- label: "标签",
- index: null,
- type: "checkbox",
- showName: "tag", //显示字段
- valueKey: "tag", //返回Key
- selectKey: "tag", //传参 代表选着字段 不传参返回整个选择对象
- value: "", //选中值
- list: res.data
- })
- this.setData({
- filtratelist
- })
- }
- })
- },
- /* 处理搜索 */
- onSearch({
- detail
- }) {
- this.setData({
- "content.where.condition": detail
- });
- this.getList(true);
- },
- /* 获取列表标签 */
- getTags() {
- let list = this.data.list,
- ownerids = list.map(v => v.sat_orderclueid);
- _Http.basic({
- "id": 20221018102001,
- "content": {
- nocache: true,
- "ownertable": "sat_orderclue",
- ownerids
- }
- }).then(res => {
- console.log("标签", res)
- for (let key in res.data) {
- let index = list.findIndex(v => v.sat_orderclueid == key);
- list[index].tags = res.data[key]
- };
- this.setData({
- list
- })
- })
- },
- /* 去添加 */
- openType() {
- wx.navigateTo({
- url: '/packageA/saleAdmin/insert',
- })
- },
- onReady() {
- this.setListHeight();
- },
- setListHeight() {
- this.selectComponent("#ListBox").setHeight(".total", this);
- },
- /* 顶部条件导航回调 */
- navClick({
- detail
- }) {
- switch (detail.id) {
- case '1':
- this.setData({
- classShow: true
- })
- break;
- case '2':
- this.setData({
- filtrate: true
- })
- break;
- }
- },
- classClose() {
- this.setData({
- classShow: false
- })
- },
- classSelect({
- detail
- }) {
- if (this.data.content.type == detail.index) return this.classClose();
- this.setData({
- "content.type": detail.index,
- 'navList[0].label': detail.name,
- classActions: this.data.classActions.map(v => {
- v.color = detail.i == v.i ? '#3874F6' : ''
- return v
- })
- })
- this.classClose();
- this.getList(true)
- },
- /* 处理筛选 */
- handleFilter({
- detail
- }) {
- console.log(detail)
- detail.condition = this.data.content.where.condition;
- this.data.content.where = detail;
- this.getList(true)
- }
- })
|