346 lines
9.3 KiB
Vue
346 lines
9.3 KiB
Vue
<template>
|
||
<view class="container">
|
||
<u-navbar title="消费订单" :border-bottom="false" :background="bgc" back-icon-color="#fff" title-color='#fff'
|
||
title-size='36' height='36' id="navbar">
|
||
</u-navbar>
|
||
<!-- 卡座号信息 -->
|
||
<view class="seat-info">
|
||
<view class="seat-icon">
|
||
<image src="https://api.ccttiot.com/smartmeter/img/static/uj4On0J6iDCfr1b7kIdl" mode="aspectFit"></image>
|
||
<view class="seat-number">卡座号</view>
|
||
</view>
|
||
<view class="seat-detail">{{xqobj.boothName}}</view>
|
||
</view>
|
||
|
||
<!-- 商品列表 -->
|
||
<scroll-view class="product-list" scroll-y>
|
||
<view class="product-item" v-for="(product, index) in xqobj.goodsOrderSkuVOList" :key="index" @click="toggleProduct(index)">
|
||
<view class="product-image">
|
||
<image :src="product.picture" mode="aspectFill"></image>
|
||
</view>
|
||
<view class="product-info">
|
||
<text class="product-name">{{ product.goodsName }}</text>
|
||
<text class="product-desc">{{ product.description }}</text>
|
||
<text class="product-price">
|
||
¥{{ product.price }}
|
||
</text>
|
||
</view>
|
||
<view class="product-quantity">×{{ product.number }}</view>
|
||
</view>
|
||
</scroll-view>
|
||
|
||
<!-- 订单汇总信息 -->
|
||
<view class="order-summary">
|
||
<view class="summary-item">
|
||
<text class="label">商品总价</text>
|
||
<text class="value">¥{{xqobj.payAmount}}</text>
|
||
</view>
|
||
<view class="summary-item order-number">
|
||
<text class="label">订单号</text>
|
||
<text class="value">
|
||
{{xqobj.orderNo}}
|
||
</text>
|
||
</view>
|
||
</view>
|
||
|
||
<!-- 底部总价和支付按钮 -->
|
||
<view class="bottom-bar">
|
||
<view class=" total-info">
|
||
共<text>{{totalQuantity}}</text>件 总计<text>¥{{xqobj.payAmount}}</text>
|
||
</view>
|
||
<view class="pay-button" @click="confirmPay">确认支付</view>
|
||
</view>
|
||
</view>
|
||
</template>
|
||
|
||
<script>
|
||
export default {
|
||
data() {
|
||
return {
|
||
products: [],
|
||
bgc: {
|
||
backgroundColor: "#111111",
|
||
},
|
||
no:'',
|
||
xqobj:{},
|
||
totalQuantity:'',
|
||
czflag:true
|
||
}
|
||
},
|
||
computed: {
|
||
|
||
},
|
||
onLoad(option) {
|
||
this.no = option.no
|
||
this.totalQuantity = option.totalQuantity
|
||
this.getxq()
|
||
},
|
||
methods: {
|
||
// 点击支付订单
|
||
confirmPay() {
|
||
if(this.czflag == true){
|
||
this.czflag = false
|
||
this.$u.get(`/app/channel/list?appId=${this.$store.state.appid}`).then((res) => {
|
||
if (res.code == 200) {
|
||
let data = {
|
||
orderNo:this.no,
|
||
appId:1,
|
||
channelId:res.data[0].channelId
|
||
}
|
||
this.$u.post(`/app/goodsOrder/pay`, data).then(resp => {
|
||
if (resp.code == 200) {
|
||
uni.requestPayment({
|
||
provider: 'wxpay',
|
||
timeStamp: resp.data.payParams.timeStamp,
|
||
nonceStr: resp.data.payParams.nonceStr,
|
||
package: resp.data.payParams.packageVal,
|
||
signType: resp.data.payParams.signType,
|
||
paySign: resp.data.payParams.paySign,
|
||
success: (respc) => {
|
||
console.log(respc, '支付成功')
|
||
this.$u.put(`/app/pay/refreshPayResult?no=${resp.data.pay.no}`).then((res) => { //刷新支付结果
|
||
this.czflag = true
|
||
})
|
||
},
|
||
fail(err) {
|
||
setTimeout(() => {
|
||
uni.hideLoading()
|
||
this.czflag = true
|
||
}, 1000)
|
||
console.log('取消或者支付失败')
|
||
}
|
||
})
|
||
} else {
|
||
uni.showToast({
|
||
title: resp.msg,
|
||
icon: 'none',
|
||
duration: 2000
|
||
})
|
||
this.czflag = true
|
||
}
|
||
})
|
||
} else {
|
||
uni.showToast({
|
||
title: res.msg,
|
||
icon: 'none',
|
||
duration: 2000
|
||
})
|
||
this.czflag = true
|
||
}
|
||
})
|
||
}
|
||
},
|
||
// 根据订单号请求订单详情
|
||
getxq(){
|
||
this.$u.get(`/app/goodsOrder/goodsOrderDetail?eqNo=${this.no}`).then(res =>{
|
||
if(res.code == 200){
|
||
this.xqobj = res.data
|
||
}
|
||
})
|
||
}
|
||
}
|
||
}
|
||
</script>
|
||
|
||
<style lang="scss">
|
||
.container {
|
||
background-color: #0f0f0f;
|
||
color: white;
|
||
min-height: 100vh;
|
||
padding: 20rpx;
|
||
padding-bottom: 200rpx;
|
||
}
|
||
.seat-info {
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: space-between;
|
||
margin: 30rpx 0;
|
||
padding: 20rpx;
|
||
background: rgba(255, 255, 255, 0.05);
|
||
border-radius: 12rpx;
|
||
.seat-icon{
|
||
display: flex;
|
||
align-items: center;
|
||
justify-content: space-between;
|
||
font-size: 32rpx;
|
||
color: white;
|
||
}
|
||
.seat-icon image {
|
||
width: 40rpx;
|
||
height: 40rpx;
|
||
}
|
||
.seat-number {
|
||
margin: 0 20rpx;
|
||
font-size: 32rpx;
|
||
}
|
||
.seat-detail {
|
||
display: flex;
|
||
justify-content: space-between;
|
||
align-items: center;
|
||
font-size: 32rpx;
|
||
image {
|
||
width: 24rpx;
|
||
height: 24rpx;
|
||
}
|
||
}
|
||
}
|
||
.product-list-header {
|
||
display: none;
|
||
}
|
||
.product-list {
|
||
.product-item {
|
||
display: flex;
|
||
align-items: center;
|
||
padding: 25rpx 20rpx;
|
||
margin-bottom: 15rpx;
|
||
background: rgba(255, 255, 255, 0.03);
|
||
border-radius: 12rpx;
|
||
transition: all 0.3s;
|
||
&:active {
|
||
background: rgba(255, 255, 255, 0.1);
|
||
}
|
||
.product-checkbox {
|
||
display: none;
|
||
}
|
||
.product-image {
|
||
width: 120rpx;
|
||
height: 120rpx;
|
||
margin-right: 20rpx;
|
||
border-radius: 8rpx;
|
||
overflow: hidden;
|
||
image {
|
||
width: 100%;
|
||
height: 100%;
|
||
}
|
||
}
|
||
.product-info {
|
||
flex: 1;
|
||
.product-name {
|
||
display: block;
|
||
font-size: 32rpx;
|
||
margin-bottom: 10rpx;
|
||
font-weight: 500;
|
||
}
|
||
.product-desc {
|
||
display: block;
|
||
font-size: 24rpx;
|
||
color: #999;
|
||
margin-bottom: 0;
|
||
}
|
||
.product-price {
|
||
font-size: 32rpx;
|
||
color: #fff;
|
||
font-weight: bold;
|
||
|
||
.member-price {
|
||
display: none;
|
||
}
|
||
}
|
||
}
|
||
.product-quantity {
|
||
font-size: 32rpx;
|
||
color: #e94b64;
|
||
font-weight: bold;
|
||
margin-left: 20rpx;
|
||
}
|
||
}
|
||
}
|
||
.order-summary {
|
||
background: rgba(255, 255, 255, 0.05);
|
||
border-radius: 12rpx;
|
||
padding: 20rpx;
|
||
margin-top: 30rpx;
|
||
font-size: 28rpx;
|
||
color: #ccc;
|
||
.summary-item {
|
||
display: flex;
|
||
justify-content: space-between;
|
||
align-items: center;
|
||
padding: 15rpx 0;
|
||
border-bottom: 1rpx solid rgba(255, 255, 255, 0.1);
|
||
&:last-child {
|
||
border-bottom: none;
|
||
}
|
||
.label {
|
||
color: #999;
|
||
}
|
||
.value {
|
||
color: #fff;
|
||
display: flex;
|
||
align-items: center;
|
||
.discount {
|
||
color: #e94b64;
|
||
margin-right: 10rpx;
|
||
}
|
||
image {
|
||
width: 24rpx;
|
||
height: 24rpx;
|
||
}
|
||
}
|
||
&.total-due {
|
||
padding-top: 30rpx;
|
||
.label {
|
||
font-size: 30rpx;
|
||
font-weight: bold;
|
||
color: #fff;
|
||
}
|
||
.value {
|
||
font-size: 36rpx;
|
||
color: #e94b64;
|
||
font-weight: bold;
|
||
}
|
||
}
|
||
&.order-number {
|
||
padding-top: 20rpx;
|
||
.label {
|
||
color: #999;
|
||
}
|
||
.value {
|
||
font-size: 26rpx;
|
||
color: #999;
|
||
}
|
||
}
|
||
}
|
||
.summary-item.clickable {
|
||
&:active {
|
||
background: rgba(255, 255, 255, 0.1);
|
||
border-radius: 12rpx;
|
||
}
|
||
}
|
||
}
|
||
.bottom-bar {
|
||
position: fixed;
|
||
bottom: 0;
|
||
left: 0;
|
||
right: 0;
|
||
display: flex;
|
||
justify-content: space-between;
|
||
align-items: center;
|
||
background-color: #1a1a1a;
|
||
padding: 40rpx 30rpx;
|
||
box-shadow: 0 -2rpx 10rpx rgba(0, 0, 0, 0.3);
|
||
.total-info {
|
||
font-size: 28rpx;
|
||
color: #fff;
|
||
text{
|
||
font-size: 30rpx;
|
||
color: #e94b64;
|
||
font-weight: bold;
|
||
}
|
||
}
|
||
.pay-button {
|
||
background: linear-gradient(90deg, #e94b64, #ff6b81);
|
||
color: white;
|
||
padding: 18rpx 50rpx;
|
||
border-radius: 50rpx;
|
||
border: none;
|
||
font-size: 30rpx;
|
||
font-weight: bold;
|
||
box-shadow: 0 4rpx 15rpx rgba(233, 75, 100, 0.3);
|
||
&:active {
|
||
opacity: 0.9;
|
||
transform: translateY(2rpx);
|
||
}
|
||
}
|
||
}
|
||
</style> |