Browse Source

激活车辆

liuwei 3 weeks ago
parent
commit
eeaf311edf

+ 13 - 5
common/config.js

@@ -43,10 +43,6 @@ var config = {
 	API_DAYHIRE_USER_INVESTMENT: api_web_url + '?r=dayhire/user/investment', // 投资规模
 	API_DAYHIRE_USER_INVESTMENT: api_web_url + '?r=dayhire/user/investment', // 投资规模
 	API_DAYHIRE_USER_COOPERATE: api_web_url + '?r=dayhire/user/cooperate', // 申请加盟
 	API_DAYHIRE_USER_COOPERATE: api_web_url + '?r=dayhire/user/cooperate', // 申请加盟
 
 
-	API_DAYHIRE_USER_WALLET_TYPE: api_web_url + '?r=dayhire/user/wallet-type', // 钱包业务类型
-	API_DAYHIRE_USER_WALLET_INFO: api_web_url + '?r=dayhire/user/wallet-info', // 钱包信息
-	API_DAYHIRE_USER_WALLET_HISTORY: api_web_url + '?r=dayhire/user/wallet-history', // 钱包交易记录
-	API_DAYHIRE_USER_WALLET_PAY: api_web_url + '?r=dayhire/user/wallet-pay', // 钱包充值
 
 
 	API_DAYHIRE_CAR_MODEL_INFO: api_web_url + '?r=dayhire/car/model-info', // 车型信息
 	API_DAYHIRE_CAR_MODEL_INFO: api_web_url + '?r=dayhire/car/model-info', // 车型信息
 	API_DAYHIRE_HIRE_PREDETERMINE: api_web_url + '?r=dayhire/hire/predetermine', // 预约支付
 	API_DAYHIRE_HIRE_PREDETERMINE: api_web_url + '?r=dayhire/hire/predetermine', // 预约支付
@@ -146,11 +142,23 @@ var config = {
 	API_FLK_ORDER_CANCEL_HIRE: api_web_url + '?r=flk/order/cancel-hire',
 	API_FLK_ORDER_CANCEL_HIRE: api_web_url + '?r=flk/order/cancel-hire',
 	//续租
 	//续租
 	API_FLK_ORDER_RENEW: api_web_url + '?r=flk/order/renew',
 	API_FLK_ORDER_RENEW: api_web_url + '?r=flk/order/renew',
+	//用户车辆列表
+	API_FLK_CAR_DEVICE_LIST: api_web_url + '?r=flk/car/device-list',
 	//激活车辆(绑定设备)
 	//激活车辆(绑定设备)
 	API_FLK_CAR_ASSIGNMENT: api_web_url + '?r=flk/car/assignment',
 	API_FLK_CAR_ASSIGNMENT: api_web_url + '?r=flk/car/assignment',
-	//激活车辆(绑定设备)
+	//解绑车辆
+	API_FLK_CAR_RETURN_CAR: api_web_url + '?r=flk/car/unbind-car',
+	//车辆开关
 	API_FLK_CAR_SWITCH: api_web_url + '?r=flk/car/switch',
 	API_FLK_CAR_SWITCH: api_web_url + '?r=flk/car/switch',
 	//订单列表
 	//订单列表
 	API_FLK_ORDER_LIST: api_web_url + '?r=flk/order/list',
 	API_FLK_ORDER_LIST: api_web_url + '?r=flk/order/list',
+	//套餐列表
+	API_FLK_EXCHANGE_PACKAGE_LIST: api_web_url + '?r=flk/exchange-package/package-list',
+	//购买套餐
+	API_FLK_EXCHANGE_PACKAGE_PAY: api_web_url + '?r=flk/exchange-package/pay',
+	//购买套餐
+	API_FLK_EXCHANGE_PACKAGE_ORDER_LIST: api_web_url + '?r=flk/exchange-package/order-list',
+	//机柜换电
+	API_FLK_CABINET_CHANGE_BATTERY: api_web_url + '?r=flk/cabinet/change-battery',
 };
 };
 module.exports = config;
 module.exports = config;

+ 71 - 0
component/uploader/uploader.css

