12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247 |
- <!-- 货源 -->
- <template>
- <!-- @touchend="end" @touchmove="move" -->
- <view :class="{popupShow:isShowAlert}" class="content">
- <!-- <fh-no-network></fh-no-network> -->
- <view class="banner">
- <image class="banner-img" src="@/static/images/goodSource/banner@2x.png" mode='widthFix'></image>
- <view class="head flex s-row">
- <view class="flex flex-space-between">
- <view class="flex s-row item1" @click="goCity(0)">
- <view class="fontsize-28 gray place-title">装车</view>
- <view class="fontsize-46 fontweight-500 text">{{startPlace.selected}}</view>
- </view>
- <image class="change-btn item2" src="@/static/images/goodSource/change.png" mode='widthFix'
- @click="changeCity"></image>
- <view class="flex s-row item3" @click="goCity(1)">
- <view class="fontsize-28 gray text-align-right place-title">卸车</view>
- <view class="fontsize-46 fontweight-500 text">{{endPlace.selected}}</view>
- </view>
- </view>
- <view>
- <u-button type="" class="btn-color fontsize-36" @click="upCallback({size:10,num:1})"> 查询
- </u-button>
- </view>
- </view>
- </view>
- <view :class="scrollTop>1200?'fixed1':''"></view>
- <view class="tab-view">
- <u-tabs :list="tabList" @click="clickTab" :lineColor="scrollTop>1200?'white':'#000000'" :current='tabIndex'
- :inactiveStyle="{color: scrollTop>1200?'white':'',}" :activeStyle="{
- color: scrollTop>1200?'':'#000000',
- fontWeight: 'bold',
- transform: 'scale(1.25)',
- }" :class="scrollTop>1200?'fixed':''"></u-tabs>
- <!-- 全部类型 -->
- <!-- <view class="tab-right" @click="selectType">
- <view>{{pickerSelect}}</view>
- <image style='width:8px;height:8px;margin-left:5px;'
- :src="!showMenu?'../../static/images/order/xiala.png':'../../static/images/order/shangla.png'"
- mode=""></image>
- </view> -->
- </view>
- <!-- <u-picker :show="show" :columns="columns" :closeOnClickOverlay='true' @close='selectTypeClose'
- @cancel='selectTypeClose' @confirm='confirmSelectType'></u-picker> -->
- <mescroll-body ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback"
- style="min-height: 410px !important;">
- <view v-for="(good,index) in goods" :key="index" @click="toDetail(good.id)">
- <view v-if="good.peripheralInfo==1&&isFirstIndex==index" class="other-goods">周边货源</view>
- <view class="good-list">
- <view class="good-view">
- <image src="@/static/images/goodSource/xf.png" mode="widthFix" class="xf-iamge"
- v-if="good.freightAdvance==1"></image>
- <view class="list-left">
- <view class="flex align-center">
- <view class="item1">
- <view class="ssx">
- {{$helper.getProvinceAbbreviation(good.sendPrivate?good.sendPrivate:good.sendCity)}}
- </view>
- <view class="level2-title">{{$helper.filterUrban(good.sendCity)}}
- {{$helper.filterArea(good.sendArea)}}
- </view>
- </view>
- <image class="jt-icon item2" src="@/static/images/goodSource/jt.png" mode='widthFix'>
- </image>
- <view class="item3">
- <view class="ssx">
- {{$helper.getProvinceAbbreviation(good.unloadPrivate?good.unloadPrivate:good.unloadCity)}}
- </view>
- <view class="level2-title">{{$helper.filterUrban(good.unloadCity)}}
- {{$helper.filterArea(good.unloadArea)}}
- </view>
- </view>
- </view>
- <view class="flex flex-space-between yf-style">
- <view class="left">
- <view class="flex">
- <view class="gray" v-if="good.cargoDistance"><text class="text-space">货距</text>
- <text class="text-space">{{good.cargoDistance}}km</text>
- </view>
- <view class="gray " v-if="good.distance"><text class="text-space">运距</text><text
- class="text-space">{{good.distance}}km</text> </view>
- </view>
- <view class="u-flex-wrap flex gray row ">
- <view>{{good.goodsName}}</view>
- <!-- <u-line direction="col"></u-line> -->
- <view v-if="carLength(good)"><text class="line">|</text> {{carLength(good)}}
- </view>
- <view v-if="carType(good)"><text class="line">|</text>{{carType(good)}} </view>
- <view v-if="carWeight(good)"><text class="line">|</text>{{carWeight(good)}}
- </view>
- </view>
- <view class="flex row">
- <view class="row-tips" v-if="good.taskDescription">{{good.taskDescription}}
- </view>
- </view>
- </view>
- <view class="right flex h-color">
- <text class="fontsize-46">
- {{good.freightPrice}}
- </text>
- <text class="flex dw">{{good.billingMethod == 0?"元/吨":"元/车"}}</text>
- </view>
- </view>
- </view>
- <!-- <view class="right gray">
- {{$helper.changeTime(good.updateDate)}}
- </view> -->
- </view>
- <view class="flex flex-space-between item-bottom">
- <view class="left flex row" @click.stop="cargoOwner(good)">
- <u--image
- :src="good.cargoOwnerPortrait?good.cargoOwnerPortrait:'../../static/images/mine/tx.png'"
- width='57rpx' height='57rpx' shape="circle">
- </u--image>
- <view class="name">{{good.cargoOwnerName}}</view>
- <!-- <view class="hp flex fontsize-24">
- <view class="gray">评分</view>
- <view class="number-color">99%</view>
- </view>
-
- <view class="sum flex fontsize-24">
- <view class="gray">发运次数</view>
- <view class="number-color">106</view>
- </view> -->
- </view>
- <view class="right">
- <view @click.stop="grabOrders(good)" class="qd" v-if='hasLogin'>抢单</view>
- </view>
- </view>
- </view>
- </view>
- </mescroll-body>
- <u-toast ref="uToast"></u-toast>
- <u-modal :show="isShowAlert" :title="alertTitle" :closeOnClickOverlay='true' :confirmText='confirmText'
- :showCancelButton='showCancelButton' confirmColor='#F5BA3C' @confirm="$u.throttle(confirmClick(), 1000)"
- @close="cancelClick" @cancel="cancelClick"></u-modal>
- </view>
- </template>
- <script>
- var that
- import permision from "@/js_sdk/wa-permission/permission.js"
- import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
- import {
- mapState
- } from 'vuex';
- import {
- apiGoods
- } from "@/api/mock.js"
- export default {
- mixins: [MescrollMixin], // 使用mixin
- data() {
- return {
- confirmText: '确定',
- showCancelButton: true,
- isFirstIndex: null,
- ObjSelect: {},
- isShowAlert: false,
- alertTitle: '确定抢单?',
- show: false,
- columns: [
- ['全部类型', '运费先付']
- ],
- startPlace: {},
- endPlace: {},
- otherGoods: [], // 数据列表
- goods: [], // 数据列表
- src: 'https://cdn.uviewui.com/uview/album/1.jpg',
- height: "", // 需要固定swiper的高度
- tabList: [
- // {
- // name: '全部'
- // },
- {
- name: '推荐'
- }, {
- name: '按时间'
- }, {
- name: '按距离'
- },
- // {
- // name: '运费先付'
- // },
- ],
- pickerSelect: '全部类型',
- tabIndex: 0,
- scrollTop: 0,
- isdblclick: 0,
- count: 0,
- lng: '',
- lat: '',
- bool: false,
- showMenu: false,
- driverCommonId: "",
- driverPhone: "",
- driverName: ""
- }
- },
- onTabItemTap(e) {
- this.isdblclick++
- // tab 点击时执行,此处直接接收单击事件
- if (this.scrollTop > 1200) {
- if (this.isdblclick > 1) {
- uni.pageScrollTo({
- scrollTop: 0,
- duration: 300
- });
- }
- }
- },
- created() {
- },
- computed: {
- ...mapState(['hasLogin', 'userInfo', 'firstAuthentication'])
- },
- watch: {
- // startPlace(){
- // console.log(this.startPlace)
- // this.upCallback({page});
- // },
- },
- onLoad() {
- that = this
- // this.checkOpenGPSServiceByAndroidIOS()
- },
- onHide() {
- this.isdblclick = 0
- },
- async onShow() {
- if (this.scrollTop > 1200) {
- uni.setTabBarItem({
- index: 0,
- text: '返回顶部',
- iconPath: 's',
- selectedIconPath: 'static/images/common/top@2x.png'
- })
- }
- uni.setTabBarItem({
- index: 2,
- text: '订单',
- iconPath: 'static/images/common/dingdan@2x(1).png',
- selectedIconPath: 'static/images/common/dingdan@2x.png'
- })
- var that = this
- //获取上一次点击起装卸地
- if (uni.getStorageSync('fPlaceObj')) {
- that.startPlace = uni.getStorageSync('fPlaceObj');
- } else {
- that.startPlace = {
- fchoosearea: '',
- fchoosecity: '沈阳市',
- fchooseprovince: '新民市',
- selected: '沈阳'
- }
- uni.setStorageSync('fPlaceObj', {
- fchoosearea: '辽宁省',
- fchoosecity: '沈阳市',
- fchooseprovince: '新民市',
- selected: '沈阳'
- })
- }
- if (uni.getStorageSync('sPlaceObj')) {
- that.endPlace = uni.getStorageSync('sPlaceObj');
- } else {
- that.endPlace.selected = '全国';
- uni.setStorageSync('sPlaceObj', {
- schoosearea: '请选择区',
- schoosecity: '请选择市',
- schooseprovince: '全国',
- selected: '全国'
- })
- }
- that.upCallback({
- size: 10,
- num: 1
- })
- that.$request.baseRequest('get', '/newsInfo/unreadMessage', {
- reCommonId: this.userInfo.id,
- }).then(res3 => {
- if (res3.data || res3.data == 0) {
- let name = 'myTip';
- let value = res3.data
- if (value == 0) {
- uni.removeTabBarBadge({
- index: 3
- })
- }
- that.$store.commit('$uStore', {
- name,
- value
- });
- if (value != 0 && value) {
- uni.setTabBarBadge({
- index: 3,
- text: value + ""
- })
- }
- }
- })
- // this.mescroll.resetUpScroll()
- },
- // async onLoad() {
- // that = this
- // // #ifdef APP-PLUS
- // let _status = await that.$request.baseRequest('get', '/driverInfo/firstAuthentication', {
- // driverPhone: this.userInfo.phone,
- // }).then(res => {
- // return res.data.authenticationStatus
- // })
- // // if (_status == '已禁用') {
- // // this.isShowAlert = true
- // // this.alertTitle = '账号审核中'
- // // this.confirmText = '退出APP'
- // // this.showCancelButton = false
- // // } else {
- // // console.log(1231233212332312312213)
- // // }
- // // #endif
- // },
- onPageScroll(res) {
- this.scrollTop = res.scrollTop
- // console.log("页面滚动了", res.scrollTop)
- if (this.scrollTop > 1200) {
- uni.setTabBarItem({
- index: 0,
- text: '返回顶部',
- iconPath: 'static/images/common/top@2x.png',
- selectedIconPath: 'static/images/common/top@2x.png'
- })
- } else {
- uni.setTabBarItem({
- index: 0,
- text: '货源',
- iconPath: 'static/images/common/huoyuan@2x(1).png',
- selectedIconPath: 'static/images/common/huoyuan@2x.png'
- })
- }
- },
- methods: {
- stopRoll() {
- },
- async get_localtion_permission() {
- var photol = await permision.checkSystemEnableLocation()
- if (photol == true) {
- this.getLngLat()
- } else {
- // that.$refs.uToast.show({
- // type: 'error',
- // message: "未获取定位权限!",
- // })
- this.checkOpenGPSServiceByAndroidIOS()
- }
- },
- async getLngLat() {
- await uni.getLocation({
- type: 'gcj02',
- geocode: true,
- success: res => {
- if (res.latitude) {
- if (res.address.city) {
- if (res.address.city.indexOf('市') != -1) {
- res.address.city = res.address.city.substring(0, res.address.city
- .length - 1)
- }
- }
- if (res.address.province) {
- if (res.address.province.indexOf('省') != -1) {
- res.address.province = res.address.province.substring(0, res.address
- .province.length - 1)
- }
- }
- uni.setStorageSync('fPlaceObj', {
- fchoosearea: '全部',
- fchoosecity: res.address.city,
- fchooseprovince: res.address.province,
- selected: res.address.city
- })
- uni.setStorageSync('sPlaceObj', {
- schoosearea: '请选择区',
- schoosecity: '请选择市',
- schooseprovince: '全国',
- selected: '全国'
- })
- uni.setStorageSync('longitudeAndLatitude', res.longitude + ',' + res.latitude)
- that.upCallback({
- size: 10,
- num: 1
- })
- }
- }
- })
- },
- checkOpenGPSServiceByAndroidIOS() {
- let system = uni.getSystemInfoSync(); // 获取系统信息
- // console.log(system);
- if (system.platform === 'android') { // 判断平台
- var context = plus.android.importClass("android.content.Context");
- var locationManager = plus.android.importClass("android.location.LocationManager");
- var main = plus.android.runtimeMainActivity();
- var mainSvr = main.getSystemService(context.LOCATION_SERVICE);
- if (!mainSvr.isProviderEnabled(locationManager.GPS_PROVIDER)) {
- uni.showModal({
- title: '提示',
- content: '请打开定位服务功能',
- // showCancel: false, // 不显示取消按钮
- success(res) {
- if (res.confirm) {
- uni.setStorageSync('confirm_location', 1)
- if (!mainSvr.isProviderEnabled(locationManager.GPS_PROVIDER)) {
- var Intent = plus.android.importClass('android.content.Intent');
- var Settings = plus.android.importClass('android.provider.Settings');
- var intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
- main.startActivity(intent); // 打开系统设置GPS服务页面
- console.log()
- }
- // else {
- // uni.setStorageSync('fPlaceObj', {
- // fchoosearea: '全部',
- // fchoosecity: '市辖区',
- // fchooseprovince: '北京',
- // selected: '东城'
- // })
- // uni.setStorageSync('sPlaceObj', {
- // schoosearea: '请选择区',
- // schoosecity: '请选择市',
- // schooseprovince: '全国',
- // selected: '全国'
- // })
- // uni.setStorageSync('longitudeAndLatitude', '116.3972,39.9096')
- // }
- } else {
- // uni.setStorageSync('fPlaceObj', {
- // fchoosearea: '全部',
- // fchoosecity: '市辖区',
- // fchooseprovince: '北京',
- // selected: '东城'
- // })
- // uni.setStorageSync('sPlaceObj', {
- // schoosearea: '请选择区',
- // schoosecity: '请选择市',
- // schooseprovince: '全国',
- // selected: '全国'
- // })
- // uni.setStorageSync('longitudeAndLatitude', '116.3972,39.9096')
- }
- }
- });
- // uni.setStorageSync('fPlaceObj', {
- // fchoosearea: '全部',
- // fchoosecity: '市辖区',
- // fchooseprovince: '北京',
- // selected: '东城'
- // })
- // uni.setStorageSync('sPlaceObj', {
- // schoosearea: '请选择区',
- // schoosecity: '请选择市',
- // schooseprovince: '全国',
- // selected: '全国'
- // })
- if (uni.getStorageSync('fPlaceObj')) {
- that.startPlace = uni.getStorageSync('fPlaceObj');
- }
- if (uni.getStorageSync('sPlaceObj')) {
- that.endPlace = uni.getStorageSync('sPlaceObj');
- }
- uni.setStorageSync('longitudeAndLatitude', '116.3972,39.9096')
- } else {
- this.getLngLat()
- }
- } else if (system.platform === 'ios') {
- // console.log("苹果");
- var cllocationManger = plus.ios.import("CLLocationManager");
- var enable = cllocationManger.locationServicesEnabled();
- var status = cllocationManger.authorizationStatus();
- plus.ios.deleteObject(cllocationManger);
- if (enable && status != 2) {
- this.getLngLat()
- console.log("手机系统的定位已经打开");
- } else {
- console.log("手机系统的定位没有打开");
- uni.showModal({
- title: '提示',
- content: '请前往设置-隐私-定位服务打开定位服务功能',
- // showCancel: false, // 不显示取消按钮
- success(res) {
- if (res.confirm) {
- var UIApplication = plus.ios.import("UIApplication");
- var application2 = UIApplication.sharedApplication();
- var NSURL2 = plus.ios.import("NSURL");
- // var setting2 = NSURL2.URLWithString("prefs:root=LOCATION_SERVICES");
- // var setting2 = NSURL2.URLWithString("App-Prefs:root=LOCATION_SERVICES");
- // var setting2 = NSURL2.URLWithString("app-settings");
- var setting2 = NSURL2.URLWithString("App-Prefs:root=Privacy&path=LOCATION");
- // var setting2 = NSURL2.URLWithString("App-Prefs:root=Privacy&path=LOCATION_SERVICES");
- application2.openURL(setting2);
- plus.ios.deleteObject(setting2);
- plus.ios.deleteObject(NSURL2);
- plus.ios.deleteObject(application2);
- this.getLngLat()
- }
- }
- });
- }
- }
- },
- cargoOwner(_obj) {
- // uni.$u.route('/pages/order/evaluateList');
- // console.log("查看---------------",_obj)
- uni.$u.route('/pages/goodSource/cargoOwnerSee', _obj)
- },
- mescrollInit(mescroll) {
- this.mescroll = mescroll;
- },
- confirmClick() {
- let item = this.ObjSelect
- var that = this
- let _obj = {
- driverCommonId: that.driverCommonId,
- commonId: item.commonId,
- compId: item.compId,
- cargoOwnerName: item.cargoOwnerReallyName,
- cargoOwner: item.cargoOwner,
- sendPrivate: item.sendPrivate,
- sendCity: item.sendCity,
- sendArea: item.sendArea,
- sendDetailedAddress: item.sendDetailedAddress,
- unloadPrivate: item.unloadPrivate,
- unloadCity: item.unloadCity,
- unloadArea: item.unloadArea,
- unloadDetailedAddress: item.unloadDetailedAddress,
- goodsName: item.goodsName,
- distance: item.distance,
- freightPrice: item.freightPrice,
- driverName: that.driverName,
- driverPhone: that.driverPhone,
- cargoOwnerPhone: item.cargoOwnerPhone,
- id: item.id,
- billingMethod: item.billingMethod,
- freightAdvance: item.freightAdvance,
- goodsType: item.goodsType,
- goodsTypeKey: item.goodsTypeKey
- }
- console.log("查看抢单", _obj)
- that.$request.baseRequest('post', '/publishTaskInfo/api/addOrder', _obj).then(res => {
- if (res.code == 200) {
- that.$refs.uToast.show({
- type: 'success',
- message: "抢单成功!",
- complete() {
- uni.switchTab({
- url: "/pages/order/index"
- })
- }
- })
- } else {
- that.$refs.uToast.show({
- type: 'error',
- message: res.message,
- })
- }
- })
- .catch(res => {
- uni.$u.toast(res.message);
- });
- // });
- this.isShowAlert = false
- },
- cancelClick() {
- this.isShowAlert = false
- },
- carLength(good) {
- let length = ''
- if (good.carLengthSmall && good.carLength) {
- length = good.carLengthSmall + '~' + good.carLength + '米'
- } else if (good.carLengthSmall && !good.carLength) {
- length = "大于" + good.carLengthSmall + '米'
- } else if (good.carLength && !good.carLengthSmall) {
- length = "小于" + good.carLength + '米'
- }
- return length
- },
- carType(good) {
- let _val = '';
- if (good.carModel == 1) {
- _val = ''
- } else {
- if (good.carModel.includes(2)) {
- _val += '高栏 '
- }
- if (good.carModel.includes(3)) {
- _val += '集装箱 '
- }
- if (good.carModel.includes(4)) {
- _val += '自卸车 '
- }
- }
- return _val
- },
- carWeight(good) {
- good.loadWeightSmall
- good.loadWeight
- let weight = ''
- if (good.loadWeightSmall && good.loadWeight) {
- weight = good.loadWeightSmall + '~' + good.loadWeight + '吨'
- } else if (good.loadWeightSmall) {
- weight = "大于" + good.loadWeightSmall + '吨'
- } else if (good.loadWeight) {
- weight = "小于" + good.loadWeight + '吨'
- }
- return weight
- },
- getdate() {
- var date = new Date()
- var year = date.getFullYear() //获取完整的年份(4位)
- var mouth = date.getMonth() + 1 //获取当前月份(0-11,0代表1月)
- var datetime = date.getDate() //获取当前日(1-31)
- if (mouth < 10) {
- mouth = '0' + mouth
- }
- if (datetime < 10) {
- datetime = '0' + datetime
- }
- return String(year) + String(mouth) + String(datetime)
- },
- grabOrders(item) {
- let that = this
- this.$request.baseRequest('get', '/driverInfo/firstAuthentication', {
- driverPhone: this.userInfo.phone,
- }).then(res2 => {
- if (res2.data.authenticationStatus == '已过期') {
- that.$refs.uToast.show({
- type: 'error',
- message: '证件已过期,请上传新证件!',
- })
- return
- } else if (res2.data.authenticationStatus == '未认证' || res2.data.authenticationStatus ==
- '已驳回') {
- that.$refs.uToast.show({
- type: 'error',
- message: '请先完成司机认证!',
- })
- return
- } else if (res2.data.authenticationStatus == '审核中') {
- that.$refs.uToast.show({
- type: 'error',
- message: '司机审核中!',
- })
- return
- } else if (res2.data.authenticationStatus == '已认证') {
- this.driverCommonId = res2.data.commonId
- this.driverPhone = res2.data.driverPhone
- this.driverName = res2.data.driverName
- this.isShowAlert = true
- this.ObjSelect = item
- }
- })
- },
- confirmSelectType(val) {
- this.pickerSelect = val.value[0]
- this.show = false
- this.upCallback({
- size: 10,
- num: 1
- })
- },
- selectTypeClose() {
- this.show = false
- },
- selectType() {
- this.show = true
- },
- // getLngLat() {
- // var that=this
- // // uni.showLoading({
- // // title: '获取定位信息'
- // // })
- // uni.getLocation({
- // type: 'gcj02',
- // geocode: true,
- // success: res => {
- // if (res.latitude) {
- // console.log(res)
- // if(res.address.city){
- // if(res.address.city.indexOf('市')!=-1){
- // res.address.city=res.address.city.substring(0,res.address.city.length-1)
- // }
- // }
- // if(res.address.province){
- // if(res.address.province.indexOf('省')!=-1){
- // res.address.province=res.address.province.substring(0,res.address.province.length-1)
- // }
- // }
- // uni.setStorageSync('fPlaceObj',{
- // fchoosearea:'全部',
- // fchoosecity:res.address.city,
- // fchooseprovince:res.address.province,
- // selected:res.address.city
- // })
- // uni.setStorageSync('sPlaceObj',{
- // schoosearea:'请选择区',
- // schoosecity:'请选择市',
- // schooseprovince:'全国',
- // selected:'全国'
- // })
- // let _pickerSelect;
- // if (that.pickerSelect == '运费先付') {
- // _pickerSelect = 1
- // } else {
- // _pickerSelect = 0
- // }
- // that.startPlace.selected=res.address.city
- // that.startPlace.fchoosecity=res.address.city
- // let _data = {
- // searchKeyWord: this.tabIndex + 1,
- // searchType: _pickerSelect,
- // pageSize: 10,
- // currentPage: 1,
- // loadingPlaceCity: that.startPlace.fchoosecity,
- // // unLoadingPlaceCity: this.endPlace.schoosecity
- // }
- // that.$forceUpdate()
- // // that.$set(that.startPlace,'selected',res.address.city)
- // // that.lng = res.longitude;
- // // that.lat = res.latitude;
- // that.$request.baseRequest('get', '/publishTaskInfo/selectGoodsSource', _data).then(res => {
- // if (res.code == 200) {
- // console.log(res.data.records)
- // uni.hideLoading()
- // that.mescroll.endBySize(res.data.records.length, res.data.total);
- // if(res.data.records){
- // that.goods = res.data.records
- // for (let i = 0; i < that.goods.length; i++) {
- // if (that.goods[i].peripheralInfo == 1) {
- // that.isFirstIndex = i
- // return
- // }
- // }
- // }else{
- // that.goods=[]
- // }
- // }
- // uni.hideLoading()
- // })
- // .catch(res => {
- // uni.$u.toast(res.message);
- // that.mescroll.endErr();
- // });
- // } else {
- // if (uni.getSystemInfoSync().platform == 'android') {
- // var context = plus.android.importClass("android.content.Context");
- // var locationManager = plus.android.importClass(
- // "android.location.LocationManager");
- // var main = plus.android.runtimeMainActivity();
- // var mainSvr = main.getSystemService(context.LOCATION_SERVICE);
- // that.bool = mainSvr.isProviderEnabled(locationManager.GPS_PROVIDER)
- // }
- // if (that.bool === false) {
- // uni.showModal({
- // title: '提示',
- // content: '请打开定位服务',
- // success: ({
- // confirm,
- // cancel
- // }) => {
- // if (confirm) {
- // if (uni.getSystemInfoSync().platform == 'android') {
- // var Intent = plus.android.importClass(
- // 'android.content.Intent');
- // var Settings = plus.android.importClass(
- // 'android.provider.Settings');
- // var intent = new Intent(Settings
- // .ACTION_LOCATION_SOURCE_SETTINGS);
- // var main = plus.android.runtimeMainActivity();
- // main.startActivity(intent); // 打开系统设置GPS服务页面
- // }
- // }
- // }
- // });
- // }
- // uni.hideLoading()
- // }
- // }
- // });
- // },
- toDetail(id) {
- var that = this
- that.$request.baseRequest('get', '/driverInfo/firstAuthentication', {
- driverPhone: this.userInfo.phone,
- }).then(res2 => {
- // console.log('跳转',1111111)
- uni.setStorageSync('firstAuthentication', res2.data)
- that.firstAuthentication = uni.getStorageSync('firstAuthentication')
- // console.log(that.firstAuthentication)
- //司机是否认证身份
- // 保留uni.getStorageSync('firstAuthentication'),thisfirstAuthentication有缓存问题
- if (uni.getStorageSync('firstAuthentication').authenticationStatus == '已认证') {
- uni.$u.route('/pages/goodSource/shippingDetails', {
- id: id,
- });
- } else if (uni.getStorageSync('firstAuthentication').authenticationStatus == '已过期') {
- that.$refs.uToast.show({
- type: 'error',
- message: "证件已过期,请上传新证件!",
- })
- } else {
- that.$refs.uToast.show({
- type: 'error',
- message: "请先完成司机认证!",
- })
- }
- })
- },
- /*上拉加载的回调: 其中page.num:当前页 从1开始, page.size:每页数据条数,默认10 */
- upCallback(page) {
- var that = this
- let _pickerSelect;
- if (this.pickerSelect == '运费先付') {
- _pickerSelect = 1
- } else {
- _pickerSelect = 0
- }
- //选择省市区
- let _data = {
- searchKeyWord: this.tabIndex + 1,
- searchType: _pickerSelect,
- // loadingPlace: this.startPlace.selected,
- // unLoadingPlace: this.endPlace.selected=="全国"?'':this.endPlace.selected,
- pageSize: page.size,
- currentPage: page.num,
- // loadingPlaceCity: this.startPlace.fchoosecity,
- // unLoadingPlaceCity: this.endPlace.schoosecity
- }
- console.log(uni.getStorageSync('longitudeAndLatitude'))
- // if (this.tabIndex == 2) {
- if (uni.getStorageSync('longitudeAndLatitude')) {
- this.lng = uni.getStorageSync('longitudeAndLatitude').split(',')[0]
- this.lat = uni.getStorageSync('longitudeAndLatitude').split(',')[1]
- }
- _data.driverLongitude = this.lng
- _data.driverLatitude = this.lat
- // }
- console.log('------')
- console.log(_data)
- if (uni.getStorageSync('fPlaceObj')) {
- if (this.startPlace.fchoosearea && this.startPlace.fchoosearea == '全部' && this.startPlace
- .fchoosearea != '请选择区') {
- // _data.loadingPlaceCity = this.startPlace.fchoosecity
- if (this.startPlace.fchoosecity == '市辖区') {
- _data.loadingPlaceCity = this.startPlace.fchooseprovince
- } else {
- _data.loadingPlaceCity = this.startPlace.fchoosecity
- }
- } else if (this.startPlace.fchoosecity == '全部') {
- _data.loadingPlace = this.startPlace.selected
- } else {
- _data.loadingPlaceCity = this.startPlace.fchoosecity
- // _data.loadingPlace = this.startPlace.fchoosearea
- _data.loadingPlace = ""
- }
- } else {
- _data.loadingPlaceCity = this.startPlace.fchoosecity
- }
- if (uni.getStorageSync('sPlaceObj')) {
- if (this.endPlace.schoosearea && this.endPlace.schoosearea == '全部' && this.endPlace.schoosearea !=
- '请选择区') {
- if (this.endPlace.schoosecity == '市辖区') {
- _data.unLoadingPlaceCity = this.endPlace.schooseprovince
- } else {
- _data.unLoadingPlaceCity = this.endPlace.schoosecity
- }
- } else if (this.endPlace.schoosearea) {
- _data.unLoadingPlace = this.endPlace.selected == "全国" ? '' : this.endPlace.selected
- } else {
- _data.unLoadingPlace = this.endPlace.selected == "全国" ? '' : this.endPlace.selected
- _data.unLoadingPlaceCity = this.endPlace.schoosecity
- }
- } else {
- _data.unLoadingPlace = this.endPlace.selected == "全国" ? '' : this.endPlace.selected
- }
- if (this.lng) {
- _data.longitude = this.lng
- _data.latitude = this.lat
- }
- uni.showLoading({
- mask: true,
- title: '加载中'
- })
- console.log(_data)
- this.$request.baseRequest('get', '/publishTaskInfo/selectGoodsSource', _data).then(res => {
- uni.hideLoading()
- if (res.code == 200) {
- if (page.num == 1) {
- this.goods = [];
- // this.otherGoods = []
- };
- if (res.data.records) {
- for (var i = 0; i < res.data.records.length; i++) {
- if (res.data.records[i].cargoDistance) {
- if (res.data.records[i].cargoDistance > 10) {
- res.data.records[i].cargoDistance = res.data.records[i].cargoDistance
- .toFixed(0)
- } else {
- res.data.records[i].cargoDistance = res.data.records[i].cargoDistance
- .toFixed(1)
- }
- }
- if (res.data.records[i].distance) {
- if (res.data.records[i].distance > 10) {
- res.data.records[i].distance = res.data.records[i].distance.toFixed(0)
- } else {
- res.data.records[i].distance = res.data.records[i].distance.toFixed(1)
- }
- }
- }
- }
- this.mescroll.endBySize(res.data.records.length, res.data.total);
- // for (var i = 0; i < res.data.records.length; i++) {
- // res.data.records[i].cargoOwnerName1=
- // }
- //如果是第一页需手动制空列表
- if (res.data.records) {
- that.goods = that.goods.concat(res.data.records);
- for (let i = 0; i < that.goods.length; i++) {
- if (that.goods[i].peripheralInfo == 1) {
- that.isFirstIndex = i
- return
- }
- }
- } else {
- that.goods = []
- }
- }
- })
- .catch(res => {
- uni.hideLoading()
- uni.$u.toast(res.message);
- this.mescroll.endErr();
- });
- },
- async clickTab(val) {
- console.log("val", val)
- this.tabIndex = val.index
- if (val.name == '按距离') {
- console.log(1)
- // this.checkOpenGPSServiceByAndroidIOS()
- // var photol = await permision.checkSystemEnableLocation()
- // console.log("photol",photol)
- // if (!photol) {
- that.get_localtion_permission()
- // }
- } else {
- this.upCallback({
- size: 10,
- num: 1,
- })
- }
- },
- changeCity() {
- if (this.endPlace.selected == '全国') {
- this.$refs.uToast.show({
- type: 'error',
- message: "装车地不能为全国!",
- })
- return
- }
- [this.startPlace.fchooseprovince, this.endPlace.schooseprovince] = [this.endPlace.schooseprovince, this
- .startPlace.fchooseprovince
- ];
- [this.startPlace.fchoosecity, this.endPlace.schoosecity] = [this.endPlace.schoosecity, this.startPlace
- .fchoosecity
- ];
- [this.startPlace.fchoosearea, this.endPlace.schoosearea] = [this.endPlace.schoosearea, this.startPlace
- .fchoosearea
- ];
- [this.startPlace.selected, this.endPlace.selected] = [this.endPlace.selected, this.startPlace.selected];
- // [this.startPlace, this.endPlace] = [this.endPlace, this.startPlace];
- uni.setStorageSync('fPlaceObj', this.startPlace);
- uni.setStorageSync('sPlaceObj', this.endPlace);
- },
- goCity(type) {
- uni.$u.route('/pages/goodSource/selectCity', {
- startPlace: JSON.stringify(this.startPlace),
- endPlace: JSON.stringify(this.endPlace),
- type: type
- });
- },
- swiperChange(e) {
- this.tabIndex = e.detail.current
- }
- }
- }
- </script>
- <style scoped lang="scss">
- .popupShow {
- overflow: hidden;
- position: fixed;
- height: 100vh;
- width: 100%;
- }
- .content {
- background: #F2F4F7;
- }
- .banner {
- width: 100%;
- position: relative;
- }
- .u-flex-wrap {
- flex-wrap: wrap;
- }
- .fixed,
- .fixed1 {
- background: linear-gradient(97deg, #F5BA3C 0%, #F5BA3C 100%);
- position: fixed;
- top: var(--status-bar-height);
- z-index: 999;
- // width: calc(100% - 40rpx);
- width: 100%;
- // margin:0 20rpx;
- }
- .fixed1 {
- top: 0;
- height: var(--status-bar-height);
- background: linear-gradient(97deg, #F5BA3C 0%, #F5BA3C 100%);
- }
- .banner-img {
- width: 100%;
- }
- .head {
- position: absolute;
- width: calc(100% - 108rpx);
- bottom: 0;
- background: white;
- margin: 0 20rpx;
- border-radius: 20rpx;
- padding: 33rpx 33rpx 48rpx 33rpx;
- .item1,
- .item3 {
- width: 40%;
- .text {
- text-overflow: ellipsis;
- overflow: hidden;
- white-space: nowrap;
- }
- }
- .item1 .text {
- text-align: left;
- }
- .item3 .text {
- text-align: right;
- }
- }
- .change-btn {
- width: 86rpx;
- height: 86rpx;
- }
- .good-list {
- background-color: white;
- margin: 10px 10px 15px 10px;
- // padding: 10px 0px 0px 0;
- border-radius: 30rpx;
- box-shadow: 0px 5rpx 20rpx #E3E3E3;
- .good-view {
- padding: 10rpx 35rpx 10rpx 35rpx;
- position: relative;
- }
- .item1,
- .item3 {
- // width: 40%;
- display: flex;
- .text {
- text-overflow: ellipsis;
- overflow: hidden;
- white-space: nowrap;
- }
- }
- .item1 .text {
- text-align: left;
- }
- .item3 .text {
- text-align: right;
- }
- }
- .jt-icon {
- position: relative;
- // top: 6rpx;
- width: 60rpx;
- margin: 0 20rpx;
- }
- .row {
- margin: 10rpx 0;
- align-items: center;
- }
- .item-bottom {
- background: #F0F5FF;
- padding: 23rpx 30rpx;
- border-radius: 0px 0px 18px 18px;
- .name {
- font-size: 26rpx;
- font-weight: 700;
- color: #000000;
- margin-left: 30rpx;
- }
- .hp {
- margin: 30rpx;
- }
- .number-color {
- margin: 0 10rpx;
- }
- .qd {
- background: linear-gradient(97deg, #F5BA3C 0%, #F5BA3C 100%);
- border-radius: 13rpx;
- font-size: 29rpx;
- font-weight: 400;
- color: #FFFFFF;
- padding: 15rpx 35rpx;
- }
- }
- .dw {
- align-items: center;
- }
- .place {
- height: var(--status-bar-height);
- }
- .tab-view {
- display: flex;
- align-items: center;
- justify-content: space-between;
- // padding-left: 20rpx;
- }
- .tab-right {
- display: flex;
- margin-right: 39rpx;
- align-items: center;
- }
- .other-goods {
- // background: red;
- color: #999999;
- margin: 40rpx 0;
- display: flex;
- justify-content: center;
- font-size: 36rpx;
- }
- .level2-title {
- font-size: 28rpx;
- }
- .yf-style {
- position: relative;
- .left {
- font-size: 25.39rpx;
- .text-space {
- margin-right: 20rpx;
- }
- .line {
- margin: 0 10rpx;
- }
- }
- .h-color {
- // position: absolute;
- // right: 0;
- // top: -30rpx;
- }
- }
- .xf-iamge {
- width: 74rpx;
- height: 43rpx;
- position: absolute;
- top: -20rpx;
- right: 0;
- }
- .place-title {
- margin-bottom: 11rpx;
- }
- .btn-color {
- margin-top: 52rpx;
- padding: 30rpx 0;
- }
- </style>
|