main^2
wubin 11 months ago
parent f7f0bf649d
commit 1a4fa39e5b

@ -21,6 +21,9 @@
},
"[typescript]": {
"editor.defaultFormatter": "vscode.typescript-language-features"
},
"[scss]": {
"editor.defaultFormatter": "vscode.css-language-features"
}
}
}

@ -111,6 +111,7 @@ class App extends Component {
'pages/labor-union/labor-union',
'pages/labor-union-login/labor-union-login',
'pages/test/test',
'pages/select-free-plate/select-free-plate',
],
subPackages: [
{

@ -16,8 +16,9 @@ import {
QueryEquipmentStatusRes,
stopCharge,
getDefaultCar,
isThirdPartyStation,
} from '@/services/charging';
import { showModal } from '@/utils/wechat-ui';
import { showModal, showModalOnlyWithConfirmBtn } from '@/utils/wechat-ui';
import classNames from 'classnames';
import {
contact,
@ -66,9 +67,8 @@ export const Charging: Taro.FC<ChargingProps> = () => {
setRealTimeInfo(res);
if (res.orderState !== 2) {
Taro.redirectTo({
url: `/pages/order-detail/order-detail?isFromCharging=${true}&orderNo=${
router.params.orderNo
}`,
url: `/pages/order-detail/order-detail?isFromCharging=${true}&orderNo=${router.params.orderNo
}`,
});
}
}
@ -119,11 +119,27 @@ export const Charging: Taro.FC<ChargingProps> = () => {
orderNo: router.params.orderNo,
});
if (stopRes) {
Taro.redirectTo({
url: `/pages/order-detail/order-detail?isFromCharging=${true}&orderNo=${
router.params.orderNo
}`,
//是否为合作道闸车场,如果是有免费停车时长,跳转到选车界面
const freeTimeRes = await isThirdPartyStation({
order_no: router.params.orderNo,
});
if (freeTimeRes.success) {
const freeRes = await showModalOnlyWithConfirmBtn(
'提示',
'请输入车辆信息领取免费停车时长!'
);
if (freeRes.confirm) {
Taro.redirectTo({
url: `/pages/select-free-plate/select-free-plate?order_no=${router.params.orderNo}`,
});
}
} else {
Taro.redirectTo({
url: `/pages/order-detail/order-detail?isFromCharging=${true}&orderNo=${router.params.orderNo}`,
});
}
}
}
};

@ -169,7 +169,7 @@ export const FilterView: Taro.FC<FilterViewProps> = ({
className="filter__search"
hoverClass="btn-hover"
onClick={() => onSearch(stationName)}>
<Text className="filter__search-txt"></Text>
<Text className="filter__search-txt">1</Text>
</View>
</AtInput>
</View>

@ -59,11 +59,11 @@ export default function Index() {
}
};
const handleHuanghai = async () => {
// const res = await huangHaiTest();
const handleTest = async () => {
// const res = await huangHaiTest();
// console.log(res.data[0].columns.dictValue);
Taro.navigateTo({ url: `/pages/test/test` });
Taro.redirectTo({ url: `/pages/select-free-plate/select-free-plate?order_no=123456` });
// Taro.navigateTo({
// url: `/pages/labor-union/labor-union`,
@ -197,7 +197,7 @@ export default function Index() {
onScrollToLower={handleScrollToLower}>
{currentTabElement}
</ScrollView> */}
{/* <Button size='mini' onClick={handleHuanghai}>按钮</Button> */}
<Button size='mini' onClick={handleTest}></Button>
<View className="index">{currentTabElement}</View>
<AtTabBar
fixed

@ -0,0 +1,62 @@
.station-footer {
position: fixed;
bottom: 0;
left: 0;
right: 0;
background: $rz-text-color-inverse;
height: 120px;
padding: 0 $rz-spacing-row-xxxl;
padding-bottom: constant(safe-area-inset-bottom);
padding-bottom: env(safe-area-inset-bottom);
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
box-shadow: 0px 0px 15px 1px rgba(111, 140, 192, 0.3);
.btn-box {
display: flex;
flex-direction: row;
align-items: center;
&__left {
display: flex;
align-items: baseline;
}
&__symbol {
font-size: $rz-font-size-xl;
color: $rz-color-primary;
font-weight: 600;
}
&__price {
font-size: 42px;
color: $rz-color-primary;
font-weight: 600;
}
&__btn {
// margin-left: $rz-spacing-row-xxxl;
@include display-flex-center;
// width: 330px;
padding: 0 36px;
height: 90px;
background: $rz-color-primary;
// border-radius: 45px;
&-txt {
color: $rz-text-color-inverse;
font-size: $rz-font-size-lg;
}
.btn-box__txt {
color: $rz-color-primary;
font-size: $rz-font-size-lg;
}
}
&__btn2 {
border-top-left-radius: 45px;
border-bottom-left-radius: 45px;
background: #ecf6ee;
margin-left: $rz-spacing-row-xl;
}
&__btn1 {
border-top-right-radius: 45px;
border-bottom-right-radius: 45px;
}
}
}

@ -0,0 +1,50 @@
import { StandardProps } from '@tarojs/components/types/common';
import { View, Text } from '@tarojs/components';
import './NewFooter.scss';
type FooterProps = {
btnText?: string;
btnText2?: string;
onClick?: () => void;
onClick2?: () => void;
} & StandardProps;
export const Footer: Taro.FC<FooterProps> = ({
btnText,
btnText2,
onClick,
onClick2,
}) => {
const handleClick = () => {
if (typeof onClick === 'function') {
onClick();
}
};
const handleClick2 = () => {
if (typeof onClick2 === 'function') {
onClick2();
}
};
return (
<View className="station-footer">
<View className="btn-box">
<View
className="btn-box__btn btn-box__btn2"
hoverClass="btn-hover"
onClick={handleClick2}>
<Text className="btn-box__txt">{btnText2}</Text>
</View>
<View
className="btn-box__btn btn-box__btn1"
hoverClass="btn-hover"
onClick={handleClick}>
<Text className="btn-box__btn-txt">{btnText}</Text>
</View>
</View>
</View>
);
};
Footer.defaultProps = {
btnText: '确定',
btnText2: '手动输入车牌号',
};

@ -0,0 +1,233 @@
// @keyframes flash {
// 0% {
// left: -150px;
// }
// 100% {
// left: 120%;
// }
// }
.my-car {
// padding-top: $rz-spacing-col-xxxl;
height: 100vh;
background: $rz-bg-color-grey;
&__tip {
margin: $rz-spacing-col-base $rz-spacing-row-xxxl;
color: $rz-text-color;
}
}
.card {
box-sizing: border-box;
margin: 32px auto;
// margin-top: 0;
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
width: 686px;
// height: 258px;
background: white;
border-radius: 20px;
color: white;
}
.car-card {
box-sizing: border-box;
justify-content: space-between;
padding: 48px;
padding-top: 38px;
padding-bottom: 20px;
background: url('../../assets/images/my-car/img_mycar_bg.png') no-repeat;
background-size: 100%;
position: relative;
.top {
width: 100%;
display: flex;
justify-content: space-between;
.left {
display: flex;
&__logo {
width: 100px;
height: 100px;
border-radius: 100px;
}
.left-info {
margin-left: 12px;
height: 100px;
display: flex;
align-items: flex-start;
justify-content: space-between;
flex-direction: column;
&__palate-no {
font-size: 34px;
}
}
}
.right {
width: 160px;
height: 52px;
line-height: 52px;
text-align: center;
font-size: 24px;
border: 2px solid #fff;
border-radius: 36px;
&.set-default {
background: white;
color: $rz-color-primary;
}
}
}
.bottom {
width: 100%;
display: flex;
justify-content: flex-end;
align-items: center;
font-size: 24px;
padding-top: $rz-spacing-col-sm;
&__clock {
width: 26px;
height: 26px;
margin-right: 12px;
}
&__time {
margin-right: 20px;
}
}
.close {
width: 48px;
height: 48px;
position: absolute;
right: -16px;
top: -16px;
}
}
.add-card {
padding: $rz-spacing-col-base 0;
&__img {
width: 90px;
height: 90px;
}
&__txt {
margin-top: 22px;
color: $rz-color-primary;
font-size: 32px;
font-weight: 500;
}
}
.station-detail {
background: #f9f9f9;
padding-bottom: 120px;
&__list {
margin-top: $rz-spacing-col-base;
}
&__list2 {
border-top: 2px solid #f9f9f9;
margin-bottom: $rz-spacing-col-base;
}
&__phone {
font-size: $rz-font-size-xl;
color: $rz-color-primary;
font-weight: 500;
}
&__white {
padding-bottom: constant(safe-area-inset-bottom);
padding-bottom: env(safe-area-inset-bottom);
}
.strong {
font-weight: 500;
}
&__modal {
position: fixed;
left: 0;
top: 0;
right: 0;
bottom: 0;
display: none;
z-index: $zindex-modal;
}
&--active {
display: block;
.station-detail__overlay,
.station-detail__container {
opacity: 1;
}
}
&__overlay,
&__container {
opacity: 0;
transition: opacity 0.2s ease-in;
}
&__overlay {
@include overlay;
}
&__container {
position: absolute;
left: 32px;
top: 30%;
width: 686px;
background: rgba(255, 255, 255, 1);
box-shadow: 0px 0px 20px 0px rgba(54, 64, 110, 0.16);
border-radius: 20px;
box-sizing: border-box;
padding: 32px 50px;
}
&__title {
text-align: center;
}
&__input {
margin-top: 36px;
margin-bottom: 50px;
height: 120px;
background: #ecf6ee;
opacity: 0.5;
border-radius: 8px;
padding-left: 37px;
}
&__box {
display: flex;
justify-content: space-between;
.foo {
width: 250px;
// height: 68px;
}
}
}
.station-footer {
position: fixed;
bottom: 0;
left: 0;
right: 0;
background: $rz-text-color-inverse;
height: 120px;
padding: 0 $rz-spacing-row-xxxl;
padding-bottom: constant(safe-area-inset-bottom);
padding-bottom: env(safe-area-inset-bottom);
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
box-shadow: 0px 0px 15px 1px rgba(111, 140, 192, 0.3);
}
.btnCtrl {
color: #ffffff;
border-radius: 45rpx;
display: flex;
justify-content: center;
align-items: center;
flex-direction: row;
padding: 0 36rpx;
height: 90rpx;
background: #23bf69;
}
.btn1 {
background: #ecf6ee;
color: #23bf69;
margin-right: 20px;
}
.btn2 {
margin-left: 20px;
}

@ -0,0 +1,212 @@
import { ScrollView, View, Image, Text, Input } from '@tarojs/components';
import './select-free-plate.scss';
import { useState, useDidShow, useRouter } from '@tarojs/taro';
import classNames from 'classnames';
import iconEduTime from '@/assets/images/my-car/icon_edu_time.png';
import defaultCar from '@/assets/images/my-car/default_car.png';
import {
getUserCar,
GetUserCarRes,
syncChargePilePay,
} from '@/services/my-car';
import { RzException } from '@/components/RzException/RzException';
import { showFailToast, showModalOnlyWithConfirmBtn } from '@/utils/wechat-ui';
import { AtButton } from 'taro-ui';
export const SelectFreePlate: Taro.FC = () => {
const router = useRouter();
const [isShowInputModal, setIsShowInputModal] = useState(false);
const [connectorSn, setConnectorSn] = useState('');
const [selectedCarId, setSelectedCarId] = useState(0);
const [carList, setCarList] = useState<GetUserCarRes[]>([]);
const validateCarPlate = (plate) => {
const pattern = /^(([京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领][A-Z](([0-9]{5}[DF])|([DF]([A-HJ-NP-Z0-9])[0-9]{4})))|([京津沪渝冀豫云辽黑湘皖鲁新苏浙赣鄂桂甘晋蒙陕吉闽贵粤青藏川宁琼使领][A-Z][A-HJ-NP-Z0-9]{4}[A-HJ-NP-Z0-9挂学警港澳使领]))$/
return pattern.test(plate);
};
const getUserCarList = async () => {
const res = await getUserCar();
if (res) {
setCarList(res);
}
};
useDidShow(() => {
getUserCarList();
});
const handleCloseModal = () => {
setIsShowInputModal(false);
setConnectorSn('');
};
const handleModalSave = () => {
if (connectorSn.length == 0) {
showFailToast('请输入车牌号!');
return;
} else {
if (validateCarPlate(connectorSn)) {
handleCloseModal();
syncChargePilePay({
order_no: router.params.order_no,
charge_plate_no: connectorSn
});
Taro.redirectTo({
url: `/pages/order-detail/order-detail?isFromCharging=${true}&orderNo=${router.params.order_no}`,
});
} else {
showFailToast('车牌号格式不正确!');
return;
}
}
};
const handleSave = async () => {
if (selectedCarId == 0) {
showFailToast('请选择车辆或手动输入车牌号!');
return;
} else {
const res = await showModalOnlyWithConfirmBtn(
'提示',
'当前微信版本过低,微信订阅消息,请升级到最新微信版本后重试。'
);
console.log(res);
// syncChargePilePay({
// order_no: router.params.order_no,
// charge_plate_no: connectorSn
// });
// Taro.redirectTo({
// url: `/pages/order-detail/order-detail?isFromCharging=${true}&orderNo=${router.params.order_no}`,
// });
}
};
const handleInputCode = () => {
setIsShowInputModal(true);
};
const selectCar = (item?: GetUserCarRes) => {
setSelectedCarId(item.id);
setConnectorSn(item.plateNo.toString())
};
return (
<View>
<ScrollView scrollY className="my-car">
{carList.length === 0 ? (
<RzException type="nodata"></RzException>
) : (
carList.map((item) => {
return (
<View
className={classNames('card', 'car-card', {
'is-default': item.isDefault === '0',
})}
v-for="(item, index) in carList"
key={item.id}
onClick={() => selectCar(item)}>
<View className="top">
<View className="left">
<Image
className="left__logo"
src={item.carPicture || defaultCar}></Image>
<View className="left-info">
<View className="left-info__plate-no">{item.plateNo}</View>
{item.brandName ? (
<View className="left-info__brand">
{item.brandName}
{item.modelName}
</View>
) : (
<View className="left-info__brand"></View>
)}
</View>
</View>
{selectedCarId == item.id ? (
<View className="right set-default"></View>
) : (
<View className="right"></View>
)}
</View>
<View className="bottom">
{item.productDate && (
<Image className="bottom__clock" src={iconEduTime}></Image>
)}
{item.productDate && (
<View className="bottom__time">{item.productDate}</View>
)}
{item.carMileage && (
<View className="bottom__mile">
{item.carMileage}
</View>
)}
</View>
</View>
);
})
)}
</ScrollView>
<View className="station-footer">
<View
className="btnCtrl btn1"
hoverClass="btn-hover"
onClick={handleInputCode}>
<Text className=""></Text>
</View>
<View
className="btnCtrl btn2"
hoverClass="btn-hover"
onClick={handleSave}>
<Text className=""> </Text>
</View>
</View>
<View
className={classNames('station-detail__modal', {
'station-detail--active': isShowInputModal,
})}>
<View
className="station-detail__overlay"
onClick={handleCloseModal}></View>
<View className="station-detail__container">
<View className="station-detail__title"></View>
<Input
className="station-detail__input"
placeholder="请输入车牌号"
maxLength={20}
value=''
onInput={(e) => setConnectorSn(e.detail.value)}></Input>
<View className="station-detail__box">
<AtButton
type="secondary"
circle
className="foo"
size="small"
onClick={handleCloseModal}>
</AtButton>
<AtButton
type="primary"
circle
className="foo"
size="small"
onClick={handleModalSave}>
</AtButton>
</View>
</View>
</View>
</View>
);
};
SelectFreePlate.config = {
navigationBarTitleText: '选择爱车',
};

@ -52,6 +52,18 @@ export const stopCharge = async (params: StopChargeReq) => {
return res;
};
export type IsThirdPartyStationReq = {
order_no: string;
};
export const isThirdPartyStation = async (params: IsThirdPartyStationReq) => {
const res = await RzRequest.postNew(
'/ZhuQue/Ylt/isThirdPartyStation',
params
);
return res;
};
export const getDefaultCar = async () => {
const res = await RzRequest.post<GetUserCarRes>(
'/userapi/userCar/getDefaultCar'

@ -80,3 +80,16 @@ export const getUserCar = async () => {
);
return res;
};
export type SyncChargePilePayReq = {
order_no: string;
charge_plate_no: string;
};
export const syncChargePilePay = async (params: SyncChargePilePayReq) => {
const res = await RzRequest.postNew(
'/ZhuQue/Ylt/SyncChargePilePay',
params
);
return res;
};

@ -8,7 +8,8 @@ import { getGlobalData, setGlobalData } from './global-data';
// export const BASE_URL = 'https://ylt.ikbvip.com';
//本地
export const BASE_URL = 'http://10.10.21.20:7001';
//export const BASE_URL = 'http://10.10.21.20:7001';
export const BASE_URL = 'http://10.10.14.77:7001';
// export const BASE_URL = 'https://wechatapps.test-ylt.ikbvip.com/';

Loading…
Cancel
Save