customer-list.js 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171
  1. /*******************************************************************************
  2. * Copyright(c) 2022 dongke All rights reserved. / Confidential
  3. * 类的信息:
  4. * 1.程序名称:
  5. * 编辑履历:
  6. * 作者 日期 版本 修改内容
  7. * 于继渤 2024-1-23 1.00 客户档案新增
  8. *******************************************************************************/
  9. const Constants = require('@/utils/Constants.js');
  10. const util = require('@/utils/util.js')
  11. const mixins = require('@/mixins/index.js')
  12. const app = getApp()
  13. Page({
  14. mixins: [mixins],
  15. /**
  16. * 页面的初始数据
  17. */
  18. data: {
  19. 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' }],
  20. gradeCode: app.globalData.company.gradeCode,
  21. // 查询条件
  22. searchContent: [
  23. { code: 'createtime', title: mixins.$t('pastThirthtyDays'), defaultValue: 5, searchType: Constants.searchType.date },
  24. { code: 'staff', title: mixins.$t("staffId"), dropType: 'staff' },
  25. { code: 'org', title: mixins.$t("orgId"), dropType: 'org' },
  26. { code: 'choose', title: mixins.$t('choose'), searchType: Constants.searchType.pick }
  27. ],
  28. buttonSaveList: [{ code: 'add', title: mixins.$t('add') }],
  29. contentSaveList: [{ code: 'need', title: mixins.$t('together'), type: 'count', color: '#1B365D', tail: mixins.$t('customers'), bill: 1, fontSize: '15px' }],
  30. // 查询条件-筛选
  31. pullMenuList: [
  32. { code: 'cusFrom', pullType: 'mSelect', typeName: 'cusFrom' },
  33. { code: 'followCount', dataType: 'number' },
  34. { code: 'nextFollowTime', dataType: 'date' }
  35. ],
  36. // 列表区(脚部信息)
  37. footerInfo: [{
  38. prefix: mixins.$t('followedUp'),
  39. name: 'followCount',
  40. title: mixins.$t('next'),
  41. different: mixins.$t('notFollowedUp'),
  42. color: 'red'
  43. },],
  44. // 列表区(内容)
  45. contentList: [
  46. { name: 'cusPhone', title: mixins.$t('cusPhone'), phone: true },
  47. { name: 'addressFull', title: mixins.$t('addressFull') },
  48. {
  49. name: [{ name: 'orgName', title: '' },
  50. { name: 'staffName', title: '' }], title: mixins.$t('storeInformation')
  51. },
  52. { name: 'nextFollowTime', title: mixins.$t('nextFollowTime') }
  53. ],
  54. // 弹出按钮
  55. buttonList: [
  56. { name: 'followUp', title: mixins.$t('followUp') },
  57. { name: 'followUpTasks', title: mixins.$t('followUpTasks') },
  58. { name: 'collection', title: mixins.$t("cusCollection"), idKey: 'cusId' },//跳转客户收款
  59. ],
  60. totallength: 0, //视图下方提醒数量
  61. // 路由
  62. routeObjName: 'customer',
  63. active: 0,
  64. saleStatus: mixins.$t('salePotentialCus'),
  65. },
  66. /**
  67. * @desc : 切换
  68. * @date : 2024/2/1 15:49
  69. * @author : 于继渤
  70. */
  71. onChangeTabs(e) {
  72. let code = e.detail.detail.code
  73. this.setData({
  74. saleStatus: code,
  75. })
  76. this.searchData()
  77. },
  78. /**
  79. * @desc : 详细页面
  80. * @date : 2024/2/1 15:49
  81. * @author : 于继渤
  82. */
  83. toDetail(e) {
  84. let cusId = e.detail.item.cusId
  85. this.setData({
  86. selectflag: true
  87. })
  88. wx.navigateTo({
  89. url: this.data.route.detail.url,
  90. success: function (res) {
  91. // 通过eventChannel向被打开页面传送数据 TODO 测试例子url是写死的,实际中,需要从route中读取
  92. res.eventChannel.emit('params', { id: cusId, formMode: Constants.formMode.edit })
  93. }
  94. })
  95. },
  96. /**
  97. * @desc : 设置查询参数
  98. * @date : 2024/2/1 15:49
  99. * @author : 于继渤
  100. */
  101. setSearchParams(params) {
  102. //销售状态
  103. if (this.data.gradeCode !== Constants.gradeCode.STD) {
  104. params.saleStatus = this.data.saleStatus == 'all' ? '' : this.data.saleStatus
  105. }
  106. return params
  107. },
  108. /**
  109. * @desc : 处理接口返回数据
  110. * @date : 2024/2/1 15:49
  111. * @author : 于继渤
  112. */
  113. handleSearchData(tableData) {
  114. let contentSaveList = this.data.contentSaveList
  115. contentSaveList[0].bill = tableData.length
  116. this.setData({
  117. contentSaveList: contentSaveList
  118. })
  119. },
  120. /**
  121. * @desc : 查询
  122. * @date : 2024/2/1 15:49
  123. * @author : 于继渤
  124. */
  125. getData(params) {
  126. return this.excute(this.data.service, this.data.service.selectByCond, params);
  127. },
  128. /**
  129. * 生命周期函数--监听页面加载
  130. */
  131. onLoad: function (options) {
  132. if (app.globalData.company.gradeCode == Constants.gradeCode.STD) { //标准
  133. this.setData({
  134. buttonList: [
  135. { name: 'followUp', title: mixins.$t('followUp') },
  136. { name: 'followUpTasks', title: mixins.$t('followUpTasks') },
  137. { name: 'collection', title: mixins.$t("cusCollection"), idKey: 'cusId' },//跳转客户收款
  138. ],
  139. })
  140. }
  141. if (app.globalData.company.gradeCode == Constants.gradeCode.PRO) { //专业
  142. this.setData({
  143. buttonList: [
  144. { name: 'followUp', title: mixins.$t('followUp') },
  145. { name: 'followUpTasks', title: mixins.$t('followUpTasks') },
  146. { name: 'toReceipt', title: mixins.$t("cusCollection"), idKey: 'cusId' },//跳转收款单
  147. ],
  148. })
  149. }
  150. },
  151. /**
  152. * 生命周期函数--监听页面显示
  153. */
  154. onShow: function () {
  155. if (this.data.refreshDataFlag) {
  156. this.searchData()
  157. }
  158. },
  159. })