reqair.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. <template>
  2. <view>
  3. <view class="box">
  4. <input placeholder="请输入车牌号" @input="input1" v-model="value1"></input>
  5. <input placeholder="请输入原因" @input="input3" v-model="value3"></input>
  6. <text style="width:690upx;font-size:32upx;font-family:PingFang SC;color:rgba(42,42,42,1);padding:15upx 0upx;">车辆状态</text>
  7. <view class="list">
  8. <view v-for="(item,index) in list" @click="screen(item.id,index)" :class="index1==index?'active':''">
  9. <text>{{item.name}}</text>
  10. </view>
  11. </view>
  12. <view class="btn" @click="btn">
  13. <text>提交</text>
  14. </view>
  15. </view>
  16. </view>
  17. </template>
  18. <script>
  19. var app = getApp()
  20. export default {
  21. data() {
  22. return {
  23. list: [],
  24. index1: null,
  25. bike_no: '',
  26. id: '',
  27. value1: '',
  28. value3: ''
  29. }
  30. },
  31. methods: {
  32. input1: function(e) {
  33. this.value1 = e.detail.value;
  34. },
  35. input3: function(e) {
  36. this.value3 = e.detail.value;
  37. },
  38. screen: function(id,index) {
  39. this.index1 = index
  40. this.id = id
  41. },
  42. btn: function() {
  43. var that = this;
  44. if (that.value1 == '') {
  45. uni.showToast({
  46. title: '请输入车牌号',
  47. icon: 'none'
  48. })
  49. return;
  50. } else if (that.value3 == '') {
  51. uni.showToast({
  52. title: '请输入原因',
  53. icon: 'none'
  54. })
  55. return;
  56. } else if (that.id == '') {
  57. uni.showToast({
  58. title: '请选择状态',
  59. icon: 'none'
  60. })
  61. return;
  62. }
  63. uni.showLoading({
  64. title: '加载中...',
  65. })
  66. var data = {
  67. bike_no: that.value1,
  68. trouble_part: that.id,
  69. reason: that.value3
  70. }
  71. app.request('bike/bikeRepair', data, 'POST').then(res => {
  72. uni.hideLoading();
  73. if (res.statusCode == 200) {
  74. uni.showToast({
  75. title: '报修完成',
  76. icon: 'none'
  77. })
  78. setTimeout(function() {
  79. uni.navigateBack()
  80. }, 2000)
  81. }
  82. })
  83. },
  84. },
  85. onLoad: function(options) {
  86. var that = this;
  87. that.value1 = options.bike_no
  88. uni.showLoading({
  89. title: '加载中...',
  90. })
  91. app.request('bike/repairOptions', '', 'GET').then(res => {
  92. uni.hideLoading();
  93. if (res.statusCode == 200) {
  94. that.list = res.data;
  95. }
  96. })
  97. uni.setNavigationBarTitle({
  98. title: '报修页面'
  99. })
  100. },
  101. }
  102. </script>
  103. <style>
  104. .box {
  105. width: 100%;
  106. height: 100%;
  107. display: flex;
  108. flex-direction: column;
  109. align-items: center;
  110. }
  111. .box input {
  112. width: 690upx;
  113. height: 90upx;
  114. background: rgba(255, 255, 255, 1);
  115. box-shadow: 0px 0px 4upx 0px rgba(141, 141, 141, 1);
  116. border-radius: 10upx;
  117. font-size: 28upx;
  118. padding-left: 20upx;
  119. margin-top: 30upx;
  120. }
  121. .box .list {
  122. width: 690upx;
  123. display: flex;
  124. flex-wrap: wrap;
  125. justify-content: space-between;
  126. }
  127. .box .list view {
  128. display: flex;
  129. align-items: center;
  130. justify-content: center;
  131. height: 58upx;
  132. background: rgba(255, 255, 255, 1);
  133. box-shadow: 0px 0px 18upx 0px rgba(208, 208, 208, 1);
  134. border-radius: 29upx;
  135. font-size: 28upx;
  136. color: rgba(92, 92, 92, 1);
  137. padding: 0upx 20upx;
  138. margin-top: 32upx;
  139. }
  140. .box .list .active {
  141. background: #ccc;
  142. color: white;
  143. }
  144. .box .btn {
  145. width: 420upx;
  146. height: 88upx;
  147. background: rgba(24, 213, 185, 1);
  148. box-shadow: 0px 0px 20upx 0px rgba(100, 239, 218, 1);
  149. border-radius: 44upx;
  150. display: flex;
  151. align-items: center;
  152. justify-content: center;
  153. font-size: 32upx;
  154. color: rgba(255, 255, 255, 1);
  155. margin-top: 200upx;
  156. }
  157. </style>