recordItem.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224
  1. <template>
  2. <view class="record-item">
  3. <view class="record-item-body">
  4. <view class="user-info">
  5. <wk-avatar :size="12" :name="recordData.createUser.realname" :avatar="recordData.userImg" class="avatar" />
  6. <view class="info">
  7. <view class="username">
  8. <text>{{ recordData.createUser.realname }}</text>
  9. <view v-if="recordData.category" class="category">
  10. {{ recordData.category }}
  11. </view>
  12. </view>
  13. <view class="text">
  14. {{ recordData.createTime }}
  15. </view>
  16. </view>
  17. <view v-if="titleMap.hasOwnProperty(recordData.activityType)" class="type-box">
  18. <template v-if="recordData.activityType !== 8">
  19. {{ titleMap[recordData.activityType].label }}-{{ getRecordType(recordData) }}
  20. </template>
  21. <template v-else>
  22. {{ titleMap[recordData.activityType].label }}
  23. </template>
  24. </view>
  25. </view>
  26. <view class="log-content content">
  27. <log-item :log-data="recordData" />
  28. </view>
  29. </view>
  30. <view v-if="titleMap.hasOwnProperty(recordData.activityType)" class="record-item-footer">
  31. <text :class="titleMap[recordData.activityType].icon" class="wk icon" />
  32. <view class="text" @click="handleToDetail(recordData)">
  33. <template v-if="recordData.activityTypeName">
  34. <text style="color: #333">
  35. {{ titleMap[recordData.activityType].label }}-
  36. </text>{{ recordData.activityTypeName }}
  37. </template>
  38. <template v-else>
  39. <text style="color: #333">
  40. {{ titleMap[recordData.activityType].label }}
  41. </text>
  42. </template>
  43. </view>
  44. </view>
  45. </view>
  46. </template>
  47. <script>
  48. import LogItem from '@/components/base/log-item.vue'
  49. export default {
  50. name: 'RecordItem',
  51. components: {
  52. LogItem
  53. },
  54. props: {
  55. recordData: {
  56. type: Object,
  57. required: true
  58. }
  59. },
  60. data() {
  61. return {
  62. titleMap: {
  63. 1: {
  64. label: '线索',
  65. icon: 'wk-leads',
  66. path: '/pages_crm/leads/detail'
  67. },
  68. 2: {
  69. label: '客户',
  70. icon: 'wk-customer',
  71. path: '/pages_crm/customer/detail'
  72. },
  73. 3: {
  74. label: '联系人',
  75. icon: 'wk-contacts',
  76. path: '/pages_crm/contacts/detail'
  77. },
  78. 5: {
  79. label: '商机',
  80. icon: 'wk-business',
  81. path: '/pages_crm/business/detail'
  82. },
  83. 6: {
  84. label: '合同',
  85. icon: 'wk-contract',
  86. path: '/pages_crm/contract/detail'
  87. },
  88. 8: {
  89. label: '日志',
  90. icon: 'wk-log',
  91. path: '/pages_log/detail'
  92. }
  93. },
  94. }
  95. },
  96. methods: {
  97. /**
  98. * 跟进记录类型
  99. */
  100. getRecordType(item) {
  101. if (!item.hasOwnProperty('type')) return '跟进记录'
  102. let str = ''
  103. switch (item.type) {
  104. case 1:
  105. str = '跟进记录'
  106. break;
  107. case 2:
  108. str = '创建记录'
  109. break;
  110. case 3:
  111. str = '商机阶段变更'
  112. break;
  113. case 4:
  114. str = '外勤签到'
  115. break;
  116. default:
  117. str = '跟进记录'
  118. }
  119. return str
  120. },
  121. /**
  122. * 查看详情
  123. */
  124. handleToDetail(data) {
  125. this.$Router.navigateTo({
  126. url: this.titleMap[data.activityType].path,
  127. query: {
  128. id: data.activityTypeId
  129. }
  130. })
  131. }
  132. }
  133. }
  134. </script>
  135. <style scoped lang="scss">
  136. .record-item {
  137. position: relative;
  138. width: 100%;
  139. background-color: white;
  140. border-bottom: 1rpx solid $border-color;
  141. padding: 24rpx 0;
  142. &:last-child {
  143. border-bottom: 0 none;
  144. }
  145. .record-item-body {
  146. padding: 0 32rpx;
  147. .user-info {
  148. @include left;
  149. .avatar {
  150. width: 65rpx;
  151. height: 65rpx;
  152. }
  153. .info {
  154. flex: 1;
  155. margin-left: 16rpx;
  156. .username {
  157. font-size: 28rpx;
  158. font-weight: 500;
  159. color: #333;
  160. @include left;
  161. .category {
  162. height: 38rpx;
  163. font-size: 26rpx;
  164. color: #999;
  165. background-color: #f6f6f6;
  166. border-radius: 38rpx;
  167. padding: 0 15rpx;
  168. margin-left: 20rpx;
  169. @include center;
  170. }
  171. }
  172. .text {
  173. font-size: 24rpx;
  174. color: #999;
  175. }
  176. }
  177. .type-box {
  178. font-size: 24rpx;
  179. color: #999;
  180. }
  181. }
  182. .content {
  183. font-size: 28rpx;
  184. color: #666;
  185. margin-top: 20rpx;
  186. padding-left: 10rpx;
  187. &.record {
  188. .special {
  189. color: $theme-color;
  190. }
  191. }
  192. }
  193. }
  194. .record-item-footer {
  195. width: 100%;
  196. font-size: 26rpx;
  197. color: $theme-color;
  198. padding: 5rpx 40rpx;
  199. @include left;
  200. .icon {
  201. font-size: 32rpx;
  202. color: $theme-color;
  203. margin-right: 15rpx;
  204. }
  205. }
  206. }
  207. </style>