import { ActionType, CopyText, DealerPicker, Icon, PageList, State, ToolBar, } from "@/components"; import Taro, { useShareAppMessage } from "@tarojs/taro"; import { useRef, useState } from "react"; import { business } from "@/services"; import hocAuth from "@/hocs/auth"; import { CommonComponent } from "@/types/typings"; import { Label, Text, View } from "@tarojs/components"; import { buildUrl } from "@/utils"; import dayjs from "dayjs"; import orderShip from "@/constant/orderShip"; import { Button } from "@nutui/nutui-react-taro"; export default hocAuth(function Page(props: CommonComponent) { const { shareOptions } = props; const [state, setState] = useState(); const [dealerVO, setDealerVO] = useState(); const actionRef = useRef(); const toolbar: ToolBar = { search: { activeKey: "vehicleNo", defaultActiveKey: "vehicleNo", items: [ { key: "vehicleNo", name: "车次号", placeholder: "请输入车次号", }, { key: "plate", name: "车牌号", placeholder: "请输入车牌号", }, ], }, tabs: { activeKey: "state", defaultActiveKey: state || "ALL", items: orderShip.stateList, onChange: (item) => { setState(item as BusinessAPI.OrderShipPageQry["state"]); actionRef.current?.reload(); }, }, render: () => ( <> { setDealerVO(dealerVO); actionRef.current?.reload(); }} trigger={ {dealerVO?.shortName || "经销商"} {dealerVO?.shortName ? ( { setDealerVO(undefined); actionRef.current?.reload(); event.stopPropagation(); }} /> ) : ( )} } /> ), }; useShareAppMessage((res) => { console.log("useShareAppMessage1", res, shareOptions); // 如果是按钮触发的转发,使用默认配置 if (res.from === "button") { return shareOptions; } // 页面转发使用设置的配置 return {}; }); return ( rowId={"orderShipId"} itemHeight={182} type={"infinite"} actionRef={actionRef} render={(orderShipVO: BusinessAPI.OrderShipVO, index) => ( {/* 头部区域:车次号 + 状态 */} { // await Taro.navigateTo({ // url: buildUrl("/pages/delivery/document", { // orderShipId: orderShipVO.orderShipId, // orderId: orderShipVO.orderId, // }), // }); // }} > {orderShipVO.orderVO?.orderVehicle?.dealerName}{" "} {orderShipVO.orderVO?.orderVehicle?.vehicleNo ? `第${orderShipVO.orderVO?.orderVehicle?.vehicleNo}车` : "暂未生成车次"} {`${orderShipVO.orderVO?.orderVehicle?.origin} → ${orderShipVO.orderVO?.orderVehicle?.destination}`} {/* 详细信息区域 */} { // await Taro.navigateTo({ // url: buildUrl("/pages/delivery/document", { // orderShipId: orderShipVO.orderShipId, // orderId: orderShipVO.orderId, // }), // }); }} > {orderShipVO.orderSn} {orderShip.getTypeLabel(orderShipVO.type)} {orderShipVO.createdByName} {dayjs(orderShipVO.createdAt).format("MM-DD HH:mm")} {/* 操作按钮区域 */} {orderShipVO.state !== "DRAFT" && orderShipVO.state !== "WAIT_SHIPMENT" && ( )} )} toolbar={toolbar} request={async (params) => { const { data: { data, success, notEmpty }, } = await business.orderShip.pageOrderShip({ orderShipPageQry: { ...params, //@ts-ignore state: state !== "ALL" ? state : undefined, ...(dealerVO ? { dealerId: dealerVO.dealerId, } : {}), }, }); return { data, success, hasMore: notEmpty, }; }} pagination={{ pageSize: 10, }} /> ); });