index.vue 5.2 KB

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