followList.vue 3.6 KB

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