index.vue 5.8 KB

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