shippingDetails.vue 11 KB

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