confirmLoading.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493
  1. <!-- 确认装车 -->
  2. <template>
  3. <view class="content">
  4. <!-- <div class='content1'>
  5. <view class="level2-title">承运合同</view>
  6. <view class='row-between'>
  7. <view class="">合同编号</view>
  8. <view class="" @click="toSignContract">{{detailData.contractNo?detailData.contractNo:'去签订合同'}}</view>
  9. </view>
  10. </div> -->
  11. <view class="content2">
  12. <view class="level2-title">基本信息</view>
  13. <view class='row-between'>
  14. <view class="">订单编号</view>
  15. <view class="">{{detailData.orderNo}}</view>
  16. </view>
  17. <view class='row-between'>
  18. <view class="">司机</view>
  19. <view class="">{{detailData.driverName}}</view>
  20. </view>
  21. <view class='row-between'>
  22. <view class="">发货单位</view>
  23. <view class="">{{detailData.compName?detailData.compName:'个人货主'}}</view>
  24. </view>
  25. <view class='row-between'>
  26. <view class="">发货地</view>
  27. <view class=" place">
  28. {{detailData.sendPrivate}}{{detailData.sendCity}}{{detailData.sendArea}}{{detailData.sendDetailedAddress}}
  29. </view>
  30. </view>
  31. <view class='row-between'>
  32. <view class="">卸货地</view>
  33. <view class=" place">
  34. {{detailData.unloadPrivate}}{{detailData.unloadCity}}{{detailData.unloadArea}}{{detailData.unloadDetailedAddress}}
  35. </view>
  36. </view>
  37. <view class='row-between'>
  38. <view class="">货名</view>
  39. <view class="">{{detailData.goodsName}}</view>
  40. </view>
  41. <view class='row-between'>
  42. <view class="">距离</view>
  43. <view class="">{{detailData.distance?detailData.distance:'暂无'}}公里</view>
  44. </view>
  45. </view>
  46. <view class="content2">
  47. <view class="level2-title">承运信息</view>
  48. <view class='row-between'>
  49. <view class="">合同编号</view>
  50. <view class="date-style">
  51. {{detailData.contractNo?detailData.contractNo:'暂无'}}
  52. </view>
  53. </view>
  54. <view class='row-between'>
  55. <view class="">车牌号</view>
  56. {{detailData.carNo?detailData.carNo:"来自合同"}}
  57. </view>
  58. <view class='row-between'>
  59. <view class="">装车净重(吨)</view>
  60. {{detailData.weight ? detailData.weight:"来自合同"}}
  61. </view>
  62. <view class='row-between'>
  63. <view class="">预计运费(元)</view>
  64. {{detailData.freight ? detailData.freight:"来自合同"}}
  65. </view>
  66. <view class='row-between'>
  67. <view class="">装车日期</view>
  68. <view class="date-style">
  69. {{detailData.loadingDate?detailData.loadingDate:'来自合同'}}
  70. </view>
  71. </view>
  72. <!-- <view class='s-flex'>
  73. <view class="" style="margin:20rpx 0;">上传装车照片</view>
  74. <u-upload class="uview-upload" :fileList="fileList1" @afterRead="afterRead($event)" @delete="deletePic"
  75. name="1" multiple :maxCount="3"></u-upload>
  76. </view> -->
  77. </view>
  78. <view class="bottom-btn">
  79. <!-- <view class="store" @click="submit(1)">暂存</view> -->
  80. <view class="submit" @click="submit(3)">提交</view>
  81. </view>
  82. <u-modal :show="isShowAlert" :title="alertTitle" :content='alertContent' :closeOnClickOverlay='true'
  83. :showCancelButton='true' confirmColor='#2772FB' @confirm="confirmClick" @close="cancelClick"
  84. @cancel="cancelClick"></u-modal>
  85. <master-keyboard ref="keyboard" keyboardtype="car" :show="keyShow" :randomNumber="true" :newCar="false"
  86. :defaultValue="carNumber" @keyboardClick="handleClick"></master-keyboard>
  87. <u-toast ref="uToast"></u-toast>
  88. <u-calendar :show="showDate" :mode="mode" @confirm="confirmDate" @close="showDate= false"></u-calendar>
  89. </view>
  90. </template>
  91. <script>
  92. let that;
  93. import uploadImage from '@/components/ossutil/uploadFile.js';
  94. export default {
  95. data() {
  96. return {
  97. imgList: [],
  98. fileList1: [],
  99. showDate: false,
  100. mode: 'single',
  101. id: '',
  102. sourceType: ['camera'],
  103. detailData: {
  104. carrierInfo: {},
  105. loadingDate: {}
  106. },
  107. action: this.$helper.ossUploadUrl,
  108. maxSize: 50 * 1024 * 1024, //限制文件大小 50M
  109. isAdd: true,
  110. isShowAlert: false,
  111. alertContent: '',
  112. alertTitle: '',
  113. keyShow: false,
  114. carNumber: '',
  115. gjList: [],
  116. }
  117. },
  118. onLoad(options) {
  119. that = this
  120. // #ifdef APP-PLUS
  121. // this.getLngLat();
  122. // #endif
  123. console.log(options)
  124. this.id = JSON.parse(decodeURIComponent(options.obj)).id
  125. this.getInfo()
  126. // this.detailData = JSON.parse(options.obj) ;
  127. // console.log(this.detailData)
  128. // CYHT20220317000001
  129. },
  130. methods: {
  131. //确认装车提交成功后,开启实时定位,
  132. // 调接口5分钟一次发送轨迹,[
  133. // {latitude: 39.997761, longitude: 116.478935},
  134. // {latitude: 39.997825, longitude: 116.478939},
  135. // {latitude: 39.998549, longitude: 116.478912},
  136. // {latitude: 39.998555, longitude: 116.478998},
  137. // {latitude: 39.998566, longitude: 116.479282},
  138. // {latitude: 39.998528, longitude: 116.479658},
  139. // {latitude: 39.998453, longitude: 116.480151},
  140. // {latitude: 39.998302, longitude: 116.480784},
  141. // {latitude: 39.998184, longitude: 116.481149},
  142. // {latitude: 39.997997, longitude: 116.481573},
  143. // {latitude: 39.997846, longitude: 116.481863},
  144. // {latitude: 39.997718, longitude: 116.482072},
  145. // {latitude: 39.997718, longitude: 116.482362},
  146. // {latitude: 39.998935, longitude: 116.483633},
  147. // {latitude: 39.998968, longitude: 116.48367},
  148. // {latitude: 39.999861, longitude: 116.484648}
  149. // ]
  150. // a(){},
  151. toSignContract() {
  152. uni.$u.route('/pages/order/signContract', {
  153. obj: JSON.stringify(this.detailData),
  154. });
  155. },
  156. selectDate() {
  157. this.showDate = true
  158. },
  159. confirmDate(e) {
  160. this.detailData.carrierInfo.loadingDate = e[0]
  161. this.showDate = false
  162. },
  163. getInfo() {
  164. this.$request.baseRequest('get', '/orderInfo/getOrderInfo', {
  165. id: this.id,
  166. }).then(res => {
  167. if (res.code == 200) {
  168. this.detailData = res.data
  169. this.$request.baseRequest('get', '/carrierInfo/getHyCarrierInfo', {
  170. orderId: this.detailData.id,
  171. }).then(res => {
  172. if (res.data) {
  173. this.detailData.carNo = res.data.carNo
  174. this.detailData.loadingDate = res.data.loadingDate
  175. this.detailData.weight = res.data.loadingWeight
  176. this.detailData.freight = res.data.estimatedFreight
  177. }
  178. })
  179. // this.detailData.contractNo = ''
  180. // this.detailData.id = this.detailData.carrierId
  181. // this.detailData.carrierInfo.loadingDate = ''
  182. // this.detailData.carrierInfo.carNo = ''
  183. // this.detailData.carrierInfo.loadingAreaLongitude = ''
  184. // this.detailData.carrierInfo.loadingAreaLatitude = ''
  185. // this.detailData.carrierInfo.sendCity = '营口'
  186. // this.detailData.carrierInfo.sendArea = '鲅鱼圈'
  187. // this.detailData.carrierInfo.loadingImg = ''
  188. // this.carrierInfo = res.data.carrierInfo
  189. // this.freightInfo = res.data.freightInfo
  190. // this.zcPhoneList = this.carrierInfo.loadingImg.split(',')
  191. // if(res.data.orderStatus!="待货主确认"&&res.data.orderStatus!="未装车"&&res.data.orderStatus!="已终止"){
  192. // this.status1 = true
  193. // }
  194. // if(res.data.orderStatus!="已终止"&&res.data.orderStatus!="平台驳回装车信息"&&res.data.orderStatus!="待平台确认装车"&&res.data.orderStatus!="待货主确认"&&res.data.orderStatus!="未装车"&&res.data.orderStatus!="待货主确认装车"&&res.data.orderStatus!="货主驳回装车信息"){
  195. // this.status2 = true
  196. // }
  197. }
  198. })
  199. },
  200. //车牌号弹出键盘
  201. handleShowKeyboard() {
  202. if (this.detailData.carrierInfo.carNo == '') {
  203. this.carNumber = ''
  204. } else {
  205. this.carNumber = this.detailData.carrierInfo.carNo
  206. }
  207. if (this.$refs.keyboard.open) {
  208. this.$refs.keyboard.open(false) //true 键盘显示 false 键盘隐藏
  209. } else {
  210. this.$refs.keyboard[0].open(false)
  211. }
  212. if (this.$refs.keyboard.open) {
  213. this.$refs.keyboard.open(true) //true 键盘显示 false 键盘隐藏
  214. } else {
  215. this.$refs.keyboard[0].open(true)
  216. }
  217. },
  218. //车牌号弹出键盘
  219. handleClick(e) {
  220. this.carNumber = e.value
  221. this.detailData.carrierInfo.carNo = e.value //键盘输入值
  222. },
  223. // getLngLat() {
  224. // uni.showLoading({
  225. // title: '获取定位中',
  226. // mask: true
  227. // })
  228. // this.$helper.fUN_AmapLocation.start({
  229. // intervalTime: 1000 * 3,
  230. // isReport: false,
  231. // },
  232. // res => {
  233. // //见下方定位返回示例
  234. // console.log('====fUN_AmapLocation定位====', JSON.stringify(res));
  235. // if (res.latitude) {
  236. // this.detailData.carrierInfo.loadingAreaLongitude = res.longitude;
  237. // this.detailData.carrierInfo.loadingAreaLatitude = res.latitude;
  238. // this.detailData.carrierInfo.sendCity = this.$helper.filterUrban(res.city)
  239. // this.detailData.carrierInfo.sendArea = this.$helper.filterArea(res.district);
  240. // console.log(this.detailData.carrierInfo.sendCity)
  241. // console.log(this.detailData.carrierInfo.sendArea)
  242. // this.$forceUpdate()
  243. // }
  244. // uni.hideLoading()
  245. // this.$helper.fUN_AmapLocation.stop({}, result => {
  246. // console.log('====fUN_AmapLocation定位stop====', JSON.stringify(result));
  247. // });
  248. // }
  249. // );
  250. // uni.getLocation({
  251. // type: 'gcj02',
  252. // geocode: true,
  253. // success: res => {
  254. // console.log('定位地址')
  255. // console.log(res)
  256. // if (res.latitude) {
  257. // this.detailData.carrierInfo.loadingAreaLongitude = res.longitude;
  258. // this.detailData.carrierInfo.loadingAreaLatitude = res.latitude;
  259. // this.detailData.carrierInfo.sendCity = this.$helper.filterUrban(res.address.city)
  260. // this.detailData.carrierInfo.sendArea = this.$helper.filterArea(res.address
  261. // .district);
  262. // console.log(this.detailData.carrierInfo.sendCity)
  263. // console.log(this.detailData.carrierInfo.sendArea)
  264. // this.$forceUpdate()
  265. // uni.hideLoading()
  266. // } else {
  267. // if (uni.getSystemInfoSync().platform == 'android') {
  268. // var context = plus.android.importClass("android.content.Context");
  269. // var locationManager = plus.android.importClass(
  270. // "android.location.LocationManager");
  271. // var main = plus.android.runtimeMainActivity();
  272. // var mainSvr = main.getSystemService(context.LOCATION_SERVICE);
  273. // this.bool = mainSvr.isProviderEnabled(locationManager.GPS_PROVIDER)
  274. // }
  275. // if (this.bool === false) {
  276. // uni.showModal({
  277. // title: '提示',
  278. // content: '请打开定位服务',
  279. // success: ({
  280. // confirm,
  281. // cancel
  282. // }) => {
  283. // if (confirm) {
  284. // if (uni.getSystemInfoSync().platform == 'android') {
  285. // var Intent = plus.android.importClass(
  286. // 'android.content.Intent');
  287. // var Settings = plus.android.importClass(
  288. // 'android.provider.Settings');
  289. // var intent = new Intent(Settings
  290. // .ACTION_LOCATION_SOURCE_SETTINGS);
  291. // var main = plus.android.runtimeMainActivity();
  292. // main.startActivity(intent); // 打开系统设置GPS服务页面
  293. // }
  294. // }
  295. // }
  296. // });
  297. // }
  298. // }
  299. // },
  300. // fail: res => {
  301. // console.log('定位失败')
  302. // console.log(res)
  303. // }
  304. // });
  305. // },
  306. alertBtn() {
  307. // uni.navigateTo({
  308. // url: '/pages/public/login'
  309. // })
  310. },
  311. cancelClick() {
  312. this.isShowAlert = false
  313. },
  314. // 删除图片
  315. deletePic(event) {
  316. this[`fileList${event.name}`].splice(event.index, 1)
  317. },
  318. // 新增图片
  319. async afterRead(event) {
  320. // 当设置 mutiple 为 true 时, file 为数组格式,否则为对象格式
  321. let lists = [].concat(event.file)
  322. let fileListLen = this[`fileList${event.name}`].length
  323. lists.map((item) => {
  324. this[`fileList${event.name}`].push({
  325. ...item,
  326. status: 'uploading',
  327. message: '上传中'
  328. })
  329. })
  330. for (let i = 0; i < lists.length; i++) {
  331. const result = await this.uploadFilePromise(lists[i].url)
  332. let item = this[`fileList${event.name}`][fileListLen]
  333. this[`fileList${event.name}`].splice(fileListLen, 1, Object.assign(item, {
  334. status: 'success',
  335. message: '',
  336. url: result
  337. }))
  338. fileListLen++
  339. }
  340. },
  341. uploadFilePromise(url) {
  342. uploadImage('image', url, 'appData/',
  343. result => {
  344. // 上传成功回调函数
  345. console.log('图片地址', result)
  346. this.imgList.push(result)
  347. }
  348. )
  349. },
  350. onProgress(e) {
  351. console.log(e)
  352. },
  353. submit(type) {
  354. if (type == 1) {
  355. if (!this.detailData.contractNo) {
  356. this.$refs.uToast.show({
  357. type: 'error',
  358. message: "合同未签订不能暂存!"
  359. })
  360. return
  361. }
  362. this.alertTitle = '确定暂存装车信息?'
  363. } else {
  364. this.alertTitle = '确定提交装车信息?'
  365. }
  366. this.isShowAlert = true
  367. this.detailData.statusFlag = type
  368. },
  369. confirmClick() {
  370. this.isShowAlert = false
  371. //1暂存
  372. // if (this.detailData.statusFlag == 1) {
  373. // delete this.detailData.carrierInfo.loadingAreaLongitude;
  374. // delete this.detailData.carrierInfo.loadingAreaLatitude;
  375. // delete this.detailData.carrierInfo.sendCity;
  376. // delete this.detailData.carrierInfo.sendArea;
  377. // }
  378. this.detailData.carrierInfo = {}
  379. uni.showLoading({
  380. title: '加载中'
  381. })
  382. this.$request.baseRequest('post', '/carrierInfo/cargoOwnerLoadingAdd', {
  383. id: this.id,
  384. loadingFlag: 1,
  385. flag: 1
  386. }).then(res => {
  387. if (res.code == 200) {
  388. uni.hideLoading()
  389. let _title = ''
  390. if (this.detailData.statusFlag == 1) {
  391. _title = '暂存成功!'
  392. } else {
  393. _title = '提交成功!'
  394. }
  395. uni.navigateBack({
  396. delta:1
  397. })
  398. }else{
  399. uni.hideLoading()
  400. uni.$u.toast(res.message);
  401. }
  402. })
  403. .catch(res => {
  404. uni.$u.toast(res.message);
  405. });
  406. }
  407. },
  408. }
  409. </script>
  410. <style scoped lang="scss">
  411. .content {
  412. // . {
  413. // color: #333333;
  414. // }
  415. }
  416. .level2-title {
  417. margin: 0 0 20rpx 0;
  418. }
  419. .content1,
  420. .content2 {
  421. background: white;
  422. margin: 20rpx;
  423. border-radius: 20rpx;
  424. padding: 20rpx;
  425. .place {
  426. width: 80%;
  427. text-align: right;
  428. }
  429. }
  430. .upload {}
  431. .bottom-btn {
  432. display: flex;
  433. justify-content: space-around;
  434. margin-bottom: 50rpx;
  435. background: #FFFFFF;
  436. padding: 40rpx 0;
  437. }
  438. .store {
  439. padding: 20rpx 30rpx;
  440. color: #2772FB;
  441. width: 40%;
  442. background: #EEF4FF;
  443. border-radius: 40rpx;
  444. font-size: 36rpx;
  445. text-align: center;
  446. }
  447. .submit {
  448. font-size: 36rpx;
  449. padding: 20rpx 30rpx;
  450. color: white;
  451. width: 40%;
  452. background: #2772FB;
  453. border-radius: 40rpx;
  454. text-align: center;
  455. }
  456. .row-between {
  457. margin: 20rpx 0;
  458. }
  459. .sx-style {
  460. background: #2772FB;
  461. color: white;
  462. padding: 2rpx 16rpx;
  463. box-sizing: border-box;
  464. border-radius: 10rpx;
  465. margin-left: 20rpx;
  466. }
  467. .input {
  468. text-align: right;
  469. }
  470. .date-style {}
  471. </style>