customer-list.js 7.2 KB

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