275 lines
		
	
	
		
			8.0 KiB
		
	
	
	
		
			Vue
		
	
	
	
			
		
		
	
	
			275 lines
		
	
	
		
			8.0 KiB
		
	
	
	
		
			Vue
		
	
	
	
| <template>
 | ||
| 	<view>
 | ||
| 		<view class="d-e-c tips-box">
 | ||
| 			<!-- <u-icon name="info-circle-fill" size="32rpx" color="#CCCCCC"></u-icon> -->
 | ||
| 			<text class="f28 gray9 ml10">{{$t('w_0157')}}</text>
 | ||
| 			<text class="f32 ml20 fb">{{formatNum(queryBonusTotal)}}</text>
 | ||
| 		</view>
 | ||
| 		<view class="d-b-c search-data border-b f26 mb20">
 | ||
| 			<view class="flex-1 gray9">{{$t('w_0352')}}</view>
 | ||
| 			<picker mode="date" :value="form.startDate" :start="startDate" :end="endDate" @change="bindDateChange1">
 | ||
| 				<view class="picker-item-data">{{ form.startDate || $t('CK_KS_3') }}</view>
 | ||
| 			</picker>
 | ||
| 			<view style="margin: 0 60rpx;">{{$t('w_0139')}}</view>
 | ||
| 			<picker mode="date" :value="form.endDate" :start="startDate" :end="endDate" @change="bindDateChange2">
 | ||
| 				<view class="picker-item-data">{{ form.endDate || $t('CK_KS_9') }}</view>
 | ||
| 			</picker>
 | ||
| 			<view class="search-radio" @click="searchSubmit"><text class="icon iconfont icon-sousuo"></text></view>
 | ||
| 		</view>
 | ||
| 
 | ||
| 		<view class="wallet-list">
 | ||
| 			<view class="bonus-item" v-for="(item,index) in listData" :key="index">
 | ||
| 				<view class="bonus-item-item">
 | ||
| 					<view class="bonus-item-name f26 gray9">{{$t('N_I_130')}}</view>
 | ||
| 					<view class="bonus-item-content f26 gray3">{{item.settleDate}}</view>
 | ||
| 				</view>
 | ||
| 				<view class="bonus-item-item">
 | ||
| 					<view class="bonus-item-name f26 gray9">{{$t('N_I_131')}}({{currencyIcon()}}) </view>
 | ||
| 					<view class="bonus-item-content f26 gray3">{{formatNum(item.directIncome)}}</view>
 | ||
| 				</view>
 | ||
| 				<view class="bonus-item-item">
 | ||
| 					<view class="bonus-item-name f26 gray9">{{$t('MN_F_T_894')}}({{currencyIcon()}}) </view>
 | ||
| 					<view class="bonus-item-content f26 gray3">{{formatNum(item.storeIncome)}}</view>
 | ||
| 				</view>
 | ||
| 				<view class="bonus-item-item">
 | ||
| 					<view class="bonus-item-name f26 gray9">{{$t('fn_042')}}({{currencyIcon()}}) </view>
 | ||
| 					<view class="bonus-item-content f26 gray3">{{formatNum(item.seePointIncome)}}</view>
 | ||
| 				</view>
 | ||
| 				<view class="bonus-item-item">
 | ||
| 					<view class="bonus-item-name f26 gray9">{{$t('N_I_132')}}({{currencyIcon()}}) </view>
 | ||
| 					<view class="bonus-item-content f26 gray3">{{formatNum(item.expandIncome)}}</view>
 | ||
| 				</view>
 | ||
| 				<view class="bonus-item-item">
 | ||
| 					<view class="bonus-item-name f26 gray9">{{$t('N_I_133')}}({{currencyIcon()}})</view>
 | ||
| 					<view class="bonus-item-content f26 gray3">{{formatNum(item.coachIncome)}}</view>
 | ||
| 				</view>
 | ||
| 				<view class="bonus-item-item">
 | ||
| 					<view class="bonus-item-name f26 gray9">{{$t('MN_F_T_120')}}({{currencyIcon()}})</view>
 | ||
| 					<view class="bonus-item-content f26 gray3">{{formatNum(item.globalPoints || 0)}}</view>
 | ||
| 				</view>
 | ||
| 				<view class="bonus-item-item">
 | ||
| 					<view class="bonus-item-name f26 gray9">{{$t('fn_043')}}({{currencyIcon()}})</view>
 | ||
| 					<view class="bonus-item-content f26 gray3">{{formatNum(item.shareIncome)}}</view>
 | ||
| 				</view>
 | ||
| 				<view class="bonus-item-item">
 | ||
| 					<view class="bonus-item-name f26 gray9">{{$t('N_I_136')}}({{currencyIcon()}})</view>
 | ||
| 					<view class="bonus-item-content f26 gray3">{{formatNum(item.backPoints)}}</view>
 | ||
