SeekList.vue 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481
  1. <template>
  2. <div>
  3. <ul class="seek-list">
  4. <li v-for="(item, index) in purchaseManListData" class="clearfix">
  5. <p v-if="!(seekType === 'seekPurchase') && !(seekType !== 'seekPurchase' && item.quotations)">
  6. <span v-if="seekType === 'purchaseinquiry' && item.enterprise && item.enterprise.enName">{{[item.enName || item.enterprise.enName, user.logged] | enterpriseFilter}}</span>
  7. <span v-else-if="seekType !== 'purchaseinquiry' && item.inquiry && (item.inquiry.enName || (item.inquiry.enterprise && item.inquiry.enterprise.enName))">{{[item.inquiry.enName || item.inquiry.enterprise.enName, user.logged] | enterpriseFilter}}</span>
  8. <span v-else>{{[item.userName, user.logged] | userNameFilter}}</span>
  9. </p>
  10. <div class="clearfix" :class="{'no-quot': !item.quotations}">
  11. <div class="fl">
  12. <div class="content" v-if="item.quotations && seekType !== 'seekPurchase'">
  13. <span v-if="seekType === 'purchaseinquiry' && item.enterprise && item.enterprise.enName">{{[item.enName || item.enterprise.enName, user.logged] | enterpriseFilter}}</span>
  14. <span v-else-if="seekType !== 'purchaseinquiry' && item.inquiry && (item.inquiry.enName || (item.inquiry.enterprise && item.inquiry.enterprise.enName))">{{[item.inquiry.enName || item.inquiry.enterprise.enName, user.logged] | enterpriseFilter}}</span>
  15. <span v-else>{{[item.userName, user.logged] | userNameFilter}}</span>
  16. </div>
  17. <template v-if="seekType === 'enquiry' || seekType === 'purchaseinquiry'">
  18. <div class="content" >
  19. 单号:
  20. <span>{{item.inquiry.code || '-'}}</span>
  21. </div>
  22. <div class="content">
  23. 物料编号:
  24. <span>{{item.product.code || '-'}}</span>
  25. </div>
  26. <div class="content">
  27. 物料名称:
  28. <span>{{item.product.title || '-'}}</span>
  29. </div>
  30. <div class="content">
  31. 物料规格:
  32. <span>{{item.product.spec ||'-'}}</span>
  33. </div>
  34. <div class="content">
  35. 询价时间:
  36. <span>{{item.inquiry.date | date}}</span>
  37. </div>
  38. </template>
  39. <template v-else>
  40. <div class="content" >
  41. 品牌:
  42. <span>{{item.inbrand ||'-'}}</span>
  43. </div>
  44. <div class="content">
  45. 物料名称:
  46. <span>{{item.title || item.prodTitle || '-'}}</span>
  47. </div>
  48. <div class="content">
  49. 型号:
  50. <span>{{item.cmpCode || '-'}}</span>
  51. </div>
  52. <div class="content">
  53. 规格:
  54. <span>{{item.spec || '-'}}</span>
  55. </div>
  56. <div class="content">
  57. 采购数量(PCS):
  58. <span>{{item.needquantity || item.needQty || '-'}}</span>
  59. </div>
  60. </template>
  61. <div class="content">
  62. 截止日期:
  63. <span class="date">{{(item.endDate || item.inquiry.endDate) | date}}</span>
  64. </div>
  65. </div>
  66. <div class="fr" :class="{'no-btn': !isSelfSeek(item) && !canSayPrice(item) && !canSeeInfo(item) && !(seekType === 'purchaseinquiry' && activeType === 'todo'), 'is-qutation': item.quotations, 'is-simple': seekType !== 'seekPurchase' && item.quotations}">
  67. <template v-if="item.quotations">
  68. <div class="content" v-if="seekType !== 'enquiry' && seekType !== 'purchaseinquiry'">
  69. <span>{{item.quotations.vendName || '-'}}</span>
  70. </div>
  71. <div class="content" v-if="seekType !== 'enquiry' && seekType !== 'purchaseinquiry'">
  72. 报价人:
  73. <span>{{item.quotations.user ? item.quotations.user.userName : '-'}}</span>
  74. </div>
  75. <div class="content" v-if="seekType !== 'enquiry' && seekType !== 'purchaseinquiry'">
  76. 电话:
  77. <span>{{item.quotations.user ? item.quotations.user.userTel : '-'}}</span>
  78. </div>
  79. <div class="content">
  80. 交期(天):
  81. <span class="date">{{item.quotations.leadtime || '-'}}</span>
  82. </div>
  83. <div class="content">
  84. 税率%:
  85. <span class="date">{{item.quotations.taxrate || 0}}</span>
  86. </div>
  87. <table class="com-price-list" v-if="item.quotations.replies && item.quotations.replies.length">
  88. <thead>
  89. <tr>
  90. <th>分段数量</th>
  91. <th>分段单价</th>
  92. </tr>
  93. </thead>
  94. <tbody>
  95. <tr>
  96. <td class="date text-ellipse">{{item.quotations.replies[0].lapQty + '+'}}</td>
  97. <td class="date text-ellipse">{{item.quotations.replies[0].price}}</td>
  98. </tr>
  99. </tbody>
  100. </table>
  101. <button v-if="seekType !== 'enquiry' && seekType !== 'purchaseinquiry'" class="more-btn" @click="goSayPriceInfo(item.newId || item.quteId || item.id, item.agreed, index)">查看更多</button>
  102. <button v-if="seekType === 'enquiry' || seekType === 'purchaseinquiry'" class="more-btn" @click="goBtobDetails(item.id)">查看更多</button>
  103. </template>
  104. <template v-else>
  105. <div v-if="seekType === 'enquiry'">
  106. <p class="remain-time" v-if="activeType === 'todo' && item.inquiry.endDate - new Date() > 0">剩余&nbsp;:
  107. <span v-if="getDay(item.inquiry.endDate - new Date()) > 0" v-text="getDay(item.inquiry.endDate - new Date())"></span>
  108. <i v-if="getDay(item.inquiry.endDate - new Date()) > 0">&nbsp;天&nbsp;</i>
  109. <span v-if="getDay(item.inquiry.endDate - new Date()) <= 0" v-text="getHours(item.inquiry.endDate - new Date())"></span>
  110. <i v-if="getDay(item.inquiry.endDate - new Date()) <= 0">&nbsp;小时</i>
  111. </p>
  112. <p class="remain-time" v-if="item.status === 201 && item.invalid === 0 && item.overdue === 0 && !item.agreed"><span>已报价</span></p>
  113. <p class="remain-time" v-if="item.agreed === 1 && item.status === 201 && item.invalid === 0 && item.overdue === 0"><span>已采纳</span></p>
  114. <p class="remain-time" v-if="item.invalid === 1 || item.status === 314 || (item.inquiry.check || item.inquiry.check === 1) || item.overdue === 1"><span>已失效</span></p>
  115. <a style="margin-top:-1rem;" v-if="(seekType === 'enquiry') && (item.status===200 && item.invalid!==1 && item.overdue !== 1 && (!item.inquiry.check || item.inquiry.check === 0))" @click="goBtobDetails(item.id)">我要报价</a>
  116. <a v-else @click="goBtobDetails(item.id)">查看更多</a>
  117. </div>
  118. <div v-else-if="seekType === 'purchaseinquiry'">
  119. <p class="remain-time" v-if="activeType === 'todo' && item.inquiry.endDate - new Date() > 0">剩余&nbsp;:
  120. <span v-if="getDay(item.inquiry.endDate - new Date()) > 0" v-text="getDay(item.inquiry.endDate - new Date())"></span>
  121. <i v-if="getDay(item.inquiry.endDate - new Date()) > 0">&nbsp;天&nbsp;</i>
  122. <span v-if="getDay(item.inquiry.endDate - new Date()) <= 0" v-text="getHours(item.inquiry.endDate - new Date())"></span>
  123. <i v-if="getDay(item.inquiry.endDate - new Date()) <= 0">&nbsp;小时</i>
  124. </p>
  125. <p class="remain-time" v-if="activeType === 'done'"><span>已报价</span></p>
  126. <p class="remain-time" v-if="activeType === 'agreed'"><span>已采纳</span></p>
  127. <p class="remain-time" v-if="activeType === 'end'"><span>已失效</span></p>
  128. <!--<a style="margin-top:-1rem;" v-if="(seekType === 'enquiry') && (item.status===200 && item.invalid!==1 && item.overdue !== 1 && (!item.inquiry.check || item.inquiry.check === 0))" @click="goBtobDetails(item.id)">我要报价</a>-->
  129. <a @click="goBtobDetails(item.id)">查看更多</a>
  130. </div>
  131. <div v-else>
  132. <p class="remain-time" v-if="item.remainingTime > 0">剩余&nbsp;:
  133. <span v-if="getDay(item.remainingTime) > 0" v-text="getDay(item.remainingTime)"></span>
  134. <i v-if="getDay(item.remainingTime) > 0">&nbsp;天&nbsp;</i>
  135. <span v-if="getDay(item.remainingTime) <= 0" v-text="getHours(item.remainingTime)"></span>
  136. <i v-if="getDay(item.remainingTime) <= 0">&nbsp;小时</i>
  137. </p>
  138. <p class="remain-time" v-else><span>已截止</span></p>
  139. <!--<a v-if="!userType && item.quoted == 1">已报价</a>-->
  140. <a v-if="isSelfSeek(item)" class="self-publish" @click="setRemindText('此为贵公司的求购')">我要报价</a>
  141. <a v-if="canSayPrice(item)" @click="goSayPrice(item.itemId || item.id, index)">我要报价</a>
  142. <!--<a v-if="item.newId" class="self-publish" @click="setRemindText('您已报价')">我要报价</a>-->
  143. <a v-if="canSeeInfo(item)" @click="goSayPriceInfo(item.newId || item.quteId || item.id, item.agreed, index)">查看报价</a>
  144. </div>
  145. </template>
  146. </div>
  147. </div>
  148. </li>
  149. </ul>
  150. <empty-status v-if="!purchaseManListData || purchaseManListData.length === 0 && !isDataChange" :type="isSearch ? 'search' : 'collect'" :text="isSearch ? `抱歉,暂无与“${keyword}”匹配的求购信息` : '抱歉,暂无求购信息'" :showLink="true"></empty-status>
  151. <login-box :url="url" @onLoginBoxClose="showLoginBox = false" v-if="showLoginBox"></login-box>
  152. <say-price :showSayPriceBox="showSayPriceBox" @cancelSayPriceAction="onSayPriceCancel"></say-price>
  153. <say-price-info v-if="showSayPriceInfoBox" :agreed="agreed" @cancelSayPriceInfoAction="onSayPriceInfoCancel" :userType="userType"></say-price-info>
  154. <remind-box :title="remindText" :timeoutCount="timeoutCount"></remind-box>
  155. </div>
  156. </template>
  157. <script>
  158. import { LoginBox, RemindBox, EmptyStatus } from '~components/mobile/common'
  159. import { SayPrice, SayPriceInfo } from '~components/mobile/applyPurchase'
  160. export default {
  161. data() {
  162. return {
  163. showLoginBox: false,
  164. showSayPriceBox: false,
  165. showSayPriceInfoBox: false,
  166. activeIndex: -1,
  167. remindText: '',
  168. timeoutCount: 0,
  169. agreed: 0,
  170. purchaseManListData: [{}],
  171. url: ''
  172. }
  173. },
  174. components: {
  175. LoginBox,
  176. SayPrice,
  177. RemindBox,
  178. SayPriceInfo,
  179. EmptyStatus
  180. },
  181. props: ['userType', 'seekType', 'activeType', 'purchaseManList', 'isDataChange', 'isSearch', 'keyword'],
  182. filters: {
  183. date: function(date) {
  184. if (date) {
  185. const d = new Date(Number(date))
  186. const year = d.getFullYear()
  187. const monthTemp = d.getMonth() + 1
  188. const month = monthTemp < 10 ? '0' + monthTemp : '' + monthTemp
  189. const day =
  190. d.getDate() < 10 ? '0' + d.getDate() : '' + d.getDate() + ' '
  191. return year + '-' + month + '-' + day
  192. } else {
  193. return '-'
  194. }
  195. },
  196. enterpriseFilter([str, logged]) {
  197. if (logged) {
  198. return str
  199. } else {
  200. return str && str.length > 4
  201. ? str.substring(0, 2) +
  202. '**' +
  203. str.substring(str.length - 2, str.length)
  204. : str || '-'
  205. }
  206. },
  207. userNameFilter([str, logged]) {
  208. if (logged) {
  209. return str
  210. } else {
  211. return str ? str.substring(0, 1) + '**' : '-'
  212. }
  213. }
  214. },
  215. watch: {
  216. // 'purchaseManList': {
  217. // handler (newVal) {
  218. // if (this.purchaseManListData.length === 0) {
  219. // this.$store.dispatch('applyPurchase/loadMobileHomeList', {
  220. // pageNumber: 1,
  221. // pageSize: 5,
  222. // enUU: this.$store.state.option.user.data.enterprise ? this.$store.state.option.user.data.enterprise.uu : null
  223. // }).then(res => {
  224. // this.purchaseManListData = JSON.parse(JSON.stringify(this.purchaseManList))
  225. // console.log(this.purchaseManListData.length)
  226. // })
  227. // } else {
  228. // this.purchaseManListData = JSON.parse(JSON.stringify(this.purchaseManList))
  229. // }
  230. // },
  231. // immediate: true
  232. // }
  233. 'purchaseManList': {
  234. handler (newVal) {
  235. this.purchaseManListData = JSON.parse(JSON.stringify(this.purchaseManList))
  236. },
  237. immediate: true
  238. }
  239. },
  240. methods: {
  241. goBtobDetails (type) {
  242. this.$router.push(`/mobile/center/${this.seekType === 'enquiry' ? 'vendor' : 'user'}/seek_btob_details?id=${type}&active=${this.activeType}`)
  243. },
  244. getDay: function(timeStamp) {
  245. return Math.floor(timeStamp / (1000 * 60 * 60 * 24))
  246. },
  247. getHours: function(timeStamp) {
  248. return Math.floor((timeStamp / (1000 * 60 * 60)) % 24)
  249. },
  250. goSayPrice: function(id, index) {
  251. if (this.user.logged) {
  252. if (this.user.data.enterprise.uu) {
  253. if (
  254. this.user.data.enterprise.isVendor &&
  255. this.user.data.enterprise.isVendor !== '1690'
  256. ) {
  257. this.authorityInterceptor(this.baseUrls.vendorBusinessSayPrice, () => {
  258. this.$store.dispatch('applyPurchase/loadPurchaseManDetail', {
  259. itemId: id,
  260. enuu: this.$store.state.option.user.data.enterprise
  261. ? this.$store.state.option.user.data.enterprise.uu
  262. : null
  263. }).then(() => {
  264. this.showSayPriceBox = true
  265. this.activeIndex = index
  266. })
  267. })
  268. } else {
  269. this.setRemindText('抱歉,您需开通卖家功能才可报价')
  270. }
  271. } else {
  272. this.setRemindText('个人账户暂不可报价')
  273. }
  274. } else {
  275. this.url = this.$route.fullPath
  276. this.showLoginBox = true
  277. }
  278. return false
  279. },
  280. goSayPriceInfo: function(id, agreed, index) {
  281. this.requestSayPrice(id).then(() => {
  282. this.agreed = agreed
  283. this.showSayPriceInfoBox = true
  284. this.activeIndex = index
  285. }, err => {
  286. console.log(err)
  287. this.setRemindText('获取报价信息失败')
  288. })
  289. // '/mobile/applyPurchase/list/' + (userType ? (item.quteId || item.id) + '?type=' + userType : (item.quteId || item.id)) + (userType ? '&' : '?') + 'status=' + item.agreed
  290. },
  291. requestSayPrice: function (id) {
  292. if (this.userType === 'buyer') {
  293. return this.$store.dispatch('applyPurchase/loadBuyerInquiryDetail', {
  294. id: id
  295. })
  296. } else {
  297. return this.$store.dispatch('applyPurchase/loadVendorInquiryDetail', {
  298. id: id,
  299. enuu: this.user.data.enterprise.uu,
  300. useruu: this.user.data.userUU
  301. })
  302. }
  303. },
  304. onSayPriceCancel: function(flag, quteId) {
  305. if (flag) {
  306. this.purchaseManListData[this.activeIndex].quoted = 1
  307. this.purchaseManListData[this.activeIndex].quteId = quteId
  308. this.setRemindText('感谢您参与报价,敬请期待回复')
  309. }
  310. this.showSayPriceBox = false
  311. },
  312. onSayPriceInfoCancel: function(flag) {
  313. if (flag) {
  314. this.purchaseManListData[this.activeIndex].agreed = 1
  315. this.setRemindText('采纳成功')
  316. }
  317. this.showSayPriceInfoBox = false
  318. },
  319. setRemindText: function(str) {
  320. this.remindText = str
  321. this.timeoutCount++
  322. },
  323. isSelfSeek: function (item) {
  324. return !this.userType && item.remainingTime > 0 && (!item.quoted || item.quoted !== 1) && (this.user.logged && ((item.inquiry && item.inquiry.enterprise && this.user.data.enterprise && (item.inquiry.enterprise.uu === this.user.data.enterprise.uu)) || (!this.user.data.enterprise.uu && item.userUU === this.user.data.userUU && !item.inquiry.enterprise)))
  325. },
  326. canSayPrice: function (item) {
  327. return !item.newId && (!(this.userType === 'saler' && this.activeType && this.activeType !== 'todo') && (item.remainingTime > 0 && (!item.quoted || item.quoted !== 1) && !(this.user.logged && ((item.inquiry && item.inquiry.enterprise && this.user.data.enterprise && (item.inquiry.enterprise.uu === this.user.data.enterprise.uu)) || (!this.user.data.enterprise.uu && item.userUU === this.user.data.userUU)))))
  328. },
  329. canSeeInfo: function (item) {
  330. return ((!this.userType || this.userType === 'buyer') && (this.activeType && this.activeType !== 'todo')) || (this.userType === 'saler' && this.activeType && this.activeType !== 'todo') || item.quoted === 1 || item.newId
  331. }
  332. }
  333. }
  334. </script>
  335. <style lang="scss" scoped>
  336. .seek-list {
  337. padding: .13rem .12rem 0;
  338. background: #f1f3f6;
  339. li.clearfix {
  340. border: 1px solid #e0e0e4;
  341. /*height: 4.2rem;*/
  342. margin: auto;
  343. margin-bottom: .2rem;
  344. max-width: 7.3rem;
  345. background: #fff;
  346. > p {
  347. font-size: .28rem;
  348. color: #3a3a3a;
  349. font-weight: bold;
  350. /*background: #f8f7fa;*/
  351. height: .92rem;
  352. line-height: .92rem;
  353. span {
  354. display: block;
  355. width: 6.9rem;
  356. border-bottom: 1px solid #d3d3d3;
  357. margin: 0 auto;
  358. }
  359. }
  360. > div {
  361. font-size: .28rem;
  362. .remain-time {
  363. font-size: .28rem;
  364. text-align: center;
  365. span {
  366. font-size: .35rem;
  367. color: #ff3208;
  368. }
  369. i {
  370. font-style: normal;
  371. }
  372. }
  373. .content {
  374. overflow: hidden;
  375. text-overflow: ellipsis;
  376. white-space: nowrap;
  377. padding: 0 .18rem;
  378. line-height: .46rem;
  379. span {
  380. color: #333;
  381. }
  382. }
  383. .fl {
  384. color: #666;
  385. width: 50%;
  386. /*height: 2.62rem;*/
  387. line-height: .46rem;
  388. margin: .27rem 0;
  389. border-right: 1px dashed #9f9f9f;
  390. .remain-time {
  391. margin-top: .41rem;
  392. }
  393. }
  394. .fr {
  395. width: 50%;
  396. padding: .9rem 0 0 0;
  397. &.is-qutation {
  398. margin: .27rem 0;
  399. padding: 0 .18rem;
  400. color: #666;
  401. .more-btn {
  402. width: 3.2rem;
  403. margin: 0 auto;
  404. color: #fff;
  405. font-size: .28rem;
  406. height: .54rem;
  407. background: #3f84f6;
  408. border-radius: .08rem;
  409. }
  410. }
  411. &.is-simple {
  412. margin-top: .73rem;
  413. .more-btn {
  414. margin-top: .38rem;
  415. }
  416. }
  417. &.no-btn {
  418. padding-top: 0;
  419. line-height: 3.18rem;
  420. }
  421. a {
  422. display: block;
  423. width: 1.7rem;
  424. height: .47rem;
  425. line-height: .47rem;
  426. text-align: center;
  427. font-size: .28rem;
  428. color: #fff;
  429. background: #3f84f6;
  430. margin: .34rem auto 0;
  431. border-radius: .05rem;
  432. vertical-align: middle;
  433. &.self-publish {
  434. background: rgb(204, 203, 203);
  435. color: #fff;
  436. border-color: #fff;
  437. }
  438. }
  439. }
  440. .date {
  441. color: #e6353d !important;
  442. }
  443. }
  444. .no-quot {
  445. .fl {
  446. width: 70%;
  447. }
  448. .fr {
  449. width: 30%;
  450. }
  451. }
  452. }
  453. }
  454. .none-state {
  455. text-align: center;
  456. margin-top: 1.1rem;
  457. img {
  458. width: 4.08rem;
  459. height: 2.62rem;
  460. }
  461. p {
  462. font-size: .32rem;
  463. color: #999;
  464. margin: 1.19rem 0 0 0;
  465. }
  466. }
  467. </style>