ApplyInfo.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488
  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 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 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">
  42. <div :title="purchaseMan.inbrand" class="fl"><span>类目:</span>{{purchaseMan.inbrand || '-'}}</div>
  43. <div :title="purchaseMan.inbrand" class="fl"><span>品牌:</span>{{purchaseMan.inbrand || '-'}}</div>
  44. <div :title="purchaseMan.cmpCode" class="fl"><span>型号:</span>{{purchaseMan.cmpCode || '-'}}</div>
  45. <div :title="purchaseMan.cmpCode" class="fl"><span>规格:</span>{{purchaseMan.spec || '-'}}</div>
  46. </div>
  47. <div class="il-box-small">
  48. <div :title="purchaseMan.cmpCode" class="fl"><span>封装:</span>{{purchaseMan.encapsulation || '-'}}</div>
  49. <div :title="purchaseMan.cmpCode" class="fl"><span>采购数量:</span>{{purchaseMan.needquantity || '-'}}</div>
  50. <div :title="purchaseMan.cmpCode" class="fl"><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. /*vertical-align: middle;*/
  287. border: {
  288. top-right-radius: 3px;
  289. bottom-right-radius: 3px;
  290. }
  291. cursor: pointer;
  292. }
  293. >a {
  294. background: #ffa200;
  295. color: #fff;
  296. width: 79px;
  297. border-radius: 3px;
  298. text-align: center;
  299. display: inline-block;
  300. }
  301. }
  302. }
  303. .apply-info-list {
  304. .list-title {
  305. background: #ededed;
  306. height: 40px;
  307. line-height: 40px;
  308. margin: 9px 0 0 0;
  309. .list-title-item {
  310. display: inline-block;
  311. text-align: center;
  312. .fa {
  313. color: #333;
  314. &.active {
  315. color: #5078cb;
  316. }
  317. }
  318. &:nth-child(1) {
  319. margin-left: 21px;
  320. }
  321. &:nth-child(2) {
  322. margin-left: 290px;
  323. }
  324. &:nth-child(3) {
  325. margin-left: 480px;
  326. }
  327. &:nth-child(4) {
  328. margin-left: 44px;
  329. }
  330. }
  331. }
  332. >ul {
  333. margin-bottom: 29px;
  334. > li {
  335. position: relative;
  336. border: 1px solid #ededed;
  337. .il-item {
  338. height: 120px;
  339. display: inline-block;
  340. text-align: center;
  341. color: #3c3c3c;
  342. padding-top: 16px;
  343. vertical-align: middle;
  344. > div {
  345. display: inline-block;
  346. span {
  347. color: #999;
  348. }
  349. }
  350. &.il-left {
  351. margin-left: 17px;
  352. div {
  353. display: block;
  354. &:last-child {
  355. margin-top: 37px;
  356. color: #666;
  357. }
  358. }
  359. }
  360. &.il-center {
  361. margin-left: 47px;
  362. text-align: left;
  363. .fl {
  364. overflow: hidden;
  365. white-space: nowrap;
  366. text-overflow: ellipsis;
  367. }
  368. .il-box-large {
  369. width: 420px;
  370. .fl {
  371. width: 209px;
  372. height: 38px;
  373. line-height: 19px;
  374. }
  375. }
  376. .il-box-small {
  377. width: 250px;
  378. .fl {
  379. width: 121px;
  380. &:nth-child(n + 2) {
  381. margin-top: 14px;
  382. }
  383. }
  384. }
  385. }
  386. .date-content {
  387. span {
  388. &:first-child {
  389. font-size: 12px;
  390. color: #666;
  391. }
  392. color: #f71026;
  393. }
  394. i {
  395. font-style: normal;
  396. }
  397. }
  398. .number-content {
  399. span {
  400. color: #5392f9;
  401. &.active {
  402. color: #ff9a00;
  403. }
  404. }
  405. >img {
  406. margin-bottom: 5px;
  407. margin-right: 2px;
  408. }
  409. }
  410. .btn-content {
  411. >div a {
  412. display: inline-block;
  413. width: 71px;
  414. height: 28px;
  415. line-height: 28px;
  416. color: #fff;
  417. background: #3c7cf5;
  418. border-radius: 3px;
  419. cursor: pointer;
  420. /* &:first-child {
  421. background: #ffa200;
  422. float: left;
  423. margin-top: 19px;
  424. }*/
  425. }
  426. .is-say-price {
  427. display: inline-block;
  428. color: #39ae05;
  429. margin-left: 11px;
  430. img {
  431. margin-bottom: 2px;
  432. }
  433. }
  434. }
  435. }
  436. }
  437. }
  438. .empty{
  439. text-align: center;
  440. height: 200px;
  441. line-height: 200px;
  442. border: 1px solid #e8e8e8;
  443. margin-bottom: 10px;
  444. span {
  445. color: #999;
  446. margin-left: 10px;
  447. }
  448. }
  449. }
  450. .page-wrap {
  451. text-align: right;
  452. float: none;
  453. }
  454. .link-saler-box {
  455. width: 289px;
  456. height: auto;
  457. min-height: auto;
  458. border-radius: 2px;
  459. .title {
  460. background-color: #4290f7;
  461. height: 22px;
  462. line-height: 22px;
  463. margin-bottom: 20px;
  464. }
  465. .content {
  466. p {
  467. line-height: 20px;
  468. padding-top: 0;
  469. i {
  470. color: #4290f7;
  471. margin-right: 4px;
  472. }
  473. span {
  474. color: #f62d37;
  475. }
  476. }
  477. div {
  478. a {
  479. width: 78px;
  480. background: #4290f7;
  481. margin: 18px 0 13px 0;
  482. border-radius: 2px;
  483. }
  484. }
  485. }
  486. }
  487. }
  488. </style>