lrf402788946 4 years ago
parent
commit
f97b227757

+ 19 - 0
src/router/index.js

@@ -333,6 +333,25 @@ const web = [
         component: () => import('../views/adminCenter/company/coupons/detail.vue'),
       },
 
+      {
+        path: '/adminCenter/company/policyApply/index',
+        name: 'company_policyApply_index',
+        meta: { title: '创新券申领结果' },
+        component: () => import('../views/adminCenter/company/policy_apply/index.vue'),
+      },
+      {
+        path: '/adminCenter/company/policyApply/info',
+        name: 'company_policyApply_info',
+        meta: { title: '创新券申领结果' },
+        component: () => import('../views/adminCenter/company/policy_apply/apply_info.vue'),
+      },
+      {
+        path: '/adminCenter/company/policyApply/order',
+        name: 'company_policyApply_order',
+        meta: { title: '创新券订单' },
+        component: () => import('../views/adminCenter/company/policy_apply/order_apply.vue'),
+      },
+
       // 中介机构
       {
         path: '/adminCenter/inter/basic',

+ 2 - 0
src/store/index.js

@@ -18,6 +18,7 @@ import adminLogin from './live/adminLogin';
 import organization from './live/organization';
 import policy from './live/policy';
 import policyApply from './live/policy_apply';
+import policyOrder from './live/policy_order';
 import ticket from './live/ticket';
 
 Vue.use(Vuex);
@@ -44,5 +45,6 @@ export default new Vuex.Store({
     policy,
     ticket,
     policyApply,
+    policyOrder,
   },
 });

+ 53 - 0
src/store/live/policy_order.js

@@ -0,0 +1,53 @@
+import Vue from 'vue';
+import Vuex from 'vuex';
+import _ from 'lodash';
+Vue.use(Vuex);
+const api = {
+  interface: `/api/live/v0/cysci/policyOrder`,
+};
+const state = () => ({});
+const mutations = {};
+
+const actions = {
+  async query({ commit }, { skip = 0, limit, ...info } = {}) {
+    const res = await this.$axios.$get(`${api.interface}`, {
+      skip,
+      limit,
+      ...info,
+    });
+    return res;
+  },
+  async create({ commit }, payload) {
+    const res = await this.$axios.$post(`${api.interface}`, payload);
+    return res;
+  },
+  async fetch({ commit }, payload) {
+    const res = await this.$axios.$get(`${api.interface}/${payload}`);
+    return res;
+  },
+  async update({ commit }, { id, ...data }) {
+    const res = await this.$axios.$post(`${api.interface}/update/${id}`, data);
+    return res;
+  },
+
+  async delete({ commit }, payload) {
+    const res = await this.$axios.$delete(`${api.interface}/${payload}`);
+    return res;
+  },
+  // 获取行政区划
+  async xzqh({ commit }, payload) {
+    const res = await this.$axios.$get(`${api.interface}/xzqh`, payload);
+    return res;
+  },
+  // 用code换该项
+  async getItemByCode({ commit }, payload) {
+    const res = await this.$axios.$post(`${api.interface}/name`, payload);
+    return res;
+  },
+};
+export default {
+  namespaced: true,
+  state,
+  mutations,
+  actions,
+};

+ 190 - 0
src/views/adminCenter/company/policy_apply/apply_info.vue

