customer-list.js 8.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234
  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. tableData.forEach(res => {
  112. if(res.addressFull){
  113. const addressNo = res.addressNo ? res.addressNo: ''
  114. res.addressFull = res.addressFull + addressNo
  115. }
  116. })
  117. this.setData({
  118. tableData: tableData,
  119. contentSaveList: contentSaveList
  120. })
  121. },
  122. /**
  123. * @desc : 查询
  124. * @date : 2024/2/1 15:49
  125. * @author : 于继渤
  126. */
  127. getData(params) {
  128. return this.excute(this.data.service, this.data.service.selectByCond, params);
  129. },
  130. /**
  131. * @desc : 初始加载
  132. * @date : 2024/7/5 15:49
  133. * @author : 周兴
  134. */
  135. loadInit() {
  136. if (this.data.freeVersionFlag) { //标准
  137. const menu = app.globalData.menus
  138. const selMenu = menu.filter(item => item.objectCode === "cus-follow")
  139. let buttonList = [
  140. { name: 'collection', title: mixins.$t("cusCollection"), idKey: 'cusId' },//跳转客户收款
  141. ]
  142. let searchContent = []
  143. let tagList = []
  144. if(selMenu.length > 0){
  145. buttonList = [
  146. { name: 'followUp', title: mixins.$t('followUp') },
  147. { name: 'followUpTasks', title: mixins.$t('followUpTasks') },
  148. { name: 'collection', title: mixins.$t("cusCollection"), idKey: 'cusId' },//跳转客户收款
  149. ]
  150. searchContent = [
  151. { code: 'createtime', title: mixins.$t('pastThirthtyDays'), defaultValue: 5, searchType: Constants.searchType.date },
  152. { code: 'staff', title: mixins.$t("staffId"), dropType: 'staff' },
  153. { code: 'org', title: mixins.$t("orgId"), dropType: 'org' },
  154. { code: 'choose', title: mixins.$t('choose'), searchType: Constants.searchType.pick }
  155. ]
  156. tagList = [{ title: mixins.$t('potentialCus'), code: mixins.$t('salePotentialCus') },
  157. { title: mixins.$t('seasCus'), code: mixins.$t('saleSeasCus') },
  158. { title: mixins.$t('dealCus'), code: mixins.$t('saleDealCus') },
  159. { title: mixins.$t('allCus'), code: 'all' }]
  160. }
  161. this.setData({
  162. buttonList: buttonList,
  163. searchContent: searchContent,
  164. tagList: tagList,
  165. // 列表区(内容)
  166. contentList: [
  167. { name: 'cusPhone', title: mixins.$t('cusPhone'), phone: true },
  168. { name: 'addressFull', title: mixins.$t('addressFull') },
  169. {
  170. name: [{ name: 'orgName', title: '' },
  171. { name: 'staffName', title: '' }], title: mixins.$t('storeInformation')
  172. },
  173. ],
  174. footerInfo: [{
  175. prefix: selMenu.length > 0 ? mixins.$t('followedUp'): '',
  176. name: selMenu.length > 0 ? 'followCount': '',
  177. title: selMenu.length > 0 ? mixins.$t('next'): '',
  178. different: selMenu.length > 0 ? mixins.$t('notFollowedUp'): '',
  179. color: 'red'
  180. },]
  181. })
  182. } else { //专业
  183. this.setData({
  184. buttonList: [
  185. { name: 'followUp', title: mixins.$t('followUp') },
  186. { name: 'followUpTasks', title: mixins.$t('followUpTasks') },
  187. { name: 'collection', title: mixins.$t("cusCollection"), idKey: 'cusId' },//跳转收款单 toReceipt
  188. ],
  189. tagList: [{ title: mixins.$t('potentialCus'), code: mixins.$t('salePotentialCus') },
  190. { title: mixins.$t('seasCus'), code: mixins.$t('saleSeasCus') },
  191. { title: mixins.$t('dealCus'), code: mixins.$t('saleDealCus') },
  192. { title: mixins.$t('allCus'), code: 'all' }],
  193. // 列表区(内容)
  194. contentList: [
  195. { name: 'cusPhone', title: mixins.$t('cusPhone'), phone: true },
  196. { name: 'addressFull', title: mixins.$t('addressFull') },
  197. {
  198. name: [{ name: 'orgName', title: '' },
  199. { name: 'staffName', title: '' }], title: mixins.$t('storeInformation')
  200. },
  201. { name: 'nextFollowTime', title: mixins.$t('nextFollowTime') }
  202. ],
  203. footerInfo: [{
  204. prefix: mixins.$t('followedUp'),
  205. name: 'followCount',
  206. title: mixins.$t('next'),
  207. different: mixins.$t('notFollowedUp'),
  208. color: 'red'
  209. },],
  210. searchContent: [
  211. { code: 'createtime', title: mixins.$t('pastThirthtyDays'), defaultValue: 5, searchType: Constants.searchType.date },
  212. { code: 'staff', title: mixins.$t("staffId"), dropType: 'staff' },
  213. { code: 'org', title: mixins.$t("orgId"), dropType: 'org' },
  214. { code: 'choose', title: mixins.$t('choose'), searchType: Constants.searchType.pick }
  215. ],
  216. })
  217. }
  218. },
  219. /**
  220. * 生命周期函数--监听页面显示
  221. */
  222. onShow: function () {
  223. if (this.data.refreshDataFlag) {
  224. this.searchData()
  225. }
  226. },
  227. })