| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389 | 
							- <template>
 
- 	<view class="content">
 
- 		<view class="cont-box">
 
- 			<view class="top-box">
 
- 				<view class="my-integral">
 
- 					<view class="left">
 
- 						<view class="label">我的积分</view>
 
- 						<view class="integral">{{integral}}</view>
 
- 					</view>
 
- 					<view class="btn-box">
 
- 						<view class="btn" @click="loginNavTo('/pages_user/integralLogsList')">获得记录</view>
 
- 						<view class="btn" @click="loginNavTo('/pages_user/integralOrderList')">兑换记录</view>
 
- 					</view>
 
- 				</view>
 
- 				<view class="search-cont">
 
- 					<view class="inner">
 
- 						<image class="icon-search" src="https://bjyjb-1362704775.cos.ap-chongqing.myqcloud.com/shop/image/icon_search.png" mode=""></image>
 
- 						<input type="text" v-model="keyword" placeholder="搜索商品" confirm-type="search" @confirm="doSearch" placeholder-style="font-size:28rpx;color:#BBBBBB;font-family: PingFang SC;" />
 
- 					</view>
 
- 				</view>
 
- 				<view class="tabs" v-if="tabs.length>0">
 
- 					<u-tabs
 
- 					 :current="tabIndex"
 
- 					 :scrollable="true"
 
- 					 :list="tabs"  
 
- 					 lineColor="#2583EB"
 
- 					@change="tabChange">
 
- 					</u-tabs>
 
- 				</view>
 
- 			</view>
 
- 			<mescroll-body :top="top+'px'" bottom="0"  ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback" :down="downOption" :up="upOption">
 
- 			<view class="integral-box"  >
 
- 				<view class="item"  @click="navTo('/pages_user/integralGoodsDetails?goodsId='+item.goodsId)" v-for="(item,index) in dataList">
 
- 					<view class="top">
 
- 						<image :src="item.imgUrl"></image>
 
- 					</view>
 
- 					<view class="bottom">
 
- 						<view class="title ellipsis2">
 
- 							{{item.goodsName}}
 
- 						</view>
 
- 						<view class="price-box">
 
- 							<view class="price">{{item.integral}}积分</view>
 
- 							<view class="count">价值:{{item.otPrice.toFixed(2)}}元</view>
 
- 						</view>
 
- 					</view>
 
- 				</view>
 
- 			</view>
 
- 			</mescroll-body>
 
- 		</view>
 
- 		
 
- 	</view>
 
- </template>
 
- <script>
 
-  import {getDictByKey} from '@/api/common.js'
 
-  import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
 
-  import {getIntegralGoodsList} from '@/api/integral.js'
 
-  import {getUserInfo} from '@/api/user'
 
