delay.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. <template>
  2. <view class="container">
  3. <!-- 接单考核时间区域 -->
  4. <view class="box">
  5. 接单考核时间
  6. <view class="box_time">
  7. <input type="number" v-model="receivingTime" @blur="handleChange($event, 1)" />
  8. <img src="../../static/images/repairsImg/clock.png" />
  9. </view>
  10. 分钟
  11. </view>
  12. <!-- 维修考核时间区域 -->
  13. <view class="box">
  14. 维修考核时间
  15. <view class="box_time">
  16. <input type="number" v-model="repairsTime" @blur="handleChange($event, 2)" />
  17. <img src="../../static/images/repairsImg/clock.png" />
  18. </view>
  19. 分钟
  20. </view>
  21. <!-- 提交按钮区域 -->
  22. <view class="btn" @click="handleSub">提交</view>
  23. </view>
  24. </template>
  25. <script>
  26. export default {
  27. data() {
  28. return {
  29. receivingTime: 0,
  30. repairsTime: 0
  31. }
  32. },
  33. methods: {
  34. // 提交按钮回调
  35. handleSub() {
  36. uni.showModal({
  37. title: '提示',
  38. content: '确定延时吗?',
  39. success: (res) => {
  40. if (res.confirm) {
  41. console.log(this.receivingTime)
  42. console.log(this.repairsTime)
  43. uni.showToast({
  44. title: '延时成功',
  45. icon: 'success'
  46. })
  47. setTimeout(() => {
  48. uni.navigateBack(1)
  49. }, 1500)
  50. }
  51. }
  52. })
  53. },
  54. // 输入框输入事件回调
  55. handleChange(e, type) {
  56. // console.log(e.detail.value)
  57. // 验证输入为整数
  58. const reg = /^\+?[1-9][0-9]*$/
  59. if (!reg.test(e.detail.value)) {
  60. uni.showToast({
  61. title: '输入格式错误,请重新输入',
  62. icon: 'none'
  63. })
  64. if (type === 1) {
  65. this.receivingTime = 0
  66. } else {
  67. this.repairsTime = 0
  68. }
  69. }
  70. }
  71. }
  72. }
  73. </script>
  74. <style lang="scss" scoped>
  75. .container {
  76. box-sizing: border-box;
  77. padding: 0 30rpx;
  78. width: 100vw;
  79. height: 100vh;
  80. .box {
  81. display: flex;
  82. align-items: center;
  83. height: 100rpx;
  84. font-size: 32rpx;
  85. font-weight: bold;
  86. .box_time {
  87. display: flex;
  88. justify-content: space-between;
  89. align-items: center;
  90. box-sizing: border-box;
  91. padding: 0 23rpx;
  92. margin: 0 25rpx;
  93. width: 237rpx;
  94. height: 68rpx;
  95. font-weight: 400;
  96. border-radius: 4rpx;
  97. border: 1rpx solid #a6a6a6;
  98. input {
  99. flex: 1;
  100. }
  101. img {
  102. width: 40rpx;
  103. height: 40rpx;
  104. }
  105. }
  106. }
  107. .btn {
  108. position: absolute;
  109. bottom: 66rpx;
  110. display: flex;
  111. justify-content: center;
  112. align-items: center;
  113. margin: auto;
  114. width: 690rpx;
  115. height: 100rpx;
  116. color: #fff;
  117. font-size: 32rpx;
  118. border-radius: 12rpx;
  119. background-color: #6fb6b8;
  120. }
  121. }
  122. </style>