Fix(入驻):[#1845, #1757]类型选择存在兼容性问题

This commit is contained in:
lifizer
2024-06-23 11:39:24 +08:00
parent eed49847c4
commit 44849db20d
2 changed files with 90 additions and 81 deletions
+30 -32
View File
@@ -149,20 +149,25 @@
</view>
<u-form-item prop="typeText">
<u-cell title="店铺类型" :border="false" isLink @click="changeType(true)">
<u-cell title="店铺类型" :border="false" isLink>
<template #icon>
<text class="required">*</text>
</template>
<template #value>
<u--text :text="form.typeText" v-if="form.typeText"></u--text>
<u--text text="请选择类型" color="#c0c4cc" v-else></u--text>
<picker
:value="indexType"
:range="columnsType"
mode=selector
range-key="name"
class="picker"
@change="typeChange"
>
<u--text v-if="form.typeText" :text="form.typeText"></u--text>
<u--text v-else text="请选择类型" color="#c0c4cc"></u--text>
</picker>
</template>
</u-cell>
</u-form-item>
<u-picker :show="showType" :defaultIndex="indexType" :columns="columnsType" keyName="name"
@confirm="confirmType" @cancel="cancelType"/>
<u-form-item prop="contact">
<u-cell title="联系人姓名" :border="false">
<template #icon>
@@ -430,7 +435,6 @@ export default {
trigger: ['blur', 'change']
}
},
showType: false,
columnsType: [],
indexType: [0],
district: [],
@@ -455,9 +459,6 @@ export default {
this.$refs.shopForm.setRules(this.rules);
},
methods: {
changeType(state){
this.showType=state
},
changeRemove(state){
this.showRemove=state
},
@@ -487,14 +488,13 @@ export default {
init() {
getCity().then(({data}) => {
this.district = data;
});
this.district = data
})
getShopData().then(({data}) => {
this.columnsType.push(data.hotelTypeList);
this.notice = data.merchantApplyNotice;
this.initInfo();
});
this.columnsType = data.hotelTypeList
this.notice = data.merchantApplyNotice
this.initInfo()
})
},
initInfo() {
@@ -530,9 +530,9 @@ export default {
}
})
}
this.indexType = this.columnsType[0].findIndex(item => item.id === this.form.type);
if (this.indexType != -1) {
this.form.typeText = this.columnsType[0][this.indexType].name;
this.indexType = this.columnsType.findIndex(item => item.id === this.form.type)
if (this.indexType !== -1) {
this.form.typeText = this.columnsType[this.indexType].name
}
this.form.position = this.$forceToDecimal(this.form.longitude, 6) + ',' + this.$forceToDecimal(this.form.latitude, 6);
this.form.area = `${this.form.provinceName} ${this.form.cityName} ${this.form.areaName}`;
@@ -595,17 +595,15 @@ export default {
})
}
},
// 回调参数为包含column indexs、value、values
confirmType(e) {
this.indexType = e.indexs;
this.form.type = e.value[0].id;
this.form.typeText = e.value[0].name;
this.showType = false;
},
cancelType() {
this.showType = false;
typeChange(e) {
const idx = parseInt(e.detail.value)
this.columnsType.map((item, index) => {
if (index === idx) {
this.form.typeText = item.name
this.indexType = index
this.form.type = item.id
}
})
},
// 省市区
+60 -49
View File
@@ -120,21 +120,26 @@
</u-cell>
</view>
<!-- <u-form-item prop="typeText">-->
<!-- <u-cell title="类型" :border="false" isLink @click="showSupplierType=true">-->
<!-- <template #icon>-->
<!-- <text class="required">*</text>-->
<!-- </template>-->
<!-- <template #value>-->
<!-- <u&#45;&#45;text :text="formSupplier.typeText" v-if="formSupplier.typeText"></u&#45;&#45;text>-->
<!-- <u&#45;&#45;text text="请选择类型" color="#c0c4cc" v-else></u&#45;&#45;text>-->
<!-- </template>-->
<!-- </u-cell>-->
<!-- </u-form-item>-->
<!-- <u-picker :show="showSupplierType" :defaultIndex="indexSupplierType" :columns="columnsSupplierType"-->
<!-- keyName="value"-->
<!-- @confirm="confirmSupplierType" @cancel="cancelType"/>-->
<!-- <u-form-item prop="typeText">
<u-cell title="类型" :border="false" isLink @click="showSupplierType=true">
<template #icon>
<text class="required">*</text>
</template>
<template #value>
<picker
:value="indexSupplierType"
:range="columnsSupplierType"
mode=selector
range-key="value"
class="picker"
@change="supplierTypeChange"
>
<u--text v-if="formSupplier.typeText" :text="formSupplier.typeText"></u--text>
<u--text v-else text="请选择类型" color="#c0c4cc"></u--text>
</picker>
</template>
</u-cell>
</u-form-item> -->
<u-form-item prop="area">
<u-cell title="省市区" :border="false" isLink>
@@ -287,20 +292,26 @@
</u-form-item>
<u-form-item prop="typeText">
<u-cell title="店铺类型" :border="false" isLink @click="changeType(true)">
<u-cell title="店铺类型" :border="false" isLink>
<template #icon>
<text class="required">*</text>
</template>
<template #value>
<u--text :text="form.typeText" v-if="form.typeText"></u--text>
<u--text text="请选择类型" color="#c0c4cc" v-else></u--text>
<picker
:value="indexType"
:range="columnsType"
mode=selector
range-key="name"
class="picker"
@change="typeChange"
>
<u--text v-if="form.typeText" :text="form.typeText"></u--text>
<u--text v-else text="请选择类型" color="#c0c4cc"></u--text>
</picker>
</template>
</u-cell>
</u-form-item>
<u-picker :show="showType" :defaultIndex="indexType" :columns="columnsType" keyName="name"
@confirm="confirmType" @cancel="cancelType"/>
<u-form-item prop="contact">
<u-cell title="联系人姓名" :border="false">
<template #icon>
@@ -456,7 +467,7 @@ export default {
subType: "",
area: "",
address: "",
position: "",
position: ""
},
form: {
name: "",
@@ -596,14 +607,10 @@ export default {
trigger: ['blur', 'change']
}
},
showType: false,
columnsType: [],
indexType: [0],
showSupplierType: false,
indexType: 0,
columnsSupplierType: [],
indexSupplierType: [0],
indexSupplierType: 0,
district: [],
@@ -641,9 +648,6 @@ export default {
this.$refs.supplierForm.setRules(this.rulesSupplier);
},
methods: {
changeType(state){
this.showType=state
},
changeRemove(state){
this.showRemove=state
},
@@ -677,8 +681,8 @@ export default {
});
getShopData().then(({data}) => {
this.columnsType.push(data.hotelTypeList);
this.columnsSupplierType.push(data.supplierTypeList);
this.columnsType = data.hotelTypeList
this.columnsSupplierType = data.supplierTypeList
this.notice = data.merchantApplyNotice;
this.initInfo();
});
@@ -718,8 +722,8 @@ export default {
}
})
}
this.indexType = this.columnsType[0].findIndex(item => item.id === this.form.type);
this.form.typeText = this.columnsType[0][this.indexType].name;
this.indexType = this.columnsType.findIndex(item => item.id === this.form.type);
this.form.typeText = this.columnsType[this.indexType].name;
this.form.position = this.$forceToDecimal(this.form.longitude, 6) + ',' + this.$forceToDecimal(this.form.latitude, 6);
this.form.area = `${this.form.provinceName} ${this.form.cityName} ${this.form.areaName}`;
if (data.hotelInfo.coverType === 2) {
@@ -733,8 +737,8 @@ export default {
if (this.infoTitle === "文玩" && data.applyType !== 3) return;
this.formSupplier = data.supplierInfo;
this.indexSupplierType = this.columnsSupplierType[0].findIndex(item => item.key === this.formSupplier.subType);
this.formSupplier.typeText = this.columnsSupplierType[0][this.indexSupplierType].value;
this.indexSupplierType = this.columnsSupplierType.findIndex(item => item.key === this.formSupplier.subType);
this.formSupplier.typeText = this.columnsSupplierType[this.indexSupplierType].value;
this.formSupplier.position = this.$forceToDecimal(this.formSupplier.longitude, 6) + ',' + this.$forceToDecimal(this.formSupplier.latitude, 6);
this.formSupplier.area = `${this.formSupplier.provinceName} ${this.formSupplier.cityName} ${this.formSupplier.areaName}`;
}
@@ -810,24 +814,31 @@ export default {
}
},
// 回调参数为包含column indexs、value、values
confirmType(e) {
this.indexType = e.indexs;
this.form.type = e.value[0].id;
this.form.typeText = e.value[0].name;
this.showType = false;
},
confirmSupplierType(e) {
this.indexSupplierType = e.indexs;
this.formSupplier.subType = e.value[0].key;
this.formSupplier.typeText = e.value[0].value;
this.showSupplierType = false;
},
cancelType() {
this.showType = false;
this.showSupplierType = false;
typeChange(e) {
const idx = parseInt(e.detail.value)
this.columnsType.map((item, index) => {
if (index === idx) {
this.form.typeText = item.name
this.indexType = index
this.form.type = item.id
}
})
},
supplierTypeChange(e) {
const idx = parseInt(e.detail.value)
this.columnsSupplierType.map((item, index) => {
if (index === idx) {
this.formSupplier.typeText = item.value
this.indexSupplierType = index
this.formSupplier.type = item.key
}
})
},
resultSupplier(values) {