|
|
|
@ -1,18 +1,104 @@ |
|
|
|
/** |
|
|
|
/** |
|
|
|
* 未结算账单页 |
|
|
|
* 未结算账单页 |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
import { View, Text } from '@tarojs/components' |
|
|
|
import { View, Text, Image, Button } from '@tarojs/components' |
|
|
|
import { useLoad } from '@tarojs/taro' |
|
|
|
import { useState } from 'react' |
|
|
|
|
|
|
|
import Taro, { useLoad } from '@tarojs/taro' |
|
|
|
|
|
|
|
import { Divider } from '@taroify/core' |
|
|
|
|
|
|
|
import { Arrow } from '@taroify/icons' |
|
|
|
import './index.scss' |
|
|
|
import './index.scss' |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
const noDataImg = require('../../assets/big/noData.png') |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 未结算订单数据接口
|
|
|
|
|
|
|
|
interface UnsettledOrderItem { |
|
|
|
|
|
|
|
id: string |
|
|
|
|
|
|
|
type: string // 台球 / 自助售货机
|
|
|
|
|
|
|
|
amount: number // 消费金额
|
|
|
|
|
|
|
|
consumeTime: string // 消费时间
|
|
|
|
|
|
|
|
orderNo: string // 订单号
|
|
|
|
|
|
|
|
storeName: string // 门店
|
|
|
|
|
|
|
|
address: string // 地址
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
const UnsettledOrders = () => { |
|
|
|
const UnsettledOrders = () => { |
|
|
|
|
|
|
|
// 模拟未结算订单数据
|
|
|
|
|
|
|
|
const [orderList] = useState<UnsettledOrderItem[]>([]) |
|
|
|
|
|
|
|
|
|
|
|
useLoad(() => { |
|
|
|
useLoad(() => { |
|
|
|
console.log('未结算账单页面加载') |
|
|
|
console.log('未结算账单页面加载') |
|
|
|
}) |
|
|
|
}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 点击详情
|
|
|
|
|
|
|
|
const handleDetailClick = (orderId: string) => { |
|
|
|
|
|
|
|
console.log('查看订单详情', orderId) |
|
|
|
|
|
|
|
Taro.navigateTo({ |
|
|
|
|
|
|
|
url: `/pagesUser/orderDetail/index?orderId=${orderId}` |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 立即支付
|
|
|
|
|
|
|
|
const handlePay = (orderId: string) => { |
|
|
|
|
|
|
|
console.log('立即支付', orderId) |
|
|
|
|
|
|
|
Taro.showToast({ |
|
|
|
|
|
|
|
title: '跳转支付', |
|
|
|
|
|
|
|
icon: 'none' |
|
|
|
|
|
|
|
}) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
return ( |
|
|
|
<View className="unsettled-orders-page"> |
|
|
|
<View className="unsettled-orders-page"> |
|
|
|
<Text>未结算账单</Text> |
|
|
|
{orderList.length === 0 ? ( |
|
|
|
|
|
|
|
<View className="empty-data"> |
|
|
|
|
|
|
|
<Image className="empty-image" src={noDataImg} mode="aspectFit" /> |
|
|
|
|
|
|
|
<Text className="empty-text">没有数据哦~</Text> |
|
|
|
|
|
|
|
</View> |
|
|
|
|
|
|
|
) : ( |
|
|
|
|
|
|
|
<View className="order-list"> |
|
|
|
|
|
|
|
{orderList.map(order => ( |
|
|
|
|
|
|
|
<View key={order.id} className="order-card"> |
|
|
|
|
|
|
|
{/* 标题行 */} |
|
|
|
|
|
|
|
<View className="card-header"> |
|
|
|
|
|
|
|
<Text className="order-type">{order.type}</Text> |
|
|
|
|
|
|
|
<View className="detail-btn" onClick={() => handleDetailClick(order.id)}> |
|
|
|
|
|
|
|
<Text className="detail-text">详情</Text> |
|
|
|
|
|
|
|
<Arrow size="16px" color="#8B8B8B" /> |
|
|
|
|
|
|
|
</View> |
|
|
|
|
|
|
|
</View> |
|
|
|
|
|
|
|
<Divider dashed={true} /> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{/* 订单信息 */} |
|
|
|
|
|
|
|
<View className="card-info"> |
|
|
|
|
|
|
|
<View className="info-row"> |
|
|
|
|
|
|
|
<Text className="info-label">消费金额</Text> |
|
|
|
|
|
|
|
<Text className="info-value">{order.amount.toFixed(2)}元</Text> |
|
|
|
|
|
|
|
</View> |
|
|
|
|
|
|
|
<View className="info-row"> |
|
|
|
|
|
|
|
<Text className="info-label">消费时间</Text> |
|
|
|
|
|
|
|
<Text className="info-value">{order.consumeTime}</Text> |
|
|
|
|
|
|
|
</View> |
|
|
|
|
|
|
|
<View className="info-row"> |
|
|
|
|
|
|
|
<Text className="info-label">订单号</Text> |
|
|
|
|
|
|
|
<Text className="info-value">{order.orderNo}</Text> |
|
|
|
|
|
|
|
</View> |
|
|
|
|
|
|
|
<View className="info-row"> |
|
|
|
|
|
|
|
<Text className="info-label">门店</Text> |
|
|
|
|
|
|
|
<Text className="info-value">{order.storeName}</Text> |
|
|
|
|
|
|
|
</View> |
|
|
|
|
|
|
|
<View className="info-row"> |
|
|
|
|
|
|
|
<Text className="info-label">地址</Text> |
|
|
|
|
|
|
|
<Text className="info-value">{order.address}</Text> |
|
|
|
|
|
|
|
</View> |
|
|
|
|
|
|
|
</View> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
{/* 立即支付按钮 */} |
|
|
|
|
|
|
|
<Button className="pay-btn" onClick={() => handlePay(order.id)}> |
|
|
|
|
|
|
|
立即支付 |
|
|
|
|
|
|
|
</Button> |
|
|
|
|
|
|
|
</View> |
|
|
|
|
|
|
|
))} |
|
|
|
|
|
|
|
</View> |
|
|
|
|
|
|
|
)} |
|
|
|
</View> |
|
|
|
</View> |
|
|
|
) |
|
|
|
) |
|
|
|
} |
|
|
|
} |
|
|
|
|