|
@@ -3,7 +3,7 @@
|
|
|
<u-navbar
|
|
|
title="积分商城"
|
|
|
:autoBack="true"
|
|
|
- :safeAreaInsetTop="true"
|
|
|
+ :safeAreaInsetTop="true"
|
|
|
>
|
|
|
</u-navbar>
|
|
|
<view class="header">
|
|
@@ -16,7 +16,7 @@
|
|
|
<text>规则</text>
|
|
|
</view>
|
|
|
</view>
|
|
|
- <view class="num">64565</view>
|
|
|
+ <view class="num">{{credit}}</view>
|
|
|
<view class="bottom">
|
|
|
<text @click="$u.route('/credits/creditslist')">积分明细</text>
|
|
|
</view>
|
|
@@ -33,17 +33,21 @@
|
|
|
<view class="">
|
|
|
<mescroll-body class="" ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback" :down="downOption" :up="upOption">
|
|
|
<view class="credit-product u-flex u-flex-wrap">
|
|
|
- <view class="credit-product-item" v-for="(item,index) in dataList" :key="item.id">
|
|
|
+ <view class="credit-product-item" @click="goDetails(item.id)" v-for="(item,index) in dataList" :key="item.id">
|
|
|
<view class="pic">
|
|
|
<u--image class="image" :src="item.mainImg" width="100%" height="340rpx"></u--image>
|
|
|
</view>
|
|
|
<view class="text">
|
|
|
<view class="til ellipsis-2">
|
|
|
- {{item.title||'测试标题测试标题测试标题测试标题测试标题测试标题'}}
|
|
|
+ {{item.goodsName}}
|
|
|
</view>
|
|
|
- <view class="price">¥54.00</view>
|
|
|
+ <view class="price" v-if="vuex_member_info.priceType>1">
|
|
|
+ ¥{{item.salePrice}}
|
|
|
+ <text class="vip-icon">VIP</text>
|
|
|
+ </view>
|
|
|
+ <view class="price" v-else>¥{{item.salePrice}}</view>
|
|
|
<view class="bottom u-flex u-row-between">
|
|
|
- <text>+20000积分</text>
|
|
|
+ <text>+{{item.exchangeCredit}}积分</text>
|
|
|
<text class="btn">兑换</text>
|
|
|
</view>
|
|
|
</view>
|
|
@@ -61,23 +65,21 @@
|
|
|
mixins: [MescrollMixin], // 使用mixin
|
|
|
data() {
|
|
|
return {
|
|
|
+ hasAddr:false,
|
|
|
staticUrl:this.$commonConfig.staticUrl,
|
|
|
- tabsList:[
|
|
|
- {name:'全部'},
|
|
|
- {name:'推荐'},
|
|
|
- {name:'美食'},
|
|
|
- {name:'饮料'},
|
|
|
- {name:'住行'},
|
|
|
- {name:'其他'}
|
|
|
- ],
|
|
|
+ tabsList:[],
|
|
|
+ credit:'',
|
|
|
+ hasTypeId:false,
|
|
|
typeId:'',
|
|
|
- dataList:[{id:1},{id:2},{id:3}],
|
|
|
+ dataList:[],
|
|
|
}
|
|
|
},
|
|
|
onShow() {
|
|
|
+ this.getCredit();//积分
|
|
|
+ this.getAddrList();
|
|
|
},
|
|
|
onLoad() {
|
|
|
-
|
|
|
+ this.getTypeList();
|
|
|
},
|
|
|
methods: {
|
|
|
/*下拉刷新的回调, 重置列表为第一页 (此处可删,mixins已默认)
|
|
@@ -92,10 +94,10 @@
|
|
|
// }
|
|
|
|
|
|
// 如果希望先请求其他接口,再触发upCallback,可参考以下写法
|
|
|
- // if(!this.hasTypeId){
|
|
|
- // this.shopNewsType();
|
|
|
- // return // 此处return,先获取xx
|
|
|
- // }
|
|
|
+ if(!this.hasTypeId){
|
|
|
+ this.getTypeList();
|
|
|
+ return // 此处return,先获取xx
|
|
|
+ }
|
|
|
|
|
|
let pageNum = page.num; // 页码, 默认从1开始
|
|
|
let pageSize = page.size; // 页长, 默认每页10条
|
|
@@ -103,10 +105,11 @@
|
|
|
let params = {
|
|
|
pageNum : page.num,
|
|
|
pageSize : page.size,
|
|
|
- type : this.typeId,
|
|
|
+ parentTypeId : this.typeId,
|
|
|
+ isCredit:1
|
|
|
}
|
|
|
// console.log('this.params',params);
|
|
|
- this.$u.api.shopNewsList(params).then(data => {
|
|
|
+ this.$u.api.memberGoodList(params).then(data => {
|
|
|
console.log('data',JSON.parse(JSON.stringify(data)));
|
|
|
// 接口返回的当前页数据列表 (数组)
|
|
|
let curPageData = data.data.rows;
|
|
@@ -138,11 +141,62 @@
|
|
|
reloadList() {
|
|
|
this.mescroll.resetUpScroll();
|
|
|
},
|
|
|
+ getTypeList(){
|
|
|
+ this.$u.api.goodsTypeList({parentId:0}).then(res=>{
|
|
|
+ console.log('getTypeList',res.data);
|
|
|
+ this.hasTypeId = true;
|
|
|
+ this.tabsList = res.data;
|
|
|
+ this.typeId =res.data[0].id;
|
|
|
+ this.mescroll.resetUpScroll()
|
|
|
+ }).catch(err=>{
|
|
|
+ console.log('goodsTypeList',err);
|
|
|
+ })
|
|
|
+ },
|
|
|
tabsClick(item){
|
|
|
this.typeId = item.id;
|
|
|
this.reloadList()
|
|
|
// console.log('item',item);
|
|
|
},
|
|
|
+ getCredit(){
|
|
|
+ this.$u.api.memberCredit().then(res=>{
|
|
|
+ this.credit = res.data.credit;
|
|
|
+ console.log('memberCredit',res.data);
|
|
|
+ }).catch(err=>{
|
|
|
+ console.log('memberCredit',err);
|
|
|
+ })
|
|
|
+ },
|
|
|
+ goDetails(id){
|
|
|
+ if(!this.hasAddr){
|
|
|
+ uni.showModal({
|
|
|
+ title: '温馨提示',
|
|
|
+ content: '请先设置地址!',
|
|
|
+ success: res => {
|
|
|
+ if (res.confirm) {
|
|
|
+ uni.$u.route('/center/addrlist', {
|
|
|
+ from: 'cart',
|
|
|
+ backUrl:'/credits/credits'
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ })
|
|
|
+ return
|
|
|
+ }
|
|
|
+ uni.$u.route('/shopping/productdetails', {
|
|
|
+ id: id
|
|
|
+ });
|
|
|
+ },
|
|
|
+ getAddrList(){
|
|
|
+ this.$u.api.addrList().then(res=>{
|
|
|
+ // this.dataList = res.data.rows;
|
|
|
+ if( res.data.total>0){
|
|
|
+ this.hasAddr = true;
|
|
|
+ }else{
|
|
|
+ this.hasAddr = false;
|
|
|
+ }
|
|
|
+ }).catch(err=>{
|
|
|
+ console.log('getAddrList',err.data);
|
|
|
+ })
|
|
|
+ },
|
|
|
}
|
|
|
}
|
|
|
</script>
|