| 				</view>
 | ||
| 				<view class="bonus-item-item">
 | ||
| 					<view class="bonus-item-name f26 gray9">{{$t('N_I_138')}}({{currencyIcon()}})</view>
 | ||
| 					<view class="bonus-item-content f26 gray3">{{formatNum(item.purRealSubtotal)}}</view>
 | ||
| 				</view>
 | ||
| 
 | ||
| 				<!-- 	<view class="d-e-c bonus-bottom border-t">
 | ||
| 					<view class="order-btn">查看详情</view>
 | ||
| 				</view> -->
 | ||
| 			</view>
 | ||
| 		</view>
 | ||
| 		<view class="d-c-c p30" v-if="listData.length == 0 && !loading">
 | ||
| 			<text class="iconfont icon-wushuju"></text>
 | ||
| 			<text class="cont">{{$t('w_0405')}}</text>
 | ||
| 		</view>
 | ||
| 		<uni-load-more v-else :loadingType="loadingType"></uni-load-more>
 | ||
| 	</view>
 | ||
| </template>
 | ||
| 
 | ||
| <script>
 | ||
| 	import uniLoadMore from '@/components/uni-load-more.vue';
 | ||
| 	export default {
 | ||
| 		components: {
 | ||
| 			uniLoadMore
 | ||
| 		},
 | ||
| 		data() {
 | ||
| 			return {
 | ||
| 				/*有没有等多*/
 | ||
| 				no_more: false,
 | ||
| 				/*是否正在加载*/
 | ||
| 				loading: true,
 | ||
| 				listData: [],
 | ||
| 				form: {
 | ||
| 					pageNum: 1,
 | ||
| 					pageSize: 10,
 | ||
| 					startDate: '',
 | ||
| 					endDate: '',
 | ||
| 					gradeId: ''
 | ||
| 				},
 | ||
| 				total: 0,
 | ||
| 				queryBonusTotal: 0
 | ||
| 			};
 | ||
| 		},
 | ||
| 		onLoad() {
 | ||
| 			let data = this.defaultDates();
 | ||
| 			this.form.startDate = this.getDate2(data[0]);
 | ||
| 			this.form.endDate = this.getDate2(data[1]);
 | ||
| 		},
 | ||
| 		onShow() {
 | ||
| 			/*获取数据*/
 | ||
| 			this.listData = [];
 | ||
| 			this.form.pageNum = 1;
 | ||
| 			this.getData();
 | ||
| 			this.getQueryBonusTotal();
 | ||
| 
 | ||
| 		},
 | ||
| 		onReachBottom() {
 | ||
| 			let self = this;
 | ||
| 			if (self.form.pageNum * self.form.pageSize < self.total) {
 | ||
| 				self.form.pageNum++;
 | ||
| 				self.getData();
 | ||
| 			}
 | ||
| 			self.no_more = true;
 | ||
| 		},
 | ||
| 		computed: {
 | ||
| 			/*加载中状态*/
 | ||
| 			loadingType() {
 | ||
| 				if (this.loading) {
 | ||
| 					return 1;
 | ||
| 				} else {
 | ||
| 					if (this.listData.length != 0 && this.no_more) {
 | ||
| 						return 2;
 | ||
| 					} else {
 | ||
| 						return 0;
 | ||
| 					}
 | ||
| 				}
 | ||
| 			},
 | ||
| 			startDate() {
 | ||
| 				return this.getDate('start');
 | ||
| 			},
 | ||
| 			endDate() {
 | ||
| 				return this.getDate('end');
 | ||
| 			}
 | ||
| 		},
 | ||
| 		methods: {
 | ||
| 			getQueryBonusTotal() {
 | ||
| 				let self = this;
 | ||
| 				self._post(
 | ||
| 					'bonus/api/bonus/query-bonus-total', {},
 | ||
| 					function(res) {
 | ||
| 						self.queryBonusTotal = res.rows[0].realIncomeTotal;
 | ||
| 					}
 | ||
| 				);
 | ||
| 			},
 | ||
| 			getData() {
 | ||
| 				let self = this;
 | ||
| 				self.loading = true;
 | ||
| 				var formdata = self.form;
 | ||
| 				self._post(
 | ||
| 					'bonus/api/bonus/query-bonus-first', formdata,
 | ||
| 					function(res) {
 | ||
| 						self.listData = res.rows;
 | ||
| 						self.total = res.total;
 | ||
| 						if (self.total < (self.form.pageNum * self.form.pageSize)) {
 | ||
| 							self.no_more = true;
 | ||
| 						}
 | ||
| 					}, {},
 | ||
| 					() => {
 | ||
| 						self.loading = false;
 | ||
| 					}
 | ||
| 				);
 | ||
| 			},
 | ||
| 			getDate2(date) {
 | ||
| 				let year = date.getFullYear();
 | ||
| 				let month = date.getMonth() + 1;
 | ||
| 				let day = date.getDate();
 | ||
| 				month = month > 9 ? month : '0' + month;
 | ||
| 				day = day > 9 ? day : '0' + day;
 | ||
| 				return `${year}-${month}-${day}`;
 | ||
| 			},
 | ||
| 			getDate(type) {
 | ||
| 				const date = new Date();
 | ||
| 				let year = date.getFullYear();
 | ||
| 				let month = date.getMonth() + 1;
 | ||
| 				let day = date.getDate();
 | ||
| 
 | ||
| 				if (type === 'start') {
 | ||
| 					year = year - 60;
 | ||
| 				} else if (type === 'end') {
 | ||
| 					year = year + 2;
 | ||
| 				}
 | ||
| 				month = month > 9 ? month : '0' + month;
 | ||
| 				day = day > 9 ? day : '0' + day;
 | ||
| 				return `${year}-${month}-${day}`;
 | ||
| 			},
 | ||
| 			defaultDates() {
 | ||
| 				const today = new Date();
 | ||
| 				const yesterday = new Date(today);
 | ||
| 				yesterday.setDate(today.getDate() - 1);
 | ||
| 				
 | ||
| 				// 获取当前月份的第一天
 | ||
| 				const firstDayOfMonth = new Date(today.getFullYear(), today.getMonth(), 1);
 | ||
| 				
 | ||
| 				// 如果今天是本月的1号,则设置为上个月的1号到上个月的最后一天
 | ||
| 				if (today.getDate() === 1) {
 | ||
| 					const previousMonthFirstDay = new Date(today.getFullYear(), today.getMonth() - 1, 1);
 | ||
| 					const previousMonthLastDay = new Date(today.getFullYear(), today.getMonth(), 0); // 0号表示上个月的最后一天
 | ||
| 				
 | ||
| 					return [previousMonthFirstDay, previousMonthLastDay];
 | ||
| 				} else {
 | ||
| 					// 否则,设置为这个月的1号到昨天
 | ||
| 					return [firstDayOfMonth, yesterday];
 | ||
| 				}
 | ||
| 			},
 | ||
| 			bindDateChange1: function(e) {
 | ||
| 				this.form.startDate = e.detail.value;
 | ||
| 			},
 | ||
| 			bindDateChange2: function(e) {
 | ||
| 				this.form.endDate = e.detail.value;
 | ||
| 			},
 | ||
| 			resetSubmit: function() {
 | ||
| 				this.form.gradeId = "";
 | ||
| 				this.form.startDate = "";
 | ||
| 				this.form.endDate = "";
 | ||
| 			},
 | ||
| 			searchSubmit: function() {
 | ||
| 				/*获取数据*/
 | ||
| 				this.listData = [];
 | ||
| 				this.form.pageNum = 1;
 | ||
| 				this.getData();
 | ||
| 			},
 | ||
| 		}
 | ||
| 	};
 | ||
