shish hace 2 años
padre
commit
8bfc9f07b3

+ 1 - 0
ghsApp/src/admin/home/apply.vue

@@ -58,6 +58,7 @@ export default {
                         {name: "损耗花材",img: `${this.$constant.imgUrl}/ghs/home/jyzk.png`,url: "/admin/stat/wastage"},
                         {name: "损耗花材",img: `${this.$constant.imgUrl}/ghs/home/jyzk.png`,url: "/admin/stat/wastage"},
                         {name: "损耗总览",img: `${this.$constant.imgUrl}/ghs/home/jyzk.png`,url: "/admin/stat/waste"},
                         {name: "损耗总览",img: `${this.$constant.imgUrl}/ghs/home/jyzk.png`,url: "/admin/stat/waste"},
                         {name: "结账跟踪",img: `${this.$constant.imgUrl}/ghs/home/jyzk.png`,url: "/admin/stat/clear"},
                         {name: "结账跟踪",img: `${this.$constant.imgUrl}/ghs/home/jyzk.png`,url: "/admin/stat/clear"},
+                        {name: "按分类",img: `${this.$constant.imgUrl}/ghs/home/jyzk.png`,url: "/admin/stat/classProfit"},
                     ]
                     ]
                 },
                 },
                 {
                 {

+ 204 - 0
ghsApp/src/admin/stat/classProfit.vue

@@ -0,0 +1,204 @@
+<template>
+<view class="app-content">
+	<view class="ex-page">
+		<view class="top-bar">
+			 <DateSelect class="bar" top="0" @selectDateFn="selectDateFn" /> 
+		</view>
+		<scroll-view scroll-y scroll-with-animation class="main-view">
+			<view class="space-view ex-table">
+				<block>
+					<t-table :headerBackgroundColor="'#F0F2F6'">
+						<t-tr header>
+							<t-th>类型</t-th>
+							<t-th>金额</t-th>
+							<t-th>操作</t-th>
+						</t-tr>
+						<t-tr v-for="(item, inIndex) in profit.income" :key="inIndex">
+							<t-td><view style="color:black;font-size:30upx;">{{item.name}}</view></t-td>
+							<t-td><view style="color:black;font-size:30upx;">{{item.amount}}</view></t-td>
+							<t-td><view>-</view></t-td>
+						</t-tr>
+						<!--同个节点v-for key重复会报错,所以再包一层-->
+						<view>
+							<t-tr v-for="(item, exIndex) in profit.expend" :key="exIndex">
+								<t-td><view style="color:black;font-size:30upx;">{{item.name}}</view></t-td>
+								<t-td v-if="item.amount==0"><view style="color:black;font-size:30upx;">0</view></t-td>
+								<t-td v-else><view style="color:black;font-size:30upx;">-{{item.amount}}</view></t-td>
+								<t-td><view>-</view></t-td>
+							</t-tr>
+						</view>
+						<t-tr>
+							<t-td align="center">
+								<view style="font-weight:bold;color:black;font-size:32upx;">利润 ¥{{profit.balance||0}}</view>
+							</t-td>
+						</t-tr>
+						<block v-if="profit.wastagePrice && Number(profit.wastagePrice)>0">
+							<t-tr>
+								<t-td align="center">
+									<view style="font-weight:bold;color:red;font-size:30upx;">
+										由于花材损耗,少赚了 ¥{{profit.wastagePrice||0}}
+									</view>
+								</t-td>
+							</t-tr>
+						</block>
+					</t-table>
+				</block>
+			</view>
+		</scroll-view>
+	</view>
+</view>
+</template>
+<script>
+import AppWrapperEmpty from "@/components/app-wrapper-empty";
+import SelectList from "@/components/plugin/selectList";
+import { getClassProfit } from "@/api/stat";
+import { list } from "@/mixins";
+import ShopSelect from "@/components/module/shopSelect";
+import DateSelect from "@/components/module/dateSelect";
+import AppSearchModule from "@/components/module/app-search";
+import {mapActions, mapGetters} from "vuex";
+export default {
+	components: { SelectList, AppWrapperEmpty,ShopSelect,DateSelect,AppSearchModule},
+	mixins: [list],
+	computed: {		
+		...mapGetters(["getDictionariesInfo","getLoginInfo"])
+	},
+	data() {
+		return {
+			isShow:false,
+			customizationTime:'',
+			shopId:'',
+			itemId:'',
+			nowTime: "",
+			showTimeDropdown: false,
+			nowShop: "",
+			showShopDropdown: false,
+			dataList: [],
+			params:{
+				itemId: '',
+				searchTime:'',
+				startTime: "",
+				endTime: "",
+				shopId: "",
+				
+			},
+			profit:[],
+		};
+	},
+	onPullDownRefresh() {
+		this.resetList();
+		this._list().then(res => {
+			uni.stopPullDownRefresh();
+		});
+	},
+	onLoad(e) {
+		this.itemId = e.id;
+		this.params.itemId = e.id;
+		this.shopId = this.getLoginInfo.shopId;
+	},
+	methods: {
+		...mapActions(['setUserShopAll']),
+		//选择分店
+		selectShopFn(val){
+			this.params.shopId = val.id;
+			this.init();
+		},
+		//选择时间
+		selectDateFn(val) {
+			this.params = {...this.params,...val}
+			this.init();			
+		},
+		async init() {
+			this._list();
+		},
+		_list() {
+			let that = this
+			getClassProfit(this.params).then(res => {
+				that.profit = res.data
+			});
+		}
+	}
+};
+</script>
+<style lang="scss" scoped>
+.ex-page {
+	background: white;
+	padding-top:20upx;
+	height: 100%;
+	display: flex;
+	flex-direction: column;
+	.top-bar {
+		position: absolute;
+		left: 0;
+		top:18upx;
+		display: flex;
+		width: 100%;
+		z-index: 20;
+		.bar{
+			width: 50%;
+			height: 100%;
+			text-align: center;
+			&:nth-child(1){
+				border-right: 1upx solid #eeeeec;
+			}
+		}
+	}
+	.main-view {
+		margin-top: 50upx;
+		flex: 1;
+		background-color: #f9fbfc;
+		.space-view {
+			background-color: #fff;
+		}
+		.ex-info {
+			padding: 30upx;
+			.info-cell {
+				display: flex;
+				align-items: center;
+				font-size: 28upx;
+				&:not(:first-child) {
+					margin-top: 20upx;
+				}
+				.cell-label {
+					width: 110upx;
+					color: #666666;
+				}
+				.cell-value {
+					margin-left: 40upx;
+					color: #333;
+					&.warning {
+						color: #ffaf1d;
+					}
+					&.success {
+						color: #27c325;
+					}
+				}
+			}
+		}
+		.ex-table {
+			::v-deep.icon-info {
+				color: #333333;
+			}
+		}
+	}
+	.bar-view {
+		display: flex;
+		justify-content: space-between;
+		align-items: center;
+		padding: 0 30upx;
+		width: 100%;
+		height: 100upx;
+
+		box-shadow: 0upx -1upx 6upx 0upx rgba(4, 0, 0, 0.06);
+		.info-view {
+			font-size: 26upx;
+		}
+		.btn-view {
+			display: flex;
+			.admin-button-com {
+				margin: 0 10upx;
+			}
+		}
+	}
+}
+</style>

+ 4 - 0
ghsApp/src/api/stat/index.js

@@ -1,5 +1,9 @@
 import https from '@/plugins/luch-request_0.0.7/request'
 import https from '@/plugins/luch-request_0.0.7/request'
 
 
+export const getClassProfit = data => {
+	return https.get('/stat/class-profit', data)
+}
+
 export const getStatOrderClear = data => {
 export const getStatOrderClear = data => {
 	return https.get('/stat-clear/profile', data)
 	return https.get('/stat-clear/profile', data)
 }
 }