This commit is contained in:
zmj 2024-02-23 18:20:18 +08:00
parent 89e1ce0e44
commit 20ba872f75
3 changed files with 21 additions and 8 deletions

View File

@ -55,11 +55,11 @@ const handChose = (index) => {
actIndex.value = index; actIndex.value = index;
getTownListsFn(options[index].value); getTownListsFn(options[index].value);
sendFn('choserArea', { name: options[index].label, code: options[index].value }) sendFn('choserArea', { name: options[index].label, code: options[index].value })
emit('handArea', options[actIndex.value].value,)
emit('handArea', options[actIndex.value].label,)
} }
const handTown = (index) => { const handTown = (index) => {
console.log(townLists.value[index]);
// townLists.value.forEach(item => { // townLists.value.forEach(item => {
// if (item.value == townLists[index].value) { // if (item.value == townLists[index].value) {
// sendFn('choseTown', { name: item.label, code: item.value }) // sendFn('choseTown', { name: item.label, code: item.value })
@ -68,7 +68,7 @@ const handTown = (index) => {
townLists.value.forEach(item => { townLists.value.forEach(item => {
if (item.code == townLists.value[index].code) { if (item.code == townLists.value[index].code) {
sendFn('choseTown', { name: item.name, code: item.code }) sendFn('choseTown', { name: item.name, code: item.code })
emit('handTown', options[actIndex.value].value, item.code) emit('handTown', item.name)
} }
}) })
} }

View File

@ -9,13 +9,13 @@
<div class="tradmenu-li cw" @click="sendFn('header5')"></div> <div class="tradmenu-li cw" @click="sendFn('header5')"></div>
</div> </div>
<div v-else> <div v-else>
<areaChose channel="user-trad"></areaChose> <areaChose channel="user-trad" @handTown="handTown" @handArea="handArea"></areaChose>
</div> </div>
</div> </div>
<div class="area" @click="flag = !flag"> <div class="area" @click="flag = !flag">
<div class="area-top"> <div class="area-top">
<div class="town">泸县</div> <div class="town">{{ area }}</div>
<div class="town"></div> <div class="town">{{ town }}</div>
</div> </div>
<div class="area-bottom"></div> <div class="area-bottom"></div>
</div> </div>
@ -28,12 +28,23 @@ import areaChose from "@/view/components/areaChose.vue"
import { useRouter } from "vue-router" import { useRouter } from "vue-router"
const router = useRouter() const router = useRouter()
const flag = ref(true) const flag = ref(true)
const town=ref("")
const area=ref("泸县")
const sendFn = (event, data = '', fn) => { const sendFn = (event, data = '', fn) => {
sendMsg({ channel: 'user-trad', event, data }) sendMsg({ channel: 'user-trad', event, data })
if (fn) eval(fn) if (fn) eval(fn)
} }
const handTown=(e)=>{
town.value=e
}
const handArea=(e)=>{
area.value=e
town.value=''
}
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.tradmenu { .tradmenu {

View File

@ -17,8 +17,8 @@
<areaChose v-else></areaChose> <areaChose v-else></areaChose>
<div class="area" @click="flag = !flag"> <div class="area" @click="flag = !flag">
<div class="area-top"> <div class="area-top">
<div class="town">江陽區</div> <div class="town">{{ area }}</div>
<div class="town">江陽區</div> <div class="town">{{ town }}</div>
</div> </div>
<div class="area-bottom"></div> <div class="area-bottom"></div>
</div> </div>
@ -142,6 +142,8 @@ import { sendMsg } from "@/api.js"
const router = useRouter() const router = useRouter()
const flag = ref(true) const flag = ref(true)
const town=ref("")
const area=ref("泸县")
const merchant_list =ref([]) const merchant_list =ref([])
const getmerchant_list = async () => { const getmerchant_list = async () => {