PublishApply.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540
  1. <template>
  2. <div class="publish-apply">
  3. <div class="good-purchaser">
  4. <p class="good-purchaser-title">
  5. <img src="/images/applyPurchase/good-purchaser-title.png" alt="">
  6. </p>
  7. <ul>
  8. <li v-for="(goodMan, index) in goodPurchaseMan.content">
  9. <i v-text="index + 1" :style="'background: url(/images/applyPurchase/level-' + getRankBg(index) + '.png) center no-repeat;'"></i>
  10. <span v-text="goodMan.name"></span>
  11. </li>
  12. </ul>
  13. </div>
  14. <div class="publish-area">
  15. <div class="publish-form-area">
  16. <p>单个发布</p>
  17. <div>
  18. <div class="form-item">
  19. <span>
  20. <i>*</i>型号:
  21. </span>
  22. <input type="text" class="form-control" :class="{'error': !validObj.code}" v-model="applyObj.code" maxlength="30" @blur="checkCode" />
  23. </div>
  24. <div class="form-item">
  25. <span>
  26. <i>*</i>品牌:
  27. </span>
  28. <input type="text" class="form-control" :class="{'error': !validObj.brand}" maxlength="20" v-model="applyObj.brand" @blur="checkBrand" />
  29. </div>
  30. <div class="form-item">
  31. <span>
  32. 单价预算:
  33. </span>
  34. <select v-model="applyObj.currency">
  35. <option value="RMB">¥</option>
  36. <option value="USD">$</option>
  37. </select>
  38. <input type="number" class="form-control" :class="{'error': !validObj.unitPrice}" v-model="applyObj.unitPrice" @blur="checkUnitPrice" @input="onUnitPriceInput" />
  39. </div>
  40. <div class="form-item">
  41. <span>
  42. 封装:
  43. </span>
  44. <input type="text" class="form-control" maxlength="20" v-model="applyObj.encapsulation" />
  45. </div>
  46. <div class="form-item">
  47. <span>
  48. 生产日期:
  49. </span>
  50. <input type="text" class="form-control" v-model="applyObj.produceDate" />
  51. </div>
  52. <div class="form-item">
  53. <span>
  54. 采购数量:
  55. </span>
  56. <input type="number" class="form-control" :class="{'error': !validObj.amount}" v-model="applyObj.amount" @blur="checkAmount" @input="onAmountInput" />
  57. </div>
  58. <div class="form-item">
  59. <span>
  60. <i>*</i>截止日期:
  61. </span>
  62. <!--<input type="text" class="form-control" readonly :class="{'error': !validObj.deadline}" v-model="applyObj.deadline" @blur="checkDeadline" />-->
  63. <el-date-picker
  64. v-model="applyObj.deadline"
  65. type="date"
  66. :picker-options="pickerOptions"
  67. :class="{'error': !validObj.deadline}"
  68. size="mini">
  69. </el-date-picker>
  70. </div>
  71. </div>
  72. <a @click="goPublish()">发布求购</a>
  73. </div>
  74. <div class="publish-upload">
  75. <h1>批量发布</h1>
  76. <h2>3秒一键配单采购</h2>
  77. <img src="/images/applyPurchase/upload.png" alt="" />
  78. <h3>把Excel格式的BOM拖放到框中</h3>
  79. <img class="download-line" src="/images/applyPurchase/download.png" alt="">
  80. <img class="apply-logo" src="/images/applyPurchase/publish-apply.png" alt="">
  81. </div>
  82. </div>
  83. <div class="apply-rank">
  84. <table>
  85. <thead>
  86. <tr>
  87. <th width="62">排名</th>
  88. <th width="124">求购型号</th>
  89. <th width="57">数量</th>
  90. <th width="72">求购次数</th>
  91. </tr>
  92. </thead>
  93. <tbody>
  94. <tr v-for="(rank, index) in purchaseRank">
  95. <td><div>NO.<span>{{index + 1}}</span><i>|</i></div></td>
  96. <td :title="rank.spCode"><div><span>{{rank.spCode}}</span><i>|</i></div></td>
  97. <td :title="rank.spAmount"><div><span>{{rank.spAmount}}</span><i>|</i></div></td>
  98. <td :title="rank.uuAmount"><div>{{rank.uuAmount}}</div></td>
  99. </tr>
  100. </tbody>
  101. </table>
  102. </div>
  103. <!--提示框-->
  104. <div class="com-del-box" v-if="showRemindBox">
  105. <div class="title">
  106. <a @click="showRemindBox = false"><i class="fa fa-close fa-lg"></i></a>
  107. </div>
  108. <div class="content">
  109. <!--<p style="line-height: 20px;margin-top: 10px;padding:0 10px">非常抱歉,目前暂无此品牌!<br>若直接前往“品牌申请”,我们将为您先开通寄售功能,待申请通过后再提交开店申请。</p>-->
  110. <!--<p style="line-height: 20px;">前往<a @click="goBrandApply()" target="_blank" style="color: #5078CB">品牌申请&nbsp;<i class="fa fa-arrow-right"></i></a></p>-->
  111. <p><img src="/images/applyPurchase/check.png" alt="">发布成功</p>
  112. <p>其中 <span>100</span>个求购型号有现货在售,您可前往“<span>买家中心-我的求购</span>”查询并直接购买</p>
  113. <div>
  114. <a @click="showRemindBox = false">我知道了</a>
  115. <a href="javascript:void(0)">前往我的求购</a>
  116. </div>
  117. </div>
  118. </div>
  119. </div>
  120. </template>
  121. <script>
  122. export default {
  123. data () {
  124. return {
  125. applyObj: {
  126. code: '',
  127. brand: '',
  128. unitPrice: '',
  129. currency: 'RMB',
  130. encapsulation: '',
  131. produceDate: '',
  132. amount: '',
  133. deadline: ''
  134. },
  135. validObj: {
  136. code: true,
  137. brand: true,
  138. unitPrice: true,
  139. // encapsulation: true,
  140. // produceDate: true,
  141. amount: true
  142. // deadline: true,
  143. },
  144. pickerOptions: {
  145. disabledDate (time) {
  146. // 大于等于今天 小于三个月后
  147. return time.getTime() < Date.now() - 1000 * 60 * 60 * 24 || time.getTime() > Date.now() + 1000 * 60 * 60 * 24 * 30 * 3
  148. }
  149. },
  150. showRemindBox: false
  151. }
  152. },
  153. computed: {
  154. goodPurchaseMan () {
  155. return this.$store.state.applyPurchase.goodPurchaseMan.goodPurchaseMan.data
  156. },
  157. purchaseRank () {
  158. return this.$store.state.applyPurchase.purchaseApplyRank.purchaseApplyRank.data
  159. },
  160. user () {
  161. return this.$store.state.option.user
  162. }
  163. },
  164. methods: {
  165. emptyForm: function () {
  166. for (let attr in this.applyObj) {
  167. this.applyObj[attr] = attr === 'currency' ? 'RMB' : ''
  168. }
  169. },
  170. getRankBg: function (index) {
  171. return index === 0 ? 1 : index < 3 ? 2 : 3
  172. },
  173. goPublish: function () {
  174. if (this.user.logged) {
  175. if (this.checkAll()) {
  176. this.$http.post('/seek/saveOneSeekPurchase', this.applyObj)
  177. .then(response => {
  178. this.$message.success('发布成功')
  179. // this.showRemindBox = true
  180. this.emptyForm()
  181. this.$store.dispatch('applyPurchase/loadPurchaseManList', {page: 1, count: 10})
  182. }, error => {
  183. console.log(error)
  184. this.$message.error('发布失败')
  185. })
  186. } else {
  187. this.$message.error('请填写正确的信息')
  188. }
  189. } else {
  190. this.$router.push('/auth/login')
  191. }
  192. },
  193. checkCode: function () {
  194. this.validObj.code = this.applyObj.code && this.applyObj.code !== ''
  195. return this.validObj.code
  196. },
  197. checkBrand: function () {
  198. this.validObj.brand = this.applyObj.brand && this.applyObj.brand !== ''
  199. return this.validObj.brand
  200. },
  201. checkUnitPrice: function () {
  202. this.validObj.unitPrice = this.applyObj.unitPrice === '' ? true : this.applyObj.unitPrice > 0 && this.applyObj.unitPrice < 100000000
  203. return this.validObj.unitPrice
  204. },
  205. // checkEncapsulation: function () {
  206. // this.validObj.encapsulation = this.applyObj.encapsulation && this.applyObj.encapsulation !== ''
  207. // },
  208. // checkProduceDate: function () {
  209. // this.validObj.produceDate = this.applyObj.produceDate && this.applyObj.produceDate !== ''
  210. // },
  211. checkAmount: function () {
  212. this.validObj.amount = this.applyObj.amount === '' ? true : this.applyObj.amount > 0 && this.applyObj.amount < 100000000
  213. return this.validObj.amount
  214. },
  215. checkAll: function () {
  216. return this.checkCode() && this.checkBrand() && this.checkUnitPrice() && this.checkAmount() && this.checkDeadline()
  217. },
  218. checkDeadline: function () {
  219. this.validObj.deadline = this.applyObj.deadline && this.applyObj.deadline !== ''
  220. return this.validObj.deadline
  221. },
  222. onUnitPriceInput: function () {
  223. if (this.applyObj.unitPrice < 0) {
  224. this.applyObj.unitPrice = 0
  225. } else if (this.applyObj.unitPrice.toString().indexOf('.') !== -1 && this.applyObj.unitPrice.toString().split('.')[1].length > 6) {
  226. this.applyObj.unitPrice = Number(this.applyObj.unitPrice).toFixed(6)
  227. }
  228. },
  229. onAmountInput: function () {
  230. if (this.applyObj.amount < 0) {
  231. this.applyObj.amount = 0
  232. }
  233. }
  234. }
  235. }
  236. </script>
  237. <style lang="scss" scoped>
  238. .publish-apply {
  239. background: url('/images/applyPurchase/banner.png') center center/cover no-repeat;
  240. height: 583px;
  241. text-align: center;
  242. padding-top: 290px;
  243. >div {
  244. display: inline-block;
  245. border: 1px solid #3975f4;
  246. height: 267px;
  247. margin-right: 6px;
  248. vertical-align: middle;
  249. background: #fff;
  250. }
  251. .good-purchaser {
  252. width: 225px;
  253. .good-purchaser-title {
  254. height: 55px;
  255. line-height: 55px;
  256. background: #3975f4;
  257. margin: 0;
  258. }
  259. ul {
  260. padding: 0 22px 0 10px;
  261. li {
  262. line-height: 42px;
  263. span {
  264. float: right;
  265. display: inline-block;
  266. width: 152px;
  267. overflow: hidden;
  268. text-overflow: ellipsis;
  269. white-space: nowrap;
  270. }
  271. i {
  272. display: inline-block;
  273. float: left;
  274. width: 25px;
  275. color: #fff;
  276. font-size: 16px;
  277. font-style: normal;
  278. }
  279. }
  280. }
  281. }
  282. .publish-area {
  283. width: 549px;
  284. .publish-form-area {
  285. width: 243px;
  286. float: left;
  287. height: 100%;
  288. p {
  289. padding-top: 18px;
  290. font-size: 26px;
  291. color: #3975f4;
  292. margin-bottom: 7px;
  293. }
  294. >div {
  295. text-align: left;
  296. margin-left: 14px;
  297. .form-item {
  298. margin-bottom: 5px;
  299. span {
  300. width: 80px;
  301. text-align: right;
  302. display: inline-block;
  303. i {
  304. position: relative;
  305. top: 2px;
  306. right: 3px;
  307. color: #e41515;
  308. }
  309. }
  310. select {
  311. width: 32px;
  312. position: absolute;
  313. height: 20px;
  314. background: url('/images/applyPurchase/select.png')no-repeat right;
  315. & + input {
  316. padding-left: 34px;
  317. }
  318. }
  319. input {
  320. width: 111px;
  321. height: 20px;
  322. line-height: 20px;
  323. border-radius: 2px;
  324. padding: 0 3px;
  325. box-shadow: none;
  326. -webkit-box-shadow: none;
  327. -moz-box-shadow: none;
  328. &.error {
  329. border-color: #f4645f!important;
  330. }
  331. }
  332. }
  333. }
  334. >a {
  335. width: 90px;
  336. height: 25px;
  337. line-height: 25px;
  338. background: #3975f4;
  339. color: #fefefe;
  340. font-size: 16px;
  341. display: block;
  342. margin: 0 auto;
  343. border-radius: 3px;
  344. cursor: pointer;
  345. }
  346. }
  347. .publish-upload {
  348. background: url('/images/applyPurchase/publish-apply-bg.png')no-repeat;
  349. background-size: cover;
  350. width: 304px;
  351. height: 100%;
  352. padding-left: 22px;
  353. float: right;
  354. color: #fff;
  355. position: relative;
  356. h1 {
  357. font-size: 26px;
  358. margin: 22px 0 0 0;
  359. }
  360. h2 {
  361. font-size: 16px;
  362. margin: 10px 0 23px 0;
  363. }
  364. h3 {
  365. font-size: 16px;
  366. margin: 20px 0 13px 0;
  367. }
  368. .download-line {
  369. cursor: pointer;
  370. }
  371. .apply-logo {
  372. position: absolute;
  373. left: -20px;
  374. top: 86px;
  375. }
  376. }
  377. }
  378. .apply-rank {
  379. width: 317px;
  380. margin-right: 0;
  381. background: url('/images/applyPurchase/rank-title.png') no-repeat;
  382. background-color: #fff;
  383. background-size: 319px 74px;
  384. background-position: -3px -2px;
  385. table {
  386. margin: 76px auto 0;
  387. width: 98%;
  388. thead {
  389. background: #e0e0e0;
  390. height: 26px;
  391. line-height: 26px;
  392. border-radius: 3px;
  393. tr {
  394. th {
  395. font-size: 16px;
  396. font-weight: bold;
  397. text-align: center;
  398. }
  399. }
  400. }
  401. tbody {
  402. tr {
  403. height: 25px;
  404. line-height: 25px;
  405. &:first-child {
  406. td {
  407. padding-top: 10px;
  408. }
  409. }
  410. td {
  411. &:nth-child(1) {
  412. color: #f6682f;
  413. font-size: 12px;
  414. >div {
  415. width: 62px;
  416. span {
  417. font-size: 16px;
  418. }
  419. }
  420. }
  421. &:nth-child(2) {
  422. >div {
  423. width: 122px;
  424. }
  425. }
  426. &:nth-child(3) {
  427. >div {
  428. width: 55px;
  429. }
  430. }
  431. &:nth-child(4) {
  432. >div {
  433. width: 72px;
  434. }
  435. }
  436. >div {
  437. overflow: hidden;
  438. text-overflow: ellipsis;
  439. white-space: nowrap;
  440. padding: 0 8px;
  441. position: relative;
  442. i {
  443. font-style: normal;
  444. float: right;
  445. color: #8b8b8b;
  446. font-size: 14px;
  447. position: absolute;
  448. right: 0;
  449. }
  450. }
  451. }
  452. }
  453. }
  454. }
  455. }
  456. .com-del-box{
  457. position: fixed;
  458. z-index: 1000;
  459. height: auto;
  460. opacity: 1;
  461. background-color: white;
  462. width: 310px;
  463. -webkit-box-shadow: 0 5px 15px rgba(0,0,0,.5);
  464. -moz-box-shadow: 0 5px 15px rgba(0,0,0,.5);
  465. -o-box-shadow: 0 5px 15px rgba(0,0,0,.5);
  466. box-shadow: 0 5px 15px rgba(0,0,0,.5);
  467. margin: -155px 0 0 -75px;
  468. top: 55%;
  469. left: 43%;
  470. .title{
  471. height: 24px;
  472. background-color: #007aff;
  473. text-align: right;
  474. padding-right: 15px;
  475. line-height: 24px;
  476. a{
  477. color: white;
  478. font-size: 12px;
  479. }
  480. }
  481. .content{
  482. width: 100%;
  483. text-align: center;
  484. margin: 0 auto;
  485. p{
  486. padding: 12px 31px;
  487. margin: 0;
  488. i{
  489. color: #5078cb;
  490. font-size: 16px;
  491. margin-right: 10px;
  492. }
  493. span {
  494. color: #007aff;
  495. }
  496. &:last-child {
  497. font-size: 12px;
  498. }
  499. }
  500. div{
  501. width: 100%;
  502. text-align: center;
  503. margin: 0 auto 20px;
  504. a{
  505. padding: 0 19px;
  506. height: 26px;
  507. line-height: 26px;
  508. display: inline-block;
  509. text-align: center;
  510. font-size: 14px;
  511. color: #fff;
  512. &:first-child{
  513. background: #c8c6c6;
  514. margin-right: 10px;
  515. }
  516. &:last-child{
  517. background: #007aff;
  518. }
  519. }
  520. }
  521. }
  522. }
  523. }
  524. .el-date-editor--date{
  525. width: 110px;
  526. &.error {
  527. input {
  528. border: 1px solid #f4645f !important;
  529. }
  530. }
  531. }
  532. .el-icon-date {
  533. display: none;
  534. }
  535. .el-input__inner {
  536. height: 20px;
  537. border-radius: 0;
  538. border: 1px solid #c9c9c9;
  539. }
  540. </style>