This commit is contained in:
2020-07-30 20:33:16 +08:00
parent 04adc72d92
commit 6d00107944
17 changed files with 241 additions and 124 deletions

View File

@@ -67,6 +67,34 @@ export default {
onLoad() {
this.getUserInfo();
},
// 监听头像裁剪
created() {
// uni.$on('uAvatarCropper', path => {
// const url = this.$u.http.config.baseUrl + '/Upload/uploadfile';
// this.avatar = path;
// // 可以在此上传到服务端
// // uni.uploadFile({
// // url: 'http://www.example.com/upload',
// // filePath: path,
// // name: 'file',
// // complete: (res) => {
// // console.log(res);
// // }
// // });
// common.uploadFile({
// url: url,
// name: 'avatar',
// filePath: path
// }).then(result => {
// // console.log(result);
// this.$set(this, 'avatar', result.file_path);
// // this.avatar = result.file_path;
// this.uploadPath = result.file_name;
// }, error => {
// this.$u.toast(error);
// })
// })
},
onNavigationBarButtonTap(e) {
if( e.index == 0 ) uni.navigateBack();
},
@@ -94,6 +122,17 @@ export default {
}
});
},
// 头像裁剪
// chooseAvatar() {
// this.$u.route({
// url: '/uview-ui/components/u-avatar-cropper/u-avatar-cropper',
// params: {
// destWidth: 300,
// rectWidth: 200,
// fileType: 'jpg',
// }
// })
// },
getUserInfo() {
this.$u.api.getMemberInfo().then(res => {
if (res.errCode == 0) {

View File

@@ -3,11 +3,11 @@
<view class="integral-top">
<view>
<view class="title">总积分</view>
<view class="value">{{ memberInfo.member_points }}</view>
<view class="value">{{ memberInfo.member_points || 0 }}</view>
</view>
<view>
<view class="title">经验值</view>
<view class="value">{{ memberInfo.member_exppoints }}</view>
<view class="value">{{ memberInfo.member_exppoints || 0 }}</view>
</view>
<view @click="viewProgress">
<view class="title">预计进度</view>

View File

@@ -3,10 +3,11 @@
<u-tabs-swiper ref="coupon" :list="couponGroupList" name="gc_name" :is-scroll="true" active-color="#FF780F" :current="couponCurrent" font-size="24" :show-bar="false" @change="couponTabsChange" height="88" ></u-tabs-swiper>
<swiper :current="swiperCouponCurrent" @animationfinish="couponAnimationFinish" :style="{ height: swiperHeight }">
<swiper-item class="swiper-coupon-item" v-for="(_, i) in couponGroupList" :key="i">
<scroll-view scroll-y style="height: 100%;">
<scroll-view scroll-y style="height: 100%;" @scrolltolower="onreachBottom">
<view v-for="(coupon, index) in couponList" :key="index" class="coupon-item">
<Coupon :couponInfo="coupon" :status='0' :type="0" @exchange="exchangeCoupon($event)"></Coupon>
</view>
<u-loadmore :status="loadStatus" bgColor="#FFF" margin-top="20" margin-bottom="20" v-if="couponList.length>=pageSize" @loadmore="onreachBottom"></u-loadmore>
<u-empty text="暂无优惠券" mode="coupon" color="#000" v-if="!couponList.length"></u-empty>
</scroll-view>
</swiper-item>
@@ -18,6 +19,7 @@ import Coupon from "@/components/mine/coupon/index";
export default {
data() {
return {
pageSize: 1,
swiperHeight: '',
couponCurrent: 0,
swiperCouponCurrent: 0,
@@ -38,20 +40,18 @@ export default {
watch: {
couponCurrent(index) {
const id = this.couponGroupList[index].gc_id;
this.getCouponList({ gc_id: id });
this.getCouponList({ gc_id: id, load: 'reload' });
}
},
methods: {
loadMore(page) {
onreachBottom() {
if(!this.timer) return false;
this.loadStatus = "loading";
this.page++;
this.getGoodsRecommend({
gc_id: this.classifyList[this.current].gc_id,
page: this.page,
reload: false,
this.getCouponList({
gc_id: this.couponGroupList[this.couponCurrent].gc_id,
load: 'loadmore',
}).then(length => {
// console.log(length);
if(length == 0) {
this.page--;
this.loadStatus = 'nomore';
@@ -67,24 +67,24 @@ export default {
this.$u.api.getGoodsClass().then(res => {
if(res.errCode == 0) {
this.couponGroupList = res.data;
this.getCouponList(this.couponGroupList[0].gc_id);
this.getCouponList({ gc_id: this.couponGroupList[0].gc_id, load: 'reload' });
}
})
},
getCouponList({ gc_id }) {
this.$u.api.getCouponList({
async getCouponList({ gc_id, load }) {
const res = await this.$u.api.getCouponList({
page: this.page,
gc_id: gc_id,
}).then(res => {
if(res.errCode == 0) {
this.couponList = res.data;
} else {
this.couponList = [];
}
})
this.timer = true;
if(res.errCode == 0) {
if(load == 'reload') this.couponList = res.data;
else if(load == 'loadmore') this.couponList.push(...res.data);
}
return res.data.length;
},
exchangeCoupon(id) {
console.log(id);
// console.log(id);
},
couponTabsChange(index) {