feat: 移除冗余字段并优化发货逻辑
- 移除多个模块中的发货车牌、项目名称、付款金额等冗余字段
- 优化供应商和客户管理表单,简化必填项并调整字段默认值
- 调整采购和销售台账的税率计算逻辑,使含税与不含税价格保持一致
- 重构发货功能,增加发货模式(全部/部分)和发货详情查看
- 注释掉首页的质量统计和回款开票分析模块
- 统一发货类型为快递,移除货车选项
| | |
| | | :rules="rules" |
| | | ref="formRef"> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-col :span="24"> |
| | | <el-form-item label="客户名称:" |
| | | prop="customerName"> |
| | | <el-input v-model="form.customerName" |
| | | placeholder="请输入" |
| | | clearable /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="纳税人识别号:" |
| | | prop="taxpayerIdentificationNumber"> |
| | | <el-input v-model="form.taxpayerIdentificationNumber" |
| | | placeholder="请输入" |
| | | clearable /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="公司地址:" |
| | | prop="companyAddress"> |
| | | <el-input v-model="form.companyAddress" |
| | | placeholder="请输入" |
| | | clearable /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="公司电话:" |
| | | prop="companyPhone"> |
| | | <el-input v-model="form.companyPhone" |
| | | placeholder="请输入" |
| | | clearable /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="银行基本户:" |
| | | prop="basicBankAccount"> |
| | | <el-input v-model="form.basicBankAccount" |
| | | placeholder="请输入" |
| | | clearable /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="银行账号:" |
| | | prop="bankAccount"> |
| | | <el-input v-model="form.bankAccount" |
| | | placeholder="请输入" |
| | | clearable /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="开户行号:" |
| | | prop="bankCode"> |
| | | <el-input v-model="form.bankCode" |
| | | placeholder="请输入" |
| | | clearable /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="客户分类:" |
| | | prop="customerType"> |
| | | <el-select v-model="form.customerType" |
| | | placeholder="请选择" |
| | | clearable> |
| | | <el-option label="零售客户" |
| | | value="零售客户" /> |
| | | <el-option label="进销商客户" |
| | | value="进销商客户" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | |
| | | </el-row> |
| | | <el-button @click="addNewContact" |
| | | style="margin-bottom: 10px;">+ 新增联系人</el-button> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="维护人:" |
| | | prop="maintainer"> |
| | | <el-select v-model="form.maintainer" |
| | | placeholder="请选择" |
| | | clearable |
| | | disabled> |
| | | <el-option v-for="item in userList" |
| | | :key="item.nickName" |
| | | :label="item.nickName" |
| | | :value="item.nickName" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="维护时间:" |
| | | prop="maintenanceTime"> |
| | | <el-date-picker style="width: 100%" |
| | | v-model="form.maintenanceTime" |
| | | value-format="YYYY-MM-DD" |
| | | format="YYYY-MM-DD" |
| | | type="date" |
| | | placeholder="请选择" |
| | | clearable /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | </el-form> |
| | | <template #footer> |
| | | <div class="dialog-footer"> |
| | |
| | | |
| | | const tableColumn = ref([ |
| | | { |
| | | label: "客户分类", |
| | | prop: "customerType", |
| | | width: 120, |
| | | }, |
| | | { |
| | | label: "客户名称", |
| | | prop: "customerName", |
| | | width: 220, |
| | | }, |
| | | { |
| | | label: "纳税人识别码", |
| | | prop: "taxpayerIdentificationNumber", |
| | | width: 220, |
| | | }, |
| | | { |
| | | label: "地址及联系方式", |
| | | prop: "addressPhone", |
| | | width: 250, |
| | | }, |
| | | { |
| | | label: "联系人", |
| | |
| | | { |
| | | label: "联系电话", |
| | | prop: "contactPhone", |
| | | width: 150, |
| | | }, |
| | | { |
| | | label: "跟进进度", |
| | | prop: "followUpLevel", |
| | | width: 120, |
| | | }, |
| | | { |
| | | label: "跟进时间", |
| | | prop: "followUpTime", |
| | | width: 120, |
| | | }, |
| | | { |
| | | label: "银行基本户", |
| | | prop: "basicBankAccount", |
| | | width: 220, |
| | | }, |
| | | { |
| | | label: "银行账号", |
| | | prop: "bankAccount", |
| | | width: 220, |
| | | }, |
| | | { |
| | | label: "开户行号", |
| | | prop: "bankCode", |
| | | width: 220, |
| | | }, |
| | | { |
| | | label: "维护人", |
| | | prop: "maintainer", |
| | | }, |
| | | { |
| | | label: "维护时间", |
| | | prop: "maintenanceTime", |
| | | width: 100, |
| | | }, |
| | | |
| | | { |
| | | dataType: "action", |
| | | label: "操作", |
| | |
| | | openForm("edit", row); |
| | | }, |
| | | }, |
| | | { |
| | | name: "详情", |
| | | type: "text", |
| | | clickFun: row => { |
| | | openDetailDialog(row); |
| | | }, |
| | | }, |
| | | { |
| | | name: "回访提醒", |
| | | type: "text", |
| | | clickFun: row => { |
| | | openReminderDialog(row); |
| | | }, |
| | | }, |
| | | { |
| | | name: "添加洽谈进度", |
| | | type: "text", |
| | | clickFun: row => { |
| | | openNegotiationDialog(row); |
| | | }, |
| | | }, |
| | | // { |
| | | // name: "详情", |
| | | // type: "text", |
| | | // clickFun: row => { |
| | | // openDetailDialog(row); |
| | | // }, |
| | | // }, |
| | | // { |
| | | // name: "回访提醒", |
| | | // type: "text", |
| | | // clickFun: row => { |
| | | // openReminderDialog(row); |
| | | // }, |
| | | // }, |
| | | // { |
| | | // name: "添加洽谈进度", |
| | | // type: "text", |
| | | // clickFun: row => { |
| | | // openNegotiationDialog(row); |
| | | // }, |
| | | // }, |
| | | ], |
| | | }, |
| | | ]); |
| | |
| | | }, |
| | | rules: { |
| | | customerName: [{ required: true, message: "请输入", trigger: "blur" }], |
| | | taxpayerIdentificationNumber: [ |
| | | { required: true, message: "请输入", trigger: "blur" }, |
| | | ], |
| | | companyAddress: [{ required: true, message: "请输入", trigger: "blur" }], |
| | | companyPhone: [{ required: true, message: "请输入", trigger: "blur" }], |
| | | // contactPerson: [{ required: true, message: "请输入", trigger: "blur" }], |
| | | // contactPhone: [{ required: true, message: "请输入", trigger: "blur" }], |
| | | maintainer: [{ required: false, message: "请选择", trigger: "change" }], |
| | | maintenanceTime: [ |
| | | { required: false, message: "请选择", trigger: "change" }, |
| | | ], |
| | | basicBankAccount: [{ required: true, message: "请输入", trigger: "blur" }], |
| | | bankAccount: [{ required: true, message: "请输入", trigger: "blur" }], |
| | | bankCode: [{ required: true, message: "请输入", trigger: "blur" }], |
| | | customerType: [{ required: true, message: "请选择", trigger: "change" }], |
| | | }, |
| | | }); |
| | | const upload = reactive({ |
| | |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item |
| | | label="纳税人识别号:" |
| | | prop="taxpayerIdentificationNum" |
| | | > |
| | | <el-input |
| | | v-model="form.taxpayerIdentificationNum" |
| | | placeholder="请输入" |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="公司地址:" prop="companyAddress"> |
| | | <el-input |
| | | v-model="form.companyAddress" |
| | | placeholder="请输入" |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="公司电话:" prop="companyPhone"> |
| | | <el-input |
| | | v-model="form.companyPhone" |
| | | placeholder="请输入" |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="开户行:" prop="bankAccountName"> |
| | | <el-input |
| | | v-model="form.bankAccountName" |
| | | placeholder="请输入" |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="账号:" prop="bankAccountNum"> |
| | | <el-input |
| | | v-model="form.bankAccountNum" |
| | | placeholder="请输入" |
| | | clearable |
| | | /> |
| | | <el-form-item label="是否白名单:" prop="isWhite"> |
| | | <el-select v-model="form.isWhite" placeholder="请选择" clearable> |
| | | <el-option label="否" :value="1" /> |
| | | <el-option label="是" :value="0" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | |
| | | placeholder="请输入" |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="维护人:" prop="maintainUserId"> |
| | | <el-select |
| | | v-model="form.maintainUserId" |
| | | placeholder="请选择" |
| | | clearable |
| | | disabled |
| | | > |
| | | <el-option |
| | | v-for="item in userList" |
| | | :key="item.nickName" |
| | | :label="item.nickName" |
| | | :value="item.userId" |
| | | /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="维护时间:" prop="maintainTime"> |
| | | <el-date-picker |
| | | style="width: 100%" |
| | | v-model="form.maintainTime" |
| | | value-format="YYYY-MM-DD" |
| | | format="YYYY-MM-DD" |
| | | type="date" |
| | | placeholder="请选择" |
| | | clearable |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="供应商类型:" prop="supplierType"> |
| | | <el-select v-model="form.supplierType" placeholder="请选择" clearable> |
| | | <el-option label="甲" value="甲" /> |
| | | <el-option label="乙" value="乙" /> |
| | | <el-option label="丙" value="丙" /> |
| | | <el-option label="丁" value="丁" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="是否白名单:" prop="isWhite"> |
| | | <el-select v-model="form.isWhite" placeholder="请选择" clearable> |
| | | <el-option label="是" :value="0" /> |
| | | <el-option label="否" :value="1" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | |
| | | width: 250, |
| | | }, |
| | | { |
| | | label: "供应商类型", |
| | | prop: "supplierType", |
| | | width: 120, |
| | | }, |
| | | { |
| | | label: "纳税人识别号", |
| | | prop: "taxpayerIdentificationNum", |
| | | width: 230, |
| | | }, |
| | | { |
| | | label: "公司地址", |
| | | prop: "companyAddress", |
| | | width: 220, |
| | | }, |
| | | { |
| | | label: "联系方式", |
| | | prop: "companyPhone", |
| | | width:150 |
| | | }, |
| | | { |
| | | label: "开户行", |
| | | prop: "bankAccountName", |
| | | width: 220, |
| | | }, |
| | | { |
| | | label: "账号", |
| | | prop: "bankAccountNum", |
| | | width: 220, |
| | | }, |
| | | { |
| | | label: "联系人", |
| | | prop: "contactUserName", |
| | | }, |
| | |
| | | width: 150, |
| | | }, |
| | | { |
| | | label: "维护人", |
| | | prop: "maintainUserName", |
| | | }, |
| | | |
| | | { |
| | | label: "维护时间", |
| | | prop: "maintainTime", |
| | | width:100 |
| | | label: "是否白名单", |
| | | prop: "isWhite", |
| | | formatData: (val) => (val == 0 ? "是" : "否"), |
| | | }, |
| | | { |
| | | dataType: "action", |
| | |
| | | }, |
| | | form: { |
| | | supplierName: "", |
| | | taxpayerIdentificationNum: "", |
| | | companyAddress: "", |
| | | companyPhone: "", |
| | | bankAccountName: "", |
| | | bankAccountNum: "", |
| | | taxpayerIdentificationNum: "-", |
| | | companyAddress: "-", |
| | | companyPhone: "-", |
| | | bankAccountName: "-", |
| | | bankAccountNum: "-", |
| | | contactUserName: "", |
| | | contactUserPhone: "", |
| | | maintainUserId: "", |
| | | maintainTime: "", |
| | | supplierType: "", |
| | | isWhite: "", |
| | | supplierType: "甲", |
| | | isWhite: 0, |
| | | }, |
| | | rules: { |
| | | supplierName: [{ required: true, message: "请输入", trigger: "blur" }], |
| | | taxpayerIdentificationNum: [ |
| | | { required: true, message: "请输入", trigger: "blur" }, |
| | | ], |
| | | companyAddress: [{ required: true, message: "请输入", trigger: "blur" }], |
| | | companyPhone: [{ required: true, message: "请输入", trigger: "blur" }], |
| | | bankAccountName: [{ required: true, message: "请输入", trigger: "blur" }], |
| | | bankAccountNum: [{ required: true, message: "请输入", trigger: "blur" }], |
| | | contactUserName: [{ required: false, message: "请输入", trigger: "blur" }], |
| | | contactUserPhone: [{ required: false, message: "请输入", trigger: "blur" }], |
| | | maintainUserId: [{ required: false, message: "请选择", trigger: "change" }], |
| | | maintainTime: [{ required: false, message: "请选择", trigger: "change" }], |
| | | supplierType: [{ required: true, message: "请选择供应商类型", trigger: "change" }], |
| | | isWhite: [{ required: true, message: "请选择", trigger: "change" }], |
| | | }, |
| | | }); |
| | | const { searchForm, form, rules } = toRefs(data); |
| | |
| | | // 打开弹框 |
| | | const openForm = (type, row) => { |
| | | operationType.value = type; |
| | | form.value = {}; |
| | | form.value.maintainUserId = userStore.id; |
| | | form.value.maintainTime = getCurrentDate(); |
| | | form.value = { |
| | | supplierName: "", |
| | | taxpayerIdentificationNum: "-", |
| | | companyAddress: "-", |
| | | companyPhone: "-", |
| | | bankAccountName: "-", |
| | | bankAccountNum: "-", |
| | | contactUserName: "", |
| | | contactUserPhone: "", |
| | | maintainUserId: userStore.id, |
| | | maintainTime: getCurrentDate(), |
| | | supplierType: "甲", |
| | | isWhite: 0, |
| | | }; |
| | | userListNoPage().then((res) => { |
| | | userList.value = res.data; |
| | | }); |
| | |
| | | <el-descriptions :column="2" border> |
| | | <el-descriptions-item label="采购合同号">{{ currentPurchase.purchaseContractNumber }}</el-descriptions-item> |
| | | <el-descriptions-item label="供应商名称">{{ currentPurchase.supplierName }}</el-descriptions-item> |
| | | <el-descriptions-item label="项目名称">{{ currentPurchase.projectName }}</el-descriptions-item> |
| | | <el-descriptions-item label="销售合同号">{{ currentPurchase.salesContractNo }}</el-descriptions-item> |
| | | <el-descriptions-item label="签订日期">{{ currentPurchase.executionDate }}</el-descriptions-item> |
| | | <el-descriptions-item label="录入日期">{{ currentPurchase.entryDate }}</el-descriptions-item> |
| | |
| | | }, |
| | | { label: "快递公司", prop: "expressCompany", width: 140 }, |
| | | { label: "快递单号", prop: "expressNumber", width: 160 }, |
| | | { label: "发货车牌", prop: "shippingCarNumber", minWidth: 100, align: "center" }, |
| | | { label: "发货日期", prop: "shippingDate", minWidth: 100, align: "center" }, |
| | | { label: "数量", prop: "quantity", width: 100 }, |
| | | { label: "税率(%)", prop: "taxRate", width: 100 }, |
| | |
| | | </div> |
| | | |
| | | <!-- 底部横向两栏 --> |
| | | <div class="dashboard-row"> |
| | | <div class="main-panel"> |
| | | <div style="display: flex;justify-content: space-between;align-items: center;margin-bottom: 10px;"> |
| | | <div class="section-title" style="margin-bottom: 0;">质量统计</div> |
| | | <el-radio-group v-model="qualityRange" size="small" @change="qualityStatisticsInfo"> |
| | | <el-radio-button :value="1">周</el-radio-button> |
| | | <el-radio-button :value="2">月</el-radio-button> |
| | | <el-radio-button :value="3">季度</el-radio-button> |
| | | </el-radio-group> |
| | | </div> |
| | | <div class="quality-cards"> |
| | | <div class="quality-card one">原材料已检测数 <span>{{ qualityStatisticsObject.supplierNum }}件</span></div> |
| | | <div class="quality-card two">过程检验数量 <span>{{ qualityStatisticsObject.processNum }}件</span></div> |
| | | <div class="quality-card three">出厂已检数量 <span>{{ qualityStatisticsObject.factoryNum }}件</span></div> |
| | | </div> |
| | | <Echarts ref="chart" :chartStyle="chartStyle" :grid="grid" :legend="barLegend" :series="barSeries1" |
| | | :tooltip="tooltip" :xAxis="xAxis1" :yAxis="yAxis1" style="height: 260px"></Echarts> |
| | | </div> |
| | | <!-- <div class="dashboard-row">--> |
| | | <!-- <div class="main-panel">--> |
| | | <!-- <div style="display: flex;justify-content: space-between;align-items: center;margin-bottom: 10px;">--> |
| | | <!-- <div class="section-title" style="margin-bottom: 0;">质量统计</div>--> |
| | | <!-- <el-radio-group v-model="qualityRange" size="small" @change="qualityStatisticsInfo">--> |
| | | <!-- <el-radio-button :value="1">周</el-radio-button>--> |
| | | <!-- <el-radio-button :value="2">月</el-radio-button>--> |
| | | <!-- <el-radio-button :value="3">季度</el-radio-button>--> |
| | | <!-- </el-radio-group>--> |
| | | <!-- </div>--> |
| | | <!-- <div class="quality-cards">--> |
| | | <!-- <div class="quality-card one">原材料已检测数 <span>{{ qualityStatisticsObject.supplierNum }}件</span></div>--> |
| | | <!-- <div class="quality-card two">过程检验数量 <span>{{ qualityStatisticsObject.processNum }}件</span></div>--> |
| | | <!-- <div class="quality-card three">出厂已检数量 <span>{{ qualityStatisticsObject.factoryNum }}件</span></div>--> |
| | | <!-- </div>--> |
| | | <!-- <Echarts ref="chart" :chartStyle="chartStyle" :grid="grid" :legend="barLegend" :series="barSeries1"--> |
| | | <!-- :tooltip="tooltip" :xAxis="xAxis1" :yAxis="yAxis1" style="height: 260px"></Echarts>--> |
| | | <!-- </div>--> |
| | | |
| | | <div class="main-panel"> |
| | | <div class="section-title">回款与开票分析</div> |
| | | <Echarts ref="invoiceChart" :chartStyle="chartStyle" :grid="grid" :legend="lineLegend" :series="lineSeries" |
| | | :tooltip="tooltipLine" :xAxis="xAxis2" :yAxis="yAxis2" style="height: 270px;" /> |
| | | </div> |
| | | </div> |
| | | <!-- <div class="main-panel">--> |
| | | <!-- <div class="section-title">回款与开票分析</div>--> |
| | | <!-- <Echarts ref="invoiceChart" :chartStyle="chartStyle" :grid="grid" :legend="lineLegend" :series="lineSeries"--> |
| | | <!-- :tooltip="tooltipLine" :xAxis="xAxis2" :yAxis="yAxis2" style="height: 270px;" />--> |
| | | <!-- </div>--> |
| | | <!-- </div>--> |
| | | </div> |
| | | </template> |
| | | |
| | |
| | | show-overflow-tooltip |
| | | :formatter="formattedNumber" |
| | | /> |
| | | <el-table-column |
| | | <!-- <el-table-column |
| | | label="付款金额(元)" |
| | | prop="paymentAmount" |
| | | show-overflow-tooltip |
| | |
| | | {{ formattedNumber(row, column, row.payableAmount) }} |
| | | </el-text> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table-column> --> |
| | | </el-table> |
| | | <pagination |
| | | v-show="total > 0" |
| | |
| | | { |
| | | label: "采购合同号", |
| | | prop: "purchaseContractNumber", |
| | | width: 150, |
| | | }, |
| | | { |
| | | label: "合同金额(元)", |
| | | prop: "invoiceAmount", |
| | | width: 200, |
| | | formatData: (params) => { |
| | | return params ? parseFloat(params).toFixed(2) : 0; |
| | | }, |
| | | }, |
| | | { |
| | | label: "付款金额(元)", |
| | | prop: "paymentAmount", |
| | | width: 200, |
| | | formatData: (params) => { |
| | | return params ? parseFloat(params).toFixed(2) : 0; |
| | | }, |
| | | }, |
| | | { |
| | | label: "应付金额(元)", |
| | | dataType: "slot", |
| | | width: 200, |
| | | prop: "payableAmount", |
| | | slot: "payableAmountSlot", |
| | | }, |
| | | // { |
| | | // label: "付款金额(元)", |
| | | // prop: "paymentAmount", |
| | | // width: 200, |
| | | // formatData: (params) => { |
| | | // return params ? parseFloat(params).toFixed(2) : 0; |
| | | // }, |
| | | // }, |
| | | // { |
| | | // label: "应付金额(元)", |
| | | // dataType: "slot", |
| | | // width: 200, |
| | | // prop: "payableAmount", |
| | | // slot: "payableAmountSlot", |
| | | // }, |
| | | ]); |
| | | const tableDataSon = ref([]); |
| | | const originalTableDataSon = ref([]); |
| | |
| | | prefix-icon="Search" |
| | | @change="handleQuery" /> |
| | | </el-form-item> |
| | | <el-form-item label="项目名称:"> |
| | | <!-- <el-form-item label="项目名称:"> |
| | | <el-input v-model="searchForm.projectName" |
| | | placeholder="请输入" |
| | | clearable |
| | | prefix-icon="Search" |
| | | @change="handleQuery" /> |
| | | </el-form-item> |
| | | </el-form-item> --> |
| | | <el-form-item label="录入日期:"> |
| | | <el-date-picker v-model="searchForm.entryDate" |
| | | value-format="YYYY-MM-DD" |
| | |
| | | prop="supplierName" |
| | | width="160" |
| | | show-overflow-tooltip /> |
| | | <el-table-column label="项目名称" |
| | | <!-- <el-table-column label="项目名称" |
| | | prop="projectName" |
| | | width="320" |
| | | show-overflow-tooltip /> |
| | | show-overflow-tooltip /> --> |
| | | <el-table-column label="审批状态" |
| | | prop="approvalStatus" |
| | | width="100" |
| | |
| | | show-overflow-tooltip /> |
| | | <el-table-column label="备注" |
| | | prop="remarks" |
| | | width="200" |
| | | show-overflow-tooltip /> |
| | | <el-table-column fixed="right" |
| | | label="操作" |
| | |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <!-- <el-col :span="12"> |
| | | <el-form-item label="项目名称" |
| | | prop="projectName"> |
| | | <el-input v-model="form.projectName" |
| | | placeholder="请输入" |
| | | clearable /> |
| | | </el-form-item> |
| | | </el-col> --> |
| | | <el-col :span="12"> |
| | | <el-form-item label="录入日期:" |
| | | prop="entryDate"> |
| | | <el-date-picker style="width: 100%" |
| | | v-model="form.entryDate" |
| | | value-format="YYYY-MM-DD" |
| | | format="YYYY-MM-DD" |
| | | type="date" |
| | | placeholder="请选择" |
| | | clearable /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="录入日期:" |
| | | prop="entryDate"> |
| | | <el-date-picker style="width: 100%" |
| | | v-model="form.entryDate" |
| | | value-format="YYYY-MM-DD" |
| | | format="YYYY-MM-DD" |
| | | type="date" |
| | | placeholder="请选择" |
| | | clearable /> |
| | | </el-form-item> |
| | | </el-col> |
| | | |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="24"> |
| | |
| | | </div> |
| | | </el-option> |
| | | </el-select> |
| | | <!-- 按钮:与 Select 高度匹配,去掉左侧边框,无缝衔接 --> |
| | | <el-button size="small" |
| | | style="height: 32px;margin-left: 8px;" |
| | | @click="handleButtonClick" |
| | |
| | | prop="taxExclusiveTotalPrice" |
| | | :formatter="formattedNumber" |
| | | width="150" /> |
| | | <el-table-column label="是否质检" |
| | | prop="isChecked" |
| | | width="150"> |
| | | <template #default="scope"> |
| | | <el-tag :type="scope.row.isChecked ? 'success' : 'info'"> |
| | | {{ scope.row.isChecked ? '是' : '否' }} |
| | | </el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column fixed="right" |
| | | label="操作" |
| | | min-width="60" |
| | |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="是否质检:" |
| | | prop="isChecked"> |
| | | <el-radio-group v-model="productForm.isChecked"> |
| | | <el-radio label="是" |
| | | :value="true" /> |
| | | <el-radio label="否" |
| | | :value="false" /> |
| | | </el-radio-group> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | </el-form> |
| | | </FormDialog> |
| | | <FileListDialog |
| | |
| | | supplierId: "", |
| | | paymentMethod: "", |
| | | executionDate: "", |
| | | isChecked: true, |
| | | }, |
| | | rules: { |
| | | purchaseContractNumber: [ |
| | |
| | | { required: true, message: "请选择审批人", trigger: "change" }, |
| | | ], |
| | | projectName: [ |
| | | { required: true, message: "请输入项目名称", trigger: "blur" }, |
| | | { required: false, message: "请输入项目名称", trigger: "blur" }, |
| | | ], |
| | | supplierId: [{ required: true, message: "请输入", trigger: "blur" }], |
| | | entryDate: [{ required: true, message: "请选择", trigger: "change" }], |
| | |
| | | taxExclusiveTotalPrice: "", |
| | | invoiceType: "", |
| | | warnNum: "", |
| | | isChecked: true, |
| | | }, |
| | | productRules: { |
| | | productId: [{ required: true, message: "请选择", trigger: "change" }], |
| | |
| | | taxInclusiveUnitPrice: [ |
| | | { required: true, message: "请输入", trigger: "blur" }, |
| | | ], |
| | | taxRate: [{ required: true, message: "请选择", trigger: "change" }], |
| | | warnNum: [{ required: true, message: "请选择", trigger: "change" }], |
| | | taxRate: [{ required: false, message: "请选择", trigger: "change" }], |
| | | warnNum: [{ required: false, message: "请选择", trigger: "change" }], |
| | | taxInclusiveTotalPrice: [ |
| | | { required: true, message: "请输入", trigger: "blur" }, |
| | | ], |
| | |
| | | { required: true, message: "请输入", trigger: "blur" }, |
| | | ], |
| | | invoiceType: [{ required: true, message: "请选择", trigger: "change" }], |
| | | isChecked: [{ required: true, message: "请选择", trigger: "change" }], |
| | | }, |
| | | }); |
| | | const { productForm, productRules } = toRefs(productFormData); |
| | |
| | | const submitProduct = () => { |
| | | proxy.$refs["productFormRef"].validate(valid => { |
| | | if (valid) { |
| | | // 如果里面的数据没有taxRate 那就默认带上一个taxRate 为0 |
| | | if (!Object.prototype.hasOwnProperty.call(productForm.value, 'taxRate') || productForm.value.taxRate === null || productForm.value.taxRate === undefined || productForm.value.taxRate === '') { |
| | | productForm.value.taxRate = 0; |
| | | } |
| | | if (operationType.value === "edit") { |
| | | submitProductEdit(); |
| | | } else { |
| | |
| | | return `${year}-${month}-${day}`; |
| | | } |
| | | const mathNum = () => { |
| | | if (!productForm.value.taxRate) { |
| | | proxy.$modal.msgWarning("请先选择税率"); |
| | | return; |
| | | } |
| | | if (!productForm.value.taxInclusiveUnitPrice) { |
| | | return; |
| | | } |
| | | if (!productForm.value.quantity) { |
| | | if (!productForm.value.taxInclusiveUnitPrice || !productForm.value.quantity) { |
| | | return; |
| | | } |
| | | // 含税总价计算 |
| | |
| | | productForm.value.taxInclusiveUnitPrice, |
| | | productForm.value.quantity |
| | | ); |
| | | if (productForm.value.taxRate) { |
| | | // 不含税总价计算 |
| | | productForm.value.taxExclusiveTotalPrice = |
| | | proxy.calculateTaxExclusiveTotalPrice( |
| | | productForm.value.taxInclusiveTotalPrice, |
| | | productForm.value.taxRate |
| | | ); |
| | | } |
| | | // 优化:使带税和不带税价格一致 |
| | | productForm.value.taxExclusiveTotalPrice = productForm.value.taxInclusiveTotalPrice; |
| | | }; |
| | | const reverseMathNum = field => { |
| | | if (!productForm.value.taxRate) { |
| | | proxy.$modal.msgWarning("请先选择税率"); |
| | | return; |
| | | } |
| | | const taxRate = Number(productForm.value.taxRate); |
| | | if (!taxRate) return; |
| | | |
| | | // 确保输入值不为负数 |
| | | if ( |
| | | field === "taxInclusiveTotalPrice" || |
| | |
| | | productForm.value.quantity = "0"; |
| | | } |
| | | } |
| | | // 反算不含税总价 |
| | | productForm.value.taxExclusiveTotalPrice = ( |
| | | Number(productForm.value.taxInclusiveTotalPrice) / |
| | | (1 + taxRate / 100) |
| | | ).toFixed(2); |
| | | // 确保结果不为负数 |
| | | if (Number(productForm.value.taxExclusiveTotalPrice) < 0) { |
| | | productForm.value.taxExclusiveTotalPrice = "0"; |
| | | } |
| | | // 优化:使带税和不带税价格一致 |
| | | productForm.value.taxExclusiveTotalPrice = productForm.value.taxInclusiveTotalPrice; |
| | | } else if (field === "taxExclusiveTotalPrice") { |
| | | // 反算含税总价 |
| | | productForm.value.taxInclusiveTotalPrice = ( |
| | | Number(productForm.value.taxExclusiveTotalPrice) * |
| | | (1 + taxRate / 100) |
| | | ).toFixed(2); |
| | | // 确保结果不为负数 |
| | | if (Number(productForm.value.taxInclusiveTotalPrice) < 0) { |
| | | productForm.value.taxInclusiveTotalPrice = "0"; |
| | | } |
| | | // 优化:使带税和不带税价格一致 |
| | | productForm.value.taxInclusiveTotalPrice = productForm.value.taxExclusiveTotalPrice; |
| | | // 已知数量,反算含税单价 |
| | | if (productForm.value.quantity) { |
| | | productForm.value.taxInclusiveUnitPrice = ( |
| | |
| | | <el-table-column label="产品名称" prop="productName" show-overflow-tooltip /> |
| | | <el-table-column label="规格型号" prop="specificationModel" show-overflow-tooltip /> |
| | | <el-table-column label="发货时间" prop="shippingDate" show-overflow-tooltip /> |
| | | <el-table-column label="发货车牌号" prop="shippingCarNumber" show-overflow-tooltip /> |
| | | <el-table-column label="快递公司" prop="expressCompany" show-overflow-tooltip /> |
| | | <el-table-column label="快递单号" prop="expressNumber" show-overflow-tooltip /> |
| | | <el-table-column label="审核状态" prop="status" align="center" width="120"> |
| | |
| | | style="width: 100%" |
| | | @change="handleShippingTypeChange" |
| | | > |
| | | <el-option label="货车" value="货车" /> |
| | | <el-option label="快递" value="快递" /> |
| | | </el-select> |
| | | </el-form-item> |
| | |
| | | <el-descriptions-item label="发货类型">{{ detailRow.type || '--' }}</el-descriptions-item> |
| | | <el-descriptions-item label="发货日期">{{ detailRow.shippingDate || '--' }}</el-descriptions-item> |
| | | <el-descriptions-item label="审核状态">{{ getApprovalStatusText(detailRow.status) }}</el-descriptions-item> |
| | | <el-descriptions-item label="发货车牌号">{{ detailRow.shippingCarNumber || '--' }}</el-descriptions-item> |
| | | <el-descriptions-item label="快递公司">{{ detailRow.expressCompany || '--' }}</el-descriptions-item> |
| | | <el-descriptions-item label="快递单号" :span="2">{{ detailRow.expressNumber || '--' }}</el-descriptions-item> |
| | | </el-descriptions> |
| | |
| | | customerName: "", |
| | | specificationModel: "", |
| | | productName: "", |
| | | type: "货车", // 货车, 快递 |
| | | type: "快递", // 货车, 快递 |
| | | shippingDate: "", |
| | | shippingCarNumber: "", |
| | | expressCompany: "", |
| | |
| | | id: row.id ?? null, |
| | | salesContractNo: row.salesContractNo ?? "", |
| | | customerName: row.customerName ?? "", |
| | | type: row.type || "货车", |
| | | type: row.type || "快递", |
| | | shippingDate: row.shippingDate || getCurrentDate(), |
| | | shippingCarNumber: row.shippingCarNumber ?? "", |
| | | expressCompany: row.expressCompany ?? "", |
| | |
| | | id: null, |
| | | salesContractNo: "", |
| | | customerName: "", |
| | | type: "货车", |
| | | type: "快递", |
| | | shippingDate: getCurrentDate(), |
| | | shippingCarNumber: "", |
| | | expressCompany: "", |
| | |
| | | label="客户名称" |
| | | prop="customerName" |
| | | show-overflow-tooltip |
| | | width="200" |
| | | /> |
| | | <el-table-column |
| | | label="合同金额(元)" |
| | | prop="invoiceTotal" |
| | | show-overflow-tooltip |
| | | :formatter="formattedNumber" |
| | | width="200" |
| | | /> |
| | | <el-table-column |
| | | <!-- <el-table-column |
| | | label="回款金额(元)" |
| | | prop="receiptPaymentAmount" |
| | | show-overflow-tooltip |
| | |
| | | {{ formattedNumber(row, column, row.unReceiptPaymentAmount) }} |
| | | </el-text> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table-column> --> |
| | | </el-table> |
| | | <pagination |
| | | v-show="total > 0" |
| | |
| | | label="发生日期" |
| | | prop="receiptPaymentDate" |
| | | show-overflow-tooltip |
| | | width="110" |
| | | /> |
| | | <el-table-column |
| | | label="销售合同号" |
| | | prop="salesContractNo" |
| | | show-overflow-tooltip |
| | | width="200" |
| | | /> |
| | | <el-table-column |
| | | label="合同金额(元)" |
| | | prop="invoiceTotal" |
| | | show-overflow-tooltip |
| | | :formatter="formattedNumber" |
| | | width="200" |
| | | /> |
| | | <el-table-column |
| | | <!-- <el-table-column |
| | | label="回款金额(元)" |
| | | prop="receiptPaymentAmount" |
| | | show-overflow-tooltip |
| | |
| | | {{ formattedNumber(row, column, row.unReceiptPaymentAmount) }} |
| | | </el-text> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table-column> --> |
| | | </el-table> |
| | | </div> |
| | | </div> |
| | |
| | | <el-input v-model="searchForm.salesContractNo" placeholder="请输入" clearable prefix-icon="Search" |
| | | @change="handleQuery" /> |
| | | </el-form-item> |
| | | <el-form-item label="项目名称:"> |
| | | <el-input v-model="searchForm.projectName" placeholder="请输入" clearable prefix-icon="Search" |
| | | @change="handleQuery" /> |
| | | </el-form-item> |
| | | <el-form-item label="录入日期:"> |
| | | <el-date-picker v-model="searchForm.entryDate" value-format="YYYY-MM-DD" format="YYYY-MM-DD" type="daterange" |
| | | placeholder="请选择" clearable @change="changeDaterange" /> |
| | |
| | | </el-tag> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="快递公司" prop="expressCompany" show-overflow-tooltip /> |
| | | <el-table-column label="快递单号" prop="expressNumber" show-overflow-tooltip /> |
| | | <el-table-column label="发货车牌" minWidth="100px" align="center"> |
| | | <template #default="scope"> |
| | | <div> |
| | | <el-tag type="success" v-if="scope.row.shippingCarNumber">{{ scope.row.shippingCarNumber }}</el-tag> |
| | | <el-tag v-else type="info">-</el-tag> |
| | | </div> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="发货日期" |
| | | minWidth="100px" |
| | | align="center"> |
| | | <template #default="scope"> |
| | | <div> |
| | | <div v-if="scope.row.shippingDate">{{ scope.row.shippingDate }}</div> |
| | | <el-tag v-else |
| | | type="info">-</el-tag> |
| | | </div> |
| | | </template> |
| | | </el-table-column> |
| | | <el-table-column label="数量" prop="quantity" /> |
| | | <el-table-column label="数量" prop ="quantity" /> |
| | | <el-table-column label="已发货数量" prop="partSendAmount" /> |
| | | <el-table-column label="税率(%)" prop="taxRate" /> |
| | | <el-table-column label="含税单价(元)" prop="taxInclusiveUnitPrice" :formatter="formattedNumber" /> |
| | | <el-table-column label="含税总价(元)" prop="taxInclusiveTotalPrice" :formatter="formattedNumber" /> |
| | |
| | | @click="openDeliveryForm(scope.row)"> |
| | | 发货 |
| | | </el-button> |
| | | <el-button |
| | | link |
| | | type="primary" |
| | | size="small" |
| | | @click="openDeliveryDetail(scope.row)"> |
| | | 详情 |
| | | </el-button> |
| | | </template> |
| | | </el-table-column> |
| | | </el-table> |
| | |
| | | <el-table-column label="销售合同号" prop="salesContractNo" width="180" show-overflow-tooltip /> |
| | | <el-table-column label="客户名称" prop="customerName" width="300" show-overflow-tooltip /> |
| | | <el-table-column label="业务员" prop="salesman" width="100" show-overflow-tooltip /> |
| | | <el-table-column label="项目名称" prop="projectName" width="180" show-overflow-tooltip /> |
| | | <el-table-column label="付款方式" prop="paymentMethod" show-overflow-tooltip /> |
| | | |
| | | <el-table-column label="合同金额(元)" prop="contractAmount" width="220" show-overflow-tooltip |
| | | :formatter="formattedNumber" /> |
| | | <el-table-column label="录入人" prop="entryPersonName" width="100" show-overflow-tooltip /> |
| | |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <!-- <el-col :span="12"> |
| | | <el-form-item label="项目名称:" prop="projectName"> |
| | | <el-input v-model="form.projectName" placeholder="请输入" clearable :disabled="operationType === 'view'" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | </el-col> --> |
| | | <el-col :span="12"> |
| | | <el-form-item label="签订日期:" prop="executionDate"> |
| | | <el-date-picker style="width: 100%" v-model="form.executionDate" value-format="YYYY-MM-DD" |
| | | format="YYYY-MM-DD" type="date" placeholder="请选择" clearable :disabled="operationType === 'view'" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="付款方式"> |
| | | <el-input v-model="form.paymentMethod" placeholder="请输入" clearable :disabled="operationType === 'view'" /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | </el-row> |
| | | |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="录入人:" prop="entryPerson"> |
| | |
| | | </el-row> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="交货日期:" prop="entryDate"> |
| | | <el-form-item label="交货日期:" prop="deliveryDate"> |
| | | <el-date-picker style="width: 100%" v-model="form.deliveryDate" value-format="YYYY-MM-DD" format="YYYY-MM-DD" |
| | | type="date" placeholder="请选择" clearable /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | <el-row> |
| | | <el-form-item label="产品信息:" prop="entryDate"> |
| | | <el-form-item label="产品信息:"> |
| | | <el-button v-if="operationType !== 'view'" type="primary" @click="openProductForm('add')">添加</el-button> |
| | | <el-button v-if="operationType !== 'view'" plain type="danger" @click="deleteProduct" >删除</el-button> |
| | | </el-form-item> |
| | |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="数量:" prop="quantity"> |
| | | <el-form-item label="数量" prop="quantity"> |
| | | <el-input-number :step="0.1" :min="0" v-model="productForm.quantity" placeholder="请输入" clearable |
| | | :precision="2" |
| | | @change="calculateFromQuantity" style="width: 100%" /> |
| | |
| | | <span class="label">发货日期:</span> |
| | | <span class="value">{{ formatDate(item.createTime) }}</span> |
| | | </div> |
| | | <div> |
| | | <span class="label">发货车牌号:</span> |
| | | <span class="value">{{ item.shippingCarNumber }}</span> |
| | | </div> |
| | | </div> |
| | | <div class="info-row"> |
| | | <div> |
| | |
| | | > |
| | | <el-form :model="deliveryForm" label-width="120px" label-position="top" :rules="deliveryRules" ref="deliveryFormRef"> |
| | | <el-row :gutter="30"> |
| | | <el-col :span="24"> |
| | | <el-col :span="12"> |
| | | <el-form-item label="发货类型:" prop="type"> |
| | | <el-select |
| | | v-model="deliveryForm.type" |
| | | placeholder="请选择发货类型" |
| | | disabled |
| | | style="width: 100%" |
| | | > |
| | | <el-option label="货车" value="货车" /> |
| | | <el-option label="快递" value="快递" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="待发货数量:"> |
| | | <el-input v-model="deliveryForm.remainAmount" disabled placeholder="请输入待发货数量"></el-input> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="发货模式:" prop="deliveryMode"> |
| | | <el-select |
| | | v-model="deliveryForm.deliveryMode" |
| | | placeholder="请选择发货模式" |
| | | style="width: 100%" |
| | | @change="onDeliveryModeChange" |
| | | > |
| | | <el-option label="全部" value="全部" /> |
| | | <el-option label="部分" value="部分" /> |
| | | </el-select> |
| | | </el-form-item> |
| | | </el-col> |
| | | <el-col :span="12"> |
| | | <el-form-item label="发货数量:" prop="partSendAmount"> |
| | | <el-input-number |
| | | v-model="deliveryForm.partSendAmount" |
| | | :min="1" |
| | | :max="deliveryForm.remainAmount" |
| | | :precision="0" |
| | | :step="1" |
| | | :disabled="deliveryForm.deliveryMode === '全部'" |
| | | style="width: 100%" |
| | | placeholder="请输入本次发货数量" |
| | | /> |
| | | </el-form-item> |
| | | </el-col> |
| | | </el-row> |
| | | |
| | | |
| | | <!-- 审批人选择(仿协同审批里的审批人节点选择) --> |
| | | <el-row> |
| | |
| | | </div> |
| | | </template> |
| | | </el-dialog> |
| | | |
| | | <!-- 发货详情弹框 --> |
| | | <el-dialog |
| | | v-model="deliveryDetailVisible" |
| | | title="发货详情" |
| | | width="80%" |
| | | :close-on-click-modal="false" |
| | | @close="closeDeliveryDetail" |
| | | > |
| | | <el-table |
| | | :data="deliveryDetailTableData" |
| | | border |
| | | stripe |
| | | v-loading="deliveryDetailLoading" |
| | | height="520px" |
| | | > |
| | | <el-table-column align="center" label="序号" type="index" width="60" /> |
| | | <el-table-column prop="salesContractNo" label="销售订单" width="180" show-overflow-tooltip /> |
| | | <el-table-column prop="shippingNo" label="发货订单号" width="180" show-overflow-tooltip /> |
| | | <el-table-column prop="customerName" label="客户名称" min-width="200" show-overflow-tooltip /> |
| | | <el-table-column prop="status" label="发货状态" min-width="200" show-overflow-tooltip /> |
| | | <el-table-column prop="productName" label="产品名称" min-width="160" show-overflow-tooltip /> |
| | | <el-table-column prop="specificationModel" label="规格型号" min-width="160" show-overflow-tooltip /> |
| | | <el-table-column prop="type" label="发货类型" width="100" show-overflow-tooltip /> |
| | | <el-table-column prop="expressCompany" label="快递公司" width="140" show-overflow-tooltip /> |
| | | <el-table-column prop="expressNumber" label="快递单号" width="160" show-overflow-tooltip /> |
| | | <el-table-column prop="partSendAmount" label="本次发货数量" width="120" align="center" /> |
| | | </el-table> |
| | | <pagination |
| | | v-show="deliveryDetailPage.total > 0" |
| | | :total="deliveryDetailPage.total" |
| | | layout="total, sizes, prev, pager, next, jumper" |
| | | :page="deliveryDetailPage.current" |
| | | :limit="deliveryDetailPage.size" |
| | | @pagination="deliveryDetailPaginationChange" |
| | | /> |
| | | <template #footer> |
| | | <div class="dialog-footer"> |
| | | <el-button @click="closeDeliveryDetail">关闭</el-button> |
| | | </div> |
| | | </template> |
| | | </el-dialog> |
| | | </div> |
| | | </template> |
| | | |
| | |
| | | import { getToken } from "@/utils/auth"; |
| | | import pagination from "@/components/PIMTable/Pagination.vue"; |
| | | import {onMounted, ref, getCurrentInstance} from "vue"; |
| | | import { addShippingInfo } from "@/api/salesManagement/deliveryLedger.js"; |
| | | import { addShippingInfo, deliveryLedgerListPage } from "@/api/salesManagement/deliveryLedger.js"; |
| | | import { ElMessageBox, ElMessage } from "element-plus"; |
| | | import { UploadFilled, Download } from "@element-plus/icons-vue"; |
| | | import useUserStore from "@/store/modules/user"; |
| | |
| | | taxInclusiveUnitPrice: [ |
| | | { required: true, message: "请输入", trigger: "blur" }, |
| | | ], |
| | | taxRate: [{ required: true, message: "请选择", trigger: "change" }], |
| | | taxInclusiveTotalPrice: [ |
| | | { required: true, message: "请输入", trigger: "blur" }, |
| | | ], |
| | |
| | | |
| | | // 发货相关 |
| | | const deliveryFormVisible = ref(false); |
| | | const deliveryDetailVisible = ref(false); |
| | | const deliveryDetailLoading = ref(false); |
| | | const deliveryDetailTableData = ref([]); |
| | | const deliveryDetailSalesLedgerId = ref(null); |
| | | const deliveryDetailPage = reactive({ |
| | | current: 1, |
| | | size: 10, |
| | | total: 0, |
| | | }); |
| | | const currentDeliveryRow = ref(null); |
| | | const deliveryFormData = reactive({ |
| | | deliveryForm: { |
| | | type: "货车", // 货车, 快递 |
| | | type: "快递", // 货车, 快递 |
| | | remainAmount: 0, |
| | | deliveryMode: "全部", // 全部 | 部分 |
| | | partSendAmount: 0, |
| | | }, |
| | | deliveryRules: { |
| | | type: [ |
| | | { required: true, message: "请选择发货类型", trigger: "change" } |
| | | ], |
| | | deliveryMode: [ |
| | | { required: true, message: "请选择发货模式", trigger: "change" } |
| | | ], |
| | | partSendAmount: [ |
| | | { |
| | | validator: (rule, value, callback) => { |
| | | if (deliveryFormData.deliveryForm.deliveryMode !== "部分") { |
| | | return callback(); |
| | | } |
| | | const max = Number(deliveryFormData.deliveryForm.remainAmount) || 0; |
| | | const v = Number(value); |
| | | if (!v || v <= 0) { |
| | | return callback(new Error("请输入发货数量")); |
| | | } |
| | | if (v > max) { |
| | | return callback(new Error(`发货数量不能超过待发货数量(${max})`)); |
| | | } |
| | | return callback(); |
| | | }, |
| | | trigger: "change", |
| | | } |
| | | ] |
| | | }, |
| | | }); |
| | | const { deliveryForm, deliveryRules } = toRefs(deliveryFormData); |
| | | |
| | | const onDeliveryModeChange = (val) => { |
| | | const remain = Number(deliveryForm.value.remainAmount) || 0; |
| | | if (val === "全部") { |
| | | deliveryForm.value.partSendAmount = remain; |
| | | } else { |
| | | let v = Number(deliveryForm.value.partSendAmount) || 0; |
| | | if (v <= 0 || v > remain) { |
| | | deliveryForm.value.partSendAmount = remain > 0 ? Math.min(1, remain) : 0; |
| | | } |
| | | } |
| | | }; |
| | | |
| | | const getDeliveryDetailList = () => { |
| | | if (!deliveryDetailSalesLedgerId.value) return; |
| | | deliveryDetailLoading.value = true; |
| | | return deliveryLedgerListPage({ |
| | | salesLedgerId: deliveryDetailSalesLedgerId.value, |
| | | current: deliveryDetailPage.current, |
| | | size: deliveryDetailPage.size, |
| | | }).then((res) => { |
| | | deliveryDetailTableData.value = res?.data?.records || []; |
| | | deliveryDetailPage.total = res?.data?.total || 0; |
| | | }).finally(() => { |
| | | deliveryDetailLoading.value = false; |
| | | }); |
| | | }; |
| | | |
| | | const deliveryDetailPaginationChange = (obj) => { |
| | | deliveryDetailPage.current = obj.page; |
| | | deliveryDetailPage.size = obj.limit; |
| | | getDeliveryDetailList(); |
| | | }; |
| | | |
| | | const openDeliveryDetail = (row) => { |
| | | deliveryDetailSalesLedgerId.value = row?.salesLedgerId ?? null; |
| | | deliveryDetailPage.current = 1; |
| | | deliveryDetailVisible.value = true; |
| | | getDeliveryDetailList(); |
| | | }; |
| | | |
| | | const closeDeliveryDetail = () => { |
| | | deliveryDetailVisible.value = false; |
| | | deliveryDetailTableData.value = []; |
| | | deliveryDetailSalesLedgerId.value = null; |
| | | deliveryDetailPage.current = 1; |
| | | deliveryDetailPage.total = 0; |
| | | }; |
| | | |
| | | // 发货审批人节点(仿协同审批 infoFormDia.vue) |
| | | const approverNodes = ref([{ id: 1, userId: null }]); |
| | |
| | | const submitProduct = () => { |
| | | proxy.$refs["productFormRef"].validate((valid) => { |
| | | if (valid) { |
| | | // 如果里面的数据没有taxRate 那就默认带上一个taxRate 为空 |
| | | if (!Object.prototype.hasOwnProperty.call(productForm.value, 'taxRate') || productForm.value.taxRate === null || productForm.value.taxRate === undefined) { |
| | | productForm.value.taxRate = 0; |
| | | } |
| | | if (operationType.value === "edit") { |
| | | submitProductEdit(); |
| | | } else { |
| | | if(productOperationType.value === "add"){ |
| | | |
| | | productData.value.push({ ...productForm.value }); |
| | | }else{ |
| | | productData.value[productIndex.value] = { ...productForm.value } |
| | |
| | | // 计算含税单价 = 含税总价 / 数量 |
| | | productForm.value.taxInclusiveUnitPrice = (totalPrice / quantity).toFixed(2); |
| | | |
| | | // 如果有税率,计算不含税总价 |
| | | // 有税率则计算不含税总价,否则不含税总价 = 含税总价 |
| | | if (productForm.value.taxRate) { |
| | | productForm.value.taxExclusiveTotalPrice = |
| | | proxy.calculateTaxExclusiveTotalPrice( |
| | | totalPrice, |
| | | productForm.value.taxRate |
| | | ); |
| | | } else { |
| | | productForm.value.taxExclusiveTotalPrice = totalPrice.toFixed(2); |
| | | } |
| | | |
| | | isCalculating.value = false; |
| | |
| | | |
| | | // 根据不含税总价计算含税单价和数量 |
| | | const calculateFromExclusiveTotalPrice = () => { |
| | | if (!productForm.value.taxRate) { |
| | | proxy.$modal.msgWarning("请先选择税率"); |
| | | return; |
| | | } |
| | | if (isCalculating.value) return; |
| | | |
| | | const exclusiveTotalPrice = parseFloat(productForm.value.taxExclusiveTotalPrice); |
| | | const quantity = parseFloat(productForm.value.quantity); |
| | | const taxRate = parseFloat(productForm.value.taxRate); |
| | | |
| | | if (!exclusiveTotalPrice || !quantity || quantity <= 0 || !taxRate) { |
| | | if (!exclusiveTotalPrice || !quantity || quantity <= 0) { |
| | | return; |
| | | } |
| | | |
| | | isCalculating.value = true; |
| | | |
| | | // 先计算含税总价 = 不含税总价 / (1 - 税率/100) |
| | | const taxRateDecimal = taxRate / 100; |
| | | const inclusiveTotalPrice = exclusiveTotalPrice / (1 - taxRateDecimal); |
| | | productForm.value.taxInclusiveTotalPrice = inclusiveTotalPrice.toFixed(2); |
| | | |
| | | // 计算含税单价 = 含税总价 / 数量 |
| | | productForm.value.taxInclusiveUnitPrice = (inclusiveTotalPrice / quantity).toFixed(2); |
| | | if (productForm.value.taxRate) { |
| | | // 有税率:含税总价 = 不含税总价 / (1 - 税率/100) |
| | | const taxRateDecimal = parseFloat(productForm.value.taxRate) / 100; |
| | | const inclusiveTotalPrice = exclusiveTotalPrice / (1 - taxRateDecimal); |
| | | productForm.value.taxInclusiveTotalPrice = inclusiveTotalPrice.toFixed(2); |
| | | productForm.value.taxInclusiveUnitPrice = (inclusiveTotalPrice / quantity).toFixed(2); |
| | | } else { |
| | | // 无税率:含税总价 = 不含税总价 |
| | | productForm.value.taxInclusiveTotalPrice = exclusiveTotalPrice.toFixed(2); |
| | | productForm.value.taxInclusiveUnitPrice = (exclusiveTotalPrice / quantity).toFixed(2); |
| | | } |
| | | |
| | | isCalculating.value = false; |
| | | }; |
| | | |
| | | // 根据数量变化计算总价 |
| | | const calculateFromQuantity = () => { |
| | | if (!productForm.value.taxRate) { |
| | | proxy.$modal.msgWarning("请先选择税率"); |
| | | return; |
| | | } |
| | | if (isCalculating.value) return; |
| | | |
| | | const quantity = parseFloat(productForm.value.quantity); |
| | |
| | | // 计算含税总价 |
| | | productForm.value.taxInclusiveTotalPrice = (unitPrice * quantity).toFixed(2); |
| | | |
| | | // 如果有税率,计算不含税总价 |
| | | // 有税率则计算不含税总价,否则不含税总价 = 含税总价 |
| | | if (productForm.value.taxRate) { |
| | | productForm.value.taxExclusiveTotalPrice = |
| | | proxy.calculateTaxExclusiveTotalPrice( |
| | | productForm.value.taxInclusiveTotalPrice, |
| | | productForm.value.taxRate |
| | | ); |
| | | } else { |
| | | productForm.value.taxExclusiveTotalPrice = productForm.value.taxInclusiveTotalPrice; |
| | | } |
| | | |
| | | isCalculating.value = false; |
| | |
| | | |
| | | // 根据含税单价变化计算总价 |
| | | const calculateFromUnitPrice = () => { |
| | | if (!productForm.value.taxRate) { |
| | | proxy.$modal.msgWarning("请先选择税率"); |
| | | return; |
| | | } |
| | | if (isCalculating.value) return; |
| | | |
| | | const quantity = parseFloat(productForm.value.quantity); |
| | |
| | | // 计算含税总价 |
| | | productForm.value.taxInclusiveTotalPrice = (unitPrice * quantity).toFixed(2); |
| | | |
| | | // 如果有税率,计算不含税总价 |
| | | // 有税率则计算不含税总价,否则不含税总价 = 含税总价 |
| | | if (productForm.value.taxRate) { |
| | | productForm.value.taxExclusiveTotalPrice = |
| | | proxy.calculateTaxExclusiveTotalPrice( |
| | | productForm.value.taxInclusiveTotalPrice, |
| | | productForm.value.taxRate |
| | | ); |
| | | } else { |
| | | productForm.value.taxExclusiveTotalPrice = productForm.value.taxInclusiveTotalPrice; |
| | | } |
| | | |
| | | isCalculating.value = false; |
| | |
| | | |
| | | // 根据税率变化计算不含税总价 |
| | | const calculateFromTaxRate = () => { |
| | | if (!productForm.value.taxRate) { |
| | | proxy.$modal.msgWarning("请先选择税率"); |
| | | return; |
| | | } |
| | | if (isCalculating.value) return; |
| | | |
| | | const inclusiveTotalPrice = parseFloat(productForm.value.taxInclusiveTotalPrice); |
| | | const taxRate = parseFloat(productForm.value.taxRate); |
| | | |
| | | if (!inclusiveTotalPrice || !taxRate) { |
| | | if (!inclusiveTotalPrice) { |
| | | return; |
| | | } |
| | | |
| | | isCalculating.value = true; |
| | | |
| | | // 计算不含税总价 |
| | | productForm.value.taxExclusiveTotalPrice = |
| | | proxy.calculateTaxExclusiveTotalPrice( |
| | | inclusiveTotalPrice, |
| | | taxRate |
| | | ); |
| | | if (productForm.value.taxRate) { |
| | | // 有税率:重新计算不含税总价 |
| | | productForm.value.taxExclusiveTotalPrice = |
| | | proxy.calculateTaxExclusiveTotalPrice( |
| | | inclusiveTotalPrice, |
| | | parseFloat(productForm.value.taxRate) |
| | | ); |
| | | } else { |
| | | // 无税率:不含税总价 = 含税总价 |
| | | productForm.value.taxExclusiveTotalPrice = inclusiveTotalPrice.toFixed(2); |
| | | } |
| | | |
| | | isCalculating.value = false; |
| | | }; |
| | |
| | | return typeTextMap[statusStr] || 'info'; |
| | | }; |
| | | |
| | | const getRemainAmount = (row) => { |
| | | const total = Number(row?.quantity || 0); |
| | | const shipped = Number(row?.partSendAmount || 0); |
| | | return Math.max(0, total - shipped); |
| | | }; |
| | | |
| | | /** |
| | | * 判断是否可以发货 |
| | | * 只有在产品状态是充足,发货状态是待发货和审核拒绝的时候才可以发货 |
| | |
| | | if (row.approveStatus !== 1) { |
| | | return false; |
| | | } |
| | | |
| | | // 获取发货状态 |
| | | const shippingStatus = row.shippingStatus; |
| | | |
| | | // 如果已发货(有发货日期或车牌号),不能再次发货 |
| | | if (row.shippingDate || row.shippingCarNumber) { |
| | | |
| | | if (getRemainAmount(row) <= 0) { |
| | | return false; |
| | | } |
| | | |
| | | // 发货状态必须是"待发货"或"审核拒绝" |
| | | const statusStr = shippingStatus ? String(shippingStatus).trim() : ''; |
| | | return statusStr === '待发货' || statusStr === '审核拒绝'; |
| | | |
| | | |
| | | return true; |
| | | }; |
| | | |
| | | /** |
| | |
| | | }); |
| | | } |
| | | |
| | | |
| | | // 打开发货弹框 |
| | | const openDeliveryForm = (row) => { |
| | | // 检查是否可以发货 |
| | |
| | | proxy.$modal.msgWarning("只有在产品状态是充足,发货状态是待发货或审核拒绝的时候才可以发货"); |
| | | return; |
| | | } |
| | | |
| | | currentDeliveryRow.value = row; |
| | | const total = Number(row.quantity || 0); |
| | | const shipped = Number(row.partSendAmount || 0); |
| | | const remain = Math.max(0, total - shipped); |
| | | deliveryForm.value = { |
| | | type: "货车", |
| | | type: "快递", |
| | | remainAmount: remain, |
| | | deliveryMode: "全部", |
| | | partSendAmount: remain, |
| | | }; |
| | | // 重置审批人节点(默认一个空节点) |
| | | approverNodes.value = [{ id: 1, userId: null }]; |
| | |
| | | return; |
| | | } |
| | | const approveUserIds = approverNodes.value.map(node => node.userId).join(","); |
| | | const remain = Number(deliveryForm.value.remainAmount) || 0; |
| | | if (remain <= 0) { |
| | | proxy.$modal.msgWarning("待发货数量为0,无法发货"); |
| | | return; |
| | | } |
| | | const isAllSend = deliveryForm.value.deliveryMode === "全部" ? 1 : 0; |
| | | let quantityToSend = remain; |
| | | if (isAllSend === 0) { |
| | | quantityToSend = Number(deliveryForm.value.partSendAmount) || 0; |
| | | if (quantityToSend <= 0) { |
| | | proxy.$modal.msgWarning("请输入发货数量"); |
| | | return; |
| | | } |
| | | if (quantityToSend > remain) { |
| | | proxy.$modal.msgWarning(`发货数量不能超过待发货数量(${remain})`); |
| | | return; |
| | | } |
| | | } |
| | | // 保存当前展开的行ID,以便发货后重新加载子表格数据 |
| | | const currentExpandedKeys = [...expandedRowKeys.value]; |
| | | const salesLedgerId = currentDeliveryRow.value.salesLedgerId; |
| | |
| | | salesLedgerId: salesLedgerId, |
| | | salesLedgerProductId: currentDeliveryRow.value.id, |
| | | type: deliveryForm.value.type, |
| | | isAllSend, |
| | | partSendAmount: quantityToSend, |
| | | approveUserIds, |
| | | }) |
| | | .then(() => { |