Browse Source

Merge branch 'master' into jcatt

# Conflicts:
#	utils/request.js
twt 9 months ago
parent
commit
f29d8cd397
1 changed files with 126 additions and 26 deletions
  1. 126 26
      pages/rescue/rescueOrder.vue

+ 126 - 26
pages/rescue/rescueOrder.vue

@@ -28,27 +28,33 @@
 			</view>
 			<!-- 筛选框 -->
 			<view class="screen">
-			  <view class="screenLine">
+			  <view class="screenLine screenLine1" @click="ckShopAppFn">
 				  <!-- <span class="screenLineSpan">救援门店</span> -->
-				  <view class="">
+				 <!-- <view class="">
 					   <picker @change="bindPickerChange" :value="pickerindex" :range-key="'shopName'" :range="pickerarray">
 							<view class="screenLine"> 
 								<span class="screenLineSpan">救援门店</span>	
 								<img src="../../static/img/arrow_down.png" alt="" class="screenLineImg">
 							</view>
 					   </picker>
-				  </view>
+				  </view> -->
 				 
+				 	 <span class="screenLineSpan">{{shopName?shopName:'救援门店'}}</span>
+				<!-- 	<span class="screenLineSpan">连锁一号测试门店测试</span> -->
+				 	<img src="../../static/img/arrow_down.png" alt="" class="screenLineImg">
+				
 			  </view>
-			  <view class="screenLine" @click="orderTimesxSHow=true">
-				  <span class="screenLineSpan">下单时间</span>
+			  <view class="screenLine screenLine2" @click="cktimeFn">
+				 <!-- <span class="screenLineSpan">下单时间</span> -->
+				 <span class="screenLineSpan">{{date1}}-{{date2}}</span>
 				  <img src="../../static/img/arrow_down.png" alt="" class="screenLineImg">
 			  </view>
-			  <view class="screenLine" @click="typeSHow=true">
+			  <view class="screenLine screenLine3" @click="typeSHow=true">
 				  <span class="screenLineSpan">更多</span>
 				  <img src="../../static/img/arrow_down.png" alt="" class="screenLineImg">
 			  </view>
 			  <view class="orderTimesxBox" v-if="orderTimesxSHow">
+				  <view class="orderTimesxBoxTitle">下单时间</view>
 				  <view class="sdTimeBox">
 				   <picker mode="date" :value="date1"  @change="bindDateChange1">
 				  		<view class="dateinput">{{date1?date1:'选择日期'}}</view>
@@ -92,6 +98,7 @@
 		
 		
 		<view class="main">
+		<!-- 	<view>{{ms}}</view> -->
 			<view class="itemBg" v-for="(item,index) in items" @click="goDetail(item)">
 				<view class="itemTop">
 					<view class="itemType" >
@@ -138,11 +145,11 @@
 			  <view class="">
 			  	   <picker @change="bindPickerChange" :value="pickerindex" :range-key="'shopName'" :range="pickerarray">
 			  	 		<view class="uniPicker"> 
-			  							<view class="uniPickerName">
-			  							  {{shopName}}
-			  							</view>
-			  						   <image src="../../static/img/jt.png" mode=" " class="jtShopImg"></image>
-			  						</view>
+							<view class="uniPickerName">
+							  {{shopName}}
+							</view>
+						   <image src="../../static/img/jt.png" mode=" " class="jtShopImg"></image>
+						</view>
 			  	   </picker>
 			  </view>
 			  <view class="screenBt">救援时间</view>
@@ -181,6 +188,7 @@
 		},
 		data() {
 			return {
+				ms:'',
 				page: 1,
 				tabIndex: -1,
 				items: [],
@@ -217,23 +225,88 @@
 				orderTimesxSHow:false,
 				typeSHow:false,
 				iStatusBarHeight:'',
+				olddate1:'',
+				olddate2:'',
 			}
 		},
 		onLoad(opt) {
+			this.date1=this.time(new Date())
+			this.date2=this.time(new Date())
 			this.iStatusBarHeight = uni.getSystemInfoSync().statusBarHeight;
 			//this.getData();
 			this.getShopinfo();
+			//app交互
+			var standalone = window.navigator.standalone
+			var userAgent = window.navigator.userAgent.toLowerCase()
+			var safari = /safari/.test(userAgent)
+			var ios = /iphone|ipod|ipad|mac/.test(userAgent)
+			var android = /android/.test(userAgent)
+			if (ios) {
+				  window.shopAppCallbackios=this.shopAppCallbackios;
+			} else if (android) {
+				 window.shopAppCallback=this.shopAppCallback;
+			}
+			
 			
 		},