-  export default {
 
- 	mixins: [MescrollMixin], 
 
-  	data() {
 
-  		return {
 
- 			integral:0,
 
- 			type: null,
 
- 			typeOptions:[],
 
- 			tabIndex:0,
 
- 			tabs: [],
 
- 			mescroll:null,
 
- 			downOption: {   //下拉刷新
 
- 			 	use:true,
 
- 				auto: false // 不自动加载 (mixin已处理第一个tab触发downCallback)
 
- 			},
 
- 			upOption: {
 
- 				onScroll:false,
 
- 				use: true, // 是否启用上拉加载; 默认true
 
- 				page: {
 
- 					pae: 0, // 当前页码,默认0,回调之前会加1,即callback(page)会从1开始
 
- 					size: 10 // 每页数据的数量,默认10
 
- 				},
 
- 				noMoreSize: 10, // 配置列表的总数量要大于等于5条才显示'-- END --'的提示
 
- 				textNoMore:"已经到底了",
 
- 				empty: {
 
- 					icon:'https://bjyjb-1362704775.cos.ap-chongqing.myqcloud.com/app/newImages/empty_icon.png',
 
- 					tip: '暂无数据'
 
- 				}
 
- 			},
 
- 			dataList: [],
 
- 			keyword:"",
 
- 			top: uni.upx2px(432)
 
-  		}
 
-  	},
 
- 	onLoad() {
 
- 		this.getDictByKey("sys_integral_goods_type");
 
- 		this.$isLogin().then(
 
- 			res => {
 
- 				if(res){
 
- 					this.getUserInfo();
 
- 				}
 
- 			}
 
- 		);
 
- 	},
 
- 	onReady() {
 
- 		this.getTop()
 
- 	},
 
-  	methods: {
 
- 		getTop() {
 
- 			const query = uni.createSelectorQuery().in(this);
 
- 			query
 
- 			  .select(".top-box")
 
- 			  .boundingClientRect((data) => {
 
- 			    if(data) {
 
- 					this.top = data.height + uni.upx2px(88)
 
- 				}
 
- 			  })
 
- 			  .exec();
 
- 		},
 
- 		getUserInfo(){
 
- 			getUserInfo().then(
 
- 				res => {
 
- 					if(res.code==200){
 
- 						if(res.user!=null){
 
- 							this.integral=res.user.integral;
 
- 						}
 
- 					}else{
 
- 						uni.showToast({
 
- 							icon:'none',
 
- 							title: "请求失败",
 
- 						});
 
- 					}
 
- 				},
 
- 				rej => {}
 
- 			);
 
- 		},
 
- 		loginNavTo(url){
 
- 			this.$isLogin().then(
 
- 				res => {
 
- 					if(res){
 
- 						uni.navigateTo({
 
- 							url: url
 
- 						})
 
- 					}
 
- 					else{
 
- 						uni.navigateTo({
 
- 							url:'/pages/auth/login'
 
- 						})
 
- 					}
 
- 				}
 
- 			);
 
- 			 
 
- 		},
 
- 		navTo(url) {
 
- 			uni.navigateTo({
 
- 				url: url
 
- 			})
 
- 		},
 
- 		getDictByKey(key){
 
- 			var data={key:key}
 
- 			var that=this;
 
- 			getDictByKey(data).then(
 
- 				res => {
 
- 					if(res.code==200){
 
- 						this.typeOptions=res.data;
 
- 						this.typeOptions.forEach(function(item,index){
 
- 							var data={name:item.dictLabel};
 
- 							that.tabs.push(data);
 
- 						})
 
- 						this.tabs.unshift({name: '全部'})
 
- 						if(this.tabs.length>0){
 
- 							this.tabIndex=0
 
- 						}
 
- 						
 
- 					}
 
- 				},
 
- 				err => {
 
- 				}
 
- 			);
 
- 			
 
- 		},
 
- 		doSearch() {
 
- 			this.tabIndex=0
 
- 			this.type = null;
 
- 			this.mescroll.resetUpScroll()
 
- 		},
 
- 		tabChange(item){
 
- 			this.type = item.index == 0 ? null : this.typeOptions[item.index-1].dictValue;
 
- 			this.mescroll.resetUpScroll()
 
- 		},
 
- 		mescrollInit(mescroll) {
 
- 			this.mescroll = mescroll;
 
- 		},
 
- 		/*下拉刷新的回调 */
 
- 		downCallback(mescroll) {
 
- 			mescroll.resetUpScroll()
 
- 		},
 
- 		upCallback(page) {
 
- 			//联网加载数据
 
- 			var that = this;
 
- 			var data = {
 
- 				pageNum: page.num,
 
- 				pageSize: page.size,
 
- 				keyword: this.keyword
 
- 			};
 
- 			if(this.type!=null){
 
- 				data.goodsType=this.type
 
- 			}
 
- 			getIntegralGoodsList(data).then(res => {
 
- 				if(res.code==200){
 
- 					//设置列表数据
 
- 					if (page.num == 1) {
 
- 						that.dataList = res.data.list; 
 
- 						
 
- 					} else {
 
- 						that.dataList = that.dataList.concat(res.data.list);
 
- 						 
 
- 					}
 
- 					that.mescroll.endBySize(res.data.list.length, res.data.total);
 
- 					
 
- 				}else{
 
- 					uni.showToast({
 
- 						icon:'none',
 
- 						title: "请求失败",
 
- 					});
 
- 					that.dataList = null;
 
- 					that.mescroll.endErr();
 
- 				}
 
- 			});
 
- 		}
 
- 		 
 
-  	}
 
-  }
 
-  
 
-  
 
- </script>
 
- <style scoped lang="scss">
 
- page{
 
- 	height: 100%;
 
- 	background-color: #f5f5f5;
 
- }
 
