confirmLoading.vue 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746
  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.carNo?detailData.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'>
  55. <view class="">装车日期</view>
  56. <view class="date-style">
  57. {{detailData.loadingDate1?detailData.loadingDate1:'来自合同'}}
  58. </view>
  59. </view>
  60. <view class='row-between'>
  61. <view class="">装车净重(吨)</view>
  62. {{detailData.weight ? detailData.weight:"来自合同"}}
  63. </view>
  64. <view class='row-between'>
  65. <view class="">预计运费(元)</view>
  66. <view class="">{{detailData.driverContract == 1 ? detailData.freight:"来自合同"}}</view>
  67. <!-- {{detailData.freight ? detailData.freight:"来自合同"}} -->
  68. <!-- <view class=""><input class="input" type="text" value="" v-model="detailData.carrierInfo.freight"
  69. placeholder="请输入运费"></view> -->
  70. </view>
  71. <view class='row-between'>
  72. <view class="">预付款(元)</view>
  73. {{detailData.advanceCharge ? detailData.advanceCharge:"来自合同"}}
  74. <!-- <view class=""><input class="input" type="text" value="" v-model="detailData.carrierInfo.freight"
  75. placeholder="请输入运费"></view> -->
  76. </view>
  77. <view class='row-between'>
  78. <view class="">定位</view>
  79. <view class="flex align-center">{{localtion.city}}
  80. {{localtion.sendArea}}
  81. <view class="sx-style" @click.stop="getLngLat()">刷新</view>
  82. </view>
  83. </view>
  84. <view class='s-flex'>
  85. <view class="" style="margin:20rpx 0;">上传装车照片</view>
  86. <u-upload class="uview-upload" :fileList="fileList1" @afterRead="afterRead($event)" @delete="deletePic"
  87. name="1" :multiple='true' :maxCount="3"></u-upload>
  88. </view>
  89. <!-- <view class='s-flex'>
  90. <view class="">上传装车磅单</view>
  91. <upload class="upload" ref="upload" :action="action" :max-size="maxSize" :max-count="1"
  92. :size-type="['compressed']" @on-success="getImgUrl" @on-error="onError" @on-remove="onRemove"
  93. @on-uploaded="isAdd = true" :before-upload="filterFileType" @on-progress="onProgress"></upload>
  94. </view> -->
  95. </view>
  96. <view class="bottom-btn">
  97. <view class="store" @click="$u.throttle(submit(1), 5000)">暂存</view>
  98. <view class="submit" @click="$u.throttle(submit(3), 5000)">提交</view>
  99. </view>
  100. <u-modal :show="isShowAlert" :title="alertTitle" :content='alertContent' :closeOnClickOverlay='true'
  101. :showCancelButton='true' confirmColor='#2772FB' @confirm="confirmClick" @close="cancelClick"
  102. @cancel="cancelClick"></u-modal>
  103. <master-keyboard ref="keyboard" keyboardtype="car" :show="keyShow" :randomNumber="true" :newCar="false"
  104. :defaultValue="carNumber" @keyboardClick="handleClick"></master-keyboard>
  105. <u-toast ref="uToast"></u-toast>
  106. <u-calendar :show="showDate" :mode="mode" @confirm="confirmDate" @close="showDate= false"></u-calendar>
  107. </view>
  108. </template>
  109. <script>
  110. let that;
  111. import uploadImage from '@/components/ossutil/uploadFile.js';
  112. export default {
  113. data() {
  114. return {
  115. cyId: '',
  116. localtion: {
  117. city: '',
  118. sendArea: ''
  119. },
  120. imgList: [],
  121. fileList1: [],
  122. showDate: false,
  123. mode: 'single',
  124. id: '',
  125. sourceType: ['camera'],
  126. detailData: {
  127. hyCarrierInfo: {},
  128. loadingDate: {}
  129. },
  130. action: this.$helper.ossUploadUrl,
  131. maxSize: 50 * 1024 * 1024, //限制文件大小 50M
  132. isAdd: true,
  133. isShowAlert: false,
  134. alertContent: '',
  135. alertTitle: '',
  136. keyShow: false,
  137. carNumber: '',
  138. gjList: [],
  139. }
  140. },
  141. onLoad(options) {
  142. this.id = JSON.parse(decodeURIComponent(options.obj)).id
  143. this.detailData.hyCarrierInfo.id = JSON.parse(decodeURIComponent(options.obj)).carrierId
  144. this.cyId = JSON.parse(decodeURIComponent(options.obj)).carrierId
  145. this.getInfo()
  146. console.log(options)
  147. // this.detailData = JSON.parse(options.obj) ;
  148. // console.log(this.detailData)
  149. // CYHT20220317000001
  150. },
  151. methods: {
  152. //确认装车提交成功后,开启实时定位,
  153. // 调接口5分钟一次发送轨迹,[
  154. // {latitude: 39.997761, longitude: 116.478935},
  155. // {latitude: 39.997825, longitude: 116.478939},
  156. // {latitude: 39.998549, longitude: 116.478912},
  157. // {latitude: 39.998555, longitude: 116.478998},
  158. // {latitude: 39.998566, longitude: 116.479282},
  159. // {latitude: 39.998528, longitude: 116.479658},
  160. // {latitude: 39.998453, longitude: 116.480151},
  161. // {latitude: 39.998302, longitude: 116.480784},
  162. // {latitude: 39.998184, longitude: 116.481149},
  163. // {latitude: 39.997997, longitude: 116.481573},
  164. // {latitude: 39.997846, longitude: 116.481863},
  165. // {latitude: 39.997718, longitude: 116.482072},
  166. // {latitude: 39.997718, longitude: 116.482362},
  167. // {latitude: 39.998935, longitude: 116.483633},
  168. // {latitude: 39.998968, longitude: 116.48367},
  169. // {latitude: 39.999861, longitude: 116.484648}
  170. // ]
  171. // a(){},
  172. toSignContract() {
  173. console.log(this.detailData)
  174. this.$request.baseRequest('get', '/orderInfo/getOrderInfo', {
  175. id: this.id,
  176. }).then(res => {
  177. uni.$u.route('/pages/order/signContract', {
  178. obj: JSON.stringify(res.data),
  179. });
  180. });
  181. },
  182. selectDate() {
  183. this.showDate = true
  184. },
  185. confirmDate(e) {
  186. this.detailData.hyCarrierInfo.loadingDate = e[0]
  187. this.showDate = false
  188. },
  189. getInfo() {
  190. this.$request.baseRequest('get', '/orderInfo/getOrderInfo', {
  191. id: this.id,
  192. }).then(res => {
  193. if (res.code == 200) {
  194. this.detailData = res.data
  195. // #ifdef APP-PLUS
  196. this.getLngLat();
  197. // #endif
  198. this.$request.baseRequest('get', '/carrierInfo/getHyCarrierInfo', {
  199. orderId: this.detailData.id,
  200. }).then(res => {
  201. if (res.data) {
  202. if(res.data.loadingImg){
  203. var data=res.data.loadingImg.split(',')
  204. this.imgList=res.data.loadingImg.split(',')
  205. for (var i = 0; i < data.length; i++) {
  206. if(data[i]!=''){
  207. this.fileList1.push({url:data[i]})
  208. }
  209. }
  210. }
  211. console.log(this.fileList1)
  212. this.detailData.carNo = res.data.carNo
  213. this.detailData.loadingDate = res.data.loadingDate
  214. if(res.data.loadingDate){
  215. this.detailData.loadingDate1=res.data.loadingDate.split(' ')[0]
  216. }
  217. this.detailData.weight = res.data.loadingWeight
  218. this.detailData.freight = res.data.estimatedFreight
  219. }
  220. })
  221. // this.detailData.contractNo = ''
  222. // this.detailData.id = this.detailData.carrierId
  223. // this.detailData.carrierInfo.loadingDate = ''
  224. // this.detailData.carrierInfo.carNo = ''
  225. // this.detailData.carrierInfo.loadingAreaLongitude = ''
  226. // this.detailData.carrierInfo.loadingAreaLatitude = ''
  227. // this.detailData.carrierInfo.sendCity = '营口'
  228. // this.detailData.carrierInfo.sendArea = '鲅鱼圈'
  229. // this.detailData.carrierInfo.loadingImg = ''
  230. // this.carrierInfo = res.data.carrierInfo
  231. // this.freightInfo = res.data.freightInfo
  232. // this.zcPhoneList = this.carrierInfo.loadingImg.split(',')
  233. // if(res.data.orderStatus!="待货主确认"&&res.data.orderStatus!="未装车"&&res.data.orderStatus!="已终止"){
  234. // this.status1 = true
  235. // }
  236. // if(res.data.orderStatus!="已终止"&&res.data.orderStatus!="平台驳回装车信息"&&res.data.orderStatus!="待平台确认装车"&&res.data.orderStatus!="待货主确认"&&res.data.orderStatus!="未装车"&&res.data.orderStatus!="待货主确认装车"&&res.data.orderStatus!="货主驳回装车信息"){
  237. // this.status2 = true
  238. // }
  239. }
  240. })
  241. },
  242. //车牌号弹出键盘
  243. handleShowKeyboard() {
  244. if (this.detailData.hyCarrierInfo.carNo == '') {
  245. this.carNumber = ''
  246. } else {
  247. this.carNumber = this.detailData.hyCarrierInfo.carNo
  248. }
  249. if (this.$refs.keyboard.open) {
  250. this.$refs.keyboard.open(false) //true 键盘显示 false 键盘隐藏
  251. } else {
  252. this.$refs.keyboard[0].open(false)
  253. }
  254. if (this.$refs.keyboard.open) {
  255. this.$refs.keyboard.open(true) //true 键盘显示 false 键盘隐藏
  256. } else {
  257. this.$refs.keyboard[0].open(true)
  258. }
  259. },
  260. //车牌号弹出键盘
  261. handleClick(e) {
  262. this.carNumber = e.value
  263. this.detailData.hyCarrierInfo.carNo = e.value //键盘输入值
  264. },
  265. checkOpenGPSServiceByAndroidIOS() {
  266. let system = uni.getSystemInfoSync(); // 获取系统信息
  267. if (system.platform === 'android') { // 判断平台
  268. var context = plus.android.importClass("android.content.Context");
  269. var locationManager = plus.android.importClass("android.location.LocationManager");
  270. var main = plus.android.runtimeMainActivity();
  271. var mainSvr = main.getSystemService(context.LOCATION_SERVICE);
  272. console.log(mainSvr.isProviderEnabled(locationManager.GPS_PROVIDER))
  273. if (!mainSvr.isProviderEnabled(locationManager.GPS_PROVIDER)) {
  274. uni.showModal({
  275. title: '提示',
  276. content: '请打开定位服务功能',
  277. // showCancel: false, // 不显示取消按钮
  278. success(res) {
  279. if(res.confirm){
  280. if (!mainSvr.isProviderEnabled(locationManager.GPS_PROVIDER)) {
  281. var Intent = plus.android.importClass('android.content.Intent');
  282. var Settings = plus.android.importClass('android.provider.Settings');
  283. var intent = new Intent(Settings.ACTION_LOCATION_SOURCE_SETTINGS);
  284. main.startActivity(intent); // 打开系统设置GPS服务页面
  285. }
  286. }
  287. }
  288. });
  289. }
  290. } else if (system.platform === 'ios') {
  291. // console.log("苹果");
  292. var cllocationManger = plus.ios.import("CLLocationManager");
  293. var enable = cllocationManger.locationServicesEnabled();
  294. var status = cllocationManger.authorizationStatus();
  295. plus.ios.deleteObject(cllocationManger);
  296. if (enable && status != 2) {
  297. console.log("手机系统的定位已经打开");
  298. } else {
  299. console.log("手机系统的定位没有打开");
  300. uni.showModal({
  301. title: '提示',
  302. content: '请前往设置-隐私-定位服务打开定位服务功能',
  303. // showCancel: false, // 不显示取消按钮
  304. success(res) {
  305. if(res.confirm){
  306. var UIApplication = plus.ios.import("UIApplication");
  307. var application2 = UIApplication.sharedApplication();
  308. var NSURL2 = plus.ios.import("NSURL");
  309. // var setting2 = NSURL2.URLWithString("prefs:root=LOCATION_SERVICES");
  310. // var setting2 = NSURL2.URLWithString("App-Prefs:root=LOCATION_SERVICES");
  311. // var setting2 = NSURL2.URLWithString("app-settings");
  312. var setting2 = NSURL2.URLWithString("App-Prefs:root=Privacy&path=LOCATION");
  313. // var setting2 = NSURL2.URLWithString("App-Prefs:root=Privacy&path=LOCATION_SERVICES");
  314. application2.openURL(setting2);
  315. plus.ios.deleteObject(setting2);
  316. plus.ios.deleteObject(NSURL2);
  317. plus.ios.deleteObject(application2);
  318. }
  319. }
  320. });
  321. }
  322. }
  323. },
  324. getLngLat() {
  325. this.checkOpenGPSServiceByAndroidIOS()
  326. var that=this
  327. uni.showLoading({
  328. title: '获取定位中',
  329. mask: true
  330. })
  331. // this.$helper.fUN_AmapLocation.start({
  332. // intervalTime: 1000 * 3,
  333. // isReport: false,
  334. // },
  335. // res => {
  336. // //见下方定位返回示例
  337. // console.log('====fUN_AmapLocation定位====', JSON.stringify(res));
  338. // if (res.latitude) {
  339. // this.detailData.carrierInfo.loadingAreaLongitude = res.longitude;
  340. // this.detailData.carrierInfo.loadingAreaLatitude = res.latitude;
  341. // this.detailData.carrierInfo.sendCity = this.$helper.filterUrban(res.city)
  342. // this.detailData.carrierInfo.sendArea = this.$helper.filterArea(res.district);
  343. // console.log(this.detailData.carrierInfo.sendCity)
  344. // console.log(this.detailData.carrierInfo.sendArea)
  345. // this.$forceUpdate()
  346. // }
  347. // this.$helper.fUN_AmapLocation.stop({}, result => {
  348. // uni.hideLoading()
  349. // console.log('====fUN_AmapLocation定位stop====', JSON.stringify(result));
  350. // });
  351. // }
  352. // );
  353. // console.log(that.detailData,111111)
  354. uni.getLocation({
  355. type: 'gcj02',
  356. geocode: true,
  357. success: res => {
  358. if (res.latitude) {
  359. that.detailData.hyCarrierInfo.longitudeLatitude=res.longitude+','+res.latitude
  360. that.detailData.hyCarrierInfo.loadingAreaLongitude = res.longitude;
  361. that.detailData.hyCarrierInfo.loadingAreaLatitude = res.latitude;
  362. that.detailData.hyCarrierInfo.sendCity = that.$helper.filterUrban(res.address.city)
  363. that.localtion.city = that.$helper.filterUrban(res.address.city)
  364. that.$set(that.detailData,'loadingArea',that.$helper.filterUrban(res.address.district))
  365. that.$set(that.detailData,'loadingCity',that.$helper.filterUrban(res.address.city))
  366. that.localtion.sendArea = that.$helper.filterUrban(res.address.district)
  367. // .loadingCity = that.$helper.filterUrban(res.address.city)
  368. that.detailData.loadingLongitude = res.longitude;
  369. that.detailData.loadingLatitude = res.latitude;
  370. console.log(res,that.detailData,22222)
  371. that.$forceUpdate()
  372. uni.hideLoading()
  373. } else {
  374. if (uni.getSystemInfoSync().platform == 'android') {
  375. var context = plus.android.importClass("android.content.Context");
  376. var locationManager = plus.android.importClass(
  377. "android.location.LocationManager");
  378. var main = plus.android.runtimeMainActivity();
  379. var mainSvr = main.getSystemService(context.LOCATION_SERVICE);
  380. that.bool = mainSvr.isProviderEnabled(locationManager.GPS_PROVIDER)
  381. }
  382. if (that.bool === false) {
  383. uni.showModal({
  384. title: '提示',
  385. content: '请打开定位服务',
  386. success: ({
  387. confirm,
  388. cancel
  389. }) => {
  390. if (confirm) {
  391. if (uni.getSystemInfoSync().platform == 'android') {
  392. var Intent = plus.android.importClass(
  393. 'android.content.Intent');
  394. var Settings = plus.android.importClass(
  395. 'android.provider.Settings');
  396. var intent = new Intent(Settings
  397. .ACTION_LOCATION_SOURCE_SETTINGS);
  398. var main = plus.android.runtimeMainActivity();
  399. main.startActivity(intent); // 打开系统设置GPS服务页面
  400. }
  401. }
  402. }
  403. });
  404. uni.hideLoading()
  405. }
  406. }
  407. },
  408. fail: res => {
  409. console.log('定位失败')
  410. console.log(res)
  411. uni.hideLoading()
  412. }
  413. });
  414. },
  415. alertBtn() {
  416. // uni.navigateTo({
  417. // url: '/pages/public/login'
  418. // })
  419. },
  420. cancelClick() {
  421. this.isShowAlert = false
  422. },
  423. // 删除图片
  424. deletePic(event) {
  425. this[`fileList${event.name}`].splice(event.index, 1)
  426. this.imgList.splice(event.index, 1)
  427. },
  428. // 新增图片
  429. async afterRead(event) {
  430. // 当设置 mutiple 为 true 时, file 为数组格式,否则为对象格式
  431. let lists = [].concat(event.file)
  432. let fileListLen = this[`fileList${event.name}`].length
  433. lists.map((item) => {
  434. this[`fileList${event.name}`].push({
  435. ...item,
  436. status: 'uploading',
  437. message: '上传中'
  438. })
  439. })
  440. for (let i = 0; i < lists.length; i++) {
  441. const result = await this.uploadFilePromise(lists[i].url)
  442. let item = this[`fileList${event.name}`][fileListLen]
  443. this[`fileList${event.name}`].splice(fileListLen, 1, Object.assign(item, {
  444. status: 'success',
  445. message: '',
  446. url: result
  447. }))
  448. fileListLen++
  449. }
  450. },
  451. uploadFilePromise(url) {
  452. uploadImage('image', url, 'appData/',
  453. result => {
  454. // 上传成功回调函数
  455. console.log('图片地址', result)
  456. this.imgList.push(result)
  457. }
  458. )
  459. },
  460. onProgress(e) {
  461. console.log(e)
  462. },
  463. submit(type) {
  464. if (type == 1) {
  465. if (this.detailData.driverContract != 1) { //合同签订标识
  466. this.$refs.uToast.show({
  467. type: 'error',
  468. message: "合同未签订不能暂存!"
  469. })
  470. return
  471. }
  472. this.alertTitle = '确定暂存装车信息?'
  473. } else {
  474. if (this.detailData.driverContract != 1) {
  475. this.$refs.uToast.show({
  476. type: 'error',
  477. message: "合同未签订不能提交!"
  478. })
  479. return
  480. }
  481. this.alertTitle = '确定提交装车信息?'
  482. }
  483. if (this.validate()) return
  484. this.isShowAlert = true
  485. this.detailData.statusFlag = type
  486. // this.$refs.uToast.show({
  487. // ...params,
  488. // complete() {
  489. // params.url && uni.navigateTo({
  490. // url: params.url
  491. // })
  492. // }
  493. // })
  494. },
  495. validate() {
  496. // uni.$u.test.isEmpty(this.detailData.carrierInfo.carNo
  497. if (uni.$u.test.isEmpty(this.detailData.carNo)) {
  498. this.$refs.uToast.show({
  499. type: 'error',
  500. message: "车牌号不能为空!",
  501. })
  502. return true
  503. }
  504. if (uni.$u.test.isEmpty(this.detailData.loadingDate)) {
  505. this.$refs.uToast.show({
  506. type: 'error',
  507. message: "装车日期不能为空!",
  508. })
  509. return true
  510. }
  511. if (uni.$u.test.isEmpty(this.detailData.freight)) {
  512. this.$refs.uToast.show({
  513. type: 'error',
  514. message: "预计运费不能为空!",
  515. })
  516. return true
  517. }
  518. if (uni.$u.test.isEmpty(this.detailData.loadingCity)) {
  519. this.$refs.uToast.show({
  520. type: 'error',
  521. message: "定位不能为空!",
  522. })
  523. return true
  524. }
  525. if (uni.$u.test.isEmpty(this.detailData.loadingArea)) {
  526. this.$refs.uToast.show({
  527. type: 'error',
  528. message: "定位不能为空!",
  529. })
  530. return true
  531. }
  532. if(this.imgList.length == 0){
  533. this.$refs.uToast.show({
  534. type: 'error',
  535. message: "装车照片不能为空!",
  536. })
  537. return true
  538. }
  539. },
  540. confirmClick() {
  541. var that=this
  542. this.isShowAlert = false
  543. //1暂存
  544. if (this.detailData.statusFlag == 1) {
  545. delete this.detailData.hyCarrierInfo.loadingAreaLongitude;
  546. delete this.detailData.hyCarrierInfo.loadingAreaLatitude;
  547. delete this.detailData.hyCarrierInfo.sendCity;
  548. delete this.detailData.hyCarrierInfo.sendArea;
  549. }
  550. uni.showLoading({
  551. title: '加载中'
  552. })
  553. let time = new Date() //装车时间 去当前时间的时分秒
  554. let h = time.getHours();
  555. if (h < 10) {
  556. h = "0" + h
  557. }
  558. let f = time.getMinutes();
  559. if (f < 10) {
  560. f = "0" + f
  561. }
  562. let m = time.getSeconds();
  563. if (m < 10) {
  564. m = "0" + m
  565. }
  566. var data={
  567. loadingImg:this.imgList.toString(),
  568. statusFlag:this.detailData.statusFlag,
  569. loadingDate:this.detailData.hyCarrierInfo.loadingDate.split(" ")[0] + " " + h + ":" + f + ":" + m,
  570. loadingArea:this.detailData.loadingArea,
  571. loadingCity:this.detailData.loadingCity,
  572. loadingLongitude:this.detailData.loadingLongitude,
  573. loadingLatitude:this.detailData.loadingLatitude,
  574. id:this.detailData.hyCarrierInfo.id
  575. }
  576. // console.log("查看id--------",this.detailData.hyCarrierInfo.id)
  577. this.$request.baseRequest('post', '/carrierInfo/loadingAdd', data).then(res => {
  578. if (res.code == 200) {
  579. uni.hideLoading()
  580. let _title = ''
  581. if (this.detailData.statusFlag == 1) {
  582. _title = '暂存成功!'
  583. } else {
  584. _title = '提交成功!'
  585. }
  586. that.$helper.fUN_AmapLocation.start({
  587. // intervalTime: 1000 * 60,
  588. intervalTime: 5000,
  589. // locationCacheEnable:true,
  590. isReport: false
  591. // url: 'http://192.168.0.66/fun/open/test_json.do',
  592. // params: {
  593. // a: 1,
  594. // B: '测试',
  595. // c: true
  596. // },
  597. // headers: {
  598. // a: '123',
  599. // B: 'abcd'
  600. // }
  601. },
  602. res => {
  603. // console.log('====确认装车开启连续定位====');
  604. // console.log(res)
  605. let _data = {
  606. orderId: that.id,
  607. longitude: res.longitude,
  608. latitude: res.latitude,
  609. province: res.province,
  610. city: res.city,
  611. area: res.district
  612. }
  613. this.$helper.gjList.push(_data)
  614. uni.setStorageSync('mapGJ', this.$helper.gjList);
  615. // console.log('this.$helper.gjList')
  616. // console.log(this.$helper.gjList)
  617. // console.log("条数", uni.getStorageSync('mapGJ').length)
  618. if (uni.getStorageSync('mapGJ').length > 100) {
  619. console.log(JSON.stringify(uni.getStorageSync('mapGJ')) )
  620. this.$request.baseRequest('post', '/hyOrderTravelPath/api/addInfo', {
  621. orderId:that.id,
  622. longitudeLatitude:JSON.stringify(uni.getStorageSync('mapGJ'))
  623. }).then(res => {
  624. uni.removeStorageSync('mapGJ');
  625. this.$helper.gjList = []
  626. })
  627. .catch(res => {
  628. uni.$u.toast(res.message);
  629. });
  630. }
  631. //判断缓存数据条数,超过reportInterval时清空缓存,重新存入缓存
  632. }
  633. );
  634. this.$refs.uToast.show({
  635. type: 'success',
  636. message: _title,
  637. complete() {
  638. uni.switchTab({
  639. url: '/pages/order/index'
  640. })
  641. }
  642. })
  643. }
  644. })
  645. .catch(res => {
  646. uni.$u.toast(res.message);
  647. });
  648. }
  649. },
  650. }
  651. </script>
  652. <style scoped lang="scss">
  653. .content {
  654. // . {
  655. // color: #333333;
  656. // }
  657. }
  658. .level2-title {
  659. margin: 0 0 20rpx 0;
  660. }
  661. .content1,
  662. .content2 {
  663. background: white;
  664. margin: 20rpx;
  665. border-radius: 20rpx;
  666. padding: 20rpx;
  667. .place {
  668. width: 80%;
  669. text-align: right;
  670. }
  671. }
  672. .upload {}
  673. .bottom-btn {
  674. display: flex;
  675. justify-content: space-around;
  676. margin-bottom: 50rpx;
  677. background: #FFFFFF;
  678. padding: 40rpx 0;
  679. }
  680. .store {
  681. padding: 20rpx 30rpx;
  682. color: #2772FB;
  683. width: 40%;
  684. background: #EEF4FF;
  685. border-radius: 40rpx;
  686. font-size: 36rpx;
  687. text-align: center;
  688. }
  689. .submit {
  690. font-size: 36rpx;
  691. padding: 20rpx 30rpx;
  692. color: white;
  693. width: 40%;
  694. background: #2772FB;
  695. border-radius: 40rpx;
  696. text-align: center;
  697. }
  698. .row-between {
  699. margin: 20rpx 0;
  700. }
  701. .sx-style {
  702. background: #2772FB;
  703. color: white;
  704. padding: 2rpx 16rpx;
  705. box-sizing: border-box;
  706. border-radius: 10rpx;
  707. margin-left: 20rpx;
  708. }
  709. .input {
  710. text-align: right;
  711. }
  712. .date-style {}
  713. </style>