recharge.vue 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <template>
  2. <view>
  3. <view class="-list">
  4. <view class="title">充值金额</view>
  5. <view class="content">
  6. <view class="price">
  7. <span> ¥</span>
  8. <u-input v-model="price" placeholder="" type="number" />
  9. </view>
  10. </view>
  11. </view>
  12. <view class="submit" :class="{'light':flag}" @click="handlerRecharge">充值</view>
  13. </view>
  14. </template>
  15. <script>
  16. import { recharge } from "@/api/members";
  17. export default {
  18. data() {
  19. return {
  20. price: 0,
  21. flag: true,
  22. };
  23. },
  24. watch: {
  25. price(val) {
  26. val <= 0 ? (this.flag = true) : (this.flag = false);
  27. },
  28. },
  29. mounted() {},
  30. methods: {
  31. // 充值
  32. async handlerRecharge() {
  33. if (this.price > 0) {
  34. let res = await recharge({ price: this.price });
  35. if (res.data.success) {
  36. uni.navigateTo({
  37. url: `/pages/cart/payment/payOrder?orderType=RECHARGE&recharge_sn=${res.data.result.rechargeSn}`,
  38. });
  39. }
  40. }
  41. },
  42. },
  43. };
  44. </script>
  45. <style lang="scss" scoped>
  46. @import './style.scss';
  47. </style>