Browse Source

feat 会员list接口对接

feature-1.1
da da 3 years ago
parent
commit
bf2b4cc291
  1. 9
      api/userInfo.js
  2. 72
      pages/userInfo/vip/vip.vue

9
api/userInfo.js

@ -1,6 +1,7 @@
import request from '@/utils/request' import request from '@/utils/request'
const serviceTitle = '/img' const serviceTitle = '/img'
const prefix = '/img/mini/tiktok' const prefix = '/img/mini/tiktok'
const prefix_vip = '/img/mini/vip/'
//GET 传参需要用 params //GET 传参需要用 params
//POST 传参需要用 data //POST 传参需要用 data
@ -12,3 +13,11 @@ export function listTiktokCollection(data) {
data: data data: data
}) })
} }
//获取会员list
export function queryUserVipList() {
return request({
url: `${serviceTitle}${prefix}/queryUserVipList`,
method: 'get',
})
}

72
pages/userInfo/vip/vip.vue

@ -15,46 +15,18 @@
</view> </view>
<view class="vip-box"> <view class="vip-box">
<view class="vip-box__item item-active"> <view class="vip-box__item" :class="{'item-active':active == index}" @click="change(index)" v-for="(item,index) in vipList" :key="index">
<view class="title"> <view class="title">
1 {{item.vipName}}
</view> </view>
<view class="price"> <view class="price">
<text class="price-unit">¥</text> 189 <text class="price-unit">¥</text> {{item.price}}
</view> </view>
<view class="o-price"> <view class="o-price">
¥388 {{item.originPrice}}
</view> </view>
<view class="save-box"> <view class="save-box">
立省60元 立省{{item.originPrice - item.price}}
</view>
</view>
<view class="vip-box__item">
<view class="title">
1
</view>
<view class="price">
<text class="price-unit">¥</text> 189
</view>
<view class="o-price">
¥388
</view>
<view class="save-box">
立省60元
</view>
</view>
<view class="vip-box__item">
<view class="title">
1
</view>
<view class="price">
<text class="price-unit">¥</text> 189
</view>
<view class="o-price">
¥388
</view>
<view class="save-box">
立省60元
</view> </view>
</view> </view>
</view> </view>
@ -66,30 +38,39 @@
</template> </template>
<script> <script>
import {
queryUserVipList
} from '@/api/userInfo.js'
export default { export default {
data() { data() {
return { return {
userInfo: null userInfo: null,
vipList:[],
active:0
} }
}, },
methods: { methods: {
async getVipList() {
const {data} = await queryUserVipList();
this.vipList = data.data
console.log(this.vipList)
},
change(index){
this.active = index
}
}, },
onShow() { onShow() {
this.userInfo = uni.getStorageSync('userInfo') this.userInfo = uni.getStorageSync('userInfo')
}, },
created() { created() {
if (this.userInfo) { if (!this.userInfo) {
uni.navigateTo({
url: url
});
} else {
uni.navigateBack() uni.navigateBack()
uni.showToast({ uni.showToast({
title: '请先登录', title: '请先登录',
icon: 'none' icon: 'none'
}) })
} }
this.getVipList()
} }
} }
</script> </script>
@ -125,7 +106,7 @@
.title { .title {
font-weight: bold; font-weight: bold;
font-size: 38rpx; font-size: 30rpx;
} }
.price { .price {
@ -139,7 +120,7 @@
} }
.o-price { .o-price {
color: #eee; color: #1991fd;
font-size: 26rpx; font-size: 26rpx;
text-decoration: line-through; text-decoration: line-through;
} }
@ -161,10 +142,15 @@
.price,.title{ .price,
.title {
color: #fff; color: #fff;
} }
.o-price{
color: #eee;
}
.save-box { .save-box {
color: #fff; color: #fff;
background-color: rgba(255, 255, 255, .1); background-color: rgba(255, 255, 255, .1);

Loading…
Cancel
Save