|
@@ -665,7 +665,7 @@ export default {
|
|
|
|
|
|
// 验证订单详情响应数据
|
|
|
if (!orderResponse?.data?.success) {
|
|
|
- const errorMsg = orderResponse?.data?.msg || '获取订单详情失败'
|
|
|
+ const errorMsg = (orderResponse?.data && (orderResponse.data.message || orderResponse.data.msg)) || '获取订单详情失败'
|
|
|
throw new Error(errorMsg)
|
|
|
}
|
|
|
|
|
@@ -712,7 +712,7 @@ export default {
|
|
|
|
|
|
// 验证响应数据结构
|
|
|
if (!response?.data?.success) {
|
|
|
- const errorMsg = response?.data?.msg || '获取物料明细失败'
|
|
|
+ const errorMsg = (response?.data && (response.data.message || response.data.msg)) || '获取物料明细失败'
|
|
|
throw new Error(errorMsg)
|
|
|
}
|
|
|
|
|
@@ -748,8 +748,8 @@ export default {
|
|
|
warehouseId: String(material.warehouseId || ''),
|
|
|
mainCategoryId: String(material.mainItemCategoryId) || '',
|
|
|
mainItemCategoryId: material.mainItemCategoryId ? String(material.mainItemCategoryId) : undefined,
|
|
|
- mainItemCategoryName: material.mainItemCategoryName || material.mainCategoryName || '',
|
|
|
- mainCategoryName: material.mainItemCategoryName || material.mainCategoryName || '',
|
|
|
+ mainItemCategoryName: material.mainItemCategoryName || '',
|
|
|
+ mainCategoryName: material.mainItemCategoryName || '',
|
|
|
createTime: material.createTime || new Date().toISOString(),
|
|
|
updateTime: material.updateTime || new Date().toISOString(),
|
|
|
dataSource: MaterialDetailDataSource.REMOTE,
|
|
@@ -775,8 +775,8 @@ export default {
|
|
|
...material,
|
|
|
id: String(material.id || ''),
|
|
|
mainItemCategoryId: String(material.mainItemCategoryId || ''),
|
|
|
- mainItemCategoryName: material.mainItemCategoryName || material.mainCategoryName || '',
|
|
|
- mainCategoryName: material.mainItemCategoryName || material.mainCategoryName || '',
|
|
|
+ mainItemCategoryName: material.mainItemCategoryName || '',
|
|
|
+ mainCategoryName: material.mainItemCategoryName || '',
|
|
|
itemId: String(material.itemId || ''),
|
|
|
warehouseId: String(material.warehouseId || ''),
|
|
|
createTime: material.createTime || new Date().toISOString(),
|
|
@@ -965,7 +965,7 @@ export default {
|
|
|
background: 'rgba(0, 0, 0, 0.7)'
|
|
|
})
|
|
|
|
|
|
- const response = await submitOrderToU9({ id: orderId })
|
|
|
+ const response = await submitOrderToU9({ id: String(orderId) })
|
|
|
if (response && response.data && response.data.success) {
|
|
|
this.$message.success('订单提交成功')
|
|
|
// 提交成功后,重新加载详情以更新状态
|
|
@@ -1013,15 +1013,15 @@ export default {
|
|
|
const orderCode = (this.formData && this.formData.orderCode) || ''
|
|
|
|
|
|
const payloads = importedMaterials.map(material => ({
|
|
|
- orderId: orderId, // 保持字符串以避免大整数精度问题
|
|
|
+ orderId: String(orderId), // 以字符串传输,避免大整数精度问题
|
|
|
orderCode,
|
|
|
- itemId: Number(material.itemId) || 0,
|
|
|
+ itemId: String(material.itemId || ''),
|
|
|
itemCode: material.itemCode || '',
|
|
|
itemName: material.itemName || '',
|
|
|
specs: material.specs || '',
|
|
|
- mainItemCategoryId: Number(material.mainItemCategoryId) || Number(material.mainCategoryId) || 0,
|
|
|
- mainItemCategoryName: material.mainItemCategoryName || material.mainCategoryName || '',
|
|
|
- warehouseId: Number(material.warehouseId) || 0,
|
|
|
+ mainItemCategoryId: String(material.mainItemCategoryId || ''),
|
|
|
+ mainItemCategoryName: material.mainItemCategoryName || '',
|
|
|
+ warehouseId: String(material.warehouseId || ''),
|
|
|
warehouseName: material.warehouseName || '',
|
|
|
availableQuantity: Number(material.availableQuantity) || 0,
|
|
|
orderQuantity: Number(material.orderQuantity) || 0,
|
|
@@ -1060,13 +1060,13 @@ export default {
|
|
|
prepareSalesOrderData(formData) {
|
|
|
// 转换物料明细数据为API所需格式
|
|
|
const pcBladeOrderItemList = this.materialDetails.map(material => ({
|
|
|
- itemId: Number(material.itemId) || 0,
|
|
|
+ itemId: String(material.itemId || ''),
|
|
|
itemCode: material.itemCode || '',
|
|
|
itemName: material.itemName || '',
|
|
|
specs: material.specs || '',
|
|
|
- mainItemCategoryId: Number(material.mainItemCategoryId) || Number(material.mainCategoryId) || 0,
|
|
|
- mainItemCategoryName: material.mainItemCategoryName || material.mainCategoryName || '',
|
|
|
- warehouseId: Number(material.warehouseId) || 0,
|
|
|
+ mainItemCategoryId: String(material.mainItemCategoryId || ''),
|
|
|
+ mainItemCategoryName: material.mainItemCategoryName || '',
|
|
|
+ warehouseId: String(material.warehouseId || ''),
|
|
|
warehouseName: material.warehouseName || '',
|
|
|
availableQuantity: Number(material.availableQuantity) || 0,
|
|
|
orderQuantity: Number(material.orderQuantity) || 0,
|
|
@@ -1081,9 +1081,9 @@ export default {
|
|
|
// 创建销售订单数据对象
|
|
|
const salesOrderData = {
|
|
|
...formData,
|
|
|
- id: formData.id ? Number(formData.id) : 0,
|
|
|
- orgId: formData.orgId ? Number(formData.orgId) : 0,
|
|
|
- customerId: formData.customerId ? Number(formData.customerId) : 0,
|
|
|
+ id: formData.id ? String(formData.id) : undefined,
|
|
|
+ orgId: (formData.orgId !== null && formData.orgId !== undefined && formData.orgId !== '') ? String(formData.orgId) : '',
|
|
|
+ customerId: (formData.customerId !== null && formData.customerId !== undefined && formData.customerId !== '') ? String(formData.customerId) : '',
|
|
|
orderType: Number(formData.orderType) || 0,
|
|
|
totalAmount: Number(formData.totalAmount) || 0,
|
|
|
totalQuantity: Number(formData.totalQuantity) || 0,
|
|
@@ -1114,13 +1114,13 @@ export default {
|
|
|
const pcBladeOrderItemList = this.materialDetails.map(material => ({
|
|
|
id: material.id ? material.id : undefined, // 保持为字符串类型
|
|
|
orderId: formData.id || '', // 保持为字符串类型,避免大整数精度丢失
|
|
|
- itemId: Number(material.itemId) || 0,
|
|
|
+ itemId: String(material.itemId || ''),
|
|
|
itemCode: material.itemCode || '',
|
|
|
itemName: material.itemName || '',
|
|
|
specs: material.specs || '',
|
|
|
- mainItemCategoryId: Number(material.mainItemCategoryId) || Number(material.mainCategoryId) || 0,
|
|
|
- mainItemCategoryName: material.mainItemCategoryName || material.mainCategoryName || '',
|
|
|
- warehouseId: Number(material.warehouseId) || 0,
|
|
|
+ mainItemCategoryId: String(material.mainItemCategoryId || ''),
|
|
|
+ mainItemCategoryName: material.mainItemCategoryName || '',
|
|
|
+ warehouseId: String(material.warehouseId || ''),
|
|
|
warehouseName: material.warehouseName || '',
|
|
|
availableQuantity: Number(material.availableQuantity) || 0,
|
|
|
orderQuantity: Number(material.orderQuantity) || 0,
|
|
@@ -1134,19 +1134,19 @@ export default {
|
|
|
|
|
|
// 创建销售订单更新数据对象
|
|
|
const salesOrderUpdateData = {
|
|
|
- id: formData.id, // 保持为字符串类型,避免大整数精度丢失
|
|
|
+ id: formData.id || '', // 保持为字符串类型,避免大整数精度丢失
|
|
|
orderCode: formData.orderCode || '',
|
|
|
- orgId: formData.orgId ? Number(formData.orgId) : 0,
|
|
|
+ orgId: (formData.orgId !== null && formData.orgId !== undefined && formData.orgId !== '') ? String(formData.orgId) : '',
|
|
|
orgCode: formData.orgCode || '',
|
|
|
orgName: formData.orgName || '',
|
|
|
- customerId: Number(formData.customerId) || 0,
|
|
|
+ customerId: (formData.customerId !== null && formData.customerId !== undefined && formData.customerId !== '') ? String(formData.customerId) : '',
|
|
|
customerCode: formData.customerCode || '',
|
|
|
customerName: formData.customerName || '',
|
|
|
orderType: Number(formData.orderType) || 0,
|
|
|
orderQuantity: Number(formData.orderQuantity) || 0,
|
|
|
totalAmount: Number(formData.totalAmount) || 0,
|
|
|
totalQuantity: Number(formData.totalQuantity) || 0,
|
|
|
- addressId: Number(formData.addressId) || 0,
|
|
|
+ addressId: formData.addressId ? String(formData.addressId) : '',
|
|
|
receiverName: formData.receiverName || '',
|
|
|
receiverPhone: formData.receiverPhone || '',
|
|
|
receiverRegion: formData.receiverRegion || '',
|
|
@@ -1252,8 +1252,8 @@ export default {
|
|
|
} else if (key === 'id' && this.isEdit) {
|
|
|
// 编辑模式下保持id字段为字符串类型,避免大整数精度丢失
|
|
|
cleanedData[key] = String(value)
|
|
|
- } else if (key === 'addressId') {
|
|
|
- // 地址ID保持为字符串类型,确保与地址选择组件的类型一致
|
|
|
+ } else if (['orgId', 'customerId', 'addressId'].includes(key)) {
|
|
|
+ // 统一将所有ID类型字段以字符串传输,避免精度丢失
|
|
|
cleanedData[key] = String(value)
|
|
|
} else {
|
|
|
cleanedData[key] = value
|