| | |
| | | } |
| | | |
| | | /** |
| | | * 明细行(后端不返回明细行的 totalProductPrice/totalPrice,需按单价×数量计算: |
| | | * 金额 = 单价 × 数量;税额 = 金额 × 税率;含税金额 = 金额 + 税额) |
| | | * 明细行(优先用后端返回值;缺省时按「单价为含税单价」计算: |
| | | * 含税金额 = 含税单价 × 数量;税额 = 含税金额 × 税率;不含税金额 = 含税金额 - 税额) |
| | | */ |
| | | const printRows = computed(() => |
| | | (printData.value.items || []).map((item) => { |
| | | const totalProductPrice = |
| | | item.totalProductPrice ?? multiplyPrice(item.productPrice, item.count) ?? 0; |
| | | const taxInclusivePrice = multiplyPrice(item.productPrice, item.count); |
| | | const taxPrice = |
| | | item.taxPrice ?? multiplyPrice(totalProductPrice, (item.taxPercent ?? 0) / 100) ?? 0; |
| | | const totalPrice = item.totalPrice ?? totalProductPrice + taxPrice; |
| | | item.taxPrice ?? multiplyPrice(taxInclusivePrice, (item.taxPercent ?? 0) / 100) ?? 0; |
| | | const totalPrice = item.totalPrice ?? taxInclusivePrice ?? 0; |
| | | const totalProductPrice = item.totalProductPrice ?? totalPrice - taxPrice; |
| | | return { ...item, totalProductPrice, taxPrice, totalPrice }; |
| | | }), |
| | | ); |
| | | |
| | | /** 明细合计:数量/金额优先取订单头(后端权威值),税额与含税金额按明细累加(订单头 totalPrice 为优惠后金额,另在金额信息区展示) */ |
| | | /** 明细合计:数量/金额优先取订单头(后端权威值),税额与含税金额按明细累加(订单头 totalPrice 为优惠后含税金额,另在金额信息区展示) */ |
| | | const summaries = computed(() => { |
| | | const rows = printRows.value; |
| | | const count = rows.reduce((sum, item) => sum + (item.count || 0), 0); |
| | |
| | | <th |
| | | class="border border-solid border-[#dcdfe6] bg-[#f5f7fa] p-2 text-right font-bold" |
| | | > |
| | | 产品单价(元) |
| | | </th> |
| | | <th |
| | | class="border border-solid border-[#dcdfe6] bg-[#f5f7fa] p-2 text-right font-bold" |
| | | > |
| | | 金额(元) |
| | | 含税单价(元) |
| | | </th> |
| | | <th |
| | | class="border border-solid border-[#dcdfe6] bg-[#f5f7fa] p-2 text-right font-bold" |
| | | > |
| | | 税率(%) |
| | | </th> |
| | | <th |
| | | class="border border-solid border-[#dcdfe6] bg-[#f5f7fa] p-2 text-right font-bold" |
| | | > |
| | | 不含税金额(元) |
| | | </th> |
| | | <th |
| | | class="border border-solid border-[#dcdfe6] bg-[#f5f7fa] p-2 text-right font-bold" |
| | |
| | | {{ formatPrice(item.productPrice) }} |
| | | </td> |
| | | <td class="border border-solid border-[#dcdfe6] p-2 text-right"> |
| | | {{ formatPrice(item.totalProductPrice) }} |
| | | {{ formatPrice(item.taxPercent) }} |
| | | </td> |
| | | <td class="border border-solid border-[#dcdfe6] p-2 text-right"> |
| | | {{ formatPrice(item.taxPercent) }} |
| | | {{ formatPrice(item.totalProductPrice) }} |
| | | </td> |
| | | <td class="border border-solid border-[#dcdfe6] p-2 text-right"> |
| | | {{ formatPrice(item.taxPrice) }} |
| | |
| | | class="border border-solid border-[#dcdfe6] bg-[#f5f7fa] p-2" |
| | | ></td> |
| | | <td |
| | | class="border border-solid border-[#dcdfe6] bg-[#f5f7fa] p-2" |
| | | ></td> |
| | | <td |
| | | class="border border-solid border-[#dcdfe6] bg-[#f5f7fa] p-2 text-right" |
| | | > |
| | | {{ formatPrice(summaries.totalProductPrice) }} |
| | | </td> |
| | | <td |
| | | class="border border-solid border-[#dcdfe6] bg-[#f5f7fa] p-2" |
| | | ></td> |
| | | <td |
| | | class="border border-solid border-[#dcdfe6] bg-[#f5f7fa] p-2 text-right" |
| | | > |
| | |
| | | > |
| | | <div>优惠率(%):{{ formatPrice(printData.discountPercent) }}</div> |
| | | <div>付款优惠(元):{{ formatPrice(printData.discountPrice) }}</div> |
| | | <div>优惠后金额(元):{{ formatPrice(printData.totalPrice) }}</div> |
| | | <div>优惠后含税金额(元):{{ formatPrice(printData.totalPrice) }}</div> |
| | | <div>收取订金(元):{{ formatPrice(printData.depositPrice) }}</div> |
| | | </div> |
| | | |