From 58243a2254afce0cc0fcc7e31f927b9c94a80687 Mon Sep 17 00:00:00 2001
From: zhangwencui <1064582902@qq.com>
Date: 星期一, 29 六月 2026 14:20:59 +0800
Subject: [PATCH] 销售台账新增交货日期和生产状态管理功能
---
src/pages/sales/salesAccount/view.vue | 15 +++++
src/pages/sales/salesAccount/detail.vue | 110 +++++++++++++++++++++++++++++++++---
src/pages/sales/salesAccount/index.vue | 4 +
src/pages/sales/salesAccount/out.vue | 19 ++++++
4 files changed, 139 insertions(+), 9 deletions(-)
diff --git a/src/pages/sales/salesAccount/detail.vue b/src/pages/sales/salesAccount/detail.vue
index f8a42ab..4bd8721 100644
--- a/src/pages/sales/salesAccount/detail.vue
+++ b/src/pages/sales/salesAccount/detail.vue
@@ -58,6 +58,18 @@
@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="浠樻鏂瑰紡"
prop="paymentMethod">
<up-input v-model="form.paymentMethod"
@@ -89,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>
<!-- 瀹㈡埛閫夋嫨 -->
@@ -219,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"
@@ -323,6 +361,7 @@
customerName: "",
projectName: "",
executionDate: "",
+ deliveryDate: "",
paymentMethod: "",
entryPerson: "",
entryPersonName: "",
@@ -331,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,6 +489,9 @@
executionDate: [
{ required: true, message: "璇烽�夋嫨绛捐鏃ユ湡", trigger: "change" },
],
+ deliveryDate: [
+ { required: true, message: "璇烽�夋嫨浜よ揣鏃ユ湡", trigger: "change" },
+ ],
};
const addProduct = () => {
@@ -459,6 +503,7 @@
specificationModel: "",
productModelId: "",
unit: "",
+ isProduction: true,
speculativeTradingName: "",
taxRate: "",
taxInclusiveUnitPrice: "",
@@ -479,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;
};
// 瀹㈡埛閫夋嫨浜嬩欢
@@ -756,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}锛氳閫夋嫨绋庣巼`,
@@ -815,19 +882,34 @@
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);
// 濉厖鍩烘湰淇℃伅
@@ -835,6 +917,7 @@
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 || "";
@@ -845,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 = () => {
diff --git a/src/pages/sales/salesAccount/index.vue b/src/pages/sales/salesAccount/index.vue
index 74b906a..672926b 100644
--- a/src/pages/sales/salesAccount/index.vue
+++ b/src/pages/sales/salesAccount/index.vue
@@ -66,6 +66,10 @@
<text class="detail-label">绛捐鏃ユ湡</text>
<text class="detail-value">{{ item.executionDate }}</text>
</view>
+ <view class="detail-row">
+ <text class="detail-label">浜よ揣鏃ユ湡</text>
+ <text class="detail-value">{{ item.deliveryDate || "-" }}</text>
+ </view>
<up-divider></up-divider>
<view class="detail-info">
<view class="detail-row">
diff --git a/src/pages/sales/salesAccount/out.vue b/src/pages/sales/salesAccount/out.vue
index d4fc5be..43ac38d 100644
--- a/src/pages/sales/salesAccount/out.vue
+++ b/src/pages/sales/salesAccount/out.vue
@@ -56,6 +56,11 @@
class="detail-value danger">涓嶈冻</text>
</view>
<view class="detail-row">
+ <text class="detail-label">鏄惁鐢熶骇</text>
+ <u-tag size="mini"
+ :type="getIsProductionType(item)">{{ getIsProductionText(item) }}</u-tag>
+ </view>
+ <view class="detail-row">
<text class="detail-label">鍙戣揣鐘舵��</text>
<u-tag size="mini"
:type="getShippingStatusType(item)">{{ getShippingStatusText(item) }}</u-tag>
@@ -186,6 +191,20 @@
};
return statusTextMap[statusStr] || "寰呭彂璐�";
};
+
+ const getIsProductionText = row => {
+ const v = row?.isProduction;
+ if (v === true || v === 1 || v === "1") return "鏄�";
+ if (v === false || v === 0 || v === "0") return "鍚�";
+ return "-";
+ };
+
+ const getIsProductionType = row => {
+ const v = row?.isProduction;
+ if (v === true || v === 1 || v === "1") return "success";
+ if (v === false || v === 0 || v === "0") return "info";
+ return "info";
+ };
// 鑾峰彇椤甸潰鍙傛暟
const getPageParams = () => {
// 浠庢湰鍦板瓨鍌ㄨ幏鍙栦緵搴斿晢ID
diff --git a/src/pages/sales/salesAccount/view.vue b/src/pages/sales/salesAccount/view.vue
index 53ffab5..e30831e 100644
--- a/src/pages/sales/salesAccount/view.vue
+++ b/src/pages/sales/salesAccount/view.vue
@@ -28,6 +28,10 @@
<text class="info-value">{{ form.executionDate }}</text>
</view>
<view class="info-item">
+ <text class="info-label">浜よ揣鏃ユ湡</text>
+ <text class="info-value">{{ form.deliveryDate || '-' }}</text>
+ </view>
+ <view class="info-item">
<text class="info-label">浠樻鏂瑰紡</text>
<text class="info-value">{{ form.paymentMethod }}</text>
</view>
@@ -74,6 +78,10 @@
<view class="info-item">
<text class="info-label">鍗曚綅</text>
<text class="info-value">{{ product.unit }}</text>
+ </view>
+ <view class="info-item">
+ <text class="info-label">鏄惁鐢熶骇</text>
+ <text class="info-value">{{ formatIsProduction(product.isProduction) }}</text>
</view>
<view class="info-item">
<text class="info-label">绋庣巼(%)</text>
@@ -125,6 +133,7 @@
customerName: "",
projectName: "",
executionDate: "",
+ deliveryDate: "",
paymentMethod: "",
entryPerson: "",
entryPersonName: "",
@@ -153,6 +162,12 @@
});
};
+ const formatIsProduction = value => {
+ if (value === true || value === 1 || value === "1") return "鏄�";
+ if (value === false || value === 0 || value === "0") return "鍚�";
+ return "-";
+ };
+
onMounted(() => {
// 鑾峰彇缂栬緫鏁版嵁骞跺~鍏呰〃鍗�
const editDataStr = uni.getStorageSync("editData");
--
Gitblit v1.9.3