import { ActionType, Icon, PageList, SupplierPicker, ToolBar, } from "@/components"; import { useShareAppMessage } from "@tarojs/taro"; import { useRef, useState } from "react"; import { business } from "@/services"; import hocAuth from "@/hocs/auth"; import { CommonComponent } from "@/types/typings"; import { View } from "@tarojs/components"; import dayjs from "dayjs"; export default hocAuth(function Page(props: CommonComponent) { const { shareOptions } = props; const [supplierVO, setSupplierVO] = useState(); const actionRef = useRef(); const toolbar: ToolBar = { selectRow: { onClick: async (orderSupplierVOList: BusinessAPI.OrderSupplierVO[]) => { console.log("orderSupplierVOList", orderSupplierVOList); }, }, search: { activeKey: "vehicleNo", defaultActiveKey: "vehicleNo", items: [ { key: "vehicleNo", name: "车次号", placeholder: "请输入车次号", }, { key: "plate", name: "车牌号", placeholder: "请输入车牌号", }, ], }, render: () => ( <> { setSupplierVO(supplierVO); actionRef.current?.reload(); }} trigger={ {supplierVO?.name || "瓜农"} {supplierVO?.name ? ( { setSupplierVO(undefined); actionRef.current?.reload(); event.stopPropagation(); }} /> ) : ( )} } /> ), }; useShareAppMessage((res) => { console.log("useShareAppMessage1", res, shareOptions); // 如果是按钮触发的转发,使用默认配置 if (res.from === "button") { return shareOptions; } // 页面转发使用设置的配置 return {}; }); return ( rowId={"orderSupplierId"} itemHeight={182} type={"infinite"} actionRef={actionRef} render={(orderSupplierVO: BusinessAPI.OrderSupplierVO, index) => ( {orderSupplierVO.name} ( {orderSupplierVO.orderVehicle?.origin}- {orderSupplierVO.orderVehicle?.destination}) {/**/} {/* 草稿*/} {/**/} {orderSupplierVO.orderVehicle?.vehicleNo ? "第" + orderSupplierVO.orderVehicle?.vehicleNo + "车" : "暂未生成车次"} {dayjs(orderSupplierVO.orderVehicle?.deliveryTime).format( "MM-DD", )} | {orderSupplierVO.netWeight}斤 | ¥{orderSupplierVO.invoiceAmount} {`${orderSupplierVO.productName} | 品种:`} )} toolbar={toolbar} request={async (params) => { const { data: { data, success, notEmpty }, } = await business.orderSupplier.pageOrderSupplier({ orderSupplierPageQry: { ...params, ...(supplierVO ? { supplierId: supplierVO.supplierId, } : {}), }, }); return { data, success, hasMore: notEmpty, }; }} pagination={{ pageSize: 10, }} /> ); });