-		onShow() {
-			console.log(this.tabIndex)
-            this.getShopinfo();
+		 onShow() {
+			const onshow = uni.getStorageSync('onshow');
+			if(onshow==1){
+				  uni.removeStorageSync('onshow');
+				 // this.getShopinfo();
+				 this.getData()
+			}else{
+				
+			}
+          
 			//this.getData();
 			
 
-		},
+		}, 
 		
 		methods: {
+			cktimeFn(){
+				this.orderTimesxSHow=true
+				this.olddate1=this.date1
+				this.olddate2=this.date2
+			},
+			
+			ckShopAppFn(){
+				var obj={
+					value:this.mrshopId,
+					key:this.mrshopName
+				}
+				console.log(obj)
+				//app交互
+				var standalone = window.navigator.standalone
+				var userAgent = window.navigator.userAgent.toLowerCase()
+				var safari = /safari/.test(userAgent)
+				var ios = /iphone|ipod|ipad|mac/.test(userAgent)
+				var android = /android/.test(userAgent)
+				if (ios) {
+					 if ( true) {//!standalone&& !safari
+					   window.webkit.messageHandlers.shopApp.postMessage(JSON.stringify(obj))
+					 }
+				} else if (android) {
+					 window.android.shopApp(JSON.stringify(obj))
+				}
+			},
+			shopAppCallback(e){
+				//this.ms=e.key
+				//this.ms=JSON.parse(e).key
+			//	var obj=JSON.parse(e);
+				this.shopName=e.key
+				this.shopId=e.value
+				this.page=1
+				this.getData();
+			},
+			shopAppCallbackios(e){
+				var obj=JSON.parse(e);
+				this.shopName=obj.key
+				this.shopId=obj.value
+				this.page=1
+				this.getData();
+			},
 			orderTimesx(){
 				this.items=[]
 				this.orderTimesxSHow=false;
@@ -257,9 +330,11 @@
 			},
 			closeTime(){
 				this.orderTimesxSHow=false
-				this.date2=''
-				this.date1=''
-				this.getData();
+				this.date1=this.olddate1
+			    this.date2 =this.olddate2
+				/* this.date2=''
+				this.date1='' */
+				//this.getData();
 			},
 			sub(){
 				this.screenSHow=false;
@@ -276,8 +351,8 @@
 				this.getData();
 			},
 			resetting(){
-				this.date1='';
-				this.date2='';
+				this.date1=this.time(new Date())
+				this.date2=this.time(new Date())
 				this.typeLineIndex='';
 				this.shopName=this.mrshopName;
 				this.shopId=this.mrshopId;
@@ -372,11 +447,11 @@
 					var ios = /iphone|ipod|ipad|mac/.test(userAgent)
 					var android = /android/.test(userAgent)
 					if (ios) {
-									 if ( true) {//!standalone&& !safari
-									   window.webkit.messageHandlers.goMyNav.postMessage(null)
-									 }
+						 if ( true) {//!standalone&& !safari
+						   window.webkit.messageHandlers.goMyNav.postMessage(null)
+						 }
 					} else if (android) {
-									 window.android.postMessage()
+						 window.android.postMessage()
 					}
 				
 			   
@@ -387,6 +462,7 @@
 				this.getData()
 			},
 			goDetail(item) {
+				uni.setStorageSync('onshow', '1');
 				uni.navigateTo({
 					url: "rescueOrderDetail?id=" + item.ID+'&back=1'
 				})
@@ -433,7 +509,19 @@
 
 				})
 			},
-
+           time(time) {
+				 let month = time.getMonth() + 1;  // 月
+				 let date = time.getDate();  // 日
+				 let hh = time.getHours();  // 时
+				 let mm = time.getMinutes();  // 分
+				 let ss = time.getSeconds();  // 秒
+				 if (hh >=0 && hh<10){hh= '0' + hh;}
+				 if (mm >=0 && mm<10){mm= '0' + mm;}
+				 if (ss >=0 && ss<10){ss= '0' + ss;}
+				 if (month < 10){month= '0' + month;}
+				 if (date < 10){date= '0' + date;}
+				 return time.getFullYear().toString()+'-' + month.toString()+'-' + date.toString()// + hh.toString() + mm.toString() + ss.toString();
+           },
 		},
 		onReachBottom() {
 			this.page++;
@@ -589,7 +677,7 @@
 		  width: 500rpx;
 	}
 	.dateinput{
-		width: 270rpx;color: #999999;
+		width: 305rpx;color: #999999;
 		height: 64rpx;font-size: 24rpx;line-height: 64rpx;
 		background: #F4F5F7;padding-left: 20rpx;
 		border-radius: 36rpx;
@@ -851,4 +939,16 @@
 		height: 40rpx;
 		padding-top: 16rpx;
 	}
+	.screenLine3{
+		width: 100rpx;
+	}
+	.screenLine1{
+		max-width: 260rpx;
+	}
+	.orderTimesxBoxTitle{
+		padding-left: 24rpx;
+		color: #666;
+		font-size: 24rpx;
+		padding-top: 16rpx;
+	}
 </style>