ApplyInfo.vue 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565
  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>
  13. <span>发布时间
  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>买家</span>
  20. <span>型号</span>
  21. <span>品牌</span>
  22. <span>截止时间
  23. <a href="javascript:void(0)" @click="sortListByParam('deadline')">
  24. <i class=" fa fa-long-arrow-up" :class="{active: sorting.deadline == 'ASC'}"></i>
  25. <i class=" fa fa-long-arrow-down" :class="{active: sorting.deadline == 'DESC'}"></i>
  26. </a>
  27. </span>
  28. <span>已报价
  29. <a href="javascript:void(0)" @click="sortListByParam('offerAmount')">
  30. <i class=" fa fa-long-arrow-up" :class="{active: sorting.offerAmount == 'ASC'}"></i>
  31. <i class=" fa fa-long-arrow-down" :class="{active: sorting.offerAmount == 'DESC'}"></i>
  32. </a>
  33. </span>
  34. <span>操作</span>
  35. </p>
  36. <ul>
  37. <li v-for="purchaseMan in purchaseManList.content" :class="{'active': purchaseMan.active}">
  38. <span>{{purchaseMan.releaseDate | date}}</span>
  39. <span :title="getPurchaseManName(purchaseMan)">{{getPurchaseManName(purchaseMan)}}</span>
  40. <span :title="purchaseMan.code">{{purchaseMan.code}}</span>
  41. <span :title="purchaseMan.brand">{{purchaseMan.brand}}</span>
  42. <span class="date-content"><span>剩余&nbsp;</span><span v-text="getDay(purchaseMan.remainingTime)"></span>&nbsp;天&nbsp;<span v-text="getHours(purchaseMan.remainingTime)"></span>&nbsp;小时</span>
  43. <span class="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;条</span>
  44. <span class="btn-content">
  45. <a>联系买家</a>
  46. <a @click="sayPrice(purchaseMan)">我要报价</a>
  47. </span>
  48. <div class="expand-content">
  49. <div>
  50. 生产日期:{{purchaseMan.produceDate || '-'}}
  51. </div>
  52. <div>
  53. 封装:{{purchaseMan.encapsulation || '-'}}
  54. </div>
  55. <div>
  56. 采购数量:<span>{{purchaseMan.amount || '-'}}</span><span v-if="purchaseMan.amount">个</span>
  57. </div>
  58. <div>
  59. 单价预算:<span>{{purchaseMan.unitPrice ? (purchaseMan.currency == 'RMB' ? '¥' : '$') + purchaseMan.unitPrice : '-'}}</span>
  60. </div>
  61. </div>
  62. <div class="say-price">
  63. <div>报价</div>
  64. <div>
  65. <i>*</i>单价
  66. <!-- <select v-model="sayPriceObj.currency">
  67. <option value="RMB">¥</option>
  68. <option value="USD">$</option>
  69. </select>-->
  70. <div v-text="purchaseMan.currency == 'RMB' ? '¥' : '$'"></div>
  71. <input type="text" v-model="sayPriceObj.unitPrice" class="form-control">
  72. </div>
  73. <div>
  74. <i>*</i>交期&nbsp;
  75. <input type="number" v-model="sayPriceObj.minDay" @blur="onMinDayInput" class="form-control">&nbsp;-&nbsp;<input type="number" v-model="sayPriceObj.maxDay" @blur="onMaxDayInput" class="form-control">&nbsp;天
  76. </div>
  77. <div>
  78. 生产日期&nbsp;<input v-model="sayPriceObj.produceDate" type="text" class="form-control">
  79. </div>
  80. <div>
  81. <span @click="cancelSayPrice(purchaseMan)">取消</span>
  82. <span @click="commitSayPrice(purchaseMan)">提交</span>
  83. </div>
  84. </div>
  85. </li>
  86. </ul>
  87. </div>
  88. <page :total="totalCount" :page-size="pageSize"
  89. :current="nowPage" v-on:childEvent="listenPage"></page>
  90. </div>
  91. </template>
  92. <script>
  93. import Page from '~components/common/page/pageComponent.vue'
  94. export default {
  95. data () {
  96. return {
  97. pageSize: 10,
  98. nowPage: 1,
  99. sayPriceObj: {
  100. currency: 'RMB',
  101. unitPrice: '',
  102. minDay: '',
  103. maxDay: '',
  104. produceDate: '',
  105. spId: ''
  106. },
  107. keyWord: '',
  108. sorting: {}
  109. }
  110. },
  111. components: {
  112. Page
  113. },
  114. filters: {
  115. date: function (date) {
  116. const d = new Date(Number(date))
  117. const year = d.getFullYear()
  118. const monthTemp = d.getMonth() + 1
  119. const month = monthTemp < 10 ? '0' + monthTemp : '' + monthTemp
  120. const hour = d.getHours() < 10 ? '0' + d.getHours() : '' + d.getHours()
  121. const minutes = d.getMinutes() < 10 ? '0' + d.getMinutes() : '' + d.getMinutes() + ' '
  122. const day = d.getDate() < 10 ? '0' + d.getDate() : '' + d.getDate() + ' '
  123. return year + '-' + month + '-' + day + ' ' + hour + ':' + minutes
  124. },
  125. phone: function (str) {
  126. return str.substring(0, 3) + '****' + str.substring(7, 11)
  127. }
  128. },
  129. computed: {
  130. purchaseManList () {
  131. return this.$store.state.applyPurchase.purchaseManList.purchaseManList.data
  132. },
  133. totalCount () {
  134. return this.purchaseManList.totalElements
  135. },
  136. user () {
  137. return this.$store.state.option.user
  138. }
  139. },
  140. methods: {
  141. getDay: function (timeStamp) {
  142. return Math.floor(timeStamp / (1000 * 60 * 60 * 24))
  143. },
  144. getHours: function (timeStamp) {
  145. return Math.floor((timeStamp / (1000 * 60 * 60)) % 24)
  146. },
  147. getPurchaseManName: function (purchaseMan) {
  148. return purchaseMan.enUu ? purchaseMan.userName : purchaseMan.userName.charAt(0) + '**'
  149. },
  150. listenPage: function (page) {
  151. this.nowPage = page
  152. this.resetList()
  153. },
  154. sayPrice: function (purchaseMan) {
  155. let _this = this
  156. for (let i = 0; i < this.purchaseManList.content.length; i++) {
  157. _this.purchaseManList.content[i].active = false
  158. }
  159. purchaseMan.active = true
  160. },
  161. cancelSayPrice: function (purchaseMan) {
  162. purchaseMan.active = false
  163. },
  164. commitSayPrice: function (purchaseMan) {
  165. if (this.user.logged) {
  166. let valid = this.sayPriceObj.currency && this.sayPriceObj.unitPrice && this.sayPriceObj.minDay && this.sayPriceObj.maxDay
  167. if (valid) {
  168. this.sayPriceObj.spId = purchaseMan.id
  169. this.sayPriceObj.currency = purchaseMan.currency
  170. this.$http.post('/seek/offer/saveOffer', this.sayPriceObj).then(response => {
  171. this.$message.success('报价成功')
  172. this.nowPage = 1
  173. this.resetSayPrice()
  174. this.resetList()
  175. }, error => {
  176. console.log(error)
  177. this.$message.error('系统错误')
  178. })
  179. } else {
  180. this.$message.error('请填写正确的信息')
  181. }
  182. } else {
  183. this.$router.push('/auth/login')
  184. }
  185. },
  186. resetList: function () {
  187. this.$store.dispatch('applyPurchase/loadPurchaseManList', {page: this.nowPage, count: this.pageSize, keyWord: this.keyWord, sorting: !this.sorting || JSON.stringify(this.sorting) === '{}' ? {releaseDate: 'DESC'} : this.sorting})
  188. },
  189. resetSayPrice: function () {
  190. this.sayPriceObj = {
  191. currency: 'RMB',
  192. unitPrice: '',
  193. minDay: '',
  194. maxDay: '',
  195. produceDate: '',
  196. spId: ''
  197. }
  198. },
  199. onMinDayInput: function () {
  200. this.sayPriceObj.minDay = Math.floor(this.sayPriceObj.minDay)
  201. if (this.sayPriceObj.maxDay) {
  202. if (this.sayPriceObj.maxDay < this.sayPriceObj.minDay) {
  203. this.sayPriceObj.minDay = this.sayPriceObj.maxDay
  204. }
  205. } else if (this.sayPriceObj.minDay < 0) {
  206. this.sayPriceObj.minDay = 0
  207. }
  208. },
  209. onMaxDayInput: function () {
  210. this.sayPriceObj.maxDay = Math.floor(this.sayPriceObj.maxDay)
  211. if (this.sayPriceObj.minDay) {
  212. if (this.sayPriceObj.maxDay < this.sayPriceObj.minDay) {
  213. this.sayPriceObj.maxDay = this.sayPriceObj.minDay
  214. }
  215. } else if (this.sayPriceObj.maxDay < 0) {
  216. this.sayPriceObj.maxDay = 0
  217. }
  218. },
  219. searchList: function () {
  220. this.resetList()
  221. },
  222. sortListByParam: function (param) {
  223. if (this.sorting[param]) {
  224. if (this.sorting[param] === 'ASC') {
  225. this.$set(this.sorting, param, 'DESC')
  226. } else {
  227. this.$delete(this.sorting, param)
  228. }
  229. } else {
  230. this.sorting = {}
  231. this.$set(this.sorting, param, 'ASC')
  232. }
  233. this.resetList()
  234. }
  235. }
  236. }
  237. </script>
  238. <style lang="scss" scoped>
  239. .apply-info {
  240. width: 1190px;
  241. margin: 0 auto;
  242. .apply-info-title {
  243. border-bottom: 1px solid #3975f4;
  244. >p {
  245. display: inline-block;
  246. width: 156px;
  247. height: 33px;
  248. line-height: 33px;
  249. color: #fff;
  250. background: #3975f4;
  251. font-size: 18px;
  252. text-align: center;
  253. border: {
  254. top-left-radius: 3px;
  255. top-right-radius: 3px;
  256. }
  257. margin: 0;
  258. }
  259. >span {
  260. color: #999;
  261. margin-left: 16px;
  262. }
  263. >div {
  264. float: right;
  265. height: 25px;
  266. line-height: 25px;
  267. >input {
  268. width: 241px;
  269. height: 25px;
  270. line-height: 25px;
  271. font-size: 13px;
  272. border: {
  273. top-right-radius: 0;
  274. bottom-right-radius: 0;
  275. }
  276. }
  277. >span {
  278. display: inline-block;
  279. width: 69px;
  280. color: #fff;
  281. background: #3975f4;
  282. text-align: center;
  283. margin: 0 6px 0 -1px;
  284. border: {
  285. top-right-radius: 3px;
  286. bottom-right-radius: 3px;
  287. }
  288. cursor: pointer;
  289. }
  290. >a {
  291. background: #ffa200;
  292. color: #fff;
  293. width: 79px;
  294. border-radius: 3px;
  295. text-align: center;
  296. display: inline-block;
  297. }
  298. }
  299. }
  300. .apply-info-list {
  301. >p {
  302. background: #ededed;
  303. height: 40px;
  304. line-height: 40px;
  305. margin: 9px 0 0 0;
  306. span {
  307. display: inline-block;
  308. text-align: center;
  309. a {
  310. i {
  311. color: #333;
  312. &.active {
  313. color: #5078cb;
  314. }
  315. }
  316. }
  317. &:nth-child(1) {
  318. width: 186px;
  319. }
  320. &:nth-child(2) {
  321. width: 106px;
  322. }
  323. &:nth-child(3) {
  324. width: 200px;
  325. }
  326. &:nth-child(4) {
  327. width: 174px;
  328. }
  329. &:nth-child(5) {
  330. width: 152px;
  331. }
  332. &:nth-child(6) {
  333. width: 158px;
  334. }
  335. &:nth-child(7) {
  336. width: 214px;
  337. }
  338. }
  339. }
  340. >ul {
  341. margin-bottom: 29px;
  342. li {
  343. min-height: 67px;
  344. line-height: 67px;
  345. border: 1px solid #ededed;
  346. >span {
  347. overflow: hidden;
  348. text-overflow: ellipsis;
  349. white-space: nowrap;
  350. display: inline-block;
  351. text-align: center;
  352. color: #3c3c3c;
  353. vertical-align: middle;
  354. &:nth-child(1) {
  355. width: 186px;
  356. }
  357. &:nth-child(2) {
  358. width: 106px;
  359. }
  360. &:nth-child(3) {
  361. width: 200px;
  362. }
  363. &:nth-child(4) {
  364. width: 174px;
  365. }
  366. &:nth-child(5) {
  367. width: 152px;
  368. }
  369. &:nth-child(6) {
  370. width: 158px;
  371. }
  372. &:nth-child(7) {
  373. width: 212px;
  374. }
  375. &.date-content {
  376. span {
  377. &:first-child {
  378. font-size: 12px;
  379. color: #666;
  380. }
  381. color: #f71026;
  382. }
  383. }
  384. &.number-content {
  385. span {
  386. color: #5392f9;
  387. &.active {
  388. color: #ff9a00;
  389. }
  390. }
  391. >img {
  392. margin-bottom: 5px;
  393. margin-right: 2px;
  394. }
  395. }
  396. &.btn-content {
  397. a {
  398. display: inline-block;
  399. width: 71px;
  400. height: 28px;
  401. line-height: 28px;
  402. color: #fff;
  403. background: #3c7cf5;
  404. border-radius: 3px;
  405. cursor: pointer;
  406. &:first-child {
  407. background: #ffa200;
  408. margin-right: 10px;
  409. }
  410. }
  411. }
  412. }
  413. .expand-content {
  414. display: none;
  415. justify-content: space-between;
  416. padding: 0 236px 0 36px;
  417. background: #fffbf0;
  418. height: 45px;
  419. line-height: 45px;
  420. color: #020202;
  421. div {
  422. display: inline-block;
  423. span {
  424. color: #f71026;
  425. }
  426. }
  427. }
  428. &:hover {
  429. box-shadow: 1.5px 3px 7px 0 rgb( 178, 178, 179 );
  430. .expand-content {
  431. display: flex;
  432. }
  433. }
  434. .say-price {
  435. background-color: #e7eef9;
  436. display: none;
  437. >div {
  438. display: inline-block;
  439. position: relative;
  440. height: 64px;
  441. line-height: 64px;
  442. input {
  443. border-radius: 3px;
  444. }
  445. &:nth-child(1) {
  446. width: 282px;
  447. background: url('/images/applyPurchase/say-price.png')no-repeat;
  448. text-align: center;
  449. margin-right: 44px;
  450. }
  451. &:nth-child(2) {
  452. margin-right: 39px;
  453. input {
  454. width: 118px;
  455. height: 26px;
  456. border: 1px solid #5392f9;
  457. }
  458. /*select {
  459. position: absolute;
  460. top: 19px;
  461. width: 32px;
  462. height: 26px;
  463. background: url('/images/applyPurchase/arrow-down.png')no-repeat right center;
  464. -webkit-box-shadow: none;
  465. -moz-box-shadow: none;
  466. box-shadow: none;
  467. border: {
  468. left: none;
  469. top: none;
  470. bottom: none;
  471. right: 1px solid #5392f9;
  472. bottom-left-radius: 4px;
  473. top-left-radius: 4px;
  474. }
  475. color: #5392f9;
  476. font: small-caption;
  477. padding-left: 3px;
  478. & + input {
  479. padding-left: 34px;
  480. }
  481. }*/
  482. div {
  483. position: absolute;
  484. top: 19px;
  485. left: 38px;
  486. width: 32px;
  487. height: 26px;
  488. line-height: 26px;
  489. text-align: center;
  490. border: {
  491. left: none;
  492. top: none;
  493. bottom: none;
  494. right: 1px solid #5392f9;
  495. bottom-left-radius: 4px;
  496. top-left-radius: 4px;
  497. }
  498. color: #5392f9;
  499. & + input {
  500. padding-left: 34px;
  501. }
  502. }
  503. }
  504. &:nth-child(3) {
  505. margin-right: 37px;
  506. input {
  507. width: 32px;
  508. height: 26px;
  509. }
  510. }
  511. &:nth-child(4) {
  512. margin-right: 132px;
  513. input {
  514. width: 118px;
  515. height: 26px;
  516. }
  517. }
  518. &:nth-child(5) {
  519. span {
  520. width: 71px;
  521. height: 28px;
  522. line-height: 28px;
  523. text-align: center;
  524. display: inline-block;
  525. cursor: pointer;
  526. &:first-child {
  527. background: #dedddd;
  528. margin-right: 10px;
  529. }
  530. &:last-child {
  531. background: #fa4701;
  532. color: #fff;
  533. }
  534. }
  535. }
  536. i {
  537. color: #e41515;
  538. position: relative;
  539. top: 2px;
  540. right: 3px;
  541. }
  542. }
  543. }
  544. &.active {
  545. border-color: #f71026;
  546. box-shadow: none;
  547. .expand-content {
  548. display: flex;
  549. -webkit-box-shadow: none;
  550. -moz-box-shadow: none;
  551. box-shadow: none;
  552. }
  553. .say-price {
  554. display: block;
  555. }
  556. }
  557. }
  558. }
  559. }
  560. .page-wrap {
  561. text-align: right;
  562. float: none;
  563. }
  564. }
  565. </style>