zs před 1 rokem
rodič
revize
106c5d1d23
3 změnil soubory, kde provedl 168 přidání a 0 odebrání
  1. 6 0
      config.js
  2. 7 0
      pages.json
  3. 155 0
      pagesMy/statistics/index.vue

+ 6 - 0
config.js

@@ -92,6 +92,12 @@ export default {
 			title: "维修记录",
 			role: ['cs'],
 			route: "pagesMy/maintenance/index",
+		},
+		{
+			icon: "icon-shenpi1",
+			title: "回款统计",
+			role: ['cs'],
+			route: "pagesMy/statistics/index",
 		},
 		{
 			icon: "icon-yonghu",

+ 7 - 0
pages.json

@@ -160,6 +160,13 @@
 					"style": {
 						"navigationBarTitleText": "新增规格"
 					}
+				},
+				{
+					"path": "statistics/index",
+					"style": {
+						"navigationBarTitleText": "回款统计",
+						"enablePullDownRefresh": true
+					}
 				}
 			]
 		},

+ 155 - 0
pagesMy/statistics/index.vue

@@ -0,0 +1,155 @@
+<template>
+	<view class="content">
+		<view class="one">
+			<picker :range="years" @change="yearChange">
+				{{ years[yearsIndex] }}
+			</picker>
+		</view>
+		<view class="two">
+			<scroll-view scroll-y="true" class="scroll-view">
+				<view class="list-scroll-view">
+					<view class="list" v-for="(item,index) in list" :key="index" @tap="toInfo(item)">
+						<view class="list_1">
+							{{item.year||'暂无'}}
+						</view>
+						<view class="list_2">
+							总回款金额:
+							<text>¥{{item.money||'0'}}</text>
+						</view>
+					</view>
+				</view>
+			</scroll-view>
+		</view>
+	</view>
+</template>
+
+<script>
+	export default {
+		data() {
+			return {
+				// 系统设置
+				config: {},
+				user: {},
+				searchInfo: {},
+				list: [],
+				years: ["请选择年份", 2022, 2023, 2024, 2025, 2026, 2027, 2028, 2029, 2030, 2031, 2032, 2033, 2034, 2035, 2036,
+					2037, 2038, 2039, 2040, 2041, 2042, 2043, 2044, 2045, 2045, 2047, 2048, 2049, 2050
+				],
+				yearsIndex: 0
+			}
+		},
+		onLoad: function(e) {
+			const that = this;
+		},
+		onShow: async function(e) {
+			const that = this;
+			that.searchToken();
+		},
+		onPullDownRefresh: async function() {
+			const that = this;
+			await that.search();
+			uni.stopPullDownRefresh();
+		},
+		methods: {
+			searchToken() {
+				const that = this;
+				try {
+					const res = uni.getStorageSync('token');
+					if (res) {
+						that.$set(that, `user`, res);
+					}
+				} catch (e) {
+					uni.showToast({
+						title: err.errmsg,
+						icon: 'error',
+						duration: 2000
+					});
+				}
+			},
+			async search() {
+				const that = this;
+				let user = that.user;
+				let info = {
+					time: that.years[that.yearsIndex],
+					supplier: user._id,
+				};
+				let res;
+				res = await that.$api(`/Statistics/orderDetail`, 'GET', {
+					...info
+				});
+				if (res.errcode == '0') {
+					that.$set(that, `list`, res.data);
+				} else {
+					uni.showToast({
+						title: res.errmsg,
+						icon: 'none'
+					})
+				}
+			},
+			yearChange: function(e) {
+				const that = this;
+				that.$set(that, `yearsIndex`, e.detail.value);
+				if (that.yearsIndex != 0) that.search();
+			},
+			// 查看详情
+			toInfo(e) {
+				console.log(e);
+			},
+		}
+	}
+</script>
+
+<style lang="scss">
+	.content {
+		display: flex;
+		flex-direction: column;
+		width: 100vw;
+		height: 100vh;
+
+		.one {
+			padding: 2vw;
+		}
+
+		.two {
+			position: relative;
+			flex-grow: 1;
+			background-color: var(--f9Color);
+
+			.list {
+				background-color: #fff;
+				border: 1px solid var(--f5Color);
+				padding: 2vw;
+				margin: 2vw 2vw 0 2vw;
+				border-radius: 5px;
+
+				.list_1 {
+					padding: 0 1vw;
+					font-size: var(--font16Size);
+					font-weight: bold;
+				}
+
+				.list_2:last-child {
+					padding: 1vw;
+					font-size: var(--font14Size);
+
+					text {
+						color: var(--fF0Color);
+					}
+				}
+			}
+		}
+	}
+
+	.scroll-view {
+		position: absolute;
+		top: 0;
+		left: 0;
+		right: 0;
+		bottom: 0;
+
+		.list-scroll-view {
+			display: flex;
+			flex-direction: column;
+		}
+	}
+</style>