customer-list.js 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215
  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. 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. contentList: [
  141. { name: 'cusPhone', title: mixins.$t('cusPhone'), phone: true },
  142. { name: 'addressFull', title: mixins.$t('addressFull') },
  143. {
  144. name: [{ name: 'orgName', title: '' },
  145. { name: 'staffName', title: '' }], title: mixins.$t('storeInformation')
  146. },
  147. ],
  148. footerInfo: [{
  149. // prefix: mixins.$t('followedUp'),
  150. name: 'followCount',
  151. // title: mixins.$t('next'),
  152. // different: mixins.$t('notFollowedUp'),
  153. color: 'red'
  154. },],
  155. searchContent: [
  156. { code: 'createtime', title: mixins.$t('pastThirthtyDays'), defaultValue: 5, searchType: Constants.searchType.date },
  157. { code: 'staff', title: mixins.$t("staffId"), dropType: 'staff' },
  158. { code: 'org', title: mixins.$t("orgId"), dropType: 'org' },
  159. // { code: 'choose', title: mixins.$t('choose'), searchType: Constants.searchType.pick }
  160. ],
  161. })
  162. }
  163. if (app.globalData.company.gradeCode == Constants.gradeCode.PRO) { //专业
  164. this.setData({
  165. buttonList: [
  166. { name: 'followUp', title: mixins.$t('followUp') },
  167. { name: 'followUpTasks', title: mixins.$t('followUpTasks') },
  168. { name: 'toReceipt', title: mixins.$t("cusCollection"), idKey: 'cusId' },//跳转收款单
  169. ],
  170. // 列表区(内容)
  171. contentList: [
  172. { name: 'cusPhone', title: mixins.$t('cusPhone'), phone: true },
  173. { name: 'addressFull', title: mixins.$t('addressFull') },
  174. {
  175. name: [{ name: 'orgName', title: '' },
  176. { name: 'staffName', title: '' }], title: mixins.$t('storeInformation')
  177. },
  178. { name: 'nextFollowTime', title: mixins.$t('nextFollowTime') }
  179. ],
  180. footerInfo: [{
  181. prefix: mixins.$t('followedUp'),
  182. name: 'followCount',
  183. title: mixins.$t('next'),
  184. different: mixins.$t('notFollowedUp'),
  185. color: 'red'
  186. },],
  187. searchContent: [
  188. { code: 'createtime', title: mixins.$t('pastThirthtyDays'), defaultValue: 5, searchType: Constants.searchType.date },
  189. { code: 'staff', title: mixins.$t("staffId"), dropType: 'staff' },
  190. { code: 'org', title: mixins.$t("orgId"), dropType: 'org' },
  191. { code: 'choose', title: mixins.$t('choose'), searchType: Constants.searchType.pick }
  192. ],
  193. })
  194. }
  195. },
  196. /**
  197. * 生命周期函数--监听页面显示
  198. */
  199. onShow: function () {
  200. if (this.data.refreshDataFlag) {
  201. this.searchData()
  202. }
  203. },
  204. })