@@ -0,0 +1,71 @@
+.container {
+	
+}
+
+.list-group {
+    display: flex;
+    flex-direction: row;
+    justify-content: flex-start;
+    flex-wrap: wrap;
+}
+
+.list-item {
+	width: 218rpx;
+	height: 218rpx;
+	background-color: #F4F5F6;
+	border-radius: 16rpx;
+	display: flex;
+	flex-direction: column;
+    margin-right: 9rpx;
+    margin-bottom: 10rpx;
+	position: relative;
+	align-items: center;
+}
+
+.img-item {
+    width: 218rpx;
+    height: 218rpx;
+    background-color: #fff;
+	border-radius: 16rpx;
+}
+.img-item-demo {
+    width: 218rpx;
+    height: 218rpx;
+    background-color: #fff;
+	border-radius: 16rpx;
+	/* 翻转图片的颜色 */
+	filter: invert(30%); 
+	opacity: 0.8;
+}
+
+
+
+.empity-item {
+	position: absolute;
+	/* #ifdef MP-ALIPAY */
+	top: 0.7rem;
+	left: 0.5rem;
+	/* #endif */
+	/* #ifdef MP-WEIXIN */
+	top: 10rpx;
+	left: 48rpx;
+	/* #endif */
+
+    color: #e6e6e6;
+    font-size: 120rpx;
+    text-align: center;
+}
+
+.img_text {
+    font-family: PingFangSC, PingFang SC;
+    font-weight: 500;
+    font-size: 28rpx;
+    color: #FFFFFF;
+    line-height: 28rpx;
+    /* text-align: center; */
+    font-style: normal;
+    /* text-align: center; */
+    position: absolute;
+    bottom: 17rpx;
+    /* left: 73rpx; */
+}

+ 98 - 0
component/uploader/uploader.vue

@@ -0,0 +1,98 @@
+<template>
+	<view class="container">
+		<view class="list-group">
+			<view class="list-item" @tap="bindUpImg" @longpress="bindDelImage" :data-idx="index"
+				v-for="(item, index) in car_info" :key="item.unique">
+				<image v-if="item.img_url == ''" class="img-item-demo" :src="item.url"></image>
+				<image v-if="item.img_url != ''" class="img-item" :src="item.img_url"></image>
+				<view class="img_text">{{ item.title? item.title : '车辆照片'}}</view>
+				<view v-if="item.img_url == ''" class="empity-item">+</view>
+			</view>
+		</view>
+
+	</view>
+</template>
+
+<script>
+	var common = require('../../common/common.js');
+	export default {
+		props: {
+			car_info: {
+				type: Array,
+				required: true //必填项
+			},
+		},
+		data() {
+			return {
+			}
+		}
+		/**
+		 * 生命周期函数--监听页面加载
+		 */
+		,
+		onLoad: function(options) {
+			this.car_info.forEach(item => {
+			    item.img_url = '' // 
+			})
+		},
+		/**
+		 * 生命周期函数--监听页面显示
+		 */
+		onShow: function() {
+
+		},
+		methods: {
+			// 上传
+			bindUpImg: function(e) {
+				const me = this
+				const index = e.currentTarget.dataset.idx;
+				common.upLoadImgQiNiu(
+					function(imgUrl) {
+						const car_info = me.car_info
+						car_info[index].img_url = imgUrl
+						me.setData({
+							car_info: car_info
+						})
+						me.updateImages(me.car_info)
+						me.$forceUpdate()
+						
+					},
+					['camera']
+				)
+				
+			},	
+			
+            // 删除图片
+			bindDelImage: function(e) {
+				const me = this;
+				const index = e.currentTarget.dataset.idx
+				// 样例图不删除
+				if (me.car_info[index].img_url == '') return false
+				uni.showModal({
+					title: '提示',
+					content: '你确定要删除吗?',
+					showCancel: true,
+					success: function(res) {
+						if (res.confirm) {
+							const car_info = me.car_info
+							car_info[index].img_url = ''
+							me.setData({
+								car_info: car_info
+							});
+							// 注意异步加载car_info更新到父组件
+							me.updateImages(car_info);
+						}
+					}
+				})
+			},
+			updateImages(car_info) {
+				this.$emit('update-car-images', car_info);
+			}
+
+		}
+	};
+</script>
+
+<style>
+	@import './uploader.css';
+</style>

+ 6 - 1
pages.json

@@ -267,7 +267,12 @@
 				"navigationBarTitleText": ""
 				"navigationBarTitleText": ""
 			}
 			}
 		},
 		},
