YY há 2 anos atrás
pai
commit
49292a5b73

+ 7 - 1
src/layout/data/menu.js

@@ -72,7 +72,7 @@ export const adminMenu = [
         icon: 'icon-rencai',
         path: '/system/goodsRate',
         name: '商品评价',
-        index: '3-4',
+        index: '2-10',
       },
     ],
   },
@@ -112,6 +112,12 @@ export const adminMenu = [
         name: '售后管理',
         index: '3-5',
       },
+      {
+        icon: 'icon-rencai',
+        path: '/selfShop/bill',
+        name: '账单管理',
+        index: '3-6',
+      },
     ],
   },
 ];

+ 6 - 0
src/router/module/selfShop.js

@@ -59,4 +59,10 @@ export default [
     meta: { title: '自营店铺-商品评价' },
     component: () => import(/* webpackChunkName: "selfShop_goodsRate_detail" */ '@/views/selfShop/goodsRate/detail.vue'),
   },
+  {
+    path: '/selfShop/bill',
+    name: 'selfShop_bill',
+    meta: { title: '自营店铺-账单管理' },
+    component: () => import(/* webpackChunkName: "selfShop_bill" */ '@/views/selfShop/bill/index.vue'),
+  },
 ];

+ 4 - 2
src/store/index.js

@@ -4,8 +4,9 @@ import * as ustate from './module/user/state';
 import * as umutations from './module/user/mutations';
 import admin from './module/user/action';
 
-import todo from './module/static/todo';
-import sellTotal from './module/static/sellTotal';
+import todo from './module/statistics/todo';
+import sellTotal from './module/statistics/sellTotal';
+import getBill from './module/statistics/getBill';
 
 import dictIndex from './module/dev/dictIndex';
 import dictData from './module/dev/dictData';
@@ -57,5 +58,6 @@ export default new Vuex.Store({
     actTags,
     config,
     goodsRate,
+    getBill,
   },
 });

+ 44 - 0
src/store/module/statistics/getBill.js

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

src/store/module/static/sellTotal.js → src/store/module/statistics/sellTotal.js


src/store/module/static/todo.js → src/store/module/statistics/todo.js


+ 172 - 0
src/views/selfShop/bill/index.vue

@@ -0,0 +1,172 @@
+<template>
+  <div id="card-1">
+    <el-row>
+      <el-col :span="24" class="main">
+        <el-col :span="24" class="one">
+          <search-1 :form="searchForm" @onSubmit="search" @toReset="toClose"></search-1>
+        </el-col>
+        <el-col>
+          <el-button type="primary" @click="toFile()">对账</el-button>
+        </el-col>
+        <el-col :span="24" class="two">
+          净销售额:<span>{{ info.total || '暂无' }}</span> 元
+        </el-col>
+        <el-col :span="24">
+          <el-tabs type="border-card">
+            <el-tab-pane label="订单">
+              <data-table :fields="orderfields" @query="search" :data="orderList" :usePage="false"> </data-table>
+            </el-tab-pane>
+            <el-tab-pane label="售后单">
+              <data-table :fields="afterSalefields" @query="search" :data="afterSaleList" :usePage="false"> </data-table>
+            </el-tab-pane>
+          </el-tabs>
+        </el-col>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script>
+const _ = require('lodash');
+import FileSaver from 'file-saver';
+const ExcelJS = require('exceljs');
+import { mapState, createNamespacedHelpers } from 'vuex';
+const { mapActions } = createNamespacedHelpers('getBill');
+const { mapActions: selfShop } = createNamespacedHelpers('selfShop');
+export default {
+  name: 'card-1',
+  props: {},
+  components: { search1: () => import('./parts/search-1.vue') },
+  data: function () {
+    return {
+      searchForm: {},
+      info: {},
+      afterSaleList: [],
+      orderList: [],
+      orderfields: [
+        { label: '订单号', model: 'no' },
+        { label: '订单类型', model: 'type' },
+        { label: '支付时间', model: 'pay_time' },
+        { label: '商品', model: 'goods' },
+        { label: '规格', model: 'spec' },
+        { label: '购买数量', model: 'buy_num' },
+        { label: '单价', model: 'price' },
+        { label: '优惠金额', model: 'discount' },
+        { label: '总价', model: 'total' },
+      ],
+      afterSalefields: [
+        { label: '订单号', model: 'no' },
+        { label: '商品', model: 'goods' },
+        { label: '规格', model: 'spec' },
+        { label: '退款时间', model: 'end_time' },
+        { label: '退款金额', model: 'money' },
+      ],
+      // 多选值
+      selected: [],
+      // 自营店铺信息
+      shop: {},
+    };
+  },
+  async created() {
+    await this.search();
+    await this.searchOther();
+  },
+  methods: {
+    ...mapActions(['query', 'fetch', 'create', 'update', 'delete']),
+    ...selfShop(['getInfo']),
+    // 查询
+    async search({ skip = 0, limit = 10, ...info } = {}) {
+      let condition = _.cloneDeep(this.searchForm);
+      if (condition.buy_time) {
+        condition[`start`] = _.head(condition.buy_time);
+        condition[`end`] = _.last(condition.buy_time);
+        delete condition.buy_time;
+        let res = await this.query({ skip, limit, ...condition, ...info, shop: _.get(this.shop, '_id') });
+        if (this.$checkRes(res)) {
+          this.$set(this, 'info', res.data);
+          this.$set(this, 'afterSaleList', res.data.afterSaleList);
+          this.$set(this, 'orderList', res.data.orderList);
+        }
+      }
+    },
+    toClose() {
+      this.searchForm = {};
+      this.search();
+    },
+    // 导出清单
+    toFile() {
+      const workbook = new ExcelJS.Workbook();
+      let orderList = this.orderList;
+      const worksheet_one = workbook.addWorksheet('订单');
+      let data_one = [['订单号', '订单类型', '支付时间', '商品', '规格', '购买数量', '单价', '优惠金额', '总价']];
+      for (const p1 of orderList) {
+        let p2 = [[p1.no, p1.type, p1.pay_time, p1.goods, p1.spec, p1.buy_num, p1.price, p1.discount, p1.total]];
+        data_one.push(...p2);
+      }
+      for (const val of data_one) {
+        worksheet_one.addRow(val);
+      }
+      let afterSaleList = this.afterSaleList;
+      const worksheet_two = workbook.addWorksheet('售后单');
+      let data_two = [['订单号', '商品', '规格', '退款时间', '退款金额']];
+      for (const p1 of afterSaleList) {
+        let p2 = [[p1.no, p1.goods, p1.spec, p1.end_time, p1.money]];
+        data_two.push(...p2);
+      }
+      for (const val of data_two) {
+        worksheet_two.addRow(val);
+      }
+      worksheet_one.columns.forEach(function (column, i) {
+        column.width = 20;
+      });
+      worksheet_two.columns.forEach(function (column, i) {
+        column.width = 20;
+      });
+      workbook.xlsx.writeBuffer().then((buffer) => {
+        FileSaver.saveAs(
+          new Blob([buffer], {
+            type: 'application/octet-stream',
+          }),
+          `对账单.xlsx`
+        );
+      });
+    },
+    // 查询其他信息
+    async searchOther() {
+      let res;
+      res = await this.getInfo();
+      if (this.$checkRes(res)) this.$set(this, `shop`, res.data);
+    },
+  },
+  computed: {
+    ...mapState(['user']),
+  },
+  metaInfo() {
+    return { title: this.$route.meta.title };
+  },
+  watch: {
+    test: {
+      deep: true,
+      immediate: true,
+      handler(val) {},
+    },
+  },
+};
+</script>
+
+<style lang="less" scoped>
+.one {
+  margin: 0 0 10px 0;
+}
+.two {
+  span {
+    color: red;
+  }
+}
+.title {
+  text-align: center;
+}
+.el-col {
+  margin: 10px 0;
+}
+</style>

