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