PublishApply.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553
  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. if (!this.validObj.code) {
  188. this.$message.error('型号不能为空')
  189. } else if (!this.validObj.brand) {
  190. this.$message.error('品牌不能为空')
  191. } else if (!this.validObj.deadline) {
  192. this.$message.error('截止日期不能为空')
  193. } else if (!this.validObj.amount || !this.validObj.unitPrice) {
  194. this.$message.error('请输入正确的数值')
  195. }
  196. // this.$message.error('请填写正确的信息')
  197. }
  198. } else {
  199. this.$router.push('/auth/login?returnUrl=' + window.location.href)
  200. }
  201. },
  202. checkCode: function () {
  203. this.validObj.code = this.applyObj.code && this.applyObj.code !== ''
  204. return this.validObj.code
  205. },
  206. checkBrand: function () {
  207. this.validObj.brand = this.applyObj.brand && this.applyObj.brand !== ''
  208. return this.validObj.brand
  209. },
  210. checkUnitPrice: function () {
  211. this.validObj.unitPrice = this.applyObj.unitPrice === '' ? true : this.applyObj.unitPrice > 0 && this.applyObj.unitPrice < 100000000
  212. return this.validObj.unitPrice
  213. },
  214. // checkEncapsulation: function () {
  215. // this.validObj.encapsulation = this.applyObj.encapsulation && this.applyObj.encapsulation !== ''
  216. // },
  217. // checkProduceDate: function () {
  218. // this.validObj.produceDate = this.applyObj.produceDate && this.applyObj.produceDate !== ''
  219. // },
  220. checkAmount: function () {
  221. this.validObj.amount = this.applyObj.amount === '' ? true : this.applyObj.amount > 0 && this.applyObj.amount < 100000000
  222. return this.validObj.amount
  223. },
  224. checkAll: function () {
  225. return this.checkCode() && this.checkBrand() && this.checkUnitPrice() && this.checkAmount() && this.checkDeadline()
  226. },
  227. checkDeadline: function () {
  228. this.validObj.deadline = this.applyObj.deadline && this.applyObj.deadline !== ''
  229. return this.validObj.deadline
  230. },
  231. onUnitPriceInput: function () {
  232. if (this.applyObj.unitPrice < 0) {
  233. this.applyObj.unitPrice = 0
  234. } else if (this.applyObj.unitPrice.toString().indexOf('.') !== -1 && this.applyObj.unitPrice.toString().split('.')[1].length > 6) {
  235. this.applyObj.unitPrice = Number(this.applyObj.unitPrice).toFixed(6)
  236. }
  237. },
  238. onAmountInput: function () {
  239. if (this.applyObj.amount < 0) {
  240. this.applyObj.amount = 0
  241. }
  242. }
  243. }
  244. }
  245. </script>
  246. <style lang="scss" scoped>
  247. .publish-apply {
  248. background: url('/images/applyPurchase/banner.png') center center/cover no-repeat;
  249. height: 583px;
  250. text-align: center;
  251. padding-top: 290px;
  252. >div {
  253. display: inline-block;
  254. border: 1px solid #3975f4;
  255. height: 267px;
  256. margin-right: 6px;
  257. vertical-align: middle;
  258. background: #fff;
  259. }
  260. .good-purchaser {
  261. width: 225px;
  262. .good-purchaser-title {
  263. height: 55px;
  264. line-height: 55px;
  265. background: #3975f4;
  266. margin: 0;
  267. }
  268. ul {
  269. padding: 0 22px 0 10px;
  270. li {
  271. line-height: 42px;
  272. span {
  273. float: right;
  274. display: inline-block;
  275. width: 152px;
  276. overflow: hidden;
  277. text-overflow: ellipsis;
  278. white-space: nowrap;
  279. }
  280. i {
  281. display: inline-block;
  282. float: left;
  283. width: 25px;
  284. color: #fff;
  285. font-size: 16px;
  286. font-style: normal;
  287. }
  288. }
  289. }
  290. }
  291. .publish-area {
  292. width: 549px;
  293. .publish-form-area {
  294. width: 243px;
  295. float: left;
  296. height: 100%;
  297. p {
  298. padding-top: 18px;
  299. font-size: 26px;
  300. color: #3975f4;
  301. margin-bottom: 7px;
  302. }
  303. >div {
  304. text-align: left;
  305. margin-left: 14px;
  306. .form-item {
  307. margin-bottom: 5px;
  308. span {
  309. width: 80px;
  310. text-align: right;
  311. display: inline-block;
  312. i {
  313. position: relative;
  314. top: 2px;
  315. right: 3px;
  316. color: #e41515;
  317. }
  318. }
  319. select {
  320. width: 32px;
  321. position: absolute;
  322. height: 20px;
  323. background: url('/images/applyPurchase/select.png')no-repeat right;
  324. background-position-x: 15px;
  325. padding: 0 0 0 3px;
  326. & + input {
  327. padding-left: 34px;
  328. }
  329. }
  330. input {
  331. width: 111px;
  332. height: 20px;
  333. line-height: 20px;
  334. border-radius: 2px;
  335. padding: 0 3px;
  336. box-shadow: none;
  337. -webkit-box-shadow: none;
  338. -moz-box-shadow: none;
  339. &.error {
  340. border-color: #f4645f!important;
  341. }
  342. }
  343. }
  344. }
  345. >a {
  346. width: 90px;
  347. height: 25px;
  348. line-height: 25px;
  349. background: #3975f4;
  350. color: #fefefe;
  351. font-size: 16px;
  352. display: block;
  353. margin: 0 auto;
  354. border-radius: 3px;
  355. cursor: pointer;
  356. }
  357. }
  358. .publish-upload {
  359. background: url('/images/applyPurchase/publish-apply-bg.png')no-repeat;
  360. background-size: cover;
  361. width: 304px;
  362. height: 100%;
  363. padding-left: 22px;
  364. float: right;
  365. color: #fff;
  366. position: relative;
  367. h1 {
  368. font-size: 26px;
  369. margin: 22px 0 0 0;
  370. }
  371. h2 {
  372. font-size: 16px;
  373. margin: 10px 0 23px 0;
  374. }
  375. h3 {
  376. font-size: 16px;
  377. margin: 20px 0 13px 0;
  378. }
  379. .download-line {
  380. cursor: pointer;
  381. }
  382. .apply-logo {
  383. position: absolute;
  384. left: -20px;
  385. top: 86px;
  386. }
  387. }
  388. }
  389. .apply-rank {
  390. width: 317px;
  391. margin-right: 0;
  392. background: url('/images/applyPurchase/rank-title.png') no-repeat;
  393. background-color: #fff;
  394. background-size: 319px 74px;
  395. background-position: -3px -2px;
  396. table {
  397. margin: 76px auto 0;
  398. width: 98%;
  399. thead {
  400. background: #e0e0e0;
  401. height: 26px;
  402. line-height: 26px;
  403. border-radius: 3px;
  404. tr {
  405. th {
  406. font-size: 16px;
  407. font-weight: bold;
  408. text-align: center;
  409. }
  410. }
  411. }
  412. tbody {
  413. tr {
  414. height: 25px;
  415. line-height: 25px;
  416. &:first-child {
  417. td {
  418. padding-top: 10px;
  419. }
  420. }
  421. td {
  422. padding-bottom: 5px;
  423. color: #666;
  424. &:nth-child(1) {
  425. color: #f6682f;
  426. font-size: 12px;
  427. >div {
  428. width: 62px;
  429. span {
  430. font-size: 16px;
  431. }
  432. }
  433. }
  434. &:nth-child(2) {
  435. >div {
  436. width: 122px;
  437. }
  438. }
  439. &:nth-child(3) {
  440. >div {
  441. width: 55px;
  442. }
  443. }
  444. &:nth-child(4) {
  445. >div {
  446. width: 72px;
  447. }
  448. }
  449. >div {
  450. overflow: hidden;
  451. text-overflow: ellipsis;
  452. white-space: nowrap;
  453. padding: 0 8px;
  454. position: relative;
  455. i {
  456. font-style: normal;
  457. float: right;
  458. color: #8b8b8b;
  459. font-size: 14px;
  460. position: absolute;
  461. right: 0;
  462. }
  463. }
  464. }
  465. }
  466. }
  467. }
  468. }
  469. .com-del-box{
  470. position: fixed;
  471. z-index: 1000;
  472. height: auto;
  473. opacity: 1;
  474. background-color: white;
  475. width: 310px;
  476. -webkit-box-shadow: 0 5px 15px rgba(0,0,0,.5);
  477. -moz-box-shadow: 0 5px 15px rgba(0,0,0,.5);
  478. -o-box-shadow: 0 5px 15px rgba(0,0,0,.5);
  479. box-shadow: 0 5px 15px rgba(0,0,0,.5);
  480. margin: -155px 0 0 -75px;
  481. top: 55%;
  482. left: 43%;
  483. .title{
  484. height: 24px;
  485. background-color: #007aff;
  486. text-align: right;
  487. padding-right: 15px;
  488. line-height: 24px;
  489. a{
  490. color: white;
  491. font-size: 12px;
  492. }
  493. }
  494. .content{
  495. width: 100%;
  496. text-align: center;
  497. margin: 0 auto;
  498. p{
  499. padding: 12px 31px;
  500. margin: 0;
  501. i{
  502. color: #5078cb;
  503. font-size: 16px;
  504. margin-right: 10px;
  505. }
  506. span {
  507. color: #007aff;
  508. }
  509. &:last-child {
  510. font-size: 12px;
  511. }
  512. }
  513. div{
  514. width: 100%;
  515. text-align: center;
  516. margin: 0 auto 20px;
  517. a{
  518. padding: 0 19px;
  519. height: 26px;
  520. line-height: 26px;
  521. display: inline-block;
  522. text-align: center;
  523. font-size: 14px;
  524. color: #fff;
  525. &:first-child{
  526. background: #c8c6c6;
  527. margin-right: 10px;
  528. }
  529. &:last-child{
  530. background: #007aff;
  531. }
  532. }
  533. }
  534. }
  535. }
  536. }
  537. .el-date-editor--date{
  538. width: 110px;
  539. &.error {
  540. input {
  541. border: 1px solid #f4645f !important;
  542. }
  543. }
  544. }
  545. .el-icon-date {
  546. display: none;
  547. }
  548. .el-input__inner {
  549. height: 20px;
  550. border-radius: 0;
  551. border: 1px solid #c9c9c9;
  552. }
  553. </style>