ApplyInfo.vue 19 KB

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