index.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268
  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 inquiry" @click.stop="handleInquiry(item)">
  51. <image src='/static/publicClue/inquiry.png' mode="aspectFit" class="sendOrder_img"></image>
  52. <view>询价</view>
  53. </view> -->
  54. <view class="sendOrder" @click.stop="handleSendOrder(item)">
  55. <image src='/static/publicClue/littlePlane.png' mode="aspectFit" class="sendOrder_img"></image>
  56. <view>发单</view>
  57. </view>
  58. </view>
  59. </template>
  60. <script>
  61. import {
  62. selectDictLabel
  63. } from "@/utils/util";
  64. export default {
  65. props: {
  66. item: {
  67. type: Object,
  68. required: true
  69. },
  70. dicts: {
  71. type: Object,
  72. required: true
  73. },
  74. type: {
  75. type: String | Number,
  76. required: true
  77. },
  78. },
  79. data() {
  80. return {
  81. caseStatusDicts: [],
  82. }
  83. },
  84. methods: {
  85. // 字典翻译
  86. crm_clue_phase(caseStatus) {
  87. return selectDictLabel(this.dicts.caseStatusDicts, caseStatus);
  88. },
  89. handleCopy(item) {
  90. uni.setClipboardData({
  91. data: item.telephone,
  92. success: function () {
  93. uni.$u.toast("复制成功");
  94. }
  95. });
  96. },
  97. // 主页面的发单
  98. async handleSendOrder(item) {
  99. console.log(item);
  100. const {
  101. data: count
  102. } = await uni.$u.api.getClueSendFormCountByClueId({
  103. clueId: item.id
  104. });
  105. console.log(count);
  106. if (count > 0) {
  107. uni.showModal({
  108. title: '该线索已发单是否再次发单?',
  109. success: (res) => {
  110. if (res.confirm) {
  111. this.toOrderForm(item)
  112. }
  113. }
  114. });
  115. } else {
  116. this.toOrderForm(item)
  117. }
  118. },
  119. toOrderForm(item) {
  120. console.log(item);
  121. const {
  122. id,
  123. ownLatestDynamicTime,
  124. createTime,
  125. clueOwnerId
  126. } = item;
  127. if (this.$store.state.user.userInfo.userId === clueOwnerId) {
  128. uni.navigateTo({
  129. url: `/pages/orderForm/index?clueId=${id}`
  130. })
  131. } else {
  132. // 确定用于判断的目标时间(ownLatestDynamicTime,为null则用createTime)
  133. const date = ownLatestDynamicTime || createTime
  134. const twoDaysLater = new Date(date)
  135. twoDaysLater.setDate(twoDaysLater.getDate() + 2) // 日期加2天
  136. // 是否大于当前时间 小于可以发单
  137. let isOrderForm = false
  138. if (twoDaysLater) {
  139. isOrderForm = twoDaysLater.getTime() <= new Date().getTime()
  140. }
  141. if (isOrderForm) {
  142. uni.navigateTo({
  143. url: `/pages/orderForm/index?clueId=${id}`
  144. })
  145. } else {
  146. uni.$u.toast('非所属人需两天内无跟进记录才可发单')
  147. }
  148. }
  149. },
  150. // 询价
  151. async handleInquiry(item) {
  152. uni.navigateTo({
  153. url: `/pages/inquiry/add?clueId=${item.id}`
  154. })
  155. },
  156. },
  157. }
  158. </script>
  159. <style lang="scss" scoped>
  160. .post_item {
  161. background: #fff;
  162. border-radius: 20px;
  163. padding: 20px;
  164. margin-bottom: 20px;
  165. position: relative;
  166. .post_top {
  167. display: flex;
  168. justify-content: space-between;
  169. margin-bottom: 10px;
  170. .top_left {
  171. font-size: 18px;
  172. }
  173. .top_right {
  174. color: #87bf66;
  175. }
  176. }
  177. .post_info {
  178. font-size: 14px;
  179. .telPhone {
  180. display: flex;
  181. margin-bottom: 6px;
  182. .copy_btn {
  183. color: #4fa5fe;
  184. margin-left: 10px;
  185. }
  186. }
  187. .info {
  188. display: flex;
  189. margin-bottom: 10px;
  190. .createTime {
  191. margin-right: 10px;
  192. }
  193. .copy_btn {
  194. display: flex;
  195. flex-wrap: wrap;
  196. }
  197. }
  198. }
  199. .clue_state_wrap {
  200. font-size: 14px;
  201. background: #f8f9fb;
  202. padding: 10px;
  203. color: #9b9aa2;
  204. overflow: hidden;
  205. .state_wrap {
  206. display: flex;
  207. margin-bottom: 10px;
  208. }
  209. .label {
  210. flex: 0 0 66px;
  211. }
  212. .clueTag {
  213. display: flex;
  214. }
  215. }
  216. .sendOrder {
  217. width: 50px;
  218. height: 50px;
  219. background-color: rgb(36, 98, 234);
  220. color: #fff;
  221. border-radius: 50%;
  222. display: flex;
  223. flex-direction: column;
  224. justify-content: center;
  225. align-items: center;
  226. font-size: 10px;
  227. font-weight: 700;
  228. font-family: "uicon";
  229. position: absolute;
  230. right: 20px;
  231. bottom: 115px;
  232. .sendOrder_img {
  233. width: 20px;
  234. height: 20px;
  235. }
  236. }
  237. .inquiry {
  238. right: 140rpx;
  239. color: #2563eb;
  240. border: 1px solid #2563eb;
  241. background-color: #fff;
  242. }
  243. }
  244. </style>