-		
+		{
+			"path": "pages/activation/activation",
+			"style": {
+				"navigationBarTitleText": "激活车辆"
+			}
+		},
 		
 		
 		
 		
 		{
 		{

+ 55 - 0
pages/activation/activation.css

@@ -0,0 +1,55 @@
+.container-view {
+	height: 100vh;
+	background-color: #ffffff;
+}
+
+.return-info {
+	padding: 40rpx 32rpx 32rpx;
+	margin-bottom: 16rpx;
+}
+
+.return-info img {
+	width: 125rpx;
+	height: 125rpx;
+	border-radius: 16rpx;
+}
+
+.return-top > view:nth-of-type(1) {
+	color: #2A3A5A;
+	font-size: 36rpx;
+	margin-bottom: 16rpx;
+	font-weight: bold;
+}
+
+.return-top > view:nth-of-type(2) {
+	color: #5E6F90;
+	background-color: #F3F8FF;
+	border-radius: 40rpx;
+	padding-top: 12rpx;
+	padding-bottom: 12rpx;
+	width: 208rpx;
+	text-align: center;
+}
+
+.pictures-info {
+	background-color: #ffffff;
+	padding: 40rpx 32rpx 32rpx;
+}
+
+.pictures-info > view:nth-of-type(1) {
+	color: #2A3A5A;
+	font-size: 40rpx;
+	margin-bottom: 20rpx;
+}
+
+.pictures-btn {
+	color: #FFFFFF;
+	font-size: 32rpx;
+	background-color: #0074FF;
+	border-radius: 44rpx;
+	padding-top: 28rpx;
+	padding-bottom: 28rpx;
+	width: 100%;
+	text-align: center;
+	margin-top: 22rpx;
+}

+ 92 - 0
pages/activation/activation.vue

@@ -0,0 +1,92 @@
+<template>
+	<view class="container-view">
+		<view class="return-info flex-row flex-between">
+			<view class="return-top">
+				<view>车牌:{{plate_number}}</view>
+			</view>
+
+			<view><img :src="model_image" /></view>
+		</view>
+		<view class="pictures-info">
+			<view>车辆照片</view>
+			<!-- <view>这里是关于激活车辆照片的文案描述,这里是关于激活车辆照片的文案描述</view> -->
+			<uploader :car_info="car_imgs" @update-car-images="handleCarImagesUpdate"></uploader>
+			<view @tap="submitEnabled" class="pictures-btn">激活车辆</view>
+		</view>
+	</view>
+</template>
+
+<script>
+	import uploader from '@/component/uploader/uploader';
+	const http = require('@/common/http.js');
+	const config = require('@/common/config.js');
+	const common = require('@/common/common.js');
+	export default {
+		components: {
+			uploader
+		},
+		data() {
+			return {
+				carInfo: {},
+				plate_number: '013657142736',
+				sub_sn: '',
+				model_image: '3',
+				car_model: '',
+				return_imgs: [],
+				car_imgs: [],
+				model_image_list: ''
+			};
+		},
+		/**
+		 * 生命周期函数--监听页面加载
+		 */
+		onLoad: function(options) {
+			this.sub_sn =  options.sub_sn || ''
+		},
+
+		/**
+		 * 生命周期函数--监听页面显示
+		 */
+		onShow: function() {
+		},
+		onUnload: function () {
+		},
+		methods: {
+			handleCarImagesUpdate(updatedImages) {
+				// 这里会接收到子组件传来的更新后的图片URL数组
+				this.car_imgs = updatedImages
+			},
+			
+			submitEnabled() {
+				const me = this
+				const _image_list = this.car_imgs.map(item => item.img_url)
+				if (_image_list.includes('' || "")) return common.simpleToast('请上传车辆照片')
+				const pData = {
+					car_sn: this.plate_number,
+					sub_sn: this.sub_sn,
+					image_list: _image_list.join(', ')
+				}
+				http.postApi(config.API_FLK_CAR_ASSIGNMENT, pData, (resp) => {
+					if (resp.data.code === 200) {
+						common.simpleToast('车辆激活成功')
+						setTimeout(function() {
+							me.isCustomJump = false
+							uni.switchTab({
+								url: `/pages/index/index?plate_number=${me.plate_number}`,
+								success: function(res) {},
+								fail: function(res) {},
+								complete: function(res) {}
+							});
+						}, 500)
+					} else {
+						common.simpleToast(resp.data.msg)
+					}
+				})
+			}
+		}
+	};
+</script>
+
+<style>
+	@import './activation.css';
+</style>

+ 2 - 2
pages/index/index.vue

@@ -1,6 +1,6 @@
 <template>
 <template>
 	<view >
 	<view >
-		<block >
+		<block v-if="false">
 			<view class="container-view">
 			<view class="container-view">
 				
 				
 			
 			
@@ -86,7 +86,7 @@
 			<view style="height: 264rpx;"></view>
 			<view style="height: 264rpx;"></view>
 			</view>
 			</view>
 		</block>
 		</block>
-		<block v-if="false">
+		<block >
 			<UnleasedPages :model_list="model_list" :img_list="img_list" />
 			<UnleasedPages :model_list="model_list" :img_list="img_list" />
 		</block>
 		</block>
 		<BluetoothUnlockAuth ref="bluetoothUnlockAuth" />
 		<BluetoothUnlockAuth ref="bluetoothUnlockAuth" />

+ 30 - 0
pages/order/order.css

@@ -119,6 +119,7 @@
 	font-family: PingFangSC, PingFang SC;
 	font-family: PingFangSC, PingFang SC;
 	font-weight: 400;
 	font-weight: 400;
 	font-size: 28rpx;
 	font-size: 28rpx;
+	margin-right: 32rpx;
 	color: #9FA7B7;
 	color: #9FA7B7;
 }
 }
 .item-value{
 .item-value{
@@ -132,4 +133,33 @@
 	color: #5E6F90;
 	color: #5E6F90;
 	font-size: 28rpx;
 	font-size: 28rpx;
 	justify-content: flex-end;
 	justify-content: flex-end;
+	flex-wrap: wrap;
+	align-items: flex-end;
+	flex-direction: column;
+}
+.return-money{
+	margin-right: 16rpx;
+	font-family: PingFangSC, PingFang SC;
+	font-weight: 400;
+	font-size: 30rpx;
+	color: #FA2918;
 }
 }
