|
@@ -23,15 +23,6 @@
|
|
|
>
|
|
|
导入物料
|
|
|
</el-button>
|
|
|
- <el-button
|
|
|
- v-if="selectedRows.length > 0"
|
|
|
- type="danger"
|
|
|
- icon="el-icon-delete"
|
|
|
- size="small"
|
|
|
- @click="handleBatchDelete"
|
|
|
- >
|
|
|
- 批量删除 ({{ selectedRows.length }})
|
|
|
- </el-button>
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
@@ -43,32 +34,8 @@
|
|
|
:data="materialDetails"
|
|
|
:option="tableOption"
|
|
|
:page.sync="page"
|
|
|
- @row-save="handleRowSave"
|
|
|
- @row-update="handleRowUpdate"
|
|
|
- @row-del="handleRowDelete"
|
|
|
- @selection-change="handleSelectionChange"
|
|
|
@refresh-change="handleRefresh"
|
|
|
>
|
|
|
- <!-- 自定义操作列 -->
|
|
|
- <template slot="menuLeft" slot-scope="{ row, index }">
|
|
|
- <el-button
|
|
|
- type="text"
|
|
|
- size="small"
|
|
|
- icon="el-icon-edit"
|
|
|
- @click="handleEditDetail(row, index)"
|
|
|
- >
|
|
|
- 编辑
|
|
|
- </el-button>
|
|
|
- <el-button
|
|
|
- type="text"
|
|
|
- size="small"
|
|
|
- icon="el-icon-delete"
|
|
|
- class="delete-btn"
|
|
|
- @click="handleDeleteDetail(row, index)"
|
|
|
- >
|
|
|
- 删除
|
|
|
- </el-button>
|
|
|
- </template>
|
|
|
|
|
|
<!-- 总金额列自定义渲染 -->
|
|
|
<template slot="totalAmount" slot-scope="{ row }">
|
|
@@ -95,50 +62,60 @@
|
|
|
@cancel="handleImportCancel"
|
|
|
/>
|
|
|
|
|
|
- <!-- 编辑明细弹窗 -->
|
|
|
- <el-dialog
|
|
|
- title="编辑物料明细"
|
|
|
- :visible.sync="editDialogVisible"
|
|
|
- width="600px"
|
|
|
- :close-on-click-modal="false"
|
|
|
- @close="handleEditDialogClose"
|
|
|
- >
|
|
|
- <avue-form
|
|
|
- ref="editForm"
|
|
|
- v-model="editFormData"
|
|
|
- :option="editFormOption"
|
|
|
- @submit="handleEditSubmit"
|
|
|
- @reset-change="handleEditReset"
|
|
|
- />
|
|
|
- <div slot="footer" class="dialog-footer">
|
|
|
- <el-button @click="editDialogVisible = false">取消</el-button>
|
|
|
- <el-button
|
|
|
- type="primary"
|
|
|
- :loading="editLoading"
|
|
|
- @click="handleEditSubmit"
|
|
|
- >
|
|
|
- 确定
|
|
|
- </el-button>
|
|
|
- </div>
|
|
|
- </el-dialog>
|
|
|
+
|
|
|
</div>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { getMaterialDetailOption } from './material-detail-option'
|
|
|
+import { getMaterialDetailOption, MATERIAL_DETAIL_STATUS } from './material-detail-option'
|
|
|
import MaterialImportDialog from './material-import-dialog.vue'
|
|
|
|
|
|
/**
|
|
|
+ * 状态标签类型映射常量
|
|
|
+ * @type {Record<MaterialDetailStatus, TagType>}
|
|
|
+ */
|
|
|
+const STATUS_TAG_TYPE_MAP = {
|
|
|
+ [MATERIAL_DETAIL_STATUS.PENDING]: 'warning', // 待确认
|
|
|
+ [MATERIAL_DETAIL_STATUS.CONFIRMED]: 'success', // 已确认
|
|
|
+ [MATERIAL_DETAIL_STATUS.CANCELLED]: 'danger' // 已取消
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
+ * 状态文本映射常量
|
|
|
+ * @type {Record<MaterialDetailStatus, string>}
|
|
|
+ */
|
|
|
+const STATUS_TEXT_MAP = {
|
|
|
+ [MATERIAL_DETAIL_STATUS.PENDING]: '待确认',
|
|
|
+ [MATERIAL_DETAIL_STATUS.CONFIRMED]: '已确认',
|
|
|
+ [MATERIAL_DETAIL_STATUS.CANCELLED]: '已取消'
|
|
|
+}
|
|
|
+
|
|
|
+/**
|
|
|
* @typedef {import('./material-detail-option').MaterialDetailItem} MaterialDetailItem
|
|
|
* @typedef {import('./material-detail-option').MaterialDetailFormData} MaterialDetailFormData
|
|
|
+ * @typedef {import('./material-detail-option').AvueTableOption} AvueTableOption
|
|
|
+ * @typedef {import('./material-detail-option').MaterialDetailStatus} MaterialDetailStatus
|
|
|
+ */
|
|
|
+
|
|
|
+/**
|
|
|
+ * 分页配置类型定义
|
|
|
+ * @typedef {Object} PaginationConfig
|
|
|
+ * @property {number} currentPage - 当前页码,从1开始
|
|
|
+ * @property {number} pageSize - 每页显示条数
|
|
|
+ * @property {number} total - 总记录数
|
|
|
+ */
|
|
|
+
|
|
|
+/**
|
|
|
+ * 状态标签类型映射
|
|
|
+ * @typedef {'warning'|'success'|'danger'|'info'} TagType
|
|
|
*/
|
|
|
|
|
|
/**
|
|
|
* 物料明细表格组件
|
|
|
- * @description 用于管理订单的物料明细信息,支持导入、编辑、删除等操作
|
|
|
- * @author 系统开发团队
|
|
|
- * @version 1.0.0
|
|
|
- * @since 2024-01-15
|
|
|
+ * @description 用于展示订单的物料明细信息,支持物料导入功能(只读模式)
|
|
|
+ * 该组件已移除所有编辑、新增、删除功能,仅支持数据展示和物料导入
|
|
|
+ * @emits {Array<MaterialDetailItem>} material-import - 物料导入事件
|
|
|
+ * @emits {void} refresh - 刷新事件
|
|
|
*/
|
|
|
export default {
|
|
|
name: 'MaterialDetailTable',
|
|
@@ -151,47 +128,43 @@ export default {
|
|
|
*/
|
|
|
props: {
|
|
|
/**
|
|
|
- * 订单ID
|
|
|
+ * 订单ID - 关联的订单唯一标识符
|
|
|
* @type {string|number|null}
|
|
|
*/
|
|
|
orderId: {
|
|
|
type: [String, Number],
|
|
|
- default: null
|
|
|
+ default: null,
|
|
|
+ validator: (value) => value === null || value === undefined || (typeof value === 'string' && value.length > 0) || (typeof value === 'number' && value > 0)
|
|
|
},
|
|
|
|
|
|
- /**
|
|
|
- * 是否为编辑模式
|
|
|
- * @type {boolean}
|
|
|
- */
|
|
|
- isEdit: {
|
|
|
- type: Boolean,
|
|
|
- default: false
|
|
|
- },
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
- * 物料明细列表
|
|
|
+ * 物料明细列表 - 要展示的物料明细数据
|
|
|
* @type {Array<MaterialDetailItem>}
|
|
|
*/
|
|
|
materialDetails: {
|
|
|
type: Array,
|
|
|
- default: () => []
|
|
|
+ default: () => [],
|
|
|
+ validator: (value) => Array.isArray(value)
|
|
|
}
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 组件数据
|
|
|
+ * @returns {Object} 组件响应式数据对象
|
|
|
*/
|
|
|
data() {
|
|
|
return {
|
|
|
/**
|
|
|
- * 表单数据
|
|
|
+ * 表单数据 - AvueJS组件的表单数据绑定
|
|
|
* @type {MaterialDetailFormData}
|
|
|
*/
|
|
|
formData: {},
|
|
|
|
|
|
/**
|
|
|
- * 分页配置
|
|
|
- * @type {Object}
|
|
|
+ * 分页配置 - 表格分页相关配置
|
|
|
+ * @type {PaginationConfig}
|
|
|
*/
|
|
|
page: {
|
|
|
currentPage: 1,
|
|
@@ -200,40 +173,10 @@ export default {
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
- * 选中的行数据
|
|
|
- * @type {Array<MaterialDetailItem>}
|
|
|
- */
|
|
|
- selectedRows: [],
|
|
|
-
|
|
|
- /**
|
|
|
- * 导入弹窗显示状态
|
|
|
- * @type {boolean}
|
|
|
- */
|
|
|
- importDialogVisible: false,
|
|
|
-
|
|
|
- /**
|
|
|
- * 编辑弹窗显示状态
|
|
|
- * @type {boolean}
|
|
|
- */
|
|
|
- editDialogVisible: false,
|
|
|
-
|
|
|
- /**
|
|
|
- * 编辑表单数据
|
|
|
- * @type {MaterialDetailFormData}
|
|
|
- */
|
|
|
- editFormData: {},
|
|
|
-
|
|
|
- /**
|
|
|
- * 编辑加载状态
|
|
|
+ * 导入弹窗显示状态 - 控制物料导入弹窗的显示/隐藏
|
|
|
* @type {boolean}
|
|
|
*/
|
|
|
- editLoading: false,
|
|
|
-
|
|
|
- /**
|
|
|
- * 当前编辑的行索引
|
|
|
- * @type {number|null}
|
|
|
- */
|
|
|
- editRowIndex: null
|
|
|
+ importDialogVisible: false
|
|
|
}
|
|
|
},
|
|
|
|
|
@@ -242,23 +185,11 @@ export default {
|
|
|
*/
|
|
|
computed: {
|
|
|
/**
|
|
|
- * 表格配置选项
|
|
|
- * @returns {Object} AvueJS表格配置
|
|
|
+ * 表格配置选项 - 获取AvueJS表格的配置对象
|
|
|
+ * @returns {AvueTableOption} AvueJS表格配置对象,已配置为只读模式
|
|
|
*/
|
|
|
tableOption() {
|
|
|
- return getMaterialDetailOption(!this.isEdit)
|
|
|
- },
|
|
|
-
|
|
|
- /**
|
|
|
- * 编辑表单配置选项
|
|
|
- * @returns {Object} AvueJS表单配置
|
|
|
- */
|
|
|
- editFormOption() {
|
|
|
- return {
|
|
|
- submitBtn: false,
|
|
|
- emptyBtn: false,
|
|
|
- column: this.tableOption.column.filter(col => !col.hide)
|
|
|
- }
|
|
|
+ return getMaterialDetailOption()
|
|
|
}
|
|
|
},
|
|
|
|
|
@@ -283,296 +214,92 @@ export default {
|
|
|
*/
|
|
|
methods: {
|
|
|
/**
|
|
|
- * 处理导入物料按钮点击
|
|
|
- * @description 打开物料导入弹窗
|
|
|
+ * 处理导入物料按钮点击事件
|
|
|
+ * @description 打开物料导入弹窗,允许用户选择和导入物料
|
|
|
+ * @returns {void}
|
|
|
*/
|
|
|
handleImportMaterial() {
|
|
|
this.importDialogVisible = true
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
- * 处理批量删除
|
|
|
- * @description 删除选中的物料明细
|
|
|
- */
|
|
|
- async handleBatchDelete() {
|
|
|
- try {
|
|
|
- await this.$confirm(
|
|
|
- `确定要删除选中的 ${this.selectedRows.length} 条物料明细吗?`,
|
|
|
- '批量删除确认',
|
|
|
- {
|
|
|
- confirmButtonText: '确定',
|
|
|
- cancelButtonText: '取消',
|
|
|
- type: 'warning'
|
|
|
- }
|
|
|
- )
|
|
|
-
|
|
|
- // 过滤掉选中的行
|
|
|
- const updatedDetails = this.materialDetails.filter(
|
|
|
- item => !this.selectedRows.some(selected => selected.id === item.id)
|
|
|
- )
|
|
|
-
|
|
|
- this.$emit('material-change', updatedDetails)
|
|
|
- this.$message.success(`成功删除 ${this.selectedRows.length} 条物料明细`)
|
|
|
- this.selectedRows = []
|
|
|
- } catch (error) {
|
|
|
- // 用户取消删除
|
|
|
- }
|
|
|
- },
|
|
|
-
|
|
|
- /**
|
|
|
- * 处理行保存
|
|
|
- * @param {MaterialDetailFormData} row - 行数据
|
|
|
- * @param {Function} done - 完成回调
|
|
|
- * @param {Function} loading - 加载状态回调
|
|
|
- */
|
|
|
- async handleRowSave(row, done, loading) {
|
|
|
- try {
|
|
|
- loading(true)
|
|
|
-
|
|
|
- // 计算总金额
|
|
|
- const calculatedRow = this.calculateRowAmounts(row)
|
|
|
-
|
|
|
- // 生成新的ID
|
|
|
- const newRow = {
|
|
|
- ...calculatedRow,
|
|
|
- id: Date.now().toString(),
|
|
|
- createTime: new Date().toISOString(),
|
|
|
- updateTime: new Date().toISOString()
|
|
|
- }
|
|
|
-
|
|
|
- const updatedDetails = [...this.materialDetails, newRow]
|
|
|
- this.$emit('material-change', updatedDetails)
|
|
|
-
|
|
|
- this.$message.success('添加物料明细成功')
|
|
|
- done()
|
|
|
- } catch (error) {
|
|
|
- this.$message.error('添加物料明细失败')
|
|
|
- } finally {
|
|
|
- loading(false)
|
|
|
- }
|
|
|
- },
|
|
|
-
|
|
|
- /**
|
|
|
- * 处理行更新
|
|
|
- * @param {MaterialDetailFormData} row - 行数据
|
|
|
- * @param {number} index - 行索引
|
|
|
- * @param {Function} done - 完成回调
|
|
|
- * @param {Function} loading - 加载状态回调
|
|
|
- */
|
|
|
- async handleRowUpdate(row, index, done, loading) {
|
|
|
- try {
|
|
|
- loading(true)
|
|
|
-
|
|
|
- // 计算总金额
|
|
|
- const calculatedRow = this.calculateRowAmounts(row)
|
|
|
- calculatedRow.updateTime = new Date().toISOString()
|
|
|
-
|
|
|
- const updatedDetails = [...this.materialDetails]
|
|
|
- updatedDetails[index] = calculatedRow
|
|
|
-
|
|
|
- this.$emit('material-change', updatedDetails)
|
|
|
- this.$message.success('更新物料明细成功')
|
|
|
- done()
|
|
|
- } catch (error) {
|
|
|
- this.$message.error('更新物料明细失败')
|
|
|
- } finally {
|
|
|
- loading(false)
|
|
|
- }
|
|
|
- },
|
|
|
-
|
|
|
- /**
|
|
|
- * 处理行删除
|
|
|
- * @param {MaterialDetailItem} row - 行数据
|
|
|
- * @param {number} index - 行索引
|
|
|
- */
|
|
|
- async handleRowDelete(row, index) {
|
|
|
- try {
|
|
|
- await this.$confirm(
|
|
|
- '确定要删除这条物料明细吗?',
|
|
|
- '删除确认',
|
|
|
- {
|
|
|
- confirmButtonText: '确定',
|
|
|
- cancelButtonText: '取消',
|
|
|
- type: 'warning'
|
|
|
- }
|
|
|
- )
|
|
|
-
|
|
|
- const updatedDetails = this.materialDetails.filter((_, i) => i !== index)
|
|
|
- this.$emit('material-change', updatedDetails)
|
|
|
- this.$message.success('删除物料明细成功')
|
|
|
- } catch (error) {
|
|
|
- // 用户取消删除
|
|
|
- }
|
|
|
- },
|
|
|
-
|
|
|
- /**
|
|
|
- * 处理选择变化
|
|
|
- * @param {Array<MaterialDetailItem>} selection - 选中的行数据
|
|
|
- */
|
|
|
- handleSelectionChange(selection) {
|
|
|
- this.selectedRows = selection
|
|
|
- },
|
|
|
-
|
|
|
- /**
|
|
|
- * 处理刷新
|
|
|
+ * 处理表格刷新事件
|
|
|
+ * @description 触发刷新事件,通知父组件重新加载数据
|
|
|
+ * @returns {void}
|
|
|
+ * @emits refresh
|
|
|
*/
|
|
|
handleRefresh() {
|
|
|
- // 刷新逻辑,如果需要的话
|
|
|
- },
|
|
|
-
|
|
|
- /**
|
|
|
- * 处理编辑明细
|
|
|
- * @param {MaterialDetailItem} row - 行数据
|
|
|
- * @param {number} index - 行索引
|
|
|
- */
|
|
|
- handleEditDetail(row, index) {
|
|
|
- this.editFormData = { ...row }
|
|
|
- this.editRowIndex = index
|
|
|
- this.editDialogVisible = true
|
|
|
- },
|
|
|
-
|
|
|
- /**
|
|
|
- * 处理删除明细
|
|
|
- * @param {MaterialDetailItem} row - 行数据
|
|
|
- * @param {number} index - 行索引
|
|
|
- */
|
|
|
- handleDeleteDetail(row, index) {
|
|
|
- this.handleRowDelete(row, index)
|
|
|
- },
|
|
|
-
|
|
|
- /**
|
|
|
- * 处理编辑提交
|
|
|
- */
|
|
|
- async handleEditSubmit() {
|
|
|
- try {
|
|
|
- this.editLoading = true
|
|
|
-
|
|
|
- // 表单验证
|
|
|
- const valid = await this.validateEditForm()
|
|
|
- if (!valid) {
|
|
|
- return
|
|
|
- }
|
|
|
-
|
|
|
- // 计算总金额
|
|
|
- const calculatedData = this.calculateRowAmounts(this.editFormData)
|
|
|
- calculatedData.updateTime = new Date().toISOString()
|
|
|
-
|
|
|
- const updatedDetails = [...this.materialDetails]
|
|
|
- updatedDetails[this.editRowIndex] = calculatedData
|
|
|
-
|
|
|
- this.$emit('material-change', updatedDetails)
|
|
|
- this.$message.success('更新物料明细成功')
|
|
|
- this.editDialogVisible = false
|
|
|
- } catch (error) {
|
|
|
- this.$message.error('更新物料明细失败')
|
|
|
- } finally {
|
|
|
- this.editLoading = false
|
|
|
- }
|
|
|
- },
|
|
|
-
|
|
|
- /**
|
|
|
- * 处理编辑重置
|
|
|
- */
|
|
|
- handleEditReset() {
|
|
|
- this.editFormData = {}
|
|
|
- },
|
|
|
-
|
|
|
- /**
|
|
|
- * 处理编辑弹窗关闭
|
|
|
- */
|
|
|
- handleEditDialogClose() {
|
|
|
- this.editFormData = {}
|
|
|
- this.editRowIndex = null
|
|
|
+ this.$emit('refresh')
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
- * 处理导入确认
|
|
|
- * @param {Array<MaterialDetailItem>} importedMaterials - 导入的物料列表
|
|
|
+ * 处理物料导入确认事件
|
|
|
+ * @description 处理物料导入确认,将导入的物料数据传递给父组件并关闭弹窗
|
|
|
+ * @param {Array<MaterialDetailItem>} importedMaterials - 导入的物料列表,必须为有效的物料明细数组
|
|
|
+ * @returns {void}
|
|
|
+ * @emits material-import
|
|
|
*/
|
|
|
handleImportConfirm(importedMaterials) {
|
|
|
+ if (!Array.isArray(importedMaterials)) {
|
|
|
+ console.warn('导入的物料数据必须为数组格式')
|
|
|
+ return
|
|
|
+ }
|
|
|
this.$emit('material-import', importedMaterials)
|
|
|
this.importDialogVisible = false
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
- * 处理导入取消
|
|
|
+ * 处理物料导入取消事件
|
|
|
+ * @description 取消物料导入操作,关闭导入弹窗
|
|
|
+ * @returns {void}
|
|
|
*/
|
|
|
handleImportCancel() {
|
|
|
this.importDialogVisible = false
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
- * 验证编辑表单
|
|
|
- * @returns {Promise<boolean>} 验证结果
|
|
|
- */
|
|
|
- async validateEditForm() {
|
|
|
- return new Promise((resolve) => {
|
|
|
- this.$refs.editForm.validate((valid) => {
|
|
|
- resolve(valid)
|
|
|
- })
|
|
|
- })
|
|
|
- },
|
|
|
-
|
|
|
- /**
|
|
|
- * 计算行金额
|
|
|
- * @param {MaterialDetailFormData} row - 行数据
|
|
|
- * @returns {MaterialDetailFormData} 计算后的行数据
|
|
|
- */
|
|
|
- calculateRowAmounts(row) {
|
|
|
- const orderQuantity = Number(row.orderQuantity) || 0
|
|
|
- const unitPrice = Number(row.unitPrice) || 0
|
|
|
- const taxRate = Number(row.taxRate) || 0
|
|
|
-
|
|
|
- // 计算税额和总金额
|
|
|
- const subtotal = orderQuantity * unitPrice
|
|
|
- const taxAmount = subtotal * (taxRate / 100)
|
|
|
- const totalAmount = subtotal + taxAmount
|
|
|
-
|
|
|
- return {
|
|
|
- ...row,
|
|
|
- orderQuantity,
|
|
|
- unitPrice,
|
|
|
- taxRate,
|
|
|
- taxAmount: Number(taxAmount.toFixed(2)),
|
|
|
- totalAmount: Number(totalAmount.toFixed(2))
|
|
|
- }
|
|
|
- },
|
|
|
-
|
|
|
- /**
|
|
|
* 格式化金额显示
|
|
|
- * @param {number} amount - 金额
|
|
|
- * @returns {string} 格式化后的金额字符串
|
|
|
+ * @description 将数字金额格式化为带货币符号的字符串,保留2位小数
|
|
|
+ * @param {number|string|null|undefined} amount - 金额数值,支持数字、字符串或空值
|
|
|
+ * @returns {string} 格式化后的金额字符串,格式为 ¥XX.XX
|
|
|
+ * @example
|
|
|
+ * formatAmount(123.456) // 返回 "¥123.46"
|
|
|
+ * formatAmount(null) // 返回 "¥0.00"
|
|
|
+ * formatAmount('100') // 返回 "¥100.00"
|
|
|
*/
|
|
|
formatAmount(amount) {
|
|
|
- return `¥${Number(amount || 0).toFixed(2)}`
|
|
|
+ const numAmount = Number(amount || 0)
|
|
|
+ if (isNaN(numAmount)) {
|
|
|
+ console.warn(`无效的金额值: ${amount}`)
|
|
|
+ return '¥0.00'
|
|
|
+ }
|
|
|
+ return `¥${numAmount.toFixed(2)}`
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 获取状态标签类型
|
|
|
- * @param {string} status - 状态值
|
|
|
- * @returns {string} 标签类型
|
|
|
+ * @description 根据物料明细状态值返回对应的Element UI标签类型
|
|
|
+ * @param {MaterialDetailStatus} status - 物料明细状态值
|
|
|
+ * @returns {TagType} Element UI标签类型
|
|
|
+ * @example
|
|
|
+ * getStatusTagType('0') // 返回 'warning'
|
|
|
+ * getStatusTagType('1') // 返回 'success'
|
|
|
*/
|
|
|
getStatusTagType(status) {
|
|
|
- const typeMap = {
|
|
|
- '0': 'warning', // 待确认
|
|
|
- '1': 'success', // 已确认
|
|
|
- '2': 'danger' // 已取消
|
|
|
- }
|
|
|
- return typeMap[status] || 'info'
|
|
|
+ return STATUS_TAG_TYPE_MAP[status] || 'info'
|
|
|
},
|
|
|
|
|
|
/**
|
|
|
* 获取状态文本
|
|
|
- * @param {string} status - 状态值
|
|
|
- * @returns {string} 状态文本
|
|
|
+ * @description 根据物料明细状态值返回对应的中文描述
|
|
|
+ * @param {MaterialDetailStatus} status - 物料明细状态值
|
|
|
+ * @returns {string} 状态的中文描述文本
|
|
|
+ * @example
|
|
|
+ * getStatusText('0') // 返回 '待确认'
|
|
|
+ * getStatusText('1') // 返回 '已确认'
|
|
|
*/
|
|
|
getStatusText(status) {
|
|
|
- const textMap = {
|
|
|
- '0': '待确认',
|
|
|
- '1': '已确认',
|
|
|
- '2': '已取消'
|
|
|
- }
|
|
|
- return textMap[status] || '未知'
|
|
|
+ return STATUS_TEXT_MAP[status] || '未知'
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -652,4 +379,4 @@ export default {
|
|
|
justify-content: flex-end;
|
|
|
}
|
|
|
}
|
|
|
-</style>
|
|
|
+</style>
|