更新h5新的api
This commit is contained in:
@@ -65,7 +65,8 @@
|
||||
statusBarHeight: 0,
|
||||
typeIndex: 0,
|
||||
messageText: "",
|
||||
msgType: "success"
|
||||
msgType: "success",
|
||||
fromView: null
|
||||
}
|
||||
},
|
||||
watch: {
|
||||
@@ -79,6 +80,7 @@
|
||||
id,
|
||||
fromType,
|
||||
fromId,
|
||||
fromView,
|
||||
h
|
||||
} = options
|
||||
this.optionsProps = {
|
||||
@@ -86,6 +88,8 @@
|
||||
fromType,
|
||||
fromId
|
||||
}
|
||||
this.fromView = fromView
|
||||
// console.log(this.fromView)
|
||||
uni.setStorageSync('token', id)
|
||||
this.statusBarHeight = h
|
||||
uni.setStorageSync('BarHeight', h)
|
||||
@@ -95,7 +99,12 @@
|
||||
},
|
||||
methods: {
|
||||
back() {
|
||||
this.closeWeb()
|
||||
if (this.fromView == 1) {
|
||||
uni.navigateBack()
|
||||
} else {
|
||||
this.closeWeb()
|
||||
}
|
||||
|
||||
},
|
||||
closeWeb() {
|
||||
// 关闭页面
|
||||
@@ -156,6 +165,9 @@
|
||||
image: "",
|
||||
}
|
||||
this.$refs.uploadImage.clearImage()
|
||||
// if(this.fromView == 1) {
|
||||
// uni.navigateBack()
|
||||
// }
|
||||
} else {
|
||||
this.messageText = msg
|
||||
this.msgType = 'error'
|
||||
|
||||
@@ -13,6 +13,9 @@
|
||||
<view @click="cutTabPage(1)" :class="currentIndex == 1 ? 'active' : ''">
|
||||
魅力等级
|
||||
</view>
|
||||
<view v-if="userSinger" @click="cutTabPage(2)" :class="currentIndex == 2 ? 'active' : ''">
|
||||
歌手等级
|
||||
</view>
|
||||
</view>
|
||||
<view class="icon-image">
|
||||
</view>
|
||||
@@ -37,7 +40,7 @@
|
||||
</view>
|
||||
|
||||
</view>
|
||||
<view v-if="currentIndex == 1" style="width: 196rpx;height: 196rpx;">
|
||||
<view v-if="[1,2].includes(currentIndex)" style="width: 196rpx;height: 196rpx;">
|
||||
<img :src="levelActiveData[0].rights_icon" alt="" />
|
||||
</view>
|
||||
</view>
|
||||
@@ -72,19 +75,22 @@
|
||||
<!-- 每日奖励等 -->
|
||||
<view class="content-view" v-if="detailData">
|
||||
<view class="font-32 color-3 font-w500">
|
||||
{{`如何获得${currentIndex ? '魅力' : '财富'}值?`}}
|
||||
{{`如何获得${currentIndex === 1 ? '魅力' : currentIndex === 2 ? '歌手经验' : '财富'}值?`}}
|
||||
</view>
|
||||
<view class="mt-24 color-3 font-w400" style="font-size: 28rpx;">
|
||||
{{`${currentIndex ? `在平台收到的所有打赏均可转化为魅力值,具体比例为1金币=${detailData.coin_charm_exp}魅力值。` : `在平台的所有打赏均可转化为财富值,具体比例为1金币=${detailData.coin_wealth_exp}财富值。`}`}}
|
||||
{{`${currentIndex === 1 ? `在平台收到的所有打赏均可转化为魅力值,具体比例为1金币=${detailData.coin_charm_exp}魅力值。` : currentIndex === 2 ? `在平台的所有打赏均可转化为歌手经验值,具体比例为1金币=${detailData.singer_coin_exp}经验值` : `在平台的所有打赏均可转化为财富值,具体比例为1金币=${detailData.coin_wealth_exp}财富值。`}`}}
|
||||
</view>
|
||||
<!-- 财富等级 -->
|
||||
<view class="mt-24">
|
||||
<template v-if="!currentIndex" class="mt-24">
|
||||
<img :src="$config.wealth_url" alt="" />
|
||||
</template>
|
||||
<template v-else class="mt-24">
|
||||
<template v-if="currentIndex == 1" class="mt-24">
|
||||
<img :src="$config.charm_url" alt="" />
|
||||
</template>
|
||||
<template v-if="currentIndex == 2" class="mt-24">
|
||||
<img :src="$config.singer_url" alt="" />
|
||||
</template>
|
||||
</view>
|
||||
|
||||
</view>
|
||||
@@ -118,7 +124,9 @@
|
||||
levelList: [],
|
||||
levelCurrent: 0,
|
||||
nextLevelData: null,
|
||||
userSinger:false,
|
||||
currentSelectedLevel: 2,
|
||||
userSingerLevel:0
|
||||
}
|
||||
},
|
||||
onLoad(options) {
|
||||
@@ -132,23 +140,43 @@
|
||||
uni.setStorageSync('token', id)
|
||||
this.statusBarHeight = h
|
||||
uni.setStorageSync('BarHeight', h)
|
||||
if (uni.getStorageSync('token')) this.getData()
|
||||
if (uni.getStorageSync('token')) {
|
||||
this.getData()
|
||||
this.getSingInfo()
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
getData() {
|
||||
this.levelActiveData = []
|
||||
if (this.currentIndex) {
|
||||
if (this.currentIndex === 1) {
|
||||
// 魅力等级
|
||||
this.getCharmLevel()
|
||||
} else {
|
||||
} else if (this.currentIndex === 0) {
|
||||
// 财富等级
|
||||
this.getWealthLevel()
|
||||
}
|
||||
} else if(this.currentIndex === 2) {
|
||||
console.log('歌手等级')
|
||||
this.getSingerLevel()
|
||||
}
|
||||
},
|
||||
cutTabPage(index) {
|
||||
this.currentIndex = index
|
||||
this.getData()
|
||||
},
|
||||
async getSingInfo() {
|
||||
http.get('/api/Level/is_singer', {
|
||||
token: uni.getStorageSync('token') || ''
|
||||
}).then(response => {
|
||||
const {
|
||||
data,
|
||||
code
|
||||
} = response
|
||||
this.userSinger = data.status ? true : false
|
||||
this.userSingerLevel = Number(data.level)
|
||||
}).catch(error => {
|
||||
this.userSinger = false
|
||||
});
|
||||
},
|
||||
async getCharmLevel() {
|
||||
http.get('/api/Level/get_level_rule', {
|
||||
token: uni.getStorageSync('token') || ''
|
||||
@@ -220,6 +248,36 @@
|
||||
}).catch(error => {
|
||||
this.errorPage = true
|
||||
});
|
||||
},
|
||||
async getSingerLevel() {
|
||||
http.get('/api/Level/get_singer_level', {
|
||||
token: uni.getStorageSync('token') || ''
|
||||
}).then(response => {
|
||||
const {
|
||||
data,
|
||||
code
|
||||
} = response
|
||||
if (code) {
|
||||
console.log(data)
|
||||
this.detailData = data
|
||||
this.levelList = data.level.map(ele => {
|
||||
return {
|
||||
...ele,
|
||||
title: ele.name
|
||||
}
|
||||
})
|
||||
this.levelCurrent = Number(data.user.level)
|
||||
this.nextLevelData = data.level.filter(ele => {
|
||||
return ele.level === Number(data.user.level) + 1
|
||||
})
|
||||
this.levelActiveData = data.level.filter(ele => {
|
||||
return ele.level === Number(data.user.level)
|
||||
})
|
||||
}
|
||||
this.errorPage = false
|
||||
}).catch(error => {
|
||||
this.errorPage = true
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,8 @@
|
||||
<scroll-view scroll-y="true" class="list-view">
|
||||
<view class="flex-container" v-if="listData && listData.length">
|
||||
<!-- 循环生成子元素 -->
|
||||
<view v-for="(item,index) in listData" @click="openPopup(item)" :key="index" class="flex-item decorate-box">
|
||||
<view v-for="(item,index) in listData" @click="openPopup(item)" :key="index"
|
||||
class="flex-item decorate-box">
|
||||
<view class="decorate-content">
|
||||
<view class="decorate-image">
|
||||
<img :src="item.base_image" alt="" />
|
||||
@@ -33,7 +34,7 @@
|
||||
</view>
|
||||
</scroll-view>
|
||||
<uni-popup ref="popup" borderRadius="32rpx 32rpx 0 0" type="bottom" background-color="#fff">
|
||||
<view class="popup-view" v-if="decorateDetail">
|
||||
<view class="popup-view" v-if="decorateDetail.tab.type !== 12">
|
||||
<view class="decorate-image">
|
||||
<img :src="decorateDetail.base_image" alt="" />
|
||||
</view>
|
||||
@@ -54,8 +55,7 @@
|
||||
商品价格
|
||||
</view>
|
||||
<view class="flex-line">
|
||||
{{payData.price}} <img class="icon-goin ml-6" src="@/static/image/goin.png"
|
||||
alt="" />
|
||||
{{payData.price}} <img class="icon-goin ml-6" src="@/static/image/goin.png" alt="" />
|
||||
</view>
|
||||
</view>
|
||||
<template v-if="decorateDetail.decorate && decorateDetail.decorate.price_list">
|
||||
@@ -80,9 +80,6 @@
|
||||
<view>
|
||||
{{menu.day}}天
|
||||
</view>
|
||||
<!-- <view class="sale" v-if="menu.discount">
|
||||
7折优惠
|
||||
</view> -->
|
||||
</view>
|
||||
</view>
|
||||
</template>
|
||||
@@ -104,6 +101,65 @@
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="popup-view" v-else>
|
||||
<view class="decorate-image" style="width: 280rpx;height: 300rpx;">
|
||||
<img :src="decorateDetail.base_image" alt="" />
|
||||
</view>
|
||||
<view class="decorate-title w-fill color-3 font-28">
|
||||
{{decorateDetail.title}}
|
||||
</view>
|
||||
<view class="decorate-info">
|
||||
<view class="info-line">
|
||||
<view class="line-lable">
|
||||
商品名称
|
||||
</view>
|
||||
<view class="">
|
||||
{{decorateDetail.title}}
|
||||
</view>
|
||||
</view>
|
||||
<view class="info-line">
|
||||
<view class="line-lable">
|
||||
商品单价
|
||||
</view>
|
||||
<view class="flex-line">
|
||||
{{decorateDetail.decorate.price}} <img class="icon-goin ml-6"
|
||||
src="@/static/image/goin.png" alt="" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="info-line">
|
||||
<view class="line-lable">
|
||||
购买次数
|
||||
</view>
|
||||
<view class="flex-line">
|
||||
<uni-number-box v-model="payData.number" @change="changeValue" />
|
||||
</view>
|
||||
</view>
|
||||
<view class="info-line">
|
||||
<view class="line-lable">
|
||||
商品总价
|
||||
</view>
|
||||
<view class="flex-line">
|
||||
{{payData.allPrice}}
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
<view class="flex-line user-account font-28">
|
||||
<view class="">
|
||||
<img class="icon-goin ml-6" src="@/static/image/goin.png" alt="" />
|
||||
</view>
|
||||
<view class="color-6 ml-20">
|
||||
{{decorateDetail.user_info.user_coin}}
|
||||
</view>
|
||||
<view class="chongzhi-text ml-20" v-if="isShow" @click="RechargeCoin">
|
||||
去充值
|
||||
</view>
|
||||
</view>
|
||||
<view class="button-footer">
|
||||
<view class="pay-button" @click="toPay">
|
||||
确认支付
|
||||
</view>
|
||||
</view>
|
||||
</view>
|
||||
</uni-popup>
|
||||
</view>
|
||||
<view v-else>
|
||||
@@ -128,7 +184,7 @@
|
||||
decorateDetail: null,
|
||||
currentMenuIndex: 0,
|
||||
payData: null,
|
||||
isShow:true
|
||||
isShow: true
|
||||
}
|
||||
},
|
||||
onLoad(options) {
|
||||
@@ -138,7 +194,7 @@
|
||||
is_show
|
||||
} = options
|
||||
uni.setStorageSync('token', id)
|
||||
if(is_show) {
|
||||
if (is_show) {
|
||||
const flag = Number(is_show)
|
||||
this.isShow = flag === 1 ? true : false
|
||||
}
|
||||
@@ -191,6 +247,8 @@
|
||||
});
|
||||
},
|
||||
async getDecorateDetail(id, detail) {
|
||||
// console.log(id, detail)
|
||||
this.payData = {}
|
||||
http.get('/api/Decorate/get_decorate_detail', {
|
||||
token: uni.getStorageSync('token') || '',
|
||||
did: id
|
||||
@@ -201,14 +259,27 @@
|
||||
} = response
|
||||
this.decorateDetail = code ? {
|
||||
...detail,
|
||||
...data
|
||||
...data,
|
||||
tab: this.tabs[this.currentIndex]
|
||||
} : null
|
||||
this.currentMenuIndex = 0
|
||||
console.log(this.decorateDetail)
|
||||
this.payData = this.decorateDetail.decorate.price_list[this.currentMenuIndex]
|
||||
if (this.decorateDetail.tab.type !== 12) {
|
||||
this.payData = this.decorateDetail.decorate.price_list[this.currentMenuIndex]
|
||||
} else {
|
||||
this.payData.price = this.decorateDetail.decorate.price
|
||||
this.payData.number = 1
|
||||
this.payData.allPrice = this.decorateDetail.decorate.price * 1
|
||||
}
|
||||
// console.log(this.decorateDetail)
|
||||
this.$refs.popup.open('bottom')
|
||||
|
||||
}).catch(error => {});
|
||||
},
|
||||
changeValue(value) {
|
||||
// console.log(value)
|
||||
// console.log(this.payData)
|
||||
this.payData.allPrice = value * this.payData.price
|
||||
},
|
||||
changePayData(data, index) {
|
||||
this.payData = data
|
||||
this.currentMenuIndex = index
|
||||
@@ -236,30 +307,45 @@
|
||||
},
|
||||
// 去支付
|
||||
toPay() {
|
||||
// console.log(this.payData,this.decorateDetail)
|
||||
if (this.payData.price > this.decorateDetail.user_info.user_coin) {
|
||||
// 余额不足
|
||||
uni.showToast({
|
||||
title: '余额不足,请先充值',
|
||||
icon: 'none',
|
||||
mask: true,
|
||||
duration: 500
|
||||
});
|
||||
return
|
||||
if (this.decorateDetail.tab.type !== 12) {
|
||||
if (this.payData.price > this.decorateDetail.user_info.user_coin) {
|
||||
// 余额不足
|
||||
uni.showToast({
|
||||
title: '余额不足',
|
||||
icon: 'none',
|
||||
mask: true,
|
||||
duration: 500
|
||||
});
|
||||
return
|
||||
}
|
||||
|
||||
} else {
|
||||
// 降身卡
|
||||
if (this.payData.allPrice > this.decorateDetail.user_info.user_coin) {
|
||||
// 余额不足
|
||||
uni.showToast({
|
||||
title: '余额不足',
|
||||
icon: 'none',
|
||||
mask: true,
|
||||
duration: 500
|
||||
});
|
||||
return
|
||||
}
|
||||
}
|
||||
// 余额足 调购买装扮接口
|
||||
this.payDecorate()
|
||||
this.payDecorate(this.decorateDetail.tab.type)
|
||||
},
|
||||
payDecorate() {
|
||||
payDecorate(type) {
|
||||
uni.showLoading({
|
||||
mask: true
|
||||
})
|
||||
http.post('/api/Decorate/pay_decorate', {
|
||||
token: uni.getStorageSync('token') || '',
|
||||
did: this.decorateDetail.did,
|
||||
day: this.payData.day
|
||||
day: type !== 12 ? this.payData.day : 0,
|
||||
num: type !== 12 ? 0 : this.payData.number
|
||||
}).then(response => {
|
||||
if(response.code) {
|
||||
if (response.code) {
|
||||
uni.showToast({
|
||||
title: '购买成功',
|
||||
icon: 'success',
|
||||
@@ -278,6 +364,7 @@
|
||||
}
|
||||
|
||||
}).catch(error => {});
|
||||
|
||||
},
|
||||
// 点击去充值
|
||||
RechargeCoin() {
|
||||
@@ -364,6 +451,7 @@
|
||||
width: 120rpx;
|
||||
height: 120rpx;
|
||||
margin: 12rpx 0;
|
||||
|
||||
// background-color: #5B5B5B;
|
||||
img {
|
||||
object-fit: contain;
|
||||
@@ -387,7 +475,7 @@
|
||||
}
|
||||
|
||||
.popup-view {
|
||||
height: 60vh;
|
||||
height: 63vh;
|
||||
padding: 32rpx;
|
||||
width: calc(100vw - 64rpx);
|
||||
display: inline-flex;
|
||||
@@ -441,7 +529,7 @@
|
||||
}
|
||||
|
||||
.active-menubox {
|
||||
background: linear-gradient( 180deg, #FBFBFF 0%, #F7EBFF 100%);
|
||||
background: linear-gradient(180deg, #FBFBFF 0%, #F7EBFF 100%);
|
||||
border: 2rpx solid;
|
||||
border-radius: 12rpx;
|
||||
background-repeat: no-repeat;
|
||||
@@ -513,8 +601,8 @@
|
||||
font-size: var(--font-button-size-p);
|
||||
border-radius: 106rpx;
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user