+ 73 - 0
src/views/selfShop/bill/parts/search-1.vue

@@ -0,0 +1,73 @@
+<template>
+  <div id="search-1">
+    <el-row>
+      <el-col :span="24" class="main">
+        <el-form :model="form" ref="form" label-width="130px">
+          <el-col :span="7">
+            <el-form-item label="日期" prop="buy_time">
+              <el-date-picker
+                v-model="form.buy_time"
+                type="daterange"
+                range-separator="至"
+                start-placeholder="开始日期"
+                end-placeholder="结束日期"
+                value-format="yyyy-MM-dd"
+              >
+              </el-date-picker>
+            </el-form-item>
+          </el-col>
+          <el-col :span="24" class="btn">
+            <el-button type="primary" icon="el-icon-search" size="mini" @click="onSubmit('form')">搜索</el-button>
+            <el-button icon="el-icon-refresh" size="mini" @click="toReset('form')">重置</el-button>
+          </el-col>
+        </el-form>
+      </el-col>
+    </el-row>
+  </div>
+</template>
+
+<script>
+import { mapState, createNamespacedHelpers } from 'vuex';
+export default {
+  name: 'search-1',
+  props: { form: { type: Object } },
+  components: {},
+  data: function () {
+    return {};
+  },
+  created() {},
+  methods: {
+    onSubmit() {
+      this.$emit('onSubmit');
+    },
+    toReset(formName) {
+      this.$refs[formName].resetFields();
+      this.$emit('toReset');
+    },
+  },
+  computed: {},
+  metaInfo() {
+    return { title: this.$route.meta.title };
+  },
+  watch: {
+    test: {
+      deep: true,
+      immediate: true,
+      handler(val) {},
+    },
+  },
+};
+</script>
+
+<style lang="less" scoped>
+.main {
+  .btn {
+    text-align: right;
+  }
+  /deep/.el-form-item {
+    float: left;
+    width: 100%;
+    margin: 0 0 10px 0;
+  }
+}
+</style>

+ 4 - 2
src/views/selfShop/goods/spec.vue

@@ -97,7 +97,9 @@ export default {
         { label: '开团人数', model: 'need_person', type: 'number' },
         { label: '图片', model: 'file', type: 'upload', url: '/files/point/goodsSpec/upload' },
       ],
-      rules: {},
+      rules: {
+        freight: [{ required: true, message: '请输入运费', trigger: 'blur' }],
+      },
       form: {},
 
       statusList: [],
@@ -121,7 +123,7 @@ export default {
     ...mapActions(['query', 'fetch', 'update', 'delete', 'create']),
     ...methodUtil,
     initAddData() {
-      const obj = { goods: this.goods, status: '0', can_group: '1' };
+      const obj = { goods: this.goods, status: '0', can_group: '1', freight: '0' };
       this.$set(this, 'form', obj);
     },
     async toSave({ data }) {

+ 0 - 1
src/views/selfShop/order/parts/parts/detail-1.vue

@@ -74,7 +74,6 @@ export default {
       info.status = '1';
       let res = await this.query({ skip, limit, ...condition, ...info, shop: _.get(this.shop, '_id') });
       if (this.$checkRes(res)) {
-        console.log(res.data);
         this.$set(this, 'list', res.data);
         this.$set(this, 'total', res.total);
       }