index.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  1. <template>
  2. <view class="followRecord_wrap">
  3. <rxl-timeline class="followRecord_timeLine_wrap" v-if="!isEmpty(dataList)">
  4. <rxl-timeline-item :timestamp="key" :size="10" color="#108cff" v-for="(followList,key,index) in dataList"
  5. :key="key+index">
  6. <view slot="body">
  7. <view class="body_wrap" v-for="(item) in followList" :key="item.id">
  8. <view class="body_top">
  9. <view class="body_top_left">
  10. <image src="@/static/case/icon-avatar.png" mode=""></image>
  11. <text class="follow">{{item.createNickname}}</text>
  12. </view>
  13. <view class="body_top_right" @click="handleDelete(item)">
  14. 删除
  15. </view>
  16. </view>
  17. <view class="body_center">
  18. {{item.content}}
  19. </view>
  20. <view class="body_bottom">
  21. <u-icon name="clock" color="#C0C0C7"></u-icon>
  22. <text class="date">{{item.createTime}}</text>
  23. </view>
  24. </view>
  25. </view>
  26. </rxl-timeline-item>
  27. </rxl-timeline>
  28. <view v-else class="empty_wrap">
  29. 暂无跟进记录
  30. </view>
  31. <u-modal :show="showModal"
  32. @confirm="confirm"
  33. ref="uModal"
  34. :asyncClose="true"
  35. showCancelButton
  36. @cancel="showModal = false"
  37. cancelColor="#409eff"
  38. :confirmText="'删除'" confirmColor="#f8836c">
  39. <view class="modal_box">
  40. 确定要删除跟进记录
  41. </view>
  42. </u-modal>
  43. </view>
  44. </template>
  45. <script>
  46. import {
  47. isEmpty
  48. } from "lodash";
  49. export default {
  50. props: {
  51. clueId: {
  52. required: true
  53. },
  54. orderId: {
  55. type: [String, Number],
  56. required: false
  57. },
  58. type: {
  59. type: String,
  60. required: true
  61. }
  62. },
  63. data() {
  64. return {
  65. list: [0, 1],
  66. dataList: {},
  67. loading: false,
  68. showModal: false,
  69. currentDeleteFollowId : undefined
  70. }
  71. },
  72. methods: {
  73. handleDelete(item){
  74. const { id } = item;
  75. this.currentDeleteFollowId = id;
  76. this.showModal = true;
  77. },
  78. isEmpty,
  79. async getData() {
  80. this.loading = true;
  81. let data;
  82. // 根据type类型调用不同接口
  83. if (this.type === '1') {
  84. // 线索跟进
  85. data = await uni.$u.api.getClueFollowList({
  86. clueId: this.clueId
  87. });
  88. } else if (this.type === '2') {
  89. data = await uni.$u.api.getOrderFollowList({
  90. clueId: this.clueId
  91. });
  92. } else if (this.type === '3') {
  93. // 订单跟进(通过clueId)
  94. data = await uni.$u.api.getOrderFollowListByClueId({
  95. clueId: this.clueId
  96. });
  97. } else if (this.type === '4') {
  98. // 重复线索跟进
  99. data = await uni.$u.api.getDuplicateClueFollowByClueId({
  100. clueId: this.clueId
  101. });
  102. } else {
  103. // 重复订单跟进
  104. data = await uni.$u.api.getDuplicateOrderFollowListByClueId({
  105. clueId: this.clueId
  106. });
  107. }
  108. this.dataList = data.data;
  109. this.loading = false;
  110. },
  111. async confirm() {
  112. try {
  113. // 根据type类型调用不同删除接口
  114. if (this.type === '1' || this.type === '4') {
  115. // 线索跟进和重复线索跟进使用deleteClueFollow
  116. await uni.$u.api.deleteClueFollow([this.currentDeleteFollowId]);
  117. } else {
  118. await uni.$u.api.deleteOrderFollow([this.currentDeleteFollowId]);
  119. }
  120. uni.$u.toast("删除成功");
  121. this.getData();
  122. } catch (error) {
  123. console.error('删除跟进记录失败:', error);
  124. uni.$u.toast("删除失败");
  125. } finally {
  126. this.showModal = false;
  127. this.currentDeleteFollowId = undefined;
  128. }
  129. },
  130. },
  131. mounted() {
  132. this.getData();
  133. },
  134. beforeUnmount(){
  135. uni.$off('addFollowSuccess');
  136. },
  137. created() {
  138. uni.$on('addFollowSuccess',()=>{
  139. this.getData();
  140. });
  141. }
  142. }
  143. </script>
  144. <style lang="scss" scoped>
  145. .followRecord_wrap {
  146. min-height: 400px;
  147. background: #f5f6f8;
  148. position: relative;
  149. .empty_wrap {
  150. text-align: center;
  151. color: #999999;
  152. position: absolute;
  153. left: 50%;
  154. top: 50%;
  155. transform: translate(-50%, -50%);
  156. }
  157. }
  158. .followRecord_timeLine_wrap {
  159. background: #ffffff;
  160. .timeline-item {
  161. &:last-child {
  162. ::v-deep .left-line .timeline-item-tail {
  163. display: none;
  164. }
  165. }
  166. }
  167. }
  168. .body_wrap {
  169. margin-bottom: 20rpx;
  170. background-color: #f6f7f8;
  171. padding: 20rpx;
  172. border-radius: 20rpx;
  173. &:last-child {
  174. margin-bottom: 0;
  175. }
  176. .body_top {
  177. display: flex;
  178. align-items: center;
  179. justify-content: space-between;
  180. .body_top_left {
  181. display: flex;
  182. align-items: center;
  183. image {
  184. width: 46rpx;
  185. height: 46rpx;
  186. margin-right: 12rpx;
  187. }
  188. .follow {
  189. color: #202020;
  190. font-size: 30rpx;
  191. margin-right: 12rpx;
  192. }
  193. .debt {
  194. color: #999999;
  195. font-size: 24rpx;
  196. }
  197. }
  198. .body_top_right {
  199. color: #108CFF;
  200. font-size: 24rpx;
  201. }
  202. }
  203. .body_center {
  204. margin: 30rpx 0;
  205. padding-left: 56rpx;
  206. overflow: hidden;
  207. }
  208. .body_bottom {
  209. display: flex;
  210. padding-left: 56rpx;
  211. ::v-deep .u-icon__icon {
  212. font-size: 24rpx !important;
  213. }
  214. .date {
  215. color: #c0c0c7;
  216. font-size: 22rpx;
  217. margin-left: 10rpx;
  218. }
  219. }
  220. }
  221. </style>