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

231 lines
4.6 KiB

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