guhongwei 4 years ago
parent
commit
9df63f22be

BIN
src/assets/coupons.jpg


+ 35 - 17
src/router/index.js

@@ -20,6 +20,18 @@ const web = [
     meta: { title: '我要申领' },
     component: () => import('../views/apply/index.vue'),
   },
+  {
+    path: '/apply/detail',
+    name: 'apply_detail',
+    meta: { title: '创新券详情' },
+    component: () => import('../views/apply/detail.vue'),
+  },
+  {
+    path: '/apply/apply',
+    name: 'apply_apply',
+    meta: { title: '创新券申领' },
+    component: () => import('../views/apply/apply.vue'),
+  },
   {
     path: '/cashing',
     name: 'cashing',
@@ -32,6 +44,12 @@ const web = [
     meta: { title: '我要服务' },
     component: () => import('../views/service/index.vue'),
   },
+  {
+    path: '/login',
+    name: 'login',
+    meta: { title: '登录', key: 'login' },
+    component: () => import('../views/login.vue'),
+  },
 ];
 const routes = [...web];
 const router = new VueRouter({
@@ -39,22 +57,22 @@ const router = new VueRouter({
   base: process.env.VUE_APP_ROUTER,
   routes,
 });
-// router.beforeEach((to, from, next) => {
-//   document.title = `${to.meta.title} `;
-//   const token = localStorage.getItem('token');
-//   if (to.path == '/policy' || to.path == '/ticket' || to.path == '/userCenter') {
-//     if (!token) {
-//       next(`/login?path=${to.path}`);
-//     } else {
-//       let user = jwt.decode(token);
-//       store.commit('setUser', user, { root: true });
-//       next();
-//     }
-//   } else {
-//     let user = jwt.decode(token);
-//     store.commit('setUser', user, { root: true });
-//     next();
-//   }
-// });
+router.beforeEach((to, from, next) => {
+  document.title = `${to.meta.title} `;
+  const token = localStorage.getItem('token');
+  if (to.path == '/apply' || to.path == '/cashing' || to.path == '/service') {
+    if (!token) {
+      next(`/login?path=${to.path}`);
+    } else {
+      let user = jwt.decode(token);
+      store.commit('setUser', user, { root: true });
+      next();
+    }
+  } else {
+    let user = jwt.decode(token);
+    store.commit('setUser', user, { root: true });
+    next();
+  }
+});
 
 export default router;

+ 16 - 0
src/store/index.js

@@ -3,6 +3,14 @@ import Vuex from 'vuex';
 import * as ustate from '@common/src/store/user/state';
 import * as umutations from '@common/src/store/user/mutations';
 import upload from './upload';
+// 直播平台接口
+import adminLogin from './live/adminLogin';
+import organization from './live/organization';
+import coupons from './live/coupons';
+import couponsApply from './live/couponsApply';
+import declare from './live/declare';
+import cashing from './live/cashing';
+import reward from './live/reward';
 
 Vue.use(Vuex);
 
@@ -12,5 +20,13 @@ export default new Vuex.Store({
   actions: {},
   modules: {
     upload,
+    // 直播平台接口
+    adminLogin,
+    organization,
+    coupons,
+    couponsApply,
+    declare,
+    cashing,
+    reward,
   },
 });

+ 60 - 0
src/store/live/adminLogin.js

@@ -0,0 +1,60 @@
+import Vue from 'vue';
+import Vuex from 'vuex';
+import _ from 'lodash';
+const jwt = require('jsonwebtoken');
+Vue.use(Vuex);
+const api = {
+  adminLoginInfo: `/api/live/v0/users/admin`,
+};
+const state = () => ({});
+const mutations = {};
+
+const actions = {
+  async query({ commit }, { skip = 0, limit, ...info } = {}) {
+    const res = await this.$axios.$get(`${api.adminLoginInfo}`, {
+      skip,
+      limit,
+      ...info,
+    });
+    return res;
+  },
+  async create({ commit }, payload) {
+    const res = await this.$axios.$post(`${api.adminLoginInfo}`, payload);
+    return res;
+  },
+  async fetch({ commit }, payload) {
+    const res = await this.$axios.$get(`${api.adminLoginInfo}/${payload}`);
+    return res;
+  },
+  async update({ commit }, { id, ...data }) {
+    const res = await this.$axios.$post(`${api.adminLoginInfo}/update/${id}`, data);
+    return res;
+  },
+  async delete({ commit }, payload) {
+    const res = await this.$axios.$delete(`${api.adminLoginInfo}/${payload}`);
+    return res;
+  },
+  async login({ commit }, { user }) {
+    const res = await this.$axios.$post(`${api.adminLoginInfo}/login`, user);
+    if (res.errcode === 0) {
+      localStorage.setItem('token', res.data);
+      localStorage.setItem('type', 'FWJG');
+      user = jwt.decode(res.data);
+      console.log(user);
+      if (user.code == 'HNHPTJG' && user.role == '2') {
+        commit('setUser', user, { root: true });
+        return res;
+      }
+    }
+  },
+  async updatePwd({ commit }, { id, ...data }) {
+    const res = await this.$axios.$post(`${api.adminLoginInfo}/password/${id}`, data);
+    return res;
+  },
+};
+export default {
+  namespaced: true,
+  state,
+  mutations,
+  actions,
+};

+ 46 - 0
src/store/live/cashing.js

@@ -0,0 +1,46 @@
+import Vue from 'vue';
+import Vuex from 'vuex';
+import _ from 'lodash';
+Vue.use(Vuex);
+const api = {
+  cashing: `/api/live/v0/cysci/cashing`,
+};
+const state = () => ({});
+const mutations = {};
+
+const actions = {
+  async query({ commit }, { skip = 0, limit, ...info } = {}) {
+    const res = await this.$axios.$get(`${api.cashing}`, {
+      skip,
+      limit,
+      ...info,
+    });
+    return res;
+  },
+  async create({ commit }, payload) {
+    const res = await this.$axios.$post(`${api.cashing}`, payload);
+    return res;
+  },
+  async fetch({ commit }, payload) {
+    const res = await this.$axios.$get(`${api.cashing}/${payload}`);
+    return res;
+  },
+  async update({ commit }, { id, ...data }) {
+    const res = await this.$axios.$post(`${api.cashing}/update/${id}`, data);
+    return res;
+  },
+  async delete({ commit }, payload) {
+    const res = await this.$axios.$delete(`${api.cashing}/${payload}`);
+    return res;
+  },
+  async fromFetch({ commit }, payload) {
+    const res = await this.$axios.$get(`${api.cashing}/from/${payload}`);
+    return res;
+  },
+};
+export default {
+  namespaced: true,
+  state,
+  mutations,
+  actions,
+};

+ 43 - 0
src/store/live/coupons.js

@@ -0,0 +1,43 @@
+import Vue from 'vue';
+import Vuex from 'vuex';
+import _ from 'lodash';
+Vue.use(Vuex);
+const api = {
+  coupons: `/api/live/v0/cysci/coupons`,
+};
+const state = () => ({});
+const mutations = {};
+
+const actions = {
+  async query({ commit }, { skip = 0, limit, ...info } = {}) {
+    const res = await this.$axios.$get(`${api.coupons}`, {
+      skip,
+      limit,
+      ...info,
+    });
+    return res;
+  },
+  async create({ commit }, payload) {
+    const res = await this.$axios.$post(`${api.coupons}`, payload);
+    return res;
+  },
+  async fetch({ commit }, payload) {
+    const res = await this.$axios.$get(`${api.coupons}/${payload}`);
+    return res;
+  },
+  async update({ commit }, { id, ...data }) {
+    const res = await this.$axios.$post(`${api.coupons}/update/${id}`, data);
+    return res;
+  },
+
+  async delete({ commit }, payload) {
+    const res = await this.$axios.$delete(`${api.coupons}/${payload}`);
+    return res;
+  },
+};
+export default {
+  namespaced: true,
+  state,
+  mutations,
+  actions,
+};

+ 43 - 0
src/store/live/couponsApply.js

@@ -0,0 +1,43 @@
+import Vue from 'vue';
+import Vuex from 'vuex';
+import _ from 'lodash';
+Vue.use(Vuex);
+const api = {
+  couponsApply: `/api/live/v0/cysci/couponsApply`,
+};
+const state = () => ({});
+const mutations = {};
+
+const actions = {
+  async query({ commit }, { skip = 0, limit, ...info } = {}) {
+    const res = await this.$axios.$get(`${api.couponsApply}`, {
+      skip,
+      limit,
+      ...info,
+    });
+    return res;
+  },
+  async create({ commit }, payload) {
+    const res = await this.$axios.$post(`${api.couponsApply}`, payload);
+    return res;
+  },
+  async fetch({ commit }, payload) {
+    const res = await this.$axios.$get(`${api.couponsApply}/${payload}`);
+    return res;
+  },
+  async update({ commit }, { id, ...data }) {
+    const res = await this.$axios.$post(`${api.couponsApply}/update/${id}`, data);
+    return res;
+  },
+
+  async delete({ commit }, payload) {
+    const res = await this.$axios.$delete(`${api.couponsApply}/${payload}`);
+    return res;
+  },
+};
+export default {
+  namespaced: true,
+  state,
+  mutations,
+  actions,
+};

+ 42 - 0
src/store/live/declare.js

@@ -0,0 +1,42 @@
+import Vue from 'vue';
+import Vuex from 'vuex';
+import _ from 'lodash';
+Vue.use(Vuex);
+const api = {
+  declare: `/api/live/v0/cysci/declare`,
+};
+const state = () => ({});
+const mutations = {};
+
+const actions = {
+  async query({ commit }, { skip = 0, limit, ...info } = {}) {
+    const res = await this.$axios.$get(`${api.declare}`, {
+      skip,
+      limit,
+      ...info,
+    });
+    return res;
+  },
+  async create({ commit }, payload) {
+    const res = await this.$axios.$post(`${api.declare}`, payload);
+    return res;
+  },
+  async fetch({ commit }, payload) {
+    const res = await this.$axios.$get(`${api.declare}/${payload}`);
+    return res;
+  },
+  async update({ commit }, { id, ...data }) {
+    const res = await this.$axios.$post(`${api.declare}/update/${id}`, data);
+    return res;
+  },
+  async delete({ commit }, payload) {
+    const res = await this.$axios.$delete(`${api.declare}/${payload}`);
+    return res;
+  },
+};
+export default {
+  namespaced: true,
+  state,
+  mutations,
+  actions,
+};

+ 58 - 0
src/store/live/organization.js

@@ -0,0 +1,58 @@
+import Vue from 'vue';
+import Vuex from 'vuex';
+import _ from 'lodash';
+const jwt = require('jsonwebtoken');
+Vue.use(Vuex);
+const api = {
+  organizationInfo: `/api/live/v0/users/organization`,
+};
+const state = () => ({});
+const mutations = {};
+
+const actions = {
+  async query({ commit }, { skip = 0, limit, ...info } = {}) {
+    const res = await this.$axios.$get(`${api.organizationInfo}`, {
+      skip,
+      limit,
+      ...info,
+    });
+    return res;
+  },
+  async create({ commit }, payload) {
+    const res = await this.$axios.$post(`${api.organizationInfo}`, payload);
+    return res;
+  },
+  async fetch({ commit }, payload) {
+    const res = await this.$axios.$get(`${api.organizationInfo}/${payload}`);
+    return res;
+  },
+  async update({ commit }, { id, ...data }) {
+    const res = await this.$axios.$post(`${api.organizationInfo}/update/${id}`, data);
+    return res;
+  },
+  async delete({ commit }, payload) {
+    const res = await this.$axios.$delete(`${api.organizationInfo}/${payload}`);
+    return res;
+  },
+  // 修改密码
+  async updatePassword({ commit }, { id, ...data }) {
+    const res = await this.$axios.$post(`${api.organizationInfo}/password/${id}`, data);
+    return res;
+  },
+  async orgLogin({ commit }, { user }) {
+    const res = await this.$axios.$post(`${api.organizationInfo}/login`, user);
+    if (res.errcode === 0) {
+      localStorage.setItem('token', res.data);
+      localStorage.setItem('type', 'QY');
+      user = jwt.decode(res.data);
+      commit('setUser', user, { root: true });
+    }
+    return res;
+  },
+};
+export default {
+  namespaced: true,
+  state,
+  mutations,
+  actions,
+};

+ 43 - 0
src/store/live/reward.js

@@ -0,0 +1,43 @@
+import Vue from 'vue';
+import Vuex from 'vuex';
+import _ from 'lodash';
+Vue.use(Vuex);
+const api = {
+  reward: `/api/live/v0/cysci/reward`,
+};
+const state = () => ({});
+const mutations = {};
+
+const actions = {
+  async query({ commit }, { skip = 0, limit, ...info } = {}) {
+    const res = await this.$axios.$get(`${api.reward}`, {
+      skip,
+      limit,
+      ...info,
+    });
+    return res;
+  },
+  async create({ commit }, payload) {
+    const res = await this.$axios.$post(`${api.reward}`, payload);
+    return res;
+  },
+  async fetch({ commit }, payload) {
+    const res = await this.$axios.$get(`${api.reward}/${payload}`);
+    return res;
+  },
+  async update({ commit }, { id, ...data }) {
+    const res = await this.$axios.$post(`${api.reward}/update/${id}`, data);
+    return res;
+  },
+
+  async delete({ commit }, payload) {
+    const res = await this.$axios.$delete(`${api.reward}/${payload}`);
+    return res;
+  },
+};
+export default {
+  namespaced: true,
+  state,
+  mutations,
+  actions,
+};

+ 105 - 0
src/views/apply/apply.vue

@@ -0,0 +1,105 @@
+<template>
+  <div id="apply">
+    <el-row>
+      <el-col :span="24" class="main">
+        <el-col :span="24" class="top">
+          <top topType="2" @back="back"></top>
+        </el-col>
+        <el-col :span="24" class="info" :style="{ height: clientHeight + 'px' }">
+          <apply-form :form="form" @back="back" @onSubmit="onSubmit"></apply-form>
+        </el-col>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script>
+import applyForm from './parts/form.vue';
+import top from '@/layout/common/top.vue';
+import { mapState, createNamespacedHelpers } from 'vuex';
+const { mapActions: organization } = createNamespacedHelpers('organization');
+const { mapActions: couponsApply } = createNamespacedHelpers('couponsApply');
+export default {
+  name: 'apply',
+  props: {},
+  components: {
+    top,
+    applyForm,
+  },
+  data: function () {
+    return {
+      clientHeight: '',
+      form: {},
+    };
+  },
+  async created() {
+    if (this.coupons_id) this.search();
+  },
+  mounted() {
+    let clientHeight = (document.documentElement.clientHeight || document.body.clientHeight) - 40;
+    this.$set(this, `clientHeight`, clientHeight);
+  },
+  methods: {
+    ...organization({ orgFetch: 'fetch' }),
+    ...couponsApply(['create']),
+    async search() {
+      let res = await this.orgFetch(this.user.id);
+      if (this.$checkRes(res)) {
+        let data = {
+          coupons_id: this.coupons_id,
+          company: res.data.name,
+          apply_person: res.data.companyperson,
+          phone: res.data.phone,
+          user_id: res.data.id,
+          qyfr: [],
+          yyzz: [],
+          qylr: [],
+        };
+        this.$set(this, `form`, data);
+      }
+    },
+    async onSubmit({ data }) {
+      let res = await this.create(data);
+      if (this.$checkRes(res)) {
+        this.$toast({ type: 'success', message: '申领成功,等待审核!' });
+        this.back();
+      } else {
+        this.$toast({ type: 'fail', message: res.errmsg });
+      }
+    },
+    back() {
+      this.$router.push({ path: '/apply' });
+    },
+  },
+  computed: {
+    ...mapState(['user']),
+    coupons_id() {
+      return this.$route.query.id;
+    },
+  },
+  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;
+  }
+}
+</style>

+ 86 - 0
src/views/apply/detail.vue

@@ -0,0 +1,86 @@
+<template>
+  <div id="detail">
+    <el-row>
+      <el-col :span="24" class="main">
+        <el-col :span="24" class="top">
+          <top topType="2" @back="back"></top>
+        </el-col>
+        <el-col :span="24" class="info" :style="{ height: clientHeight + 'px' }">
+          <apply-detail :form="form"></apply-detail>
+        </el-col>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script>
+import applyDetail from './parts/detail.vue';
+import top from '@/layout/common/top.vue';
+import { mapState, createNamespacedHelpers } from 'vuex';
+const { mapActions: coupons } = createNamespacedHelpers('coupons');
+export default {
+  name: 'detail',
+  props: {},
+  components: {
+    top,
+    applyDetail,
+  },
+  data: function () {
+    return {
+      clientHeight: '',
+      form: {},
+    };
+  },
+  async created() {
+    if (this.coupons_id) this.search();
+  },
+  mounted() {
+    let clientHeight = (document.documentElement.clientHeight || document.body.clientHeight) - 40;
+    this.$set(this, `clientHeight`, clientHeight);
+  },
+  methods: {
+    ...coupons(['fetch']),
+    async search() {
+      let res = await this.fetch(this.coupons_id);
+      if (this.$checkRes(res)) {
+        this.$set(this, `form`, res.data);
+      }
+    },
+    back() {
+      this.$router.push({ path: '/apply' });
+    },
+  },
+  computed: {
+    ...mapState(['user']),
+    coupons_id() {
+      return this.$route.query.id;
+    },
+  },
+  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;
+    background-color: #f9f9f9;
+    padding: 8px;
+  }
+}
+</style>

