hejianhao
2026-06-29 2f8cf537589f07abb26bf0d0155d295f9f25c08e
feat(robotaxi): 支持订单评价多选反馈类型并调整接口参数格式
2个文件已修改
41 ■■■■■ 已修改文件
src/robotaxi/api/types/begin-route.ts 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/robotaxi/pages/begin-route/components/evaluate-popup.tsx 31 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/robotaxi/api/types/begin-route.ts
@@ -371,8 +371,8 @@
export interface SubmitOrderCommentPayload {
    /** 评价星级。 */
    orderRating: number;
    /** 反馈类型 ID。 */
    feedbackTypeId?: number;
    /** 反馈类型 ID,多个值使用英文逗号分隔。 */
    feedbackTypeId?: string;
    /** 反馈文案。 */
    feedbackContent?: string;
    /** 反馈图片 JSON。 */
@@ -385,8 +385,8 @@
export interface SubmitComplaintPayload {
    /** 评价星级。 */
    orderRating: number;
    /** 反馈类型 ID。 */
    feedbackTypeId?: number;
    /** 反馈类型 ID,多个值使用英文逗号分隔。 */
    feedbackTypeId?: string;
    /** 反馈文案。 */
    feedbackContent?: string;
    /** 反馈图片 JSON。 */
@@ -408,7 +408,7 @@
/** 评价类型项。 */
export interface OrderCommentTypeItem extends ExtendableRecord {
    /** 类型 ID。 */
    id?: number;
    id?: number | string;
    /** 类型名称。 */
    feedbackType?: string;
}
src/robotaxi/pages/begin-route/components/evaluate-popup.tsx
@@ -34,7 +34,7 @@
    const activeNormal = 'https://s.xiaopeng.com/xp-fe/robot-taxi/imgs/active-normal.png';
    const activeGood = 'https://s.xiaopeng.com/xp-fe/robot-taxi/imgs/active-good.png';
    const { visible, animationData } = useBottomPopupAnimation(show);
    const [selectedTypeId, setSelectedTypeId] = useState<number | null>(null); // 当前选择的问题类型
    const [selectedTypeIds, setSelectedTypeIds] = useState<string[]>([]); // 当前选择的问题类型列表
    const [feedbackContent, setFeedbackContent] = useState(''); // 反馈文本内容
    const [typeOptions, setTypeOptions] = useState<any[]>([]); // 问题类型选项
    const isSubmittingRef = useRef(false); // 同步提交锁,防止快速重复点击导致的并发提交
@@ -81,14 +81,31 @@
    };
    const evaluateDimension = evaluateDimensionMap[currentOrderRating] || 3; // 接口维度:1 满意,2 一般,3 不满意
    const shouldRequireFeedbackType = !hideFeedbackType;
    const canSubmit = shouldRequireFeedbackType ? !!selectedTypeId && !!feedbackContent.trim() : !!feedbackContent.trim();
    const canSubmit = shouldRequireFeedbackType ? selectedTypeIds.length > 0 && !!feedbackContent.trim() : !!feedbackContent.trim();
    const normalizeFeedbackTypeId = (typeId: unknown) => {
        if (typeId === null || typeId === undefined || typeId === '') {
            return '';
        }
        return String(typeId);
    };
    const toggleFeedbackType = (typeId: unknown) => {
        const normalizedTypeId = normalizeFeedbackTypeId(typeId);
        if (!normalizedTypeId) {
            return;
        }
        setSelectedTypeIds((prev) => (
            prev.includes(normalizedTypeId)
                ? prev.filter((id) => id !== normalizedTypeId)
                : [...prev, normalizedTypeId]
        ));
    };
    // 提交反馈(评价/投诉)
    const submit = () => {
        if (isSubmittingRef.current) {
            return;
        }
        if (shouldRequireFeedbackType && !selectedTypeId) {
        if (shouldRequireFeedbackType && selectedTypeIds.length === 0) {
            Taro.showToast({
                title: '请选择问题类型',
                icon: 'none'
@@ -130,8 +147,8 @@
            feedbackPictures: picturePayload,
            orderId: targetOrderId
        };
        if (!hideFeedbackType && selectedTypeId) {
            payload.feedbackTypeId = selectedTypeId;
        if (!hideFeedbackType && selectedTypeIds.length > 0) {
            payload.feedbackTypeId = selectedTypeIds.join(',');
        }
        submitter(payload).then((res: any) => {
            const isFailure = res?.success === false || (typeof res?.code === 'number' && res.code !== 0);
@@ -163,7 +180,7 @@
        if (!show) {
            return;
        }
        setSelectedTypeId(null);
        setSelectedTypeIds([]);
        setFeedbackContent('');
        resetImages();
        getOrderCommentType(evaluateDimension).then((res: any) => {
@@ -197,7 +214,7 @@
                            <View className='evaluate-problem-type-title'>反馈的问题类型:</View>
                            <View className='evaluate-problem-type-content'>
                                {typeOptions.map((item) => (
                                    <View key={item?.id} className={`evaluate-problem-type-content-item ${selectedTypeId === item?.id && 'active-tag'}`} onClick={() => setSelectedTypeId(item?.id)}>
                                    <View key={item?.id} className={`evaluate-problem-type-content-item ${selectedTypeIds.includes(normalizeFeedbackTypeId(item?.id)) && 'active-tag'}`} onClick={() => toggleFeedbackType(item?.id)}>
                                        <Text className='evaluate-problem-type-content-item-text'>{item?.tagContent}</Text>
                                    </View>
                                ))}