- .search-cont{
 
- 	height: 88upx;
 
- 	width: 100%;
 
- 	display: flex;
 
- 	align-items: flex-end;
 
- 	.inner{
 
- 		box-sizing: border-box;
 
- 		width: 100%;
 
- 		height: 72upx;
 
- 		background: #fff;
 
- 		border-radius: 36upx;
 
- 		display: flex;
 
- 		align-items: center;
 
- 		padding: 0 30upx;
 
- 		.icon-search{
 
- 			width: 28upx;
 
- 			height: 28upx;
 
- 			margin-right: 20upx;
 
- 		}
 
- 		input{
 
- 			height: 60upx;
 
- 			line-height: 60upx;
 
- 			flex: 1;
 
- 		}
 
- 	}
 
- }
 
- .content{
 
- 	height: 100%;
 
- 	.cont-box{
 
- 		.top-box{
 
- 			z-index: 999;
 
- 			padding: 30rpx 30rpx 0 30rpx;
 
- 			width: 100%;
 
- 			position: fixed;
 
- 			top: 0rpx;
 
- 			left: 0rpx;
 
- 			background-color: #f5f5f5;
 
- 			.my-integral{
 
- 				height: 200rpx;
 
- 				box-shadow: 0px 0px 5px 2px rgba(0,0,0,0.05);
 
- 				background: linear-gradient(#2583EB, #2EDAD4);
 
- 				border-radius: 30rpx;
 
- 				display: flex;
 
- 				align-items: flex-start;
 
- 				justify-content: space-between;
 
- 				padding: 30rpx;
 
- 				.left{
 
- 					.label{
 
- 						font-size: 28upx;
 
- 						font-family: PingFang SC;
 
- 						color: #fff;
 
- 					}
 
- 					.integral{
 
- 						margin-top: 30rpx;
 
- 						font-weight: bold;
 
- 						font-size: 40upx;
 
- 						font-family: PingFang SC;
 
- 						color: #fff;
 
- 					}
 
- 				}
 
- 				.btn-box{
 
- 					display: flex;
 
- 					flex-direction: column;
 
- 					align-items: flex-start;
 
- 					justify-content: flex-start;
 
- 					.btn{
 
- 						margin-bottom: 30rpx;
 
- 						background-color: #fff;
 
- 						border-radius: 30rpx;
 
- 						display: flex;
 
- 						align-items: center;
 
- 						justify-content: center;
 
- 						padding: 10rpx 15rpx;
 
- 						font-size: 20upx;
 
- 						font-family: PingFang SC;
 
- 						color: #2583EB;
 
- 					}
 
- 				}
 
- 			}
 
- 			.tabs{
 
- 				height: 88rpx;
 
- 			}
 
- 		}
 
- 		.integral-box{
 
- 			padding: 30rpx;
 
- 			display: flex;
 
- 			align-items: flex-start;
 
- 			justify-content: flex-start;
 
- 			flex-wrap: wrap;
 
- 			.item{
 
- 				box-shadow: 0px 0px 5px 2px rgba(0,0,0,0.05);
 
- 				background-color: #fff;
 
- 				width: calc(50% - 20rpx);
 
- 				border-radius: 15rpx;
 
- 				margin: 10rpx;
 
- 				display: flex;
 
- 				flex-direction: column;
 
- 				align-items: flex-start;
 
- 				justify-content: flex-start;
 
- 				&:last-child{
 
- 				}
 
- 				.top{
 
- 					width:100%;
 
- 					height:300rpx;
 
- 					image{
 
- 						border-radius: 15rpx 15rpx 0rpx 0rpx;
 
- 						width:100%;
 
- 						height:300rpx;
 
- 					}
 
- 					
 
- 				}
 
- 				.bottom{
 
- 					width: 100%;
 
- 					padding: 15rpx;
 
- 					.title{
 
- 						font-weight: bold;
 
- 						font-size: 28upx;
 
- 						font-family: PingFang SC;
 
- 						color: #111111;
 
- 					}
 
- 					.price-box{
 
- 						margin-top: 10rpx;
 
- 						display: flex;
 
- 						align-items: center;
 
- 						justify-content: space-between;
 
- 						width: 100%;
 
- 						.price{
 
- 							padding: 5rpx 10rpx;
 
- 							background-color: #2583EB;
 
- 							border-radius: 30rpx;
 
- 							font-size: 20upx;
 
- 							font-family: PingFang SC;
 
- 							color: #ffffff;
 
- 						}
 
- 						.count{
 
- 							font-size: 24upx;
 
- 							font-family: PingFang SC;
 
- 							color: #333333;
 
- 						}
 
- 						
 
- 					}
 
- 				}
 
- 			}
 
- 		}
 
- 	}
 
- }
 
-  
 
- </style>
 
 
  |