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