Forráskód Böngészése

科技超市更新

guhongwei 5 éve
szülő
commit
c1b4c7add5

+ 8 - 9
src/layout/supermarket/fabu.vue

@@ -13,21 +13,20 @@
           <el-col :span="12" class="fabuList" v-for="(item, index) in fabuList" :key="index">
             <el-link :underline="false">
               <el-col :span="5" class="image">
-                <el-image style="width:100px;height:97px;" :src="item.pic"></el-image>
+                <el-image style="width:100px;height:97px;" :src="item.url"></el-image>
               </el-col>
               <el-col :span="19" class="fabuListInfo">
                 <el-col :span="23" class="title">
-                  <span class="textOver">{{ item.title }}</span>
-                </el-col>
-                <el-col :span="1" class="num">
-                  {{ item.num }}
+                  <span class="textOver">{{ item.name }}</span>
                 </el-col>
                 <el-col :span="16" class="company">
-                  <span class="textOver">所属企业:{{ item.company }}</span>
+                  <span class="textOver">所属企业:长春福瑞科技</span>
                 </el-col>
-                <el-col :span="8" class="status"> 认证状态:{{ item.status }}</el-col>
-                <el-col :span="14" class="type">类别:{{ item.type }}</el-col>
-                <el-col :span="10" class="date">上架时间:{{ item.date }}</el-col>
+                <el-col :span="8" class="status"> 认证状态:{{ item.state }}</el-col>
+                <el-col :span="14" class="type">类别:{{ item.product_type_name }}</el-col>
+                <el-col :span="10" class="date"
+                  >上架时间:{{ item.meta && item.meta.createdAt ? new Date(item.meta.createdAt).toLocaleDateString() : '' || '' }}</el-col
+                >
               </el-col>
             </el-link>
           </el-col>

+ 2 - 0
src/store/index.js

@@ -17,6 +17,7 @@ import policieszhuanjia from './policieszhuanjia';
 import policiesjbxx from './policiesjbxx';
 import market from './market';
 import enterpriseproject from './enterpriseproject';
+import transaction from './transaction';
 
 Vue.use(Vuex);
 
@@ -39,6 +40,7 @@ export default new Vuex.Store({
     policiesjbxx,
     market,
     enterpriseproject,
+    transaction,
   },
   state: {},
   mutations: {},

+ 38 - 0
src/store/transaction.js

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

+ 26 - 22
src/views/supermaket/supermarket.vue

@@ -13,6 +13,9 @@
 
 <script>
 import supermarketDetail from '@/components/supermaket/supermarket.vue';
+import { createNamespacedHelpers, mapGetters } from 'vuex';
+const { mapActions: mapSite } = createNamespacedHelpers('site');
+const { mapActions: mapProduct } = createNamespacedHelpers('enterpriseproject');
 export default {
   name: 'supermarket',
   props: {},
@@ -72,26 +75,7 @@ export default {
         date: '2019-12-26',
       },
     ],
-    fabuList: [
-      {
-        pic: require('@/assets/fabu.jpg'),
-        title: '标题',
-        num: '供',
-        company: '福瑞科技',
-        status: '已认证',
-        type: 'LS',
-        date: '2019-12-26',
-      },
-      {
-        pic: require('@/assets/fabu.jpg'),
-        title: '六条数据',
-        num: '供',
-        company: '福瑞科技',
-        status: '已认证',
-        type: 'LS',
-        date: '2019-12-26',
-      },
-    ],
+    fabuList: [],
     tableData: [
       {
         market: '系统管理员',
@@ -107,9 +91,29 @@ export default {
       },
     ],
   }),
-  created() {},
+  created() {
+    this.searchSite();
+    this.searchInfo();
+  },
   computed: {},
-  methods: {},
+  methods: {
+    ...mapSite(['showInfo']),
+    ...mapProduct({ ProductQuery: 'query', ProductFetch: 'fetch', ProductDelete: 'delete' }),
+    // 查询站点信息
+    async searchSite() {
+      let res = await this.showInfo();
+      let object = JSON.parse(JSON.stringify(res.data));
+      if (object) {
+        this.$set(this, `info`, res.data);
+      } else {
+        this.$message.error(res.errmsg ? res.errmsg : 'error');
+      }
+    },
+    async searchInfo({ skip = 0, limit = 6, ...info } = {}) {
+      const res = await this.ProductQuery({ skip, limit, ...info });
+      this.$set(this, `fabuList`, res.data);
+    },
+  },
 };
 </script>