加油站付款小程序,打印小票
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.

162 lines
3.0 KiB

1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
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. <!-- <test></test> -->
  25. </view>
  26. </template>
  27. <script setup>
  28. import {
  29. onShow
  30. } from "@dcloudio/uni-app"
  31. import {
  32. reactive,
  33. ref
  34. } from "vue";
  35. import test from '../../component/test.vue'
  36. const form = reactive({
  37. money: ''
  38. })
  39. const index = ref(0)
  40. //生命周期
  41. onShow(() => {
  42. if (wx.onNeedPrivacyAuthorization) {
  43. console.log('onNeedPrivacyAuthorization');
  44. wx.onNeedPrivacyAuthorization(resolve => {
  45. console.log('onNeedPrivacyAuthorization');
  46. // 需要用户同意隐私授权时
  47. // 弹出开发者自定义的隐私授权弹窗
  48. // this.resolvePrivacyAuthorization = resolve
  49. // showPrivacy.init(resolve)
  50. })
  51. }
  52. })
  53. //用户选择加油金额
  54. function selectMoney(money, item) {
  55. form.money = money
  56. index.value = item
  57. }
  58. //输入框获得焦点
  59. function focus() {
  60. }
  61. </script>
  62. <style scoped>
  63. .payment {
  64. height: 100vh;
  65. background: #F1F5F8;
  66. width: 750rpx;
  67. margin: 0 auto;
  68. }
  69. .container {
  70. width: 96%;
  71. margin: 0rpx auto;
  72. border-radius: 20rpx;
  73. box-sizing: border-box;
  74. padding: 20rpx;
  75. overflow: hidden;
  76. background: white;
  77. margin-top: 20rpx;
  78. }
  79. .money-input {
  80. display: flex;
  81. align-items: center;
  82. background: #F6F7FB;
  83. padding: 30rpx 10rpx;
  84. border-radius: 20rpx;
  85. }
  86. .tip {
  87. color: #00aaff;
  88. margin-top: 10rpx;
  89. }
  90. .money-input image {
  91. width: 45rpx;
  92. }
  93. .money-input input {
  94. font-size: 36rpx;
  95. }
  96. .select-money {
  97. display: flex;
  98. justify-content: space-between;
  99. flex-wrap: wrap;
  100. margin: 30rpx 0rpx;
  101. }
  102. .select-money .money-item {
  103. width: 32.33%;
  104. background: #F1F5F8;
  105. border-radius: 20rpx;
  106. margin-bottom: 20rpx;
  107. overflow: hidden;
  108. }
  109. .select-money .money {
  110. display: flex;
  111. align-items: center;
  112. justify-content: center;
  113. padding: 30rpx 0rpx;
  114. box-sizing: border-box;
  115. color: #5D5C61;
  116. }
  117. .select-money .active-money {
  118. background: #00aaff;
  119. color: white;
  120. }
  121. .select-money .unit {
  122. font-size: 26rpx;
  123. }
  124. .select-money .number {
  125. font-size: 34rpx;
  126. }
  127. .sumit {
  128. background: #33a5fc;
  129. color: white;
  130. font-size: 36rpx;
  131. display: flex;
  132. align-items: center;
  133. justify-content: center;
  134. height: 80rpx;
  135. border-radius: 20rpx;
  136. }
  137. </style>