|
@@ -1,39 +1,33 @@
|
|
|
<template>
|
|
|
- <div class="form">
|
|
|
- <van-nav-bar :title="$t('priceConfig.name')" :left-text="$t('common.back')" left-arrow @click-left="onClickLeft">
|
|
|
- </van-nav-bar>
|
|
|
- <van-form @submit="editSubmit" label-align="top" style="margin-top: 20px">
|
|
|
- <van-cell-group inset>
|
|
|
- <van-field v-model="formData.supplierInfoName" is-link readonly :label="$t('priceConfig.supplier')"
|
|
|
- :placeholder="$t('priceConfig.selectSupplier')"
|
|
|
- />
|
|
|
- <van-popup v-model:show="typeModal" round position="bottom">
|
|
|
- <van-picker :columns="columns" @cancel="typeModal = false" @confirm="onConfirm" />
|
|
|
- </van-popup>
|
|
|
- <van-field v-model="formData.productInfoName" is-link readonly :label="$t('priceConfig.itemName')"
|
|
|
- :placeholder="$t('priceConfig.selectItemName')"
|
|
|
- v-if="route.query.id" />
|
|
|
-
|
|
|
- <van-field v-model="formData.price" :label="$t('priceConfig.supplyUnitPrice')"
|
|
|
- :placeholder="$t('priceConfig.pleaseEnterSupplyUnitPrice')"
|
|
|
- :rules="[{ required: true, message: $t('priceConfig.supplyUnitPriceCanNotBeEmpty')}]" required v-if="route.query.id" />
|
|
|
- <!-- 明细列表 -->
|
|
|
- <van-popup v-model:show="typeModalOne" round position="bottom">
|
|
|
- <van-picker :columns="columnsOne" @cancel="typeModalOne = false"
|
|
|
- @confirm="(data) => onConfirmOne(data, index)" />
|
|
|
- </van-popup>
|
|
|
- </van-cell-group>
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
- <div style="margin: 16px">
|
|
|
- <van-button round block type="primary" native-type="submit">
|
|
|
- {{$t('common.submit')}}
|
|
|
- </van-button>
|
|
|
- </div>
|
|
|
-
|
|
|
- </van-form>
|
|
|
- </div>
|
|
|
+ <div class="form">
|
|
|
+ <van-nav-bar :title="$t('priceConfig.name')" :left-text="$t('common.back')" left-arrow @click-left="onClickLeft">
|
|
|
+ </van-nav-bar>
|
|
|
+ <van-form @submit="editSubmit" label-align="top" style="margin-top: 20px">
|
|
|
+ <van-cell-group inset>
|
|
|
+ <van-field v-model="formData.supplierInfoName" is-link readonly :label="$t('priceConfig.supplier')"
|
|
|
+ :placeholder="$t('priceConfig.selectSupplier')" />
|
|
|
+ <van-popup v-model:show="typeModal" round position="bottom">
|
|
|
+ <van-picker :columns="columns" @cancel="typeModal = false" @confirm="onConfirm" />
|
|
|
+ </van-popup>
|
|
|
+ <van-field v-model="formData.productInfoName" is-link readonly :label="$t('priceConfig.itemName')"
|
|
|
+ :placeholder="$t('priceConfig.selectItemName')" v-if="route.query.id" />
|
|
|
+
|
|
|
+ <van-field v-model="formData.price" :label="$t('priceConfig.supplyUnitPrice')" :placeholder="$t('priceConfig.pleaseEnterSupplyUnitPrice')"
|
|
|
+ :rules="[{ required: true, message: $t('priceConfig.supplyUnitPriceCanNotBeEmpty')}]" required v-if="route.query.id" />
|
|
|
+ <!-- 明细列表 -->
|
|
|
+ <van-popup v-model:show="typeModalOne" round position="bottom">
|
|
|
+ <van-picker :columns="columnsOne" @cancel="typeModalOne = false" @confirm="(data) => onConfirmOne(data, index)" />
|
|
|
+ </van-popup>
|
|
|
+ </van-cell-group>
|
|
|
+
|
|
|
+ <div style="margin: 16px">
|
|
|
+ <van-button round block type="primary" native-type="submit">
|
|
|
+ {{$t('common.submit')}}
|
|
|
+ </van-button>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ </van-form>
|
|
|
+ </div>
|
|
|
</template>
|
|
|
|
|
|
<script setup>
|
|
@@ -49,110 +43,111 @@ const typeModal = ref(false);
|
|
|
const typeModalOne = ref(false);
|
|
|
let selectIndex = ref(null);
|
|
|
const formData = ref({
|
|
|
- supplierInfoId: "",
|
|
|
- type: "1",
|
|
|
- supplierInfoName: "",
|
|
|
+ supplierInfoId: "",
|
|
|
+ type: "1",
|
|
|
+ supplierInfoName: "",
|
|
|
});
|
|
|
const list = ref([]);
|
|
|
const handleAddRow = () => {
|
|
|
- list.value.push({
|
|
|
- productInfoId: "",
|
|
|
- productInfoName: "",
|
|
|
- price: "",
|
|
|
- });
|
|
|
+ list.value.push({
|
|
|
+ productInfoId: "",
|
|
|
+ productInfoName: "",
|
|
|
+ price: "",
|
|
|
+ });
|
|
|
};
|
|
|
const getDict = () => {
|
|
|
- proxy.post("/supplierInfo/page", { pageNum: 1, pageSize: 9999 }).then((res) => {
|
|
|
- columns.value = res.data.rows.map((item) => {
|
|
|
- return {
|
|
|
- text: item.name,
|
|
|
- value: item.id,
|
|
|
- };
|
|
|
- });
|
|
|
+ proxy
|
|
|
+ .post("/supplierInfo/page", { pageNum: 1, pageSize: 9999 })
|
|
|
+ .then((res) => {
|
|
|
+ columns.value = res.data.rows.map((item) => {
|
|
|
+ return {
|
|
|
+ text: item.name,
|
|
|
+ value: item.id,
|
|
|
+ };
|
|
|
+ });
|
|
|
});
|
|
|
|
|
|
- proxy
|
|
|
- .post("/productInfo/page", { pageNum: 1, pageSize: 9999, definition: "1" })
|
|
|
- .then((res) => {
|
|
|
- columnsOne.value = res.data.rows.map((item) => {
|
|
|
- return {
|
|
|
- text: item.name,
|
|
|
- value: item.id,
|
|
|
- };
|
|
|
- });
|
|
|
- });
|
|
|
+ proxy
|
|
|
+ .post("/productInfo/page", { pageNum: 1, pageSize: 9999, definition: "1" })
|
|
|
+ .then((res) => {
|
|
|
+ columnsOne.value = res.data.rows.map((item) => {
|
|
|
+ return {
|
|
|
+ text: item.name,
|
|
|
+ value: item.id,
|
|
|
+ };
|
|
|
+ });
|
|
|
+ });
|
|
|
};
|
|
|
|
|
|
-
|
|
|
const columns = ref([]);
|
|
|
const columnsOne = ref([]);
|
|
|
|
|
|
const onConfirm = ({ selectedOptions }) => {
|
|
|
- formData.value.supplierInfoId = selectedOptions[0].value;
|
|
|
- formData.value.supplierInfoName = selectedOptions[0].text;
|
|
|
- typeModal.value = false;
|
|
|
+ formData.value.supplierInfoId = selectedOptions[0].value;
|
|
|
+ formData.value.supplierInfoName = selectedOptions[0].text;
|
|
|
+ typeModal.value = false;
|
|
|
};
|
|
|
|
|
|
-const onConfirmOne = ({selectedOptions}) => {
|
|
|
- formData.value.productInfoId = selectedOptions[0].value;
|
|
|
- formData.value.productInfoName = selectedOptions[0].text;
|
|
|
- typeModalOne.value = false;
|
|
|
+const onConfirmOne = ({ selectedOptions }) => {
|
|
|
+ formData.value.productInfoId = selectedOptions[0].value;
|
|
|
+ formData.value.productInfoName = selectedOptions[0].text;
|
|
|
+ typeModalOne.value = false;
|
|
|
};
|
|
|
|
|
|
const handleSelect = (index) => {
|
|
|
- typeModalOne.value = true;
|
|
|
+ typeModalOne.value = true;
|
|
|
};
|
|
|
|
|
|
const handleDel = (index) => {
|
|
|
- list.value.splice(index, 1);
|
|
|
+ list.value.splice(index, 1);
|
|
|
};
|
|
|
|
|
|
const onClickLeft = () => history.back();
|
|
|
|
|
|
const editSubmit = () => {
|
|
|
- console.log(formData.value)
|
|
|
- console.log(route.query)
|
|
|
- proxy.post("/supplierPrice/edit", formData.value).then(
|
|
|
- (res) => {
|
|
|
- setTimeout(() => {
|
|
|
- showSuccessToast(proxy.$t("common.modifySuccess"));
|
|
|
- proxy.$router.push("/main/priceConfig");
|
|
|
- }, 500);
|
|
|
- },
|
|
|
- (err) => {
|
|
|
- return showFailToast(err.message);
|
|
|
- }
|
|
|
- );
|
|
|
+ console.log(formData.value);
|
|
|
+ console.log(route.query);
|
|
|
+ proxy.post("/supplierPrice/edit", formData.value).then(
|
|
|
+ (res) => {
|
|
|
+ setTimeout(() => {
|
|
|
+ showSuccessToast(proxy.$t("common.modifySuccess"));
|
|
|
+ proxy.$router.push("/main/priceConfig");
|
|
|
+ }, 500);
|
|
|
+ },
|
|
|
+ (err) => {
|
|
|
+ return showFailToast(err.message);
|
|
|
+ }
|
|
|
+ );
|
|
|
};
|
|
|
|
|
|
onMounted(() => {
|
|
|
- console.log(route.query)
|
|
|
- formData.value = {
|
|
|
- supplierInfoName: route.query.supplierName,
|
|
|
- productInfoName: route.query.productClassifyName,
|
|
|
- id: route.query.id,
|
|
|
- supplierInfoId: route.query.supplierInfoId,
|
|
|
- productInfoId: route.query.productInfoId,
|
|
|
- price: route.query.price,
|
|
|
- }
|
|
|
- getDict();
|
|
|
+ console.log(route.query);
|
|
|
+ formData.value = {
|
|
|
+ supplierInfoName: route.query.supplierName,
|
|
|
+ productInfoName: route.query.productClassifyName,
|
|
|
+ id: route.query.id,
|
|
|
+ supplierInfoId: route.query.supplierInfoId,
|
|
|
+ productInfoId: route.query.productInfoId,
|
|
|
+ price: route.query.price,
|
|
|
+ };
|
|
|
+ getDict();
|
|
|
});
|
|
|
</script>
|
|
|
<style lang="scss" scoped>
|
|
|
.row {
|
|
|
- display: flex;
|
|
|
- padding: 5px 10px 0 10px;
|
|
|
- justify-content: space-between;
|
|
|
- align-items: center;
|
|
|
-
|
|
|
- .title {
|
|
|
- flex: 1;
|
|
|
- }
|
|
|
-
|
|
|
- .delete {
|
|
|
- width: 20px;
|
|
|
- cursor: pointer;
|
|
|
- text-align: center;
|
|
|
- }
|
|
|
+ display: flex;
|
|
|
+ padding: 5px 10px 0 10px;
|
|
|
+ justify-content: space-between;
|
|
|
+ align-items: center;
|
|
|
+
|
|
|
+ .title {
|
|
|
+ flex: 1;
|
|
|
+ }
|
|
|
+
|
|
|
+ .delete {
|
|
|
+ width: 20px;
|
|
|
+ cursor: pointer;
|
|
|
+ text-align: center;
|
|
|
+ }
|
|
|
}
|
|
|
</style>
|