|
Before Width: | Height: | Size: 468 KiB After Width: | Height: | Size: 468 KiB |
|
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 1.3 KiB After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
|
Before Width: | Height: | Size: 48 KiB After Width: | Height: | Size: 48 KiB |
|
Before Width: | Height: | Size: 146 KiB After Width: | Height: | Size: 146 KiB |
|
|
@ -9,6 +9,7 @@ export type GoodsItem = {
|
||||||
price: string
|
price: string
|
||||||
sign_value: string
|
sign_value: string
|
||||||
weixinMpOriId: string
|
weixinMpOriId: string
|
||||||
|
recommend?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
export type OrderPayload = Record<string, unknown> & {
|
export type OrderPayload = Record<string, unknown> & {
|
||||||
|
|
|
||||||
|
|
@ -211,6 +211,42 @@ p {
|
||||||
background: #FFFFFF;
|
background: #FFFFFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.plan-recommend-badge {
|
||||||
|
position: absolute;
|
||||||
|
top: 0;
|
||||||
|
right: 0;
|
||||||
|
width: 34px;
|
||||||
|
height: 20px;
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
background: #FF2D2D;
|
||||||
|
border-radius: 0px 8px 0px 8px;
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.plan-recommend-badge span {
|
||||||
|
width: 24px;
|
||||||
|
height: 16px;
|
||||||
|
font-family: PingFang SC, PingFang SC;
|
||||||
|
font-weight: 400;
|
||||||
|
font-size: 12px;
|
||||||
|
color: #FFFFFF;
|
||||||
|
line-height: 16px;
|
||||||
|
text-align: left;
|
||||||
|
font-style: normal;
|
||||||
|
text-transform: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.plan-selected-icon {
|
||||||
|
position: absolute;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
width: 20px;
|
||||||
|
height: 20px;
|
||||||
|
pointer-events: none;
|
||||||
|
}
|
||||||
|
|
||||||
.plan-price-symbol {
|
.plan-price-symbol {
|
||||||
font-size: 10px;
|
font-size: 10px;
|
||||||
transition: color 320ms ease;
|
transition: color 320ms ease;
|
||||||
|
|
|
||||||
|
|
@ -69,6 +69,7 @@ function PayPage() {
|
||||||
try {
|
try {
|
||||||
const { data } = await getGoods()
|
const { data } = await getGoods()
|
||||||
const nextGoodsList = Array.isArray(data) ? data : []
|
const nextGoodsList = Array.isArray(data) ? data : []
|
||||||
|
const recommendIndex = nextGoodsList.findIndex((goods) => goods.recommend)
|
||||||
const checkedIndex = nextGoodsList.findIndex((goods) => goods.checked)
|
const checkedIndex = nextGoodsList.findIndex((goods) => goods.checked)
|
||||||
|
|
||||||
if (!isMounted) {
|
if (!isMounted) {
|
||||||
|
|
@ -76,7 +77,7 @@ function PayPage() {
|
||||||
}
|
}
|
||||||
|
|
||||||
setGoodsList(nextGoodsList)
|
setGoodsList(nextGoodsList)
|
||||||
setCurrentIndex(checkedIndex >= 0 ? checkedIndex : 0)
|
setCurrentIndex(recommendIndex >= 0 ? recommendIndex : checkedIndex >= 0 ? checkedIndex : 0)
|
||||||
} catch {
|
} catch {
|
||||||
if (isMounted) {
|
if (isMounted) {
|
||||||
setGoodsList([])
|
setGoodsList([])
|
||||||
|
|
@ -429,6 +430,11 @@ function Plan({
|
||||||
onClick={() => handlePlanClick(index)}
|
onClick={() => handlePlanClick(index)}
|
||||||
type="button"
|
type="button"
|
||||||
>
|
>
|
||||||
|
{plan.recommend && (
|
||||||
|
<span className="plan-recommend-badge">
|
||||||
|
<span>推荐</span>
|
||||||
|
</span>
|
||||||
|
)}
|
||||||
<div className="plan-name">{plan.goods_name}</div>
|
<div className="plan-name">{plan.goods_name}</div>
|
||||||
<div className="plan-price">
|
<div className="plan-price">
|
||||||
<span className="plan-price-symbol">¥</span>
|
<span className="plan-price-symbol">¥</span>
|
||||||
|
|
@ -438,6 +444,9 @@ function Plan({
|
||||||
<span>¥</span>
|
<span>¥</span>
|
||||||
{plan.origin_price}
|
{plan.origin_price}
|
||||||
</div>
|
</div>
|
||||||
|
{index === currentIndex && (
|
||||||
|
<img className="plan-selected-icon" src="/images/pay/icon-check-footer.png" alt="" />
|
||||||
|
)}
|
||||||
</button>
|
</button>
|
||||||
))}
|
))}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||