ApplyInfo.vue 16 KB

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