+ 33 - 7
src/views/apply/index.vue

@@ -3,35 +3,59 @@
     <el-row>
       <el-col :span="24" class="main">
         <el-col :span="24" class="top">
-          <top topType="2" :leftArrow="false"></top>
+          <top topType="1" @search="search"></top>
+        </el-col>
+        <el-col :span="24" class="info" :style="{ height: clientHeight + 'px' }">
+          <apply-list :list="list"></apply-list>
+        </el-col>
+        <el-col :span="24" class="foot">
+          <page :limit="limit" :total="total" @search="search"></page>
         </el-col>
-        <el-col :span="24" class="info" :style="{ height: clientHeight + 'px' }"> 我要申领 </el-col>
-        <el-col :span="24" class="foot"> 底部 </el-col>
       </el-col>
     </el-row>
   </div>
 </template>
 
 <script>
+import applyList from './parts/list.vue';
 import top from '@/layout/common/top.vue';
+import page from '@/layout/common/page.vue';
 import { mapState, createNamespacedHelpers } from 'vuex';
+const { mapActions: coupons } = createNamespacedHelpers('coupons');
 export default {
   name: 'index',
   props: {},
   components: {
     top,
+    page,
+    applyList,
   },
   data: function () {
     return {
       clientHeight: '',
+      list: [],
+      total: 0,
+      limit: '10',
     };
   },
-  async created() {},
+  async created() {
+    await this.search();
+  },
   mounted() {
-    let clientHeight = (document.documentElement.clientHeight || document.body.clientHeight) - 90;
+    let clientHeight = (document.documentElement.clientHeight || document.body.clientHeight) - 80;
     this.$set(this, `clientHeight`, clientHeight);
   },
-  methods: {},
+  methods: {
+    ...coupons(['query']),
+    async search({ skip = 0, limit = this.limit, searchName, ...info } = {}) {
+      if (searchName) info.name = searchName;
+      let res = await this.query({ skip, limit, ...info });
+      if (this.$checkRes(res)) {
+        this.$set(this, `list`, res.data);
+        this.$set(this, `total`, res.total);
+      }
+    },
+  },
   computed: {
     ...mapState(['user']),
   },
@@ -58,9 +82,11 @@ export default {
   .info {
     overflow-x: hidden;
     overflow-y: auto;
+    background-color: #f9f9f9;
+    padding: 8px;
   }
   .foot {
-    height: 50px;
+    height: 40px;
     overflow: hidden;
     border-top: 1px solid #f1f1f1;
   }

+ 86 - 0
src/views/apply/parts/detail.vue

@@ -0,0 +1,86 @@
+<template>
+  <div id="detail">
+    <el-row>
+      <el-col :span="24" class="main">
+        <el-col :span="24" class="one">
+          <el-image :src="coupons"></el-image>
+        </el-col>
+        <el-col :span="24" class="two">
+          <van-cell title="创新券类型" :value="form.coupons_type" />
+          <van-cell title="创新券名称" :value="form.name" />
+          <van-cell title="折扣类型" :value="form.discount_type" />
+          <van-cell title="抵扣比例" :value="form.scale + '%'" v-if="form.discount_type == '折扣券'" />
+          <van-cell title="面额" :value="form.allowance + '元'" v-if="form.discount_type == '定额券'" />
+          <van-cell title="适用服务类型" :value="form.use_type" />
+          <van-cell title="所属分类" :value="form.classify" />
+          <van-cell title="券总额度" :value="form.total_allowance + '元'" />
+          <van-cell title="使用期限" :value="form.limit_time + '个月'" />
+          <van-swipe-cell class="desc">
+            <p>描述:</p>
+            <p>{{ form.desc || '暂无' }}</p>
+          </van-swipe-cell>
+        </el-col>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script>
+import { mapState, createNamespacedHelpers } from 'vuex';
+export default {
+  name: 'detail',
+  props: {
+    form: { type: Object },
+  },
+  components: {},
+  data: function () {
+    return {
+      coupons: require('@a/coupons.jpg'),
+    };
+  },
+  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>
+.main {
+  .one {
+    margin: 0 0 5px 0;
+    .el-image {
+      width: 100%;
+      height: 180px;
+      /deep/.el-image__inner {
+        border-radius: 8px;
+      }
+    }
+  }
+  .two {
+    .desc {
+      background-color: #fff;
+      padding: 10px 15px;
+      font-size: 14px;
+      p:nth-child(1) {
+        margin: 0 0 5px 0;
+      }
+      p:nth-child(2) {
+        text-indent: 1rem;
+        color: #969799;
+      }
+    }
+  }
+}
+</style>

+ 98 - 0
src/views/apply/parts/form.vue

@@ -0,0 +1,98 @@
+<template>
+  <div id="forms">
+    <el-row>
+      <el-col :span="24" class="main">
+        <el-col :span="24" class="one">
+          <van-form @submit="onSubmit">
+            <van-field v-model="form.company" label="申请单位" readonly />
+            <van-field v-model="form.apply_person" label="申请人" />
+            <van-field v-model="form.phone" label="联系电话" />
+            <van-field v-model="form.apply_money" label="申领金额(元)" :rules="[{ required: true, message: '请填写申领金额' }]" />
+            <van-field name="uploader" label="法人复印件">
+              <template #input>
+                <van-uploader :fileList="form.qyfr" :max-count="1" @delete="(file) => toDelete(file, 'qyfr')" :after-read="(file) => toUpload(file, 'qyfr')" />
+              </template>
+            </van-field>
+            <van-field name="uploader" label="企业营业执照">
+              <template #input>
+                <van-uploader :fileList="form.yyzz" :max-count="1" @delete="(file) => toDelete(file, 'yyzz')" :after-read="(file) => toUpload(file, 'yyzz')" />
+              </template>
+            </van-field>
+            <van-field name="uploader" label="企业利润表">
+              <template #input>
+                <van-uploader :fileList="form.qylr" :max-count="1" @delete="(file) => toDelete(file, 'qylr')" :after-read="(file) => toUpload(file, 'qylr')" />
+              </template>
+            </van-field>
+            <van-col span="24" class="btn">
+              <van-button type="info" size="small" @click="back">取消申领</van-button>
+              <van-button type="primary" size="small" native-type="submit">提交申领</van-button>
+            </van-col>
+          </van-form>
+        </el-col>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script>
+import { mapState, createNamespacedHelpers } from 'vuex';
+const { mapActions: upload } = createNamespacedHelpers('upload');
+export default {
+  name: 'forms',
+  props: {
+    form: { type: Object },
+  },
+  components: {},
+  data: function () {
+    return {};
+  },
+  created() {},
+  methods: {
+    ...upload(['upload']),
+    back() {
+      this.$emit('back');
+    },
+    onSubmit() {
+      this.$emit('onSubmit', { data: this.form });
+    },
+    async toUpload({ file }, model) {
+      // 上传,赋值
+      const res = await this.upload({ file, dir: 'file' });
+      if (this.$checkRes(res)) {
+        this.$set(this.form, model, [{ name: res.name, url: res.uri }]);
+      }
+    },
+    toDelete(file, model) {
+      const index = this.form[model].findIndex((f) => _.isEqual(f, file));
+      this.form[model].splice(index, 1);
+    },
+  },
+  computed: {
+    ...mapState(['user']),
+  },
+  metaInfo() {
+    return { title: this.$route.meta.title };
+  },
+  watch: {
+    test: {
+      deep: true,
+      immediate: true,
+      handler(val) {},
+    },
+  },
+};
+</script>
+
+<style lang="less" scoped>
+.main {
+  .one {
+    .btn {
+      text-align: center;
+      margin: 10px 0;
+      .van-button {
+        margin: 0 10px;
+      }
+    }
+  }
+}
+</style>

+ 104 - 0
src/views/apply/parts/list.vue

@@ -0,0 +1,104 @@
+<template>
+  <div id="list">
+    <el-row>
+      <el-col :span="24" class="main">
+        <el-col :span="24" class="one">
+          <el-col :span="24" class="list" v-for="(item, index) in list" :key="index">
+            <el-col :span="24" class="name">
+              {{ item.name }}
+            </el-col>
+            <el-col :span="24" class="other">
+              <el-col :span="12" class="other_info textOver">
+                券类型:<span>{{ item.coupons_type || '暂无' }}</span>
+              </el-col>
+              <el-col :span="12" class="other_info textOver">
+                折扣类型:<span>{{ item.discount_type || '暂无' }}</span>
+              </el-col>
+              <el-col :span="12" class="other_info textOver">
+                适用类型:<span>{{ item.use_type || '暂无' }}</span>
+              </el-col>
+              <el-col :span="12" class="other_info textOver">
+                所属分类:<span>{{ item.classify || '暂无' }}</span>
+              </el-col>
+            </el-col>
+            <el-col :span="24" class="btn">
+              <el-button type="info" size="mini" @click="detail(item)">查看详情</el-button>
+              <el-button type="primary" size="mini" @click="apply(item)">申领</el-button>
+            </el-col>
+          </el-col>
+        </el-col>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script>
+import { mapState, createNamespacedHelpers } from 'vuex';
+export default {
+  name: 'list',
+  props: {
+    list: { type: Array },
+  },
+  components: {},
+  data: function () {
+    return {};
+  },
+  created() {},
+  methods: {
+    detail(data) {
+      this.$router.push({ path: '/apply/detail', query: { id: data.id } });
+    },
+    apply(data) {
+      this.$router.push({ path: '/apply/apply', query: { id: data.id } });
+    },
+  },
+  computed: {
+    ...mapState(['user']),
+  },
+  metaInfo() {
+    return { title: this.$route.meta.title };
+  },
+  watch: {
+    test: {
+      deep: true,
+      immediate: true,
+      handler(val) {},
+    },
+  },
+};
+</script>
+
+<style lang="less" scoped>
+.main {
+  .one {
+    .list {
+      background-color: #fff;
+      padding: 8px;
+      border-radius: 5px;
+      margin: 0 0 10px 0;
+      .name {
+        font-size: 16px;
+        font-weight: bold;
+        margin: 0 0 5px 0;
+      }
+      .other {
+        margin: 0 0 5px 0;
+        .other_info {
+          font-size: 14px;
+          color: #666;
+          margin: 0 0 5px 0;
+          span {
+            color: #000;
+          }
+        }
+      }
+      .btn {
+        text-align: center;
+        .el-button {
+          margin: 0 10px;
+        }
+      }
+    }
+  }
+}
+</style>

+ 100 - 0
src/views/login.vue

@@ -0,0 +1,100 @@
+<template>
+  <div id="login">
+    <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' }">
+          <el-col :span="24" class="one">
+            <van-form label-width="4.2em">
+              <van-field v-model="form.institution_code" name="账号" label="账号" :rules="[{ required: true, message: '请填写账号' }]" />
+              <van-field v-model="form.password" type="password" name="密码" label="密码" :rules="[{ required: true, message: '请填写密码' }]" />
+              <van-col span="24" class="btn">
+                <van-button type="danger" round @click="back">取消登录</van-button>
+                <van-button type="primary" round @click="onSubmit">提交登录</van-button>
+              </van-col>
+            </van-form>
+          </el-col>
+        </el-col>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script>
+import top from '@/layout/common/top.vue';
+import { mapState, createNamespacedHelpers } from 'vuex';
+const { mapActions: organization } = createNamespacedHelpers('organization');
+export default {
+  name: 'login',
+  props: {},
+  components: {
+    top,
+  },
+  data: function () {
+    return {
+      clientHeight: '',
+      form: {},
+    };
+  },
+  async created() {},
+  mounted() {
+    let clientHeight = (document.documentElement.clientHeight || document.body.clientHeight) - 90;
+    this.$set(this, `clientHeight`, clientHeight);
+  },
+  methods: {
+    ...organization(['orgLogin']),
+    async onSubmit() {
+      let res = await this.orgLogin({ user: this.form });
+      if (this.$checkRes(res)) {
+        this.$toast({ type: 'success', message: '登录成功' });
+        this.$router.push({ path: this.$route.query.path });
+      } else {
+        console.log(res);
+        this.$toast({ type: 'fail', message: res.errmsg });
+      }
+    },
+    back() {
+      window.history.go(-1);
+    },
+  },
+  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;
+    padding: 8px;
+    .one {
+      .btn {
+        text-align: center;
+        margin: 10px 0;
+        .van-button {
+          margin: 0 10px;
+        }
+      }
+    }
+  }
+}
+</style>

+ 6 - 1
vue.config.js

@@ -22,8 +22,13 @@ module.exports = {
       '/files': {
         target: 'http://broadcast.waityou24.cn',
       },
+      // '/api/question': {
+      //   target: 'http://192.168.1.19:9104', //http://192.168.1.19:9101
+      //   changeOrigin: true,
+      //   ws: false,
+      // },
       '/api': {
-        target: 'http://192.168.1.19:9200', //http://192.168.1.19:9200
+        target: 'http://192.168.1.19:9101', //http://192.168.1.19:9200
         changeOrigin: true,
         ws: false,
       },