index.vue 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243
  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. // 订单跟进(通过orderId)
  90. data = await uni.$u.api.getOrderFollowList({
  91. orderId: this.orderId
  92. });
  93. } else if (this.type === '3') {
  94. // 订单跟进(通过clueId)
  95. data = await uni.$u.api.getOrderFollowListByClueId({
  96. clueId: this.clueId
  97. });
  98. } else if (this.type === '4') {
  99. // 重复线索跟进
  100. data = await uni.$u.api.getDuplicateClueFollowByClueId({
  101. clueId: this.clueId
  102. });
  103. } else {
  104. // 重复订单跟进
  105. data = await uni.$u.api.getDuplicateOrderFollowListByClueId({
  106. clueId: this.clueId
  107. });
  108. }
  109. this.dataList = data.data;
  110. this.loading = false;
  111. },
  112. async confirm() {
  113. try {
  114. // 根据type类型调用不同删除接口
  115. if (this.type === '1' || this.type === '4') {
  116. // 线索跟进和重复线索跟进使用deleteClueFollow
  117. await uni.$u.api.deleteClueFollow([this.currentDeleteFollowId]);
  118. } else {
  119. // 订单跟进(通过orderId)、订单跟进(通过clueId)、重复订单跟进使用deleteOrderFollow
  120. await uni.$u.api.deleteOrderFollow([this.currentDeleteFollowId]);
  121. }
  122. uni.$u.toast("删除成功");
  123. this.getData();
  124. } catch (error) {
  125. console.error('删除跟进记录失败:', error);
  126. uni.$u.toast("删除失败");
  127. } finally {
  128. this.showModal = false;
  129. this.currentDeleteFollowId = undefined;
  130. }
  131. },
  132. },
  133. mounted() {
  134. this.getData();
  135. },
  136. beforeDestroy(){
  137. uni.$off('addFollowSuccess');
  138. },
  139. created() {
  140. uni.$on('addFollowSuccess',()=>{
  141. this.getData();
  142. });
  143. }
  144. }
  145. </script>
  146. <style lang="scss" scoped>
  147. .followRecord_wrap {
  148. min-height: 400px;
  149. background: #f5f6f8;
  150. position: relative;
  151. .empty_wrap {
  152. text-align: center;
  153. color: #999999;
  154. position: absolute;
  155. left: 50%;
  156. top: 50%;
  157. transform: translate(-50%, -50%);
  158. }
  159. }
  160. .followRecord_timeLine_wrap {
  161. background: #ffffff;
  162. .timeline-item {
  163. &:last-child {
  164. ::v-deep .left-line .timeline-item-tail {
  165. display: none;
  166. }
  167. }
  168. }
  169. }
  170. .body_wrap {
  171. margin-bottom: 20rpx;
  172. background-color: #f6f7f8;
  173. padding: 20rpx;
  174. border-radius: 20rpx;
  175. &:last-child {
  176. margin-bottom: 0;
  177. }
  178. .body_top {
  179. display: flex;
  180. align-items: center;
  181. justify-content: space-between;
  182. .body_top_left {
  183. display: flex;
  184. align-items: center;
  185. image {
  186. width: 46rpx;
  187. height: 46rpx;
  188. margin-right: 12rpx;
  189. }
  190. .follow {
  191. color: #202020;
  192. font-size: 30rpx;
  193. margin-right: 12rpx;
  194. }
  195. .debt {
  196. color: #999999;
  197. font-size: 24rpx;
  198. }
  199. }
  200. .body_top_right {
  201. color: #108CFF;
  202. font-size: 24rpx;
  203. }
  204. }
  205. .body_center {
  206. margin: 30rpx 0;
  207. padding-left: 56rpx;
  208. overflow: hidden;
  209. }
  210. .body_bottom {
  211. display: flex;
  212. padding-left: 56rpx;
  213. ::v-deep .u-icon__icon {
  214. font-size: 24rpx !important;
  215. }
  216. .date {
  217. color: #c0c0c7;
  218. font-size: 22rpx;
  219. margin-left: 10rpx;
  220. }
  221. }
  222. }
  223. </style>