InboundMaterialSearchPage.xaml 3.8 KB
<?xml version="1.0" encoding="utf-8" ?>
<ContentPage  x:Name="Page"
    xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             x:Class="IndustrialControl.Pages.InboundMaterialSearchPage"
              xmlns:conv="clr-namespace:IndustrialControl.Converters"
             Title="仓储管理系统">

    <ContentPage.Resources>
        <ResourceDictionary>
            <!-- 空/非空转布尔:非空 => true(按钮可用) -->
            <conv:NullToBoolConverter x:Key="NullToBoolConverter" />
        </ResourceDictionary>
    </ContentPage.Resources>

    <Grid RowDefinitions="Auto,*,Auto" Padding="16" BackgroundColor="#F6F7FB">

        <!-- 顶部:输入条件(第0行) -->
        <VerticalStackLayout Grid.Row="0" Spacing="10">
            <Grid ColumnDefinitions="*,Auto" RowDefinitions="Auto,Auto" ColumnSpacing="8" RowSpacing="8">
                <Entry x:Name="OrderEntry"
                       Grid.Row="0" Grid.Column="0"
                       Placeholder="请输入入库单号/包裹条码"
                       VerticalOptions="Center"
                       BackgroundColor="White"
                       Text="{Binding SearchOrderNo}" />

                <DatePicker Grid.Row="1" Grid.Column="0"
                            Date="{Binding CreatedDate}"
                            MinimumDate="2000-01-01" />
                <Button Grid.Row="1" Grid.Column="1"
                        Text="查询"
                        Command="{Binding SearchCommand}" />
            </Grid>
        </VerticalStackLayout>

        <!-- 中部:结果列表(第1行) -->
        <CollectionView Grid.Row="1"
                        ItemsSource="{Binding Orders}"
                        SelectionMode="Single"
                        SelectionChanged="OnOrderSelected">
            <CollectionView.ItemTemplate>
                <DataTemplate>
                    <Frame Margin="0,8,0,0" Padding="12" HasShadow="True" CornerRadius="10">
                        <!-- ⭐ 点击整卡片触发命令 -->
                        <Frame.GestureRecognizers>
                            <TapGestureRecognizer
                                Command="{Binding BindingContext.OpenItemCommand, Source={x:Reference Page}}"
                                CommandParameter="{Binding .}" />
                        </Frame.GestureRecognizers>
                        <Grid RowDefinitions="Auto,Auto,Auto,Auto"
                              ColumnDefinitions="Auto,*" ColumnSpacing="8">
                            <Label Grid.Row="0" Grid.Column="0" Text="入库单号:" FontAttributes="Bold"/>
                            <Label Grid.Row="0" Grid.Column="1" Text="{Binding OrderNo}"/>

                            <Label Grid.Row="1" Grid.Column="0" Text="入库类型:" FontAttributes="Bold"/>
                            <Label Grid.Row="1" Grid.Column="1" Text="{Binding InboundType}" />

                            <Label Grid.Row="2" Grid.Column="0" Text="供应商:" FontAttributes="Bold"/>
                            <Label Grid.Row="2" Grid.Column="1" Text="{Binding Supplier}" />

                            <Label Grid.Row="3" Grid.Column="0" Text="创建日期:" FontAttributes="Bold"/>
                            <Label Grid.Row="3" Grid.Column="1" Text="{Binding CreatedAt, StringFormat='{0:yyyy-M-d}'}"/>
                        </Grid>
                    </Frame>
                </DataTemplate>
            </CollectionView.ItemTemplate>
        </CollectionView>

        <!-- 底部:操作(第2行) -->
        <Grid Grid.Row="2" ColumnDefinitions="*,Auto" Padding="0,8,0,0">
            <Label Text="{Binding Orders.Count, StringFormat='共 {0} 条'}"
                   VerticalTextAlignment="Center" />
        </Grid>
    </Grid>
</ContentPage>