confirmLoading.vue 16 KB

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