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
}
})
},
// 省市区