Dining_Hall/pages/code/index.vue

125 lines
2.5 KiB
Vue
Raw Normal View History

2025-01-02 16:16:54 +08:00
<template>
<page-meta :page-font-size="fontValue+'px'" :root-font-size="fontValue+'px'"></page-meta>
2025-01-02 20:42:29 +08:00
<view class="work-container">
2025-02-19 09:34:34 +08:00
<view class="card-box">
<!-- 标题 -->
<view class="title">出示二维码支付</view>
<!-- 副标题 -->
<view class="subtitle">{{custName}}</view>
<view style="border: 1px dashed #e9a765;width: 90%;margin: 0 auto;"></view>
<!-- 二维码 -->
<ikun-qrcode
class="qr-code"
width="500"
height="500"
unit="rpx"
color="#000000"
:data="qrCodeUrl"
></ikun-qrcode>
<!-- 有效期 -->
<view class="valid-time">有效时间15分钟</view>
<view class="refresh-button">
<button @click="refreshQrCode" class="login-btn cu-btn block bg-blue lg round" style="width: 70%;">刷新二维码</button>
2025-02-19 09:34:34 +08:00
</view>
2025-01-02 20:42:29 +08:00
</view>
</view>
2025-01-02 16:16:54 +08:00
</template>
<script>
import Cookies from "js-cookie";
2025-02-19 09:34:34 +08:00
import { getOrderQRCodeAPI } from '../../api/index/index'
2025-01-02 20:42:29 +08:00
export default {
data() {
return {
fontValue:Cookies.get('fontSize') || 8,
custName:Cookies.get('custName'),
2025-02-19 09:34:34 +08:00
qrCodeUrl:"" // 替换为实际的二维码URL
2025-01-02 20:42:29 +08:00
};
},
2025-02-19 09:34:34 +08:00
onShow() {
this.getOrderQRCodeData()
},
2025-01-02 20:42:29 +08:00
methods: {
2025-02-19 09:34:34 +08:00
// 获取二维码
async getOrderQRCodeData() {
const res = await getOrderQRCodeAPI({ "custId":Cookies.get('custId') })
2025-02-19 09:34:34 +08:00
console.log(res, '二维码信息--')
if(res.code==200){
this.qrCodeUrl=res.msg;
}
},
2025-01-02 20:42:29 +08:00
refreshQrCode() {
// 模拟刷新二维码
2025-02-19 09:34:34 +08:00
this.getOrderQRCodeData()
2025-01-02 20:42:29 +08:00
}
}
};
2025-01-02 16:16:54 +08:00
</script>
<style scoped>
2025-01-02 20:42:29 +08:00
page {
display: flex;
flex-direction: column;
box-sizing: border-box;
background-color: #F9FBFF;
min-height: 100%;
height: auto;
}
2025-01-02 16:16:54 +08:00
2025-01-02 20:42:29 +08:00
.work-container {
background-color: #FFFFFF;
text-align: center;
2025-02-19 09:34:34 +08:00
height: 94vh;
}
.card-box{
margin: 40rpx;
/* border: 1px solid #000; */
border-radius: 10rpx;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.5);
padding-top: 20rpx;
padding-bottom: 40rpx;
2025-01-02 20:42:29 +08:00
}
2025-01-02 16:16:54 +08:00
2025-01-02 20:42:29 +08:00
.title {
font-size: 44rpx;
2025-01-02 20:42:29 +08:00
color: #333;
margin-bottom: 10px;
font-weight: 600;
}
2025-01-02 16:16:54 +08:00
2025-01-02 20:42:29 +08:00
.subtitle {
font-size: 32rpx;
2025-02-19 09:34:34 +08:00
color: #999;
2025-01-02 20:42:29 +08:00
margin-bottom: 20px;
2025-02-19 09:34:34 +08:00
/* font-weight: 600; */
2025-01-02 20:42:29 +08:00
}
2025-01-02 16:16:54 +08:00
2025-01-02 20:42:29 +08:00
.qr-code {
2025-02-19 09:34:34 +08:00
margin: 0 auto;
margin-bottom: 10px;
padding-top: 20rpx;
2025-01-02 20:42:29 +08:00
}
2025-01-02 16:16:54 +08:00
2025-01-02 20:42:29 +08:00
.valid-time {
font-size: 32rpx;
2025-01-02 20:42:29 +08:00
color: #666;
2025-02-19 09:34:34 +08:00
margin-bottom: 20px;
2025-01-02 20:42:29 +08:00
}
.refresh-button {
2025-03-24 15:46:35 +08:00
width: 100%;
2025-02-19 09:34:34 +08:00
height: auto;
display: flex;
2025-03-24 15:46:35 +08:00
justify-content: center;
2025-01-02 20:42:29 +08:00
}
.login-btn {
2025-02-19 09:34:34 +08:00
width: 100%;
height: 35px;
margin: 0 auto;
margin-left: 30rpx;
margin-right: 30rpx;
background-color: #e97c3d;
2025-01-02 20:42:29 +08:00
}
2025-01-02 16:16:54 +08:00
</style>