/******************************************************************************* * Copyright(c) 2022 dongke All rights reserved. / Confidential * 类的信息: * 1.程序名称: * 编辑履历: * 作者 日期 版本 修改内容 * 于继渤 2024-1-23 1.00 客户档案新增 *******************************************************************************/ const Constants = require('@/utils/Constants.js'); const util = require('@/utils/util.js') const mixins = require('@/mixins/index.js') const app = getApp() Page({ mixins: [mixins], /** * 页面的初始数据 */ data: { tagList: [], // gradeCode: app.globalData.company.gradeCode, // 查询条件 searchContent: [], buttonSaveList: [{ code: 'add', title: mixins.$t('add') }], contentSaveList: [{ code: 'need', title: mixins.$t('together'), type: 'count', color: '#1B365D', tail: mixins.$t('customers'), bill: 1, fontSize: '15px' }], // 查询条件-筛选 pullMenuList: [ // { code: 'cusFrom', pullType: 'mSelect', typeName: 'cusFrom' }, { code: 'followCount', dataType: 'number' }, { code: 'nextFollowTime', dataType: 'date' } ], // 列表区(脚部信息) footerInfo: [{ // prefix: mixins.$t('followedUp'), name: 'followCount', // title: mixins.$t('next'), // different: mixins.$t('notFollowedUp'), color: 'red' },], // 列表区(内容) contentList: [ { name: 'cusPhone', title: mixins.$t('cusPhone'), phone: true }, { name: 'addressFull', title: mixins.$t('addressFull') }, { name: [{ name: 'orgName', title: '' }, { name: 'staffName', title: '' }], title: mixins.$t('storeInformation') }, { name: 'nextFollowTime', title: mixins.$t('nextFollowTime') } ], // 弹出按钮 buttonList: [ { name: 'followUp', title: mixins.$t('followUp') }, { name: 'followUpTasks', title: mixins.$t('followUpTasks') }, { name: 'collection', title: mixins.$t("cusCollection"), idKey: 'cusId' },//跳转客户收款 ], totallength: 0, //视图下方提醒数量 // 路由 routeObjName: 'customer', active: 0, saleStatus: mixins.$t('salePotentialCus'), }, /** * @desc : 切换 * @date : 2024/2/1 15:49 * @author : 于继渤 */ onChangeTabs(e) { let code = e.detail.detail.code this.setData({ saleStatus: code, }) this.searchData() }, /** * @desc : 详细页面 * @date : 2024/2/1 15:49 * @author : 于继渤 */ toDetail(e) { let cusId = e.detail.item.cusId this.setData({ selectflag: true }) wx.navigateTo({ url: this.data.route.detail.url, success: function (res) { // 通过eventChannel向被打开页面传送数据 TODO 测试例子url是写死的,实际中,需要从route中读取 res.eventChannel.emit('params', { id: cusId, formMode: Constants.formMode.edit }) } }) }, /** * @desc : 设置查询参数 * @date : 2024/2/1 15:49 * @author : 于继渤 */ setSearchParams(params) { //销售状态 if (this.data.gradeCode !== Constants.gradeCode.STD) { params.saleStatus = this.data.saleStatus == 'all' ? '' : this.data.saleStatus } return params }, /** * @desc : 处理接口返回数据 * @date : 2024/2/1 15:49 * @author : 于继渤 */ handleSearchData(tableData) { let contentSaveList = this.data.contentSaveList contentSaveList[0].bill = tableData.length tableData.forEach(res => { if(res.addressFull){ const addressNo = res.addressNo ? res.addressNo: '' res.addressFull = res.addressFull + addressNo } }) this.setData({ tableData: tableData, contentSaveList: contentSaveList }) }, /** * @desc : 查询 * @date : 2024/2/1 15:49 * @author : 于继渤 */ getData(params) { return this.excute(this.data.service, this.data.service.selectByCond, params); }, /** * @desc : 初始加载 * @date : 2024/7/5 15:49 * @author : 周兴 */ loadInit() { if (this.data.freeVersionFlag) { //标准 const menu = app.globalData.menus const selMenu = menu.filter(item => item.objectCode === "cus-follow") let buttonList = [ { name: 'collection', title: mixins.$t("cusCollection"), idKey: 'cusId' },//跳转客户收款 ] let searchContent = [] let tagList = [] if(selMenu.length > 0){ buttonList = [ { name: 'followUp', title: mixins.$t('followUp') }, { name: 'followUpTasks', title: mixins.$t('followUpTasks') }, { name: 'collection', title: mixins.$t("cusCollection"), idKey: 'cusId' },//跳转客户收款 ] searchContent = [ { code: 'createtime', title: mixins.$t('pastThirthtyDays'), defaultValue: 5, searchType: Constants.searchType.date }, { code: 'staff', title: mixins.$t("staffId"), dropType: 'staff' }, { code: 'org', title: mixins.$t("orgId"), dropType: 'org' }, { code: 'choose', title: mixins.$t('choose'), searchType: Constants.searchType.pick } ] tagList = [{ title: mixins.$t('potentialCus'), code: mixins.$t('salePotentialCus') }, { title: mixins.$t('seasCus'), code: mixins.$t('saleSeasCus') }, { title: mixins.$t('dealCus'), code: mixins.$t('saleDealCus') }, { title: mixins.$t('allCus'), code: 'all' }] } this.setData({ buttonList: buttonList, searchContent: searchContent, tagList: tagList, // 列表区(内容) contentList: [ { name: 'cusPhone', title: mixins.$t('cusPhone'), phone: true }, { name: 'addressFull', title: mixins.$t('addressFull') }, { name: [{ name: 'orgName', title: '' }, { name: 'staffName', title: '' }], title: mixins.$t('storeInformation') }, ], footerInfo: [{ prefix: selMenu.length > 0 ? mixins.$t('followedUp'): '', name: selMenu.length > 0 ? 'followCount': '', title: selMenu.length > 0 ? mixins.$t('next'): '', different: selMenu.length > 0 ? mixins.$t('notFollowedUp'): '', color: 'red' },] }) } else { //专业 this.setData({ buttonList: [ { name: 'followUp', title: mixins.$t('followUp') }, { name: 'followUpTasks', title: mixins.$t('followUpTasks') }, { name: 'collection', title: mixins.$t("cusCollection"), idKey: 'cusId' },//跳转收款单 toReceipt ], tagList: [{ title: mixins.$t('potentialCus'), code: mixins.$t('salePotentialCus') }, { title: mixins.$t('seasCus'), code: mixins.$t('saleSeasCus') }, { title: mixins.$t('dealCus'), code: mixins.$t('saleDealCus') }, { title: mixins.$t('allCus'), code: 'all' }], // 列表区(内容) contentList: [ { name: 'cusPhone', title: mixins.$t('cusPhone'), phone: true }, { name: 'addressFull', title: mixins.$t('addressFull') }, { name: [{ name: 'orgName', title: '' }, { name: 'staffName', title: '' }], title: mixins.$t('storeInformation') }, { name: 'nextFollowTime', title: mixins.$t('nextFollowTime') } ], footerInfo: [{ prefix: mixins.$t('followedUp'), name: 'followCount', title: mixins.$t('next'), different: mixins.$t('notFollowedUp'), color: 'red' },], searchContent: [ { code: 'createtime', title: mixins.$t('pastThirthtyDays'), defaultValue: 5, searchType: Constants.searchType.date }, { code: 'staff', title: mixins.$t("staffId"), dropType: 'staff' }, { code: 'org', title: mixins.$t("orgId"), dropType: 'org' }, { code: 'choose', title: mixins.$t('choose'), searchType: Constants.searchType.pick } ], }) } }, /** * 生命周期函数--监听页面显示 */ onShow: function () { if (this.data.refreshDataFlag) { this.searchData() } }, })