index.vue 6.8 KB

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