delay.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163
  1. <template>
  2. <view class="container">
  3. <!-- 接单考核时间区域 -->
  4. <view class="box">
  5. 接单考核时间
  6. <view class="box_time">
  7. <input type="number" v-model="receivingTime" />
  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" />
  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. // 接单考核时间
  30. receivingTime: null,
  31. // 维修考核时间
  32. repairsTime: null,
  33. // 订单id
  34. id: ''
  35. }
  36. },
  37. onLoad(options) {
  38. this.id = options.id
  39. },
  40. methods: {
  41. // 提交按钮回调
  42. handleSub() {
  43. // 验证输入为整数
  44. const reg = /^\+?[1-9][0-9]*$/
  45. if (!this.receivingTime) {
  46. uni.showToast({
  47. title: '请输入接单考核时间',
  48. icon: 'none'
  49. })
  50. return
  51. }
  52. if (!reg.test(this.receivingTime)) {
  53. uni.showToast({
  54. title: '接单考核时间格式错误,请重新输入',
  55. icon: 'none'
  56. })
  57. return
  58. }
  59. if (!this.repairsTime) {
  60. uni.showToast({
  61. title: '请输入维修考核时间',
  62. icon: 'none'
  63. })
  64. return
  65. }
  66. if (!reg.test(this.repairsTime)) {
  67. uni.showToast({
  68. title: '维修考核时间格式错误,请重新输入',
  69. icon: 'none'
  70. })
  71. return
  72. }
  73. uni.showModal({
  74. title: '提示',
  75. content: '确定延时吗?',
  76. success: async (res) => {
  77. if (res.confirm) {
  78. const res = await this.$myRequest_repairs({
  79. url: '/repairRecord/delayed',
  80. method: 'post',
  81. data: {
  82. recordId: this.id,
  83. receiving: this.receivingTime,
  84. maintain: this.repairsTime
  85. }
  86. })
  87. // console.log(res)
  88. if (res.code === '200') {
  89. uni.showToast({
  90. title: '延时成功',
  91. icon: 'success'
  92. })
  93. setTimeout(() => {
  94. uni.redirectTo({
  95. url: '/pagesRepairs/box/box'
  96. })
  97. }, 1500)
  98. }
  99. }
  100. }
  101. })
  102. }
  103. }
  104. }
  105. </script>
  106. <style lang="scss" scoped>
  107. .container {
  108. box-sizing: border-box;
  109. padding: 0 30rpx;
  110. width: 100vw;
  111. height: 100vh;
  112. .box {
  113. display: flex;
  114. align-items: center;
  115. height: 100rpx;
  116. font-size: 32rpx;
  117. font-weight: bold;
  118. .box_time {
  119. display: flex;
  120. justify-content: space-between;
  121. align-items: center;
  122. box-sizing: border-box;
  123. padding: 0 23rpx;
  124. margin: 0 25rpx;
  125. width: 237rpx;
  126. height: 68rpx;
  127. font-weight: 400;
  128. border-radius: 4rpx;
  129. border: 1rpx solid #a6a6a6;
  130. input {
  131. flex: 1;
  132. }
  133. img {
  134. width: 40rpx;
  135. height: 40rpx;
  136. }
  137. }
  138. }
  139. .btn {
  140. position: absolute;
  141. bottom: 66rpx;
  142. display: flex;
  143. justify-content: center;
  144. align-items: center;
  145. margin: auto;
  146. width: 690rpx;
  147. height: 100rpx;
  148. color: #fff;
  149. font-size: 32rpx;
  150. border-radius: 12rpx;
  151. background-color: #6fb6b8;
  152. }
  153. }
  154. </style>