index.vue 7.0 KB

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