|
@@ -65,7 +65,7 @@
|
|
|
readonly
|
|
|
:label="$t('procureList.supplier')"
|
|
|
:placeholder="$t('procureList.selectSupplier')"
|
|
|
- @click="typeModal = true"
|
|
|
+ @click="handleSupplyClick"
|
|
|
:rules="[
|
|
|
{
|
|
|
required: true,
|
|
@@ -88,15 +88,15 @@
|
|
|
:name="$t('procureList.procurementDescription')"
|
|
|
:label="$t('procureList.procurementDescription')"
|
|
|
:placeholder="$t('procureList.pleaseFillInTheProcurementDescription')"
|
|
|
- :rules="[
|
|
|
+ rows="3"
|
|
|
+ />
|
|
|
+ <!-- :rules="[
|
|
|
{
|
|
|
required: true,
|
|
|
message: $t('procureList.procurementDescriptionCanNotBeEmpty'),
|
|
|
},
|
|
|
]"
|
|
|
- required
|
|
|
- rows="3"
|
|
|
- />
|
|
|
+ required -->
|
|
|
</van-cell-group>
|
|
|
|
|
|
<!-- 明细列表 -->
|
|
@@ -290,6 +290,18 @@ const changePrice = (index) => {
|
|
|
0
|
|
|
);
|
|
|
};
|
|
|
+const changeAmount = () => {
|
|
|
+ for (let i = 0; i < formData.value.purchaseDetailList.length; i++) {
|
|
|
+ const e = formData.value.purchaseDetailList[i];
|
|
|
+ e.amount = (e.count * e.price).toFixed(2);
|
|
|
+ }
|
|
|
+ formData.value.amount = formData.value.purchaseDetailList.reduce(
|
|
|
+ (total, item) => {
|
|
|
+ return total + Number(item.amount);
|
|
|
+ },
|
|
|
+ 0
|
|
|
+ );
|
|
|
+};
|
|
|
|
|
|
const getDetails = (id) => {
|
|
|
proxy.post("/subscribe/detail", { id: id }).then((res) => {
|
|
@@ -309,7 +321,12 @@ const getDetails = (id) => {
|
|
|
const columns = ref([]);
|
|
|
const columnsOne = ref([]);
|
|
|
const submitType = ref("add");
|
|
|
-
|
|
|
+const handleSupplyClick = () => {
|
|
|
+ if (route.query.processType == 10 || route.query.processType == 20) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ typeModal.value = true;
|
|
|
+};
|
|
|
const onConfirm = ({ selectedOptions }) => {
|
|
|
formData.value.supplyId = selectedOptions[0].value;
|
|
|
formData.value.supplyName = selectedOptions[0].text;
|
|
@@ -413,6 +430,39 @@ watch(
|
|
|
deep: true,
|
|
|
}
|
|
|
);
|
|
|
+
|
|
|
+watch(
|
|
|
+ () => formData.value.supplyId,
|
|
|
+ (val) => {
|
|
|
+ const ids = formData.value.purchaseDetailList.map((x) => x.bussinessId);
|
|
|
+ // console.log(val, "ss");
|
|
|
+ if (val && ids.length > 0) {
|
|
|
+ proxy
|
|
|
+ .post("/supplierPrice/getSupplierPriceByProductIds", {
|
|
|
+ supplierInfoId: val,
|
|
|
+ productIdList: ids,
|
|
|
+ })
|
|
|
+ .then((res) => {
|
|
|
+ if (res.data && Object.keys(res.data).length > 0) {
|
|
|
+ for (let i = 0; i < formData.value.purchaseDetailList.length; i++) {
|
|
|
+ const e = formData.value.purchaseDetailList[i];
|
|
|
+ for (const key in res.data) {
|
|
|
+ if (e.bussinessId === key) {
|
|
|
+ e.price = Number(res.data[key]);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ for (let i = 0; i < formData.value.purchaseDetailList.length; i++) {
|
|
|
+ const e = formData.value.purchaseDetailList[i];
|
|
|
+ e.price = 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ changeAmount();
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+);
|
|
|
</script>
|
|
|
<style lang="scss" scoped>
|
|
|
.row {
|