shippingDetails.vue 14 KB

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