money.vue 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. <template>
  2. <view>
  3. <view class="title">
  4. <u-icon name="close" @click="close()"></u-icon>
  5. <view class="font-thirty-two font-color3" style="margin: 0 auto;">
  6. 消费金额
  7. </view>
  8. </view>
  9. <view class="border">
  10. <view class="font-twenty font-color3" style="margin: 20rpx 0 50rpx;">
  11. 消费金额
  12. </view>
  13. <!-- <u-input v-model="value" :type="type" :border="border" /> -->
  14. <!-- <input type="number" v-model="value" placeholder="请输入数字" /> -->
  15. <input v-model="value" placeholder="请输入数字" />
  16. </view>
  17. <button type="default" class="btn" @click="submit">确认</button>
  18. <u-toast ref="uToast" />
  19. </view>
  20. </template>
  21. <script>
  22. export default{
  23. data(){
  24. return{
  25. value:'',
  26. type: 'number',
  27. border: false
  28. }
  29. },
  30. methods:{
  31. close(){
  32. this.$emit('close')
  33. },
  34. submit(){
  35. const num = /^[0-9]*$/;
  36. if (num.test(this.value)) {
  37. this.$emit('add', this.value);
  38. this.close()
  39. }else{
  40. this.$refs.uToast.show({
  41. title: '必须是数字,请重新输入!',
  42. type: 'default',
  43. })
  44. }
  45. }
  46. }
  47. }
  48. </script>
  49. <style lang="scss" scoped>
  50. .title {
  51. display: flex;
  52. align-items: center;
  53. text-align: center;
  54. .close {
  55. width: 50rpx;
  56. height: 50rpx;
  57. }
  58. }
  59. .border {
  60. border: 2rpx #E0E0E0 solid;
  61. border-left: none;
  62. border-right: none;
  63. margin: 30rpx 0;
  64. .area {
  65. height: 250rpx;
  66. }
  67. }
  68. .btn {
  69. width: 560rpx;
  70. margin: 50rpx auto;
  71. color: #ffffff;
  72. background: #2E4F1C;
  73. border-radius: 48rpx;
  74. }
  75. </style>