shish 2 anni fa
parent
commit
534de27881
2 ha cambiato i file con 162 aggiunte e 0 eliminazioni
  1. 1 0
      ghs/src/mock/userInfo.js
  2. 161 0
      ghs/src/views/assets/cgItem.vue

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

@@ -188,6 +188,7 @@ let menu = {
 		{id: '1202',parentId: '12',name: '支出明细',type: 1,icon: 'icondingdanguanli',orderNum: 12,router: '/assets/expendList',viewPath: 'views/assets/expendList.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: '1203',parentId: '12',name: '收支分类',type: 1,icon: 'icondingdanguanli',orderNum: 12,router: '/assets/incomeClass',viewPath: 'views/assets/incomeClass.vue',keepAlive: 1},
 		{id: '1205',parentId: '12',name: '花材销量',type: 1,icon: 'icondingdanguanli',orderNum: 12,router: '/assets/itemSale',viewPath: 'views/assets/itemSale.vue',keepAlive: 1},
 		{id: '1205',parentId: '12',name: '花材销量',type: 1,icon: 'icondingdanguanli',orderNum: 12,router: '/assets/itemSale',viewPath: 'views/assets/itemSale.vue',keepAlive: 1},
+		{id: '1210',parentId: '12',name: '采购花材',type: 1,icon: 'icondingdanguanli',orderNum: 12,router: '/assets/cgItem',viewPath: 'views/assets/cgItem.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: '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}
 		{id: '1301',parentId: '13',name: '密码设置',type: 1,icon: 'iconkehuguanli',orderNum: 12,router: '/setting/set-password',viewPath: 'views/setting/set-password.vue',keepAlive: 1}

+ 161 - 0
ghs/src/views/assets/cgItem.vue

@@ -0,0 +1,161 @@
+<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-export-due>
+				<el-button type="primary" size="mini" style="margin-left:60px;" @click="exportData()">导出数据</el-button>
+			</template>
+
+            <template #slot-total-amount>
+				<span style="font-size:15px;font-weight:bold;">{{totalNum}} 笔 ¥{{ totalAmount }} 总毛利 {{ totalMl }}</span>
+			</template>
+
+			<template #table-column-mll="{scope}">
+				<span>{{ scope.row.mll }}%</span>
+        	</template>
+
+			<template #table-column-num="{scope}">
+				<span>{{ scope.row.num?parseFloat(scope.row.num):0 }}</span>
+        	</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,
+			totalNum:0,
+			totalMl:0
+		}
+	},
+	computed: {
+		...mapGetters(['shopInfo']),
+	},
+	methods: {
+		exportData(){
+			this.$service.statItem.getShow({searchTime:this.searchTime,startTime:this.startTime,endTime:this.endTime,export:1}).then(res => {
+				if(res.file){
+					window.location.href = res.file
+				}
+			})
+		},
+		onLoad({ ctx, app }) {
+                this.app = app;
+                ctx.service({
+                    page: () => {
+                        return this.$service.statItem.getShow({searchTime:this.searchTime,startTime:this.startTime,endTime:this.endTime}).then((res) => {
+							this.totalAmount = res.totalAmount||0
+							this.totalMl = res.totalMl||0
+							this.totalNum = res.totalNum||0
+							let list = [...res.list]
+                            return {
+                                list: list
+                            };
+                        });
+                    }
+                })
+				.set('table', {
+					columns: [
+						{
+							label: '名称',
+							prop: 'name',
+							align: 'center',
+						},
+						{
+							label: '总数量',
+							prop: 'num',
+							align: 'center',
+						},
+						{
+							label: '总金额',
+							prop: 'amount',
+							align: 'center',
+						},
+						{
+							label: '毛利',
+							prop: 'gross',
+							align: 'center',
+						},
+						{
+							label: '毛利率',
+							prop: 'mll',
+							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});
+        }
+	},
+};
+</script>
+
+<style lang="stylus" scoped>
+.shop-list {
+  height: 100%;
+}
+</style>