+.order-money{
+	font-family: PingFangSC, PingFang SC;
+	font-weight: 400;
+	font-size: 30rpx;
+	color: #060809;
+	display: flex;
+	margin-bottom: 32rpx;
+}
+.activation-btn{
+	width: 180rpx;
+	height: 64rpx;
+	background: #060809;
+	border-radius: 32rpx;
+	font-family: AlibabaPuHuiTiM;
+	font-size: 28rpx;
+	color: #FFFFFF;
+	line-height: 64rpx;
+	text-align: center;
+}

+ 55 - 22
pages/order/order.vue

@@ -18,29 +18,44 @@
 				</view>
 				</view>
 			</view>
 			</view>
 		</view>
 		</view>
-		<view v-for="(item, index) in hireOrderList" :key="index" @tap="loadToNav" :data-orderSn="item.order_sn"
+		<view v-for="(item, index) in hireOrderList" :key="index" @tap="loadToNav" :data-order_sn="item.order_sn"
 			class="order-card">
 			class="order-card">
 			<view class="card-top flex-row">
 			<view class="card-top flex-row">
 				<view>{{ item.car_model }}</view>
 				<view>{{ item.car_model }}</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>
-				<view class="card card-r" v-else-if="item.order_status == 4">已逾期</view>
-				<view class="card card-k" v-else-if="item.order_status == 5">还车申请中</view>
-				<view class="card card-k" v-else-if="item.order_status == 6">还车中</view>
-				<view class="card card-k" v-else-if="item.order_status == 7">车辆已归还</view>
-				<view class="card card-k" v-else-if="item.order_status == 8 || item.order_status == 9">已取消</view>
+				<view v-if="item.pay_status==2">
+					<view class="card card-k" v-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>
+					<view class="card card-r" v-else-if="item.order_status == 4">已逾期</view>
+					<view class="card card-k" v-else-if="item.order_status == 5">还车申请中</view>
+					<view class="card card-k" v-else-if="item.order_status == 6">还车中</view>
+					<view class="card card-k" v-else-if="item.order_status == 7">车辆已归还</view>
+					<view class="card card-k" v-else-if="item.order_status == 8 ">订单已支付,已取消</view>
+					<view class="card card-k" v-else-if=" item.order_status == 9">订单未支付,已取消</view>
+				</view>
+				<view v-if="item.pay_status!=2">
+					<view class="card card-k" v-if="item.pay_status == 0">待支付</view>
+					<view class="card card-k" v-else-if="item.pay_status == 1">支付中</view>
+					<view class="card card-r" v-else-if="item.pay_status == 3">支付失败</view>
+					<view class="card card-k" v-else-if="item.pay_status == 4">支付取消</view>
+					<view class="card card-b" v-else-if="item.pay_status == 5">线下待审核</view>
+					<view class="card card-k" v-else-if="item.pay_status == 6">线下审核拒绝</view>
+				</view>
+				
 			</view>
 			</view>
 			<view class="card-border"></view>
 			<view class="card-border"></view>
 			<view class="card-bottom">
 			<view class="card-bottom">
 				<view class="bottom-item">
 				<view class="bottom-item">
 					<view class="item-label-view flex-row">
 					<view class="item-label-view flex-row">
 						<view class="item-label">下单时间</view>
 						<view class="item-label">下单时间</view>
