<template>
|
|
<view class="payment">
|
|
<uni-nav-bar dark :fixed="true" background-color="#00aaff" :border="false" status-bar title="加油" />
|
|
<view class="container">
|
|
<uni-section title="输入金额" type="line" titleFontSize="34rpx"></uni-section>
|
|
|
|
<view class="money-input">
|
|
<image src="../../static/payment/money.png" mode="widthFix"></image>
|
|
<input v-model="form.money" @focus="focus" placeholder="请输入加油金额" type="number" />
|
|
</view>
|
|
|
|
<view v-if="form.money" class="tip">
|
|
折后共计{{ form.money * 0.99 }}元
|
|
</view>
|
|
|
|
<view class="select-money">
|
|
<view v-for="item in 3" class="money-item">
|
|
<view @click="selectMoney(item * 100,item)" :class="{ 'active-money' : index == item }"
|
|
class="money">
|
|
<view class="unit">¥</view>
|
|
<view class="number">{{ item * 100 }}</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
|
|
<view class="sumit">提交订单</view>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
|
|
<script setup>
|
|
import {
|
|
onLoad
|
|
} from "@dcloudio/uni-app"
|
|
import {
|
|
reactive,
|
|
ref
|
|
} from "vue";
|
|
|
|
const form = reactive({
|
|
money: ''
|
|
})
|
|
const index = ref(0)
|
|
|
|
//用户选择加油金额
|
|
function selectMoney(money, item) {
|
|
form.money = money
|
|
index.value = item
|
|
}
|
|
|
|
//输入框获得焦点
|
|
function focus() {
|
|
|
|
}
|
|
</script>
|
|
|
|
<style scoped>
|
|
.payment {
|
|
height: 100vh;
|
|
background: #F1F5F8;
|
|
width: 750rpx;
|
|
margin: 0 auto;
|
|
}
|
|
|
|
.container {
|
|
width: 96%;
|
|
margin: 0rpx auto;
|
|
border-radius: 20rpx;
|
|
box-sizing: border-box;
|
|
padding: 20rpx;
|
|
overflow: hidden;
|
|
background: white;
|
|
margin-top: 20rpx;
|
|
}
|
|
|
|
.money-input {
|
|
display: flex;
|
|
align-items: center;
|
|
background: #F6F7FB;
|
|
padding: 30rpx 10rpx;
|
|
border-radius: 20rpx;
|
|
}
|
|
|
|
.tip {
|
|
color: #00aaff;
|
|
margin-top: 10rpx;
|
|
}
|
|
|
|
.money-input image {
|
|
width: 45rpx;
|
|
}
|
|
|
|
.money-input input {
|
|
font-size: 36rpx;
|
|
}
|
|
|
|
.select-money {
|
|
display: flex;
|
|
justify-content: space-between;
|
|
flex-wrap: wrap;
|
|
margin: 30rpx 0rpx;
|
|
}
|
|
|
|
.select-money .money-item {
|
|
width: 32.33%;
|
|
background: #F1F5F8;
|
|
border-radius: 20rpx;
|
|
margin-bottom: 20rpx;
|
|
overflow: hidden;
|
|
}
|
|
|
|
.select-money .money {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
padding: 30rpx 0rpx;
|
|
box-sizing: border-box;
|
|
color: #5D5C61;
|
|
}
|
|
|
|
.select-money .active-money {
|
|
background: #00aaff;
|
|
color: white;
|
|
}
|
|
|
|
.select-money .unit {
|
|
font-size: 26rpx;
|
|
}
|
|
|
|
.select-money .number {
|
|
font-size: 34rpx;
|
|
}
|
|
|
|
|
|
.sumit {
|
|
background: #33a5fc;
|
|
color: white;
|
|
font-size: 36rpx;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
height: 80rpx;
|
|
border-radius: 20rpx;
|
|
}
|
|
</style>
|