From 4c8d18cc5ed8a7b0e220c91a858d16d0310896df Mon Sep 17 00:00:00 2001
From: zhangwencui <1064582902@qq.com>
Date: 星期一, 29 六月 2026 16:50:03 +0800
Subject: [PATCH] BOM新增修改删除功能开发、以及BOM结构的可编辑
---
src/pages/sales/salesAccount/detail.vue | 131 +++++++++++++++++++++++++++++++++++--------
1 files changed, 106 insertions(+), 25 deletions(-)
diff --git a/src/pages/sales/salesAccount/detail.vue b/src/pages/sales/salesAccount/detail.vue
index 6e7f811..4bd8721 100644
--- a/src/pages/sales/salesAccount/detail.vue
+++ b/src/pages/sales/salesAccount/detail.vue
@@ -25,14 +25,8 @@
placeholder="鐐瑰嚮閫夋嫨涓氬姟鍛�" />
<template #right>
<up-icon name="arrow-right"
- @click="showPicker = true"></up-icon>
+ @click=" showPicker = true"></up-icon>
</template>
- </up-form-item>
- <up-form-item label="瀹㈡埛鍚堝悓鍙�"
- prop="customerContractNo"
- required>
- <up-input v-model="form.customerContractNo"
- placeholder="璇疯緭鍏ュ鎴峰悎鍚屽彿" />
</up-form-item>
<up-form-item label="瀹㈡埛鍚嶇О"
prop="customerName"
@@ -62,6 +56,18 @@
<template #right>
<up-icon name="arrow-right"
@click="showDatePicker = true"></up-icon>
+ </template>
+ </up-form-item>
+ <up-form-item label="浜よ揣鏃ユ湡"
+ prop="deliveryDate"
+ required>
+ <up-input v-model="form.deliveryDate"
+ readonly
+ placeholder="鐐瑰嚮閫夋嫨鏃堕棿"
+ @click="showDeliveryDatePicker = true" />
+ <template #right>
+ <up-icon name="arrow-right"
+ @click="showDeliveryDatePicker = true"></up-icon>
</template>
</up-form-item>
<up-form-item label="浠樻鏂瑰紡"
@@ -95,6 +101,15 @@
v-model="pickerDateValue"
@confirm="onDateConfirm"
@cancel="showDatePicker = false"
+ mode="date" />
+ </up-popup>
+ <up-popup :show="showDeliveryDatePicker"
+ mode="bottom"
+ @close="showDeliveryDatePicker = false">
+ <up-datetime-picker :show="true"
+ v-model="deliveryDateValue"
+ @confirm="onDeliveryDateConfirm"
+ @cancel="showDeliveryDatePicker = false"
mode="date" />
</up-popup>
<!-- 瀹㈡埛閫夋嫨 -->
@@ -190,7 +205,7 @@
@click="openCategoryPicker(idx)" />
<template #right>
<up-icon name="arrow-right"
- @click="showCategoryPicker = true"></up-icon>
+ @click="openCategoryPicker(idx)"></up-icon>
</template>
</up-form-item>
<!-- 瑙勬牸鍨嬪彿 -->
@@ -203,7 +218,7 @@
@click="openSpecificationPicker(idx)" />
<template #right>
<up-icon name="arrow-right"
- @click="showSpecificationPicker = true"></up-icon>
+ @click="openSpecificationPicker(idx)"></up-icon>
</template>
</up-form-item>
<!-- 缁戝畾鏈哄櫒 -->
@@ -225,6 +240,23 @@
<up-input v-model="product.unit"
placeholder="璇疯緭鍏�" />
</up-form-item>
+ <up-form-item label="鏄惁鐢熶骇"
+ prop="isProduction"
+ required>
+ <u-radio-group v-model="product.isProduction"
+ :disabled="operationType === 'view'"
+ placement="row">
+ <u-radio :customStyle="{ marginRight: '40rpx' }"
+ :disabled="operationType === 'view'"
+ :name="true"
+ label="鏄�">
+ </u-radio>
+ <u-radio :disabled="operationType === 'view'"
+ :name="false"
+ label="鍚�">
+ </u-radio>
+ </u-radio-group>
+ </up-form-item>
<!-- 绋庣巼 -->
<up-form-item label="绋庣巼(%)"
prop="taxRate"
@@ -235,7 +267,7 @@
@click="openTaxRatePicker(idx)" />
<template #right>
<up-icon name="arrow-right"
- @click="showTaxRatePicker = true"></up-icon>
+ @click="openTaxRatePicker(idx)"></up-icon>
</template>
</up-form-item>
<!-- 鍚◣鍗曚环 -->
@@ -284,7 +316,7 @@
@click="openInvoiceTypePicker(idx)" />
<template #right>
<up-icon name="arrow-right"
- @click="showInvoiceTypePicker = true"></up-icon>
+ @click="openInvoiceTypePicker(idx)"></up-icon>
</template>
</up-form-item>
</view>
@@ -325,11 +357,11 @@
const form = ref({
id: "",
salesContractNo: "",
- customerContractNo: "",
customerId: "",
customerName: "",
projectName: "",
executionDate: "",
+ deliveryDate: "",
paymentMethod: "",
entryPerson: "",
entryPersonName: "",
@@ -338,6 +370,8 @@
const showPicker = ref(false);
const showDatePicker = ref(false);
const pickerDateValue = ref(Date.now());
+ const showDeliveryDatePicker = ref(false);
+ const deliveryDateValue = ref(Date.now());
const showCustomerPicker = ref(false);
const userList = ref([]);
const customerOption = ref([]);
@@ -448,15 +482,15 @@
// 琛ㄥ崟鏍¢獙瑙勫垯
const rules = {
salesman: [{ required: true, message: "璇烽�夋嫨涓氬姟鍛�", trigger: "change" }],
- customerContractNo: [
- { required: true, message: "璇疯緭鍏ュ鎴峰悎鍚屽彿", trigger: "blur" },
- ],
customerName: [
{ required: true, message: "璇烽�夋嫨瀹㈡埛鍚嶇О", trigger: "change" },
],
projectName: [{ required: true, message: "璇疯緭鍏ラ」鐩悕绉�", trigger: "blur" }],
executionDate: [
{ required: true, message: "璇烽�夋嫨绛捐鏃ユ湡", trigger: "change" },
+ ],
+ deliveryDate: [
+ { required: true, message: "璇烽�夋嫨浜よ揣鏃ユ湡", trigger: "change" },
],
};
@@ -469,6 +503,7 @@
specificationModel: "",
productModelId: "",
unit: "",
+ isProduction: true,
speculativeTradingName: "",
taxRate: "",
taxInclusiveUnitPrice: "",
@@ -489,6 +524,11 @@
// 淇濇寔pickerDateValue涓烘椂闂存埑鏍煎紡锛岃�屼笉鏄牸寮忓寲鐨勫瓧绗︿覆
pickerDateValue.value = e.value;
showDatePicker.value = false;
+ };
+ const onDeliveryDateConfirm = e => {
+ form.value.deliveryDate = formatDateToYMD(e.value);
+ deliveryDateValue.value = e.value;
+ showDeliveryDatePicker.value = false;
};
// 瀹㈡埛閫夋嫨浜嬩欢
@@ -766,6 +806,23 @@
});
return;
}
+ const rawIsProduction = product.isProduction;
+ const normalizedIsProduction =
+ rawIsProduction === true || rawIsProduction === false
+ ? rawIsProduction
+ : rawIsProduction === 1 || rawIsProduction === 0
+ ? Boolean(rawIsProduction)
+ : rawIsProduction === "1" || rawIsProduction === "0"
+ ? rawIsProduction === "1"
+ : null;
+ if (normalizedIsProduction === null) {
+ uni.showToast({
+ title: `浜у搧${i + 1}锛氳閫夋嫨鏄惁鐢熶骇`,
+ icon: "none",
+ });
+ return;
+ }
+ product.isProduction = normalizedIsProduction;
if (!product.taxRate) {
uni.showToast({
title: `浜у搧${i + 1}锛氳閫夋嫨绋庣巼`,
@@ -825,27 +882,42 @@
form.value.entryPerson = userStore.id;
form.value.entryPersonName = userStore.nickName;
// 璁剧疆褰撳ぉ鏃ユ湡
- const today = new Date();
- const year = today.getFullYear();
- const month = String(today.getMonth() + 1).padStart(2, "0");
- const day = String(today.getDate()).padStart(2, "0");
- form.value.entryDate = `${year}-${month}-${day}`;
- // 璁剧疆鏃ユ湡閫夋嫨鍣ㄩ粯璁ゅ�间负浠婂ぉ
- pickerDateValue.value = `${year}-${month}-${day}`;
+ const now = new Date();
+ const year = now.getFullYear();
+ const month = String(now.getMonth() + 1).padStart(2, "0");
+ const day = String(now.getDate()).padStart(2, "0");
+ const todayStr = `${year}-${month}-${day}`;
+ form.value.entryDate = todayStr;
+ form.value.executionDate = todayStr;
+ form.value.deliveryDate = todayStr;
+ pickerDateValue.value = now.getTime();
+ deliveryDateValue.value = now.getTime();
};
// 濉厖琛ㄥ崟鏁版嵁锛堢紪杈戞ā寮忥級
const fillFormData = () => {
if (!editData.value) return;
getSalesLedgerWithProducts({ id: editData.value.id, type: 1 }).then(res => {
- productData.value = res.productData;
+ const list = Array.isArray(res?.productData) ? res.productData : [];
+ productData.value = list.map(item => {
+ const raw = item?.isProduction;
+ const normalized =
+ raw === true || raw === false
+ ? raw
+ : raw === 1 || raw === 0
+ ? Boolean(raw)
+ : raw === "1" || raw === "0"
+ ? raw === "1"
+ : true;
+ return { ...item, isProduction: normalized };
+ });
});
console.log(editData.value);
// 濉厖鍩烘湰淇℃伅
form.value.salesContractNo = editData.value.salesContractNo || "";
- form.value.customerContractNo = editData.value.customerContractNo || "";
form.value.customerName = editData.value.customerName || "";
form.value.projectName = editData.value.projectName || "";
form.value.executionDate = editData.value.executionDate || "";
+ form.value.deliveryDate = editData.value.deliveryDate || "";
form.value.paymentMethod = editData.value.paymentMethod || "";
form.value.salesman = editData.value.salesman || "";
form.value.entryPerson = editData.value.entryPerson || "";
@@ -856,7 +928,16 @@
// 璁剧疆鏃ユ湡閫夋嫨鍣ㄧ殑鍊�
if (editData.value.executionDate) {
- pickerDateValue.value = editData.value.executionDate;
+ const ts = new Date(
+ String(editData.value.executionDate).replace(/-/g, "/")
+ ).getTime();
+ pickerDateValue.value = Number.isFinite(ts) ? ts : Date.now();
+ }
+ if (editData.value.deliveryDate) {
+ const ts = new Date(
+ String(editData.value.deliveryDate).replace(/-/g, "/")
+ ).getTime();
+ deliveryDateValue.value = Number.isFinite(ts) ? ts : Date.now();
}
};
const getUserList = () => {
--
Gitblit v1.9.3