SeekList.vue 19 KB

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