customer-list.js 5.3 KB

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