lrf402788946 3 years ago
parent
commit
18005130b3

BIN
src/assets/user.jpg


+ 69 - 0
src/components/c-select.vue

@@ -0,0 +1,69 @@
+<template>
+  <div id="c-select">
+    <van-cell :title="label" @click="show = true">
+      <span v-if="mval" style="color:#000">{{ mval }}</span>
+      <span v-else>{{ `请选择${label}` }}</span>
+    </van-cell>
+    <van-popup v-model="show" show-toolbar position="bottom">
+      <van-picker v-if="type === 'select'" :value-key="valueKey" :title="label" show-toolbar :columns="list" @confirm="onConfirm" @cancel="show = false" />
+      <van-checkbox-group v-model="multi" v-else>
+        <van-picker :title="label" :show-toolbar="true" :columns="list" @confirm="onConfirm" @cancel="show = false">
+          <template #option="item">
+            <van-checkbox :name="item">{{ item }}</van-checkbox>
+          </template>
+        </van-picker>
+      </van-checkbox-group>
+    </van-popup>
+  </div>
+</template>
+
+<script>
+const _ = require('lodash');
+export default {
+  name: 'c-select',
+  props: {
+    label: { type: String },
+    mval: { type: String },
+    list: { type: Array, default: () => [] },
+    type: { type: String },
+    valueKey: { type: String },
+  },
+  model: {
+    prop: 'mval',
+    event: 'change',
+  },
+  components: {},
+  data: function() {
+    return {
+      show: false,
+      selectList: [],
+      multi: [],
+    };
+  },
+  created() {},
+  methods: {
+    onConfirm(value) {
+      if (this.type === 'select') this.$emit('change', value);
+      else {
+        const str = this.multi.join(',');
+        this.$emit('change', str);
+      }
+      this.show = false;
+    },
+  },
+  computed: {
+    pageTitle() {
+      return `${this.$route.meta.title}`;
+    },
+  },
+  metaInfo() {
+    return { title: this.$route.meta.title };
+  },
+};
+</script>
+
+<style lang="less" scoped>
+/deep/.van-cell__value {
+  text-align: left;
+}
+</style>

+ 6 - 0
src/router/index.js

@@ -74,6 +74,12 @@ const web = [
     meta: { title: '个人中心' },
     meta: { title: '个人中心' },
     component: () => import('../views/service/account.vue'),
     component: () => import('../views/service/account.vue'),
   },
   },
+  {
+    path: '/service/account/base',
+    name: 'service_account_base',
+    meta: { title: '个人中心-基础信息' },
+    component: () => import('../views/service/account/base.vue'),
+  },
   {
   {
     path: '/login',
     path: '/login',
     name: 'login',
     name: 'login',

+ 2 - 0
src/store/index.js

@@ -10,6 +10,7 @@ import coupons from './live/coupons';
 import couponsApply from './live/couponsApply';
 import couponsApply from './live/couponsApply';
 import declare from './live/declare';
 import declare from './live/declare';
 import reward from './live/reward';
 import reward from './live/reward';
+import mechanism from './live/mechanism';
 import cashing from './live/cashing';
 import cashing from './live/cashing';
 import news from '@common/src/store/news';
 import news from '@common/src/store/news';
 
 
@@ -30,5 +31,6 @@ export default new Vuex.Store({
     reward,
     reward,
     cashing,
     cashing,
     news,
     news,
+    mechanism,
   },
   },
 });
 });

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

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

+ 72 - 8
src/views/service/account.vue

@@ -1,14 +1,34 @@
 <template>
 <template>
-  <div id="account">
+  <div id="index">
     <el-row>
     <el-row>
       <el-col :span="24" class="main">
       <el-col :span="24" class="main">
         <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' }"> 个人中心 </el-col>
-        <el-col :span="24" class="foot">
-          <foot :type="2"></foot>
+        <el-col :span="24" class="info" :style="{ height: clientHeight + 'px' }">
+          <el-col :span="24" class="one">
+            <el-col :span="5" class="image">
+              <el-image :src="icon"></el-image>
+            </el-col>
+            <el-col :span="19" class="info">
+              <el-col :span="24" class="name textOver">
+                {{ user.name ? user.name : '游客' }}
+              </el-col>
+              <el-col :span="24" class="other">
+                <el-col :span="24" class="other_info textOver">
+                  电话:<span>{{ user.phone ? user.phone : '未知' }}</span>
+                </el-col>
+                <el-col :span="24" class="other_info textOver">
+                  地址:<span>{{ user.addr ? user.addr : '未知' }}</span>
+                </el-col>
+              </el-col>
+            </el-col>
+          </el-col>
+          <el-col :span="24" class="two">
+            <van-cell title="基本信息" @click="btn('base')" is-link />
+          </el-col>
         </el-col>
         </el-col>