| </script>
 | ||
| 
 | ||
| <style lang="scss">
 | ||
| 	.tips-box {
 | ||
| 		padding: 30rpx 20rpx;
 | ||
| 		background-color: #fff;
 | ||
| 		border-bottom: 1rpx solid #eee;
 | ||
| 	}
 | ||
| 
 | ||
| 	.bonus-item {
 | ||
| 		padding: 20rpx 25rpx 20rpx 23rpx;
 | ||
| 		margin-bottom: 20rpx;
 | ||
| 		background-color: #fff;
 | ||
| 
 | ||
| 		.bonus-bottom {
 | ||
| 			height: 104rpx;
 | ||
| 
 | ||
| 			.order-btn {
 | ||
| 				box-sizing: border-box;
 | ||
| 				padding: 0 26rpx;
 | ||
| 				min-width: 146rpx;
 | ||
| 				height: 52rpx;
 | ||
| 				line-height: 52rpx;
 | ||
| 				text-align: center;
 | ||
| 				border-radius: 26rpx;
 | ||
| 				font-size: 24rpx;
 | ||
| 				color: #fff;
 | ||
| 				border: 1rpx solid #eee;
 | ||
| 				margin-left: 18rpx;
 | ||
| 				background: #fb3024;
 | ||
| 				border: 1rpx solid #fb3024;
 | ||
| 				flex-shrink: 0;
 | ||
| 				display: flex;
 | ||
| 				justify-content: center;
 | ||
| 				align-items: center;
 | ||
| 			}
 | ||
| 		}
 | ||
| 	}
 | ||
| 
 | ||
| 	.bonus-item-item {
 | ||
| 		display: flex;
 | ||
| 		justify-content: space-between;
 | ||
| 		align-items: center;
 | ||
| 		margin-bottom: 20rpx;
 | ||
| 	}
 | ||
| </style> |