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.

121 lines
2.4 KiB

10 months ago
  1. <template>
  2. <view>
  3. <u-navbar
  4. :title="$t('page.walletRecharge.title')"
  5. :safeAreaInsetTop="false"
  6. placeholder
  7. @leftClick="leftClick"
  8. >
  9. </u-navbar>
  10. <u--form
  11. labelPosition="left"
  12. :model="model1"
  13. :rules="rules"
  14. class="line"
  15. ref="uForm"
  16. >
  17. <u-form-item
  18. :label="$t('page.walletRecharge.Recharge-amount')"
  19. prop="rechargeAmount"
  20. borderBottom
  21. labelWidth="80px"
  22. >
  23. <u--input
  24. v-model="model1.rechargeAmount"
  25. border="none"
  26. :placeholder="$t('page.walletRecharge.rechargeAmount-placeholder')"
  27. ></u--input>
  28. </u-form-item>
  29. <u-form-item
  30. :label="$t('page.productDetail.payOrder.pay-password')"
  31. prop="payPassword"
  32. borderBottom
  33. labelWidth="80px"
  34. >
  35. <u--input
  36. v-model="model1.payPassword"
  37. type="password"
  38. :placeholder="$t('page.productDetail.payOrder.pay-input-placeholder')"
  39. ></u--input>
  40. </u-form-item>
  41. </u--form>
  42. <u-button class="submit"
  43. size="large" @click="submit"
  44. :text="$t('page.walletRecharge.submit')"></u-button>
  45. </view>
  46. </template>
  47. <script>
  48. export default {
  49. data() {
  50. return {
  51. model1: {
  52. rechargeAmount: '',
  53. payPassword: '',
  54. },
  55. rules: {
  56. 'rechargeAmount': {
  57. type: 'string',
  58. required: true,
  59. message: this.$t('page.walletRecharge.rechargeAmount-placeholder'),
  60. trigger: ['blur', 'change']
  61. },
  62. 'payPassword': {
  63. type: 'string',
  64. required: true,
  65. message: this.$t('page.productDetail.payOrder.pay-input-placeholder'),
  66. trigger: ['blur', 'change']
  67. },
  68. },
  69. }
  70. },
  71. methods: {
  72. leftClick(){
  73. uni.navigateTo({
  74. url: '/pages/balance/balance'
  75. })
  76. },
  77. submit(){
  78. this.$refs.uForm.validate().then(res => {
  79. this.request('water', {
  80. "type": "0",
  81. "money": this.model1.rechargeAmount,
  82. payPass : this.model1.payPassword
  83. }).then(res => {
  84. if(res.code === 200){
  85. uni.$u.toast(this.$t('success-operation'))
  86. setTimeout(()=>{
  87. uni.navigateTo({
  88. url: '/pages/balance/balance'
  89. })
  90. },500)
  91. }
  92. })
  93. })
  94. },
  95. }
  96. }
  97. </script>
  98. <style scoped lang="scss">
  99. .line{
  100. background-color: #fff;
  101. padding: 5px 10px;
  102. margin-top: 10px;
  103. .celi{
  104. border-radius: 10px;
  105. margin: 10px 0;
  106. }
  107. }
  108. .submit{
  109. border-radius: 30px;
  110. background-color: #ED762F;
  111. color: #fff;
  112. margin: 10px;
  113. width: calc(100% - 20px);
  114. }
  115. </style>