更新h5新的api

This commit is contained in:
yziiy
2025-11-29 11:33:18 +08:00
parent 5ed0c676b2
commit edd856475e
170 changed files with 531 additions and 49 deletions

View File

@@ -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;
}
}
}