Zhengzaijiesong.nvue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510
  1. <template>
  2. <view>
  3. <customNav :shownav="true" :title="i18n('dache.zhengzaifuw')" tinColor="white" jiantou="1" rightBT1='1' rightBTimg1="/static/imags/dache/baojing@2x.png" v-on:Enavbarsel="navbarsel"></customNav>
  4. <view class="topfloatV">
  5. <view v-if="obj!=''" class="floatView">
  6. <view class="contentInRowS topnoteView">
  7. <view class="contentColumn" style="margin-left: 10rpx;margin-bottom: 10rpx;">
  8. <view class="contentInRowL" style="align-items: center;">
  9. <text class="noteTxtstB">去</text>
  10. <text class="noteTxtstY">{{obj.downAddress}}</text>
  11. </view>
  12. <text class="noteTxtstD">{{i18n('dache.quancheng')}}{{obj.distance}}Km {{obj.estimatedDuration}}</text>
  13. <text v-if="obj.state==1" class="noteTxtst">{{i18n('dache.chengkeshcd')}}</text>
  14. </view>
  15. <view class="contentColumnC">
  16. <uni-icons custom-prefix="custom-icon" color="#006AFF" type="navigate-filled" size="34"></uni-icons>
  17. <text style="font-size: 30rpx;">{{i18n('dache.daohang')}}</text>
  18. </view>
  19. </view>
  20. </view>
  21. </view>
  22. <!-- <view class="mapcontentV" :style="'height:'+mapHeight+'px;'">
  23. <map id="map" class="mapbody" scale="18" show-location="true" :style="'height:'+mapHeight+'px;'" :latitude="latitude" :longitude="longitude">
  24. </map>
  25. </view> -->
  26. <view class="" v-if="isShow">
  27. <web-view style="background-color: #fafafa;" ref="webview" :style="{ height: statusBarHeight + 'px' }" @onPostMessage="getMessage" :src="webUrl"></web-view>
  28. </view>
  29. <view class="bottomfloatV">
  30. <view v-if="obj!=''" class="floatView">
  31. <view class="contentInRowS rowContentVst">
  32. <view class="contentInRowL" style="align-items: center;">
  33. <view class="contentColumnC">
  34. <text style="padding-left: 16rpx;font-size: 38rpx;font-weight: bold;">{{obj.user.phone.slice(-4)}}</text>
  35. <text style="font-size: 30rpx;">{{i18n('dache.weihao')}}</text>
  36. </view>
  37. <view class="contentColumn" style="margin-left: 16rpx;">
  38. <view class="contentInRowL" style="align-items: center;">
  39. <text style="width: 16rpx;height: 16rpx;background-color:#54B798;"></text>
  40. <text class="addrTextst">{{obj.boardingAddress}}{{obj.boardingAddress}}{{obj.boardingAddress}}</text>
  41. </view>
  42. <view class="contentInRowL" style="align-items: center;">
  43. <text style="width: 16rpx;height: 16rpx;background-color:#E86E48;"></text>
  44. <text class="addrTextst">{{obj.downAddress}}</text>
  45. </view>
  46. </view>
  47. </view>
  48. <view class="contentInRowR">
  49. <image class="actImagevst" src="/static/imags/dache/msgcm@3x.png" mode="scaleToFill" @click="gotomsg"></image>
  50. <image class="actImagevst" src="/static/imags/dache/phonecall@3x.png" mode="scaleToFill" @click="callPhone(obj.user.phone)"></image>
  51. </view>
  52. </view>
  53. <view class="contentInRowC">
  54. <text v-if="obj.state==1" class="bottomBt" @click="luchengAct(1)">{{i18n('dache.jiedaochk')}}</text>
  55. <text v-if="obj.state==2" class="bottomBt" @click="luchengAct(2)">{{i18n('dache.daodajiesuan')}}</text>
  56. <text v-if="obj.state==3" class="bottomBt" >{{i18n('dache.daizhifu')}}</text>
  57. <text v-if="obj.state==4" class="bottomBt" @click="luchengAct(3)">{{i18n('dache.yizhifu')}}</text>
  58. </view>
  59. </view>
  60. </view>
  61. <uni-popup style="z-index: 9999;" ref="popMsg" type="center" :isMaskClick="true" :safeArea="true">
  62. <view class="contentColumnC popviewContent">
  63. <text style="text-align: center;font-size: 32rpx;margin-top: 80rpx;">弹框信息</text>
  64. <text class="querenBt" @click="popQueren">{{i18n('index.queren')}}</text>
  65. </view>
  66. </uni-popup>
  67. <uni-popup style="z-index: 9999;" ref="popBjsl" type="bottom" :isMaskClick="true" :safeArea="true">
  68. <view class="contentColumn popviewContentBJ">
  69. <view class="contentInRowS bottomLine" style="margin-top: 20rpx;">
  70. <text style="font-size: 32rpx;margin-left: 20rpx;">一键求助</text>
  71. <image style="width: 60rpx;height: 60rpx;margin-right: 20rpx;" src="/static/imags/dache/dacha@3x.png" mode="scaleToFill"></image>
  72. </view>
  73. <view class="contentInRowL bottomLine" style="height: 100rpx;align-items: center;">
  74. <image style="width: 60rpx;height: 60rpx;margin-left: 20rpx;" src="/static/imags/dache/baojing@2x.png" mode="scaleToFill"></image>
  75. <text style="font-size: 32rpx;margin-left: 20rpx;">一键报警</text>
  76. </view>
  77. <view class="contentInRowL bottomLine" style="height: 100rpx;align-items: center;">
  78. <image style="width: 60rpx;height: 60rpx;margin-left: 20rpx;" src="/static/imags/dache/kefu@2x.png" mode="scaleToFill"></image>
  79. <text style="font-size: 32rpx;margin-left: 20rpx;">一键联系客服</text>
  80. </view>
  81. <view class="contentInRowL bottomLine" style="height: 100rpx;align-items: center;">
  82. <image style="width: 60rpx;height: 60rpx;margin-left: 20rpx;" src="/static/imags/dache/liuyan@2x.png" mode="scaleToFill"></image>
  83. <text style="font-size: 32rpx;margin-left: 20rpx;">一键语音留言</text>
  84. </view>
  85. </view>
  86. </uni-popup>
  87. </view>
  88. </template>
  89. <script>
  90. import api from "@/pages/api/api.js"
  91. export default {
  92. data() {
  93. return {
  94. mapHeight:0,
  95. latitude: 22.84585,
  96. longitude:108.324762,
  97. mapContext:Object,
  98. obj:'',
  99. statusBarHeight: 0, //可视屏幕的高度
  100. webUrl: '',
  101. isShow: false,
  102. lat: '',
  103. lng: '',
  104. }
  105. },
  106. onLoad() {
  107. var info = uni.getSystemInfoSync();
  108. this.mapHeight=info.screenHeight;
  109. this.obj = uni.getStorageSync('TaxiOrder');
  110. console.log(this.obj);
  111. uni.onPushMessage((res) => {
  112. console.log('onPushMessage',res);
  113. if(null==res.data.payload||undefined==res.data.payload||''==res.data.payload){
  114. return;
  115. }
  116. this.getObjDetail(this.obj.id);
  117. });
  118. this.computedScreenHeight();
  119. // #ifdef APP-PLUS
  120. //this.getlocetion();
  121. // #endif
  122. // #ifdef H5
  123. this.lng = 113.64360881345777;
  124. this.lat = 34.738282020827825;
  125. //this.webUrl = '/hybrid/html/maps/mapindex.html?lat=' + this.lat + '&lng=' + this.lng+'&nlng=0&nlat=0';
  126. this.isShow = true;
  127. // #endif
  128. },
  129. onReady() {
  130. //this.mapContext = uni.createMapContext("map",this);
  131. console.log('---------1')
  132. // if(!this.isAndroid){
  133. // this.setCenter();
  134. // }
  135. if(this.obj.state==1){
  136. this.gotoLocat();
  137. }
  138. else{
  139. this.setRouteSN();
  140. }
  141. },
  142. methods: {
  143. i18n(str){
  144. return getApp().globalData.$t(str);
  145. },
  146. gotoLocat(){
  147. var that = this;
  148. uni.getLocation({
  149. type: "wgs84", //默认为 wgs84 返回 gps 坐标//谷歌地图使用 wgs84 坐标,其他地图使用 gcj02 坐标
  150. geocode: "true",
  151. isHighAccuracy: "true",
  152. accuracy: "best", // 精度值为20m
  153. success: function (res) {
  154. console.log(res);
  155. var latlon= res.latitude+','+res.longitude;
  156. that.movetoCenter(res.latitude,res.longitude,false);
  157. },
  158. fail(err) {
  159. console.log('--------getLocation',err)
  160. }
  161. });
  162. },
  163. movetoCenter(latitude,longitude,sLb){
  164. console.log(longitude)
  165. this.latitude=latitude;
  166. this.longitude=longitude;
  167. this.setRouteSN();
  168. },
  169. gotomsg(){
  170. uni.navigateTo({
  171. url:'/pages/dache/kehuheyh/Xiaoxijiaohu?id='+this.obj.id
  172. })
  173. },
  174. luchengAct(index){
  175. console.log('luchengAct')
  176. if(index==1){//接到乘客
  177. var data={
  178. id:this.obj.id,
  179. state:2,
  180. }
  181. this.SetTxorder(data,2);
  182. }
  183. else if(index==2){//到达目的地,发起收款
  184. var data={
  185. id:this.obj.id,
  186. state:3,
  187. }
  188. this.SetTxorder(data,3);
  189. }
  190. else if(index==3){
  191. uni.navigateBack();
  192. }
  193. },
  194. popQueren(){
  195. //this.$refs.popMsg.open('center');
  196. this.$refs.popMsg.close();
  197. },
  198. navbarsel(index){
  199. this.$refs.popBjsl.open('bottom');
  200. },
  201. callPhone(telphone){
  202. var that = this;
  203. uni.showModal({
  204. title: that.i18n('api.message'),
  205. content:that.i18n('api.nqdbddh'),
  206. confirmText:that.i18n('index.queren'),
  207. cancelText:that.i18n('index.quxiao'),
  208. success: function (res) {
  209. if (res.confirm) { //这里是点击了确定以后
  210. console.log('打电话')
  211. plus.device.dial(telphone, false );
  212. } else { //这里是点击了取消以后
  213. console.log('点击取消')
  214. }
  215. }
  216. })
  217. },
  218. //net work ---------------------------
  219. getObjDetail(id){
  220. api('getTxorder',{
  221. id:id,
  222. },res=>{
  223. console.log(res)
  224. if(res.data.code==200){
  225. this.obj=res.data.data;
  226. this.setRouteSN();
  227. }
  228. },failc=>{
  229. //console.log('getadvertis----',failc)
  230. })
  231. },
  232. SetTxorder(data,index){
  233. api('SetTxorder',data,res=>{
  234. console.log('SetTxorder------',res)
  235. if(res.data.code==200){
  236. this.obj.state=index;
  237. uni.setStorageSync('TaxiOrder',this.obj);
  238. uni.showToast({
  239. title:'修改成功',//that.i18n('api.wangluoshibai'),
  240. icon: 'none',
  241. duration: 2500
  242. })
  243. if(index==2){
  244. this.pushMsg(this.obj.user.cid,this.obj.user.phone,'乘客上车了');
  245. }
  246. else if(index==3){
  247. this.pushMsg(this.obj.user.cid,this.obj.user.phone,'发起结算');
  248. }
  249. this.getObjDetail(this.obj.id);
  250. }
  251. else{
  252. uni.showToast({
  253. title:'修改失败',//that.i18n('api.wangluoshibai'),
  254. icon: 'none',
  255. duration: 2500
  256. })
  257. }
  258. },failc=>{
  259. //console.log('getTaxiPrices----',failc)
  260. uni.showToast({
  261. title:'网络错误',//that.i18n('api.wangluoshibai'),
  262. icon: 'none',
  263. duration: 2500
  264. })
  265. })
  266. },
  267. pushMsg(cid,phone,msg){//消息推送
  268. var time=new Date();
  269. var n,y,r,h,m,s;
  270. n=time.getFullYear();
  271. y=time.getMonth()+1;
  272. r=time.getDate();
  273. h=time.getHours();
  274. m=time.getMinutes();
  275. s=time.getSeconds();
  276. var timsStr = n+'-'+y+'-'+r+' '+h+':'+m+':'+s;
  277. var payloadData={
  278. rcuser:'尾号:'+phone.slice(-4),
  279. time:timsStr,
  280. msg:msg,
  281. type:2
  282. }
  283. api('pushMsgYH',{
  284. cid:cid,
  285. title:'您有新消息了',
  286. content:msg,
  287. payload:payloadData
  288. },res=>{
  289. console.log(res)
  290. },failc=>{
  291. //console.log('getadvertis----',failc)
  292. })
  293. },
  294. //-----------------
  295. /**
  296. 设置起点和终点
  297. **/
  298. setRouteSN(){
  299. var slat,slng,nlat,nlng;
  300. if(this.obj.state==1){
  301. slat=this.latitude;
  302. slng=this.longitude;
  303. nlat=this.obj.intoLatitude;
  304. nlng=this.obj.intoLongitude;
  305. }
  306. else{
  307. slat=this.obj.intoLatitude;
  308. slng=this.obj.intoLongitude;
  309. nlat=this.obj.downLatitude;
  310. nlng=this.obj.downLongitude;
  311. }
  312. //this.webUrl = '/hybrid/html/maps/mapindex.html?lat='+slat+'&lng='+slng+'&nlat='+nlat+'&nlng='+nlng;
  313. this.isShow = true;
  314. },
  315. /**
  316. * 特别注意这里 nvue和vue页面 web-view---->vue ||nvue方式不一样 详情请查看官网 https://uniapp.dcloud.net.cn/component/web-view.html#web-view
  317. *
  318. * */
  319. getMessage(e) {
  320. console.log("--getMessage--",e.detail.data[0]);
  321. },
  322. // 计算屏幕的高度
  323. computedScreenHeight() {
  324. uni.getSystemInfo({
  325. success: function(e) {
  326. // #ifndef MP
  327. Vue.prototype.StatusBar = e.statusBarHeight;
  328. if (e.platform == 'android') {
  329. Vue.prototype.CustomBar = e.statusBarHeight + 50;
  330. } else {
  331. Vue.prototype.CustomBar = e.statusBarHeight + 45;
  332. }
  333. // #endif
  334. // #ifdef MP-WEIXIN
  335. Vue.prototype.StatusBar = e.statusBarHeight;
  336. let custom = wx.getMenuButtonBoundingClientRect();
  337. Vue.prototype.Custom = custom;
  338. Vue.prototype.CustomBar = custom.bottom + custom.top - e.statusBarHeight;
  339. // #endif
  340. // #ifdef MP-ALIPAY
  341. Vue.prototype.StatusBar = e.statusBarHeight;
  342. Vue.prototype.CustomBar = e.statusBarHeight + e.titleBarHeight;
  343. // #endif
  344. let unitRatio = 750 / uni.getSystemInfoSync().windowWidth;
  345. Vue.prototype.StatusBarRpx = Vue.prototype.StatusBar * unitRatio;
  346. Vue.prototype.CustomBarRpx = Vue.prototype.CustomBar * unitRatio;
  347. Vue.prototype.unitRatio = unitRatio;
  348. Vue.mixin({
  349. data() {
  350. return {
  351. StatusBar: Vue.prototype.StatusBar, //状态栏高度(px)
  352. CustomBar: Vue.prototype.CustomBar, //整个标题栏高度(px)
  353. StatusBarRpx: Vue.prototype.StatusBarRpx, //状态栏高度(rpx)
  354. CustomBarRpx: Vue.prototype.CustomBarRpx //整个标题栏高度(rpx)
  355. };
  356. }
  357. });
  358. }
  359. });
  360. // 状态栏高度 导航高度 tab切换的高度 底部导航的高度
  361. this.statusBarHeight = uni.getSystemInfoSync().screenHeight;
  362. },
  363. },
  364. }
  365. </script>
  366. <style lang="scss">
  367. .mapbody{
  368. position: absolute;
  369. width: 750rpx;
  370. }
  371. .mapcontentV{
  372. position: absolute;
  373. width: 750rpx;
  374. background-color:deeppink;
  375. }
  376. .topnoteView{
  377. margin-top: 12rpx;
  378. width: 680rpx;
  379. }
  380. .noteTxtstB{
  381. font-size: 40rpx;
  382. font-weight: bold;
  383. color: #1A1A1A;
  384. }
  385. .noteTxtstY{
  386. font-size: 38rpx;
  387. color: #E86E48;
  388. width: 540rpx;
  389. }
  390. .noteTxtstD{
  391. font-size: 30rpx;
  392. color: darkgray;
  393. }
  394. .noteTxtst{
  395. font-size: 30rpx;
  396. padding-bottom: 30rpx;
  397. }
  398. .floatView{
  399. display: flex;
  400. flex-direction: column;
  401. width: 700rpx;
  402. background-color: white;
  403. border-radius: 20rpx;
  404. }
  405. .topfloatV{
  406. position: fixed;
  407. flex-direction: column;
  408. justify-content: center;
  409. align-items: center;
  410. left: 0;
  411. right: 0;
  412. top: 220rpx;
  413. z-index: 999;
  414. }
  415. .bottomfloatV{
  416. position: fixed;
  417. flex-direction: column;
  418. justify-content: center;
  419. align-items: center;
  420. left: 0;
  421. right: 0;
  422. bottom: 80rpx;
  423. z-index: 999;
  424. }
  425. .rowContentVst{
  426. width: 660rpx;
  427. margin-top: 10rpx;
  428. padding-bottom: 10rpx;
  429. border-radius: 20rpx;
  430. border: solid lavender;
  431. border-width: 0px 0px 1rpx 0px;
  432. background-color: white;
  433. }
  434. .addrTextst{
  435. width: 340rpx;
  436. font-size: 28rpx;
  437. color:#1A1A1A;
  438. padding-left: 6rpx;
  439. }
  440. .actImagevst{
  441. width: 50rpx;
  442. height: 50rpx;
  443. margin-right: 20rpx;
  444. }
  445. .bottomBt{
  446. width:600rpx;
  447. text-align: center;
  448. line-height: 86rpx;
  449. font-size: 32rpx;
  450. font-weight: bold;
  451. color: white;
  452. border-radius: 20rpx;
  453. background-color: #E86E48;
  454. margin-top: 30rpx;
  455. margin-bottom: 30rpx;
  456. }
  457. .popviewContent{
  458. width:680rpx;
  459. background-color: white;
  460. border-radius: 10rpx;
  461. }
  462. .popviewContentBJ{
  463. width:750rpx;
  464. background-color: white;
  465. border-radius: 10rpx 10rpx 0rpx 0rpx;
  466. }
  467. .bottomLine{
  468. padding-bottom: 10rpx;
  469. border: solid lavender;
  470. border-width: 0px 0px 1rpx 0px;
  471. }
  472. .querenBt{
  473. margin-top: 30rpx;
  474. margin-bottom: 30rpx;
  475. font-size: 32rpx;
  476. font-weight: bold;
  477. width: 240rpx;
  478. line-height: 60rpx;
  479. border-radius: 30rpx;
  480. text-align: center;
  481. background-color: #E86E48;
  482. color: white;
  483. }
  484. </style>