followList.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189
  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. console.log('pageName', this.pageName)
  113. if (this.pageName == 'businessOpportunity') {
  114. this.tableList = JSON.parse(JSON.stringify(data))
  115. return
  116. }
  117. if (data) {
  118. this.form = data
  119. this.tableList = JSON.parse(JSON.stringify(data.opportunityFollowupList))
  120. console.log('tableList', this.tableList)
  121. }
  122. },
  123. del(index, item) {
  124. this.tableList.splice(index, 1);
  125. if (this.pageName == 'businessOpportunity') {
  126. uni.$emit('delFollowList', item)
  127. return
  128. }
  129. this.form.opportunityFollowupList = JSON.parse(JSON.stringify(this.tableList))
  130. if (this.isDrawer) {
  131. uni.$emit('setContact', {
  132. key: 'form',
  133. data: this.form
  134. })
  135. }
  136. },
  137. add(type, data, index) {
  138. if (type == 'edit') {
  139. data['index'] = index
  140. }
  141. console.log('index', JSON.stringify(data))
  142. uni.navigateTo({
  143. url: '/pages/saleManage/contact/components/followListAdd?type=' + type + '&linkList=' + JSON
  144. .stringify(this.linkList) + (type == 'edit' ?
  145. '&data=' + encodeURIComponent(JSON.stringify(data)) : '')
  146. })
  147. }
  148. }
  149. }
  150. </script>
  151. <style lang="scss" scoped>
  152. .add {
  153. width: 96rpx;
  154. height: 96rpx;
  155. border-radius: 48rpx;
  156. background: #3c9cff;
  157. position: fixed;
  158. bottom: 100rpx;
  159. right: 24rpx;
  160. display: flex;
  161. align-items: center;
  162. justify-content: center;
  163. z-index: 99;
  164. }
  165. /deep/.u-cell__body,
  166. /deep/.u-cell__title-text {
  167. font-size: 26rpx;
  168. }
  169. </style>