chenrui
2 天以前 b497a0b35c09e6b53324c14b7697c1e9e0ed36a9
销售台账/采购台账计算重写
已修改5个文件
52 ■■■■ 文件已修改
src/main.js 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/utils/summarizeTable.js 7 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/login.vue 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/procurementManagement/procurementLedger/index.vue 20 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/views/salesManagement/salesLedger/index.vue 21 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main.js
@@ -46,7 +46,7 @@
import PIMTable from "@/components/PIMTable/PIMTable.vue";
import { getToken } from "@/utils/auth";
import {calculateTaxExclusiveTotalPrice, summarizeTable} from "@/utils/summarizeTable.js";
import {calculateTaxExclusiveTotalPrice, summarizeTable,calculateTaxIncludeTotalPrice} from "@/utils/summarizeTable.js";
const app = createApp(App)
@@ -57,6 +57,7 @@
app.config.globalProperties.resetForm = resetForm
app.config.globalProperties.summarizeTable = summarizeTable
app.config.globalProperties.calculateTaxExclusiveTotalPrice = calculateTaxExclusiveTotalPrice
app.config.globalProperties.calculateTaxIncludeTotalPrice = calculateTaxIncludeTotalPrice
app.config.globalProperties.handleTree = handleTree
app.config.globalProperties.addDateRange = addDateRange
app.config.globalProperties.selectDictLabel = selectDictLabel
src/utils/summarizeTable.js
@@ -35,9 +35,14 @@
    });
    return sums;
}
// 不含税总价计算
const calculateTaxExclusiveTotalPrice = (taxInclusiveTotalPrice, taxRate) => {
    const taxRateDecimal = taxRate / 100;
    return (taxInclusiveTotalPrice / (1 + taxRateDecimal)).toFixed(2);
}
// 含税总价计算
const calculateTaxIncludeTotalPrice = (taxInclusiveUnitPrice, quantity) => {
    return (taxInclusiveUnitPrice * quantity).toFixed(2);
}
// 导出函数供其他文件使用
export { summarizeTable, calculateTaxExclusiveTotalPrice };
export { summarizeTable, calculateTaxExclusiveTotalPrice ,calculateTaxIncludeTotalPrice};
src/views/login.vue
@@ -183,6 +183,7 @@
getCode()
getCookie()
deptListSearch()
</script>
<style lang='scss' scoped>
src/views/procurementManagement/procurementLedger/index.vue
@@ -213,14 +213,14 @@
          </el-col>
          <el-col :span="12">
            <el-form-item label="数量:" prop="quantity">
              <el-input v-model="productForm.quantity" placeholder="请输入" clearable/>
              <el-input v-model="productForm.quantity" placeholder="请输入" clearable @change="mathNum"/>
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="30">
          <el-col :span="12">
            <el-form-item label="含税单价(元):" prop="taxInclusiveUnitPrice">
              <el-input-number v-model="productForm.taxInclusiveUnitPrice" :precision="2" :step="0.1" clearable style="width: 100%"/>
              <el-input-number v-model="productForm.taxInclusiveUnitPrice" :precision="2" :step="0.1" clearable style="width: 100%" @change="mathNum"/>
            </el-form-item>
          </el-col>
          <el-col :span="12">
@@ -236,7 +236,7 @@
        <el-row :gutter="30">
          <el-col :span="12">
            <el-form-item label="含税总价(元):" prop="taxInclusiveTotalPrice">
              <el-input-number v-model="productForm.taxInclusiveTotalPrice" :precision="2" :step="0.1" clearable style="width: 100%" @change="mathNum"/>
              <el-input-number v-model="productForm.taxInclusiveTotalPrice" :precision="2" :step="0.1" clearable style="width: 100%" disabled/>
            </el-form-item>
          </el-col>
          <el-col :span="12">
@@ -717,7 +717,19 @@
  return `${year}-${month}-${day}`;
}
const mathNum = () => {
  productForm.value.taxExclusiveTotalPrice = proxy.calculateTaxExclusiveTotalPrice(productForm.value.taxInclusiveTotalPrice, productForm.value.taxRate)
  console.log('productForm.value',productForm.value)
  if(!productForm.value.taxInclusiveUnitPrice){
    return
  }
  if(!productForm.value.quantity){
    return
  }
  // 含税总价计算
  productForm.value.taxInclusiveTotalPrice = proxy.calculateTaxIncludeTotalPrice(productForm.value.taxInclusiveUnitPrice, productForm.value.quantity)
  if(productForm.value.taxRate){
    // 不含税总价计算
    productForm.value.taxExclusiveTotalPrice = proxy.calculateTaxExclusiveTotalPrice(productForm.value.taxInclusiveTotalPrice, productForm.value.taxRate)
  }
}
getList()
</script>
src/views/salesManagement/salesLedger/index.vue
@@ -231,14 +231,14 @@
          </el-col>
          <el-col :span="12">
            <el-form-item label="数量:" prop="quantity">
              <el-input v-model="productForm.quantity" placeholder="请输入" clearable/>
              <el-input v-model="productForm.quantity" placeholder="请输入" clearable @change="mathNum" />
            </el-form-item>
          </el-col>
        </el-row>
        <el-row :gutter="30">
          <el-col :span="12">
            <el-form-item label="含税单价(元):" prop="taxInclusiveUnitPrice">
              <el-input v-model="productForm.taxInclusiveUnitPrice" placeholder="请输入" clearable/>
              <el-input v-model="productForm.taxInclusiveUnitPrice" placeholder="请输入" clearable @change="mathNum" />
            </el-form-item>
          </el-col>
          <el-col :span="12">
@@ -254,7 +254,7 @@
        <el-row :gutter="30">
          <el-col :span="12">
            <el-form-item label="含税总价(元):" prop="taxInclusiveTotalPrice">
              <el-input v-model="productForm.taxInclusiveTotalPrice" placeholder="请输入" clearable  @change="mathNum" />
              <el-input v-model="productForm.taxInclusiveTotalPrice" placeholder="请输入" clearable disabled />
            </el-form-item>
          </el-col>
          <el-col :span="12">
@@ -733,8 +733,21 @@
  const day = String(today.getDate()).padStart(2, '0');
  return `${year}-${month}-${day}`;
}
const mathNum = () => {
  productForm.value.taxExclusiveTotalPrice = proxy.calculateTaxExclusiveTotalPrice(productForm.value.taxInclusiveTotalPrice, productForm.value.taxRate)
  console.log('productForm.value',productForm.value)
  if(!productForm.value.taxInclusiveUnitPrice){
    return
  }
  if(!productForm.value.quantity){
    return
  }
  // 含税总价计算
  productForm.value.taxInclusiveTotalPrice = proxy.calculateTaxIncludeTotalPrice(productForm.value.taxInclusiveUnitPrice, productForm.value.quantity)
  if(productForm.value.taxRate){
    // 不含税总价计算
    productForm.value.taxExclusiveTotalPrice = proxy.calculateTaxExclusiveTotalPrice(productForm.value.taxInclusiveTotalPrice, productForm.value.taxRate)
  }
}
getList()
</script>