feat(invoice): 为已完成订单添加开发票功能并修复开发环境发票URL
新增 INVOICE_CHARGE_URL 环境常量用于生产和开发配置
修复开发环境 INVOICE_URL 的参数顺序错误
更新订单页面,添加订单号校验并传递订单号到发票页面
| | |
| | | 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"', |
| | |
| | | ROBOTAXI_WS_HOST, |
| | | AMAP_KEY, |
| | | INVOICE_URL, |
| | | INVOICE_CHARGE_URL, |
| | | }, |
| | | mini: { |
| | | // webpackChain (chain) { |
| | |
| | | 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 |
| | |
| | | ROBOTAXI_WS_HOST, |
| | | AMAP_KEY, |
| | | INVOICE_URL, |
| | | INVOICE_CHARGE_URL, |
| | | }, |
| | | mini: { |
| | | // module: { |
| | |
| | | // 发票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' |
| | |
| | | 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'; |
| | | |
| | |
| | | completed: 10, |
| | | cancelled: 0 |
| | | }; |
| | | |
| | | const XP_INVOICE_APP_ID = 'xp_invoice'; |
| | | |
| | | export default function OrderPage() { |
| | | const router = useRouter(); |
| | |
| | | }) |
| | | } |
| | | |
| | | 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}` |
| | | }) |
| | | } |
| | | |
| | |
| | | } |
| | | { |
| | | 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> |
| | | } |