| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481 |
- <template>
- <view>
- <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>
- <view >
- <uni-drawer ref="showLeft" mode="left" :width="250" @change="change($event,'showLeft')">
- <view class="contentInRowR" style="margin-top: 100rpx;margin-right: 16rpx;" @click="closeDrawer('showLeft')">
- <image style="width: 60rpx;height: 60rpx;" src="/static/imags/dache/dacha@3x.png" mode="scaleToFill"></image>
- </view>
- <view class="contentInRowL" style="margin-top: 20rpx;margin-bottom: 30rpx;margin-left: 30rpx;" @click="gotousercenter">
- <myImage class="iconImg" :isIcon="true" :mysrc="userInfo.avatar" mymode="scaleToFill"></myImage>
- <view class="contentColumn" style="padding-left: 20rpx;">
- <text class="nameText">{{userInfo.nickName}}</text>
- <text class="phoneText">{{userInfo.userName}}</text>
- </view>
- </view>
- <view class="contentInRowL drawerlist" @click="gotochezhurz(1)">
- <image class="drawerlistIcon" src="/static/imags/dache/sfcxl@3x.png" mode=""></image>
- <text class="drawerlisttext">{{$t('dache.fabushunfc')}}</text>
- </view>
- <view class="contentInRowL drawerlist" @click="gotochezhurz(2)">
- <image class="drawerlistIcon" src="/static/imags/dache/qianbao@3x.png" mode=""></image>
- <text class="drawerlisttext">{{$t('dache.qianbao')}}</text>
- </view>
- <view class="contentInRowL drawerlist" @click="gotochezhurz(3)">
- <image class="drawerlistIcon" src="/static/imags/dache/rzxx@3x.png" mode=""></image>
- <text class="drawerlisttext">{{$t('dache.renzhengxx')}}</text>
- </view>
- <view class="contentInRowL drawerlist" @click="gotochezhurz(5)">
- <image class="drawerlistIcon" src="/static/imags/dache/kfzx@3x.png" mode=""></image>
- <text class="drawerlisttext">我的订单</text>
- </view>
- <view class="contentInRowL drawerlist" @click="gotochezhurz(4)">
- <image class="drawerlistIcon" src="/static/imags/dache/kfzx@3x.png" mode=""></image>
- <text class="drawerlisttext">{{$t('user.kefuzhongxin')}}</text>
- </view>
- </uni-drawer>
- </view>
- <view v-if="orderList.length==0" class="contentColumnC" @click="gotochezhurz(3)">
- <image class="weishimingImage" src="/static/imags/dingdan.png" mode="widthFix"></image>
- <!-- <text class="meiyouText">{{$t('dache.yaoqingcwcz')}}</text> -->
- <text class="meiyouDDText">{{$t('order.dangqmydd')}}</text>
- </view>
- <view v-if="zhengzfuw!=0" class="contentColumnC" style="margin-top: 40rpx;margin-bottom: 40rpx;">
- <view class="contentInRowS zhengzaijdV" @click="zhengzaifwdd">
- <view class="contentColumn">
- <text class="zhengzaijdT">{{$t('dache.zhengzjsdd')}}</text>
- <text class="zhengzaijdD">{{$t('dache.tongshiyigedd')}}</text>
- </view>
- <image style="width: 46rpx;height: 46rpx;" src="/static/imags/fanhui1@3x.png" mode="scaleToFill"></image>
- </view>
- </view>
- <view class="contentColumnC" v-for="(item,index) in orderList">
- <view class="contentColumnC ItemcentianV">
- <view class="contentInRowS" style="width: 100%;" @click="chakanditu(item)">
- <view class="contentInRowC sstibjv">
- <text class="shishiT">{{$t('dache.shishi')}}</text>
- </view>
- <view class="contentInRowR" style="align-items: center;">
- <text style="color: darkgray;font-size: 28rpx;">{{$t('dache.chakandit')}}</text>
- <image style="width: 30rpx;height: 30rpx;margin-right: 30rpx;" src="/static/imags/youjian@3x.png" mode="scaleToFill"></image>
- </view>
- </view>
- <view class="contentInRowS ItemmsgL" @click="chakanditu(item)">
- <view class="contentColumnC">
- <view class="contentInRowL">
- <text style="font-size: 40rpx;color:#1A1A1A;font-weight: bold;">{{item.distance}}</text>
- <text style="font-size: 28rpx;color:#1A1A1A;padding-top: 16rpx;">Km</text>
- </view>
- <text style="font-size: 28rpx;color:#1A1A1A;">{{$t('dache.quancheng')}}</text>
- </view>
- <!-- <view class="contentColumnC">
- <view class="contentInRowL">
- <text style="font-size: 40rpx;color:#1A1A1A;font-weight: bold;">10.3</text>
- <text style="font-size: 28rpx;color:#1A1A1A;padding-top: 16rpx;">Km</text>
- </view>
- <text style="font-size: 28rpx;color:#1A1A1A;">{{$t('dache.jiejiajuli')}}</text>
- </view> -->
- <view class="contentColumnC">
- <view class="contentInRowL">
- <text style="font-size: 40rpx;color:#E86E48;font-weight: bold;">{{item.amount}}</text>
- <text style="font-size: 28rpx;color:#E86E48;padding-top: 16rpx;">{{$t('api.huobidanwei')}}</text>
- </view>
- <text style="font-size: 28rpx;color:#E86E48;">{{$t('dache.yugudingdje')}}</text>
- </view>
-
- </view>
- <view class="contentInRowS ItemmsgL" style="margin-bottom: 20rpx;">
- <view class="contentColumn">
- <view class="contentInRowL" style="align-items: center;width:560rpx;">
- <text style="width: 16rpx;height: 16rpx;background-color:#54B798;"></text>
- <text class="text2row" style="font-size: 28rpx;color:#1A1A1A;padding-left: 6rpx;width: 520rpx;">{{item.boardingAddress}}</text>
- </view>
- <view class="contentInRowL" style="align-items: center;width:560rpx;">
- <text style="width: 16rpx;height: 16rpx;background-color:#E86E48;"></text>
- <text class="text2row" style="font-size: 28rpx;color:#1A1A1A;padding-left: 6rpx;width: 520rpx;">{{item.downAddress}}</text>
- </view>
- </view>
- <view class="contentInRowR" style="width: 140rpx;">
- <text class="qushcBt" @click="qiangdan(item)">{{$t('order.qiangdan')}}</text>
- </view>
- </view>
- </view>
- </view>
- </view>
- </template>
- <script>
- import api from "@/pages/api/api.js"
- export default {
- data() {
- return {
- showLeft: false,
- userInfo:'',
- latitude: 22.84585,
- longitude:108.324762,
- page:1,
- orderList:[],
- zhengzfuw:0,
- timer:null
- }
- },
- onLoad() {
- this.userInfo = uni.getStorageSync('userInfo');
- console.log(this.userInfo);
- },
- onShow() {
- this.gotoLocat();
- this.getOrderlist();
- this.timerAct();
- },
- onHide() {
- this.clearTimer();
- },
- methods: {
- navbarsel(index){
- this.$refs.showLeft.open()
- },
- closeDrawer(e){
- this.$refs[e].close()
- },
- // 抽屉状态发生变化触发
- change(e, type) {
- //console.log((type === 'showLeft' ? '左窗口' : '右窗口') + (e ? '打开' : '关闭'));
- this[type] = e
- },
- gotoLocat(){
- var that = this;
- uni.getLocation({
- type: "wgs84", //默认为 wgs84 返回 gps 坐标//谷歌地图使用 wgs84 坐标,其他地图使用 gcj02 坐标
- geocode: "true",
- isHighAccuracy: "true",
- accuracy: "best", // 精度值为20m
- success: function (res) {
- console.log(res);
- that.latitude = res.latitude;
- that.longitude = res.longitude;
- that.getFjorder();
- },
- fail(err) {
- console.log('--------getLocation',err)
- }
- });
- },
- timerAct(){
- this.clearTimer();
- var that = this;
- that.timer = setInterval(() => {
- //console.log('setInterval',that.toptableindex)
- that.getFjorder();
- }, 20000);
- },
- clearTimer() {
- // clearTime
- if (this.timer) {
- clearInterval(this.timer);
- this.timer = null;
- }
- },
- gotousercenter(){
- uni.navigateTo({
- url:'/pages/user/UserCenter'
- })
- },
- gotochezhurz(index){
- if(index==2){
- uni.navigateTo({
- url:'/pages/dache/kehuheyh/Qianbao'
- })
- }
- if(index==3){
- uni.navigateTo({
- url:'/pages/dache/Chezhurenzheng?state='+index
- })
- }
- if(index==4){//客服电话
-
- }
- if(index==5){//我的订单
- uni.navigateTo({
- url:'/pages/dache/kehuheyh/MyorderList'
- })
- }
- },
- chakanditu(obj){
- if(this.zhengzfuw!=0){
- uni.showToast({
- title:'上单未完成',//that.i18n('api.wangluoshibai'),
- icon: 'none',
- duration: 2500
- })
- return;
- }
- uni.setStorageSync('TaxiOrder',obj);
- uni.navigateTo({
- url:'/pages/dache/Chakanditu'
- })
- },
- zhengzaifwdd(){
- uni.navigateTo({
- url:'/pages/dache/Zhengzaijiesong'
- })
- },
- qiangdan(obj){
- if(this.zhengzfuw!=0){
- uni.showToast({
- title:'上单未完成',//that.i18n('api.wangluoshibai'),
- icon: 'none',
- duration: 2500
- })
- return;
- }
- var data={
- id:obj.id,
- state:1,
- driverId:this.userInfo.userId
- }
- this.SetTxorder(data,obj);
- },
- //net work ----------------------------
- getFjorder(){
- api('getFjorder',{
- page:1,
- juli:20,
- latitude:this.latitude,
- longitude:this.longitude
- },res=>{
- console.log('getFjorder-------',res)
- if(res.data.code==200){
- this.orderList= res.data.data;
- }
- else{
- uni.showToast({
- title:'获取列表失败',//that.i18n('api.wangluoshibai'),
- icon: 'none',
- duration: 2500
- })
- }
- },failc=>{
- //console.log('getTaxiPrices----',failc)
- uni.showToast({
- title:'网络错误',//that.i18n('api.wangluoshibai'),
- icon: 'none',
- duration: 2500
- })
- })
- },
- SetTxorder(data,obj){
- api('SetTxorder',data,res=>{
- console.log('SetTxorder------',res)
- if(res.data.code==200){
- obj.state=1;
- uni.setStorageSync('TaxiOrder',obj);
- uni.setStorageSync('dachexiaoxi','');
- this.pushMsg(obj.user.cid,this.userInfo.phone,'司机接单了');
- setTimeout(()=>{
- uni.navigateTo({
- url:'/pages/dache/Zhengzaijiesong'
- });
- },1000);
- }
- else{
- uni.showToast({
- title:'抢单失败',//that.i18n('api.wangluoshibai'),
- icon: 'none',
- duration: 2500
- })
- }
- },failc=>{
- //console.log('getTaxiPrices----',failc)
- uni.showToast({
- title:'网络错误',//that.i18n('api.wangluoshibai'),
- icon: 'none',
- duration: 2500
- })
- })
- },
- getOrderlist(){
- console.log('-----getOrderlist')
- api('getUsTxorder',{
- page:1,
- size:20,
- state:'',
- type:1
- },res=>{
- console.log('getUsTxorder-------',res)
- if(res.data.code==200){
- for(var i=0;i<res.data.data.length;i++){
- var tempObj = res.data.data[i];
- if(tempObj.state<3){
- this.zhengzfuw=1;
- uni.setStorageSync('TaxiOrder',tempObj);
- return;
- }
- }
- }
- else{
- uni.showToast({
- title:'获取列表失败',//that.i18n('api.wangluoshibai'),
- icon: 'none',
- duration: 2500
- })
- }
- },failc=>{
- //console.log('getTaxiPrices----',failc)
- uni.showToast({
- title:'网络错误',//that.i18n('api.wangluoshibai'),
- icon: 'none',
- duration: 2500
- })
- })
- },
- pushMsg(cid,phone,msg){//消息推送
- var time=new Date();
- var n,y,r,h,m,s;
- n=time.getFullYear();
- y=time.getMonth()+1;
- r=time.getDate();
- h=time.getHours();
- m=time.getMinutes();
- s=time.getSeconds();
-
- var timsStr = n+'-'+y+'-'+r+' '+h+':'+m+':'+s;
- var payloadData={
- rcuser:'尾号:'+phone.slice(-4),
- time:timsStr,
- msg:msg,
- type:2
- }
- api('pushMsgYH',{
- cid:cid,
- title:'您有新消息了',
- content:msg,
- payload:payloadData
- },res=>{
- console.log(res)
- },failc=>{
- //console.log('getadvertis----',failc)
- })
- },
- },
- onNavigationBarButtonTap(e) {
- if (this.showLeft) {
- this.$refs.showLeft.close()
- } else {
- this.$refs.showLeft.open()
- }
- },
- // app端拦截返回事件 ,仅app端生效
- onBackPress() {
- if (this.showLeft) {
- this.$refs.showLeft.close()
- return true
- }
- },
- }
- </script>
- <style lang="scss">
- @import '@/common/common.scss';
- page{
- background-color: #F4F4F4;
- }
- .iconImg{
- margin-top: 20rpx;
- margin-bottom: 20rpx;
- width: 110rpx;
- height: 110rpx;
- border-radius: 55rpx;
- background-color: #1A1A1A;
- }
- .nameText{
- font-size: 32rpx;
- color: black;
- }
- .phoneText{
- font-size: 26rpx;
- color: black;
- }
- .drawerlist{
- width: 100%;
- height: 100rpx;
- align-items: center;
- border: solid lavender;
- border-width: 0px 0px 1rpx 0px;
- }
- .drawerlistIcon{
- padding-left: 30rpx;
- width: 60rpx;
- height: 60rpx;
- }
- .drawerlisttext{
- font-size: 26rpx;
- padding-left: 8rpx;
- }
- .weishimingImage{
- width: 30%;
- margin-top: 80rpx;
- }
- .meiyouText{
- margin-top: 20rpx;
- font-size: 32rpx;
- font-weight: bold;
- color:darkmagenta;
- }
- .meiyouDDText{
- margin-top: 20rpx;
- font-size: 32rpx;
- font-weight: bold;
- color:#1A1A1A;
- }
- .zhengzaijdV{
- border-radius: 20rpx;
- padding: 16rpx;
- width: 90%;
- background-color: #E86E48;
- }
- .zhengzaijdT{
- font-size: 32rpx;
- font-weight: bold;
- color:white;
- }
- .zhengzaijdD{
- font-size: 28rpx;
- color:lightgrey;
- }
- .ItemcentianV{
- margin-top: 20rpx;
- margin-bottom: 10rpx;
- width: 100%;
- background-color: white;
- border-radius: 20rpx;
- }
- .ItemmsgL{
- margin-top: 30rpx;
- width: 90%;
- }
- .sstibjv{
- min-width: 100rpx;
- height: 50rpx;
- background-size: 100% 100%;
- background-image: url('/static/imags/dache/ssbj@3x.png');
- }
- .shishiT{
- padding-left: 4rpx;
- padding-right: 4rpx;
- font-size: 24rpx;
- color: white;
- }
- .qushcBt{
- font-size: 32rpx;
- font-weight: bold;
- color: white;
- line-height: 60rpx;
- border-radius: 30rpx;
- padding-left: 22rpx;
- padding-right: 22rpx;
- text-align: center;
- background-color: #E86E48;
- }
- </style>
|