amendCar.vue 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160
  1. <template>
  2. <view>
  3. <view class="amendCar">
  4. <view class="inp">
  5. <image src="http://resource.weilaibike.com/common/icon1.png"></image>
  6. <input type="number" placeholder="请输入车牌号" v-model="bikeNo"></input>
  7. <text class="flexC" @click="scan1">扫码</text>
  8. </view>
  9. <view class="inp">
  10. <image src="http://resource.weilaibike.com/common/icon2.png"></image>
  11. <input type="number" placeholder="请输入中控设备号" v-model="boxNo"></input>
  12. <text class="flexC" @click="scan2">扫码</text>
  13. </view>
  14. <view class="inp">
  15. <image src="http://resource.weilaibike.com/common/icon3.png"></image>
  16. <input placeholder="添加备注" @input="input"></input>
  17. </view>
  18. <view class="button flexC" @click="btn">
  19. <view>保存</view>
  20. </view>
  21. </view>
  22. </view>
  23. </template>
  24. <script>
  25. var app = getApp()
  26. export default {
  27. data() {
  28. return {
  29. bikeNo: '', //车牌号
  30. boxNo: '', //车牌号
  31. bikeID: '', //车牌号
  32. value: ''
  33. }
  34. },
  35. methods: {
  36. // 扫车牌号
  37. scan1() {
  38. var that = this;
  39. uni.scanCode({
  40. onlyFromCamera: true,
  41. success(res) {
  42. let index = res.result.lastIndexOf("\=");
  43. var code = res.result.substring(index + 1, res.result.length);
  44. this.bikeNo = code
  45. app.request('bike/getBikeInfo?bike_no=' + code, '', 'GET').then(res => {
  46. this.bikeID = res.data.bike_info.id
  47. })
  48. }
  49. })
  50. },
  51. //扫描中控设备号
  52. scan2() {
  53. uni.scanCode({
  54. onlyFromCamera: true,
  55. success(res) {
  56. let index = res.result.lastIndexOf("\=");
  57. var code = res.result.substring(index + 1, res.result.length);
  58. this.boxNo = code
  59. }
  60. })
  61. },
  62. input: function(e) {
  63. this.value = e.detail.value
  64. },
  65. btn: function() {
  66. uni.showLoading({
  67. title: '修改中...',
  68. })
  69. var data = {
  70. bike_id: this.bikeID,
  71. bike_remarks: this.value,
  72. bike_no: this.bikeNo,
  73. box_no: this.boxNo,
  74. }
  75. app.request('bike/updateBikeInfo', data, 'POST').then(res => {
  76. uni.hideLoading()
  77. if (res.statusCode == 200) {
  78. uni.showToast({
  79. title: '修改成功',
  80. icon: 'none',
  81. success: function() {
  82. uni.navigateBack()
  83. }
  84. })
  85. }
  86. })
  87. },
  88. },
  89. onLoad: function(options) {
  90. this.bikeNo = options.bike_no;
  91. this.bikeID = options.id;
  92. this.boxNo = options.box_no;
  93. },
  94. }
  95. </script>
  96. <style>
  97. uni-page{
  98. height: auto;
  99. }
  100. .amendCar {
  101. width: 90%;
  102. margin: 20upx auto 0;
  103. }
  104. .amendCar>view {
  105. display: flex;
  106. }
  107. .amendCar image {
  108. height: 48upx;
  109. width: 48upx;
  110. margin-right: 28upx;
  111. }
  112. .amendCar view.inp {
  113. margin-bottom: 20upx;
  114. box-shadow: 0 0 4upx 0 rgba(222, 222, 222, 1);
  115. padding: 20upx 20upx;
  116. border-radius: 10upx;
  117. }
  118. .amendCar input {
  119. font-size: 28upx;
  120. border-bottom: 1px solid #6b6b6b;
  121. padding-bottom: 10upx;
  122. width: 70%;
  123. }
  124. .amendCar .placeholder {
  125. font-size: 28upx;
  126. color: #b6b6b6;
  127. }
  128. .amendCar text {
  129. background: #c5c5c5;
  130. padding: 5upx 20upx;
  131. color: #fff;
  132. font-size: 24upx;
  133. margin-left: 10upx;
  134. border-radius: 10upx;
  135. padding-top: 10upx;
  136. }
  137. .button {
  138. margin: 0 auto;
  139. width: 420upx;
  140. height: 88upx;
  141. color: #fff;
  142. letter-spacing: 10upx;
  143. margin-top: 84upx;
  144. background: rgba(24, 213, 185, 1);
  145. box-shadow: 0 8upx 13upx 0 rgba(100, 239, 218, 1);
  146. border-radius: 44upx;
  147. display: flex;
  148. align-items: center;
  149. justify-content: center;
  150. }
  151. </style>