123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118 |
- <template>
- <view>
- <view class="search">
- <u-search placeholder="输入车辆名称" v-model="param.vehiclePlate" bgColor="white" @search="getByVehiclePlate()"
- @custom="getByVehiclePlate()" :showAction="true" @clear="refresh()"></u-search>
- <view class="clear"></view>
- </view>
- <view class="goodsList">
- <view class="item" v-for="(item, index) in vehiceList" :key="index">
- <view class="con">
- <view class="productName omit">{{ item.vehiclePlate }}</view>
- <view class="desc omit">{{item.vehicleModel}}</view>
- </view>
- <view>
- <button class="btn" @click="vehicleClick(item)">选择地址</button>
- </view>
- <view class="clear"></view>
- </view>
- <view class="loading" v-if="loadMore"><u-loadmore :status="loadMore ? 'loading' : 'nomore'" /></view>
- <u-empty v-if="!loadMore && vehiceList.length == 0"></u-empty>
- </view>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- param: {
- pageNo: 1,
- pageSize: 10
- },
- vehiceList: [],
- loadMore: true,
- vehice: {},
- address: {},
- }
- },
- onLoad(e) {
- this.getByVehiclePlate()
- if(e){
- let v = JSON.parse(decodeURIComponent(e.item))
- this.vehice.tradeAreaId = v.tradeAreaId
- this.vehice.tradeAreaName = v.tradeAreaName
- this.vehice.enterpriseId = v.enterpriseId
- this.vehice.orderId = v.id
- }
- uni.$on('one-address', res => {
- this.vehice.loadingAddress = res.address;
- this.informDriver()
- })
- console.log(this.vehice)
- // console.log(e)
- // console.log(this.address)
- // if(this.address.address) {
- // this.vehice.address = this.address.address
- // this.informDriver()
- // }
- },
- methods: {
- // 车牌查询
- getByVehiclePlate() {
- // this.vehiceList = []
- // this.param.vehiclePlate = ''
- this.http.request({
- url: '/transport-server/app/TbVehicle/getByVehiclePlate',
- loading: 'false',
- data: this.param,
- success: res => {
- this.loadMore = parseInt(res.data.pageCount) > this.param.pageNo;
- if (res.data.data) {
- // this.vehiceList.push(...r);
- this.vehiceList = res.data.data
- }
- }
- });
- },
- // 车辆绑定
- vehicleClick(item) {
- this.vehice.driverId = item.driverId
- this.vehice.vehicleId = item.id
- uni.navigateTo({
- url: '/pages/market/one/merchant/contacts/contacts'
- })
- },
- // 通知司机
- informDriver() {
- this.http.request({
- url: '/transport-server/app/TbVehicle/informDriver',
- loading: 'false',
- method: 'POST',
- contentType: 'application/json;charset=UTF-8',
- data: this.vehice,
- success: res => {
- uni.showToast({
- title: '稍等片刻,司机马上就来'
- })
- uni.$emit("refreshPage")
- uni.navigateBack();
- }
- });
- },
- }
- }
- </script>
- <style lang="scss">
- page {
- background-color: $pg;
- }
- .btn {
- height: 30px;
- margin: 8px 0px;
- display: flex;
- align-items: center;
- justify-content: center;
- }
- </style>
|