confirmLoading.vue 24 KB

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