| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153 |
- <template>
- <div class="result">
- <div class="container" v-if="state == 'success'">
- <p>发布求购</p>
- <img src="/images/applyPurchase/batch-success.png" alt="">
- <h1>发布成功</h1>
- <h2>成功发布 <span>{{count}}</span> 条求购</h2>
- <div class="footer1">前往 <a href="/user#/seekPurchase">买家中心-我的求购</a> <span>{{timer}}s</span></div>
- <div class="footer2">返回 <a @click="go('/')">商城首页</a> | <a @click="go('/applyPurchase')">求购首页</a></div>
- </div>
- <div class="container" v-else>
- <p>发布求购</p>
- <img src="/images/applyPurchase/batch-error.png" alt="">
- <h1>上传失败</h1>
- <h2>请完善产品信息</h2>
- <div class="footer1">立刻
- <label>
- <input type="file" @change="upload" accept="*.xls, *.xlsx">
- <a>重新上传</a>
- </label>
- </div>
- <div class="footer2">返回 <nuxt-link to="/">商城首页</nuxt-link> | <nuxt-link to="/applyPurchase">求购首页</nuxt-link></div>
- </div>
- </div>
- </template>
- <script>
- export default {
- data () {
- return {
- timer: 5,
- isChange: false
- }
- },
- mounted () {
- if (this.state === 'success') {
- let interval = setInterval(() => {
- this.timer--
- if (this.timer === 0 && !this.isChange) {
- clearInterval(interval)
- window.location.href = '/user#/seekPurchase'
- } else if (this.timer < 0) {
- clearInterval(interval)
- }
- }, 1000)
- }
- },
- computed: {
- state () {
- return this.$route.query.status
- },
- count () {
- return this.$route.query.count || 0
- },
- user () {
- return this.$store.state.option.user
- }
- },
- methods: {
- upload: function (e) {
- let file = e.target.files[0]
- if (file) {
- let param = new FormData()
- param.append('file', file, file.name)
- param.append('chunk', '0')
- let config = {
- headers: {'Content-Type': 'multipart/form-data'}
- }
- this.$http.post('/seek/importBom', param, config)
- .then(response => {
- if (response.data.success) {
- window.open('/applyPurchase/' + response.data.data)
- } else {
- this.$message.error(response.data.message)
- }
- }, err => {
- console.log(err)
- if (!this.user.logged) {
- this.$router.push('/auth/login?returnUrl=' + window.location.href)
- } else {
- this.$message.error('上传失败, 系统错误')
- }
- })
- }
- },
- go: function (url) {
- this.isChange = true
- this.$router.push(url)
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .result {
- background: #f5f5f5;
- padding: 20px 0 103px 0;
- .container {
- background: #fff;
- text-align: center;
- height: 400px;
- > p {
- height: 40px;
- line-height: 40px;
- background: #e5edfc;
- margin: 0;
- font-weight: bold;
- font-size: 14px;
- padding-left: 22px;
- text-align: left;
- }
- > img {
- margin: 61px 0 25px 0;
- }
- > h1 {
- font-size: 18px;
- color: #fd4e4e;
- margin: 0 0 8px 0;
- }
- > h2 {
- font-size: 14px;
- margin: 0;
- span {
- color: #fd4e4e;
- }
- }
- .footer1 {
- margin-top: 38px;
- font-size: 16px;
- color: #666;
- label {
- input {
- display: none;
- }
- }
- a {
- color: #007aff;
- font-weight: normal;
- }
- span {
- color: #fd4e4e;
- margin-left: 10px;
- }
- }
- .footer2 {
- margin-top: 21px;
- a {
- &:first-child {
- color: #4290f7;
- }
- }
- }
- }
- }
- </style>
|