Bladeren bron

Merge branch 'master' of http://git.cc-lotus.info/pointToNetwork/web-admin

zs 2 jaren geleden
bovenliggende
commit
87c5399a97
3 gewijzigde bestanden met toevoegingen van 69 en 2 verwijderingen
  1. 2 0
      src/store/index.js
  2. 44 0
      src/store/module/statistics/outBill.js
  3. 23 2
      src/views/selfShop/bill/index.vue

+ 2 - 0
src/store/index.js

@@ -7,6 +7,7 @@ import admin from './module/user/action';
 import todo from './module/statistics/todo';
 import sellTotal from './module/statistics/sellTotal';
 import getBill from './module/statistics/getBill';
+import outBill from './module/statistics/outBill';
 
 import dictIndex from './module/dev/dictIndex';
 import dictData from './module/dev/dictData';
@@ -61,5 +62,6 @@ export default new Vuex.Store({
     platformAct,
     goodsRate,
     getBill,
+    outBill,
   },
 });

+ 44 - 0
src/store/module/statistics/outBill.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/outBill',
+};
+
+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,
+};

+ 23 - 2
src/views/selfShop/bill/index.vue

@@ -5,7 +5,7 @@
         <el-col :span="24" class="one">
           <search-1 :form="searchForm" @onSubmit="search" @toReset="toClose"></search-1>
         </el-col>
-        <el-col>
+        <el-col :span="24" v-if="afterSaleList.length != '0' || orderList.length != '0'">
           <el-button type="primary" @click="toFile()">对账</el-button>
         </el-col>
         <el-col :span="24" class="two">
@@ -33,6 +33,7 @@ const ExcelJS = require('exceljs');
 import { mapState, createNamespacedHelpers } from 'vuex';
 const { mapActions } = createNamespacedHelpers('getBill');
 const { mapActions: selfShop } = createNamespacedHelpers('selfShop');
+const { mapActions: outBill } = createNamespacedHelpers('outBill');
 export default {
   name: 'card-1',
   props: {},
@@ -72,8 +73,9 @@ export default {
     await this.searchOther();
   },
   methods: {
-    ...mapActions(['query', 'fetch', 'create', 'update', 'delete']),
     ...selfShop(['getInfo']),
+    ...mapActions(['query', 'fetch', 'create', 'update', 'delete']),
+    ...outBill({ outQuery: 'query', outCreate: 'create' }),
     // 查询
     async search({ skip = 0, limit = 10, ...info } = {}) {
       let condition = _.cloneDeep(this.searchForm);
@@ -130,6 +132,25 @@ export default {
           `对账单.xlsx`
         );
       });
+      this.$confirm('是否确认对账?', '提示', {
+        confirmButtonText: '确定',
+        cancelButtonText: '取消',
+        type: 'warning',
+      }).then(async () => {
+        let order = [];
+        for (const p1 of this.orderList) {
+          order.push(p1._id);
+        }
+        let afterSale = [];
+        for (const p1 of this.afterSaleList) {
+          afterSale.push(p1._id);
+        }
+        let res;
+        res = await this.outCreate({ order, afterSale });
+        if (this.$checkRes(res)) {
+          this.$message({ type: `success`, message: `对账成功` });
+        }
+      });
     },
     // 查询其他信息
     async searchOther() {