guhongwei преди 4 години
родител
ревизия
33a9ba3ac7
променени са 4 файла, в които са добавени 176 реда и са изтрити 41 реда
  1. 4 4
      src/router/index.js
  2. 0 36
      src/views/declare/index.vue
  3. 4 1
      src/views/index.vue
  4. 168 0
      src/views/ticket/index.vue

+ 4 - 4
src/router/index.js

@@ -21,10 +21,10 @@ const web = [
     component: () => import('../views/policy/index.vue'),
     component: () => import('../views/policy/index.vue'),
   },
   },
   {
   {
-    path: '/declare',
-    name: 'declare_index',
+    path: '/ticket',
+    name: 'ticket_index',
     meta: { title: '高企申报服务' },
     meta: { title: '高企申报服务' },
-    component: () => import('../views/declare/index.vue'),
+    component: () => import('../views/ticket/index.vue'),
   },
   },
   {
   {
     path: '/userCenter',
     path: '/userCenter',
@@ -48,7 +48,7 @@ const router = new VueRouter({
 router.beforeEach((to, from, next) => {
 router.beforeEach((to, from, next) => {
   document.title = `${to.meta.title} `;
   document.title = `${to.meta.title} `;
   const token = localStorage.getItem('token');
   const token = localStorage.getItem('token');
-  if (to.path == '/policy') {
+  if (to.path == '/policy' || to.path == '/ticket') {
     if (!token) {
     if (!token) {
       next(`/login?path=${to.path}`);
       next(`/login?path=${to.path}`);
     } else {
     } else {

+ 0 - 36
src/views/declare/index.vue

@@ -1,36 +0,0 @@
-<template>
-  <div id="index">
-    <el-row>
-      <el-col :span="24" class="main"> test </el-col>
-    </el-row>
-  </div>
-</template>
-
-<script>
-import { mapState, createNamespacedHelpers } from 'vuex';
-export default {
-  name: 'index',
-  props: {},
-  components: {},
-  data: function () {
-    return {};
-  },
-  created() {},
-  methods: {},
-  computed: {
-    ...mapState(['user']),
-  },
-  metaInfo() {
-    return { title: this.$route.meta.title };
-  },
-  watch: {
-    test: {
-      deep: true,
-      immediate: true,
-      handler(val) {},
-    },
-  },
-};
-</script>
-
-<style lang="less" scoped></style>

+ 4 - 1
src/views/index.vue

@@ -5,7 +5,10 @@
         <el-col :span="24" class="top">
         <el-col :span="24" class="top">
           <top topType="2" :leftArrow="false"></top>
           <top topType="2" :leftArrow="false"></top>
         </el-col>
         </el-col>
-        <el-col :span="24" class="info" :style="{ height: clientHeight + 'px' }"> <van-button @click="$router.push('policy')">登录</van-button> </el-col>
+        <el-col :span="24" class="info" :style="{ height: clientHeight + 'px' }">
+          <van-button @click="$router.push('policy')">高企政策服务</van-button>
+          <van-button @click="$router.push('ticket')">高企申报服务</van-button>
+        </el-col>
         <el-col :span="24" class="foot"> 底部 </el-col>
         <el-col :span="24" class="foot"> 底部 </el-col>
       </el-col>
       </el-col>
     </el-row>
     </el-row>

+ 168 - 0
src/views/ticket/index.vue

@@ -0,0 +1,168 @@
+<template>
+  <div id="index">
+    <el-row>
+      <el-col :span="24" class="main">
+        <el-col :span="24" class="top">
+          <top topType="2" :leftArrow="false"></top>
+        </el-col>
+        <el-col :span="24" class="info" :style="{ height: clientHeight + 'px' }">
+          <van-form>
+            <van-field name="uploader" label="法人复印件" label-width="70">
+              <template #input>
+                <van-uploader
+                  :fileList="form.qyfr"
+                  :max-count="1"
+                  :after-read="(file) => toUpload(file, 'qyfr')"
+                  @delete="(file) => toDelete(file, 'qyfr')"
+                  max-size="11534336"
+                  @oversize="onOversize"
+                />
+              </template>
+            </van-field>
+            <van-field name="uploader" label="营业执照" label-width="70">
+              <template #input>
+                <van-uploader
+                  :fileList="form.yyzz"
+                  :max-count="1"
+                  :after-read="(file) => toUpload(file, 'yyzz')"
+                  @delete="(file) => toDelete(file, 'yyzz')"
+                  max-size="11534336"
+                  @oversize="onOversize"
+                />
+              </template>
+            </van-field>
+            <van-field name="uploader" label="企业利润表" label-width="70">
+              <template #input>
+                <van-uploader
+                  :fileList="form.qylr"
+                  :max-count="1"
+                  :after-read="(file) => toUpload(file, 'qylr')"
+                  @delete="(file) => toDelete(file, 'qylr')"
+                  max-size="11534336"
+                  @oversize="onOversize"
+                />
+              </template>
+            </van-field>
+            <van-col span="24" class="btn">
+              <van-button type="danger" round>取消申报</van-button>
+              <van-button type="info" round @click="oneSubmit">提交申报</van-button>
+            </van-col>
+          </van-form>
+        </el-col>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script>
+const _ = require('lodash');
+import top from '@/layout/common/top.vue';
+import { mapState, createNamespacedHelpers } from 'vuex';
+const { mapActions: upload } = createNamespacedHelpers('upload');
+const { mapActions: mapTicket } = createNamespacedHelpers('ticket');
+export default {
+  name: 'index',
+  props: {},
+  components: {
+    top,
+  },
+  data: function () {
+    return {
+      clientHeight: '',
+      form: {
+        qyfr: [],
+        yyzz: [],
+        qylr: [],
+        status: '0',
+      },
+    };
+  },
+  async created() {},
+  mounted() {
+    let clientHeight = (document.documentElement.clientHeight || document.body.clientHeight) - 40;
+    this.$set(this, `clientHeight`, clientHeight);
+  },
+  methods: {
+    ...upload(['upload']),
+    ...mapTicket(['create']),
+    async oneSubmit() {
+      let data = _.get(this, 'form');
+      data.user_id = this.user.id;
+      const material = this.resetData();
+      if (material.length < 3) {
+        this.$toast({ type: 'fail', message: '缺少所需资料' });
+        return;
+      }
+      data.material = material;
+      let res = await this.create(data);
+      if (this.$checkRes(res)) {
+        this.$toast({ type: 'success', message: '高企申报成功,请耐心等待结果' });
+        this.$router.push({ path: '/userCenter' });
+      }
+    },
+    async toUpload({ file }, model) {
+      // 上传,赋值
+      const res = await this.upload({ file, dir: 'serve' });
+      if (this.$checkRes(res)) {
+        this.form[model].push({ url: res.uri, name: res.name });
+      }
+    },
+    toDelete(file, model) {
+      const index = this.form[model].findIndex((f) => _.isEqual(f, file));
+      this.form[model].splice(index, 1);
+    },
+    onOversize() {
+      Toast('文件大小不能超过 10MB');
+    },
+    resetData() {
+      let data = _.cloneDeep(this.form);
+      const arr = ['qyfr', 'yyzz', 'qylr'];
+      const res = [];
+      for (const key of arr) {
+        const e = data[key];
+        if (e.length <= 0) continue;
+        const head = _.head(e);
+        res.push(head);
+      }
+      return res;
+    },
+  },
+  computed: {
+    ...mapState(['user']),
+  },
+  metaInfo() {
+    return { title: this.$route.meta.title };
+  },
+  watch: {
+    test: {
+      deep: true,
+      immediate: true,
+      handler(val) {},
+    },
+  },
+};
+</script>
+
+<style lang="less" scoped>
+.main {
+  .top {
+    height: 40px;
+    overflow: hidden;
+    border-bottom: 1px solid #f1f1f1;
+  }
+  .info {
+    overflow-x: hidden;
+    overflow-y: auto;
+    /deep/.van-radio__label {
+      margin-left: 7px;
+    }
+    .btn {
+      text-align: center;
+      padding: 15px 0;
+      .van-button {
+        margin: 0 10px;
+      }
+    }
+  }
+}
+</style>