hejianhao
2026-05-12 f4d38b145a88d17e6b710b26fad862dba85f5fe9
feat(invoice): 为已完成订单添加开发票功能并修复开发环境发票URL

新增 INVOICE_CHARGE_URL 环境常量用于生产和开发配置
修复开发环境 INVOICE_URL 的参数顺序错误
更新订单页面,添加订单号校验并传递订单号到发票页面
4个文件已修改
28 ■■■■■ 已修改文件
config/dev.js 4 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
config/prod.js 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/constants/api.ts 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/robotaxi/pages/order/index.tsx 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
config/dev.js
@@ -25,7 +25,8 @@
const ROBOTAXI_HOST = '"https://rt-api.deploy-test.xiaopeng.com"';
const ROBOTAXI_WS_HOST = '"wss://rt-ws.deploy-test.xiaopeng.com/websocket"';
const AMAP_KEY = '"8157fdfa13878d3f7bf69c560c8a846a"';
const INVOICE_URL = '"https://pay.deploy-test.xiaopeng.com/invoice.html?bizType=rt#/entry"';
const INVOICE_URL = '"https://pay.deploy-test.xiaopeng.com/invoice.html#/entry?bizType=rt"';
const INVOICE_CHARGE_URL = '"https://pay.deploy-test.xiaopeng.com/invoice.html?bizType=rt&orderNo=#/charge"';
const XP_APPID_MAP = {
  weapp: '"xp_cs_wom"',
@@ -98,6 +99,7 @@
    ROBOTAXI_WS_HOST,
    AMAP_KEY,
    INVOICE_URL,
    INVOICE_CHARGE_URL,
  },
  mini: {
    // webpackChain (chain) {
config/prod.js
@@ -21,6 +21,7 @@
const ROBOTAXI_WS_HOST = '"wss://rt-ws.xiaopeng.com/websocket"';
const AMAP_KEY = '"8157fdfa13878d3f7bf69c560c8a846a"';
const INVOICE_URL = '"https://pay.xiaopeng.com/invoice.html?bizType=rt#/entry"';
const INVOICE_CHARGE_URL = '"https://pay.xiaopeng.com/invoice.html?bizType=rt&orderNo=#/charge"';
const XP_APPID_MAP = {
  weapp: '"xp_cs_wom"', // 用户中心登录appId
@@ -91,6 +92,7 @@
    ROBOTAXI_WS_HOST,
    AMAP_KEY,
    INVOICE_URL,
    INVOICE_CHARGE_URL,
  },
  mini: {
    // module: {
src/constants/api.ts
@@ -50,6 +50,8 @@
// 发票URL
//@ts-ignore
export const _INVOICE_URL = INVOICE_URL
//@ts-ignore
export const _INVOICE_CHARGE_URL = INVOICE_CHARGE_URL
// pic CDN
export const CDN = 'https://s.xiaopeng.com/xp-fe/mini'
src/robotaxi/pages/order/index.tsx
@@ -3,7 +3,7 @@
import { View, Image } from '@tarojs/components';
import './index.less';
import { getOrderHistoryList, OrderHistoryGroup } from '../../../robotaxi/api/order';
import { _INVOICE_URL } from '../../../constants/api';
import { _INVOICE_CHARGE_URL } from '../../../constants/api';
type OrderFilterKey = 'all' | 'pendingPay' | 'completed' | 'cancelled';
@@ -20,6 +20,8 @@
  completed: 10,
  cancelled: 0
};
const XP_INVOICE_APP_ID = 'xp_invoice';
export default function OrderPage() {
  const router = useRouter();
@@ -105,9 +107,19 @@
    })
  }
  const toInvoicePage = () => {
  // 根据当前订单号跳转到发票开具页面。
  const toInvoicePage = (orderId?: string) => {
    if (!orderId) {
      Taro.showToast({
        title: '订单号缺失',
        icon: 'none'
      });
      return;
    }
    const invoicePageUrl = _INVOICE_CHARGE_URL.replace('orderNo=', `orderNo=${encodeURIComponent(orderId)}`);
    Taro.navigateTo({
      url: `/pages/webpage/index?pageUrl=${encodeURIComponent(_INVOICE_URL)}&appId=xp_invoice`
      url: `/pages/webpage/index?pageUrl=${encodeURIComponent(invoicePageUrl)}&appId=${XP_INVOICE_APP_ID}`
    })
  }
@@ -185,7 +197,7 @@
                }
                {
                  formatOrderStatus(item.status) == '已完成' &&
                  <View onClick={(e) => { e.stopPropagation(); toInvoicePage() }}>
                  <View onClick={(e) => { e.stopPropagation(); toInvoicePage(item.orderId) }}>
                    <View className='order-again-text' hoverClass='common-hover-class'>开发票</View>
                  </View>
                }