Bladeren bron

对接接口

liuwei 1 maand geleden
bovenliggende
commit
e000a9ad02

+ 3 - 1
common/config.js

@@ -129,7 +129,7 @@ var config = {
 	//首页-推荐车型列表
 	API_RECOMMEND_CAR_MODEL_LIST: api_web_url + '?r=flk/index/recommend-car-model-list',
 	//首页-推荐车型详情
-	API_RECOMMEND_CAR_MODEL_DETAIL: api_web_url + '?r=flk/index/recommend-car-model-detail',
+	API_FLK_INDEX_CAR_MODEL_DETAIL: api_web_url + '?r=flk/index/car-model-detail',
 	//附近门店列表
 	API_NEAR_SHOP_LIST: api_web_url + '?r=flk/net-shop/near-shop-list',
 	//附近机柜列表
@@ -150,5 +150,7 @@ var config = {
 	API_FLK_CAR_ASSIGNMENT: api_web_url + '?r=flk/car/assignment',
 	//激活车辆(绑定设备)
 	API_FLK_CAR_SWITCH: api_web_url + '?r=flk/car/switch',
+	//订单列表
+	API_FLK_ORDER_LIST: api_web_url + '?r=flk/order/list',
 };
 module.exports = config;

+ 19 - 15
common/http.js

@@ -1,7 +1,7 @@
 // import common = require("./common");
-const appid = '2025014122441122'
+const appid = 'wxefa2810018787a41'
 
-const language = 'en'
+const language = 'zh'
 
 var common = require('./common.js');
 
@@ -26,20 +26,13 @@ function _checkTokenValid(res) {
 	) {
 		//wx.clearStorageSync();
 
-		var shareCode = storage.getShareCode();
-		storage.clearStorage();
-		storage.setShareCode(shareCode);
+		//TODO
+		// var shareCode = storage.getShareCode();
+		// storage.clearStorage();
+		// storage.setShareCode(shareCode);
 		uni.reLaunch({
 			url: '/pages/index/index'
-		}); //wx.switchTab({url:'/pages/index/index'})
-		// wx.navigateTo({
-		//   url: '/pages/login/login',
-		// })
-		// wx.showModal({
-		//   title: '错误',
-		//   content: '鉴权认证过期,请重新登录',
-		//   showCancel: false
-		// })
+		});
 		return false;
 	}
 
