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