index.vue 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931
  1. <!-- 货源 -->
  2. <template>
  3. <view class="content">
  4. <view class="banner">
  5. <image class="banner-img" src="@/static/images/goodSource/banner@2x.png" mode='widthFix'></image>
  6. <view class="head flex s-row paddingr35">
  7. <view class="flex flex-space-between">
  8. <view class="flex s-row item1" @click="goCity(0)">
  9. <view class="fontsize-28 gray">装车</view>
  10. <view class="fontsize-46 fontweight-500 text">{{startPlace.selected}}</view>
  11. </view>
  12. <image class="change-btn item2" src="@/static/images/goodSource/change.png" mode='widthFix'
  13. @click="changeCity"></image>
  14. <view class="flex s-row item3" @click="goCity(1)">
  15. <view class="fontsize-28 gray text-align-right">卸车</view>
  16. <view class="fontsize-46 fontweight-500 text">{{endPlace.selected}}</view>
  17. </view>
  18. </view>
  19. <view>
  20. <u-button type="" class="btn-color fontsize-36 m-top20" @click="upCallback({size:10,num:1})"> 查询
  21. </u-button>
  22. </view>
  23. </view>
  24. </view>
  25. <view :class="scrollTop>1200?'fixed1':''"></view>
  26. <view class="tab-view">
  27. <u-tabs :list="tabList" @click="clickTab" :lineColor="scrollTop>1200?'white':'#303133'" :current='tabIndex'
  28. :inactiveStyle="{color: scrollTop>1200?'white':'',}" :activeStyle="{
  29. color: scrollTop>1200?'white':'',
  30. fontWeight: 'bold',
  31. transform: 'scale(1.05)'
  32. }" :class="scrollTop>1200?'fixed':''"></u-tabs>
  33. <view class="tab-right" @click="selectType">
  34. <view>{{pickerSelect}}</view>
  35. <u-icon name="arrow-down" size="20"></u-icon>
  36. </view>
  37. </view>
  38. <u-picker :show="show" :columns="columns" :closeOnClickOverlay='true' @close='selectTypeClose'
  39. @cancel='selectTypeClose' @confirm='confirmSelectType'></u-picker>
  40. <mescroll-body ref="mescrollRef" @init="mescrollInit" @down="downCallback" @up="upCallback">
  41. <view v-for="(good,index) in goods" :key="index" @click="toDetail(good.id)">
  42. <view v-if="good.peripheralInfo==1&&isFirstIndex==index" class="other-goods">周边货源</view>
  43. <view class="good-list">
  44. <view style="padding: 0 35rpx 20rpx 35rpx;position: relative;">
  45. <image src="@/static/images/goodSource/xf.png" mode="widthFix" class="xf-iamge"
  46. v-if="good.freightAdvance==1"></image>
  47. <view class="flex align-center">
  48. <view class="item1">
  49. <view class="ssx">{{$helper.getProvinceAbbreviation(good.sendPrivate?good.sendPrivate:good.sendCity)}}</view>
  50. <view class="level2-title">{{$helper.filterUrban(good.sendCity)}}
  51. {{$helper.filterArea(good.sendArea)}}
  52. </view>
  53. </view>
  54. <image class="jt-icon item2" src="@/static/images/goodSource/jt.png" mode='widthFix'>
  55. </image>
  56. <view class="item3">
  57. <view class="ssx">{{$helper.getProvinceAbbreviation(good.unloadPrivate?good.unloadPrivate:good.unloadCity)}}</view>
  58. <view class="level2-title">{{$helper.filterUrban(good.unloadCity)}}
  59. {{$helper.filterArea(good.unloadArea)}}
  60. </view>
  61. </view>
  62. </view>
  63. <view class="right gray">
  64. {{$helper.changeTime(good.updateDate)}}
  65. </view>
  66. <view class="flex flex-space-between yf-style">
  67. <view class="left">
  68. <view class="flex">
  69. <view class="gray mr20" v-if="good.cargoDistance">货距 {{good.cargoDistance}}km</view>
  70. <view class="gray " v-if="good.distance">运距 {{good.distance}}km</view>
  71. </view>
  72. <view class="u-flex-wrap flex gray row ">
  73. <view>{{good.goodsName}} | </view>
  74. <!-- <u-line direction="col"></u-line> -->
  75. <view v-if="carLength(good)"> {{carLength(good)}} | </view>
  76. <view v-if="carType(good)">{{carType(good)}} | </view>
  77. <view v-if="carWeight(good)">{{carWeight(good)}}</view>
  78. </view>
  79. <view class="flex row">
  80. <view class="row-tips" v-if="good.taskDescription">{{good.taskDescription}}</view>
  81. </view>
  82. </view>
  83. <view class="right flex h-color">
  84. <view class="fontsize-46">
  85. {{good.freightPrice}}
  86. </view>
  87. <view class="flex dw">元/吨</view>
  88. </view>
  89. </view>
  90. </view>
  91. <view class="flex flex-space-between item-bottom">
  92. <view class="left flex row" @click.stop="cargoOwner(good)">
  93. <u--image
  94. :src="good.cargoOwnerPortrait?good.cargoOwnerPortrait:'../../static/images/mine/tx.png'"
  95. width='100rpx' height='100rpx' shape="circle" >
  96. </u--image>
  97. <view class="name">{{good.cargoOwnerName}}</view>
  98. <!-- <view class="hp flex fontsize-24">
  99. <view class="gray">评分</view>
  100. <view class="number-color">99%</view>
  101. </view>
  102. <view class="sum flex fontsize-24">
  103. <view class="gray">发运次数</view>
  104. <view class="number-color">106</view>
  105. </view> -->
  106. </view>
  107. <view class="right">
  108. <view @click.stop="grabOrders(good)" class="qd" v-if='hasLogin'>抢单</view>
  109. </view>
  110. </view>
  111. </view>
  112. </view>
  113. </mescroll-body>
  114. <u-toast ref="uToast"></u-toast>
  115. <u-modal :show="isShowAlert" :title="alertTitle" :closeOnClickOverlay='true' :confirmText='confirmText'
  116. :showCancelButton='showCancelButton' confirmColor='#2772FB' @confirm="confirmClick" @close="cancelClick"
  117. @cancel="cancelClick"></u-modal>
  118. </view>
  119. </template>
  120. <script>
  121. var that
  122. import MescrollMixin from "@/uni_modules/mescroll-uni/components/mescroll-uni/mescroll-mixins.js";
  123. import {
  124. mapState
  125. } from 'vuex';
  126. import {
  127. apiGoods
  128. } from "@/api/mock.js"
  129. export default {
  130. mixins: [MescrollMixin], // 使用mixin
  131. data() {
  132. return {
  133. confirmText: '确定',
  134. showCancelButton: true,
  135. isFirstIndex: null,
  136. ObjSelect: {},
  137. isShowAlert: false,
  138. alertTitle: '确定抢单?',
  139. show: false,
  140. columns: [
  141. ['全部类型', '运费先付']
  142. ],
  143. startPlace: {},
  144. endPlace: {},
  145. otherGoods: [], // 数据列表
  146. goods: [], // 数据列表
  147. src: 'https://cdn.uviewui.com/uview/album/1.jpg',
  148. height: "", // 需要固定swiper的高度
  149. tabList: [
  150. // {
  151. // name: '全部'
  152. // },
  153. {
  154. name: '推荐'
  155. }, {
  156. name: '按时间'
  157. }, {
  158. name: '按距离'
  159. },
  160. // {
  161. // name: '运费先付'
  162. // },
  163. ],
  164. pickerSelect: '全部类型',
  165. tabIndex: 0,
  166. scrollTop: 0,
  167. count: 0,
  168. lng: '',
  169. lat: '',
  170. bool: false,
  171. }
  172. },
  173. onTabItemTap(e) {
  174. // tab 点击时执行,此处直接接收单击事件
  175. uni.pageScrollTo({
  176. scrollTop: 0,
  177. duration: 300
  178. });
  179. },
  180. created() {
  181. },
  182. computed: {
  183. ...mapState(['hasLogin', 'userInfo', 'firstAuthentication'])
  184. },
  185. watch:{
  186. // startPlace(){
  187. // console.log(this.startPlace)
  188. // this.upCallback({page});
  189. // },
  190. },
  191. onShow() {
  192. //获取上一次点击起装卸地
  193. if (uni.getStorageSync('fPlaceObj')) {
  194. this.startPlace = uni.getStorageSync('fPlaceObj');
  195. } else {
  196. // #ifdef APP-PLUS
  197. var that=this
  198. console.log('good',1111)
  199. // this.$nextTick(function(){
  200. this.getLngLat();
  201. // })
  202. // #endif
  203. }
  204. if (uni.getStorageSync('sPlaceObj')) {
  205. this.endPlace = uni.getStorageSync('sPlaceObj');
  206. } else {
  207. this.endPlace.selected = '全国'
  208. }
  209. this.upCallback({size:10,num:1})
  210. var that= this
  211. that.$request.baseRequest('get', '/newsInfo/unreadMessage', {
  212. reCommonId: this.userInfo.id,
  213. }).then(res3 => {
  214. if (res3.data||res3.data==0) {
  215. let name = 'myTip';
  216. let value = res3.data
  217. if (value == 0) {
  218. uni.removeTabBarBadge({
  219. index: 3
  220. })
  221. }
  222. that.$store.commit('$uStore', {
  223. name,
  224. value
  225. });
  226. if (value != 0 && value) {
  227. uni.setTabBarBadge({
  228. index: 3,
  229. text: value + ""
  230. })
  231. }
  232. }
  233. })
  234. // this.mescroll.resetUpScroll()
  235. },
  236. // async onLoad() {
  237. // that = this
  238. // // #ifdef APP-PLUS
  239. // let _status = await that.$request.baseRequest('get', '/driverInfo/firstAuthentication', {
  240. // driverPhone: this.userInfo.phone,
  241. // }).then(res => {
  242. // return res.data.authenticationStatus
  243. // })
  244. // // if (_status == '已禁用') {
  245. // // this.isShowAlert = true
  246. // // this.alertTitle = '账号审核中'
  247. // // this.confirmText = '退出APP'
  248. // // this.showCancelButton = false
  249. // // } else {
  250. // // console.log(1231233212332312312213)
  251. // // }
  252. // // #endif
  253. // },
  254. onPageScroll(res) {
  255. this.scrollTop = res.scrollTop
  256. // console.log("页面滚动了", res.scrollTop)
  257. if (this.scrollTop > 1200) {
  258. uni.setTabBarItem({
  259. index: 0,
  260. text: '返回顶部',
  261. iconPath: 'static/images/common/top@2x.png',
  262. selectedIconPath: 'static/images/common/top@2x.png'
  263. })
  264. } else {
  265. uni.setTabBarItem({
  266. index: 0,
  267. text: '货源',
  268. iconPath: 'static/images/common/huoyuan@2x(1).png',
  269. selectedIconPath: 'static/images/common/huoyuan@2x.png'
  270. })
  271. }
  272. },
  273. methods: {
  274. cargoOwner(_obj){
  275. // uni.$u.route('/pages/order/evaluateList');
  276. console.log("查看---------------",_obj)
  277. uni.$u.route('/pages/goodSource/cargoOwnerSee',_obj)
  278. },
  279. mescrollInit(mescroll) {
  280. this.mescroll = mescroll;
  281. },
  282. confirmClick() {
  283. let item = this.ObjSelect
  284. var that=this
  285. this.$request.baseRequest('get', '/driverInfo/firstAuthentication', {
  286. driverPhone: this.userInfo.phone,
  287. }).then(res2 => {
  288. let _obj = {
  289. driverCommonId: res2.data.commonId,
  290. commonId: item.commonId,
  291. cargoOwnerName: item.cargoOwnerName,
  292. cargoOwner: item.cargoOwner,
  293. sendPrivate: item.sendPrivate,
  294. sendCity: item.sendCity,
  295. sendArea: item.sendArea,
  296. sendDetailedAddress: item.sendDetailedAddress,
  297. unloadPrivate: item.unloadPrivate,
  298. unloadCity: item.unloadCity,
  299. unloadArea: item.unloadArea,
  300. unloadDetailedAddress: item.unloadDetailedAddress,
  301. goodsName: item.goodsName,
  302. distance: item.distance,
  303. freightPrice: item.freightPrice,
  304. driverName: res2.data.driverName,
  305. driverPhone: res2.data.driverPhone,
  306. cargoOwnerPhone: item.cargoOwnerPhone,
  307. id:item.id,
  308. billingMethod:item.billingMethod,
  309. freightAdvance:item.freightAdvance,
  310. goodsType:item.goodsType,
  311. goodsTypeKey:item.goodsTypeKey
  312. }
  313. that.$request.baseRequest('post', '/publishTaskInfo/api/addOrder', _obj).then(res => {
  314. if (res.code == 200) {
  315. that.$refs.uToast.show({
  316. type: 'success',
  317. message: "抢单成功!",
  318. complete() {
  319. uni.switchTab({
  320. url: "/pages/order/index"
  321. })
  322. }
  323. })
  324. } else {
  325. that.$refs.uToast.show({
  326. type: 'error',
  327. message: res.message,
  328. })
  329. }
  330. })
  331. .catch(res => {
  332. uni.$u.toast(res.message);
  333. });
  334. });
  335. this.isShowAlert = false
  336. },
  337. cancelClick() {
  338. this.isShowAlert = false
  339. },
  340. carLength(good) {
  341. let length = ''
  342. if (good.carLengthSmall && good.carLength) {
  343. length = good.carLengthSmall + '~' + good.carLength + '米'
  344. } else if (good.carLengthSmall && !good.carLength) {
  345. length = "大于" + good.carLengthSmall + '米'
  346. } else if (good.carLength && !good.carLengthSmall) {
  347. length = "小于" + good.carLength + '米'
  348. }
  349. return length
  350. },
  351. carType(good) {
  352. let _val = '';
  353. if (good.carModel == 1) {
  354. _val = ''
  355. } else {
  356. if (good.carModel.includes(2)) {
  357. _val += '高栏 '
  358. }
  359. if (good.carModel.includes(3)) {
  360. _val += '集装箱 '
  361. }
  362. if (good.carModel.includes(4)) {
  363. _val += '自卸车 '
  364. }
  365. }
  366. return _val
  367. },
  368. carWeight(good) {
  369. good.loadWeightSmall
  370. good.loadWeight
  371. let weight = ''
  372. if (good.loadWeightSmall && good.loadWeight) {
  373. weight = good.loadWeightSmall + '~' + good.loadWeight + '吨'
  374. } else if (good.loadWeightSmall) {
  375. weight = "大于" + good.loadWeightSmall + '吨'
  376. } else if (good.loadWeight) {
  377. weight = "小于" + good.loadWeight + '吨'
  378. }
  379. return weight
  380. },
  381. getdate() {
  382. var date = new Date()
  383. var year = date.getFullYear() //获取完整的年份(4位)
  384. var mouth = date.getMonth() + 1 //获取当前月份(0-11,0代表1月)
  385. var datetime = date.getDate() //获取当前日(1-31)
  386. if (mouth < 10) {
  387. mouth = '0' + mouth
  388. }
  389. if (datetime < 10) {
  390. datetime = '0' + datetime
  391. }
  392. return String(year) + String(mouth) + String(datetime)
  393. },
  394. grabOrders(item) {
  395. this.isShowAlert = true
  396. this.ObjSelect = item
  397. },
  398. confirmSelectType(val) {
  399. this.pickerSelect = val.value[0]
  400. this.show = false
  401. this.upCallback({size:10,num:1})
  402. },
  403. selectTypeClose() {
  404. this.show = false
  405. },
  406. selectType() {
  407. this.show = true
  408. },
  409. getLngLat() {
  410. var that=this
  411. // uni.showLoading({
  412. // title: '获取定位信息'
  413. // })
  414. uni.getLocation({
  415. type: 'gcj02',
  416. geocode: true,
  417. success: res => {
  418. if (res.latitude) {
  419. console.log(res)
  420. if(res.address.city){
  421. if(res.address.city.indexOf('市')!=-1){
  422. res.address.city=res.address.city.substring(0,res.address.city.length-1)
  423. }
  424. }
  425. if(res.address.province){
  426. if(res.address.province.indexOf('省')!=-1){
  427. res.address.province=res.address.province.substring(0,res.address.province.length-1)
  428. }
  429. }
  430. uni.setStorageSync('fPlaceObj',{
  431. fchoosearea:'全部',
  432. fchoosecity:res.address.city,
  433. fchooseprovince:res.address.province,
  434. selected:res.address.city
  435. })
  436. uni.setStorageSync('sPlaceObj',{
  437. schoosearea:'请选择区',
  438. schoosecity:'请选择市',
  439. schooseprovince:'全国',
  440. selected:'全国'
  441. })
  442. let _pickerSelect;
  443. if (that.pickerSelect == '运费先付') {
  444. _pickerSelect = 1
  445. } else {
  446. _pickerSelect = 0
  447. }
  448. that.startPlace.selected=res.address.city
  449. that.startPlace.fchoosecity=res.address.city
  450. let _data = {
  451. searchKeyWord: this.tabIndex + 1,
  452. searchType: _pickerSelect,
  453. pageSize: 10,
  454. currentPage: 1,
  455. loadingPlaceCity: that.startPlace.fchoosecity,
  456. // unLoadingPlaceCity: this.endPlace.schoosecity
  457. }
  458. that.$forceUpdate()
  459. // that.$set(that.startPlace,'selected',res.address.city)
  460. that.lng = res.longitude;
  461. that.lat = res.latitude;
  462. that.$request.baseRequest('get', '/publishTaskInfo/selectGoodsSource', _data).then(res => {
  463. if (res.code == 200) {
  464. console.log(res.data.records)
  465. uni.hideLoading()
  466. that.mescroll.endBySize(res.data.records.length, res.data.total);
  467. if(res.data.records){
  468. that.goods = res.data.records
  469. for (let i = 0; i < that.goods.length; i++) {
  470. if (that.goods[i].peripheralInfo == 1) {
  471. that.isFirstIndex = i
  472. return
  473. }
  474. }
  475. }else{
  476. that.goods=[]
  477. }
  478. }
  479. uni.hideLoading()
  480. })
  481. .catch(res => {
  482. uni.$u.toast(res.message);
  483. that.mescroll.endErr();
  484. });
  485. } else {
  486. if (uni.getSystemInfoSync().platform == 'android') {
  487. var context = plus.android.importClass("android.content.Context");
  488. var locationManager = plus.android.importClass(
  489. "android.location.LocationManager");
  490. var main = plus.android.runtimeMainActivity();
  491. var mainSvr = main.getSystemService(context.LOCATION_SERVICE);
  492. that.bool = mainSvr.isProviderEnabled(locationManager.GPS_PROVIDER)
  493. }
  494. if (that.bool === false) {
  495. uni.showModal({
  496. title: '提示',
  497. content: '请打开定位服务',
  498. success: ({
  499. confirm,
  500. cancel
  501. }) => {
  502. if (confirm) {
  503. if (uni.getSystemInfoSync().platform == 'android') {
  504. var Intent = plus.android.importClass(
  505. 'android.content.Intent');
  506. var Settings = plus.android.importClass(
  507. 'android.provider.Settings');
  508. var intent = new Intent(Settings
  509. .ACTION_LOCATION_SOURCE_SETTINGS);
  510. var main = plus.android.runtimeMainActivity();
  511. main.startActivity(intent); // 打开系统设置GPS服务页面
  512. }
  513. }
  514. }
  515. });
  516. }
  517. uni.hideLoading()
  518. }
  519. }
  520. });
  521. },
  522. toDetail(id) {
  523. var that=this
  524. that.$request.baseRequest('get', '/driverInfo/firstAuthentication', {
  525. driverPhone: this.userInfo.phone,
  526. }).then(res2 => {
  527. // console.log('跳转',1111111)
  528. uni.setStorageSync('firstAuthentication', res2.data)
  529. that.firstAuthentication=uni.getStorageSync('firstAuthentication')
  530. // console.log(that.firstAuthentication)
  531. //司机是否认证身份
  532. if (that.firstAuthentication.authenticationStatus == '已认证') {
  533. uni.$u.route('/pages/goodSource/shippingDetails', {
  534. id: id,
  535. });
  536. } else if (that.firstAuthentication.authenticationStatus == '已过期') {
  537. that.$refs.uToast.show({
  538. type: 'error',
  539. message: "证件已过期,请上传新证件!",
  540. })
  541. } else {
  542. that.$refs.uToast.show({
  543. type: 'error',
  544. message: "请先完成司机认证!",
  545. })
  546. }
  547. })
  548. },
  549. /*上拉加载的回调: 其中page.num:当前页 从1开始, page.size:每页数据条数,默认10 */
  550. upCallback(page) {
  551. var that =this
  552. let _pickerSelect;
  553. if (this.pickerSelect == '运费先付') {
  554. _pickerSelect = 1
  555. } else {
  556. _pickerSelect = 0
  557. }
  558. //选择省市区
  559. let _data = {
  560. searchKeyWord: this.tabIndex + 1,
  561. searchType: _pickerSelect,
  562. // loadingPlace: this.startPlace.selected,
  563. // unLoadingPlace: this.endPlace.selected=="全国"?'':this.endPlace.selected,
  564. pageSize: page.size,
  565. currentPage: page.num,
  566. // loadingPlaceCity: this.startPlace.fchoosecity,
  567. // unLoadingPlaceCity: this.endPlace.schoosecity
  568. }
  569. // if (this.tabIndex == 2) {
  570. if(!this.startPlace.selected){
  571. console.log(1)
  572. this.getLngLat();
  573. }else{
  574. _data.driverLongitude = this.lng
  575. _data.driverLatitude = this.lat
  576. // }
  577. console.log('------')
  578. console.log(_data)
  579. if (uni.getStorageSync('fPlaceObj')) {
  580. if (this.startPlace.fchoosearea && this.startPlace.fchoosearea == '全部' && this.startPlace
  581. .fchoosearea != '请选择区') {
  582. // _data.loadingPlaceCity = this.startPlace.fchoosecity
  583. if(this.startPlace.fchoosecity=='市辖区'){
  584. _data.loadingPlaceCity = this.startPlace.fchooseprovince
  585. }else{
  586. _data.loadingPlaceCity = this.startPlace.fchoosecity
  587. }
  588. } else if (this.startPlace.fchoosecity == '全部') {
  589. _data.loadingPlace = this.startPlace.selected
  590. } else {
  591. _data.loadingPlaceCity = this.startPlace.fchoosecity
  592. _data.loadingPlace = this.startPlace.fchoosearea
  593. }
  594. } else {
  595. _data.loadingPlaceCity = this.startPlace.fchoosecity
  596. }
  597. if (uni.getStorageSync('sPlaceObj')) {
  598. if (this.endPlace.schoosearea && this.endPlace.schoosearea == '全部' && this.endPlace.schoosearea !=
  599. '请选择区') {
  600. if(this.endPlace.schoosecity=='市辖区'){
  601. _data.unLoadingPlaceCity = this.endPlace.schooseprovince
  602. }else{
  603. _data.unLoadingPlaceCity = this.endPlace.schoosecity
  604. }
  605. } else if (this.endPlace.schoosearea) {
  606. _data.unLoadingPlace = this.endPlace.selected == "全国" ? '' : this.endPlace.selected
  607. } else {
  608. _data.unLoadingPlace = this.endPlace.selected == "全国" ? '' : this.endPlace.selected
  609. _data.unLoadingPlaceCity = this.endPlace.schoosecity
  610. }
  611. } else {
  612. _data.unLoadingPlace = this.endPlace.selected == "全国" ? '' : this.endPlace.selected
  613. }
  614. if (this.lng) {
  615. _data.longitude = this.lng
  616. _data.latitude = this.lat
  617. }
  618. uni.showLoading({
  619. mask: true,
  620. title: '加载中'
  621. })
  622. console.log(_data)
  623. this.$request.baseRequest('get', '/publishTaskInfo/selectGoodsSource', _data).then(res => {
  624. if (res.code == 200) {
  625. uni.hideLoading()
  626. if (page.num == 1) {
  627. this.goods = [];
  628. // this.otherGoods = []
  629. };
  630. console.log(res.data.records,1111111)
  631. if(res.data.records){
  632. for(var i=0;i<res.data.records.length;i++){
  633. if(res.data.records[i].cargoDistance){
  634. if(res.data.records[i].cargoDistance>10){
  635. res.data.records[i].cargoDistance=res.data.records[i].cargoDistance.toFixed(0)
  636. }else{
  637. res.data.records[i].cargoDistance=res.data.records[i].cargoDistance.toFixed(1)
  638. }
  639. }
  640. if(res.data.records[i].distance){
  641. if(res.data.records[i].distance>10){
  642. res.data.records[i].distance=res.data.records[i].distance.toFixed(0)
  643. }else{
  644. res.data.records[i].distance=res.data.records[i].distance.toFixed(1)
  645. }
  646. }
  647. }
  648. }
  649. this.mescroll.endBySize(res.data.records.length, res.data.total);
  650. // for (var i = 0; i < res.data.records.length; i++) {
  651. // res.data.records[i].cargoOwnerName1=
  652. // }
  653. //如果是第一页需手动制空列表
  654. if(res.data.records){
  655. that.goods = that.goods.concat(res.data.records);
  656. for (let i = 0; i < that.goods.length; i++) {
  657. if (that.goods[i].peripheralInfo == 1) {
  658. that.isFirstIndex = i
  659. return
  660. }
  661. }
  662. }else{
  663. that.goods=[]
  664. }
  665. }
  666. })
  667. .catch(res => {
  668. uni.$u.toast(res.message);
  669. this.mescroll.endErr();
  670. });
  671. }
  672. },
  673. clickTab(val) {
  674. this.tabIndex = val.index
  675. this.upCallback({
  676. size: 10,
  677. num: 1,
  678. })
  679. },
  680. changeCity() {
  681. if (this.endPlace.selected == '全国') {
  682. this.$refs.uToast.show({
  683. type: 'error',
  684. message: "装车地不能为全国!",
  685. })
  686. return
  687. }
  688. [this.startPlace.fchooseprovince, this.endPlace.schooseprovince] = [this.endPlace.schooseprovince, this
  689. .startPlace.fchooseprovince
  690. ];
  691. [this.startPlace.fchoosecity, this.endPlace.schoosecity] = [this.endPlace.schoosecity, this.startPlace
  692. .fchoosecity
  693. ];
  694. [this.startPlace.fchoosearea, this.endPlace.schoosearea] = [this.endPlace.schoosearea, this.startPlace
  695. .fchoosearea
  696. ];
  697. [this.startPlace.selected, this.endPlace.selected] = [this.endPlace.selected, this.startPlace.selected];
  698. // [this.startPlace, this.endPlace] = [this.endPlace, this.startPlace];
  699. uni.setStorageSync('fPlaceObj', this.startPlace);
  700. uni.setStorageSync('sPlaceObj', this.endPlace);
  701. },
  702. goCity(type) {
  703. uni.$u.route('/pages/goodSource/selectCity', {
  704. startPlace: JSON.stringify(this.startPlace),
  705. endPlace: JSON.stringify(this.endPlace),
  706. type: type
  707. });
  708. },
  709. swiperChange(e) {
  710. this.tabIndex = e.detail.current
  711. }
  712. }
  713. }
  714. </script>
  715. <style scoped lang="scss">
  716. .content {
  717. background: #F2F4F7;
  718. }
  719. .banner {
  720. width: 100%;
  721. position: relative;
  722. }
  723. .u-flex-wrap{
  724. flex-wrap: wrap;
  725. }
  726. .fixed,
  727. .fixed1 {
  728. background: linear-gradient(97deg, #4FABFD 0%, #2772FB 100%);
  729. position: fixed;
  730. top: var(--status-bar-height);
  731. z-index: 999;
  732. // width: calc(100% - 40rpx);
  733. width: 100%;
  734. // margin:0 20rpx;
  735. }
  736. .fixed1 {
  737. top: 0;
  738. height: var(--status-bar-height);
  739. background: linear-gradient(97deg, #4FABFD 0%, #2772FB 100%);
  740. }
  741. .banner-img {
  742. width: 100%;
  743. }
  744. .head {
  745. position: absolute;
  746. width: calc(100% - 108rpx);
  747. bottom: 0;
  748. background: white;
  749. margin: 0 20rpx;
  750. border-radius: 20rpx;
  751. .item1,
  752. .item3 {
  753. width: 40%;
  754. .text {
  755. text-overflow: ellipsis;
  756. overflow: hidden;
  757. white-space: nowrap;
  758. }
  759. }
  760. .item1 .text {
  761. text-align: left;
  762. }
  763. .item3 .text {
  764. text-align: right;
  765. }
  766. }
  767. .change-btn {
  768. width: 86rpx;
  769. height: 86rpx;
  770. }
  771. .good-list {
  772. background-color: white;
  773. margin: 10px 10px 15px 10px;
  774. padding: 10px 0px 0px 0;
  775. border-radius: 30rpx;
  776. box-shadow: 0px 5rpx 20rpx #E3E3E3;
  777. .item1,
  778. .item3 {
  779. // width: 40%;
  780. display: flex;
  781. .text {
  782. text-overflow: ellipsis;
  783. overflow: hidden;
  784. white-space: nowrap;
  785. }
  786. }
  787. .item1 .text {
  788. text-align: left;
  789. }
  790. .item3 .text {
  791. text-align: right;
  792. }
  793. }
  794. .jt-icon {
  795. position: relative;
  796. top: 6rpx;
  797. width: 60rpx;
  798. margin: 0 20rpx;
  799. }
  800. .row {
  801. margin: 10rpx 0;
  802. align-items: center;
  803. }
  804. .item-bottom {
  805. background: #F0F5FF;
  806. padding: 0 30rpx;
  807. border-radius: 0 0 30rpx 30rpx;
  808. .name {
  809. font-size: 26rpx;
  810. font-weight: 700;
  811. color: #000000;
  812. margin-left: 30rpx;
  813. }
  814. .hp {
  815. margin: 30rpx;
  816. }
  817. .number-color {
  818. margin: 0 10rpx;
  819. }
  820. .qd {
  821. background: linear-gradient(97deg, #4FABFD 0%, #2772FB 100%);
  822. border-radius: 13px;
  823. font-size: 29rpx;
  824. font-weight: 400;
  825. color: #FFFFFF;
  826. padding: 10rpx 35rpx;
  827. }
  828. }
  829. .dw {
  830. align-items: center;
  831. }
  832. .place {
  833. height: var(--status-bar-height);
  834. }
  835. .tab-view {
  836. display: flex;
  837. align-items: center;
  838. justify-content: space-between;
  839. }
  840. .tab-right {
  841. display: flex;
  842. margin-right: 20rpx;
  843. align-items: center;
  844. }
  845. .other-goods {
  846. // background: red;
  847. color:#999999;
  848. margin: 40rpx 0;
  849. display: flex;
  850. justify-content: center;
  851. font-size: 36rpx;
  852. }
  853. .level2-title {
  854. font-size: 28rpx;
  855. }
  856. .yf-style {
  857. position: relative;
  858. .h-color {
  859. position: absolute;
  860. right: 0;
  861. top: -30rpx;
  862. }
  863. }
  864. .xf-iamge {
  865. width: 74rpx;
  866. height: 43rpx;
  867. position: absolute;
  868. top: -20rpx;
  869. right: 0;
  870. }
  871. </style>