shippingDetails.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567
  1. <!-- 发运详情 -->
  2. <template>
  3. <view class="content">
  4. <!-- <u-navbar title="发运详情" :bgColor="bgColor" @leftClick='back' :placeholder='true' leftIconColor="#fff" titleStyle='color:#fff'
  5. :rightText='caseText' @rightClick="rightClick">
  6. </u-navbar> -->
  7. <!-- <u-navbar leftText="发运详情" height="50" :bgColor="bgColor" @leftClick='back' :placeholder='true'
  8. leftIconColor="#fff" :titleStyle='titleStyle' leftIconSize='38rpx' rightIcon>
  9. </u-navbar> -->
  10. <u-navbar :placeholder='true' :bgColor="bgColor" @leftClick='back'>
  11. <view class="u-nav-slot nav-left" slot="left">
  12. <u-icon name="arrow-left" size="19" color="#fff"></u-icon>
  13. <text style="margin-left:20rpx;">发运详情</text>
  14. <!-- <u-line direction="column" :hairline="false" length="16" margin="0 8px"></u-line>
  15. <u-icon name="home" size="20"></u-icon> -->
  16. </view>
  17. <view class="u-nav-slot nav-right" slot="right">
  18. <!-- <text class="case-style" @click="rightClick">已关注</text>
  19. <image src="../../static/fenxiang.png" mode="widthFix" style="width: 40rpx;" @click="share"></image> -->
  20. </view>
  21. </u-navbar>
  22. <view class="top-bgc"></view>
  23. <view class="content-move">
  24. <view class="content1">
  25. <view class="row1 flex flex-space-between">
  26. <view class="left flex">
  27. <u--image
  28. :src="detailData.cargoOwnerPortrait?detailData.cargoOwnerPortrait:'../../static/images/mine/tx.png'"
  29. width='122rpx' height='122rpx' shape="circle">
  30. </u--image>
  31. <view class="fontsize-46 ml20">{{detailData.cargoOwnerCall}}</view>
  32. </view>
  33. <view class="right">
  34. <view class="flex">
  35. <view class="call fontsize-28"
  36. @click="$helper.contactCustomerService(detailData.cargoOwnerPhone)">
  37. <image style='width:12px;height:12px;margin-right:4px;'
  38. src="../../static/images/goodSource/dianhua.png" mode=""></image>联系货主
  39. </view>
  40. </view>
  41. </view>
  42. </view>
  43. <view class="row hztype-style">
  44. {{detailData.cargoOwner}}
  45. </view>
  46. <!-- 当前版本不做 -->
  47. <view class="row3 flex fontsize-24">
  48. <!-- <view class="item flex">
  49. <view class="gray">好评率</view>
  50. <view class="number-color">99%</view>
  51. </view> -->
  52. <!-- <view class="item flex">
  53. <view class="gray">发运次数</view>
  54. <view class="number-color">106</view>
  55. </view> -->
  56. <!-- <view class="item flex">
  57. <view class="gray">评价</view>
  58. <view class="number-color">10</view>
  59. </view> -->
  60. </view>
  61. <view class="row4">
  62. <view class="flex fontsize-26">
  63. <view class="left">装</view>
  64. <view class="right flex align-center">
  65. {{detailData.sendPrivate}}{{detailData.sendCity}}{{detailData.sendArea}}{{detailData.sendDetailedAddress}}
  66. </view>
  67. </view>
  68. <u-line class="line" margin="20rpx 0"></u-line>
  69. <view class="flex fontsize-26">
  70. <view class="left-x">卸</view>
  71. <view class=" right align-center">
  72. {{detailData.unloadPrivate}}{{detailData.unloadCity}}{{detailData.unloadArea}}{{detailData.unloadDetailedAddress}}
  73. </view>
  74. </view>
  75. </view>
  76. </view>
  77. <view class="content2">
  78. <view class="flex align-center">
  79. <view class="left">货物</view>
  80. <view class="right flex">
  81. <view>{{detailData.goodsName}}</view>
  82. <view style='margin: 0 10rpx;'>|</view>
  83. <view v-if='detailData.weight'>{{detailData.weight}}吨</view>
  84. <view v-else>无</view>
  85. </view>
  86. </view>
  87. <view class="flex align-center msx20">
  88. <view class="left">距离</view>
  89. <view class="right flex align-center">
  90. <view>运输距离约{{detailData.distance}}公里</view>
  91. <image @click="toMap()" style='width:14px;height:14px;margin-left:4px;'
  92. src="../../static/images/goodSource/dituzuobiao.png" mode=""></image>
  93. </view>
  94. </view>
  95. <view class="flex align-center">
  96. <view class="left">运费</view>
  97. <view class="right">{{detailData.freightPrice}}元/吨</view>
  98. </view>
  99. <view class="flex msx20">
  100. <view class="left">日期</view>
  101. <view class="right">
  102. <view class="in-row flex">
  103. <text style="margin-right: 40rpx;">发布</text>
  104. <view class="time">{{detailData.createDate}}</view>
  105. </view>
  106. </view>
  107. </view>
  108. <view class="flex msx20">
  109. <view class="left"></view>
  110. <view class="right">
  111. <view class="in-row flex">
  112. <text style="margin-right: 40rpx;">装车</text>
  113. <view class="time"
  114. v-if='detailData.loadingDateStart=="随时"&&detailData.loadingDateEnd=="随时"'>
  115. {{detailData.loadingDateStart}}
  116. </view>
  117. <view class="time" v-else>{{detailData.loadingDateStart}}~{{detailData.loadingDateEnd}}
  118. </view>
  119. </view>
  120. </view>
  121. </view>
  122. <view class="flex align-center">
  123. <view class="left">车型</view>
  124. <!-- carModel -->
  125. <view class="right">
  126. <text v-if="detailData.carModel.indexOf('1') != -1">不限</text>
  127. <text v-show="detailData.carModel.indexOf('2') != -1">高栏 | </text>
  128. <text v-show="detailData.carModel.indexOf('3') != -1">集装箱 | </text>
  129. <text v-show="detailData.carModel.indexOf('4') != -1">自卸车</text>
  130. </view>
  131. <!-- <view class="right" v-else>不限</view> -->
  132. </view>
  133. <view class="flex mt20">
  134. <view class="left">描述</view>
  135. <view class="right">
  136. {{detailData.taskDescription?detailData.taskDescription:'无'}}
  137. </view>
  138. </view>
  139. </view>
  140. <view class="content3">
  141. <view class="left">运费<view class="text">{{detailData.freightPrice}}元/吨</view>
  142. </view>
  143. <view class="right">
  144. <view class="btn" @click.stop="grabOrders()">立即抢单</view>
  145. </view>
  146. <!-- <view class="right">
  147. <u-button type="error" text="已抢单" disabled></u-button>
  148. </view> -->
  149. </view>
  150. <u-toast ref="uToast"></u-toast>
  151. <u-modal :show="isShowAlert" :title="alertTitle" :closeOnClickOverlay='true' :showCancelButton='true'
  152. confirmColor='#2772FB' @confirm="$u.throttle(confirmClick(), 1000)" @close="cancelClick"
  153. @cancel="cancelClick"></u-modal>
  154. </view>
  155. </view>
  156. </template>
  157. <script>
  158. import {
  159. mapState
  160. } from 'vuex';
  161. export default {
  162. data() {
  163. return {
  164. titleStyle: {
  165. "fontSize": "38rpx",
  166. "fontWeight": 500,
  167. "color": "#FFFFFF"
  168. },
  169. isShowAlert: false,
  170. alertTitle: '确定抢单?',
  171. caseText: '关注',
  172. bgColor: '#317AFE',
  173. src: 'https://cdn.uviewui.com/uview/album/1.jpg',
  174. id: '',
  175. detailData: {},
  176. };
  177. },
  178. onLoad(options) {
  179. console.log(options)
  180. this.id = options.id
  181. this.init()
  182. },
  183. computed: {
  184. ...mapState(['hasLogin', 'userInfo', 'firstAuthentication']),
  185. carLength() {
  186. let length = ''
  187. if (this.detailData.carLengthSmall && this.detailData.carLength) {
  188. length = this.detailData.carLengthSmall + '~' + this.detailData.carLength + '米'
  189. } else if (this.detailData.carLengthSmall) {
  190. length = "大于" + this.detailData.carLengthSmall + '米'
  191. } else if (this.detailData.carLength) {
  192. length = "小于" + this.detailData.carLength + '米'
  193. }
  194. console.log(length)
  195. return length
  196. },
  197. carType() {
  198. let _val = '';
  199. if (!this.detailData.carModel) this.detailData.carModel = ''
  200. if (this.detailData.carModel == 1) {
  201. _val = '不限'
  202. } else {
  203. if (this.detailData.carModel.includes(2)) {
  204. _val += '高栏/'
  205. }
  206. if (this.detailData.carModel.includes(3)) {
  207. _val += '集装箱/'
  208. }
  209. if (this.detailData.carModel.includes(4)) {
  210. _val += '自卸车'
  211. }
  212. }
  213. console.log(_val)
  214. return _val
  215. },
  216. carWeight() {
  217. this.detailData.loadWeightSmall
  218. this.detailData.loadWeight
  219. let weight = ''
  220. if (this.detailData.loadWeightSmall && this.detailData.loadWeight) {
  221. weight = this.detailData.loadWeightSmall + '~' + this.detailData.loadWeight + '吨'
  222. } else if (this.detailData.loadWeightSmall) {
  223. weight = "大于" + this.detailData.loadWeightSmall + '吨'
  224. } else if (this.detailData.loadWeight) {
  225. weight = "小于" + this.detailData.loadWeight + '吨'
  226. }
  227. console.log(weight)
  228. return weight
  229. },
  230. },
  231. methods: {
  232. share() {
  233. console.log('share')
  234. },
  235. rightClick() {
  236. uni.$u.toast('后台接口未写');
  237. // 关注
  238. // console.log(123)
  239. // this.$request.baseRequest('get', '/publishTaskInfo/seeTask', {
  240. // reCommonId: this.userInfo.id,
  241. // }).then(res => {
  242. // this.mescroll.resetUpScroll()
  243. // })
  244. // .catch(res => {
  245. // uni.$u.toast(res.message);
  246. // });
  247. },
  248. async init() {
  249. await this.$request.baseRequest('get', '/publishTaskInfo/seeTask', {
  250. id: this.id,
  251. // id: '8f1f3c624d7946d79a9d44a4057d9623',
  252. }).then(res => {
  253. if (res.code == 200) {
  254. this.detailData = res.data
  255. }
  256. })
  257. .catch(res => {
  258. uni.$u.toast(res.message);
  259. });
  260. },
  261. toMap() {
  262. uni.setStorageSync('sendaddress', {
  263. sendLatitude: this.detailData.sendLatitude,
  264. sendLongitude: this.detailData.sendLongitude,
  265. })
  266. uni.setStorageSync('unsendaddress', {
  267. unsendLatitude: this.detailData.unsendLatitude,
  268. unsendLongitude: this.detailData.unsendLongitude,
  269. })
  270. uni.setStorageSync('distance', this.detailData.distance, )
  271. uni.$u.route('/pages/goodSource/map', {
  272. id: 1,
  273. });
  274. },
  275. back() {
  276. uni.navigateBack({
  277. })
  278. },
  279. call() {
  280. uni.makePhoneCall({
  281. phoneNumber: '114' //仅为示例
  282. });
  283. },
  284. grabOrders() {
  285. this.isShowAlert = true
  286. },
  287. confirmClick() {
  288. let item = this.detailData
  289. console.log(item)
  290. var that = this
  291. this.$request.baseRequest('get', '/driverInfo/firstAuthentication', {
  292. driverPhone: this.userInfo.phone,
  293. }).then(res2 => {
  294. if (res2.data.authenticationStatus == '已过期') {
  295. that.$refs.uToast.show({
  296. type: 'error',
  297. message: '证件已过期,请上传新证件!',
  298. })
  299. return
  300. } else if (res2.data.authenticationStatus == '未认证' || res2.data.authenticationStatus ==
  301. '已驳回') {
  302. that.$refs.uToast.show({
  303. type: 'error',
  304. message: '请先完成司机认证!',
  305. })
  306. return
  307. } else if (res2.data.authenticationStatus == '审核中') {
  308. that.$refs.uToast.show({
  309. type: 'error',
  310. message: '司机审核中!',
  311. })
  312. return
  313. }
  314. let _obj = {
  315. driverCommonId: res2.data.commonId,
  316. commonId: item.commonId,
  317. id: item.id,
  318. compId: item.compId,
  319. cargoOwnerName: item.cargoOwnerName,
  320. cargoOwner: item.cargoOwner,
  321. sendPrivate: item.sendPrivate,
  322. sendCity: item.sendCity,
  323. sendArea: item.sendArea,
  324. sendDetailedAddress: item.sendDetailedAddress,
  325. unloadPrivate: item.unloadPrivate,
  326. unloadCity: item.unloadCity,
  327. unloadArea: item.unloadArea,
  328. unloadDetailedAddress: item.unloadDetailedAddress,
  329. goodsName: item.goodsName,
  330. goodsType:item.goodsType,
  331. distance: item.distance,
  332. freightPrice: item.freightPrice,
  333. driverName: res2.data.driverName,
  334. driverPhone: res2.data.driverPhone,
  335. cargoOwnerPhone: item.cargoOwnerPhone
  336. }
  337. that.$request.baseRequest('post', '/publishTaskInfo/api/addOrder', _obj).then(res => {
  338. if (res.code == 200) {
  339. that.$refs.uToast.show({
  340. type: 'success',
  341. message: "抢单成功!",
  342. complete() {
  343. uni.switchTab({
  344. url: "/pages/order/index"
  345. })
  346. }
  347. })
  348. } else {
  349. that.$refs.uToast.show({
  350. type: 'error',
  351. message: res.message,
  352. })
  353. }
  354. })
  355. .catch(res => {
  356. uni.$u.toast(res.message);
  357. });
  358. }).catch(res => {
  359. uni.$u.toast(res.message);
  360. });
  361. this.isShowAlert = false
  362. },
  363. cancelClick() {
  364. this.isShowAlert = false
  365. },
  366. }
  367. }
  368. </script>
  369. <style lang="scss">
  370. /deep/.u-navbar__content__right__text {
  371. background: rgba(255, 255, 255, 0.2);
  372. padding: 3px 10px;
  373. border-radius: 16px;
  374. font-size: 26rpx;
  375. color: #FFFFFF;
  376. }
  377. .top-bgc {
  378. padding-top: 30rpx;
  379. position: relative;
  380. width: 100%;
  381. height: 519rpx;
  382. background: linear-gradient(180deg, #317AFE 0%, #F8F9FC 100%);
  383. }
  384. .content-move {
  385. position: relative;
  386. top: -460rpx;
  387. }
  388. .content1 {
  389. background: white;
  390. margin: 0 20rpx;
  391. border-radius: 20rpx;
  392. // padding: 0 46rpx;
  393. .hztype-style {
  394. width: 100%;
  395. font-size: 28rpx;
  396. color: #121212;
  397. padding: 0 0 20rpx 46rpx;
  398. font-weight: 700;
  399. border-bottom: 2px dotted #ccc
  400. }
  401. .row1 {
  402. padding: 0 46rpx;
  403. .left {
  404. position: relative;
  405. top: -50rpx;
  406. align-items: flex-end;
  407. }
  408. }
  409. .row3 {
  410. margin: 20rpx 0;
  411. .item {
  412. margin-right: 40rpx;
  413. }
  414. }
  415. .row4 {
  416. align-items: center;
  417. padding: 0 46rpx 46rpx 46rpx;
  418. margin-top: 20rpx;
  419. .left {
  420. display: flex;
  421. align-items: center;
  422. justify-content: center;
  423. width: 30rpx;
  424. height: 30rpx;
  425. background: #2772FB;
  426. padding: 20rpx;
  427. box-sizing: border-box;
  428. font-size: 26rpx;
  429. border-radius: 8rpx;
  430. color: #FFFFFF;
  431. }
  432. .left-x {
  433. display: flex;
  434. align-items: center;
  435. justify-content: center;
  436. width: 30rpx;
  437. height: 30rpx;
  438. background: #FE6300;
  439. padding: 20rpx;
  440. box-sizing: border-box;
  441. font-size: 26rpx;
  442. border-radius: 8rpx;
  443. color: #FFFFFF;
  444. }
  445. .right {
  446. color: #666666;
  447. margin-left: 20rpx;
  448. }
  449. }
  450. }
  451. .call {
  452. display: flex;
  453. align-items: center;
  454. background: #E5F0FE;
  455. padding: 10rpx 30rpx;
  456. border-radius: 30rpx;
  457. color: #2772FB;
  458. }
  459. .number-color {
  460. margin-left: 20rpx;
  461. }
  462. .content2 {
  463. background: white;
  464. border-radius: 20rpx;
  465. margin: 20rpx;
  466. padding: 30rpx;
  467. font-size: 26rpx;
  468. .left {
  469. color: #666666;
  470. margin-right: 20rpx;
  471. box-sizing: border-box;
  472. width: 8vw;
  473. }
  474. .right {
  475. width: 90%;
  476. }
  477. .in-row {
  478. .text {
  479. margin-right: 60rpx;
  480. }
  481. }
  482. }
  483. .content3 {
  484. position: fixed;
  485. bottom: 0;
  486. width: 100%;
  487. display: flex;
  488. background: white;
  489. justify-content: space-between;
  490. padding: 40rpx 20rpx;
  491. box-sizing: border-box;
  492. align-items: center;
  493. .left {
  494. display: flex;
  495. .text {
  496. color: #FE6300;
  497. margin-left: 20rpx;
  498. }
  499. }
  500. }
  501. .btn {
  502. background: #2772FB;
  503. color: white;
  504. font-size: 28rpx;
  505. border-radius: 40rpx;
  506. padding: 20rpx 40rpx;
  507. }
  508. .nav-left {
  509. display: flex;
  510. color: #fff;
  511. font-size: 38rpx;
  512. padding-top: 60rpx;
  513. box-sizing: border-box;
  514. }
  515. .nav-right {
  516. display: flex;
  517. align-items: center;
  518. padding-top: 60rpx;
  519. box-sizing: border-box;
  520. .case-style {
  521. margin-right: 20rpx;
  522. background: rgba(255, 255, 255, 0.2);
  523. border-radius: 32rpx;
  524. font-size: 24rpx;
  525. font-weight: 400;
  526. color: #FFFFFF;
  527. padding: 6rpx 28rpx;
  528. }
  529. }
  530. </style>