@@ -100,7 +93,7 @@ function postRequest(url, data, successCallBack, failCallBack) {
 		url: url,
 		data: data,
 		header: {
-			'content-type': 'application/x-www-form-urlencoded',
+			'content-type': 'application/json',
 			'X-Token': token
 		},
 		method: 'POST',
@@ -167,7 +160,13 @@ function getApi(url, data, successCallBack, failCallBack) {
 	data.token = token;
 	data.v = config.APP_VERSION;
 	data.appid =  appid
+	//#ifdef MP-ALIPAY
 	data.from = 'ali'
+	//#endif
+	//#ifdef MP-WEIXIN
+	data.from = 'wx'
+	//#endif
+	
 	data.language = language
 	getRequest(url, data, successCallBack, failCallBack);
 }
@@ -178,7 +177,12 @@ function postApi(url, data, successCallBack, failCallBack) {
 	data.token = token;
 	data.v = config.APP_VERSION;
 	data.appid = appid
+	//#ifdef MP-ALIPAY
 	data.from = 'ali'
+	//#endif
+	//#ifdef MP-WEIXIN
+	data.from = 'wx'
+	//#endif
 	data.language = language
 	postRequest(url, data, successCallBack, failCallBack);
 }

+ 5 - 5
common/user.js

@@ -296,10 +296,10 @@ function totalPay(order_sn, payParams, trade_no, callBack) {
 	//#endif
 }
 
-// 取消车支付
-function cancelWorkOrderPay(order_sn) {
+// 取消租车/购车支付
+function cancelPayTakeCar(order_sn) {
 	http.postApi(
-		config.API_DAYHIRE_WORK_ORDER_CANCEL_PAY, {
+		config.API_FLK_ORDER_CANCEL_HIRE, {
 			order_sn: order_sn
 		},
 		function(res) {
@@ -321,7 +321,7 @@ module.exports = {
 	cancelChargeExtractPay: cancelChargeExtractPay,
 	cancelExtractPay: cancelExtractPay,
 	cancelChargeExPay: cancelChargeExPay,
-	cancelWorkOrderPay: cancelWorkOrderPay,
 	totalPay: totalPay,
-	getUserOpenId: getUserOpenId
+	getUserOpenId: getUserOpenId,
+	cancelPayTakeCar: cancelPayTakeCar,
 };

+ 1 - 1
component/carPlan/carPlan.vue

@@ -2,7 +2,7 @@
 	<view  class="show-more">
 		<view class="more-info">
 			<view class="flex-row model-title">
-				<view style="margin-right: 24rpx;"><img style="width: 160rpx;height: 160rpx;border-radius: 16rpx;" :src="params.img" alt=""></view>
+				<view style="margin-right: 24rpx;"><img style="width: 160rpx;height: 160rpx;border-radius: 16rpx;" :src="params.image" alt=""></view>
 				<view class="car-model-detail flex-row">
 					<!-- <priceTool :price="58" :font_size="40"/> -->
 					<allPrice :amount="(price/100)"/>

+ 21 - 18
component/customTabbar/index.vue

@@ -40,23 +40,24 @@ export default {
   },
   data() {
     return {
+      selectedTab: uni.getStorageSync('selectedIndex') || 0,
       tabs: [
-        { label: '设备', name: 'home', url: '/pages/index/index', 
-			icon: '/static/resource/images/home_i.png', 
-			activeIcon: '/static/resource/images/home_s.png' ,
-		},
-        { label: '服务', name: 'service', url: '/pages/service/service', 
-			icon: '/static/resource/images/service_i.png',
-			activeIcon: '/static/resource/images/service_s.png' ,
-		},
-        { label: '活动', name: 'active', url: '/pages/activity/activity', 
-			icon: '/static/resource/images/active_i.png',
-			activeIcon: '/static/resource/images/active_s.png' ,
-		},
-        { label: '我的', name: 'my', url: '/pages/my/my', 
-			icon: '/static/resource/images/my_i.png',
-			activeIcon: '/static/resource/images/my_s.png' ,
-		},
+          { label: '设备', name: 'home', url: '/pages/index/index', 
+            icon: '/static/resource/images/home_i.png', 
+            activeIcon: '/static/resource/images/home_s.png' ,
+          },
+              { label: '服务', name: 'service', url: '/pages/service/service', 
+            icon: '/static/resource/images/service_i.png',
+            activeIcon: '/static/resource/images/service_s.png' ,
+          },
+              { label: '活动', name: 'active', url: '/pages/activity/activity', 
+            icon: '/static/resource/images/active_i.png',
+            activeIcon: '/static/resource/images/active_s.png' ,
+          },
+              { label: '我的', name: 'my', url: '/pages/my/my', 
+            icon: '/static/resource/images/my_i.png',
+            activeIcon: '/static/resource/images/my_s.png' ,
+          },
       ],
       userInfo: {
         is_auth: 0,
@@ -76,8 +77,10 @@ export default {
   },
   methods: {
     routerPush(url) {
-      // uni.switchTab({ url });
-      uni.navigateTo({ url })
+      
+      // uni.setStorageSync('selectedIndex', data.index);
+      uni.switchTab({ url });
+      // uni.navigateTo({ url })
     },
     loadFaceToken() {
       const me = this

+ 11 - 4
component/payTypeModel/payTypeModel.vue

@@ -12,7 +12,14 @@
 				</view>
 			</view>
 			<view class="pay-type-view">
-				<view @tap="changePayType" :data-type="0" class="pay-view flex-row">
+				<view @tap="changePayType" :data-type="1" class="pay-view flex-row">
+					<img class="pay-icon" src="https://qiniu.bms16.com/FjtmRXUBGOrPGYOD6wcNhc0Z39IW" alt="">
+					<view class="pay-view-text">线下支付</view>
+					<img class="wx-pay-icon"
+						:src="payType==1?'https://qiniu.bms16.com/FhWimtmWybKlYMB6mgIReVWArbfq':'https://qiniu.bms16.com/FkmDjxBNZhFGFU5inza2usdtDlX8'"
+						alt="">
+				</view>
+				<!-- <view @tap="changePayType" :data-type="0" class="pay-view flex-row">
 					<img class="pay-icon" src="https://qiniu.bms16.com/FkmtlfJrmGfAh9n1138KC1WloQkZ" alt="">
 					<view class="pay-view-text">微信支付</view>
 					<img class="wx-pay-icon"
@@ -25,7 +32,7 @@
 					<img class="wx-pay-icon"
 						:src="payType==2?'https://qiniu.bms16.com/FhWimtmWybKlYMB6mgIReVWArbfq':'https://qiniu.bms16.com/FkmDjxBNZhFGFU5inza2usdtDlX8'"
 						alt="">
-				</view>
+				</view> -->
 				<!-- <view @tap="changePayType" :data-type="9" class="pay-view flex-row">
 					<img class="pay-icon" src="https://qiniu.bms16.com/FiGNLQ5lqhEK5im_mUVgRrE8PJMB" alt="">
 					<view class="pay-view-text">钱包余额支付(¥{{wallet_money}})</view>
@@ -45,7 +52,7 @@
 	export default {
 		data() {
 			return {
-				payType:0
+				payType:1
 			};
 		},
 		/**
@@ -77,7 +84,7 @@
 				this.$emit('closeShow')
 			},
 			toPayOrFreeExchange(){
-				
+				this.$emit('payToOrder',this.payType)
 			}
 		}
 	};

+ 7 - 2
manifest.json

@@ -62,6 +62,9 @@
                         "__platform__" : [ "ios", "android" ],
                         "appid" : "wx868f4e5130ef2636",
                         "UniversalLinks" : ""
+                    },
+                    "alipay" : {
+                        "__platform__" : [ "ios", "android" ]
                     }
                 },
                 "maps" : {
@@ -125,8 +128,10 @@
     },
     "quickapp" : {},
     "mp-weixin" : {
-        "appid" : "wx868f4e5130ef2636", //小众出行
-		// "appid": "wxfa47ec20c664ad3e", //可人智行
+        // "appid" : "wx868f4e5130ef2636", //小众出行
+        "appid" : "wxefa2810018787a41", //智寻小租
+
+        // "appid": "wxfa47ec20c664ad3e", //可人智行
         // "appid" : "wx56681a7f2fe324ed",//名师傅出行
         "setting" : {
             "urlCheck" : false,

+ 1 - 0
pages/bluetoothUnlock/components/AndroidUnlockAuth.vue

@@ -118,6 +118,7 @@ export default {
       this.$emit('input', false)
     },
 		bluetoothClose: function() {
+			
 			bluetooth.closeBluetoothAdapter();
 			bluetooth.closeDevice(
 				"095A5832",

+ 67 - 71
pages/carDetail/carDetail.vue

@@ -108,83 +108,79 @@
 		},
 		onLoad: function(options) {
 			console.log(options, 'options');
-			// if(options.recommend_id){
-			// 	this.recommend_id=options.recommend_id
-			// 	this.loadCarInfo()
-			// }
-			this.loadCarInfo()
+			if(options.model_id){
+				this.model_id=options.model_id
+				this.loadCarInfo()
+			}
+			// this.loadCarInfo()
 			// getFlatternDistance 获取直线距离
 		},
 		methods: {
 			loadCarInfo() {
 				const me = this
-				let test = {
-					"recommend_id": 3,
-					"title": "噢抬哇塞红擦无论谁",
-					"image": "https://loremflickr.com/400/400?lock=201810282360670",
-					"desc": "voluptate commodo quis fugiat ut",
-					"model_id": 1,
-					"car_model_name": "电摩-12",
-					"sell_price": 100,
-					"deposit": 10,
-					"rental_setting": [
-					  {
-						"setting_id": 1,
-						"admin_id": 1,
-						"hire_duration": 1,
-						"hire_duration_unit": 1,
-						"hire_price": 15,
-						"ctime": 1736330909,
-						"delete_time": 0
-					  },
-					  {
-						"setting_id": 2,
-						"admin_id": 1,
-						"hire_duration": 1,
-						"hire_duration_unit": 2,
-						"hire_price": 5,
-						"ctime": 1736386379,
-						"delete_time": 0
-					  }
-					],
-					"services_list": [
-					  {
-						"service_id": 3,
-						"admin_id": 1,
-						"service_name": "手套",
-						"ctime": 1736476283,
-						"delete_time": 0
-					  }
-					],
-					"shop_name": "智寻出行 - 测试",
-					"longitude": "115.815236",
-					"latitude": "28.691463",
-					"address": "江西省南昌市新建区友谊路与自强路交叉口北80米",
-					"work_begin_time": "03:00:00",
-					"work_end_time": "23:59:59",
-					"link_phone": "18779187403",
-					"distance": 11
-				  }
-				me.destance = common.getFlatternDistance(me.myLocation.latitude, me.myLocation.longitude, test.latitude,test.longitude)
-				console.log(me.destance);
-				me.setData({
-					car_detail: test
-				})
-
-				// http.postApi(config.API_RECOMMEND_CAR_MODEL_DETAIL, {recommend_id:3}, (resp) => {
-				// 	me.destance=common.getFlatternDistance(me.myLocation.latitude,me.myLocation.longitude,test.latitude,test.longitude)
-				// 	console.log(me.destance);
-				// 	me.setData({
-				// 		car_detail:test
-				// 	})
-				// 	// if (resp.data.code === 200) {
-				// 	// 	me.setData({
-				// 	// 		car_detail:resp.data.data
-				// 	// 	})
-				// 	// } else {
-				// 	// 	common.simpleToast(resp.data.msg);
-				// 	// }
+				// let test = {
+				// 	"recommend_id": 3,
+				// 	"title": "噢抬哇塞红擦无论谁",
+				// 	"image": "https://loremflickr.com/400/400?lock=201810282360670",
+				// 	"desc": "voluptate commodo quis fugiat ut",
+				// 	"model_id": 1,
+				// 	"car_model_name": "电摩-12",
+				// 	"sell_price": 100,
+				// 	"deposit": 10,
+				// 	"rental_setting": [
+				// 	  {
+				// 		"setting_id": 1,
+				// 		"admin_id": 1,
+				// 		"hire_duration": 1,
+				// 		"hire_duration_unit": 1,
+				// 		"hire_price": 15,
+				// 		"ctime": 1736330909,
+				// 		"delete_time": 0
+				// 	  },
+				// 	  {
+				// 		"setting_id": 2,
+				// 		"admin_id": 1,
+				// 		"hire_duration": 1,
+				// 		"hire_duration_unit": 2,
+				// 		"hire_price": 5,
+				// 		"ctime": 1736386379,
+				// 		"delete_time": 0
+				// 	  }
+				// 	],
+				// 	"services_list": [
+				// 	  {
+				// 		"service_id": 3,
+				// 		"admin_id": 1,
+				// 		"service_name": "手套",
+				// 		"ctime": 1736476283,
+				// 		"delete_time": 0
+				// 	  }
+				// 	],
+				// 	"shop_name": "智寻出行 - 测试",
+				// 	"longitude": "115.815236",
+				// 	"latitude": "28.691463",
+				// 	"address": "江西省南昌市新建区友谊路与自强路交叉口北80米",
+				// 	"work_begin_time": "03:00:00",
+				// 	"work_end_time": "23:59:59",
+				// 	"link_phone": "18779187403",
+				// 	"distance": 11
+				//   }
+				// me.destance = common.getFlatternDistance(me.myLocation.latitude, me.myLocation.longitude, test.latitude,test.longitude)
+				// console.log(me.destance);
+				// me.setData({
+				// 	car_detail: test
 				// })
+
+				http.postApi(config.API_FLK_INDEX_CAR_MODEL_DETAIL, {model_id:me.model_id}, (resp) => {
+					if (resp.data.code === 200) {
+						me.setData({
+							car_detail:resp.data.data,
+							price:(resp.data.data.rental_setting[0].hire_price/100).toFixed(2)
+						})
+					} else {
+						common.simpleToast(resp.data.msg);
+					}
+				})
 			},
 			tapSelectType(e) {
 				const {select_type,price} = e.currentTarget.dataset

+ 14 - 23
pages/index/components/unleasedPages/unleasedPages.vue

@@ -27,7 +27,7 @@
 						<text>极速可达</text>
 					</view> -->
 				</view>
-				<view class="flex-row" @tap="navDetail" :data-id="moder_info.recommend_id" style="justify-content: center;" >
+				<view class="flex-row" @tap="navCarDetail"  style="justify-content: center;" >
 					<view class="more-btn flex-row">
 						<view class="more-btn-text">了解更多</view>
 						<img class="more-btn-img" src="https://qiniu.bms16.com/Fi2Lg800Mc1MhCnvHT1DkvOEdJB1" alt="">
@@ -62,46 +62,37 @@
 				type: Array,
 				default: []
 			},
-			moder_info: {
-				type: Object,
-				default: {}
-			},
 		},
 		data() {
 			return {
 				current: 0,
-				recommend_id:'',//租赁设备编号
+				model_id:'',//租赁设备编号
+				moder_info:{}
 			};
 		}
 		/**
 		 * 生命周期函数--监听页面加载
 		 */
 		,
-		creatd: function(options) {
-			console.log(this.img_list,'img_list');
-			this.recommend_id=this.model_list[0].id
-			// this.img_list=this.model_list.map(item=>item.image)
-		},
+		  watch: {
+		    model_list(newVal) {
+		      console.log("子组件 props 更新:", newVal);
+			  this.moder_info=newVal[0]
+			  this.model_id=newVal[0].model_id
+		    }
+		  },
 		methods: {
 			tapSwiper(e){
-				console.log(this.img_list,'img_list');
-				// console.log(e,'eeeee');
 				this.setData({
 					current:e,
-					moder_info:this.model_list[e]
-				})
-			},
-			navDetail(e){
-				const recommend_id = e.currentTarget.dataset.id;
-				console.log(this.moder_info.recommend_id,e,recommend_id,'recommend_id');
-				this.recommend_id=recommend_id
-				uni.navigateTo({
-					url: '/pages/carDetail/carDetail?recommend_id=' + recommend_id
+					moder_info:this.model_list[e],
+					model_id:this.model_list[e].model_id
 				})
 			},
 			navCarDetail(){
+				const me=this
 				uni.navigateTo({
-					url: '/pages/carDetail/carDetail?recommend_id=' + this.recommend_id
+					url: '/pages/carDetail/carDetail?model_id=' + me.model_id
 				})
 			}
 		}

+ 28 - 21
pages/index/index.vue

@@ -87,7 +87,7 @@
 			</view>
 		</block>
 		<block >
-			<UnleasedPages :model_list="model_list" :img_list="img_list" :moder_info="model_list[0]"/>
+			<UnleasedPages :model_list="model_list" :img_list="img_list" />
 		</block>
 		<BluetoothUnlockAuth ref="bluetoothUnlockAuth" />
 		<CustomTabbar curt-tab="home"/>
@@ -139,6 +139,11 @@
 		 * 生命周期函数--监听页面加载
 		 */
 		onLoad: function(options) {
+			const user_token = storage.getUserToken()
+				if (!user_token) {
+					this.loadIsLogin()
+					return
+				}
 			this.loadModelList()
 		},
 		/**
@@ -155,7 +160,24 @@
 			}
 		},
 		methods: {
-			
+			loadIsLogin(){
+				uni.showModal({
+					title: '提示',
+					content: '您还未登录,请先登录',
+					showCancel: true,
+					cancelText: '取消',
+					confirmText: '确定',
+					success: function(res) {
+						if (res.confirm) {
+							uni.navigateTo({
+								url: '/pages/loginRegister/login',
+							})
+						}
+					},
+					fail: function(res) {},
+					complete: function(res) {},
+				})
+			},
 			connectBluetooth(){
 				var device = {
 					mac_id: "095A5832",
@@ -175,32 +197,17 @@
 				});
 			},
 			inductiveUnlockHandle() {
-				this.$refs.bluetoothUnlockAuth.open();
+				// this.$refs.bluetoothUnlockAuth.open();
 			},
 			loadModelList() {
 				const me = this
 				http.postApi(config.API_RECOMMEND_CAR_MODEL_LIST, {}, (resp) => {
 					if (resp.data.code === 200) {
-						// me.model_list=resp.data.data.list
-						const list=[
-						   {
-						        "recommend_id": "3",
-						        "title": "噢抬哇塞红擦无论谁",
-						        "image": "https://loremflickr.com/400/400?lock=201810282360670",
-						        "model_id": "1",
-						        "model_name": "电摩-12"
-						      },
-						      {
-						        "recommend_id": "4",
-						        "title": "修改测试车型推荐",
-						        "image": "https://loremflickr.com/400/400?lock=201810282360670",
-						        "model_id": "24",
-						        "model_name": "测试车型"
-						      }
-						]
+						const list=resp.data.data
+						const img_list=resp.data.data.map(item=>item.image)
 						me.setData({
 							model_list:list,
-							img_list:list.map(item=>item.image)
+							img_list:img_list
 						})
 					} else {
 						common.simpleToast(resp.data.msg);

+ 65 - 34
pages/order/order.css

@@ -1,12 +1,50 @@
-.container {
-	padding: 24rpx 32rpx;
+.container-view {
+	/* padding: 24rpx 32rpx; */
+}
+.order-type-view{
+	padding: 32rpx;
+	height: 96rpx;
+	margin-bottom: 20rpx;
+	background: #FFFFFF;
+	align-items: center;
+}
+.car-model-list{
+	position: relative;
+	font-family: PingFangSC, PingFang SC;
+	font-weight: 600;
+	font-size: 40rpx;
+	color: #060809;
+}
+.package-type-list{
+	font-family: PingFangSC, PingFang SC;
+	font-weight: 500;
+	font-size: 32rpx;
+	color: #9FA7B7;
+	position: relative;
+}
+.package-type-list-i{
+	color: #0D52FC;	
+}
+.right-button-icon{
+	width: 16rpx;
+	height: 12rpx;
+	position: absolute;
+	bottom: -8rpx;
+	right: -15rpx;
+}
+.right-corner-icon{
+	width: 14rpx;
+	height: 14rpx;
+	position: absolute;
+	bottom: 9rpx;
+	right: -22rpx;
 }
-
 .order-card {
 	border-radius: 32rpx;
 	background-color: #FFFFFF;
 	padding: 36rpx 32rpx;
 	margin-bottom: 24rpx;
+	margin:0 24rpx 24rpx;
 }
 
 .card-top {
@@ -35,37 +73,6 @@
 	margin-bottom: 14rpx;
 }
 
-.item-left {
-	margin-right: 32rpx;
-	flex-direction: column;
-	align-items: flex-end;
-}
-
-.item-left>view {
-	color: #9FA7B7;
-	font-size: 30rpx;
-}
-
-.item-right>view {
-	color: #2A3A5A;
-	font-size: 28rpx;
-}
-
-.item-left>view:nth-of-type(1),
-.item-left>view:nth-of-type(2),
-.item-right>view:nth-of-type(1),
-.item-right>view:nth-of-type(2) {
-	margin-bottom: 32rpx;
-}
-
-.bottom-price {
-	display: flex;
-	color: #5E6F90;
-	font-size: 28rpx;
-	justify-content: flex-end;
-	align-items: baseline;
-}
-
 .price-text {
 	color: #2A3A5A;
 	font-weight: bold;
@@ -102,3 +109,27 @@
 	color: #5E6F90;
 	background-color: #F3F8FF;
 }
+.bottom-item{
+	flex-direction: column;
+}
+.item-label-view{
+	margin-bottom: 32rpx;
+}
+.item-label{
+	font-family: PingFangSC, PingFang SC;
+	font-weight: 400;
+	font-size: 28rpx;
+	color: #9FA7B7;
+}
+.item-value{
+	font-family: Futura, Futura;
+	font-weight: 500;
+	font-size: 30rpx;
+	color: #060809;
+}
+.button-config-view{
+	display: flex;
+	color: #5E6F90;
+	font-size: 28rpx;
+	justify-content: flex-end;
+}

+ 55 - 31
pages/order/order.vue

@@ -1,10 +1,28 @@
 <template>
-	<view class="container">
+	<view class="container-view">
+		<view class="order-type-view flex-row flex-between">
+			<view class="car-model-list flex-row">
+				<view class="car-model-text">小米Su5</view><img class="right-corner-icon" src="https://qiniu.bms16.com/Fqs6TrEmcdT7QNEdKWs9Hir2cacO" alt="">
+			</view>
+			<view class="order-package-type-view flex-row">
+				<view 
+					v-for="(type, index) in orderTypes" 
+					:key="index" 
+					@tap="checkOrderType" 
+					:data-type="type.value" 
+					:class="['package-type-list', 'flex-row', {'package-type-list-i': selectOrderType === type.value}]"
+					:style="{ marginRight: index === 0 ? '48rpx' : '' }"
+				>
+					<view class="package-type-text">{{ type.text }}</view>
+					<img v-if="selectOrderType === type.value" class="right-button-icon" src="https://qiniu.bms16.com/FmcoAVgWvyK44iPjK0phkDRU21i0" alt="">
+				</view>
+			</view>
+		</view>
 		<view v-for="(item, index) in hireOrderList" :key="index" @tap="loadToNav" :data-orderSn="item.order_sn"
 			class="order-card">
 			<view class="card-top flex-row">
 				<view>{{ item.car_model }}</view>
-				<view class="card card-k" v-if="item.order_status == 0">待支付</view>
+				<view class="card card-k" v-if="item.order_status == 0">待生效</view>
 				<view class="card card-k" v-else-if="item.order_status == 1">待取车</view>
 				<view class="card card-k" v-else-if="item.order_status == 2">待激活</view>
 				<view class="card card-b" v-else-if="item.order_status == 3">使用中</view>
@@ -16,37 +34,34 @@
 			</view>
 			<view class="card-border"></view>
 			<view class="card-bottom">
-				<view class="bottom-item flex-row">
-					<view class="item-left flex-row">
-						<view>下单时间</view>
-						<view>租用时长</view>
-						<view v-if="item.order_status == 3">剩余租期</view>
+				<view class="bottom-item">
+					<view class="item-label-view flex-row">
+						<view class="item-label">下单时间</view>
+						<view class="item-value">{{ tools.formatTime(item.settle_date) }}</view>
 					</view>
-					<view class="item-right">
-						<view>{{ tools.formatTime(item.ctime) }}</view>
-						<view>
+					<view class="item-label-view flex-row">
+						<view class="item-label">有效期至</view>
+						<view class="item-value"><view>
 							{{ item.hire_duration_time.day > 0 ? item.hire_duration_time.day : '' }}<text
 								v-if="item.hire_duration_time.day > 0">日</text>{{ item.hire_duration_time.hour > 0 ?
 									item.hire_duration_time.hour : '' }}<text
 								v-if="item.hire_duration_time.hour > 0">小时</text>{{ item.hire_duration_time.minute > 0 ?
 									item.hire_duration_time.minute : '' }}<text
 								v-if="item.hire_duration_time.minute > 0">分</text>
-						</view>
-						<view v-if="item.order_status == 3">
-							{{ item.order_time.day > 0 ? item.order_time.day : '' }}<text
-								v-if="item.order_time.day > 0">日</text>{{ item.order_time.hour > 0 ?
-									item.order_time.hour
-									: '' }}<text v-if="item.order_time.hour > 0">小时</text>{{ item.order_time.minute > 0 ?
-								item.order_time.minute : '' }}<text v-if="item.order_time.minute > 0">分</text>
-							<!-- hire_end_time -当前时间 -->
-						</view>
+						</view></view>
+					</view>
+					<view class="item-label-view flex-row">
+						<view class="item-label">有效时长</view>
+						<view class="item-value">{{ tools.formatTime(item.settle_date) }}</view>
+					</view>
+					<view class="item-label-view flex-row">
+						<view class="item-label">免费换电数</view>
+						<view class="item-value">{{ tools.formatTime(item.settle_date) }}</view>
+					</view>
+					<view class="flex-row button-config-view">
+						<view class="return-money">已退款</view>
+						<view class="item-value">套餐金额$ <text class="money-style">5.0</text></view>
 					</view>
-				</view>
-				<view class="bottom-price flex-row">
-					订单金额
-					<!-- <view class="price-text">¥<text>{{((item.money-0) + (item.deposit-0) + (item.insurance-0)) / 100}}</text></view> -->
-					<view class="price-text">
-						¥<text>{{ item.money / 100 }}</text></view>
 				</view>
 			</view>
 		</view>
@@ -63,6 +78,11 @@
 	export default {
 		data() {
 			return {
+				selectOrderType:1,
+				orderTypes: [
+				{ value: 0, text: '换电套餐' },
+				{ value: 1, text: '租车购车' }
+				],
 				page: 1,
 				limit: 10,
 				status: '-1',
@@ -95,7 +115,6 @@
 		 */
 		onShow: function() {
 			this.hireOrderList = []
-			this.sort_time = 0
 			this.bindHireOrderList()
 		},
 		
@@ -123,12 +142,12 @@
 		methods: {
 			bindHireOrderList() {
 				const me = this
-				http.postApi(config.API_DAYHIRE_HIRE_ORDER_LIST, {
+				http.postApi(config.API_FLK_ORDER_LIST, {
 					page: me.page,
 					limit: me.limit,
-					status: me.status,
-					sort_time: me.sort_time,
-					sort_num: me.sort_num
+					// status: me.status,
+					// sort_time: me.sort_time,
+					// sort_num: me.sort_num
 				}, (resp) => {
 					if (resp.data.code === 200) {
 						me.hireOrderList.push.apply(me.hireOrderList, resp.data.data.list)
@@ -146,7 +165,12 @@
 					}
 				})
 			},
-
+			checkOrderType(e){
+				const type = e.currentTarget.dataset.type;
+				this.setData({
+					selectOrderType:type
+				})
+			},
 			navToPage(e) {
 				const url = e.currentTarget.dataset.url;
 				if (!url) {

+ 66 - 9
pages/purchaseOrder/purchaseOrder.vue

@@ -62,7 +62,7 @@
 		<view v-if="!isShowDetail" class="payment-info">
 			<view class="payment-bottom flex-row flex-between">
 				<view class="bottom-left flex-row">
-					<allPrice :amount="price"></allPrice>
+					<allPrice :amount="totalPrice"></allPrice>
 					<view @tap="bindDetail" class="all-money">明细<img
 							src="https://qiniu.bms16.com/Fvl1d-AWRvwY_ehNrw7bMZOK6LBZ" /></view>
 				</view>
@@ -83,7 +83,7 @@
 						<view>车辆租金</view>
 						<view>
 							<!-- ¥{{(leaseTime * price_list[0].hire_price) /100}} -->
-							¥{{tools.toFixed(unitPrice/100)+'x'+modelInfo.count}}
+							¥{{price+'x'+modelInfo.count}}
 							<text >{{leaseUnits}}</text>
 						</view>
 					</view>
@@ -95,13 +95,13 @@
 					
 					<view class="detail-money flex-row" style="padding-bottom: 44rpx;">
 						<view>支付金额</view>
-						<allPrice :amount="price"></allPrice>
+						<allPrice :amount="totalPrice"></allPrice>
 					</view>
 				</view>
 				<view class="second">
 					<view class="payment-bottom flex-row flex-between">
 						<view class="bottom-left flex-row">
-							<allPrice :amount="price"></allPrice>
+							<allPrice :amount="totalPrice"></allPrice>
 							<view @tap="isShowDetail = false" class="all-money">明细<img
 									src="https://qiniu.bms16.com/FkzZI0r5jO-c2JRahNkZW2pHb9dR" /></view>
 						</view>
@@ -133,12 +133,12 @@
 					<view>请于 <text class="get-car-time">3.5-20:00</text>  到 <text class="get-car-name">深圳南山深大店</text>  取车</view>
 				</view>
 				<view class="return-btn flex-row">
-					<view @tap="toRurnCarPage">我知道了</view>
-					<view @tap="toNearbyStorePage">订单详情</view>
+					<view @tap="toIndexPage">我知道了</view>
+					<view @tap="toOrderInfo">订单详情</view>
 				</view>
 			</view>
 		</view>
-		<PayTypeModel @closeShow="closeShow" :free_price="price" :isShowToBuy="isShowToBuy"/>
+		<PayTypeModel @closeShow="closeShow" @payToOrder="payToOrder" :free_price="totalPrice" :isShowToBuy="isShowToBuy"/>
 	</view>
 </template>
 <script module="tools" lang="wxs" src="@/pages/common/wxs/tools.wxs"></script>
@@ -169,7 +169,9 @@
 				modelInfo:{},
 				isShowDetail:false,
 				unitPrice:0, //单价
-				isShowToBuy:false
+				isShowToBuy:false,
+				order_sn:'', //租赁订单号
+				totalPrice:0,//结算总金额
 			};
 		}
 		/**
@@ -184,9 +186,11 @@
 					modelInfo:model_info,
 					unitPrice:model_info.rental_setting.find(v => v.hire_duration_unit == model_info.selectType)?.hire_price,
 					service_list:model_info.service_list||[],
-					price:(model_info.totalPrice/100).toFixed(2)
+					price:model_info.totalPrice/100,
+					totalPrice:((model_info.totalPrice+model_info.deposit)/100).toFixed(2)
 				})
 			}
+			this.pick_up_time = Math.floor(new Date().getTime() / 1000)
 			this.setData({
 				takeCar:common.getFormattedTime()
 			})
@@ -210,6 +214,7 @@
 			handleValuesUpdated(e) {
 				this.isShowCalendar = false;
 				const timeStr=new Date(e.startDate)
+				this.pick_up_time=Math.floor(new Date(e.startDate).getTime()/1000)
 				this.setData({
 					takeCar:common.getFormattedTime(timeStr)
 				})
@@ -248,6 +253,58 @@
 				this.setData({
 					isShowToBuy:false
 				})
+			},
+			payToOrder(type){
+				const pay_type = type
+				var from=''
+				if(pay_type == 1){
+					from = 'wx'
+				}else if(pay_type == 2){
+					from = 'ali'
+				}
+				const hire_duration=this.modelInfo.rental_setting.find(v => v.hire_duration_unit == this.modelInfo.selectType)?.hire_duration
+				console.log(this.modelInfo,'test');
+				const pData={
+					pay_type,
+					car_model_id:this.modelInfo.model_id,
+					hire_cycle:this.modelInfo.count,
+					hire_duration_unit:this.modelInfo.selectType,
+					hire_duration,
+					price: this.totalPrice*100,
+					pick_up_time:this.pick_up_time,
+					address: this.modelInfo.address,
+					currency_code:'CNY'
+				}
+				this.loadPayMethod(pData)
+				
+			},
+			loadPayMethod(pData){
+				const me = this;
+				common.loading();
+				http.postApi(config.API_FLK_ORDER_HIRE_MODEL, pData, function (resp) {
+					uni.hideLoading();
+					if (resp.data.code === 200) {
+						if(!resp.data.data.need_pay){
+							common.simpleToast(me,me.$t('支付成功'));
+							me.order_sn = resp.data.data.order_sn;
+							me.setData({
+								isShowToBuy:false,
+								isShowCheckOrder:true
+							})
+						}
+					}  else {
+						common.simpleToast(me,resp.data.msg);
+						
+					}
+				});
+			},
+			toIndexPage(){
+				uni.switchTab({
+					url: '/pages/index/index'
+				})
+			},
+			toOrderInfo(){
+				uni.navToPage({ url: '/pages/orderStatus/orderStatus?order_sn=' + this.order_sn })
 			}
 		}
 	};