|
|
@@ -14,8 +14,20 @@
|
|
|
>
|
|
|
<el-row>
|
|
|
<el-col :span="24">
|
|
|
- <el-form-item prop="clientName" label="客户名称">
|
|
|
- <el-input v-model="formData.clientName"/>
|
|
|
+ <el-form-item prop="storeName" label="门店名称">
|
|
|
+ <el-input v-model="formData.storeName"/>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
+ <el-col :span="24">
|
|
|
+ <el-form-item prop="idBrand" label="选择品牌">
|
|
|
+ <el-select v-model="formData.idBrand" placeholder="请选择" style="width: 320px">
|
|
|
+ <el-option
|
|
|
+ v-for="type in optionsList"
|
|
|
+ :key="type.storeInfo.id"
|
|
|
+ :label="type.storeInfo"
|
|
|
+ :value="type.storeInfo">
|
|
|
+ </el-option>
|
|
|
+ </el-select>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
</el-row>
|
|
|
@@ -32,7 +44,7 @@
|
|
|
</div>
|
|
|
</template>
|
|
|
<script setup lang="ts">
|
|
|
-import {queryViewStoreInfo} from "@/api/store";
|
|
|
+import {getViewStoreInfo, addStoreInfo, updateStoreInfo,queryStoreBrandList} from "@/api/store";
|
|
|
import type {FormInstance} from 'element-plus'
|
|
|
|
|
|
let dialogVisible = ref(false)
|
|
|
@@ -40,18 +52,84 @@ let dialogTitle = ref("")
|
|
|
const formRef = ref<FormInstance>()
|
|
|
const emit = defineEmits(['dialogChange'])
|
|
|
const formData = reactive({
|
|
|
- clientName:'',
|
|
|
+ storeName:'',
|
|
|
+ idBrand:0,
|
|
|
+ brandName:'',
|
|
|
+ deliverSettleKind:0,
|
|
|
+ storeCodeInput:'',
|
|
|
+ storeProvince:'',
|
|
|
+ storeCity:'',
|
|
|
+ storeDistrict:'',
|
|
|
+ storeAddress:'',
|
|
|
+ contractPhone:'',
|
|
|
id: ""
|
|
|
})
|
|
|
const rules = reactive({
|
|
|
- clientName: [{required: true, message: "请输入客户名称", trigger: "blur"}],
|
|
|
+ storeName: [{required: true, message: "请输入名称", trigger: "blur"}],
|
|
|
});
|
|
|
+let optionsList = ref(new Array<any>())
|
|
|
function handleSubmit() {
|
|
|
-
|
|
|
+ formRef.value.validate((valid: any) => {
|
|
|
+ if (valid) {
|
|
|
+ const itemId = formData.id;
|
|
|
+ if (itemId) {
|
|
|
+ //修改
|
|
|
+ const postData = JSON.stringify(formData)
|
|
|
+ const params = {
|
|
|
+ "storeInfo": postData
|
|
|
+ }
|
|
|
+ updateStoreInfo(params).then((response) => {
|
|
|
+ dialogVisible.value = false
|
|
|
+ if (response.httpCode == 200) {
|
|
|
+ emit('dialogChange');
|
|
|
+ ElMessage.success("操作成功");
|
|
|
+ }
|
|
|
+ })
|
|
|
+ } else {
|
|
|
+ //增加
|
|
|
+ const postData = JSON.stringify(formData)
|
|
|
+ const params = {
|
|
|
+ "storeInfo": postData
|
|
|
+ }
|
|
|
+ addStoreInfo(params).then((response) => {
|
|
|
+ dialogVisible.value = false
|
|
|
+ if (response.httpCode == 200) {
|
|
|
+ emit('dialogChange');
|
|
|
+ ElMessage.success("操作成功");
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+}
|
|
|
+function getOptionsList() {
|
|
|
+ const page = {
|
|
|
+ pageIndex: 1,
|
|
|
+ pageSize: 100
|
|
|
+ };
|
|
|
+ const data = {
|
|
|
+ 'params': JSON.stringify({
|
|
|
+ 'voidFlag': 0
|
|
|
+ }),
|
|
|
+ "page": JSON.stringify(page)
|
|
|
+ }
|
|
|
+ queryStoreBrandList(data).then((response) => {
|
|
|
+ if (response.httpCode == 200) {
|
|
|
+ const { data } = response
|
|
|
+ optionsList.value = JSON.parse(data)
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
-
|
|
|
function getItemData(item) {
|
|
|
-
|
|
|
+ const data = {
|
|
|
+ idStore: item
|
|
|
+ }
|
|
|
+ getViewStoreInfo(data).then(response => {
|
|
|
+ if (response.httpCode == 200) {
|
|
|
+ const data = response.data
|
|
|
+ Object.assign(formData, {...data});
|
|
|
+ }
|
|
|
+ })
|
|
|
}
|
|
|
|
|
|
/** 重置表单 */
|