| | |
| | | placeholder="请输入" |
| | | @blur="formatAmount(idx)" /> |
| | | </up-form-item> |
| | | <up-form-item label="运费单价(元)" |
| | | prop="freightUnitPrice" |
| | | :rules="productRules"> |
| | | <up-input v-model="product.freightUnitPrice" |
| | | type="number" |
| | | :disabled="!canEditProducts" |
| | | placeholder="请输入" |
| | | @blur="formatFreightUnitPrice(idx)" /> |
| | | </up-form-item> |
| | | <up-form-item label="总运费(元)" |
| | | prop="totalFreight" |
| | | :rules="productRules"> |
| | | <up-input v-model="product.totalFreight" |
| | | type="number" |
| | | :disabled="!canEditProducts" |
| | | placeholder="请输入" |
| | | @blur="formatTotalFreight(idx)" /> |
| | | </up-form-item> |
| | | <!-- 含税总价 --> |
| | | <up-form-item label="含税总价(元)" |
| | | prop="taxInclusiveTotalPrice" |
| | |
| | | taxRate: "", |
| | | taxInclusiveUnitPrice: "", |
| | | quantity: "", |
| | | freightUnitPrice: "", |
| | | totalFreight: "", |
| | | taxInclusiveTotalPrice: "", |
| | | taxExclusiveTotalPrice: "", |
| | | invoiceType: "", |
| | |
| | | } |
| | | }; |
| | | |
| | | const formatFreightUnitPrice = idx => { |
| | | if (productData.value[idx].freightUnitPrice) { |
| | | const value = parseFloat(productData.value[idx].freightUnitPrice); |
| | | if (!isNaN(value)) { |
| | | productData.value[idx].freightUnitPrice = value.toFixed(2); |
| | | } |
| | | } |
| | | const quantity = parseFloat(productData.value[idx].quantity); |
| | | const unitPrice = parseFloat(productData.value[idx].freightUnitPrice); |
| | | if (!quantity || quantity <= 0 || !unitPrice) return; |
| | | productData.value[idx].totalFreight = (unitPrice * quantity).toFixed(2); |
| | | }; |
| | | |
| | | const formatTotalFreight = idx => { |
| | | if (productData.value[idx].totalFreight) { |
| | | const value = parseFloat(productData.value[idx].totalFreight); |
| | | if (!isNaN(value)) { |
| | | productData.value[idx].totalFreight = value.toFixed(2); |
| | | } |
| | | } |
| | | const quantity = parseFloat(productData.value[idx].quantity); |
| | | const totalFreight = parseFloat(productData.value[idx].totalFreight); |
| | | if (!quantity || quantity <= 0 || !totalFreight) return; |
| | | productData.value[idx].freightUnitPrice = (totalFreight / quantity).toFixed( |
| | | 2 |
| | | ); |
| | | }; |
| | | |
| | | // 数量输入框失焦 |
| | | const formatAmount = idx => { |
| | | if (productData.value[idx].quantity) { |