新疆-融邦
1.销售台账根据类别修改展示字段
2.数据四舍五入
| | |
| | | @change="handleQuery" |
| | | clearable |
| | | :prefix-icon="Search" /> |
| | | <span class="search_title">客户分类:</span> |
| | | <el-select v-model="searchForm.customerType" |
| | | placeholder="请选择" |
| | | style="width: 240px" |
| | | clearable |
| | | @change="handleQuery"> |
| | | <el-option v-for="dict in customer_type" |
| | | :key="dict.value" |
| | | :label="dict.label" |
| | | :value="dict.value" /> |
| | | </el-select> |
| | | <el-button type="primary" |
| | | @click="handleQuery" |
| | | style="margin-left: 10px">搜索</el-button> |
| | |
| | | @click="handleDelete">删除</el-button> |
| | | </div> |
| | | </div> |
| | | <!-- 按「客户分类」拆页签;「全部」不带分类查询,保证还没补分类的老数据也能看到 --> |
| | | <el-tabs v-model="activeTab" |
| | | @tab-change="handleTabChange" |
| | | class="customer-tabs"> |
| | | <el-tab-pane label="全部" |
| | | name="全部" /> |
| | | <el-tab-pane label="销售客户" |
| | | name="销售客户" /> |
| | | <el-tab-pane label="代储客户" |
| | | name="代储客户" /> |
| | | </el-tabs> |
| | | <div class="table_list"> |
| | | <PIMTable rowKey="id" |
| | | :column="tableColumn" |
| | |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { onMounted, ref, reactive, getCurrentInstance, toRefs } from "vue"; |
| | | import { |
| | | onMounted, |
| | | ref, |
| | | reactive, |
| | | getCurrentInstance, |
| | | toRefs, |
| | | watch, |
| | | } from "vue"; |
| | | import { Search, Paperclip, Upload } from "@element-plus/icons-vue"; |
| | | import { |
| | | addCustomerFollow, |
| | |
| | | const data = reactive({ |
| | | searchForm: { |
| | | customerName: "", |
| | | customerType: "", |
| | | type: 0 |
| | | }, |
| | | form: { |
| | |
| | | page.size = obj.limit; |
| | | getList(); |
| | | }; |
| | | // 全部 / 销售客户 / 代储客户三个页签,各自带客户分类查同一个列表接口 |
| | | const activeTab = ref("全部"); |
| | | // 「全部」不传分类(undefined 会被 axios 丢掉),销售/代储按字典值筛; |
| | | // 字典的 value 未必就是中文标签,按 label 反查真实取值再传接口 |
| | | const activeCustomerType = () => { |
| | | if (activeTab.value === "全部") { |
| | | return undefined; |
| | | } |
| | | const list = customer_type.value || []; |
| | | const hit = list.find(item => item.label === activeTab.value); |
| | | return hit ? hit.value : activeTab.value; |
| | | }; |
| | | // 页签切换:换客户分类重新查列表 |
| | | const handleTabChange = () => { |
| | | page.current = 1; |
| | | getList(); |
| | | }; |
| | | const getList = () => { |
| | | tableLoading.value = true; |
| | | listCustomer({ ...searchForm.value, ...page }).then(res => { |
| | | listCustomer({ |
| | | ...searchForm.value, |
| | | ...page, |
| | | customerType: activeCustomerType(), |
| | | }).then(res => { |
| | | tableLoading.value = false; |
| | | tableData.value = res.data.records; |
| | | page.total = res.data.total; |
| | | }); |
| | | }; |
| | | // 字典是异步拉的,到达后按真实字典值重查一次,避免首屏用中文标签筛不到数据 |
| | | watch(customer_type, () => getList()); |
| | | // 表格选择数据 |
| | | const handleSelectionChange = selection => { |
| | | selectedRows.value = selection; |
| | |
| | | }, |
| | | ]; |
| | | form.value.type = 0; |
| | | // 客户分类默认跟随当前页签 |
| | | form.value.customerType = activeCustomerType(); |
| | | form.value.maintenanceTime = getCurrentDate(); |
| | | userListNoPage().then(res => { |
| | | userList.value = res.data; |
| | |
| | | type: "warning", |
| | | }) |
| | | .then(() => { |
| | | proxy.download("/basic/customer/export", {type: 0}, "客户档案.xlsx"); |
| | | // 导出跟随当前页签的客户分类 |
| | | proxy.download( |
| | | "/basic/customer/export", |
| | | { type: 0, customerType: activeCustomerType() }, |
| | | "客户档案.xlsx" |
| | | ); |
| | | }) |
| | | .catch(() => { |
| | | proxy.$modal.msg("已取消"); |
| | |
| | | </script> |
| | | |
| | | <style scoped lang="scss"> |
| | | /* 销售客户 / 代储客户页签:只要标签栏,内容由下方列表展示 */ |
| | | .customer-tabs { |
| | | margin-bottom: 8px; |
| | | |
| | | :deep(.el-tabs__header) { |
| | | margin-bottom: 0; |
| | | } |
| | | |
| | | :deep(.el-tabs__content) { |
| | | display: none; |
| | | } |
| | | } |
| | | |
| | | .detail-section { |
| | | margin-bottom: 20px; |
| | | padding: 15px; |
| | |
| | | @change="handleQuery" |
| | | clearable |
| | | :prefix-icon="Search" /> |
| | | <span class="search_title">客户分类:</span> |
| | | <el-select v-model="searchForm.customerType" |
| | | placeholder="请选择" |
| | | style="width: 240px" |
| | | clearable |
| | | @change="handleQuery"> |
| | | <el-option v-for="dict in customer_type" |
| | | :key="dict.value" |
| | | :label="dict.label" |
| | | :value="dict.value" /> |
| | | </el-select> |
| | | <el-button type="primary" |
| | | @click="handleQuery" |
| | | style="margin-left: 10px">搜索</el-button> |
| | |
| | | @click="handleDelete">删除</el-button> |
| | | </div> |
| | | </div> |
| | | <!-- 按「客户分类」拆页签;「全部」不带分类查询,保证还没补分类的老数据也能看到 --> |
| | | <el-tabs v-model="activeTab" |
| | | @tab-change="handleTabChange" |
| | | class="customer-tabs"> |
| | | <el-tab-pane label="全部" |
| | | name="全部" /> |
| | | <el-tab-pane label="销售客户" |
| | | name="销售客户" /> |
| | | <el-tab-pane label="代储客户" |
| | | name="代储客户" /> |
| | | </el-tabs> |
| | | <div class="table_list"> |
| | | <PIMTable rowKey="id" |
| | | :column="tableColumn" |
| | |
| | | </template> |
| | | |
| | | <script setup> |
| | | import { onMounted, ref, reactive, getCurrentInstance, toRefs } from "vue"; |
| | | import { |
| | | onMounted, |
| | | ref, |
| | | reactive, |
| | | getCurrentInstance, |
| | | toRefs, |
| | | watch, |
| | | } from "vue"; |
| | | import { Search, Paperclip, Upload } from "@element-plus/icons-vue"; |
| | | import { |
| | | addCustomerFollow, |
| | |
| | | const data = reactive({ |
| | | searchForm: { |
| | | customerName: "", |
| | | customerType: "", |
| | | type: 1 |
| | | }, |
| | | form: { |
| | |
| | | page.size = obj.limit; |
| | | getList(); |
| | | }; |
| | | // 全部 / 销售客户 / 代储客户三个页签,各自带客户分类查同一个列表接口 |
| | | const activeTab = ref("全部"); |
| | | // 「全部」不传分类(undefined 会被 axios 丢掉),销售/代储按字典值筛; |
| | | // 字典的 value 未必就是中文标签,按 label 反查真实取值再传接口 |
| | | const activeCustomerType = () => { |
| | | if (activeTab.value === "全部") { |
| | | return undefined; |
| | | } |
| | | const list = customer_type.value || []; |
| | | const hit = list.find(item => item.label === activeTab.value); |
| | | return hit ? hit.value : activeTab.value; |
| | | }; |
| | | // 页签切换:换客户分类重新查列表 |
| | | const handleTabChange = () => { |
| | | page.current = 1; |
| | | getList(); |
| | | }; |
| | | const getList = () => { |
| | | tableLoading.value = true; |
| | | const { total, ...queryPage } = page; |
| | | listCustomer({ ...searchForm.value, ...queryPage }).then(res => { |
| | | listCustomer({ |
| | | ...searchForm.value, |
| | | ...queryPage, |
| | | customerType: activeCustomerType(), |
| | | }).then(res => { |
| | | tableLoading.value = false; |
| | | tableData.value = res.data.records; |
| | | page.total = res.data.total; |
| | | }); |
| | | }; |
| | | // 字典是异步拉的,到达后按真实字典值重查一次,避免首屏用中文标签筛不到数据 |
| | | watch(customer_type, () => getList()); |
| | | // 表格选择数据 |
| | | const handleSelectionChange = selection => { |
| | | selectedRows.value = selection; |
| | |
| | | ]; |
| | | form.value.maintenanceTime = getCurrentDate(); |
| | | form.value.type = 1; |
| | | // 客户分类默认跟随当前页签 |
| | | form.value.customerType = activeCustomerType(); |
| | | userListNoPage().then(res => { |
| | | userList.value = res.data; |
| | | }); |
| | |
| | | type: "warning", |
| | | }) |
| | | .then(() => { |
| | | proxy.download("/basic/customer/export", {type: 1}, "客户档案.xlsx"); |
| | | // 导出跟随当前页签的客户分类 |
| | | proxy.download( |
| | | "/basic/customer/export", |
| | | { type: 1, customerType: activeCustomerType() }, |
| | | "客户档案.xlsx" |
| | | ); |
| | | }) |
| | | .catch(() => { |
| | | proxy.$modal.msg("已取消"); |
| | |
| | | </script> |
| | | |
| | | <style scoped lang="scss"> |
| | | /* 销售客户 / 代储客户页签:只要标签栏,内容由下方列表展示 */ |
| | | .customer-tabs { |
| | | margin-bottom: 8px; |
| | | |
| | | :deep(.el-tabs__header) { |
| | | margin-bottom: 0; |
| | | } |
| | | |
| | | :deep(.el-tabs__content) { |
| | | display: none; |
| | | } |
| | | } |
| | | |
| | | .detail-section { |
| | | margin-bottom: 20px; |
| | | padding: 15px; |
| | |
| | | <el-col :span="12"> |
| | | <el-form-item label="毛重(吨)" |
| | | prop="grossWeight" |
| | | :rules="[ |
| | | { required: true, message: '请输入毛重', trigger: 'blur' }, |
| | | { pattern: /^\d+$/, message: '只能输入整数数字', trigger: 'blur' }, |
| | | ]"> |
| | | <el-input v-model="formState.grossWeight" |
| | | placeholder="请输入整数数字" |
| | | clearable /> |
| | | :rules="[{ required: true, message: '请输入毛重', trigger: 'blur' }]"> |
| | | <el-input-number v-model="formState.grossWeight" |
| | | :min="0" |
| | | :precision="2" |
| | | :controls="false" |
| | | placeholder="请输入数字,最多保留两位小数" |
| | | style="width: 100%" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="皮重(吨)" |
| | | prop="tareWeight" |
| | | :rules="[ |
| | | { required: true, message: '请输入皮重', trigger: 'blur' }, |
| | | { pattern: /^\d+$/, message: '只能输入整数数字', trigger: 'blur' }, |
| | | ]"> |
| | | <el-input v-model="formState.tareWeight" |
| | | placeholder="请输入整数数字" |
| | | clearable /> |
| | | :rules="[{ required: true, message: '请输入皮重', trigger: 'blur' }]"> |
| | | <el-input-number v-model="formState.tareWeight" |
| | | :min="0" |
| | | :precision="2" |
| | | :controls="false" |
| | | placeholder="请输入数字,最多保留两位小数" |
| | | style="width: 100%" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | |
| | | }, |
| | | }); |
| | | |
| | | // 净重(吨) = 毛重 - 皮重 |
| | | // 净重(吨) = 毛重 - 皮重,保留两位小数(浮点相减会有精度尾巴) |
| | | const netWeight = computed(() => { |
| | | const g = formState.value.grossWeight; |
| | | const t = formState.value.tareWeight; |
| | | if ([g, t].some(v => v === null || v === undefined || v === "")) { |
| | | return null; |
| | | } |
| | | return Number(g) - Number(t); |
| | | return Number((Number(g) - Number(t)).toFixed(2)); |
| | | }); |
| | | |
| | | // 亏量(吨) = 净重的负数 |
| | | // 亏量(吨) = 净重的负数,保留两位小数 |
| | | const lossQuantity = computed(() => { |
| | | if (netWeight.value === null) { |
| | | return null; |
| | | } |
| | | return -netWeight.value; |
| | | return Number((-netWeight.value).toFixed(2)); |
| | | }); |
| | | |
| | | // 实际入库体积(升) = 实际净重(kg) ÷ 密度(kg/L),净重吨 × 1000 转 kg |
| | |
| | | <el-col :span="12"> |
| | | <el-form-item label="毛重(吨)" |
| | | prop="grossWeight" |
| | | :rules="[ |
| | | { required: true, message: '请输入毛重', trigger: 'blur' }, |
| | | { pattern: /^\d+$/, message: '只能输入整数数字', trigger: 'blur' }, |
| | | ]"> |
| | | <el-input v-model="formState.grossWeight" |
| | | placeholder="请输入整数数字" |
| | | clearable /> |
| | | :rules="[{ required: true, message: '请输入毛重', trigger: 'blur' }]"> |
| | | <el-input-number v-model="formState.grossWeight" |
| | | :min="0" |
| | | :precision="2" |
| | | :controls="false" |
| | | placeholder="请输入数字,最多保留两位小数" |
| | | style="width: 100%" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="皮重(吨)" |
| | | prop="tareWeight" |
| | | :rules="[ |
| | | { required: true, message: '请输入皮重', trigger: 'blur' }, |
| | | { pattern: /^\d+$/, message: '只能输入整数数字', trigger: 'blur' }, |
| | | ]"> |
| | | <el-input v-model="formState.tareWeight" |
| | | placeholder="请输入整数数字" |
| | | clearable /> |
| | | :rules="[{ required: true, message: '请输入皮重', trigger: 'blur' }]"> |
| | | <el-input-number v-model="formState.tareWeight" |
| | | :min="0" |
| | | :precision="2" |
| | | :controls="false" |
| | | placeholder="请输入数字,最多保留两位小数" |
| | | style="width: 100%" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | |
| | | }, |
| | | }); |
| | | |
| | | // 净重(吨) = 毛重 - 皮重 |
| | | // 净重(吨) = 毛重 - 皮重,保留两位小数(浮点相减会有精度尾巴) |
| | | const netWeight = computed(() => { |
| | | const g = formState.value.grossWeight; |
| | | const t = formState.value.tareWeight; |
| | | if ([g, t].some(v => v === null || v === undefined || v === "")) { |
| | | return null; |
| | | } |
| | | return Number(g) - Number(t); |
| | | return Number((Number(g) - Number(t)).toFixed(2)); |
| | | }); |
| | | |
| | | // 亏量(吨) = 净重的负数 |
| | | // 亏量(吨) = 净重的负数,保留两位小数 |
| | | const lossQuantity = computed(() => { |
| | | if (netWeight.value === null) { |
| | | return null; |
| | | } |
| | | return -netWeight.value; |
| | | return Number((-netWeight.value).toFixed(2)); |
| | | }); |
| | | |
| | | // 实际入库体积(升) = 实际净重(kg) ÷ 密度(kg/L),净重吨 × 1000 转 kg |
| | |
| | | prop="taxExclusiveTotalPrice" |
| | | :formatter="formattedNumber" |
| | | /> |
| | | <el-table-column label="是否生产" prop="isProduction" width="150"> |
| | | <template #default="scope"> |
| | | <el-tag :type="scope.row.isProduction ? 'success' : 'info'"> |
| | | {{ scope.row.isProduction ? "是" : "否" }} |
| | | </el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column |
| | | fixed="right" |
| | | label="操作" |
| | |
| | | <el-option label="增普票" value="增普票" /> |
| | | <el-option label="增专票" value="增专票" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="是否生产:" prop="isProduction"> |
| | | <el-radio-group v-model="productForm.isProduction"> |
| | | <el-radio label="是" :value="true" /> |
| | | <el-radio label="否" :value="false" /> |
| | | </el-radio-group> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | |
| | | taxInclusiveTotalPrice: "", |
| | | taxExclusiveTotalPrice: "", |
| | | invoiceType: "", |
| | | isProduction: false, |
| | | }, |
| | | productRules: { |
| | | productCategory: [{ required: true, message: "请选择", trigger: "change" }], |
| | |
| | | { required: true, message: "请输入", trigger: "blur" }, |
| | | ], |
| | | invoiceType: [{ required: true, message: "请选择", trigger: "change" }], |
| | | isProduction: [{ required: true, message: "请选择", trigger: "change" }], |
| | | }, |
| | | }); |
| | | const { productForm, productRules } = toRefs(productFormData); |
| | |
| | | taxInclusiveTotalPrice: taxInclusiveTotalPrice, |
| | | taxExclusiveTotalPrice: taxExclusiveTotalPrice, |
| | | invoiceType: "增普票", |
| | | isProduction: true, |
| | | productId: p.productId, |
| | | productModelId: p.productModelId, |
| | | }; |
| | |
| | | |
| | | productOperationType.value = type; |
| | | productForm.value = {}; |
| | | if (type === "add") { |
| | | productForm.value.isProduction = true; |
| | | } |
| | | proxy.resetForm("productFormRef"); |
| | | if (type === "edit") { |
| | | productForm.value = { ...row }; |