+
@@ -12,6 +12,12 @@ import { defineProps, defineEmits } from "vue"
import { reactive } from "vue"
import axios from "axios"
import { areaObj } from "@/store/index.js"
+import { sendMsg } from "@/api.js"
+const sendFn = (event, data = '') => {
+ sendMsg({ channel: 'user-11', event, data })
+}
+const isMainScreen = JSON.parse(localStorage.getItem("TRADE_TYPE"))
+
const userInfoStore = areaObj()
const emit = defineEmits(['offAreaList'])
const props = defineProps({
@@ -19,50 +25,32 @@ const props = defineProps({
})
const areaList = reactive([])
-// 选额镇
+// 选ze镇
const choseTownFn = (item) => {
- if (item.isArea)
- {
- userInfoStore.changeUserInfoFn( item.code ,null )
- userInfoStore.changeAddress(item.name,'')
+ if (isMainScreen) {
+ // console.log("sdfhsdghfj")
+ item.code == 510521? sendFn('choserArea', { name: item.name, code: item.code }): sendFn('choseTown', { name: item.name })
+
+ } else {
+ item.code == 510521 ? userInfoStore.changeUserInfoFn(510521, '', item.name) : userInfoStore.changeUserInfoFn(510521, Number(item.code), item.name)
}
- else {
- userInfoStore.changeUserInfoFn(510524, Number(item.code))
- userInfoStore.changeAddress("",item.name)
- }
- console.log(userInfoStore.userInfo)
- props.choseArea = false
- emit('offAreaList', item)
-
- // router.replace('/townDetail?id=' + id)
}
axios.get(`https://crmeb-test.shop.lihaink.cn/api/city/get_street?area_code=${userInfoStore.userInfo.areaCode}`)
.then(function (response) {
-
userInfoStore.changeareaCodeList(response.data.data)
response.data.data.forEach(item => {
areaList.push(item)
})
-
})
- .catch(function (error) {
- // 处理错误情况
- })
- .finally(function () {
- // 总是会执行
- });