ApplyInfo.vue 15 KB

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