shippingDetails.vue 13 KB

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