followList.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183
  1. <template>
  2. <view class="mainBox">
  3. <view v-for="(item, index) in tableList" :key="index" style="position: relative;">
  4. <myCard @del="del(index,item)" @add="add('edit',item,index)" :item="item" :btnList="btnList" :index="index+1"
  5. :columns="columns">
  6. </myCard>
  7. </view>
  8. <view class="add" @click="add('add')">
  9. <u-icon name="plus" color="#fff"></u-icon>
  10. </view>
  11. </view>
  12. </template>
  13. <script>
  14. import myCard from '../../components/myCard.vue'
  15. export default {
  16. data() {
  17. return {
  18. columns: [
  19. [{
  20. label: '跟进内容:',
  21. prop: 'content',
  22. type: 'title',
  23. className: 'perce100',
  24. }],
  25. [{
  26. label: '跟进阶段:',
  27. prop: 'stageName'
  28. }, {
  29. label: '客户联系人:',
  30. prop: 'linkName',
  31. }],
  32. [{
  33. label: '跟进时间:',
  34. prop: 'followupTime',
  35. className: 'perce100',
  36. }],
  37. [{
  38. label: '达成共识:',
  39. prop: 'agreement',
  40. className: 'perce100',
  41. }],
  42. [{
  43. label: '下一步计划:',
  44. prop: 'nextPlan',
  45. className: 'perce100',
  46. }],
  47. [{
  48. label: '操作:',
  49. prop: 'action',
  50. type: 'action',
  51. className: 'perce100',
  52. }],
  53. ],
  54. btnList: [{
  55. name: '修改',
  56. apiName: 'add',
  57. btnType: 'primary',
  58. type: '2',
  59. }, {
  60. name: '删除',
  61. apiName: 'del',
  62. btnType: 'error',
  63. type: '2',
  64. pageUrl: '',
  65. }],
  66. tableList: [],
  67. form: {},
  68. }
  69. },
  70. props: {
  71. isDrawer: {
  72. default: false
  73. },
  74. linkList: {
  75. default: []
  76. },
  77. pageName: ''
  78. },
  79. components: {
  80. myCard
  81. },
  82. created() {
  83. uni.$off('updateFollowList')
  84. uni.$on('updateFollowList', ({
  85. type,
  86. data
  87. }) => {
  88. if (type == 'add') {
  89. this.tableList.unshift(data)
  90. } else {
  91. this.$set(this.tableList, data.index, data)
  92. }
  93. if(this.pageName=='businessOpportunity'){
  94. uni.$emit('savefollowList',data)
  95. return
  96. }
  97. this.form.opportunityFollowupList = JSON.parse(JSON.stringify(this.tableList))
  98. if (this.isDrawer) {
  99. uni.$emit('setContact', {
  100. key: 'form',
  101. data: this.form
  102. })
  103. }
  104. })
  105. },
  106. methods: {
  107. init(data) {
  108. if (this.pageName == 'businessOpportunity') {
  109. this.tableList = JSON.parse(JSON.stringify(data))
  110. return
  111. }
  112. if (data) {
  113. this.form = data
  114. this.tableList = JSON.parse(JSON.stringify(data.opportunityFollowupList))
  115. }
  116. },
  117. del(index,item) {
  118. this.tableList.splice(index, 1);
  119. if (this.pageName == 'businessOpportunity') {
  120. uni.$emit('delFollowList',item)
  121. return
  122. }
  123. this.form.opportunityFollowupList = JSON.parse(JSON.stringify(this.tableList))
  124. if (this.isDrawer) {
  125. uni.$emit('setContact', {
  126. key: 'form',
  127. data: this.form
  128. })
  129. }
  130. },
  131. add(type, data, index) {
  132. if (type == 'edit') {
  133. data['index'] = index
  134. }
  135. uni.navigateTo({
  136. url: '/pages/saleManage/contact/components/followListAdd?type=' + type + '&linkList=' + JSON
  137. .stringify(this.linkList) + (type == 'edit' ?
  138. '&data=' + JSON.stringify(data) : '')
  139. })
  140. }
  141. }
  142. }
  143. </script>
  144. <style lang="scss" scoped>
  145. .add {
  146. width: 96rpx;
  147. height: 96rpx;
  148. border-radius: 48rpx;
  149. background: #3c9cff;
  150. position: fixed;
  151. bottom: 100rpx;
  152. right: 24rpx;
  153. display: flex;
  154. align-items: center;
  155. justify-content: center;
  156. z-index: 99;
  157. }
  158. /deep/.u-cell__body,
  159. /deep/.u-cell__title-text {
  160. font-size: 26rpx;
  161. }
  162. </style>