+        <el-col :span="24" class="foot"> <foot :type="2"></foot> </el-col>
       </el-col>
       </el-col>
     </el-row>
     </el-row>
   </div>
   </div>
@@ -19,7 +39,7 @@ import top from '@/layout/common/top.vue';
 import foot from '@/layout/common/foot.vue';
 import foot from '@/layout/common/foot.vue';
 import { mapState, createNamespacedHelpers } from 'vuex';
 import { mapState, createNamespacedHelpers } from 'vuex';
 export default {
 export default {
-  name: 'account',
+  name: 'index',
   props: {},
   props: {},
   components: {
   components: {
     top,
     top,
@@ -28,14 +48,22 @@ export default {
   data: function () {
   data: function () {
     return {
     return {
       clientHeight: '',
       clientHeight: '',
+      icon: require('@a/user.jpg'),
+      coupons: ['1'],
+      cashing: ['1'],
     };
     };
   },
   },
   async created() {},
   async created() {},
+  methods: {
+    btn(to) {
+      this.$router.push({ path: `/service/account/${to}` });
+    },
+  },
   mounted() {
   mounted() {
     let clientHeight = (document.documentElement.clientHeight || document.body.clientHeight) - 80;
     let clientHeight = (document.documentElement.clientHeight || document.body.clientHeight) - 80;
     this.$set(this, `clientHeight`, clientHeight);
     this.$set(this, `clientHeight`, clientHeight);
   },
   },
-  methods: {},
+
   computed: {
   computed: {
     ...mapState(['user']),
     ...mapState(['user']),
   },
   },
@@ -57,16 +85,52 @@ export default {
   .top {
   .top {
     height: 40px;
     height: 40px;
     overflow: hidden;
     overflow: hidden;
-    border-bottom: 1px solid #f1f1f1;
+    border-bottom: 1px solid #f9f9f9;
   }
   }
   .info {
   .info {
     overflow-x: hidden;
     overflow-x: hidden;
     overflow-y: auto;
     overflow-y: auto;
+    background-color: #f9f9f9;
+    .one {
+      background-color: #fff;
+      margin: 0 0 10px 0;
+      padding: 10px;
+      .image {
+        text-align: center;
+        .el-image {
+          width: 60px;
+          height: 60px;
+          border-radius: 90px;
+        }
+      }
+      .info {
+        background-color: #fff;
+        padding: 0 10px;
+        .name {
+          font-size: 16px;
+          font-weight: bold;
+          margin: 0 0 5px 0;
+        }
+        .other {
+          .other_info {
+            font-size: 14px;
+            color: #666;
+            margin: 0 0 2px 0;
+            span {
+              color: #000;
+            }
+          }
+        }
+      }
+    }
+    /deep/.van-collapse-item__content {
+      padding: 0 10px;
+    }
   }
   }
   .foot {
   .foot {
     height: 40px;
     height: 40px;
     overflow: hidden;
     overflow: hidden;
-    border-top: 1px solid #f1f1f1;
+    border-top: 1px solid #f9f9f9;
   }
   }
 }
 }
 </style>
 </style>

+ 175 - 0
src/views/service/account/base.vue

@@ -0,0 +1,175 @@
+<template>
+  <div id="index">
+    <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' }">
+          <van-form @submit="onSubmit" label-width="5.2em">
+            <van-col span="24" class="one">
+              <van-tabs v-model="activeName">
+                <van-tab title="基本信息" name="1">
+                  <van-field v-model="form.name" name="企业名称" label="企业名称" />
+                  <van-field v-model="form.institution_code" name="机构代码" label="机构代码" disabled />
+                  <van-field v-model="form.phone" name="手机号" label="手机号" />
+                  <van-field v-model="form.email" name="电子邮箱" label="电子邮箱" />
+                  <van-field v-model="form.addr" name="联系地址" label="联系地址" />
+                  <van-field v-model="form.office_phone" name="办公电话" label="办公电话" />
+                  <van-field v-model="form.profession" name="所属行业" label="所属行业" />
+                  <van-field readonly clickable name="picker" :value="form.juris" label="所属辖区" placeholder="点击选择" @click="showPicker = true" />
+                  <van-popup v-model="showPicker" position="bottom">
+                    <van-picker show-toolbar :columns="jurisList" @confirm="onConfirm" @cancel="showPicker = false" />
+                  </van-popup>
+                </van-tab>
+                <van-tab title="详细信息" name="2">
+                  <van-field v-model="form.companytype" name="注册类型" label="注册类型" />
+                  <van-field
+                    readonly
+                    clickable
+                    name="datetimePicker"
+                    :value="form.companydate"
+                    label="时间选择"
+                    placeholder="点击选择时间"
+                    @click="dateShow = true"
+                  />
+                  <van-popup v-model="dateShow" position="bottom">
+                    <van-datetime-picker type="date" @confirm="dateConfirm" @cancel="showPicker = false" :min-date="minDate" :max-date="maxDate" />
+                  </van-popup>
+                  <van-field v-model="form.companycapital" name="注册资金" label="注册资金" />
+                  <van-field v-model="form.companyperson" name="企业法人" label="企业法人" />
+                  <van-field v-model="form.sndqyzsr" name="企业总收入" label="企业总收入" />
+                  <van-field v-model="form.sndyffy" name="研发费用" label="研发费用" />
+                  <van-field v-model="form.companytotal" name="企业总人数" label="企业总人数" />
+                  <van-field v-model="form.zjzyfrs" name="研发人数" label="研发人数" />
+                  <van-field v-model="form.companybrief" name="企业简介" label="企业简介" rows="2" autosize type="textarea" maxlength="300" show-word-limit />
+                  <van-field v-model="form.mainproduct" name="主要产品" label="主要产品" rows="2" autosize type="textarea" maxlength="300" show-word-limit />
+                  <van-field
+                    v-model="form.qualifications"
+                    name="资质&荣誉"
+                    label="资质&荣誉"
+                    rows="2"
+                    autosize
+                    type="textarea"
+                    maxlength="300"
+                    show-word-limit
+                  />
+                </van-tab>
+              </van-tabs>
+            </van-col>
+            <van-col span="24" class="btn">
+              <van-button type="danger" round @click="back">取消提交</van-button>
+              <van-button type="info" round native-type="submit">确认提交</van-button>
+            </van-col>
+          </van-form>
+        </el-col>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script>
+const _ = require('lodash');
+const moment = require('moment');
+import top from '@/layout/common/top.vue';
+import { mapState, createNamespacedHelpers } from 'vuex';
+const { mapActions: organization } = createNamespacedHelpers('organization');
+export default {
+  name: 'index',
+  props: {},
+  components: {
+    top,
+  },
+  data: function () {
+    return {
+      clientHeight: '',
+      form: {},
+      activeName: '1',
+      // 所属辖区
+      showPicker: false,
+      jurisList: ['长春新区', '净月区', '汽开区', '经开区', '高新区', '南关区', '朝阳区', '宽城区', '二道区', '绿园区', '双阳区', '九台区'],
+      // 时间
+      dateShow: false,
+      minDate: new Date(1949, 1, 1),
+      maxDate: new Date(2050, 1, 1),
+    };
+  },
+  async created() {
+    if (this.user.id) this.search(this.user.id);
+  },
+  methods: {
+    ...organization(['fetch', 'update']),
+    async search(id) {
+      let res = await this.fetch(id);
+      if (this.$checkRes(res)) {
+        this.$set(this, `form`, res.data);
+      }
+    },
+    async onSubmit() {
+      let data = this.form;
+      let res = await this.update(data);
+      if (this.$checkRes(res)) {
+        this.$toast({ type: 'success', message: '修改信息成功!' });
+        this.back();
+      } else {
+        this.$toast({ type: 'fail', message: '修改信息失败!' });
+      }
+    },
+    // 选择辖区
+    onConfirm(value) {
+      this.$set(this.form, `juris`, value);
+      this.showPicker = false;
+    },
+    // 选择日期
+    dateConfirm(value) {
+      this.$set(this.form, `companydate`, moment(value).format('YYYY-MM-DD'));
+      this.dateShow = false;
+    },
+    back() {
+      this.$router.push({ path: '/finance/account' });
+    },
+  },
+  mounted() {
+    let clientHeight = (document.documentElement.clientHeight || document.body.clientHeight) - 40;
+    this.$set(this, `clientHeight`, clientHeight);
+  },
+  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 #f9f9f9;
+  }
+  .info {
+    overflow-x: hidden;
+    overflow-y: auto;
+    .van-form {
+      float: left;
+      width: 100%;
+    }
+    .btn {
+      text-align: center;
+      margin: 10px 0;
+      .van-button {
+        margin: 0 10px;
+      }
+    }
+  }
+}
+</style>

+ 45 - 2
src/views/service/mechanism.vue

@@ -5,7 +5,25 @@
         <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' }"> 服务机构 </el-col>
+        <el-col :span="24" class="info" :style="{ height: clientHeight + 'px' }">
+          <van-form @submit="onSubmit">
+            <template v-for="(i, index) in fields">
+              <span :key="`field-${index}`">
+                <template v-if="i.type === 'select'">
+                  <template v-if="i.model === 'juris'">
+                    <cselect v-model="form[i.model]" :label="i.label" :list="jurisList" :type="i.type" valueKey="" />
+                  </template>
+                </template>
+                <template v-else>
+                  <van-field v-model="form[i.model]" :label="i.label" :type="i.type" :placeholder="`请填写${i.label}`" :rules="i.rules" />
+                </template>
+              </span>
+            </template>
+            <div style="margin: 16px">
+              <van-button round block type="info" native-type="submit">提交</van-button>
+            </div>
+          </van-form>
+        </el-col>
         <el-col :span="24" class="foot">
         <el-col :span="24" class="foot">
           <foot :type="2"></foot>
           <foot :type="2"></foot>
         </el-col>
         </el-col>
@@ -15,19 +33,35 @@
 </template>
 </template>
 
 
 <script>
 <script>
+import { juris } from '@common/dict/index';
+import cselect from '@/components/c-select.vue';
 import top from '@/layout/common/top.vue';
 import top from '@/layout/common/top.vue';
 import foot from '@/layout/common/foot.vue';
 import foot from '@/layout/common/foot.vue';
 import { mapState, createNamespacedHelpers } from 'vuex';
 import { mapState, createNamespacedHelpers } from 'vuex';
+const { mapActions: mechanism } = createNamespacedHelpers('mechanism');
 export default {
 export default {
   name: 'mechanism',
   name: 'mechanism',
   props: {},
   props: {},
   components: {
   components: {
     top,
     top,
     foot,
     foot,
+    cselect,
   },
   },
   data: function () {
   data: function () {
     return {
     return {
       clientHeight: '',
       clientHeight: '',
+      form: {},
+      fields: [
+        { label: '机构名', model: 'name', rules: [{ required: true, message: '请填写机构名' }] },
+        { label: '联系人', model: 'contacts', rules: [{ required: true, message: '请填写联系人' }] },
+        { label: '联系电话', model: 'phone', rules: [{ required: true, message: '请填写联系电话' }] },
+        { label: '密码', model: 'passwd', type: 'password', rules: [{ required: true, message: '请填写密码' }] },
+        { label: '电子邮箱', model: 'email', rules: [{ required: true, message: '请填写电子邮箱' }] },
+        { label: '联系地址', model: 'address', rules: [] },
+        { label: '所属行业', model: 'industry', rules: [] },
+        { label: '辖区', model: 'juris', type: 'select', rules: [{ required: true, message: '请选择辖区' }] },
+      ],
+      jurisList: juris,
     };
     };
   },
   },
   async created() {},
   async created() {},
@@ -35,7 +69,16 @@ export default {
     let clientHeight = (document.documentElement.clientHeight || document.body.clientHeight) - 80;
     let clientHeight = (document.documentElement.clientHeight || document.body.clientHeight) - 80;
     this.$set(this, `clientHeight`, clientHeight);
     this.$set(this, `clientHeight`, clientHeight);
   },
   },
-  methods: {},
+  methods: {
+    ...mechanism(['create']),
+    async onSubmit() {
+      let dup = _.cloneDeep(this.form);
+      const res = await this.create(dup);
+      if (this.$checkRes(res, '提交成功', res.errmsg || '提交失败')) {
+        // TODO:不知道干啥
+      }
+    },
+  },
   computed: {
   computed: {
     ...mapState(['user']),
     ...mapState(['user']),
   },
   },