shish 2 лет назад
Родитель
Сommit
6919417755
2 измененных файлов с 154 добавлено и 1 удалено
  1. 2 1
      ghs/src/mock/userInfo.js
  2. 152 0
      ghs/src/views/assets/incomeClass.vue

+ 2 - 1
ghs/src/mock/userInfo.js

@@ -182,9 +182,10 @@ let menu = {
 		{id: '11',parentId: null,name: '邀请',type: 1,icon: 'iconyaoqingyouli',orderNum: 11,router: '/pages/admin/my-invite',viewPath: 'views/my-invite/index.vue',keepAlive: 1},
         {id: '1101',parentId: 11,name: '邀请注册',type: 1,icon: 'iconyaoqingyouli',orderNum: 11,router: '/pages/admin/my-invite',viewPath: 'views/my-invite/index.vue',keepAlive: 1},
 
-		{id: '12',parentId: null,name: '资产',type: 0,icon: 'icondingdanguanli',orderNum: 12,router: '/assets/list',viewPath: 'views/assets/list.vue',keepAlive: 1},
+		{id: '12',parentId: null,name: '统计',type: 0,icon: 'icondingdanguanli',orderNum: 12,router: '/assets/list',viewPath: 'views/assets/list.vue',keepAlive: 1},
 		{id: '1201',parentId: '12',name: '收入明细',type: 1,icon: 'icondingdanguanli',orderNum: 12,router: '/assets/list',viewPath: 'views/assets/list.vue',keepAlive: 1},
 		{id: '1202',parentId: '12',name: '支出明细',type: 1,icon: 'icondingdanguanli',orderNum: 12,router: '/assets/expendList',viewPath: 'views/assets/expendList.vue',keepAlive: 1},
+		{id: '1203',parentId: '12',name: '收支分类',type: 1,icon: 'icondingdanguanli',orderNum: 12,router: '/assets/incomeClass',viewPath: 'views/assets/incomeClass.vue',keepAlive: 1},
 		
 		{id: '13',parentId: null,name: '设置',type: 0,icon: 'iconshezhi',orderNum: 12,router: '/goods/list',viewPath: 'views/goods/goods-list.vue',keepAlive: 1},
 		{id: '1301',parentId: '13',name: '密码设置',type: 1,icon: 'iconkehuguanli',orderNum: 12,router: '/setting/set-password',viewPath: 'views/setting/set-password.vue',keepAlive: 1}

+ 152 - 0
ghs/src/views/assets/incomeClass.vue

@@ -0,0 +1,152 @@
+<template>
+	<div class="shop-list">
+		<x-crud @load="onLoad">
+			<template #slot-date-select>
+                <el-date-picker v-model="currentDateList" type="daterange" align="right" unlink-panels range-separator="至" start-placeholder="开始日期" @change="getDate" value-format="yyyy-MM-dd"
+                end-placeholder="结束日期" :picker-options="pickerOptions" size="mini"> </el-date-picker>
+			</template>
+
+			<template #slot-order-debt="{scope}">
+				<el-radio-group v-model="debt" @change="changeDebt" style="margin-right:20px;padding-top:6px;margin-left:20px;">
+				<el-radio label="0">全部</el-radio>
+				<el-radio label="1">待结款</el-radio>
+                <el-radio label="2">已结款</el-radio>
+				</el-radio-group>
+			</template>
+
+            <template #slot-total-amount>
+				<span style="font-size:15px;font-weight:bold;">累计金额:{{ totalAmount }}</span>
+			</template>
+
+			<template #slot-export-due>
+				<el-button type="primary" size="mini" style="margin-left:60px;" @click="exportDue()">导出数据</el-button>
+			</template>
+
+		</x-crud>
+	</div>
+</template>
+<script>
+import { mapGetters } from 'vuex';
+export default {
+	data() {
+		return {
+			crud: null,
+            pickerOptions: {
+            shortcuts: [{
+                text: '最近一周',
+                onClick(picker) {
+                const end = new Date();
+                const start = new Date();
+                start.setTime(start.getTime() - 3600 * 1000 * 24 * 7);
+                picker.$emit('pick', [start, end]);
+                }
+            }, {
+                text: '最近一个月',
+                onClick(picker) {
+                const end = new Date();
+                const start = new Date();
+                start.setTime(start.getTime() - 3600 * 1000 * 24 * 30);
+                picker.$emit('pick', [start, end]);
+                }
+            }, {
+                text: '最近三个月',
+                onClick(picker) {
+                const end = new Date();
+                const start = new Date();
+                start.setTime(start.getTime() - 3600 * 1000 * 24 * 90);
+                picker.$emit('pick', [start, end]);
+                }
+            }]
+            },
+            currentDateList:'',
+            startTime:'',
+            endTime:'',
+            searchTime:'',
+            totalAmount:0,
+            debt:'0'
+		};
+	},
+	computed: {
+		...mapGetters(['shopInfo']),
+	},
+	methods: {
+		exportDue(){
+			this.$service.purchaseOrder.dueList({searchTime:this.searchTime,startTime:this.startTime,endTime:this.endTime,debt:this.debt,export:1}).then(res => {
+				if(res.file){
+					window.location.href = res.file
+				}
+			})
+		},
+		onLoad({ ctx, app }) {
+                this.app = app;
+                ctx.service({
+                    page: () => {
+                        return this.$service.purchaseOrder.dueList({searchTime:this.searchTime,startTime:this.startTime,endTime:this.endTime,debt:this.debt}).then((res) => {
+                            this.totalAmount = res.totalAmount ? res.totalAmount : 0
+                            return {
+                                list: res.list
+                            };
+                        });
+                    }
+                })
+				.set('table', {
+					columns: [
+						{
+							label: 'ID',
+							prop: 'id',
+							align: 'center',
+						},
+						{
+							label: '名称',
+							prop: 'name',
+							align: 'center',
+						},
+						{
+							label: '金额',
+							prop: 'amount',
+							align: 'center',
+						}
+					],
+					op: {
+						visible: true,
+						props: {
+							width: 250,
+							align: 'center',
+							fixed: 'right',
+							label: '操作'
+						},
+						layout: []
+					}
+				})
+				.set('layout', [
+					[   'slot-date-select',
+                        'slot-order-debt',
+						'flex1',
+                        'slot-export-due',
+						'refresh-btn',
+					],
+					[ 'data-table' ],
+                    ['slot-total-amount','flex1']
+				])
+				.done();
+			    app.refresh();
+		},
+        getDate(){
+            this.searchTime = 'custom'
+            this.startTime = this.currentDateList[0]
+            this.endTime = this.currentDateList[1]
+            this.app.refresh({searchTime:this.searchTime,startTime:this.startTime,endTime:this.endTime,debt:this.debt});
+        },
+    	changeDebt(e){
+			this.debt = e
+			this.app.refresh({searchTime:this.searchTime,startTime:this.startTime,endTime:this.endTime,debt:this.debt})
+		},
+	},
+};
+</script>
+
+<style lang="stylus" scoped>
+.shop-list {
+  height: 100%;
+}
+</style>