confirmLoading.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572
  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.cargoOwner}}</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.freight}}{{detailData.illingMethod==0?'元/吨':'元/车'}}</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. {{detailData.carrierInfo.carNo}}
  51. <!-- <input class="car-uumber input" v-model='detailData.carrierInfo.carNo'
  52. :disabled="true" placeholder="输入车牌号" name="input" disabled="true"></input> -->
  53. </view>
  54. <view class='row-between' @click="selectDate">
  55. <view class="">装车日期</view>
  56. <view class="date-style">
  57. {{detailData.carrierInfo.loadingDate?detailData.carrierInfo.loadingDate:'选择装车日期'}}
  58. </view>
  59. </view>
  60. <view class='row-between'>
  61. <view class="">运费总额(元)</view>
  62. {{detailData.freightInfo.freight}}
  63. <!-- <view class=""><input class="input" type="text" value="" v-model="detailData.carrierInfo.freight"
  64. placeholder="请输入运费"></view> -->
  65. </view>
  66. <view class='row-between'>
  67. <view class="">定位</view>
  68. <view class="flex align-center">{{detailData.carrierInfo.sendCity}} {{detailData.carrierInfo.sendArea}}
  69. <view class="sx-style" @click.stop="getLngLat()">刷新</view>
  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 class='s-flex'>
  78. <view class="">上传装车磅单</view>
  79. <upload class="upload" ref="upload" :action="action" :max-size="maxSize" :max-count="1"
  80. :size-type="['compressed']" @on-success="getImgUrl" @on-error="onError" @on-remove="onRemove"
  81. @on-uploaded="isAdd = true" :before-upload="filterFileType" @on-progress="onProgress"></upload>
  82. </view> -->
  83. </view>
  84. <view class="bottom-btn">
  85. <view class="store" @click="submit(1)">暂存</view>
  86. <view class="submit" @click="submit(3)">提交</view>
  87. </view>
  88. <u-modal :show="isShowAlert" :title="alertTitle" :content='alertContent' :closeOnClickOverlay='true'
  89. :showCancelButton='true' confirmColor='#2772FB' @confirm="confirmClick" @close="cancelClick"
  90. @cancel="cancelClick"></u-modal>
  91. <master-keyboard ref="keyboard" keyboardtype="car" :show="keyShow" :randomNumber="true" :newCar="false"
  92. :defaultValue="carNumber" @keyboardClick="handleClick"></master-keyboard>
  93. <u-toast ref="uToast"></u-toast>
  94. <u-calendar :show="showDate" :mode="mode" @confirm="confirmDate" @close="showDate= false"></u-calendar>
  95. </view>
  96. </template>
  97. <script>
  98. let that;
  99. import uploadImage from '@/components/ossutil/uploadFile.js';
  100. export default {
  101. data() {
  102. return {
  103. imgList: [],
  104. fileList1: [],
  105. showDate: false,
  106. mode: 'single',
  107. id: '',
  108. sourceType: ['camera'],
  109. detailData: {
  110. carrierInfo: {},
  111. },
  112. action: this.$helper.ossUploadUrl,
  113. maxSize: 50 * 1024 * 1024, //限制文件大小 50M
  114. isAdd: true,
  115. isShowAlert: false,
  116. alertContent: '',
  117. alertTitle: '',
  118. keyShow: false,
  119. carNumber: '',
  120. gjList: []
  121. }
  122. },
  123. onLoad(options) {
  124. that = this
  125. // debugger
  126. // #ifdef APP-PLUS
  127. this.getLngLat();
  128. // #endif
  129. console.log(options)
  130. this.id = JSON.parse(decodeURIComponent(options.obj)).id
  131. this.getInfo()
  132. // this.detailData = options;
  133. // CYHT20220317000001
  134. },
  135. methods: {
  136. toSignContract(){
  137. uni.$u.route('/pages/order/signContract', {
  138. obj: JSON.stringify(this.detailData),
  139. });
  140. },
  141. selectDate() {
  142. this.showDate = true
  143. },
  144. confirmDate(e) {
  145. this.detailData.carrierInfo.loadingDate = e[0]
  146. this.showDate = false
  147. console.log(e);
  148. },
  149. getInfo() {
  150. this.$request.baseRequest('get', '/orderInfo/getOrderInfo', {
  151. id: this.id,
  152. }).then(res => {
  153. if (res.code == 200) {
  154. this.detailData = res.data
  155. // this.detailData.contractNo = ''
  156. // this.detailData.id = this.detailData.carrierId
  157. // this.detailData.carrierInfo.loadingDate = ''
  158. // this.detailData.carrierInfo.carNo = ''
  159. // this.detailData.carrierInfo.loadingAreaLongitude = ''
  160. // this.detailData.carrierInfo.loadingAreaLatitude = ''
  161. // this.detailData.carrierInfo.sendCity = '营口'
  162. // this.detailData.carrierInfo.sendArea = '鲅鱼圈'
  163. // this.detailData.carrierInfo.loadingImg = ''
  164. // this.carrierInfo = res.data.carrierInfo
  165. // this.freightInfo = res.data.freightInfo
  166. // this.zcPhoneList = this.carrierInfo.loadingImg.split(',')
  167. // if(res.data.orderStatus!="待货主确认"&&res.data.orderStatus!="未装车"&&res.data.orderStatus!="已终止"){
  168. // this.status1 = true
  169. // }
  170. // if(res.data.orderStatus!="已终止"&&res.data.orderStatus!="平台驳回装车信息"&&res.data.orderStatus!="待平台确认装车"&&res.data.orderStatus!="待货主确认"&&res.data.orderStatus!="未装车"&&res.data.orderStatus!="待货主确认装车"&&res.data.orderStatus!="货主驳回装车信息"){
  171. // this.status2 = true
  172. // }
  173. }
  174. })
  175. },
  176. //车牌号弹出键盘
  177. handleShowKeyboard() {
  178. if (this.detailData.carrierInfo.carNo == '') {
  179. this.carNumber = ''
  180. } else {
  181. this.carNumber = this.detailData.carrierInfo.carNo
  182. }
  183. if (this.$refs.keyboard.open) {
  184. this.$refs.keyboard.open(false) //true 键盘显示 false 键盘隐藏
  185. } else {
  186. this.$refs.keyboard[0].open(false)
  187. }
  188. if (this.$refs.keyboard.open) {
  189. this.$refs.keyboard.open(true) //true 键盘显示 false 键盘隐藏
  190. } else {
  191. this.$refs.keyboard[0].open(true)
  192. }
  193. },
  194. //车牌号弹出键盘
  195. handleClick(e) {
  196. this.carNumber = e.value
  197. this.detailData.carrierInfo.carNo = e.value //键盘输入值
  198. },
  199. getLngLat() {
  200. uni.showLoading({
  201. title: '获取定位中',
  202. mask: true
  203. })
  204. console.log(123)
  205. this.$helper.fUN_AmapLocation.start({
  206. intervalTime: 1000 * 3,
  207. isReport: false,
  208. },
  209. res => {
  210. //见下方定位返回示例
  211. console.log('====fUN_AmapLocation定位====', JSON.stringify(res));
  212. if (res.latitude) {
  213. this.detailData.carrierInfo.loadingAreaLongitude = res.longitude;
  214. this.detailData.carrierInfo.loadingAreaLatitude = res.latitude;
  215. this.detailData.carrierInfo.sendCity = this.$helper.filterUrban(res.city)
  216. this.detailData.carrierInfo.sendArea = this.$helper.filterArea(res
  217. .district);
  218. console.log(this.detailData.carrierInfo.sendCity)
  219. console.log(this.detailData.carrierInfo.sendArea)
  220. this.$forceUpdate()
  221. }
  222. uni.hideLoading()
  223. this.$helper.fUN_AmapLocation.stop({}, result => {
  224. console.log('====fUN_AmapLocation定位stop====', JSON.stringify(result));
  225. });
  226. }
  227. );
  228. // uni.getLocation({
  229. // type: 'gcj02',
  230. // geocode: true,
  231. // success: res => {
  232. // console.log('定位地址')
  233. // console.log(res)
  234. // if (res.latitude) {
  235. // this.detailData.carrierInfo.loadingAreaLongitude = res.longitude;
  236. // this.detailData.carrierInfo.loadingAreaLatitude = res.latitude;
  237. // this.detailData.carrierInfo.sendCity = this.$helper.filterUrban(res.address.city)
  238. // this.detailData.carrierInfo.sendArea = this.$helper.filterArea(res.address
  239. // .district);
  240. // console.log(this.detailData.carrierInfo.sendCity)
  241. // console.log(this.detailData.carrierInfo.sendArea)
  242. // this.$forceUpdate()
  243. // uni.hideLoading()
  244. // } else {
  245. // if (uni.getSystemInfoSync().platform == 'android') {
  246. // var context = plus.android.importClass("android.content.Context");
  247. // var locationManager = plus.android.importClass(
  248. // "android.location.LocationManager");
  249. // var main = plus.android.runtimeMainActivity();
  250. // var mainSvr = main.getSystemService(context.LOCATION_SERVICE);
  251. // this.bool = mainSvr.isProviderEnabled(locationManager.GPS_PROVIDER)
  252. // }
  253. // if (this.bool === false) {
  254. // uni.showModal({
  255. // title: '提示',
  256. // content: '请打开定位服务',
  257. // success: ({
  258. // confirm,
  259. // cancel
  260. // }) => {
  261. // if (confirm) {
  262. // if (uni.getSystemInfoSync().platform == 'android') {
  263. // var Intent = plus.android.importClass(
  264. // 'android.content.Intent');
  265. // var Settings = plus.android.importClass(
  266. // 'android.provider.Settings');
  267. // var intent = new Intent(Settings
  268. // .ACTION_LOCATION_SOURCE_SETTINGS);
  269. // var main = plus.android.runtimeMainActivity();
  270. // main.startActivity(intent); // 打开系统设置GPS服务页面
  271. // }
  272. // }
  273. // }
  274. // });
  275. // }
  276. // }
  277. // },
  278. // fail: res => {
  279. // console.log('定位失败')
  280. // console.log(res)
  281. // }
  282. // });
  283. },
  284. alertBtn() {
  285. // uni.navigateTo({
  286. // url: '/pages/public/login'
  287. // })
  288. },
  289. cancelClick() {
  290. this.isShowAlert = false
  291. },
  292. // 删除图片
  293. deletePic(event) {
  294. this[`fileList${event.name}`].splice(event.index, 1)
  295. },
  296. // 新增图片
  297. async afterRead(event) {debugger
  298. // 当设置 mutiple 为 true 时, file 为数组格式,否则为对象格式
  299. let lists = [].concat(event.file)
  300. let fileListLen = this[`fileList${event.name}`].length
  301. lists.map((item) => {
  302. this[`fileList${event.name}`].push({
  303. ...item,
  304. status: 'uploading',
  305. message: '上传中'
  306. })
  307. })
  308. for (let i = 0; i < lists.length; i++) {
  309. const result = await this.uploadFilePromise(lists[i].url)
  310. let item = this[`fileList${event.name}`][fileListLen]
  311. this[`fileList${event.name}`].splice(fileListLen, 1, Object.assign(item, {
  312. status: 'success',
  313. message: '',
  314. url: result
  315. }))
  316. fileListLen++
  317. }
  318. },
  319. uploadFilePromise(url) {
  320. uploadImage('image', url, 'appData/',
  321. result => {
  322. // 上传成功回调函数
  323. console.log('图片地址', result)
  324. this.imgList.push(result)
  325. }
  326. )
  327. },
  328. onProgress(e) {
  329. console.log(e)
  330. },
  331. submit(type) {
  332. console.log(type)
  333. if (type == 1) {
  334. if (!this.detailData.contractNo) {
  335. this.$refs.uToast.show({
  336. type: 'error',
  337. message: "合同未签订不能暂存!"
  338. })
  339. return
  340. }
  341. this.alertTitle = '确定暂存装车信息?'
  342. } else {
  343. this.alertTitle = '确定提交装车信息?'
  344. }
  345. this.isShowAlert = true
  346. this.detailData.statusFlag = type
  347. // this.$refs.uToast.show({
  348. // ...params,
  349. // complete() {
  350. // params.url && uni.navigateTo({
  351. // url: params.url
  352. // })
  353. // }
  354. // })
  355. },
  356. validate() {
  357. if (uni.$u.test.isEmpty(this.detailData.carrierInfo.carNo)) {
  358. this.$refs.uToast.show({
  359. type: 'error',
  360. message: "车牌号不能为空!",
  361. })
  362. return true
  363. }
  364. if (uni.$u.test.isEmpty(this.detailData.carrierInfo.loadingDate)) {
  365. this.$refs.uToast.show({
  366. type: 'error',
  367. message: "装车日期不能为空!",
  368. })
  369. return true
  370. }
  371. if (uni.$u.test.isEmpty(this.detailData.freightInfo.freight)) {
  372. this.$refs.uToast.show({
  373. type: 'error',
  374. message: "运费总额不能为空!",
  375. })
  376. return true
  377. }
  378. // if (uni.$u.test.isEmpty(this.detailData.carrierInfo.sendCity)) {
  379. // this.$refs.uToast.show({
  380. // type: 'error',
  381. // message: "定位不能为空!",
  382. // })
  383. // return true
  384. // }
  385. // if (uni.$u.test.isEmpty(this.detailData.carrierInfo.sendArea)) {
  386. // this.$refs.uToast.show({
  387. // type: 'error',
  388. // message: "定位不能为空!",
  389. // })
  390. // return true
  391. // }
  392. // if (uni.$u.test.isEmpty(this.detailData.carrierInfo.loadingImg)) {
  393. // this.$refs.uToast.show({
  394. // type: 'error',
  395. // message: "装车照片不能为空!",
  396. // })
  397. // return true
  398. // }
  399. },
  400. confirmClick() {
  401. this.isShowAlert = false
  402. if(this.validate()) return
  403. //1暂存
  404. if (this.detailData.statusFlag == 1) {
  405. delete this.detailData.carrierInfo.loadingAreaLongitude;
  406. delete this.detailData.carrierInfo.loadingAreaLatitude;
  407. delete this.detailData.carrierInfo.sendCity;
  408. delete this.detailData.carrierInfo.sendArea;
  409. }
  410. this.detailData.carrierInfo.statusFlag = this.detailData.statusFlag
  411. this.detailData.carrierInfo.loadingImg = this.imgList.toString()
  412. this.$request.baseRequest('post', '/carrierInfo/loadingAdd', this.detailData.carrierInfo).then(res => {
  413. if (res.code == 200) {
  414. // debugger
  415. let _title = ''
  416. if (this.detailData.statusFlag == 1) {
  417. _title = '暂存成功!'
  418. } else {
  419. _title = '提交成功!'
  420. }
  421. this.$helper.fUN_AmapLocation.start({
  422. // intervalTime: 1000 * 60,
  423. intervalTime: 5000,
  424. // isReport: true,
  425. reportInterval: 5,
  426. // url: 'http://192.168.0.66/fun/open/test_json.do',
  427. // params: {
  428. // a: 1,
  429. // B: '测试',
  430. // c: true
  431. // },
  432. // headers: {
  433. // a: '123',
  434. // B: 'abcd'
  435. // }
  436. },
  437. res => {
  438. console.log('====确认装车开启连续定位====');
  439. console.log(res)
  440. let _data = {
  441. orderId: that.id,
  442. longitude: res.longitude,
  443. latitude: res.latitude,
  444. province: res.province,
  445. city: res.city,
  446. area: res.district
  447. }
  448. this.$helper.gjList.push(_data)
  449. uni.setStorageSync('mapGJ', this.$helper.gjList);
  450. console.log('this.$helper.gjList')
  451. console.log(this.$helper.gjList)
  452. if (uni.getStorageSync('mapGJ').length > 100) {
  453. console.log(uni.getStorageSync('mapGJ'))
  454. this.$request.baseRequest('post', '/vehicleTrajectoryInfo/api/addInfo', {
  455. vehicleTrajectoryInfos: uni.getStorageSync('mapGJ')
  456. }).then(res => {
  457. this.$helper.gjList = []
  458. uni.setStorageSync('mapGJ', []);
  459. })
  460. .catch(res => {
  461. uni.$u.toast(res.message);
  462. });
  463. }
  464. //判断缓存数据条数,超过reportInterval时清空缓存,重新存入缓存
  465. }
  466. );
  467. this.$refs.uToast.show({
  468. type: 'success',
  469. message: _title,
  470. complete() {
  471. uni.switchTab({
  472. url: '/pages/order/index'
  473. })
  474. }
  475. })
  476. }
  477. })
  478. .catch(res => {
  479. uni.$u.toast(res.message);
  480. });
  481. }
  482. },
  483. }
  484. </script>
  485. <style scoped lang="scss">
  486. .content {
  487. // . {
  488. // color: #333333;
  489. // }
  490. }
  491. .level2-title {
  492. margin: 0 0 20rpx 0;
  493. }
  494. .content1,
  495. .content2 {
  496. background: white;
  497. margin: 20rpx;
  498. border-radius: 20rpx;
  499. padding: 20rpx;
  500. .place {
  501. width: 80%;
  502. text-align: right;
  503. }
  504. }
  505. .upload {}
  506. .bottom-btn {
  507. display: flex;
  508. justify-content: space-around;
  509. margin-bottom: 50rpx;
  510. background: #FFFFFF;
  511. padding: 40rpx 0;
  512. }
  513. .store {
  514. padding: 20rpx 30rpx;
  515. color: #2772FB;
  516. width: 40%;
  517. background: #EEF4FF;
  518. border-radius: 40rpx;
  519. font-size: 36rpx;
  520. text-align: center;
  521. }
  522. .submit {
  523. font-size: 36rpx;
  524. padding: 20rpx 30rpx;
  525. color: white;
  526. width: 40%;
  527. background: #2772FB;
  528. border-radius: 40rpx;
  529. text-align: center;
  530. }
  531. .row-between {
  532. margin: 20rpx 0;
  533. }
  534. .sx-style {
  535. background: #2772FB;
  536. color: white;
  537. padding: 2rpx 16rpx;
  538. box-sizing: border-box;
  539. border-radius: 10rpx;
  540. margin-left: 20rpx;
  541. }
  542. .input {
  543. text-align: right;
  544. }
  545. .date-style {}
  546. </style>