Dachedingdan.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481
  1. <template>
  2. <view>
  3. <customNav :shownav="true" rightBTimg1="/static/imags/dache/546@3x.png" :title="$t('order.xinrenwu')" tinColor="white" jiantou="1" rightBT1="1" v-on:Enavbarsel="navbarsel"></customNav>
  4. <view >
  5. <uni-drawer ref="showLeft" mode="left" :width="250" @change="change($event,'showLeft')">
  6. <view class="contentInRowR" style="margin-top: 100rpx;margin-right: 16rpx;" @click="closeDrawer('showLeft')">
  7. <image style="width: 60rpx;height: 60rpx;" src="/static/imags/dache/dacha@3x.png" mode="scaleToFill"></image>
  8. </view>
  9. <view class="contentInRowL" style="margin-top: 20rpx;margin-bottom: 30rpx;margin-left: 30rpx;" @click="gotousercenter">
  10. <myImage class="iconImg" :isIcon="true" :mysrc="userInfo.avatar" mymode="scaleToFill"></myImage>
  11. <view class="contentColumn" style="padding-left: 20rpx;">
  12. <text class="nameText">{{userInfo.nickName}}</text>
  13. <text class="phoneText">{{userInfo.userName}}</text>
  14. </view>
  15. </view>
  16. <view class="contentInRowL drawerlist" @click="gotochezhurz(1)">
  17. <image class="drawerlistIcon" src="/static/imags/dache/sfcxl@3x.png" mode=""></image>
  18. <text class="drawerlisttext">{{$t('dache.fabushunfc')}}</text>
  19. </view>
  20. <view class="contentInRowL drawerlist" @click="gotochezhurz(2)">
  21. <image class="drawerlistIcon" src="/static/imags/dache/qianbao@3x.png" mode=""></image>
  22. <text class="drawerlisttext">{{$t('dache.qianbao')}}</text>
  23. </view>
  24. <view class="contentInRowL drawerlist" @click="gotochezhurz(3)">
  25. <image class="drawerlistIcon" src="/static/imags/dache/rzxx@3x.png" mode=""></image>
  26. <text class="drawerlisttext">{{$t('dache.renzhengxx')}}</text>
  27. </view>
  28. <view class="contentInRowL drawerlist" @click="gotochezhurz(5)">
  29. <image class="drawerlistIcon" src="/static/imags/dache/kfzx@3x.png" mode=""></image>
  30. <text class="drawerlisttext">我的订单</text>
  31. </view>
  32. <view class="contentInRowL drawerlist" @click="gotochezhurz(4)">
  33. <image class="drawerlistIcon" src="/static/imags/dache/kfzx@3x.png" mode=""></image>
  34. <text class="drawerlisttext">{{$t('user.kefuzhongxin')}}</text>
  35. </view>
  36. </uni-drawer>
  37. </view>
  38. <view v-if="orderList.length==0" class="contentColumnC" @click="gotochezhurz(3)">
  39. <image class="weishimingImage" src="/static/imags/dingdan.png" mode="widthFix"></image>
  40. <!-- <text class="meiyouText">{{$t('dache.yaoqingcwcz')}}</text> -->
  41. <text class="meiyouDDText">{{$t('order.dangqmydd')}}</text>
  42. </view>
  43. <view v-if="zhengzfuw!=0" class="contentColumnC" style="margin-top: 40rpx;margin-bottom: 40rpx;">
  44. <view class="contentInRowS zhengzaijdV" @click="zhengzaifwdd">
  45. <view class="contentColumn">
  46. <text class="zhengzaijdT">{{$t('dache.zhengzjsdd')}}</text>
  47. <text class="zhengzaijdD">{{$t('dache.tongshiyigedd')}}</text>
  48. </view>
  49. <image style="width: 46rpx;height: 46rpx;" src="/static/imags/fanhui1@3x.png" mode="scaleToFill"></image>
  50. </view>
  51. </view>
  52. <view class="contentColumnC" v-for="(item,index) in orderList">
  53. <view class="contentColumnC ItemcentianV">
  54. <view class="contentInRowS" style="width: 100%;" @click="chakanditu(item)">
  55. <view class="contentInRowC sstibjv">
  56. <text class="shishiT">{{$t('dache.shishi')}}</text>
  57. </view>
  58. <view class="contentInRowR" style="align-items: center;">
  59. <text style="color: darkgray;font-size: 28rpx;">{{$t('dache.chakandit')}}</text>
  60. <image style="width: 30rpx;height: 30rpx;margin-right: 30rpx;" src="/static/imags/youjian@3x.png" mode="scaleToFill"></image>
  61. </view>
  62. </view>
  63. <view class="contentInRowS ItemmsgL" @click="chakanditu(item)">
  64. <view class="contentColumnC">
  65. <view class="contentInRowL">
  66. <text style="font-size: 40rpx;color:#1A1A1A;font-weight: bold;">{{item.distance}}</text>
  67. <text style="font-size: 28rpx;color:#1A1A1A;padding-top: 16rpx;">Km</text>
  68. </view>
  69. <text style="font-size: 28rpx;color:#1A1A1A;">{{$t('dache.quancheng')}}</text>
  70. </view>
  71. <!-- <view class="contentColumnC">
  72. <view class="contentInRowL">
  73. <text style="font-size: 40rpx;color:#1A1A1A;font-weight: bold;">10.3</text>
  74. <text style="font-size: 28rpx;color:#1A1A1A;padding-top: 16rpx;">Km</text>
  75. </view>
  76. <text style="font-size: 28rpx;color:#1A1A1A;">{{$t('dache.jiejiajuli')}}</text>
  77. </view> -->
  78. <view class="contentColumnC">
  79. <view class="contentInRowL">
  80. <text style="font-size: 40rpx;color:#E86E48;font-weight: bold;">{{item.amount}}</text>
  81. <text style="font-size: 28rpx;color:#E86E48;padding-top: 16rpx;">{{$t('api.huobidanwei')}}</text>
  82. </view>
  83. <text style="font-size: 28rpx;color:#E86E48;">{{$t('dache.yugudingdje')}}</text>
  84. </view>
  85. </view>
  86. <view class="contentInRowS ItemmsgL" style="margin-bottom: 20rpx;">
  87. <view class="contentColumn">
  88. <view class="contentInRowL" style="align-items: center;width:560rpx;">
  89. <text style="width: 16rpx;height: 16rpx;background-color:#54B798;"></text>
  90. <text class="text2row" style="font-size: 28rpx;color:#1A1A1A;padding-left: 6rpx;width: 520rpx;">{{item.boardingAddress}}</text>
  91. </view>
  92. <view class="contentInRowL" style="align-items: center;width:560rpx;">
  93. <text style="width: 16rpx;height: 16rpx;background-color:#E86E48;"></text>
  94. <text class="text2row" style="font-size: 28rpx;color:#1A1A1A;padding-left: 6rpx;width: 520rpx;">{{item.downAddress}}</text>
  95. </view>
  96. </view>
  97. <view class="contentInRowR" style="width: 140rpx;">
  98. <text class="qushcBt" @click="qiangdan(item)">{{$t('order.qiangdan')}}</text>
  99. </view>
  100. </view>
  101. </view>
  102. </view>
  103. </view>
  104. </template>
  105. <script>
  106. import api from "@/pages/api/api.js"
  107. export default {
  108. data() {
  109. return {
  110. showLeft: false,
  111. userInfo:'',
  112. latitude: 22.84585,
  113. longitude:108.324762,
  114. page:1,
  115. orderList:[],
  116. zhengzfuw:0,
  117. timer:null
  118. }
  119. },
  120. onLoad() {
  121. this.userInfo = uni.getStorageSync('userInfo');
  122. console.log(this.userInfo);
  123. },
  124. onShow() {
  125. this.gotoLocat();
  126. this.getOrderlist();
  127. this.timerAct();
  128. },
  129. onHide() {
  130. this.clearTimer();
  131. },
  132. methods: {
  133. navbarsel(index){
  134. this.$refs.showLeft.open()
  135. },
  136. closeDrawer(e){
  137. this.$refs[e].close()
  138. },
  139. // 抽屉状态发生变化触发
  140. change(e, type) {
  141. //console.log((type === 'showLeft' ? '左窗口' : '右窗口') + (e ? '打开' : '关闭'));
  142. this[type] = e
  143. },
  144. gotoLocat(){
  145. var that = this;
  146. uni.getLocation({
  147. type: "wgs84", //默认为 wgs84 返回 gps 坐标//谷歌地图使用 wgs84 坐标,其他地图使用 gcj02 坐标
  148. geocode: "true",
  149. isHighAccuracy: "true",
  150. accuracy: "best", // 精度值为20m
  151. success: function (res) {
  152. console.log(res);
  153. that.latitude = res.latitude;
  154. that.longitude = res.longitude;
  155. that.getFjorder();
  156. },
  157. fail(err) {
  158. console.log('--------getLocation',err)
  159. }
  160. });
  161. },
  162. timerAct(){
  163. this.clearTimer();
  164. var that = this;
  165. that.timer = setInterval(() => {
  166. //console.log('setInterval',that.toptableindex)
  167. that.getFjorder();
  168. }, 20000);
  169. },
  170. clearTimer() {
  171. // clearTime
  172. if (this.timer) {
  173. clearInterval(this.timer);
  174. this.timer = null;
  175. }
  176. },
  177. gotousercenter(){
  178. uni.navigateTo({
  179. url:'/pages/user/UserCenter'
  180. })
  181. },
  182. gotochezhurz(index){
  183. if(index==2){
  184. uni.navigateTo({
  185. url:'/pages/dache/kehuheyh/Qianbao'
  186. })
  187. }
  188. if(index==3){
  189. uni.navigateTo({
  190. url:'/pages/dache/Chezhurenzheng?state='+index
  191. })
  192. }
  193. if(index==4){//客服电话
  194. }
  195. if(index==5){//我的订单
  196. uni.navigateTo({
  197. url:'/pages/dache/kehuheyh/MyorderList'
  198. })
  199. }
  200. },
  201. chakanditu(obj){
  202. if(this.zhengzfuw!=0){
  203. uni.showToast({
  204. title:'上单未完成',//that.i18n('api.wangluoshibai'),
  205. icon: 'none',
  206. duration: 2500
  207. })
  208. return;
  209. }
  210. uni.setStorageSync('TaxiOrder',obj);
  211. uni.navigateTo({
  212. url:'/pages/dache/Chakanditu'
  213. })
  214. },
  215. zhengzaifwdd(){
  216. uni.navigateTo({
  217. url:'/pages/dache/Zhengzaijiesong'
  218. })
  219. },
  220. qiangdan(obj){
  221. if(this.zhengzfuw!=0){
  222. uni.showToast({
  223. title:'上单未完成',//that.i18n('api.wangluoshibai'),
  224. icon: 'none',
  225. duration: 2500
  226. })
  227. return;
  228. }
  229. var data={
  230. id:obj.id,
  231. state:1,
  232. driverId:this.userInfo.userId
  233. }
  234. this.SetTxorder(data,obj);
  235. },
  236. //net work ----------------------------
  237. getFjorder(){
  238. api('getFjorder',{
  239. page:1,
  240. juli:20,
  241. latitude:this.latitude,
  242. longitude:this.longitude
  243. },res=>{
  244. console.log('getFjorder-------',res)
  245. if(res.data.code==200){
  246. this.orderList= res.data.data;
  247. }
  248. else{
  249. uni.showToast({
  250. title:'获取列表失败',//that.i18n('api.wangluoshibai'),
  251. icon: 'none',
  252. duration: 2500
  253. })
  254. }
  255. },failc=>{
  256. //console.log('getTaxiPrices----',failc)
  257. uni.showToast({
  258. title:'网络错误',//that.i18n('api.wangluoshibai'),
  259. icon: 'none',
  260. duration: 2500
  261. })
  262. })
  263. },
  264. SetTxorder(data,obj){
  265. api('SetTxorder',data,res=>{
  266. console.log('SetTxorder------',res)
  267. if(res.data.code==200){
  268. obj.state=1;
  269. uni.setStorageSync('TaxiOrder',obj);
  270. uni.setStorageSync('dachexiaoxi','');
  271. this.pushMsg(obj.user.cid,this.userInfo.phone,'司机接单了');
  272. setTimeout(()=>{
  273. uni.navigateTo({
  274. url:'/pages/dache/Zhengzaijiesong'
  275. });
  276. },1000);
  277. }
  278. else{
  279. uni.showToast({
  280. title:'抢单失败',//that.i18n('api.wangluoshibai'),
  281. icon: 'none',
  282. duration: 2500
  283. })
  284. }
  285. },failc=>{
  286. //console.log('getTaxiPrices----',failc)
  287. uni.showToast({
  288. title:'网络错误',//that.i18n('api.wangluoshibai'),
  289. icon: 'none',
  290. duration: 2500
  291. })
  292. })
  293. },
  294. getOrderlist(){
  295. console.log('-----getOrderlist')
  296. api('getUsTxorder',{
  297. page:1,
  298. size:20,
  299. state:'',
  300. type:1
  301. },res=>{
  302. console.log('getUsTxorder-------',res)
  303. if(res.data.code==200){
  304. for(var i=0;i<res.data.data.length;i++){
  305. var tempObj = res.data.data[i];
  306. if(tempObj.state<3){
  307. this.zhengzfuw=1;
  308. uni.setStorageSync('TaxiOrder',tempObj);
  309. return;
  310. }
  311. }
  312. }
  313. else{
  314. uni.showToast({
  315. title:'获取列表失败',//that.i18n('api.wangluoshibai'),
  316. icon: 'none',
  317. duration: 2500
  318. })
  319. }
  320. },failc=>{
  321. //console.log('getTaxiPrices----',failc)
  322. uni.showToast({
  323. title:'网络错误',//that.i18n('api.wangluoshibai'),
  324. icon: 'none',
  325. duration: 2500
  326. })
  327. })
  328. },
  329. pushMsg(cid,phone,msg){//消息推送
  330. var time=new Date();
  331. var n,y,r,h,m,s;
  332. n=time.getFullYear();
  333. y=time.getMonth()+1;
  334. r=time.getDate();
  335. h=time.getHours();
  336. m=time.getMinutes();
  337. s=time.getSeconds();
  338. var timsStr = n+'-'+y+'-'+r+' '+h+':'+m+':'+s;
  339. var payloadData={
  340. rcuser:'尾号:'+phone.slice(-4),
  341. time:timsStr,
  342. msg:msg,
  343. type:2
  344. }
  345. api('pushMsgYH',{
  346. cid:cid,
  347. title:'您有新消息了',
  348. content:msg,
  349. payload:payloadData
  350. },res=>{
  351. console.log(res)
  352. },failc=>{
  353. //console.log('getadvertis----',failc)
  354. })
  355. },
  356. },
  357. onNavigationBarButtonTap(e) {
  358. if (this.showLeft) {
  359. this.$refs.showLeft.close()
  360. } else {
  361. this.$refs.showLeft.open()
  362. }
  363. },
  364. // app端拦截返回事件 ,仅app端生效
  365. onBackPress() {
  366. if (this.showLeft) {
  367. this.$refs.showLeft.close()
  368. return true
  369. }
  370. },
  371. }
  372. </script>
  373. <style lang="scss">
  374. @import '@/common/common.scss';
  375. page{
  376. background-color: #F4F4F4;
  377. }
  378. .iconImg{
  379. margin-top: 20rpx;
  380. margin-bottom: 20rpx;
  381. width: 110rpx;
  382. height: 110rpx;
  383. border-radius: 55rpx;
  384. background-color: #1A1A1A;
  385. }
  386. .nameText{
  387. font-size: 32rpx;
  388. color: black;
  389. }
  390. .phoneText{
  391. font-size: 26rpx;
  392. color: black;
  393. }
  394. .drawerlist{
  395. width: 100%;
  396. height: 100rpx;
  397. align-items: center;
  398. border: solid lavender;
  399. border-width: 0px 0px 1rpx 0px;
  400. }
  401. .drawerlistIcon{
  402. padding-left: 30rpx;
  403. width: 60rpx;
  404. height: 60rpx;
  405. }
  406. .drawerlisttext{
  407. font-size: 26rpx;
  408. padding-left: 8rpx;
  409. }
  410. .weishimingImage{
  411. width: 30%;
  412. margin-top: 80rpx;
  413. }
  414. .meiyouText{
  415. margin-top: 20rpx;
  416. font-size: 32rpx;
  417. font-weight: bold;
  418. color:darkmagenta;
  419. }
  420. .meiyouDDText{
  421. margin-top: 20rpx;
  422. font-size: 32rpx;
  423. font-weight: bold;
  424. color:#1A1A1A;
  425. }
  426. .zhengzaijdV{
  427. border-radius: 20rpx;
  428. padding: 16rpx;
  429. width: 90%;
  430. background-color: #E86E48;
  431. }
  432. .zhengzaijdT{
  433. font-size: 32rpx;
  434. font-weight: bold;
  435. color:white;
  436. }
  437. .zhengzaijdD{
  438. font-size: 28rpx;
  439. color:lightgrey;
  440. }
  441. .ItemcentianV{
  442. margin-top: 20rpx;
  443. margin-bottom: 10rpx;
  444. width: 100%;
  445. background-color: white;
  446. border-radius: 20rpx;
  447. }
  448. .ItemmsgL{
  449. margin-top: 30rpx;
  450. width: 90%;
  451. }
  452. .sstibjv{
  453. min-width: 100rpx;
  454. height: 50rpx;
  455. background-size: 100% 100%;
  456. background-image: url('/static/imags/dache/ssbj@3x.png');
  457. }
  458. .shishiT{
  459. padding-left: 4rpx;
  460. padding-right: 4rpx;
  461. font-size: 24rpx;
  462. color: white;
  463. }
  464. .qushcBt{
  465. font-size: 32rpx;
  466. font-weight: bold;
  467. color: white;
  468. line-height: 60rpx;
  469. border-radius: 30rpx;
  470. padding-left: 22rpx;
  471. padding-right: 22rpx;
  472. text-align: center;
  473. background-color: #E86E48;
  474. }
  475. </style>