-						<view class="item-value">{{ tools.formatTime(item.settle_date) }}</view>
+						<view class="item-value">{{ tools.formatTime(item.pay_time) }}</view>
 					</view>
 					</view>
 					<view class="item-label-view flex-row">
 					<view class="item-label-view flex-row">
 						<view class="item-label">有效期至</view>
 						<view class="item-label">有效期至</view>
+						<view class="item-value">{{ tools.formatTime(item.hire_end_time) }}</view>
+					</view>
+					<view class="item-label-view flex-row">
+						<view class="item-label">有效时长</view>
 						<view class="item-value"><view>
 						<view class="item-value"><view>
 							{{ item.hire_duration_time.day > 0 ? item.hire_duration_time.day : '' }}<text
 							{{ 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 ?
 								v-if="item.hire_duration_time.day > 0">日</text>{{ item.hire_duration_time.hour > 0 ?
@@ -50,18 +65,22 @@
 								v-if="item.hire_duration_time.minute > 0">分</text>
 								v-if="item.hire_duration_time.minute > 0">分</text>
 						</view></view>
 						</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 v-if="selectOrderType==1" class="item-label-view flex-row">
+						<view class="item-label">订单类型</view>
+						<view class="item-value">{{ item.order_type==3?'购车':'租车' }}</view>
 					</view>
 					</view>
-					<view class="item-label-view flex-row">
+					<view v-if="selectOrderType==0" class="item-label-view flex-row">
 						<view class="item-label">免费换电数</view>
 						<view class="item-label">免费换电数</view>
 						<view class="item-value">{{ tools.formatTime(item.settle_date) }}</view>
 						<view class="item-value">{{ tools.formatTime(item.settle_date) }}</view>
 					</view>
 					</view>
-					<view class="flex-row button-config-view">
+					<view v-if="selectOrderType==0" class="flex-row button-config-view">
 						<view class="return-money">已退款</view>
 						<view class="return-money">已退款</view>
 						<view class="item-value">套餐金额$ <text class="money-style">5.0</text></view>
 						<view class="item-value">套餐金额$ <text class="money-style">5.0</text></view>
 					</view>
 					</view>
+					<view v-if="selectOrderType==1" class="flex-row button-config-view">
+						<view class="order-money">订单金额 $ 5.0</view>
+						<view @tap="activateCar" :data-sub_sn="item.sub_sn" class="activation-btn">激活车辆</view>
+					</view>
 				</view>
 				</view>
 			</view>
 			</view>
 		</view>
 		</view>
@@ -182,12 +201,9 @@
 			},
 			},
 
 
 			loadToNav(e) {
 			loadToNav(e) {
-				//#ifdef MP-ALIPAY
-				this.order_sn = e.currentTarget.dataset.orderSn
-				//#endif
-				//#ifdef MP-WEIXIN
-				this.order_sn = e.currentTarget.dataset.ordersn
-				//#endif
+				
+				this.order_sn = e.currentTarget.dataset.order_sn
+				
 				const isJumpReturn = false
 				const isJumpReturn = false
 				uni.navigateTo({
 				uni.navigateTo({
 					url: '/pages/orderStatus/orderStatus?order_sn=' + this.order_sn + '&longitude=' + this
 					url: '/pages/orderStatus/orderStatus?order_sn=' + this.order_sn + '&longitude=' + this
@@ -197,6 +213,23 @@
 					complete: function(res) {},
 					complete: function(res) {},
 				})
 				})
 			},
 			},
+			activateCar(e){
+				const sub_sn = e.currentTarget.dataset.sub_sn
+				uni.navigateTo({
+						url: '/pages/activation/activation?order_sn=' + sub_sn 
+					})
+				// uni.scanCode({
+				// 			onlyFromCamera: true,
+				// 			success: function (res) {
+				// 				uni.navigateTo({
+				// 					url: '/pages/activation/activation?order_sn=' + sub_sn 
+				// 				})
+				// 			},
+				// 			fail: function (res) { },
+				// 			complete: function (res) { },
+				// 		})
+				
+			}
 		}
 		}
 	};
 	};
 </script>
 </script>