index.vue 6.2 KB

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