ApplyInfo.vue 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539
  1. <template>
  2. <div class="apply-info">
  3. <div class="apply-info-title">
  4. <p>最新求购信息</p>
  5. <span>海量求购,一网打尽</span>
  6. <div>
  7. <input type="text" class="form-control" v-model="keyWord" @keyup.13="searchList" placeholder="型号/品牌" />
  8. <span @click="searchList">查询</span>
  9. </div>
  10. </div>
  11. <div class="apply-info-list">
  12. <p class="list-title">
  13. <span class="list-title-item">买家/发布时间
  14. <!--<a href="javascript:void(0)" @click="sortListByParam('releaseDate')">
  15. <i class=" fa fa-long-arrow-up" :class="{active: sorting.releaseDate == 'ASC'}"></i>
  16. <i class=" fa fa-long-arrow-down" :class="{active: sorting.releaseDate == 'DESC'}"></i>
  17. </a>-->
  18. </span>
  19. <span class="list-title-item">产品信息</span>
  20. <span class="list-title-item">已报价
  21. <!--<a href="javascript:void(0)" @click="sortListByParam('offerAmount')">
  22. <i class=" fa fa-long-arrow-up" :class="{active: sorting.offerAmount == 'ASC'}"></i>
  23. <i class=" fa fa-long-arrow-down" :class="{active: sorting.offerAmount == 'DESC'}"></i>
  24. </a>-->
  25. </span>
  26. <span class="list-title-item">截止时间
  27. <!--<a href="javascript:void(0)" @click="sortListByParam('deadline')">
  28. <i class=" fa fa-long-arrow-up" :class="{active: sorting.deadline == 'ASC'}"></i>
  29. <i class=" fa fa-long-arrow-down" :class="{active: sorting.deadline == 'DESC'}"></i>
  30. </a>-->
  31. </span>
  32. </p>
  33. <ul v-if="purchaseManList.content && purchaseManList.content.length">
  34. <li v-for="(purchaseMan, index) in purchaseManList.content" :class="{'active': purchaseMan.active}">
  35. <div class="il-item il-left">
  36. <div class="item" v-if="purchaseMan.inquiry.enterprise && purchaseMan.inquiry.enterprise.enName" :title="user.logged ? purchaseMan.inquiry.enterprise.enName : null">{{[purchaseMan.inquiry.enterprise.enName, user] | enterpriseFilter}}</div>
  37. <div class="item" v-else :title="user.logged ? purchaseMan.userName : null">{{[purchaseMan.userName, user] | userNameFilter}}</div>
  38. <div>{{purchaseMan.date| date}}</div>
  39. </div>
  40. <div class="il-item il-center">
  41. <div class="il-box-large il-box">
  42. <div :title="purchaseMan.prodTitle | nullFilter" class="fl item size-middle"><span>类目:</span><div class="content">{{(purchaseMan.prodTitle || '-') | nullFilter}}</div></div>
  43. <div :title="purchaseMan.cmpCode" class="fl item"><span>型号:</span><div class="content">{{purchaseMan.cmpCode || '-'}}</div></div>
  44. <div :title="purchaseMan.inbrand" class="fl item bottom size-middle"><span>品牌:</span><div class="content">{{purchaseMan.inbrand || '-'}}</div></div>
  45. <div :title="purchaseMan.spec" class="fl item bottom"><span>规格:</span><div class="content">{{purchaseMan.spec || '-'}}</div></div>
  46. </div>
  47. <div class="il-box-small il-box">
  48. <div :title="purchaseMan.encapsulation" class="item"><span>封装:</span>{{purchaseMan.encapsulation || '-'}}</div>
  49. <div :title="purchaseMan.produceDate" class="item"><span>生产日期:</span>{{purchaseMan.produceDate || '-'}}</div>
  50. <div :title="purchaseMan.needquantity" class="item"><span>采购数量:</span>{{purchaseMan.needquantity || '-'}}</div>
  51. <div :title="purchaseMan.unitPrice ? (purchaseMan.currency == 'RMB' ? '¥' : '$') + purchaseMan.unitPrice : '-'" class="item"><span>单价预算:</span>{{purchaseMan.unitPrice ? (purchaseMan.currency == 'RMB' ? '¥' : '$') + purchaseMan.unitPrice : '-'}}</div>
  52. </div>
  53. </div>
  54. <div class="il-item number-content"><img src="/images/applyPurchase/hot-fire.png" alt="" v-if="purchaseMan.offerAmount > 10"><span :style="purchaseMan.offerAmount > 10 ? 'color: #ff9a00': ''">{{purchaseMan.offerAmount || 0}}</span>&nbsp;条</div>
  55. <div class="il-item il-right">
  56. <div class="date-content">
  57. <div v-if="purchaseMan.remainingTime > 0">
  58. <span>剩余&nbsp;</span>
  59. <span v-if="getDay(purchaseMan.remainingTime) > 0" v-text="getDay(purchaseMan.remainingTime)"></span>
  60. <i v-if="getDay(purchaseMan.remainingTime) > 0">&nbsp;天&nbsp;</i>
  61. <span v-if="getDay(purchaseMan.remainingTime) <= 0" v-text="getHours(purchaseMan.remainingTime)"></span>
  62. <i v-if="getDay(purchaseMan.remainingTime) <= 0" >&nbsp;小时</i>
  63. </div>
  64. <span v-if="!purchaseMan.remainingTime || purchaseMan.remainingTime <= 0">已截止</span>
  65. </div>
  66. <div class="btn-content">
  67. <!--<a @click="setLinkBoxIndex(index)">联系买家</a>-->
  68. <!--判断该求购是自己的-->
  69. <div class="is-say-price" v-if="purchaseMan.remainingTime > 0 && purchaseMan.quoted == 1">已报价 <img src="/images/applyPurchase/green-check.png" alt=""></div>
  70. <div v-else>
  71. <a title="该求购已截止" v-if="!purchaseMan.remainingTime || purchaseMan.remainingTime <= 0" style="background: #cccbcb;" @click="sayPriceStop">我要报价</a>
  72. <a title="此为贵公司的求购" v-if="purchaseMan.remainingTime > 0 && (!purchaseMan.quoted || purchaseMan.quoted != 1) && (user.logged && ((purchaseMan.inquiry.enterprise && user.data.enterprise && (purchaseMan.inquiry.enterprise.uu === user.data.enterprise.uu)) || (!user.data.enterprise.uu && purchaseMan.userUU == user.data.userUU && !purchaseMan.inquiry.enterprise)))" style="background: #cccbcb;" @click="sayPriceSeft">我要报价</a>
  73. <a v-if="purchaseMan.remainingTime > 0 && (!purchaseMan.quoted || purchaseMan.quoted != 1) && !(user.logged && ((purchaseMan.inquiry.enterprise && user.data.enterprise && (purchaseMan.inquiry.enterprise.uu === user.data.enterprise.uu)) || (!user.data.enterprise.uu && purchaseMan.userUU == user.data.userUU && !purchaseMan.inquiry.enterprise)))" @click="sayPrice(purchaseMan, index)">我要报价</a>
  74. </div>
  75. </div>
  76. </div>
  77. </li>
  78. </ul>
  79. <div class="empty" v-else>
  80. <img src="/images/all/empty-cart.png">
  81. <span>暂无搜索结果</span>
  82. </div>
  83. </div>
  84. <say-price :current="currentSayPriceIndex"
  85. :purchase="purchaseManList"
  86. @cancelSayPriceAction="cancelSayPrice"
  87. @resetListAction="resetList"
  88. @sayPriceIndexAction="setIndex(index)"
  89. ></say-price>
  90. <page :total="totalCount" :page-size="pageSize"
  91. :current="nowPage" v-on:childEvent="listenPage"></page>
  92. <div class="com-del-box link-saler-box" v-if="linkBoxIndex > -1">
  93. <div class="title">
  94. <i @click="setLinkBoxIndex(-1)"></i>
  95. </div>
  96. <div class="content">
  97. <p><i class="fa fa-exclamation-circle"></i>抱歉,暂时无法与买家在线沟通!</p>
  98. <p>买家联系电话:<span v-text="purchaseManList.content[linkBoxIndex].userTel"></span></p>
  99. <div>
  100. <a @click="setLinkBoxIndex(-1)">我知道了</a>
  101. </div>
  102. </div>
  103. </div>
  104. </div>
  105. </template>
  106. <script>
  107. import Page from '~components/common/page/pageComponent.vue'
  108. import SayPrice from './SayPrice.vue'
  109. import { checkNullStr } from '~utils/baseUtils'
  110. export default {
  111. data () {
  112. return {
  113. pageSize: 10,
  114. nowPage: 1,
  115. keyWord: '',
  116. sorting: {},
  117. currentSayPriceIndex: -1,
  118. linkBoxIndex: -1
  119. }
  120. },
  121. components: {
  122. Page,
  123. SayPrice
  124. },
  125. filters: {
  126. date: function (date) {
  127. const d = new Date(Number(date))
  128. const year = d.getFullYear()
  129. const monthTemp = d.getMonth() + 1
  130. const month = monthTemp < 10 ? '0' + monthTemp : '' + monthTemp
  131. const hour = d.getHours() < 10 ? '0' + d.getHours() : '' + d.getHours()
  132. const minutes = d.getMinutes() < 10 ? '0' + d.getMinutes() : '' + d.getMinutes() + ' '
  133. const day = d.getDate() < 10 ? '0' + d.getDate() : '' + d.getDate() + ' '
  134. return year + '-' + month + '-' + day + ' ' + hour + ':' + minutes
  135. },
  136. phone: function (str) {
  137. return str ? (str.substring(0, 3) + '****' + str.substring(7, 11)) : '-'
  138. },
  139. enterpriseFilter ([str, user]) {
  140. if (!user.logged) {
  141. return str ? str.length > 4 ? str.substring(0, 2) + '**' + str.substring(str.length - 2, str.length) : str : '-'
  142. } else {
  143. return str || '-'
  144. }
  145. },
  146. userNameFilter ([str, user]) {
  147. if (!user.logged) {
  148. return str ? str.substring(0, 1) + '**' : '-'
  149. } else {
  150. return str || '-'
  151. }
  152. },
  153. nullFilter (str) {
  154. return checkNullStr(str) ? str : '-'
  155. }
  156. },
  157. computed: {
  158. purchaseManList () {
  159. return this.$store.state.applyPurchase.purchaseManList.purchaseManList.data
  160. },
  161. totalCount () {
  162. return this.purchaseManList.totalElements
  163. },
  164. user () {
  165. return this.$store.state.option.user
  166. }
  167. },
  168. methods: {
  169. setIndex: function (index) {
  170. this.currentSayPriceIndex = index
  171. },
  172. getDay: function (timeStamp) {
  173. return Math.floor(timeStamp / (1000 * 60 * 60 * 24))
  174. },
  175. getHours: function (timeStamp) {
  176. return Math.floor((timeStamp / (1000 * 60 * 60)) % 24)
  177. },
  178. listenPage: function (page) {
  179. this.nowPage = page
  180. this.resetList()
  181. },
  182. sayPrice: function (purchaseMan, index) {
  183. // let _this = this
  184. // for (let i = 0; i < this.purchaseManList.content.length; i++) {
  185. // _this.purchaseManList.content[i].active = false
  186. // }
  187. if (this.user.logged) {
  188. if (this.user.data.enterprise.uu) {
  189. if (this.user.data.enterprise.isVendor && this.user.data.enterprise.isVendor !== '1690') {
  190. // this.resetSayPrice()
  191. purchaseMan.active = true
  192. this.currentSayPriceIndex = index
  193. } else {
  194. this.$message.error('抱歉,您需开通卖家功能才可报价')
  195. }
  196. } else {
  197. this.$message.error('个人账户暂不可报价')
  198. }
  199. } else {
  200. this.$router.push('/auth/login?returnUrl=' + window.location.href)
  201. }
  202. },
  203. cancelSayPrice: function () {
  204. this.purchaseManList.content[this.currentSayPriceIndex].active = false
  205. this.currentSayPriceIndex = -1
  206. },
  207. resetList: function () {
  208. this.currentSayPriceIndex = -1
  209. this.$store.dispatch('applyPurchase/loadPurchaseManList', {pageNumber: this.nowPage, pageSize: this.pageSize, keyword: this.keyWord, sorting: !this.sorting || JSON.stringify(this.sorting) === '{}' ? {releaseDate: 'DESC'} : this.sorting, enUU: this.user.data.enterprise ? this.user.data.enterprise.uu : null})
  210. },
  211. searchList: function () {
  212. this.nowPage = 1
  213. this.resetList()
  214. },
  215. sayPriceStop: function () {
  216. this.$message.error('该求购已截止')
  217. },
  218. sayPriceSeft: function () {
  219. this.$message.error('此为贵公司的求购')
  220. },
  221. sortListByParam: function (param) {
  222. if (this.sorting[param]) {
  223. if (this.sorting[param] === 'ASC') {
  224. this.$set(this.sorting, param, 'DESC')
  225. } else {
  226. this.$delete(this.sorting, param)
  227. }
  228. } else {
  229. this.sorting = {}
  230. this.$set(this.sorting, param, 'ASC')
  231. }
  232. this.nowPage = 1
  233. this.resetList()
  234. },
  235. setLinkBoxIndex: function (index) {
  236. if (!this.user.logged) {
  237. this.$router.push('/auth/login?returnUrl=' + window.location.href)
  238. } else {
  239. this.linkBoxIndex = index
  240. }
  241. }
  242. }
  243. }
  244. </script>
  245. <style lang="scss" scoped>
  246. .apply-info {
  247. width: 1190px;
  248. margin: 0 auto;
  249. .apply-info-title {
  250. border-bottom: 1px solid #3975f4;
  251. >p {
  252. display: inline-block;
  253. width: 156px;
  254. height: 33px;
  255. line-height: 33px;
  256. color: #fff;
  257. background: #3975f4;
  258. font-size: 18px;
  259. text-align: center;
  260. border: {
  261. top-left-radius: 3px;
  262. top-right-radius: 3px;
  263. }
  264. margin: 0;
  265. }
  266. >span {
  267. color: #999;
  268. margin-left: 16px;
  269. }
  270. >div {
  271. float: right;
  272. height: 33px;
  273. line-height: 33px;
  274. >input {
  275. width: 241px;
  276. height: 33px;
  277. line-height: 33px;
  278. font-size: 13px;
  279. border: {
  280. top-right-radius: 0;
  281. bottom-right-radius: 0;
  282. }
  283. }
  284. >span {
  285. display: inline-block;
  286. width: 69px;
  287. color: #fff;
  288. background: #3975f4;
  289. text-align: center;
  290. margin: 0 6px 0 -1px;
  291. height: 33px;
  292. /*vertical-align: middle;*/
  293. border: {
  294. top-right-radius: 3px;
  295. bottom-right-radius: 3px;
  296. }
  297. cursor: pointer;
  298. }
  299. >a {
  300. background: #ffa200;
  301. color: #fff;
  302. width: 79px;
  303. border-radius: 3px;
  304. text-align: center;
  305. display: inline-block;
  306. }
  307. }
  308. }
  309. .apply-info-list {
  310. .list-title {
  311. background: #e2ebff;
  312. height: 40px;
  313. line-height: 40px;
  314. margin: 9px 0 0 0;
  315. .list-title-item {
  316. display: inline-block;
  317. text-align: center;
  318. .fa {
  319. color: #333;
  320. &.active {
  321. color: #5078cb;
  322. }
  323. }
  324. &:nth-child(1) {
  325. margin-left: 76px;
  326. }
  327. &:nth-child(2) {
  328. margin-left: 345px;
  329. }
  330. &:nth-child(3) {
  331. margin-left: 399px;
  332. }
  333. &:nth-child(4) {
  334. margin-left: 71px;
  335. }
  336. }
  337. }
  338. >ul {
  339. margin-bottom: 29px;
  340. > li {
  341. position: relative;
  342. border: 1px solid #ededed;
  343. &.active {
  344. border: 1px solid #4290f7;
  345. box-shadow: 2px 4px 5px 0 rgb( 205, 221, 252 );
  346. }
  347. &:hover {
  348. border: 1px solid #4290f7;
  349. box-shadow: 2px 4px 5px 0 rgb( 205, 221, 252 );
  350. }
  351. .il-item {
  352. height: 120px;
  353. display: inline-block;
  354. text-align: center;
  355. color: #3c3c3c;
  356. padding-top: 16px;
  357. vertical-align: middle;
  358. .item {
  359. display: inline-block;
  360. overflow: hidden;
  361. text-overflow: ellipsis;
  362. white-space: nowrap;
  363. span {
  364. color: #999;
  365. }
  366. }
  367. &.il-left {
  368. width: 236px;
  369. padding: 16px 10px 0;
  370. div {
  371. display: block;
  372. &:last-child {
  373. margin-top: 37px;
  374. color: #666;
  375. }
  376. }
  377. }
  378. &.il-center {
  379. text-align: left;
  380. width: 654px;
  381. .il-box {
  382. display: inline-block;
  383. float: left;
  384. span {
  385. color: #999;
  386. }
  387. }
  388. .il-box-large {
  389. width: 482px;
  390. .fl {
  391. width: 284px;
  392. line-height: 19px;
  393. word-break: break-all;
  394. white-space: unset;
  395. &.bottom {
  396. margin-top: 14px;
  397. }
  398. .content {
  399. display: inline-block;
  400. width: 220px;
  401. overflow: hidden;
  402. vertical-align: middle;
  403. height: 38px;
  404. }
  405. span {
  406. float: left;
  407. }
  408. &.size-middle {
  409. width: 136px;
  410. margin-right: 37px;
  411. .content {
  412. width: 86px;
  413. }
  414. }
  415. }
  416. }
  417. .il-box-small {
  418. width: 151px;
  419. margin-left: 12px;
  420. .item {
  421. color: #020202;
  422. width: 151px;
  423. margin-bottom: 6px;
  424. }
  425. }
  426. }
  427. &.il-right {
  428. width: 100px;
  429. .date-content {
  430. margin-top: 14px;
  431. margin-bottom: 17px;
  432. span {
  433. &:first-child {
  434. font-size: 12px;
  435. color: #666;
  436. }
  437. color: #f71026;
  438. }
  439. i {
  440. font-style: normal;
  441. }
  442. }
  443. .btn-content {
  444. >div a {
  445. display: inline-block;
  446. width: 71px;
  447. height: 28px;
  448. line-height: 28px;
  449. color: #fff;
  450. background: #3c7cf5;
  451. border-radius: 3px;
  452. cursor: pointer;
  453. /* &:first-child {
  454. background: #ffa200;
  455. float: left;
  456. margin-top: 19px;
  457. }*/
  458. }
  459. .is-say-price {
  460. display: inline-block;
  461. color: #39ae05;
  462. margin-left: 11px;
  463. img {
  464. margin-bottom: 2px;
  465. }
  466. }
  467. }
  468. }
  469. }
  470. .number-content {
  471. margin-left: 56px;
  472. line-height: 120px;
  473. padding-top: 0;
  474. width: 77px;
  475. margin-right: 34px;
  476. span {
  477. color: #5392f9;
  478. &.active {
  479. color: #ff9a00;
  480. }
  481. }
  482. >img {
  483. margin-bottom: 5px;
  484. margin-right: 2px;
  485. }
  486. }
  487. }
  488. }
  489. .empty{
  490. text-align: center;
  491. height: 200px;
  492. line-height: 200px;
  493. border: 1px solid #e8e8e8;
  494. margin-bottom: 10px;
  495. span {
  496. color: #999;
  497. margin-left: 10px;
  498. }
  499. }
  500. }
  501. .page-wrap {
  502. text-align: right;
  503. float: none;
  504. }
  505. .link-saler-box {
  506. width: 289px;
  507. height: auto;
  508. min-height: auto;
  509. border-radius: 2px;
  510. .title {
  511. background-color: #4290f7;
  512. height: 22px;
  513. line-height: 22px;
  514. margin-bottom: 20px;
  515. }
  516. .content {
  517. p {
  518. line-height: 20px;
  519. padding-top: 0;
  520. i {
  521. color: #4290f7;
  522. margin-right: 4px;
  523. }
  524. span {
  525. color: #f62d37;
  526. }
  527. }
  528. div {
  529. a {
  530. width: 78px;
  531. background: #4290f7;
  532. margin: 18px 0 13px 0;
  533. border-radius: 2px;
  534. }
  535. }
  536. }
  537. }
  538. }
  539. </style>