<template>
|
<view class="account-detail">
|
<PageHeader title="新增采购退货"
|
@back="goBack" />
|
<up-form ref="formRef"
|
:model="form"
|
:rules="rules"
|
label-width="110">
|
<up-form-item label="退料单号"
|
prop="no">
|
<up-input v-model="form.no"
|
:disabled="form.isDefaultNo"
|
:placeholder="form.isDefaultNo ? '使用系统编号' : '请输入退料单号'"
|
clearable />
|
<template #right>
|
<up-switch v-model="form.isDefaultNo"
|
@change="onDefaultNoChange" />
|
</template>
|
</up-form-item>
|
<up-form-item label="退货方式"
|
prop="returnType"
|
required>
|
<up-input v-model="returnTypeText"
|
placeholder="请选择"
|
readonly
|
@click="showReturnTypeSheet = true" />
|
<template #right>
|
<up-icon name="arrow-right"
|
@click="showReturnTypeSheet = true"></up-icon>
|
</template>
|
</up-form-item>
|
<up-form-item label="供应商"
|
prop="supplierName"
|
required>
|
<up-input v-model="form.supplierName"
|
placeholder="请选择"
|
readonly
|
@click="showSupplierSheet = true" />
|
<template #right>
|
<up-icon name="arrow-right"
|
@click="showSupplierSheet = true"></up-icon>
|
</template>
|
</up-form-item>
|
<up-form-item label="项目阶段"
|
prop="projectPhase">
|
<up-input v-model="projectPhaseText"
|
placeholder="请选择"
|
readonly
|
@click="showProjectPhaseSheet = true" />
|
<template #right>
|
<up-icon name="arrow-right"
|
@click="showProjectPhaseSheet = true"></up-icon>
|
</template>
|
</up-form-item>
|
<up-form-item label="制作日期"
|
prop="preparedAt"
|
required>
|
<up-input v-model="form.preparedAt"
|
placeholder="请选择"
|
readonly
|
@click="showPreparedAtPicker = true" />
|
<template #right>
|
<up-icon name="arrow-right"
|
@click="showPreparedAtPicker = true"></up-icon>
|
</template>
|
</up-form-item>
|
<up-form-item label="制单人"
|
prop="preparedUserName"
|
required>
|
<up-input v-model="form.preparedUserName"
|
placeholder="请选择"
|
readonly
|
@click="openPreparedUserSheet" />
|
<template #right>
|
<up-icon name="arrow-right"
|
@click="openPreparedUserSheet"></up-icon>
|
</template>
|
</up-form-item>
|
<up-form-item label="退料人"
|
prop="returnUserName"
|
required>
|
<up-input v-model="form.returnUserName"
|
placeholder="请选择"
|
readonly
|
@click="openReturnUserSheet" />
|
<template #right>
|
<up-icon name="arrow-right"
|
@click="openReturnUserSheet"></up-icon>
|
</template>
|
</up-form-item>
|
<up-form-item label="采购合同号"
|
prop="purchaseContractNumber"
|
required>
|
<up-input v-model="form.purchaseContractNumber"
|
placeholder="请选择"
|
readonly
|
@click="showPurchaseLedgerSheet = true" />
|
<template #right>
|
<up-icon name="arrow-right"
|
@click="showPurchaseLedgerSheet = true"></up-icon>
|
</template>
|
</up-form-item>
|
<up-form-item label="备注"
|
prop="remark">
|
<up-textarea v-model="form.remark"
|
placeholder="请输入备注"
|
auto-height />
|
</up-form-item>
|
|
<view class="product-section">
|
<view class="section-header">
|
<view>
|
<text class="section-title">产品信息</text>
|
</view>
|
<view class="section-actions">
|
<text class="amount-text">合计:{{ formatAmount(baseAmount) }}</text>
|
<up-button type="primary"
|
size="small"
|
class="add-btn"
|
:disabled="!form.purchaseLedgerId"
|
@click="goSelectProducts">
|
选择产品
|
</up-button>
|
</view>
|
</view>
|
<view v-if="form.purchaseReturnOrderProductsDtos.length === 0"
|
class="empty-products">
|
<text>暂无产品,请先选择产品</text>
|
</view>
|
<view v-else>
|
<view class="product-card"
|
v-for="(item, index) in form.purchaseReturnOrderProductsDtos"
|
:key="item.id || index">
|
<view class="product-header">
|
<view class="product-title">
|
<up-icon name="file-text"
|
size="16"
|
color="#2979ff"></up-icon>
|
<text class="product-productCategory">产品 {{ index + 1 }}</text>
|
</view>
|
<view>
|
<up-button type="error"
|
size="mini"
|
class="del-btn"
|
@click="removeProduct(index)">
|
删除
|
</up-button>
|
</view>
|
</view>
|
<view class="product-form">
|
<up-form-item label="产品大类">
|
<up-input :modelValue="item.productCategory || '-'"
|
disabled />
|
</up-form-item>
|
<up-form-item label="规格型号">
|
<up-input :modelValue="item.specificationModel || '-'"
|
disabled />
|
</up-form-item>
|
<up-form-item label="入库数量">
|
<up-input :modelValue="String(item.stockInNum ?? item.quantity ?? '-')"
|
disabled />
|
</up-form-item>
|
<up-form-item label="可退货数量">
|
<up-input :modelValue="String(item.unQuantity ?? '-')"
|
disabled />
|
</up-form-item>
|
<up-form-item label="含税单价(元)">
|
<up-input :modelValue="formatAmount(item.taxInclusiveUnitPrice)"
|
disabled />
|
</up-form-item>
|
<up-form-item label="退货数量">
|
<up-number-box v-model="item.returnQuantity"
|
:min="0"
|
:max="getReturnQtyMax(item)"
|
:step="1"
|
@change="syncRowTotal(item)" />
|
</up-form-item>
|
<up-form-item label="退货总价(元)">
|
<up-input :modelValue="formatAmount(item.taxInclusiveTotalPrice)"
|
disabled />
|
</up-form-item>
|
</view>
|
</view>
|
</view>
|
</view>
|
|
<up-form-item label="整单折扣额"
|
prop="totalDiscountAmount">
|
<up-input v-model="form.totalDiscountAmount"
|
type="number"
|
placeholder="请输入"
|
@blur="onDiscountAmountBlur"
|
clearable />
|
</up-form-item>
|
<up-form-item label="整单折扣率(%)"
|
prop="totalDiscountRate">
|
<up-input v-model="form.totalDiscountRate"
|
type="number"
|
placeholder="请输入"
|
@blur="onDiscountRateBlur"
|
clearable />
|
</up-form-item>
|
<up-form-item label="成交金额"
|
prop="totalAmount"
|
required>
|
<up-input v-model="form.totalAmount"
|
disabled
|
placeholder="自动计算" />
|
</up-form-item>
|
<up-form-item label="收款方式"
|
prop="incomeType"
|
required>
|
<up-input v-model="incomeTypeText"
|
placeholder="请选择"
|
readonly
|
@click="showIncomeTypeSheet = true" />
|
<template #right>
|
<up-icon name="arrow-right"
|
@click="showIncomeTypeSheet = true"></up-icon>
|
</template>
|
</up-form-item>
|
</up-form>
|
<FooterButtons :loading="loading"
|
confirmText="提交"
|
@cancel="goBack"
|
@confirm="handleSubmit" />
|
<up-action-sheet :show="showReturnTypeSheet"
|
title="选择退货方式"
|
:actions="returnTypeActions"
|
@select="onSelectReturnType"
|
@close="showReturnTypeSheet = false" />
|
<up-action-sheet :show="showProjectPhaseSheet"
|
title="选择项目阶段"
|
:actions="projectPhaseActions"
|
@select="onSelectProjectPhase"
|
@close="showProjectPhaseSheet = false" />
|
<up-action-sheet :show="showSupplierSheet"
|
title="选择供应商"
|
:actions="supplierActions"
|
@select="onSelectSupplier"
|
@close="showSupplierSheet = false" />
|
<up-action-sheet :show="showPreparedUserSheet"
|
title="选择制单人"
|
:actions="userActions"
|
@select="onSelectPreparedUser"
|
@close="showPreparedUserSheet = false" />
|
<up-action-sheet :show="showReturnUserSheet"
|
title="选择退料人"
|
:actions="userActions"
|
@select="onSelectReturnUser"
|
@close="showReturnUserSheet = false" />
|
<up-action-sheet :show="showPurchaseLedgerSheet"
|
title="选择采购合同号"
|
:actions="purchaseLedgerActions"
|
@select="onSelectPurchaseLedger"
|
@close="showPurchaseLedgerSheet = false" />
|
<up-action-sheet :show="showIncomeTypeSheet"
|
title="选择收款方式"
|
:actions="incomeTypeActions"
|
@select="onSelectIncomeType"
|
@close="showIncomeTypeSheet = false" />
|
<up-datetime-picker :show="showPreparedAtPicker"
|
v-model="preparedAtPickerValue"
|
mode="date"
|
@confirm="onPreparedAtConfirm"
|
@cancel="showPreparedAtPicker = false" />
|
</view>
|
</template>
|
|
<script setup>
|
import { computed, onMounted, ref, watch } from "vue";
|
import { onShow } from "@dcloudio/uni-app";
|
import FooterButtons from "@/components/FooterButtons.vue";
|
import { formatDateToYMD } from "@/utils/ruoyi";
|
import { createPurchaseReturnOrder } from "@/api/procurementManagement/purchaseReturnOrder";
|
import {
|
getOptions,
|
purchaseList,
|
} from "@/api/procurementManagement/procurementLedger";
|
import { userListNoPage, userListNoPageByTenantId } from "@/api/system/user";
|
|
const formRef = ref();
|
const loading = ref(false);
|
|
const form = ref({
|
no: "",
|
isDefaultNo: true,
|
returnType: 0,
|
supplierId: undefined,
|
supplierName: "",
|
projectPhase: undefined,
|
preparedAt: "",
|
preparedUserId: undefined,
|
preparedUserName: "",
|
returnUserId: undefined,
|
returnUserName: "",
|
purchaseLedgerId: undefined,
|
purchaseContractNumber: "",
|
remark: "",
|
totalDiscountAmount: 0,
|
totalDiscountRate: "",
|
totalAmount: 0,
|
incomeType: undefined,
|
purchaseReturnOrderProductsDtos: [],
|
});
|
|
const rules = {
|
returnType: [
|
{
|
validator: (_rule, value, callback) => {
|
if (
|
value === 0 ||
|
value === 1 ||
|
String(value) === "0" ||
|
String(value) === "1"
|
) {
|
callback();
|
return;
|
}
|
callback(new Error("请选择退货方式"));
|
},
|
trigger: ["change", "blur"],
|
},
|
],
|
supplierName: [
|
{
|
validator: (_rule, value, callback) => {
|
if (value === null || value === undefined) {
|
callback(new Error("请选择供应商"));
|
return;
|
}
|
if (String(value).trim() === "") {
|
callback(new Error("请选择供应商"));
|
return;
|
}
|
callback();
|
},
|
trigger: ["change", "blur"],
|
},
|
],
|
preparedAt: [
|
{ required: true, message: "请选择制作日期", trigger: "change" },
|
],
|
preparedUserName: [
|
{
|
validator: (_rule, value, callback) => {
|
if (value === null || value === undefined) {
|
callback(new Error("请选择制单人"));
|
return;
|
}
|
if (String(value).trim() === "") {
|
callback(new Error("请选择制单人"));
|
return;
|
}
|
callback();
|
},
|
trigger: ["change", "blur"],
|
},
|
],
|
returnUserName: [
|
{
|
validator: (_rule, value, callback) => {
|
if (value === null || value === undefined) {
|
callback(new Error("请选择退料人"));
|
return;
|
}
|
if (String(value).trim() === "") {
|
callback(new Error("请选择退料人"));
|
return;
|
}
|
callback();
|
},
|
trigger: ["change", "blur"],
|
},
|
],
|
purchaseContractNumber: [
|
{
|
validator: (_rule, value, callback) => {
|
if (value === null || value === undefined) {
|
callback(new Error("请选择采购合同号"));
|
return;
|
}
|
if (String(value).trim() === "") {
|
callback(new Error("请选择采购合同号"));
|
return;
|
}
|
callback();
|
},
|
trigger: ["change", "blur"],
|
},
|
],
|
totalAmount: [
|
{
|
validator: (_rule, value, callback) => {
|
if (value === null || value === undefined || value === "") {
|
callback(new Error("成交金额不能为空"));
|
return;
|
}
|
const num = Number(value);
|
if (Number.isNaN(num)) {
|
callback(new Error("成交金额格式不正确"));
|
return;
|
}
|
callback();
|
},
|
trigger: ["change", "blur"],
|
},
|
],
|
incomeType: [
|
{ required: true, message: "请选择收款方式", trigger: "change" },
|
],
|
};
|
|
const showReturnTypeSheet = ref(false);
|
const showProjectPhaseSheet = ref(false);
|
const showSupplierSheet = ref(false);
|
const showPreparedUserSheet = ref(false);
|
const showReturnUserSheet = ref(false);
|
const showPurchaseLedgerSheet = ref(false);
|
const showIncomeTypeSheet = ref(false);
|
const showPreparedAtPicker = ref(false);
|
const preparedAtPickerValue = ref(Date.now());
|
|
const supplierOptions = ref([]);
|
const userOptions = ref([]);
|
const purchaseLedgerOptions = ref([]);
|
|
const returnTypeActions = [
|
{ name: "退货退款", value: 0 },
|
{ name: "拒收", value: 1 },
|
];
|
const projectPhaseActions = [
|
{ name: "立项", value: 0 },
|
{ name: "设计", value: 1 },
|
{ name: "采购", value: 2 },
|
{ name: "生产", value: 3 },
|
{ name: "出货", value: 4 },
|
];
|
const incomeTypeActions = [
|
{ name: "现金", value: "0" },
|
{ name: "支票", value: "1" },
|
{ name: "银行转账", value: "2" },
|
{ name: "其他", value: "3" },
|
];
|
|
const returnTypeText = computed(() => {
|
return (
|
returnTypeActions.find(
|
i => String(i.value) === String(form.value.returnType)
|
)?.name || ""
|
);
|
});
|
const projectPhaseText = computed(() => {
|
return (
|
projectPhaseActions.find(
|
i => String(i.value) === String(form.value.projectPhase)
|
)?.name || ""
|
);
|
});
|
const supplierText = computed(() => {
|
return (
|
supplierOptions.value.find(
|
i => String(i.id) === String(form.value.supplierId)
|
)?.supplierName || ""
|
);
|
});
|
const preparedUserText = computed(() => {
|
return (
|
userOptions.value.find(
|
i => String(i.userId) === String(form.value.preparedUserId)
|
)?.nickName || ""
|
);
|
});
|
const returnUserText = computed(() => {
|
return (
|
userOptions.value.find(
|
i => String(i.userId) === String(form.value.returnUserId)
|
)?.nickName || ""
|
);
|
});
|
const purchaseContractText = computed(() => {
|
return (
|
purchaseLedgerOptions.value.find(
|
i => String(i.id) === String(form.value.purchaseLedgerId)
|
)?.purchaseContractNumber || ""
|
);
|
});
|
const incomeTypeText = computed(() => {
|
return (
|
incomeTypeActions.find(
|
i => String(i.value) === String(form.value.incomeType)
|
)?.name || ""
|
);
|
});
|
|
const supplierActions = computed(() => {
|
return supplierOptions.value.map(i => ({
|
name: i.supplierName,
|
value: i.id,
|
}));
|
});
|
const userActions = computed(() => {
|
return userOptions.value.map(i => ({ name: i.nickName, value: i.userId }));
|
});
|
const purchaseLedgerActions = computed(() => {
|
return purchaseLedgerOptions.value.map(i => ({
|
name: i.purchaseContractNumber,
|
value: i.id,
|
}));
|
});
|
|
const toNumber = val => {
|
const num = Number(val);
|
return Number.isNaN(num) ? 0 : num;
|
};
|
|
const formatAmount = value => {
|
if (value === null || value === undefined || value === "") return "0.00";
|
const num = Number(value);
|
if (Number.isNaN(num)) return "0.00";
|
return num.toFixed(2);
|
};
|
|
const baseAmount = computed(() => {
|
const rows = form.value.purchaseReturnOrderProductsDtos || [];
|
return rows.reduce(
|
(sum, item) => sum + toNumber(item.taxInclusiveTotalPrice),
|
0
|
);
|
});
|
|
const syncTotalAmount = () => {
|
const total = baseAmount.value - toNumber(form.value.totalDiscountAmount);
|
form.value.totalAmount = Number(total.toFixed(2));
|
};
|
|
const getReturnQtyMax = row => {
|
const qty = Number(row?.unQuantity ?? row?.quantity);
|
if (Number.isNaN(qty) || qty < 0) return 0;
|
return qty;
|
};
|
|
const syncRowTotal = row => {
|
if (!row) return;
|
const qty = toNumber(row.returnQuantity);
|
const unitPrice = toNumber(row.taxInclusiveUnitPrice);
|
row.taxInclusiveTotalPrice = Number((qty * unitPrice).toFixed(2));
|
syncTotalAmount();
|
};
|
|
const removeProduct = index => {
|
form.value.purchaseReturnOrderProductsDtos.splice(index, 1);
|
syncTotalAmount();
|
};
|
|
const resetFeeInfo = () => {
|
form.value.totalDiscountAmount = 0;
|
form.value.totalDiscountRate = "";
|
form.value.totalAmount = 0;
|
form.value.incomeType = undefined;
|
};
|
|
const onDefaultNoChange = checked => {
|
if (checked) form.value.no = "";
|
};
|
|
const onSelectReturnType = action => {
|
form.value.returnType = action.value;
|
showReturnTypeSheet.value = false;
|
};
|
const onSelectProjectPhase = action => {
|
form.value.projectPhase = action.value;
|
showProjectPhaseSheet.value = false;
|
};
|
const onSelectSupplier = action => {
|
form.value.supplierId = action.value;
|
form.value.supplierName =
|
supplierOptions.value.find(i => String(i.id) === String(action.value))
|
?.supplierName || "";
|
form.value.purchaseLedgerId = undefined;
|
form.value.purchaseContractNumber = "";
|
form.value.purchaseReturnOrderProductsDtos = [];
|
resetFeeInfo();
|
showSupplierSheet.value = false;
|
fetchPurchaseLedgerOptions();
|
};
|
const onSelectPreparedUser = action => {
|
form.value.preparedUserId = action.value;
|
form.value.preparedUserName =
|
userOptions.value.find(i => String(i.userId) === String(action.value))
|
?.nickName || "";
|
showPreparedUserSheet.value = false;
|
};
|
const onSelectReturnUser = action => {
|
form.value.returnUserId = action.value;
|
form.value.returnUserName =
|
userOptions.value.find(i => String(i.userId) === String(action.value))
|
?.nickName || "";
|
showReturnUserSheet.value = false;
|
};
|
const onSelectPurchaseLedger = action => {
|
form.value.purchaseLedgerId = action.value;
|
form.value.purchaseContractNumber =
|
purchaseLedgerOptions.value.find(i => String(i.id) === String(action.value))
|
?.purchaseContractNumber || "";
|
form.value.purchaseReturnOrderProductsDtos = [];
|
resetFeeInfo();
|
showPurchaseLedgerSheet.value = false;
|
};
|
const onSelectIncomeType = action => {
|
form.value.incomeType = action.value;
|
showIncomeTypeSheet.value = false;
|
};
|
|
const onPreparedAtConfirm = e => {
|
form.value.preparedAt = formatDateToYMD(e.value);
|
showPreparedAtPicker.value = false;
|
};
|
|
const onDiscountRateBlur = () => {
|
const rate = toNumber(form.value.totalDiscountRate);
|
if (rate < 0 || rate > 100) {
|
uni.showToast({ title: "折扣率需在0-100", icon: "none" });
|
return;
|
}
|
form.value.totalDiscountAmount = Number(
|
(baseAmount.value * (rate / 100)).toFixed(2)
|
);
|
syncTotalAmount();
|
};
|
|
const onDiscountAmountBlur = () => {
|
const amount = toNumber(form.value.totalDiscountAmount);
|
if (amount < 0) {
|
form.value.totalDiscountAmount = 0;
|
}
|
const base = baseAmount.value;
|
if (base <= 0) {
|
form.value.totalDiscountRate = "";
|
syncTotalAmount();
|
return;
|
}
|
if (toNumber(form.value.totalDiscountAmount) > base) {
|
form.value.totalDiscountAmount = Number(base.toFixed(2));
|
}
|
const rate = (toNumber(form.value.totalDiscountAmount) / base) * 100;
|
form.value.totalDiscountRate = Number(rate.toFixed(2));
|
syncTotalAmount();
|
};
|
|
const goBack = () => {
|
uni.removeStorageSync("purchaseReturnOrderSelectedProducts");
|
uni.navigateBack();
|
};
|
|
const goSelectProducts = () => {
|
if (!form.value.purchaseLedgerId) return;
|
uni.navigateTo({
|
url: `/pages/procurementManagement/purchaseReturnOrder/productList?purchaseLedgerId=${form.value.purchaseLedgerId}`,
|
});
|
};
|
|
const fetchSupplierOptions = () => {
|
getOptions()
|
.then(res => {
|
supplierOptions.value = res.data || [];
|
})
|
.catch(() => {
|
supplierOptions.value = [];
|
});
|
};
|
|
const fetchUserOptions = () => {
|
return userListNoPageByTenantId()
|
.then(res => {
|
const rows = res?.data || res?.rows || [];
|
if (Array.isArray(rows) && rows.length > 0) {
|
userOptions.value = rows;
|
return;
|
}
|
return userListNoPage().then(res2 => {
|
const rows2 = res2?.data || res2?.rows || [];
|
userOptions.value = Array.isArray(rows2) ? rows2 : [];
|
});
|
})
|
.catch(() => {
|
userOptions.value = [];
|
});
|
};
|
|
const ensureUserOptions = async () => {
|
if (userOptions.value?.length) return;
|
await fetchUserOptions();
|
};
|
|
const openPreparedUserSheet = async () => {
|
await ensureUserOptions();
|
showPreparedUserSheet.value = true;
|
};
|
|
const openReturnUserSheet = async () => {
|
await ensureUserOptions();
|
showReturnUserSheet.value = true;
|
};
|
|
const fetchPurchaseLedgerOptions = () => {
|
purchaseLedgerOptions.value = [];
|
if (!form.value.supplierId) return;
|
purchaseList({ supplierId: form.value.supplierId, approvalStatus: 3 })
|
.then(res => {
|
const rows = res?.rows || res?.data?.records || res?.data || [];
|
purchaseLedgerOptions.value = Array.isArray(rows) ? rows : [];
|
})
|
.catch(() => {
|
purchaseLedgerOptions.value = [];
|
});
|
};
|
|
const mergeSelectedProducts = selectedRows => {
|
const existing = new Set(
|
(form.value.purchaseReturnOrderProductsDtos || []).map(i => String(i.id))
|
);
|
const toAdd = (selectedRows || [])
|
.filter(i => !existing.has(String(i.id)))
|
.map(i => ({
|
...i,
|
returnQuantity: 0,
|
taxInclusiveTotalPrice: 0,
|
}));
|
form.value.purchaseReturnOrderProductsDtos.push(...toAdd);
|
syncTotalAmount();
|
};
|
|
const validateProducts = () => {
|
const rows = form.value.purchaseReturnOrderProductsDtos || [];
|
if (rows.length === 0) {
|
uni.showToast({ title: "请先选择产品", icon: "none" });
|
return false;
|
}
|
const invalid = rows.findIndex(i => {
|
const qty = toNumber(i.returnQuantity);
|
if (qty <= 0) return true;
|
if (qty > getReturnQtyMax(i)) return true;
|
return false;
|
});
|
if (invalid !== -1) {
|
uni.showToast({ title: `第${invalid + 1}行退货数量不合法`, icon: "none" });
|
return false;
|
}
|
return true;
|
};
|
|
const handleSubmit = async () => {
|
if (!validateProducts()) return;
|
const valid = await formRef.value.validate().catch(() => false);
|
if (!valid) return;
|
loading.value = true;
|
const rows = (form.value.purchaseReturnOrderProductsDtos || []).map(i => {
|
const cloned = { ...i };
|
syncRowTotal(cloned);
|
return cloned;
|
});
|
const payload = {
|
...form.value,
|
purchaseReturnOrderProductsDtos: rows
|
.filter(i => toNumber(i.returnQuantity) > 0)
|
.map(row => ({
|
...row,
|
stockInRecordId: row.id,
|
})),
|
};
|
createPurchaseReturnOrder(payload)
|
.then(() => {
|
uni.showToast({ title: "提交成功", icon: "success" });
|
uni.removeStorageSync("purchaseReturnOrderSelectedProducts");
|
uni.navigateBack();
|
})
|
.catch(() => {
|
uni.showToast({ title: "提交失败", icon: "error" });
|
})
|
.finally(() => {
|
loading.value = false;
|
});
|
};
|
|
watch(
|
() => baseAmount.value,
|
() => {
|
syncTotalAmount();
|
}
|
);
|
|
onMounted(() => {
|
form.value.preparedAt = formatDateToYMD(Date.now());
|
preparedAtPickerValue.value = Date.now();
|
fetchSupplierOptions();
|
fetchUserOptions();
|
});
|
|
onShow(() => {
|
const stored = uni.getStorageSync("purchaseReturnOrderSelectedProducts");
|
if (stored) {
|
try {
|
const rows = JSON.parse(stored);
|
mergeSelectedProducts(rows);
|
uni.removeStorageSync("purchaseReturnOrderSelectedProducts");
|
} catch {
|
uni.removeStorageSync("purchaseReturnOrderSelectedProducts");
|
}
|
}
|
});
|
</script>
|
|
<style scoped lang="scss">
|
@import "@/static/scss/form-common.scss";
|
|
.section-actions {
|
display: flex;
|
align-items: center;
|
gap: 10px;
|
}
|
|
.amount-text {
|
font-size: 13px;
|
color: #2979ff;
|
font-weight: 500;
|
}
|
|
.empty-products {
|
padding: 8px 0 0 0;
|
color: #999;
|
font-size: 14px;
|
}
|
</style>
|