ApplyInfo.vue 19 KB

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