加油站付款小程序,打印小票
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

144 lines
2.6 KiB

1 year ago
  1. <template>
  2. <view class="payment">
  3. <uni-nav-bar dark :fixed="true" background-color="#00aaff" :border="false" status-bar title="加油" />
  4. <view class="container">
  5. <uni-section title="输入金额" type="line" titleFontSize="34rpx"></uni-section>
  6. <view class="money-input">
  7. <image src="../../static/payment/money.png" mode="widthFix"></image>
  8. <input v-model="form.money" @focus="focus" placeholder="请输入加油金额" type="number" />
  9. </view>
  10. <view v-if="form.money" class="tip">
  11. 折后共计{{ form.money * 0.99 }}
  12. </view>
  13. <view class="select-money">
  14. <view v-for="item in 3" class="money-item">
  15. <view @click="selectMoney(item * 100,item)" :class="{ 'active-money' : index == item }"
  16. class="money">
  17. <view class="unit"></view>
  18. <view class="number">{{ item * 100 }}</view>
  19. </view>
  20. </view>
  21. </view>
  22. <view class="sumit">提交订单</view>
  23. </view>
  24. </view>
  25. </template>
  26. <script setup>
  27. import {
  28. onLoad
  29. } from "@dcloudio/uni-app"
  30. import {
  31. reactive,
  32. ref
  33. } from "vue";
  34. const form = reactive({
  35. money: ''
  36. })
  37. const index = ref(0)
  38. //用户选择加油金额
  39. function selectMoney(money, item) {
  40. form.money = money
  41. index.value = item
  42. }
  43. //输入框获得焦点
  44. function focus() {
  45. }
  46. </script>
  47. <style scoped>
  48. .payment {
  49. height: 100vh;
  50. background: #F1F5F8;
  51. width: 750rpx;
  52. margin: 0 auto;
  53. }
  54. .container {
  55. width: 96%;
  56. margin: 0rpx auto;
  57. border-radius: 20rpx;
  58. box-sizing: border-box;
  59. padding: 20rpx;
  60. overflow: hidden;
  61. background: white;
  62. margin-top: 20rpx;
  63. }
  64. .money-input {
  65. display: flex;
  66. align-items: center;
  67. background: #F6F7FB;
  68. padding: 30rpx 10rpx;
  69. border-radius: 20rpx;
  70. }
  71. .tip {
  72. color: #00aaff;
  73. margin-top: 10rpx;
  74. }
  75. .money-input image {
  76. width: 45rpx;
  77. }
  78. .money-input input {
  79. font-size: 36rpx;
  80. }
  81. .select-money {
  82. display: flex;
  83. justify-content: space-between;
  84. flex-wrap: wrap;
  85. margin: 30rpx 0rpx;
  86. }
  87. .select-money .money-item {
  88. width: 32.33%;
  89. background: #F1F5F8;
  90. border-radius: 20rpx;
  91. margin-bottom: 20rpx;
  92. overflow: hidden;
  93. }
  94. .select-money .money {
  95. display: flex;
  96. align-items: center;
  97. justify-content: center;
  98. padding: 30rpx 0rpx;
  99. box-sizing: border-box;
  100. color: #5D5C61;
  101. }
  102. .select-money .active-money {
  103. background: #00aaff;
  104. color: white;
  105. }
  106. .select-money .unit {
  107. font-size: 26rpx;
  108. }
  109. .select-money .number {
  110. font-size: 34rpx;
  111. }
  112. .sumit {
  113. background: #33a5fc;
  114. color: white;
  115. font-size: 36rpx;
  116. display: flex;
  117. align-items: center;
  118. justify-content: center;
  119. height: 80rpx;
  120. border-radius: 20rpx;
  121. }
  122. </style>