bikeDetail.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231
  1. <template>
  2. <!-- <text>车辆详情</text> -->
  3. <view class="user-detail">
  4. <view class="user-detail-message">
  5. <view class=""><text>车辆编号:{{detail.bike_no}}</text></view>
  6. <view class=""><text>地址:{{detail.area_name}}</text></view>
  7. <view class=""><text>电量:{{detail.battery_power}}%</text></view>
  8. <view class=""><text>状态:</text><text class="bike-zk">{{detail.tab_name}}</text></view>
  9. </view>
  10. <view class="user-account" v-for="(item,index) in carList" :key='index' @click="skip(index)">
  11. <image class="icon" :src="item.img_url" mode=""></image>
  12. <text class="account-left">{{item.text}}</text>
  13. <view class="account-right">
  14. <image src="../../static/img/right-arrow.png" mode=""></image>
  15. </view>
  16. </view>
  17. <view class="user-account">
  18. <text class="account-left">备注:</text>
  19. <input type="text" value="" class="user-detai-beizhu" :value="detail.remark" @input="getText" />
  20. <view class="user-detail-bt" @click="operate">
  21. 完成
  22. </view>
  23. </view>
  24. </view>
  25. </template>
  26. <script>
  27. var app = getApp()
  28. export default {
  29. data() {
  30. return {
  31. carList: [
  32. //详情列表
  33. {
  34. id: 1,
  35. img_url: "http://resource.weilaibike.com/bike_yunwei/position.png",
  36. text: "车辆位置"
  37. },
  38. {
  39. id: 2,
  40. img_url: "http://resource.weilaibike.com/bike_yunwei/scan.png",
  41. text: "扫码位置"
  42. },
  43. {
  44. id: 3,
  45. img_url: "http://resource.weilaibike.com/bike_yunwei/order.png",
  46. text: "最近订单"
  47. },
  48. {
  49. id: 4,
  50. img_url: "http://resource.weilaibike.com/bike_yunwei/lock.png",
  51. text: "开关锁记录"
  52. },
  53. {
  54. id: 4,
  55. img_url: "http://resource.weilaibike.com/bike_yunwei/line.png",
  56. text: "上下线记录"
  57. }
  58. ],
  59. id: '',
  60. bike_no: '',
  61. detail: [],
  62. isDisabled: false, //备注是否修改
  63. textVal: '', //输入框内容
  64. }
  65. },
  66. onLoad(options) {
  67. uni.showLoading({
  68. title: '加载中...',
  69. })
  70. this.bike_no = options.bike_no,
  71. this.id = options.id
  72. app.request('bike/getBikeInfo?bike_no=' + options.bike_no, '', 'GET').then(res => {
  73. uni.hideLoading();
  74. this.detail = res.data.bike_info
  75. })
  76. },
  77. methods: {
  78. //页面跳转
  79. skip: function(e) {
  80. console.log(e, '这是页面跳转')
  81. let idx = parseInt(e);
  82. let url = ''
  83. switch (idx) {
  84. case 0:
  85. url = '/pages/index/car_position';
  86. break;
  87. case 1:
  88. url = '/pages/manage/scanRecord';
  89. break;
  90. case 2:
  91. url = '/pages/manage/recentOrder';
  92. break;
  93. case 3:
  94. url = '/pages/manage/lockRecord';
  95. break;
  96. case 4:
  97. url = '/pages/manage/lineRecord';
  98. break;
  99. default:
  100. ;
  101. }
  102. uni.navigateTo({
  103. url: url + '?bike_no=' + this.bike_no + '&&id=' + this.id,
  104. })
  105. },
  106. getText: function(e) {
  107. this.textVal = e.detail.value
  108. },
  109. operate: function() {
  110. let data = {
  111. remark: this.textVal
  112. }
  113. if (this.textVal == '') {
  114. uni.showToast({
  115. title: '请填写备注~',
  116. icon: 'none'
  117. })
  118. } else {
  119. uni.showLoading({
  120. title: '加载中...',
  121. })
  122. app.request('bike/updateRemark/' + this.id, data, 'PUT').then(res => {
  123. uni.hideLoading();
  124. console.log(res);
  125. if (res.statusCode == 200) {
  126. uni.showToast({
  127. title: '提交成功~',
  128. icon: 'none'
  129. })
  130. }
  131. })
  132. }
  133. },
  134. }
  135. }
  136. </script>
  137. <style>
  138. page {
  139. background-color: #f1f1f1;
  140. }
  141. .user-detail {
  142. padding: 20rpx 30rpx;
  143. }
  144. .user-detail-message {
  145. font-size: 24rpx;
  146. line-height: 50rpx;
  147. background-color: #FFFFFF;
  148. border-radius: 15rpx;
  149. padding: 20rpx;
  150. color: #FFFFFF;
  151. background-image: url('http://resource.weilaibike.com/bike_yunwei/detailBg.png');
  152. background-size: 100%;
  153. }
  154. .user-account {
  155. margin-top: 20rpx;
  156. padding: 0 20rpx;
  157. height: 88rpx;
  158. font-size: 28rpx;
  159. line-height: 88rpx;
  160. background-color: #FFFFFF;
  161. border-radius: 15rpx;
  162. }
  163. .account-right {
  164. float: right;
  165. }
  166. .user-detai-beizhu {
  167. display: inline-block;
  168. /* width: 100%; */
  169. vertical-align: middle;
  170. border-radius: 30rpx;
  171. border: solid 1px #d1d1d1;
  172. }
  173. .user-detail-bt {
  174. display: inline-block;
  175. margin-top: 30rpx;
  176. float: right;
  177. height: 38rpx;
  178. line-height: 38rpx;
  179. width: 80rpx;
  180. text-align: center;
  181. font-size: 22rpx;
  182. border-radius: 30rpx;
  183. background-color: #18D5B9;
  184. color: #FFFFFF;
  185. }
  186. .account-right image {
  187. margin-top: 30rpx;
  188. height: 30rpx;
  189. width: 40rpx;
  190. }
  191. .bike-zk {
  192. display: inline-block;
  193. vertical-align: middle;
  194. height: 26rpx;
  195. line-height: 26rpx;
  196. padding: 5rpx 30rpx;
  197. border-radius: 21rpx;
  198. text-align: center;
  199. margin-left: 20rpx;
  200. font-size: 22rpx;
  201. background: linear-gradient(163deg, rgba(255, 139, 102, 1) 0%, rgba(254, 87, 34, 1) 100%);
  202. box-shadow: 0 0 6rpx 0 rgba(254, 94, 44, 1);
  203. }
  204. .icon {
  205. display: inline-block;
  206. vertical-align: middle;
  207. height: 40rpx;
  208. width: 40rpx;
  209. margin-right: 22rpx;
  210. border-radius: 10rpx;
  211. background-color: #18D5B9;
  212. }
  213. </style>