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

224 lines
4.5 KiB

9 months ago
9 months ago
9 months 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="select-oil">
  7. <view class="oil-item">
  8. <view class="oil active-oil">
  9. <!-- <view class="unit"></view> -->
  10. <view class="number">#95</view>
  11. </view>
  12. </view>
  13. </view>
  14. <uni-section title="输入金额" type="line" titleFontSize="34rpx"></uni-section>
  15. <view class="money-input">
  16. <image src="/static/payment/money.png" mode="widthFix"></image>
  17. <input v-model="form.money" @focus="focus" placeholder="请输入加油金额" type="number" />
  18. </view>
  19. <view v-if="form.money" class="tip">
  20. 折后共计{{ form.money * 0.99 }}
  21. </view>
  22. <view class="select-money">
  23. <view v-for="(item, index) in rechargeList" class="money-item" :key="index">
  24. <view @click="selectMoney(item.price,index)" :class="{ 'active-money' : currentIndex == index }"
  25. class="money">
  26. <view class="unit"></view>
  27. <view class="number">{{ item.price }}</view>
  28. </view>
  29. </view>
  30. </view>
  31. <view class="sumit" @click="submit">提交订单</view>
  32. </view>
  33. <PrivacyAgreementPoup ref="showPrivacy"></PrivacyAgreementPoup>
  34. <uni-fab ref="fab" :content="content" :horizontal="horizontal" :vertical="vertical" :direction="direction"
  35. @trigger="clickMenu" />
  36. <showLogin ref="login"></showLogin>
  37. </view>
  38. </template>
  39. <script setup>
  40. import PrivacyAgreementPoup from "../../components/PrivacyAgreementPoup/PrivacyAgreementPoup.vue";
  41. import showLogin from "../../components/showLogin/showLogin.vue";
  42. export default {
  43. name: 'Payment',
  44. component: {
  45. PrivacyAgreementPoup,
  46. showLogin
  47. },
  48. data() {
  49. return {
  50. form: {
  51. money: ''
  52. },
  53. resolvePrivacyAuthorization: {},
  54. currentIndex: 0,
  55. content: [{
  56. iconPath: '/static/payment/wedding-celebration.png',
  57. text: '婚庆服务',
  58. active: false,
  59. path: '/pages/weddingCelebration/weddingCelebration'
  60. }],
  61. horizontal: 'right',
  62. vertical: 'bottom',
  63. direction: 'vertical',
  64. rechargeList : []
  65. }
  66. },
  67. onShow() {
  68. if (wx.onNeedPrivacyAuthorization) {
  69. console.log('onNeedPrivacyAuthorization');
  70. wx.onNeedPrivacyAuthorization(resolve => {
  71. console.log('onNeedPrivacyAuthorization');
  72. this.resolvePrivacyAuthorization = resolve
  73. this.$refs.showPrivacy.value.init(resolve)
  74. })
  75. }
  76. this.getRechargePage()
  77. },
  78. methods: {
  79. // 用户选择加油金额
  80. selectMoney(money, item) {
  81. this.form.money = money
  82. this.currentIndex = item
  83. },
  84. //输入框获得焦点
  85. focus() {
  86. },
  87. //用户点击了悬浮按钮
  88. clickMenu({
  89. item
  90. }) {
  91. uni.navigateTo({
  92. url: item.path
  93. })
  94. },
  95. submit() {
  96. if (this.$refs.login.checkLogin()) {
  97. return
  98. }
  99. },
  100. //获取充值套餐
  101. getRechargePage(){
  102. this.$api('getRechargePage', res => {
  103. this.rechargeList = res.result.records
  104. })
  105. }
  106. }
  107. }
  108. </script>
  109. <style scoped>
  110. .payment {
  111. height: 100vh;
  112. background: #F1F5F8;
  113. width: 750rpx;
  114. margin: 0 auto;
  115. }
  116. .container {
  117. width: 96%;
  118. margin: 0rpx auto;
  119. border-radius: 20rpx;
  120. box-sizing: border-box;
  121. padding: 20rpx;
  122. overflow: hidden;
  123. background: white;
  124. margin-top: 20rpx;
  125. }
  126. .money-input {
  127. display: flex;
  128. align-items: center;
  129. background: #F6F7FB;
  130. padding: 30rpx 10rpx;
  131. border-radius: 20rpx;
  132. }
  133. .tip {
  134. color: #00aaff;
  135. margin-top: 10rpx;
  136. }
  137. .money-input image {
  138. width: 45rpx;
  139. }
  140. .money-input input {
  141. font-size: 36rpx;
  142. }
  143. .select-oil,
  144. .select-money {
  145. display: flex;
  146. justify-content: space-between;
  147. flex-wrap: wrap;
  148. margin: 30rpx 0rpx;
  149. }
  150. .select-oil {
  151. margin: 0;
  152. }
  153. .select-oil .oil-item,
  154. .select-money .money-item {
  155. width: 32.33%;
  156. background: #F1F5F8;
  157. border-radius: 20rpx;
  158. margin-bottom: 20rpx;
  159. overflow: hidden;
  160. }
  161. .select-oil .oil,
  162. .select-money .money {
  163. display: flex;
  164. align-items: center;
  165. justify-content: center;
  166. padding: 30rpx 0rpx;
  167. box-sizing: border-box;
  168. color: #5D5C61;
  169. }
  170. .select-oil .active-oil,
  171. .select-money .active-money {
  172. background: #00aaff;
  173. color: white;
  174. }
  175. .select-money .unit {
  176. font-size: 26rpx;
  177. }
  178. .select-money .number {
  179. font-size: 34rpx;
  180. }
  181. .sumit {
  182. background: #33a5fc;
  183. color: white;
  184. font-size: 36rpx;
  185. display: flex;
  186. align-items: center;
  187. justify-content: center;
  188. height: 80rpx;
  189. border-radius: 20rpx;
  190. }
  191. </style>