| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207 |
- const _Http = getApp().globalData.http;
- import {
- getTypes
- } from "./query";
- Component({
- options: {
- addGlobalClass: true,
- },
- properties: {
- update: {
- type: Function
- }
- },
- lifetimes: {
- attached: function () {
- getApp().globalData.Language.getLanguagePackage(this)
- this.data.organization = this.selectComponent("#organization");
- this.data.organization.initDepAndUser().then(active => {
- let userid = active.userid || wx.getStorageSync("userMsg").userid;
- this.setData({
- "content.dataid": userid,
- userid,
- })
- this.triggerEvent('update', "Client")
- });
- this.setFiltratelist();
- }
- },
- data: {
- list: [],
- filtratelist: [],
- total: null,
- searchShow: false,
- searchValue: "",
- showFiltrate: false,
- "content": {
- "pageNumber": 1,
- "pageSize": 20,
- "type": 0, // 1 按部门 0 按人员
- "dataid": 0, // 人员或部门数据id
- "where": {
- "condition": "",
- "tag": "",
- "status": "",
- "type": "",
- "tradingstatus": "",
- "begindate": "",
- "enddate": ""
- }
- }
- },
- methods: {
- async setFiltratelist() {
- let filtratelist = [{
- label: "医院类型",
- index: null,
- showName: "value", //显示字段
- valueKey: "type", //返回Key
- selectKey: "value", //传参 代表选着字段 不传参返回整个选择对象
- value: "", //选中值
- list: await getTypes('customertypemx')
- }, {
- label: "标签",
- index: null,
- type: "checkbox",
- showName: "tag", //显示字段
- valueKey: "tag", //返回Key
- selectKey: "tag", //传参 代表选着字段 不传参返回整个选择对象
- value: "", //选中值
- list: await getTypes('tags')
- }, {
- label: "合作状态",
- index: null,
- showName: "value", //显示字段
- valueKey: "status", //返回Key
- selectKey: "value", //传参 代表选着字段 不传参返回整个选择对象
- value: "", //选中值
- list: [{
- value: "潜在"
- }, {
- value: "合作中"
- }, {
- value: "已终止"
- }, {
- value: "暂缓"
- }]
- }, {
- label: "成交状态",
- index: null,
- showName: "value", //显示字段
- valueKey: "tradingstatus", //返回Key
- selectKey: "value", //传参 代表选着字段 不传参返回整个选择对象
- value: "", //选中值
- list: [{
- value: "未成交"
- }, {
- value: "已成交"
- }, {
- value: "多次成交"
- }]
- }]
- this.setData({
- filtratelist
- })
- },
- getList(init = false) {
- _Http.init(this.data.content, init).then(content => {
- _Http.basic({
- "id": 20230713132804,
- content
- }).then(res => {
- console.log("客户画像", res)
- this.selectComponent('#ListBox').automaticSetHei();
- this.selectComponent('#ListBox').RefreshToComplete();
- if (res.code != '1') return wx.showToast({
- title: res.data,
- icon: "none"
- })
- this.setData({
- list: res.pageNumber == 1 ? res.data : this.data.list.concat(res.data),
- "content.pageNumber": res.pageNumber + 1,
- "content.pageSize": res.pageSize,
- "content.pageTotal": res.pageTotal,
- "total": res.total,
- })
- })
- })
- },
- handleFilter({
- detail
- }) {
- if (!detail.name) return;
- let content = this.data.content,
- organization = this.data.organization;
- if (detail.name == "reset") {
- organization.setData({
- isleave: 1
- })
- organization.initDepAndUser()
- content.type = 0;
- content.dataid = this.data.userid;
- content.where = {
- "condition": content.where.condition || '',
- "type": "",
- "tag": "",
- "status": "",
- "tradingstatus": "",
- "begindate": "",
- "enddate": ""
- }
- } else if (detail.name == "confirm") {
- const res = organization.data.result
- content.type = res.sa_saleareaid ? 1 : 0;
- content.dataid = res.sa_saleareaid || res.userid;
- content.where = {
- "condition": content.where.condition || '',
- "type": detail.type || '',
- "tag": detail.tag || '',
- "status": detail.status || '',
- "tradingstatus": detail.tradingstatus || '',
- "begindate": detail.startdate || '',
- "enddate": detail.enddate || ''
- }
- }
- this.setData({
- content
- });
- this.getList(true);
- },
- changeSearchShow() {
- this.setData({
- searchShow: !this.data.searchShow
- })
- setTimeout(() => {
- this.selectComponent('#ListBox').automaticSetHei();
- if (this.data.searchShow) {
- if (this.selectComponent("#Yl_Filtrate1").data.show) return
- this.setData({
- focus: true
- })
- } else {
- this.setData({
- focus: false
- })
- }
- }, 350)
- },
- onSearch() {
- this.data.content.where.condition = this.data.searchValue;
- this.getList(true);
- },
- onChange(event) {
- this.setData({
- searchValue: event.detail
- })
- },
- onClear() {
- this.setData({
- searchValue: "",
- "content.where.condition": ""
- })
- this.getList(true);
- },
- }
- })
|