SeekList.vue 20 KB

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