add.js 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  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. radioFollowUp: '1',
  21. routeObjName: 'cusFollow',
  22. cardList: ['main'],
  23. buttonSaveList:[{code:'add',title:'保存',width:'120rpx'}],
  24. contentObj: {
  25. main: [
  26. { code: 'cusName', type: 'str', required: true, title: mixins.$t('customerName') },
  27. { code: 'cusPhone', type: 'phone', title: '客户电话', required: true },
  28. { code: 'addressFull', type: 'address', title: '客户地址', required: false },
  29. { code: 'addressNo', type: 'str', required: false, title: '门牌号' },
  30. { code: 'intention', name: 'intentionName', type: 'drop', required: true, dropType: 'customerIntention', title: '客户意向' },
  31. { code: 'remarks', type: 'textarea', rows: '5', required: true, showWordLimit: true, title: '跟进内容' },
  32. { code: 'nextFollowTime', type: 'dateTime', required: true, title: '提醒时间' },
  33. { code: 'stayTimeLen', name: 'stayTimeLenName', required: true, title: '留店时长', dropType: 'storeRetentionTime', type: 'drop', }
  34. ]
  35. },
  36. followStatus:'跟进状态-报备'
  37. },
  38. /**
  39. * @desc : 设置保存参数
  40. * @date : 2024/2/1 15:49
  41. * @author : 于继渤
  42. */
  43. setParams(params) {
  44. params.followStatus = this.data.followStatus
  45. return params
  46. },
  47. /**
  48. * @desc : 保存数据服务
  49. * @date : 2024/2/1 15:49
  50. * @author : 于继渤
  51. */
  52. saveData() {
  53. return this.excute(this.data.service, this.data.service.insert, this.data.params);
  54. },
  55. onRadioFollowUp(e) {
  56. let detail = e.detail
  57. this.setFormContent(detail)
  58. this.setData({
  59. radioFollowUp: detail,
  60. formData:null
  61. })
  62. console.log('onRadioFollowUp', e.detail)
  63. },
  64. /**
  65. * @desc : 设置跟进form 字段
  66. * @date : 2024/2/1 15:49
  67. * @author : 于继渤
  68. */
  69. setFormContent(radioFollowUp) {
  70. let radioFollowUpOnelist = [
  71. { code: 'cusName', type: 'str', required: true, title: mixins.$t('customerName') },
  72. { code: 'cusPhone', type: 'phone', title: '客户电话', required: true },
  73. { code: 'addressFull', type: 'address', title: '客户地址', required: false },
  74. { code: 'addressNo', type: 'str', required: false, title: '门牌号' },
  75. { code: 'intention', name: 'intentionName', type: 'drop', required: true, dropType: 'customerIntention', title: '客户意向' },
  76. { code: 'remarks', type: 'textarea', rows: '5', required: true, showWordLimit: true, title: '跟进内容' },
  77. { code: 'nextFollowTime', type: 'dateTime', required: true, title: '提醒时间' },
  78. { code: 'stayTimeLen', name: 'stayTimeLenName', required: true, title: '留店时长', dropType: 'storeRetentionTime', type: 'drop', }
  79. ]
  80. let radioFollowUpTwolist = [
  81. { code: 'intention', name: 'intentionName', type: 'drop', required: true, dropType: 'customerIntention', title: '客户意向' },
  82. { code: 'remarks', type: 'textarea', rows: '5', required: true, showWordLimit: true, title: '跟进内容' },
  83. { code: 'stayTimeLen', name: 'stayTimeLenName', required: true, title: '留店时长', dropType: 'storeRetentionTime', type: 'drop', }
  84. ]
  85. let contentObj = this.data.contentObj
  86. let followStatus = this.data.followStatus
  87. if (radioFollowUp == '1') {
  88. followStatus = '跟进状态-报备'
  89. contentObj.main = radioFollowUpOnelist
  90. }
  91. if (radioFollowUp == '2') {
  92. followStatus = '跟进状态-接待'
  93. contentObj.main = radioFollowUpTwolist
  94. }
  95. this.setData({
  96. followStatus,followStatus,
  97. contentObj: contentObj
  98. })
  99. }
  100. })