customer-reception.js 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  1. /*******************************************************************************
  2. * Copyright(c) 2022 dongke All rights reserved. / Confidential
  3. * 类的信息:
  4. * 1.程序名称:
  5. * 2.新增接待
  6. * 编辑履历:
  7. * 作者 日期 版本 修改内容
  8. * yjb 2022-0-12 1.00
  9. *******************************************************************************/
  10. const Constants = require('@/utils/Constants.js');
  11. const util = require('@/utils/util.js')
  12. const mixins = require('@/mixins/index.js')
  13. const app = getApp()
  14. Page({
  15. mixins: [mixins],
  16. /**
  17. * 页面的初始数据
  18. */
  19. data: {
  20. tagList: [{ title: mixins.$t('allReceptions'), code: 'all' }, { title: mixins.$t('followUpTasks'), code: mixins.$t('followStatusFollowUp') }, { title: mixins.$t('followStatusInvitationName'), code: mixins.$t('followStatusInvitation') }, { title: mixins.$t('followStatusFootName'), code: mixins.$t('followStatusFoot') }],
  21. buttonSaveList: [{ code: 'add', title: mixins.$t('add')}],
  22. contentSaveList: [{ code: 'need', title: mixins.$t('together'), type: 'count', color: '#1B365D', tail: mixins.$t('receptionInformation'), bill: 1, fontSize: '15px' }],
  23. // 查询条件
  24. searchContent: [
  25. { code: 'createtime', title: mixins.$t('pastThirthtyDays'), defaultValue: 5, searchType: Constants.searchType.date },
  26. { code: 'staff', title: mixins.$t('staffId'), dropType: 'staff' },
  27. { code: 'choose', title: mixins.$t('choose'), searchType: Constants.searchType.pick }
  28. ],
  29. // 查询条件-筛选
  30. pullMenuList: [
  31. { code: 'followStatus', pullType: 'mSelect', typeName: 'followStatus' },
  32. { code: 'followCount', dataType: 'number' },
  33. { code: 'nextFollowTime', dataType: 'date' }
  34. ],
  35. // 列表区(内容)
  36. contentList: [
  37. { name: 'cusPhone', title: mixins.$t('cusPhone'), phone: true },
  38. { name: 'addressFull', title: mixins.$t('addressFull') },
  39. { name: [{ name: 'orgName', title: '' }, { name: 'staffName', title: '' }], title: mixins.$t('storeInformation') },
  40. { name: 'followTime', title: mixins.$t('followTime') }
  41. ],
  42. contentObj: {
  43. '跟进状态-跟进': [{ name: 'cusPhone', title: mixins.$t('cusPhone'), phone: true },
  44. { name: 'addressFull', title: mixins.$t('addressFull') },
  45. { name: [{ name: 'orgName', title: '' }, { name: 'staffName', title: mixins.$t('staffId') }], title: mixins.$t('storeInformation') },
  46. { name: 'followTime', title: mixins.$t('followTime') }],
  47. '跟进状态-报备': [{ name: 'cusPhone', title: mixins.$t('cusPhone'), phone: true },
  48. { name: 'addressFull', title: mixins.$t('addressFull') },
  49. { name: [{ name: 'orgName', title: '' }, { name: 'staffName', title: mixins.$t('staffId') }], title: mixins.$t('storeInformation') },
  50. { name: 'followTime', title: mixins.$t('followTime') }],
  51. '跟进状态-邀约': [{ name: 'cusPhone', title: mixins.$t('cusPhone'), phone: true },
  52. { name: 'addressFull', title: mixins.$t('addressFull') },
  53. { name: [{ name: 'orgName', title: '' }, { name: 'staffName', title: mixins.$t('staffId') }], title: mixins.$t('storeInformation') },
  54. { name: 'followTime', title: mixins.$t('followTime') }],
  55. '跟进状态-约尺': [{ name: 'cusPhone', title: mixins.$t('cusPhone'), phone: true },
  56. { name: 'addressFull', title: mixins.$t('addressFull') },
  57. { name: [{ name: 'orgName', title: '' }, { name: 'staffName', title: mixins.$t('staffId') }], title: mixins.$t('storeInformation') },
  58. { name: 'followTime', title: mixins.$t('followTime') }],
  59. '跟进状态-接待': [
  60. { name: [{ name: 'orgName', title: '' }, { name: 'staffName', title: mixins.$t('staffId') }], title: mixins.$t('storeInformation') },
  61. { name: 'followTime', title: mixins.$t('followTime') }],
  62. '跟进状态-成交': [{ name: 'cusPhone', title: mixins.$t('cusPhone'), phone: true },
  63. { name: 'addressFull', title: mixins.$t('addressFull') },
  64. { name: [{ name: 'orgName', title: '' }, { name: 'staffName', title: mixins.$t('staffId') }], title: mixins.$t('storeInformation') },
  65. { name: 'followTime', title: mixins.$t('followTime') }],
  66. '跟进状态-报价': [{ name: 'cusPhone', title: mixins.$t('cusPhone'), phone: true },
  67. { name: 'addressFull', title: mixins.$t('addressFull') },
  68. { name: [{ name: 'orgName', title: '' }, { name: 'staffName', title: mixins.$t('staffId') }], title: mixins.$t('storeInformation') },
  69. { name: 'followTime', title: mixins.$t('followTime') }],
  70. },
  71. // 列表区(脚部信息)
  72. footerInfo: [{
  73. prefix: mixins.$t('followedUp'),
  74. name: 'followCount',
  75. title: mixins.$t('next')
  76. },],
  77. // 弹出按钮
  78. buttonList: [
  79. { name: 'followUp', title: mixins.$t('follow') },
  80. { name: 'followUpTasks', title: mixins.$t('followUpTasks') },
  81. { name: 'orderAdd', title: mixins.$t('saleOrder') },
  82. { name: 'cusCollection', title: mixins.$t("cusCollection"), idKey: 'cusId' },//跳转客户收款
  83. ],
  84. totallength: 0, //视图下方提醒数量
  85. // 路由
  86. routeObjName: 'cusFollow',
  87. followStatus: 'all',
  88. active: 0
  89. },
  90. /**
  91. * @desc : 跳转客户详情
  92. * @date : 2024年5月27日
  93. * @author : 姜永辉
  94. */
  95. toTitle(e) {
  96. let cusId = e.detail.item.cusId
  97. wx.navigateTo({
  98. url: this.data.route.detailCustomer.url,
  99. success: function (res) {
  100. // 通过eventChannel向被打开页面传送数据 TODO 测试例子url是写死的,实际中,需要从route中读取
  101. res.eventChannel.emit('params', {
  102. id: cusId,
  103. formMode: Constants.formMode.edit
  104. })
  105. }
  106. })
  107. },
  108. /**
  109. * @desc : 点击三个点事件
  110. * @date : 2024/2/1 15:49
  111. * @author : 于继渤
  112. */
  113. toPoint(e) {
  114. let item = e.detail.item
  115. let buttonList = this.data.buttonList
  116. if (item.followStatus == mixins.$t('followStatusFoot') && item.measureStatus == mixins.$t('scaleStatusMeasured')) {
  117. buttonList = [
  118. { name: 'followUp', title: mixins.$t('follow') },
  119. { name: 'followUpTasks', title: mixins.$t('followUpTasks') },
  120. { name: 'orderAdd', title: mixins.$t('saleOrder') },
  121. { name: 'cusCollection', title: mixins.$t("cusCollection"), idKey: 'cusId' },//跳转客户收款
  122. { name: 'measureTo', title: mixins.$t('measuringScaleReceipt') }
  123. ]
  124. } else {
  125. buttonList = [
  126. { name: 'followUp', title: mixins.$t('follow') },
  127. { name: 'followUpTasks', title: mixins.$t('followUpTasks') },
  128. { name: 'orderAdd', title: mixins.$t('saleOrder') },
  129. { name: 'cusCollection', title: mixins.$t("cusCollection"), idKey: 'cusId' },//跳转客户收款
  130. ]
  131. }
  132. this.setData({
  133. buttonList: buttonList
  134. })
  135. },
  136. /**
  137. * @desc : 跳转
  138. * @date : 2024/2/1 15:49
  139. * @author : 于继渤
  140. */
  141. toDetail(e) {
  142. let item = e.detail.item
  143. let url = null
  144. let title = undefined
  145. if (item.followStatus == '跟进状态-报备' || item.followStatus == '跟进状态-接待') {
  146. url = this.data.route.toFollowStatus1.url
  147. } else if (item.followStatus == '跟进状态-跟进' || item.followStatus == '跟进状态-邀约') {
  148. title = '跟进详情'
  149. url = this.data.route.toFollowStatus2.url
  150. } else if (item.followStatus == '跟进状态-约尺') {
  151. url = this.data.route.toFollowStatus3.url
  152. }
  153. let _this = this;
  154. wx.navigateTo({
  155. url: url,
  156. events: {
  157. // 保存成功后刷新页面
  158. refresh: function (data) {
  159. // 刷新一览界面
  160. _this.searchData();
  161. }
  162. },
  163. success: function (res) {
  164. let data = {}
  165. data.id = item.followId
  166. data.formMode = Constants.formMode.edit
  167. data.formType = Constants.formMode.detail
  168. data.title = title
  169. res.eventChannel.emit('params', data);
  170. }
  171. })
  172. },
  173. /**
  174. * @desc : 切换
  175. * @date : 2024/2/1 15:49
  176. * @author : 于继渤
  177. */
  178. onChangeTabs(e) {
  179. let code = e.detail.detail.code
  180. this.setData({
  181. followStatus: code,
  182. })
  183. this.searchData()
  184. },
  185. /**
  186. * @desc : 设置查询参数
  187. * @date : 2024/2/1 15:49
  188. * @author : 于继渤
  189. */
  190. setSearchParams(params) {
  191. //销售状态
  192. params.followStatus = this.data.followStatus == 'all' ? '' : this.data.followStatus
  193. // if(this.data.followStatus === "跟进状态-约尺"){
  194. // params.measureSe = "量尺状态-已量尺"
  195. // }
  196. params.nextFollowTime = null
  197. return params
  198. },
  199. /**
  200. * @desc : 处理接口返回数据
  201. * @date : 2024/2/1 15:49
  202. * @author : 于继渤
  203. */
  204. handleSearchData(tableData) {
  205. let contentSaveList = this.data.contentSaveList
  206. contentSaveList[0].bill = tableData.length
  207. tableData.forEach(res => {
  208. if (res.followStatus == mixins.$t('followStatusFoot') && res.measureStatus == mixins.$t('scaleStatusMeasured')) {
  209. res.measureStatusName = ''
  210. }
  211. if(res.addressFull){
  212. const addressNo = res.addressNo? res.addressNo: ''
  213. res.addressFull = res.addressFull + addressNo
  214. }
  215. })
  216. this.setData({
  217. tableData: tableData,
  218. contentSaveList: contentSaveList
  219. })
  220. },
  221. /**
  222. * @desc : 查询
  223. * @date : 2024/2/1 15:49
  224. * @author : 于继渤
  225. */
  226. getData(params) {
  227. return this.excute(this.data.service, this.data.service.selectByCond, params);
  228. },
  229. })