From 1a4fa39e5b8215167bfbe4641ab66ca71362949f Mon Sep 17 00:00:00 2001 From: wubin Date: Wed, 14 Aug 2024 10:43:41 +0800 Subject: [PATCH 1/2] 'commit' --- .../rzyc-weapp-ylt-main/rzyc.code-workspace | 3 + MiniProgram/rzyc-weapp-ylt-main/src/app.tsx | 1 + .../src/pages/charging/charging.tsx | 32 ++- .../components/FilterView/FilterView.tsx | 2 +- .../src/pages/index/index.tsx | 8 +- .../NewFooter/NewFooter.scss | 62 +++++ .../select-free-plate/NewFooter/NewFooter.tsx | 50 ++++ .../select-free-plate/select-free-plate.scss | 233 ++++++++++++++++++ .../select-free-plate/select-free-plate.tsx | 212 ++++++++++++++++ .../src/services/charging.ts | 12 + .../src/services/my-car.ts | 13 + .../src/utils/request-enhance.ts | 3 +- 12 files changed, 617 insertions(+), 14 deletions(-) create mode 100644 MiniProgram/rzyc-weapp-ylt-main/src/pages/select-free-plate/NewFooter/NewFooter.scss create mode 100644 MiniProgram/rzyc-weapp-ylt-main/src/pages/select-free-plate/NewFooter/NewFooter.tsx create mode 100644 MiniProgram/rzyc-weapp-ylt-main/src/pages/select-free-plate/select-free-plate.scss create mode 100644 MiniProgram/rzyc-weapp-ylt-main/src/pages/select-free-plate/select-free-plate.tsx diff --git a/MiniProgram/rzyc-weapp-ylt-main/rzyc.code-workspace b/MiniProgram/rzyc-weapp-ylt-main/rzyc.code-workspace index 6bf1fc2..ab87d0e 100644 --- a/MiniProgram/rzyc-weapp-ylt-main/rzyc.code-workspace +++ b/MiniProgram/rzyc-weapp-ylt-main/rzyc.code-workspace @@ -21,6 +21,9 @@ }, "[typescript]": { "editor.defaultFormatter": "vscode.typescript-language-features" + }, + "[scss]": { + "editor.defaultFormatter": "vscode.css-language-features" } } } diff --git a/MiniProgram/rzyc-weapp-ylt-main/src/app.tsx b/MiniProgram/rzyc-weapp-ylt-main/src/app.tsx index 8a2f9f0..5f8ede6 100644 --- a/MiniProgram/rzyc-weapp-ylt-main/src/app.tsx +++ b/MiniProgram/rzyc-weapp-ylt-main/src/app.tsx @@ -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: [ { diff --git a/MiniProgram/rzyc-weapp-ylt-main/src/pages/charging/charging.tsx b/MiniProgram/rzyc-weapp-ylt-main/src/pages/charging/charging.tsx index de13d11..993e6fa 100644 --- a/MiniProgram/rzyc-weapp-ylt-main/src/pages/charging/charging.tsx +++ b/MiniProgram/rzyc-weapp-ylt-main/src/pages/charging/charging.tsx @@ -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 = () => { 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 = () => { 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}`, + }); + } + } } }; diff --git a/MiniProgram/rzyc-weapp-ylt-main/src/pages/index/components/FilterView/FilterView.tsx b/MiniProgram/rzyc-weapp-ylt-main/src/pages/index/components/FilterView/FilterView.tsx index 66086e8..0e4be30 100644 --- a/MiniProgram/rzyc-weapp-ylt-main/src/pages/index/components/FilterView/FilterView.tsx +++ b/MiniProgram/rzyc-weapp-ylt-main/src/pages/index/components/FilterView/FilterView.tsx @@ -169,7 +169,7 @@ export const FilterView: Taro.FC = ({ className="filter__search" hoverClass="btn-hover" onClick={() => onSearch(stationName)}> - 搜索 + 搜索1 diff --git a/MiniProgram/rzyc-weapp-ylt-main/src/pages/index/index.tsx b/MiniProgram/rzyc-weapp-ylt-main/src/pages/index/index.tsx index f3e5f3d..f57424d 100644 --- a/MiniProgram/rzyc-weapp-ylt-main/src/pages/index/index.tsx +++ b/MiniProgram/rzyc-weapp-ylt-main/src/pages/index/index.tsx @@ -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} */} - {/* */} + {currentTabElement} void; + onClick2?: () => void; +} & StandardProps; +export const Footer: Taro.FC = ({ + btnText, + btnText2, + onClick, + onClick2, +}) => { + const handleClick = () => { + if (typeof onClick === 'function') { + onClick(); + } + }; + const handleClick2 = () => { + if (typeof onClick2 === 'function') { + onClick2(); + } + }; + + return ( + + + + {btnText2} + + + {btnText} + + + + ); +}; + +Footer.defaultProps = { + btnText: '确定', + btnText2: '手动输入车牌号', +}; diff --git a/MiniProgram/rzyc-weapp-ylt-main/src/pages/select-free-plate/select-free-plate.scss b/MiniProgram/rzyc-weapp-ylt-main/src/pages/select-free-plate/select-free-plate.scss new file mode 100644 index 0000000..22e2a89 --- /dev/null +++ b/MiniProgram/rzyc-weapp-ylt-main/src/pages/select-free-plate/select-free-plate.scss @@ -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; +} \ No newline at end of file diff --git a/MiniProgram/rzyc-weapp-ylt-main/src/pages/select-free-plate/select-free-plate.tsx b/MiniProgram/rzyc-weapp-ylt-main/src/pages/select-free-plate/select-free-plate.tsx new file mode 100644 index 0000000..51ce130 --- /dev/null +++ b/MiniProgram/rzyc-weapp-ylt-main/src/pages/select-free-plate/select-free-plate.tsx @@ -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([]); + + 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 ( + + + {carList.length === 0 ? ( + 暂时没有爱车,请手动输入车牌号 + ) : ( + carList.map((item) => { + return ( + selectCar(item)}> + + + + + {item.plateNo} + {item.brandName ? ( + + {item.brandName} + {item.modelName} + + ) : ( + 新能源汽车 + )} + + + {selectedCarId == item.id ? ( + 已选中 + ) : ( + 未选中 + )} + + + {item.productDate && ( + + )} + {item.productDate && ( + {item.productDate} + )} + {item.carMileage && ( + + 续航里程 {item.carMileage}公里 + + )} + + + + ); + }) + )} + + + + + 手动输入车牌号 + + + 确 定 + + + + + + + 手动输入车牌号 + setConnectorSn(e.detail.value)}> + + + 取消 + + + 确定 + + + + + + ); +}; + +SelectFreePlate.config = { + navigationBarTitleText: '选择爱车', +}; diff --git a/MiniProgram/rzyc-weapp-ylt-main/src/services/charging.ts b/MiniProgram/rzyc-weapp-ylt-main/src/services/charging.ts index 5b378b5..9b9a367 100644 --- a/MiniProgram/rzyc-weapp-ylt-main/src/services/charging.ts +++ b/MiniProgram/rzyc-weapp-ylt-main/src/services/charging.ts @@ -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( '/userapi/userCar/getDefaultCar' diff --git a/MiniProgram/rzyc-weapp-ylt-main/src/services/my-car.ts b/MiniProgram/rzyc-weapp-ylt-main/src/services/my-car.ts index 0402f97..ff34919 100644 --- a/MiniProgram/rzyc-weapp-ylt-main/src/services/my-car.ts +++ b/MiniProgram/rzyc-weapp-ylt-main/src/services/my-car.ts @@ -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; +}; + diff --git a/MiniProgram/rzyc-weapp-ylt-main/src/utils/request-enhance.ts b/MiniProgram/rzyc-weapp-ylt-main/src/utils/request-enhance.ts index 096b542..304fdf6 100644 --- a/MiniProgram/rzyc-weapp-ylt-main/src/utils/request-enhance.ts +++ b/MiniProgram/rzyc-weapp-ylt-main/src/utils/request-enhance.ts @@ -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/'; From cae193a87ce122e90f7e17bc86ec2a995b4bb0c0 Mon Sep 17 00:00:00 2001 From: wubin Date: Wed, 14 Aug 2024 11:33:24 +0800 Subject: [PATCH 2/2] 'commit' --- .../select-free-plate/select-free-plate.scss | 47 +++++++++++++++++++ .../select-free-plate/select-free-plate.tsx | 32 ++++++------- 2 files changed, 61 insertions(+), 18 deletions(-) diff --git a/MiniProgram/rzyc-weapp-ylt-main/src/pages/select-free-plate/select-free-plate.scss b/MiniProgram/rzyc-weapp-ylt-main/src/pages/select-free-plate/select-free-plate.scss index 22e2a89..9e68157 100644 --- a/MiniProgram/rzyc-weapp-ylt-main/src/pages/select-free-plate/select-free-plate.scss +++ b/MiniProgram/rzyc-weapp-ylt-main/src/pages/select-free-plate/select-free-plate.scss @@ -230,4 +230,51 @@ .btn2 { margin-left: 20px; +} + +.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; + } } \ No newline at end of file diff --git a/MiniProgram/rzyc-weapp-ylt-main/src/pages/select-free-plate/select-free-plate.tsx b/MiniProgram/rzyc-weapp-ylt-main/src/pages/select-free-plate/select-free-plate.tsx index 51ce130..91ff712 100644 --- a/MiniProgram/rzyc-weapp-ylt-main/src/pages/select-free-plate/select-free-plate.tsx +++ b/MiniProgram/rzyc-weapp-ylt-main/src/pages/select-free-plate/select-free-plate.tsx @@ -58,30 +58,26 @@ export const SelectFreePlate: Taro.FC = () => { }); } else { showFailToast('车牌号格式不正确!'); + setConnectorSn(''); return; } } }; - const handleSave = async () => { + const handleSave = () => { if (selectedCarId == 0) { - showFailToast('请选择车辆或手动输入车牌号!'); + 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}`, - // }); + 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}`, + }); } }; @@ -99,7 +95,7 @@ export const SelectFreePlate: Taro.FC = () => { {carList.length === 0 ? ( - 暂时没有爱车,请手动输入车牌号 + 暂时没有爱车,请手工输入车牌号 ) : ( carList.map((item) => { return ( @@ -158,7 +154,7 @@ export const SelectFreePlate: Taro.FC = () => { className="btnCtrl btn1" hoverClass="btn-hover" onClick={handleInputCode}> - 手动输入车牌号 + 手工输入车牌号 { className="station-detail__overlay" onClick={handleCloseModal}> - 手动输入车牌号 + 手工输入车牌号 setConnectorSn(e.detail.value)}>