Browse Source

后台管理

yangchaowen 2 years ago
parent
commit
f537b246c2
4 changed files with 904 additions and 16 deletions
  1. 7 0
      pages.json
  2. 393 15
      pages/admin/index.vue
  3. 503 0
      pages/term/manage.vue
  4. 1 1
      pages/user/user.vue

+ 7 - 0
pages.json

@@ -235,6 +235,13 @@
                 "navigationBarTitleText" : "我的团队"
             }
         },
+		{
+		    "path" : "pages/term/manage",
+		    "style" : {
+		        "navigationBarTitleText" : "团队管理"
+		    }
+		},
+		
         {
             "path" : "pages/wallet/index",
             "style" : {

+ 393 - 15
pages/admin/index.vue

@@ -20,13 +20,13 @@
 			<view class="box">
 				<view class="totalAllTitle">今日营业额(元)</view>
 				<view class="total">
-					<view class="totalNum">{{ info.money }}</view>
+					<view class="totalNum">{{ info.today }}</view>
 				</view>
 
 				<view class="datas">
 					<view class="dataItem">
 						<view>昨日营业额</view>
-						<view>{{ info.rozenAmount }}</view>
+						<view>{{ info.yesterday }}</view>
 						<!-- <image
 							src="https://ymyun-oss.oss-cn-hangzhou.aliyuncs.com/yidu_tc/public/upload/12/8/0a57e6af52d6001a69c585478c71f8b6.png"
 							mode="widthFix" class="iicon"></image> -->
@@ -34,15 +34,15 @@
 
 					<view class="dataItem">
 						<view>当月营业额</view>
-						<view>{{ info.cumulativembodiment }}</view>
+						<view>{{ info.month }}</view>
 					</view>
 
 					<view class="dataItem">
 						<view>总营业额</view>
-						<view>{{ info.cumulativencome }}</view>
+						<view>{{ info.total }}</view>
 					</view>
 				</view>
-				
+
 			</view>
 
 
@@ -61,6 +61,129 @@
 			</view>
 
 
+
+
+			<view class="box" style="padding-bottom: 30rpx;">
+				<view class="shopname">八十一坊1935(元)</view>
+
+
+				<view class="datas" style="padding-top: 30rpx;">
+					<view class="dataItem">
+						<view>今日营业额</view>
+						<view>{{ info2.bsyToday }}</view>
+						<!-- <image
+							src="https://ymyun-oss.oss-cn-hangzhou.aliyuncs.com/yidu_tc/public/upload/12/8/0a57e6af52d6001a69c585478c71f8b6.png"
+							mode="widthFix" class="iicon"></image> -->
+					</view>
+
+					<view class="dataItem">
+						<view>本月营业额</view>
+						<view>{{ info2.bsyMonth }}</view>
+					</view>
+
+					<view class="dataItem">
+						<view>总营业额</view>
+						<view>{{ info2.bsyTotal }}</view>
+					</view>
+				</view>
+
+			</view>
+
+
+
+			<view class="box" style="padding-bottom: 30rpx;">
+				<view class="shopname">成义酒坊</view>
+
+
+				<view class="datas" style="padding-top: 30rpx;">
+					<view class="dataItem">
+						<view>今日营业额</view>
+						<view>{{ info2.cyToday }}</view>
+						<!-- <image
+							src="https://ymyun-oss.oss-cn-hangzhou.aliyuncs.com/yidu_tc/public/upload/12/8/0a57e6af52d6001a69c585478c71f8b6.png"
+							mode="widthFix" class="iicon"></image> -->
+					</view>
+
+					<view class="dataItem">
+						<view>本月营业额</view>
+						<view>{{ info2.cyMonth }}</view>
+					</view>
+
+					<view class="dataItem">
+						<view>总营业额</view>
+						<view>{{ info2.cyTotal }}</view>
+					</view>
+				</view>
+
+			</view>
+
+
+
+			<view class="timeSelect">
+				<view class="pickwrap">
+					<picker class="aaaa" @change="bindPickerChange" :value="index" :range="array">
+						<view class="uni-input">{{array[index]}}
+							<view class="arow">
+								›
+							</view>
+						</view>
+
+					</picker>
+				</view>
+
+				<view>
+					收入:¥{{income}}
+				</view>
+			</view>
+
+
+
+			<block v-for="(item, index) in list" :key="index">
+				<view class="orderItem">
+					<view class="info1">
+						<view>{{item.have_paid }}</view>
+						<view>{{item.status}}
+						</view>
+					</view>
+
+					<view class="orderinfo">
+						<image :src="item.image">
+						</image>
+						<view class="orderdesc">
+							<view class="desctop">
+								<view>{{item.title}}</view>
+								<!-- <view>+{{item.score}}积分</view>	 -->
+							</view>
+
+							<view class="descbot">
+								<view>购买人:{{item.buyer||''}}</view>
+								<view>实付:¥{{item.total_price}}</view>
+							</view>
+
+
+						</view>
+
+					</view>
+
+
+					<block v-for="(item2,index2) in item.share" :key="index2">
+
+						<view class="ordertip" v-if="item2.lv !=-1">
+							<view>{{item2.lv}}级分销:{{item2.username}} </view>
+							<view>+{{item2.num}}</view>
+						</view>
+
+					</block>
+				</view>
+
+			</block>
+
+
+
+			<view v-if="!list.length" style='color:#999;text-align:center;margin:100rpx 0;'>暂无数据</view>
+
+
+
 		</view>
 
 
@@ -100,19 +223,23 @@
 	export default {
 		data() {
 			return {
-		
+
 				list2: [{
 						name: '团队管理',
 						icon: 'https://ymyun-oss.oss-cn-hangzhou.aliyuncs.com/yidu_tc/public/upload/12/8/612dcfbf599a0be79cab31e7e9ceb651.png',
-						url: '/pages/term/index'
+						url: '/pages/term/manage'
 					},
-					
+
 				],
 
 
 				info: {
 
 				},
+				
+				info2: {
+				
+				},
 
 				pages: '',
 
@@ -121,7 +248,24 @@
 					height: 0
 				},
 
-				Page: 0
+				Page: 0,
+
+				index: 0,
+
+				array: ['2022年1月', '2022年2月', '2022年3月', '2022年4月', '2022年5月', '2022年6月', '2022年7月', '2022年8月', '2022年9月',
+					'2022年10月', '2022年11月', '2022年12月'
+				],
+
+				array2: ['2022-01', '2022-02', '2022-03', '2022-04', '2022-05', '2022-06', '2022-07', '2022-08', '2022-09',
+					'2022-10', '2022-11', '2022-12',
+				],
+
+				page: 1,
+				pageSize: 10,
+				list: [],
+				loaded: false,
+				income:0
+
 			};
 		}
 		/**
@@ -133,9 +277,26 @@
 			var menuButton = uni.getMenuButtonBoundingClientRect();
 			console.log(menuButton);
 
-			this.pages = page.length,
-			this.menuButton = menuButton,
-			this.getinfo();
+			this.pages = page.length;
+			this.menuButton = menuButton;
+				
+				
+				
+				    var nowdate = new Date();
+					
+					var mounth = nowdate.getMonth();
+					
+					console.log(mounth)
+					
+					this.index = mounth
+					
+					
+					this.getinfo();  //获取统计营业额
+					
+					this.getinfo1();//获取指定类型营业额 
+					
+					this.getlist();  //获取订单列表
+
 		},
 		/**
 		 * 生命周期函数--监听页面初次渲染完成
@@ -157,13 +318,15 @@
 		 * 页面相关事件处理函数--监听用户下拉动作
 		 */
 		onPullDownRefresh: function() {
-
+			this.init();
+			this.getlist();
+			uni.stopPullDownRefresh();
 		},
 		/**
 		 * 页面上拉触底事件的处理函数
 		 */
 		onReachBottom: function() {
-
+			this.loaded || this.getlist();
 		},
 		/**
 		 * 用户点击右上角分享
@@ -171,9 +334,16 @@
 		onShareAppMessage: function() {},
 		methods: {
 
+			bindPickerChange: function(e) {
+				console.log('picker发送选择改变,携带值为', e.detail.value)
+
+				this.index = e.detail.value
+
+			},
+
 			async getinfo() {
 
-				let data = await this.$api.request('/wallet/index');
+				let data = await this.$api.request('/stats/getByDateStats');
 
 
 				console.log(data)
@@ -184,6 +354,52 @@
 
 
 			},
+			
+			async getinfo1() {
+			
+				let data = await this.$api.request('/stats/getByTypeStats');
+			
+			
+				console.log(data)
+			
+				this.info2 = data;
+			
+			
+			
+			
+			},
+			
+
+			async getlist() {
+				var that = this;
+				let res = await this.$api.request('/stats/getByDateOrder', 'GET', {
+					page: this.page,
+					count: this.pageSize,
+					date:this.array2[this.index]
+				});
+
+				console.log(res)
+				if (res) {
+						this.income = res.income
+					if (res.rows.length > 0) {
+
+						this.list = this.list.concat(res.rows);
+
+						this.page++;
+
+					} else {
+						this.loaded = true
+						this.$api.msg('没有更多数据');
+					}
+				}
+			},
+
+			init() {
+				this.page = 1
+				this.loaded = false
+				this.list = []
+			},
+
 
 
 			toPage(e) {
@@ -458,4 +674,166 @@
 		font-size: 30rpx;
 		margin-right: 12rpx;
 	}
+
+	.shopname {
+		color: #010101;
+		font-size: 28rpx;
+	}
+
+	.timeSelect {
+		display: flex;
+		justify-content: space-between;
+		align-items: center;
+		margin-bottom: 20rpx;
+		margin-top: 40rpx;
+	}
+
+	.aaaa {
+		display: flex;
+		align-items: center;
+	}
+
+	.uni-input {
+		font-size: 30rpx;
+		color: #000000;
+	}
+
+	.arow {
+		margin-left: 10rpx;
+		transform: rotate(90deg);
+		display: inline-block;
+		color: #000000;
+		font-size: 30rpx;
+	}
+
+	.timeSelect>view:nth-child(2) {
+		color: #8E8E8E;
+		font-size: 26rpx;
+	}
+
+
+	.orderItem {
+
+		background: #fff;
+		padding: 30rpx 20rpx;
+		box-sizing: border-box;
+		border-radius: 12rpx;
+		margin-bottom: 24rpx;
+	}
+
+	.info1 {
+		display: flex;
+		align-items: center;
+		justify-content: space-between;
+		margin-bottom: 12rpx;
+	}
+
+	.info1>view:nth-child(1) {
+		font-size: 24rpx;
+		color: #8E8E8E;
+	}
+
+	.info1>view:nth-child(2) {
+		font-size: 24rpx;
+		color: #7B9D3E;
+	}
+
+	.orderinfo {
+		display: flex;
+		align-items: center;
+		padding-bottom: 36rpx;
+		border-bottom: 1px solid #F0EDF1;
+	}
+
+	.orderinfo1 {
+		display: flex;
+		align-items: center;
+		margin-top: 20rpx;
+
+	}
+
+	.orderinfo1>image {
+		width: 100rpx;
+		height: 100rpx;
+	}
+
+
+	.orderinfo>image {
+		width: 100rpx;
+		height: 100rpx;
+	}
+
+	.orderdesc {
+		margin-left: 15rpx;
+		flex: 1;
+
+	}
+
+
+	.desctop {
+		display: flex;
+		align-items: center;
+		justify-content: space-between;
+		margin-bottom: 10rpx;
+	}
+
+	.desctop>view:nth-child(1) {
+		color: #010101;
+		font-size: 28rpx;
+		width: 280rpx;
+		overflow: hidden;
+		text-overflow: ellipsis;
+		white-space: nowrap;
+	}
+
+	.desctop>view:nth-child(2) {
+		font-size: 26rpx;
+		font-weight: 700;
+		color: #FB4C6F;
+	}
+
+
+	.descbot {
+		display: flex;
+		align-items: center;
+		justify-content: space-between;
+	}
+
+	.descbot>view:nth-child(1) {
+		color: #8E8E8E;
+		font-size: 28rpx;
+		width: 302rpx;
+		overflow: hidden;
+		text-overflow: ellipsis;
+		white-space: nowrap;
+	}
+
+	.descbot>view:nth-child(2) {
+		color: #8E8E8E;
+		font-size: 24rpx;
+	}
+
+	.ordertip {
+		margin: 20rpx 0 0;
+		padding-left: 136rpx;
+		box-sizing: border-box;
+		display: flex;
+		align-items: center;
+		justify-content: space-between;
+	}
+
+	.ordertip>view:nth-child(1) {
+		font-size: 24rpx;
+		color: #8E8E8E;
+		width: 350rpx;
+		overflow: hidden;
+		text-overflow: ellipsis;
+		white-space: nowrap;
+	}
+
+	.ordertip>view:nth-child(2) {
+		font-size: 26rpx;
+		font-weight: 700;
+		color: #FB4C6F;
+	}
 </style>

+ 503 - 0
pages/term/manage.vue

@@ -0,0 +1,503 @@
+<template>
+	<block>
+
+
+		<view class="iNav iflex">
+			<view class="iflexC aliCen tabItem" @tap="changeNav" :data-index="index" v-for="(item, index) in navs"
+				:key="index">
+				<text :class="'iNav-text ' + (navIndex == index ? '' : '')">{{ item.name }}</text>
+
+				<image
+					src="https://ymyun-oss.oss-cn-hangzhou.aliyuncs.com/yidu_tc/public/upload/12/8/0d08dcd267a9ecfb5aec198436d00646.png"
+					v-if="navIndex == index"></image>
+			</view>
+		</view>
+
+
+
+		<view class="content1">
+
+
+
+
+
+			<view class="mItem" v-for="(item, index) in list" :key="index">
+
+
+
+				<view class="mtop">
+					<image class="avatar"
+						:src="item.avatar || 'https://ymyun-oss.oss-cn-hangzhou.aliyuncs.com/yidu_tc/public/upload/12/8/a035c7dae49cc9904c7b0977895ffb1e.png'">
+					</image>
+
+					<view class="mInfo">
+						<view class="info1">
+							<view>
+								{{ item.username }}
+							</view>
+							<view>入团:{{ item.jointime }}</view>
+						</view>
+						<view class="info2">
+							<view>{{ item.mobile }}</view>
+							<view>自购(单):
+
+								<text class="fw700">{{ item.selfBuy }} </text>
+							</view>
+						</view>
+					</view>
+
+				</view>
+
+				<view class="mbot">
+
+					<view class="mleve">
+						{{item.name}}
+					</view>
+
+					<view class="mInfo2">
+						<view class="info3">
+							<view>
+								下级(人): <text class="fw700"> {{ item.subLevelNum }} </text>
+							</view>
+							<view>下级推广(单):<text class="fw700">{{ item.subLevelShareNum }} </text> </view>
+						</view>
+					</view>
+
+				</view>
+
+
+				<view class="newData">
+
+					<view class="newDataitem">
+						<view>直推业绩(元)</view>
+						<view>{{ item.direct}}</view>
+					</view>
+
+
+					<view class="newDataitem">
+						<view>间推业绩(元)</view>
+						<view>{{ item.directReward }}</view>
+					</view>
+
+				</view>
+
+				<view class="newData">
+
+					<view class="newDataitem">
+						<view>直推佣金(元)</view>
+						<view>{{ item.indirect }}</view>
+					</view>
+
+
+					<view class="newDataitem">
+						<view>间推佣金(元)</view>
+						<view>{{ item.indirectReward }}</view>
+					</view>
+
+				</view>
+
+
+			</view>
+
+
+
+			<view v-if="!list.length" style="color: #999; text-align: center; margin: 100rpx 0">暂无数据</view>
+
+
+		</view>
+
+
+
+
+	</block>
+</template>
+<script module="parse" lang="wxs">
+	module.exports = {
+		filterTime: function(value) {
+
+			var nowDate = getDate(value * 1000); //过期时间
+
+			var year = nowDate.getFullYear(); //当前年份
+			var month = nowDate.getMonth() + 1; //当前月份
+			var date = nowDate.getDate(); //当前几号
+			var hours = nowDate.getHours(); //当前几小时
+
+
+			return year + '-' + month + '-' + date
+		}
+
+	}
+</script>
+<script>
+	// pages/tabbar/index/index.js
+	var app = getApp();
+	export default {
+		data() {
+			return {
+				navs: [{
+						name: "黄钻",
+						group: 5
+					},
+
+					{
+						name: "金钻",
+						group: 4
+					},
+
+					{
+						name: "银钻",
+						group: 3
+					},
+				],
+				navIndex: 0,
+
+				list: [],
+				loaded: false,
+				page: 1,
+
+				pageSize: 10
+			};
+		},
+		onLoad: function(options) {
+
+			// uni.setNavigationBarTitle({
+			// 	title: '团队管理'
+			// });
+
+
+			this.getlist();
+		},
+		onPullDownRefresh: function() {},
+		onReachBottom: function() {
+			this.loaded || this.getlist();
+		},
+		onShareAppMessage: function() {},
+		methods: {
+
+
+			changeNav(e) {
+				let index = e.currentTarget.dataset.index;
+				console.log(index);
+
+				if (this.navIndex != index) {
+
+					this.navIndex = index
+					this.page = 1
+					this.list = []
+					this.loaded = false
+
+					this.getlist();
+				}
+			},
+
+
+
+
+			toPage(e) {
+				app.globalData.toPage(e);
+			},
+
+			init() {
+
+				this.page = 1
+				this.loaded = false
+				this.list = []
+
+			},
+
+			async getlist() {
+				var that = this;
+
+				let res = await this.$api.request('/stats/teamManage', 'GET', {
+					page: that.page,
+					count: that.pageSize,
+					group: that.navs[that.navIndex].group,
+
+				});
+				console.log(res)
+				if (res) {
+
+					if (res.rows.length > 0) {
+
+						this.list = this.list.concat(res.rows);
+						this.page++;
+
+						uni.setNavigationBarTitle({
+							// title: '团队管理(' + res.total + ')'
+
+							title: '团队管理'
+						});
+
+
+
+					} else {
+						this.loaded = true
+						this.$api.msg('没有更多数据');
+					}
+				}
+
+
+			}
+		}
+	};
+</script>
+<style>
+	page {
+		background: #f4f5f9;
+	}
+
+	.select {
+		padding: 30rpx 0 20rpx 0;
+		background: #fff;
+		display: flex;
+		align-items: center;
+		justify-content: space-around;
+	}
+
+	.selectItem {
+		display: flex;
+		align-items: center;
+	}
+
+	.selectItem>view {
+		font-size: 28rpx;
+	}
+
+	.selectItem>image {
+		width: 26rpx;
+		margin-left: 12rpx;
+	}
+
+	.mItem {
+		margin: 25rpx 0rpx 0;
+		background: #fff;
+		padding: 28rpx 20rpx;
+
+	}
+
+	.mtop {
+		display: flex;
+		align-items: center;
+	}
+
+	.mleve {
+		width: 130rpx;
+		height: 40rpx;
+
+		border-radius: 40rpx;
+		display: flex;
+		align-items: center;
+		justify-content: center;
+		background: #FB4C6F;
+		color: #fff;
+		margin-left: -10rpx;
+		font-size: 24rpx;
+		margin-top: 12rpx;
+	}
+
+
+	.mbot {
+		display: flex;
+		align-items: center;
+	}
+
+	.avatar {
+		width: 110rpx;
+		height: 110rpx;
+		border-radius: 50%;
+		margin-right: 30rpx;
+	}
+
+	.mInfo {
+		flex: 1;
+		height: 110rpx;
+		display: flex;
+		flex-direction: column;
+		justify-content: center;
+		border-bottom: 1px solid #F3F0F3;
+		padding-bottom: 14rpx;
+	}
+
+	.mInfo2 {
+		flex: 1;
+		display: flex;
+		flex-direction: column;
+		justify-content: center;
+		margin-top: 12rpx;
+		margin-left: 20rpx;
+	}
+
+	.info1 {
+		display: flex;
+		align-items: center;
+		justify-content: space-between;
+	}
+
+	.info1>view:nth-child(1) {
+		font-size: 30rpx;
+		color: ;
+	}
+
+	.fz28 {
+		font-size: 28rpx;
+	}
+
+	.info1>view:nth-child(2) {
+		color: #8E8E8E;
+		font-size: 24rpx;
+	}
+
+	.info2 {
+		display: flex;
+		align-items: center;
+		justify-content: space-between;
+		margin-top: 26rpx;
+	}
+
+	.info2>view:nth-child(1) {
+		color: #010101;
+		font-size: 24rpx;
+	}
+
+	.info2>view:nth-child(2) {
+		color: #8E8E8E;
+	}
+
+	.fb {
+		height: 112rpx;
+		width: 100%;
+		position: fixed;
+		bottom: 0;
+		background: #fff;
+		display: flex;
+		justify-content: center;
+		align-items: center;
+	}
+
+	.info3 {
+		display: flex;
+		align-items: center;
+		justify-content: space-between;
+		font-size: 24rpx;
+		color: #8E8E8E;
+
+	}
+
+
+	.fw700 {
+		font-weight: 700;
+		color: #010101;
+		margin-left: 4rpx;
+	}
+
+	.addAddress {
+		width: 670rpx;
+		height: 80rpx;
+		display: flex;
+		justify-content: center;
+		align-items: center;
+
+		background: #1479ff;
+		border-radius: 50rpx;
+	}
+
+	.addAddress>view {
+		color: #fff;
+		font-size: 30rpx;
+	}
+
+	.addAddress>image {
+		width: 30rpx;
+		margin-right: 14rpx;
+	}
+
+	view {
+		font-size: 24rpx;
+	}
+
+
+
+	.iNav {
+		/* padding: 0 20rpx 0; */
+		/* margin-top: 34rpx; */
+		line-height: 1;
+		padding: 0 30rpx;
+		background: #fff;
+	}
+
+	.iNav .iNav-text {
+		padding: 30rpx 0rpx 28rpx;
+		/* padding-top: 34rpx;
+	  padding-bottom: 28rpx; */
+		color: #010101;
+		font-size: 28rpx;
+	}
+
+	.iNav image {
+		width: 68rpx;
+		height: 10rpx;
+		margin-top: -28rpx;
+	}
+
+	.jsbet {
+		justify-content: space-between;
+	}
+
+	.iflex {
+		display: flex;
+		justify-content: space-around;
+	}
+
+	.aliCen {
+		align-items: center;
+	}
+
+	.iflexC {
+		display: flex;
+		flex-direction: column;
+	}
+
+	.ifontweight {
+		font-weight: 700;
+	}
+
+	.content1 {
+		padding: 0 30rpx;
+		box-sizing: border-box;
+	}
+
+	.tabItem {
+		margin-right: 70rpx;
+	}
+
+	.newData {
+		margin-top: 20rpx;
+		padding-top: 26rpx;
+		margin-left: 150rpx;
+		padding-top: 1px solid #F3F0F3;
+		display: flex;
+		align-items: center;
+	}
+
+
+
+	.newDataitem {
+		flex: 1;
+	}
+
+	.newDataitem>view:nth-child(1) {
+		font-size: 24rpx;
+		color: #8E8E8E;
+	}
+
+	.newDataitem>view:nth-child(2) {
+		font-size: 26rpx;
+		color: #010101;
+		font-weight: 700;
+		margin-top: 12rpx;
+	}
+
+	.newData>.newDataitem:nth-child(2) {
+		padding-left: 70rpx;
+	}
+</style>

+ 1 - 1
pages/user/user.vue

@@ -88,7 +88,7 @@
 					<image @click="navTo('/pages/product/product')" src="https://ss0.bdstatic.com/70cFuHSh_Q1YnxGkpoWK1HF6hhy/it/u=191678693,2701202375&fm=26&gp=0.jpg" mode="aspectFill"></image>
 				</scroll-view> -->
 				
-				<!-- <list-cell icon="icon-setting" iconColor="#e07472" title="管理后台" border="" @eventClick="$api.navTo('/pages/admin/index')"></list-cell> -->
+				<list-cell icon="icon-setting" iconColor="#e07472" title="管理后台" border="" @eventClick="$api.navTo('/pages/admin/index')"></list-cell>
 				<list-cell icon="icon-daifukuan" iconColor="#e07472" title="我的积分" :tips="info.score" @eventClick="$api.navTo('/pages/wallet/integral')"></list-cell>
 				
 				<list-cell icon="icon-daifukuan" iconColor="#e07472" title="我的钱包" tips="查看余额,提现" @eventClick="$api.navTo('/pages/wallet/index')"></list-cell>