vehice.vue 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. <template>
  2. <view>
  3. <view class="search">
  4. <u-search placeholder="输入车辆名称" v-model="param.vehiclePlate" bgColor="white" @search="getByVehiclePlate()"
  5. @custom="getByVehiclePlate()" :showAction="true" @clear="refresh()"></u-search>
  6. <view class="clear"></view>
  7. </view>
  8. <view class="goodsList">
  9. <view class="item" v-for="(item, index) in vehiceList" :key="index">
  10. <view class="con">
  11. <view class="productName omit">{{ item.vehiclePlate }}</view>
  12. <view class="desc omit">{{item.vehicleModel}}</view>
  13. </view>
  14. <view>
  15. <button class="btn" @click="vehicleClick(item)">选择地址</button>
  16. </view>
  17. <view class="clear"></view>
  18. </view>
  19. <view class="loading" v-if="loadMore"><u-loadmore :status="loadMore ? 'loading' : 'nomore'" /></view>
  20. <u-empty v-if="!loadMore && vehiceList.length == 0"></u-empty>
  21. </view>
  22. </view>
  23. </template>
  24. <script>
  25. export default {
  26. data() {
  27. return {
  28. param: {
  29. pageNo: 1,
  30. pageSize: 10
  31. },
  32. vehiceList: [],
  33. loadMore: true,
  34. vehice: {},
  35. address: {},
  36. }
  37. },
  38. onLoad(e) {
  39. this.getByVehiclePlate()
  40. if(e){
  41. let v = JSON.parse(decodeURIComponent(e.item))
  42. this.vehice.tradeAreaId = v.tradeAreaId
  43. this.vehice.tradeAreaName = v.tradeAreaName
  44. this.vehice.enterpriseId = v.enterpriseId
  45. this.vehice.orderId = v.id
  46. }
  47. uni.$on('one-address', res => {
  48. this.vehice.loadingAddress = res.address;
  49. this.informDriver()
  50. })
  51. console.log(this.vehice)
  52. // console.log(e)
  53. // console.log(this.address)
  54. // if(this.address.address) {
  55. // this.vehice.address = this.address.address
  56. // this.informDriver()
  57. // }
  58. },
  59. methods: {
  60. // 车牌查询
  61. getByVehiclePlate() {
  62. // this.vehiceList = []
  63. // this.param.vehiclePlate = ''
  64. this.http.request({
  65. url: '/transport-server/app/TbVehicle/getByVehiclePlate',
  66. loading: 'false',
  67. data: this.param,
  68. success: res => {
  69. this.loadMore = parseInt(res.data.pageCount) > this.param.pageNo;
  70. if (res.data.data) {
  71. // this.vehiceList.push(...r);
  72. this.vehiceList = res.data.data
  73. }
  74. }
  75. });
  76. },
  77. // 车辆绑定
  78. vehicleClick(item) {
  79. this.vehice.driverId = item.driverId
  80. this.vehice.vehicleId = item.id
  81. uni.navigateTo({
  82. url: '/pages/market/one/merchant/contacts/contacts'
  83. })
  84. },
  85. // 通知司机
  86. informDriver() {
  87. this.http.request({
  88. url: '/transport-server/app/TbVehicle/informDriver',
  89. loading: 'false',
  90. method: 'POST',
  91. contentType: 'application/json;charset=UTF-8',
  92. data: this.vehice,
  93. success: res => {
  94. uni.showToast({
  95. title: '稍等片刻,司机马上就来'
  96. })
  97. uni.$emit("refreshPage")
  98. uni.navigateBack();
  99. }
  100. });
  101. },
  102. }
  103. }
  104. </script>
  105. <style lang="scss">
  106. page {
  107. background-color: $pg;
  108. }
  109. .btn {
  110. height: 30px;
  111. margin: 8px 0px;
  112. display: flex;
  113. align-items: center;
  114. justify-content: center;
  115. }
  116. </style>