count.vue 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. <template>
  2. <view class="liet">
  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; font-weight: 600;">
  6. 商品数量
  7. </view>
  8. </view>
  9. <view class="border" style="padding-top: 80rpx;">
  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" class="input" border="true" height="100" placeholder="请输入数量" />
  16. </view>
  17. <view class="footer11">
  18. <button type="default" class="btn" @click="submit">确认</button>
  19. <button type="default" class="btnClose" @click="close">返回</button>
  20. </view>
  21. <u-toast ref="uToast" />
  22. </view>
  23. </template>
  24. <script>
  25. export default{
  26. data(){
  27. return{
  28. value:'',
  29. type: 'number',
  30. money: null,
  31. index: null,
  32. goodsRatePrice: null,
  33. flag: false,
  34. }
  35. },
  36. methods:{
  37. close(){
  38. this.$emit('close')
  39. },
  40. shows(money,goodsRatePrice,index){
  41. this.flag = false;
  42. this.money = money;
  43. this.index = index;
  44. this.goodsRatePrice = goodsRatePrice;
  45. },
  46. show(){
  47. this.flag = true;
  48. },
  49. submit(){
  50. if(this.value === ''){
  51. this.$refs.uToast.show({
  52. title: '请输入数量!',
  53. type: 'default',
  54. })
  55. }else{
  56. if(this.$u.test.number(this.value)){
  57. console.log(this.value)
  58. this.$emit('add', this.value,this.money, this.goodsRatePrice,this.index);
  59. this.close();
  60. }else{
  61. this.$refs.uToast.show({
  62. title: '必须是数字,请重新输入!',
  63. type: 'default',
  64. })
  65. }
  66. }
  67. // const num = /^[0-9]*$/;
  68. // if (num.test(this.value)) {
  69. // this.$emit('add', this.value);
  70. // this.close()
  71. // }else{
  72. // this.$refs.uToast.show({
  73. // title: '必须是数字,请重新输入!',
  74. // type: 'default',
  75. // })
  76. // }
  77. }
  78. }
  79. }
  80. </script>
  81. <style lang="scss" scoped>
  82. .input{
  83. width: calc(100% - 30rpx);
  84. height: 100rpx;
  85. border: 2rpx solid #333333;
  86. border-radius: 24rpx;
  87. padding-left: 30rpx;
  88. }
  89. .liet{
  90. padding: 30rpx;
  91. background: #fff;
  92. min-height: 100vh;
  93. }
  94. .title {
  95. display: flex;
  96. align-items: center;
  97. text-align: center;
  98. .close {
  99. width: 50rpx;
  100. height: 50rpx;
  101. }
  102. }
  103. .border {
  104. border: 2rpx #E0E0E0 solid;
  105. border-left: none;
  106. border-right: none;
  107. margin: 30rpx 0;
  108. .area {
  109. height: 250rpx;
  110. }
  111. }
  112. .footer11{
  113. display: flex;
  114. justify-content: space-between;
  115. }
  116. .btnClose{
  117. width: 330rpx;
  118. margin: 50rpx auto;
  119. color: #2E4F1C;
  120. background: #fff;
  121. border-radius: 48rpx;
  122. border: 2rpx #2E4F1C solid;
  123. }
  124. .btn {
  125. width: 330rpx;
  126. margin: 50rpx auto;
  127. color: #ffffff;
  128. background: #2E4F1C;
  129. border-radius: 48rpx;
  130. }
  131. </style>