<template>
	<view>
		<image :src="imageUrl+item.img" mode="widthFix" class="flleft width40 imgs mart20"
			v-for="(item,index) in choicelist" :key="index" @click="jumprechangeVip(item)">
		</image>

	</view>
</template>

<script>
	import {
		getListGoodsType
	} from '../../Utils/Api.js';
	let app = getApp();
	export default {
		data() {
			return {
				choicelist: [],
				pageNum: 1,
				pageSize: 10,
				isNoMoreData: false,
				imageUrl: app.globalData.imgUrl
			}
		},
		onLoad() {
			this.getListGoodsType();
		},
		onReachBottom() {
			this.getListGoodsType();
		},
		methods: {
			//跳转充值
			jumprechangeVip(item) {
				uni.navigateTo({
					url: '../home/home?id=' + item.id
				})
			},
			//查询品牌
			getListGoodsType() {
				uni.showLoading({
					title: '加载中...'
				})
				if (this.isNoMoreData) {
					uni.hideLoading()
					return false;
				}
				let pagenum = this.pageNum;
				let params = {
					pageNum: pagenum,
					pageSize: this.pageSize,
					userService: '会员充值'
				}
				getListGoodsType(params).then(res => {
					uni.hideLoading();
					if (res.return_code == '000000') {
						this.isNoMoreData = res.return_data.list.length == this.pageSize ? false : true;
						this.choicelist = this.choicelist.concat(res.return_data.list);
						if (res.return_data.total == (this.pageNum * this.pageSize)) {
							this.isNoMoreData = true;
						}
						this.pageNum = res.return_data.list.length == this.pageSize ? ++pagenum : pagenum;
					} else {
						this.choicelist = [];
					}
				})
			},

		}
	}
</script>

<style lang="scss">
	.imgs {
		margin-left: 5%;
		margin-right: 5%;
	}
</style>
