index.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251
  1. <template>
  2. <view class="post_item">
  3. <view class="post_top">
  4. <view class="top_left">{{ item.name }}</view>
  5. <view class="top_right">{{ item.assignStateCode === '1' ? "已分配" : "未分配" }}</view>
  6. </view>
  7. <view class="post_info">
  8. <view class="telPhone">
  9. <view class="phone">
  10. <text>电话: </text>
  11. <show-real-text :real="item.telephone" :type='type'
  12. :style="{ color: item.repetitionOperationName ? 'red' : 'black' }"></show-real-text>
  13. <template v-if="item.telAddr">
  14. ({{ item.telAddr }})
  15. </template>
  16. <text v-if="item.repetitionOperationName">( 撞 : {{ item.repetitionOperationName }})</text>
  17. </view>
  18. <view class="copy_btn" @click.stop="handleCopy(item)" v-if="type != '1'">复制</view>
  19. </view>
  20. <view class="telPhone" v-if="item.weixin">
  21. <text>微信: </text>
  22. <view class="phone">
  23. <text :style="{ color: item.repetitionOperWeixinName ? 'red' : 'black' }">{{ item.weixin }}</text>
  24. <text v-if="item.repetitionOperWeixinName">( 撞 : {{ item.repetitionOperWeixinName }})</text>
  25. </view>
  26. </view>
  27. <view class="info">
  28. <view class="createTime">{{ item.createTime }}</view>
  29. <view>{{ item.appName }}</view>
  30. </view>
  31. <view class="info">
  32. <view class="owner" style="margin-right: 20px;">所属人 {{ item.clueOwnerName ? item.clueOwnerName : "-" }}
  33. </view>
  34. <view class="operation">运营人 {{ item.clueOperationName ? item.clueOperationName : "-" }}</view>
  35. </view>
  36. </view>
  37. <view class="clue_state_wrap">
  38. <view class="clue_state">
  39. <view class="state_wrap">
  40. <view class="label">线索阶段:</view>{{ crm_clue_phase(item.clueState) }}
  41. </view>
  42. <view class="clueTag">
  43. <view class="label">线索标签:</view>
  44. <u-tag :text="tag.name" plain plainFill borderColor="#fff" size="mini"
  45. v-for="(tag) in item.clueTags" :key="tag.id" style="margin-right: 10px;" :bgColor="tag.color"
  46. color="#fff"></u-tag>
  47. </view>
  48. </view>
  49. </view>
  50. <view class="sendOrder" @click.stop="handleSendOrder(item)">
  51. <image src='/static/publicClue/littlePlane.png' mode="aspectFit" class="sendOrder_img"></image>
  52. <view>发单</view>
  53. </view>
  54. </view>
  55. </template>
  56. <script>
  57. import {
  58. selectDictLabel
  59. } from "@/utils/util";
  60. export default {
  61. props: {
  62. item: {
  63. type: Object,
  64. required: true
  65. },
  66. dicts: {
  67. type: Object,
  68. required: true
  69. },
  70. type: {
  71. type: String | Number,
  72. required: true
  73. },
  74. },
  75. data() {
  76. return {
  77. caseStatusDicts: [],
  78. }
  79. },
  80. methods: {
  81. // 字典翻译
  82. crm_clue_phase(caseStatus) {
  83. return selectDictLabel(this.dicts.caseStatusDicts, caseStatus);
  84. },
  85. handleCopy(item) {
  86. uni.setClipboardData({
  87. data: item.telephone,
  88. success: function () {
  89. uni.$u.toast("复制成功");
  90. }
  91. });
  92. },
  93. // 主页面的发单
  94. async handleSendOrder(item) {
  95. console.log(item);
  96. const {
  97. data: count
  98. } = await uni.$u.api.getClueSendFormCountByClueId({
  99. clueId: item.id
  100. });
  101. console.log(count);
  102. if (count > 0) {
  103. uni.showModal({
  104. title: '该线索已发单是否再次发单?',
  105. success: (res) => {
  106. if (res.confirm) {
  107. this.toOrderForm(item)
  108. }
  109. }
  110. });
  111. } else {
  112. this.toOrderForm(item)
  113. }
  114. },
  115. toOrderForm(item) {
  116. console.log(item);
  117. const {
  118. id,
  119. ownLatestDynamicTime,
  120. createTime,
  121. clueOwnerId
  122. } = item;
  123. if (this.$store.state.user.userInfo.userId === clueOwnerId) {
  124. uni.navigateTo({
  125. url: `/pages/orderForm/index?clueId=${id}`
  126. })
  127. } else {
  128. // 确定用于判断的目标时间(ownLatestDynamicTime,为null则用createTime)
  129. const date = ownLatestDynamicTime || createTime
  130. const twoDaysLater = new Date(date)
  131. twoDaysLater.setDate(twoDaysLater.getDate() + 2) // 日期加2天
  132. // 是否大于当前时间 小于可以发单
  133. let isOrderForm = false
  134. if (twoDaysLater) {
  135. isOrderForm = twoDaysLater.getTime() <= new Date().getTime()
  136. }
  137. if (isOrderForm) {
  138. uni.navigateTo({
  139. url: `/pages/orderForm/index?clueId=${id}`
  140. })
  141. } else {
  142. uni.$u.toast('非所属人需两天内无跟进记录才可发单')
  143. }
  144. }
  145. },
  146. },
  147. }
  148. </script>
  149. <style lang="scss" scoped>
  150. .post_item {
  151. background: #fff;
  152. border-radius: 20px;
  153. padding: 20px;
  154. margin-bottom: 20px;
  155. position: relative;
  156. .post_top {
  157. display: flex;
  158. justify-content: space-between;
  159. margin-bottom: 10px;
  160. .top_left {
  161. font-size: 18px;
  162. }
  163. .top_right {
  164. color: #87bf66;
  165. }
  166. }
  167. .post_info {
  168. font-size: 14px;
  169. .telPhone {
  170. display: flex;
  171. margin-bottom: 6px;
  172. .copy_btn {
  173. color: #4fa5fe;
  174. margin-left: 10px;
  175. }
  176. }
  177. .info {
  178. display: flex;
  179. margin-bottom: 10px;
  180. .createTime {
  181. margin-right: 10px;
  182. }
  183. .copy_btn {
  184. display: flex;
  185. flex-wrap: wrap;
  186. }
  187. }
  188. }
  189. .clue_state_wrap {
  190. font-size: 14px;
  191. background: #f8f9fb;
  192. padding: 10px;
  193. color: #9b9aa2;
  194. overflow: hidden;
  195. .state_wrap {
  196. display: flex;
  197. margin-bottom: 10px;
  198. }
  199. .label {
  200. flex: 0 0 66px;
  201. }
  202. .clueTag {
  203. display: flex;
  204. }
  205. }
  206. .sendOrder {
  207. width: 50px;
  208. height: 50px;
  209. background-color: rgb(36, 98, 234);
  210. color: #fff;
  211. border-radius: 50%;
  212. display: flex;
  213. flex-direction: column;
  214. justify-content: center;
  215. align-items: center;
  216. font-size: 10px;
  217. font-weight: 700;
  218. font-family: "uicon";
  219. position: absolute;
  220. right: 20px;
  221. bottom: 115px;
  222. .sendOrder_img {
  223. width: 20px;
  224. height: 20px;
  225. }
  226. }
  227. }
  228. </style>