@@ -0,0 +1,190 @@
+<template>
+  <div id="apply_check">
+    <el-row>
+      <el-col :span="24" class="main">
+        <el-col :span="24" class="one">
+          <el-col :span="24" class="top">
+            <el-button type="primary" size="mini" @click="back">返回</el-button>
+          </el-col>
+          <el-col :span="24" class="down">
+            <el-form :model="form" ref="form" label-width="100px">
+              <el-col :span="24" class="text">
+                <el-col :span="2" class="left"> 所属创新券</el-col>
+                <el-col :span="22" class="right">
+                  {{ form.policy.name }}
+                </el-col>
+              </el-col>
+              <el-col :span="24" class="text">
+                <el-col :span="2" class="left"> 申请单位</el-col>
+                <el-col :span="22" class="right">
+                  {{ form.company }}
+                </el-col>
+              </el-col>
+              <el-col :span="24" class="text">
+                <el-col :span="2" class="left"> 申请人</el-col>
+                <el-col :span="22" class="right">
+                  {{ form.apply_personal }}
+                </el-col>
+              </el-col>
+              <el-col :span="24" class="text">
+                <el-col :span="2" class="left"> 联系电话</el-col>
+                <el-col :span="22" class="right">
+                  {{ form.phone }}
+                </el-col>
+              </el-col>
+              <el-col :span="24" class="text">
+                <el-col :span="2" class="left"> 法人复印件:</el-col>
+                <el-col :span="20" class="right">
+                  <el-col :span="4" v-for="(i, index) in form.qyfr" :key="`medium_material-${index}`">
+                    <img v-if="isImg(i.url)" :src="i.url" width="150px" height="150px" @click="toOpen(i.url)" />
+                    <el-link v-else type="primary" @click="toOpen(i.url)"> <i class="el-icon-view"></i> {{ i.name }} </el-link>
+                  </el-col>
+                </el-col>
+              </el-col>
+              <el-col :span="24" class="text">
+                <el-col :span="2" class="left"> 企业营业执照:</el-col>
+                <el-col :span="20" class="right">
+                  <el-col :span="4" v-for="(i, index) in form.yyzz" :key="`medium_material-${index}`">
+                    <img v-if="isImg(i.url)" :src="i.url" width="150px" height="150px" @click="toOpen(i.url)" />
+                    <el-link v-else type="primary" @click="toOpen(i.url)"> <i class="el-icon-view"></i> {{ i.name }} </el-link>
+                  </el-col>
+                </el-col>
+              </el-col>
+              <el-col :span="24" class="text">
+                <el-col :span="2" class="left"> 企业利润表:</el-col>
+                <el-col :span="20" class="right">
+                  <el-col :span="4" v-for="(i, index) in form.qylr" :key="`medium_material-${index}`">
+                    <img v-if="isImg(i.url)" :src="i.url" width="150px" height="150px" @click="toOpen(i.url)" />
+                    <el-link v-else type="primary" @click="toOpen(i.url)"> <i class="el-icon-view"></i> {{ i.name }} </el-link>
+                  </el-col>
+                </el-col>
+              </el-col>
+              <el-col :span="24" class="text">
+                <el-col :span="2" class="left"> 审核状态:</el-col>
+                <el-col :span="22" class="right">
+                  {{ getStatus(form.status) }}
+                </el-col>
+              </el-col>
+              <el-col :span="24" class="text">
+                <el-col :span="24" class="left"> 审核意见:</el-col>
+                <el-col :span="24" class="right desc">
+                  <el-timeline>
+                    <el-timeline-item v-for="(item, index) in form.record" :key="index" :timestamp="item.desc_time" placement="top">
+                      <el-card>
+                        <p>审核状态:{{ getStatus(item.status) || '暂无' }}</p>
+                        <p>审核意见:{{ item.desc || '暂无' }}</p>
+                      </el-card>
+                    </el-timeline-item>
+                  </el-timeline>
+                </el-col>
+              </el-col>
+            </el-form>
+          </el-col>
+        </el-col>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script>
+const _ = require('lodash');
+const moment = require('moment');
+const { policyStatus } = require('@common/dict/index');
+import { mapState, createNamespacedHelpers } from 'vuex';
+const { mapActions: policyApply } = createNamespacedHelpers('policyApply');
+export default {
+  name: 'apply_check',
+  props: {},
+  components: {},
+  data: function () {
+    return {
+      form: {
+        policy: {},
+      },
+      imgList: ['jpg', 'jpeg', 'png', 'bmp', 'gif'],
+    };
+  },
+  created() {
+    if (this.id) this.search();
+  },
+  methods: {
+    ...policyApply(['fetch', 'update']),
+    async search() {
+      let res = await this.fetch(this.id);
+      if (this.$checkRes(res)) {
+        this.$set(this, `form`, res.data);
+      }
+    },
+    back() {
+      this.$router.push({ path: '/adminCenter/company/policyApply/index' });
+    },
+    isImg(url) {
+      const arr = url.split('.');
+      const suffix = _.last(arr);
+      return this.imgList.includes(suffix);
+    },
+    toOpen(url) {
+      window.open(url);
+    },
+    getStatus(i) {
+      const r = policyStatus.find((f) => f.value === i);
+      console.log(r);
+      if (r) return r.label;
+    },
+  },
+  computed: {
+    ...mapState(['user']),
+    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 {
+  border-radius: 10px;
+  box-shadow: 0 0 5px #cccccc;
+  padding: 20px;
+  .top {
+    text-align: right;
+    margin: 0 0 10px 0;
+  }
+  .down {
+    .text {
+      padding: 10px 0;
+      border-bottom: 1px dashed #333;
+      .left {
+        text-align: left;
+      }
+      .right {
+        img {
+          width: 200px;
+          height: 200px;
+          border: 1px solid #ccc;
+        }
+      }
+      .desc {
+        margin: 10px 0 0 0;
+      }
+    }
+    .formBtn {
+      text-align: center;
+      padding: 10px 0;
+    }
+  }
+}
+.main:hover {
+  box-shadow: 0 0 5px #409eff;
+}
+</style>

+ 91 - 0
src/views/adminCenter/company/policy_apply/index.vue

@@ -0,0 +1,91 @@
+<template>
+  <div id="list">
+    <el-row>
+      <el-col :span="24" class="main">
+        <el-col :span="24" class="one">
+          <data-table :fields="fields" :opera="opera" :data="list" :total="total" @query="search" @view="toView" @pay="toPay"> </data-table>
+        </el-col>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script>
+const { policyStatus } = require('@common/dict/index');
+import { mapState, createNamespacedHelpers } from 'vuex';
+const { mapActions: policyApply } = createNamespacedHelpers('policyApply');
+export default {
+  name: 'list',
+  props: {},
+  components: {},
+  data: function () {
+    return {
+      list: [],
+      total: 0,
+      opera: [
+        {
+          label: '查看',
+          method: 'view',
+        },
+        {
+          label: '我要兑付',
+          method: 'pay',
+          display: (i) => i.status === '1',
+        },
+      ],
+      fields: [
+        { label: '所属创新券', prop: 'policy.name' },
+        { label: '申领企业', prop: 'company', filter: 'input' },
+        { label: '联系人', prop: 'apply_personal' },
+        { label: '联系电话', prop: 'phone' },
+        {
+          label: '审核状态',
+          prop: 'status',
+          format: (i) => {
+            const r = policyStatus.find((f) => f.value === i);
+            if (r) return r.label;
+            else return '';
+          },
+        },
+      ],
+    };
+  },
+  created() {
+    this.search();
+  },
+  methods: {
+    ...policyApply(['query', 'update']),
+    async search({ skip = 0, limit = 10, ...info } = {}) {
+      const res = await this.query({ skip, limit, ...info });
+      if (this.$checkRes(res)) {
+        this.$set(this, `list`, res.data);
+        this.$set(this, `total`, res.total);
+      }
+    },
+    // 查看
+    toView({ data }) {
+      this.$router.push({ path: '/adminCenter/company/policyApply/info', query: { id: data._id } });
+    },
+    toPay({ data }) {
+      this.$router.push({ path: '/adminCenter/company/policyApply/order', query: { id: data._id } });
+    },
+  },
+  computed: {
+    ...mapState(['user']),
+  },
+  metaInfo() {
+    return { title: this.$route.meta.title };
+  },
+};
+</script>
+
+<style lang="less" scoped>
+.main {
+  border-radius: 10px;
+  box-shadow: 0 0 5px #cccccc;
+  padding: 20px;
+}
+.main:hover {
+  box-shadow: 0 0 5px #409eff;
+}
+</style>

+ 179 - 0
src/views/adminCenter/company/policy_apply/order_apply.vue

@@ -0,0 +1,179 @@
+<template>
+  <div id="order_apply">
+    <el-row>
+      <el-col :span="24" class="main">
+        <el-col :span="24" class="one">
+          <el-col :span="24" class="top">
+            <el-button type="primary" size="mini" @click="back">返回</el-button>
+          </el-col>
+          <el-col :span="24" class="down">
+            <el-form :model="form" ref="form" label-width="100px" :rules="rules">
+              <el-col :span="24" class="text">
+                <el-form-item label="需求描述" prop="req_desc">
+                  <el-input v-model="form.req_desc" type="textarea" maxlength="300" :autosize="{ minRows: 4, maxRows: 6 }" show-word-limit></el-input>
+                </el-form-item>
+              </el-col>
+              <el-col :span="12" class="text">
+                <el-form-item label="订单名称" prop="name">
+                  <el-input v-model="form.name"></el-input>
+                </el-form-item>
+              </el-col>
+              <el-col :span="12" class="text">
+                <!-- mechanism_id是服务端要的 -->
+                <el-form-item label="服务机构" prop="mechanism">
+                  <el-input v-model="form.mechanism" :disabled="true"></el-input>
+                </el-form-item>
+              </el-col>
+              <el-col :span="12" class="text">
+                <el-form-item label="联系人" prop="mechanism_person">
+                  <el-input v-model="form.mechanism_person"></el-input>
+                </el-form-item>
+              </el-col>
+              <el-col :span="12" class="text">
+                <el-form-item label="联系电话" prop="mechanism_mobile">
+                  <el-input v-model="form.mechanism_mobile"></el-input>
+                </el-form-item>
+              </el-col>
+              <el-col :span="12" class="text">
+                <!-- user_id是要的 -->
+                <el-form-item label="需方机构名称" prop="user_name">
+                  <el-input v-model="form.user_name" :disabled="true"></el-input>
+                </el-form-item>
+              </el-col>
+              <el-col :span="12" class="text">
+                <el-form-item label="联系人" prop="person">
+                  <el-input v-model="form.person"></el-input>
+                </el-form-item>
+              </el-col>
+              <el-col :span="12" class="text">
+                <el-form-item label="联系电话" prop="phone">
+                  <el-input v-model="form.phone"></el-input>
+                </el-form-item>
+              </el-col>
+              <el-col :span="12" class="text">
+                <el-form-item label="电子邮箱" prop="email">
+                  <el-input v-model="form.email"></el-input>
+                </el-form-item>
+              </el-col>
+              <el-col :span="24" class="text">
+                <el-form-item label="备注" prop="remark">
+                  <el-input v-model="form.remark" type="textarea" maxlength="300" :autosize="{ minRows: 4, maxRows: 6 }" show-word-limit></el-input>
+                </el-form-item>
+              </el-col>
+              <el-col :span="24" class="formBtn">
+                <el-button type="danger" size="mini" @click="back">取消添加</el-button>
+                <el-button type="primary" size="mini" @click="onSubmit('form')">提交保存</el-button>
+              </el-col>
+            </el-form>
+          </el-col>
+        </el-col>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script>
+const _ = require('lodash');
+import { mapState, createNamespacedHelpers } from 'vuex';
+const { mapActions: policyApply } = createNamespacedHelpers('policyApply');
+const { mapActions: policyOrder } = createNamespacedHelpers('policyOrder');
+export default {
+  name: 'order_apply',
+  props: {},
+  components: {},
+  data: function () {
+    return {
+      form: {},
+      apply: {},
+      rules: {
+        req_desc: [{ required: true, message: '请填写需求描述', trigger: 'blur' }],
+        name: [{ required: true, message: '请填写订单名称', trigger: 'blur' }],
+        mechanism_person: [{ required: true, message: '请填写服务机构联系人', trigger: 'blur' }],
+        mechanism_mobile: [{ required: true, message: '请填写服务机构联系电话', trigger: 'blur' }],
+        person: [{ required: true, message: '请填写需方机构联系人', trigger: 'blur' }],
+        phone: [{ required: true, message: '请填写需方机构联系电话', trigger: 'blur' }],
+        email: [{ required: true, message: '请填写需方机构电子邮箱', trigger: 'blur' }],
+        remark: [{ required: true, message: '请填写备注', trigger: 'blur' }],
+      },
+    };
+  },
+  created() {
+    this.getApply();
+  },
+  methods: {
+    ...policyApply(['fetch']),
+    ...policyOrder(['create']),
+    async getApply() {
+      const res = await this.fetch(this.id);
+      if (this.$checkRes(res)) {
+        this.$set(this, `apply`, res.data);
+        // 整理数据
+        const policy = _.get(res.data, 'policy', {});
+        const user = _.get(policy, 'user', {});
+        let obj = {};
+        // 服务机构数据
+        const uArr = [
+          { key: '_id', prop: 'mechanism_id' },
+          { key: 'deptname', prop: 'mechanism_person' },
+          { key: 'phone', prop: 'mechanism_mobile' },
+          { key: 'deptname', prop: 'mechanism' },
+        ];
+        obj = this.setObj(user, uArr);
+        // 用户数据
+        const aArr = [
+          { key: '_id', prop: 'user_id' },
+          { key: 'name', prop: 'user_name' },
+          { key: 'companyperson', prop: 'person' },
+          { key: 'phone', prop: 'phone' },
+          { key: 'email', prop: 'email' },
+        ];
+        obj = { ...obj, ...this.setObj(this.user, aArr) };
+        obj.apply_id = this.id;
+        obj.policy_user_type = _.get(policy, 'use_type');
+        this.$set(this, 'form', obj);
+      }
+    },
+    onSubmit(formName) {
+      this.$refs[formName].validate((valid) => {
+        if (valid) {
+          this.toOrder();
+        } else {
+          console.log('error submit!!');
+          return false;
+        }
+      });
+    },
+    async toOrder() {
+      const dup = _.cloneDeep(this.form);
+      const res = await this.create(dup);
+      if (this.$checkRes(res, '订单创建成功', res.errmsg || '订单创建失败')) {
+      }
+    },
+    back() {
+      this.$router.push({ path: '/adminCenter/company/policyApply/index' });
+    },
+    setObj(object, list) {
+      const obj = {};
+      for (const i of list) {
+        const { key, prop } = i;
+        obj[prop] = object[key];
+      }
+      return obj;
+    },
+  },
+  computed: {
+    ...mapState(['user', 'menuParams']),
+    pageTitle() {
+      return `${this.$route.meta.title}`;
+    },
+    id() {
+      return this.$route.query.id;
+    },
+  },
+  metaInfo() {
+    return { title: this.$route.meta.title };
+  },
+};
+</script>
+
+<style lang="less" scoped></style>

+ 2 - 1
src/views/adminCenter/policy/apply_info.vue

@@ -69,7 +69,8 @@
                 <el-col :span="24" class="left"> 审核意见:</el-col>
                 <el-col :span="24" class="right desc">
                   <el-timeline>
-                    <el-timeline-item v-for="(item, index) in form.record" :key="index" :timestamp="item.desc_time" placement="top">
+                    <!-- TODO: type需要判断是成功还是失败,返回对应的值 -->
+                    <el-timeline-item v-for="(item, index) in form.record" :key="index" :timestamp="item.desc_time" placement="top" type="success">
                       <el-card>
                         <p>审核状态:{{ getStatus(item.status) || '暂无' }}</p>
                         <p>审核意见:{{ item.desc || '暂无' }}</p>