|
@@ -77,7 +77,7 @@
|
|
|
:disabled="!isInitiateOrFieldEditable('contract_money')"
|
|
:disabled="!isInitiateOrFieldEditable('contract_money')"
|
|
|
type="digit"
|
|
type="digit"
|
|
|
placeholder="请输入合同金额"
|
|
placeholder="请输入合同金额"
|
|
|
- @input="onContractMoneyChange"></uni-easyinput>
|
|
|
|
|
|
|
+ @blur="onContractMoneyBlur"></uni-easyinput>
|
|
|
</uni-forms-item>
|
|
</uni-forms-item>
|
|
|
<uni-forms-item name="contractContent" label="合同内容">
|
|
<uni-forms-item name="contractContent" label="合同内容">
|
|
|
<uni-easyinput v-if="isInitiateOrFieldEditable('contractContent')"
|
|
<uni-easyinput v-if="isInitiateOrFieldEditable('contractContent')"
|
|
@@ -378,7 +378,7 @@
|
|
|
<uni-section titleFontSize="1.3rem" title="付款明细" type="line"></uni-section>
|
|
<uni-section titleFontSize="1.3rem" title="付款明细" type="line"></uni-section>
|
|
|
<!-- 添加付款按钮:发起环节或字段可编辑时显示 -->
|
|
<!-- 添加付款按钮:发起环节或字段可编辑时显示 -->
|
|
|
<view v-if="isSeModel" class="payment-actions">
|
|
<view v-if="isSeModel" class="payment-actions">
|
|
|
- <button type="primary" size="mini" @click="addPayment" :disabled="materialList.length === 0" plain>添加付款</button>
|
|
|
|
|
|
|
+ <button type="primary" size="mini" @click="addPayment" :disabled="!canAddPayment" plain>添加付款</button>
|
|
|
</view>
|
|
</view>
|
|
|
<!-- 付款列表 - 卡片式展示 -->
|
|
<!-- 付款列表 - 卡片式展示 -->
|
|
|
<view v-if="paymentList.length > 0" class="payment-list">
|
|
<view v-if="paymentList.length > 0" class="payment-list">
|
|
@@ -469,7 +469,8 @@
|
|
|
</view>
|
|
</view>
|
|
|
|
|
|
|
|
<view v-else-if="paymentList.length === 0" class="empty-payments">
|
|
<view v-else-if="paymentList.length === 0" class="empty-payments">
|
|
|
- <text>暂无付款明细</text>
|
|
|
|
|
|
|
+ <text v-if="!canAddPayment">请先输入合同金额</text>
|
|
|
|
|
+ <text v-else>暂无付款明细</text>
|
|
|
</view>
|
|
</view>
|
|
|
</uni-card>
|
|
</uni-card>
|
|
|
|
|
|
|
@@ -1512,7 +1513,7 @@ function calculateTotalPrice() {
|
|
|
// 保留用户手动输入的较大值
|
|
// 保留用户手动输入的较大值
|
|
|
// 不更新合同金额
|
|
// 不更新合同金额
|
|
|
} else {
|
|
} else {
|
|
|
- // 自动更新为物料总额
|
|
|
|
|
|
|
+ // 自动更新为物料总额(包括非手动输入,或手动输入但物料总额更大的情况)
|
|
|
baseForm.value.contract_money = total.toFixed(2)
|
|
baseForm.value.contract_money = total.toFixed(2)
|
|
|
// 重置手动输入标记
|
|
// 重置手动输入标记
|
|
|
manualInput = false
|
|
manualInput = false
|
|
@@ -1521,6 +1522,8 @@ function calculateTotalPrice() {
|
|
|
// 没有物料时,只有非手动输入才清空
|
|
// 没有物料时,只有非手动输入才清空
|
|
|
if (!manualInput) {
|
|
if (!manualInput) {
|
|
|
baseForm.value.contract_money = ''
|
|
baseForm.value.contract_money = ''
|
|
|
|
|
+ // 合同金额被清空时,删除所有付款信息
|
|
|
|
|
+ clearAllPaymentInfo()
|
|
|
}
|
|
}
|
|
|
// 注意:如果是手动输入,即使没有物料也保留用户输入
|
|
// 注意:如果是手动输入,即使没有物料也保留用户输入
|
|
|
}
|
|
}
|
|
@@ -1540,8 +1543,8 @@ function calculateTotalPriceValue(): number {
|
|
|
return total
|
|
return total
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-// 监听合同金额变化(检测用户手动输入)
|
|
|
|
|
-function onContractMoneyChange() {
|
|
|
|
|
|
|
+// 监听合同金额变化(检测用户手动输入)- 失焦时触发
|
|
|
|
|
+function onContractMoneyBlur() {
|
|
|
// 当用户手动修改合同金额时,设置手动输入标记
|
|
// 当用户手动修改合同金额时,设置手动输入标记
|
|
|
const calculatedTotal = calculateTotalPriceValue()
|
|
const calculatedTotal = calculateTotalPriceValue()
|
|
|
const currentMoney = parseFloat(baseForm.value.contract_money)
|
|
const currentMoney = parseFloat(baseForm.value.contract_money)
|
|
@@ -1571,8 +1574,19 @@ function onCessBlur(item: any) {
|
|
|
calculateMaterialPrice(item)
|
|
calculateMaterialPrice(item)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+// 判断是否可以添加付款(有合同金额即可)
|
|
|
|
|
+const canAddPayment = computed(() => {
|
|
|
|
|
+ const contractMoney = parseFloat(baseForm.value.contract_money) || 0
|
|
|
|
|
+ return contractMoney > 0
|
|
|
|
|
+})
|
|
|
|
|
+
|
|
|
// 添加付款
|
|
// 添加付款
|
|
|
function addPayment() {
|
|
function addPayment() {
|
|
|
|
|
+ if (!canAddPayment.value) {
|
|
|
|
|
+ $modal.msgWarn('请先输入合同金额')
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
paymentList.value.push({
|
|
paymentList.value.push({
|
|
|
payType: '',
|
|
payType: '',
|
|
|
payTypeName: '',
|
|
payTypeName: '',
|
|
@@ -1677,6 +1691,11 @@ function getPayStatusName(item: any): string {
|
|
|
return '未支付'
|
|
return '未支付'
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+// 清空所有付款信息
|
|
|
|
|
+function clearAllPaymentInfo() {
|
|
|
|
|
+ paymentList.value = []
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
// 删除付款
|
|
// 删除付款
|
|
|
function removePayment(index: number) {
|
|
function removePayment(index: number) {
|
|
|
$modal.confirm('', '确定删除该付款明细?')
|
|
$modal.confirm('', '确定删除该付款明细?')
|