This commit is contained in:
weipengfei 2024-02-23 16:17:55 +08:00
parent 41669abfe3
commit fe6b5b7c18
4 changed files with 64 additions and 6 deletions

View File

@ -1,4 +1,14 @@
<script setup lang="ts">
// URL
const queryString = window.location.search;
//
const searchParams = new URLSearchParams(queryString);
// id
const uid = searchParams.get('local') || '';
if(uid||!localStorage.getItem('local')) localStorage.setItem('local', uid);
</script>
<template>

View File

@ -29,6 +29,11 @@ const instacneTrike = axios.create({
timeout: 30000,
});
const instacneBreed = axios.create({
baseURL: "https://ceshi-suyuan-breed.lihaink.cn",
timeout: 30000,
});
const configInstacne=(ins)=>{
ins.interceptors.request.use(
(config) => {
@ -68,9 +73,12 @@ configInstacne(instacne)
configInstacne(instacnePlant)
configInstacne(instacneTrade)
configInstacne(instacneTrike)
configInstacne(instacneBreed)
export function sendMsg(params) {
let uid = localStorage.getItem('local') || '';
params.channel = uid + params.channel;
return instacne.get('/dataviewTouchPush', { params })
}
@ -86,6 +94,10 @@ export function apigetTownLists(params) {
return instacneTrike.get('/api/city/get_street', { params })
}
export function breedFarmCount(params) {
return instacneBreed.get('/api/dataview.farm/farmCount', { params })
}
//
//api/dataview/merchant?mer_id=36&areaCode=510524&streetCode=510524100
// }

21
src/store/breed.js Normal file
View File

@ -0,0 +1,21 @@
import { defineStore } from "pinia"
import { ref } from "vue"
export const useBreedStore = defineStore('app', () => {
const address = ref(JSON.parse(localStorage.getItem('address') || '{}'));
if (!address.value.areaCode) {
address.value = { areaCode: 510502, streetCode: '' };
}
const setAddress = (e) => {
address.value.areaCode = e.areaCode;
address.value.streetCode = e.streetCode;
localStorage.setItem('address', JSON.stringify(e));
}
return {
address,
setAddress,
}
})

View File

@ -18,17 +18,17 @@
<img src="/static/img/tradeScreen/FH.png" @click="router.go(-1)" class="back-btn" alt="">
<div class="cont" v-if="flag">
<div class="card" v-for="item in 9">
<div class="card" v-for="(item, index) in farmList" :key="index">
<div class="card-tit">
究极公司
{{ item.farm_name }}
</div>
<div class="card-cotnet">
<div>商户姓名: 为对方</div>
<div>商户姓名: {{ item.master }}</div>
<div class="login">查看详情</div>
</div>
</div>
</div>
<areaChose v-else></areaChose>
<areaChose v-else channel="user-breed-datav" @handTown="handTown"></areaChose>
<div class="area" @click="flag = !flag">
<div class="area-top">
<div class="town">江陽區</div>
@ -43,9 +43,15 @@ import { sendMsg } from "@/api.js"
import axios from "axios"
import { vehicleListApi } from "@/api.js"
import areaChose from "@/view/components/areaChose.vue"
import { useBreedStore } from "@/store/breed.js"
import { breedFarmCount } from "@/api.js";
import {useRouter} from "vue-router"
const router = useRouter()
const nowPages = ref('index');
const flag = ref(true)
const flag = ref(true);
const appStore = useBreedStore();
//
const options = [
@ -96,13 +102,22 @@ const changeArea = (e) => {
}
const changeTown = (e) => {
console.log(e)
townOptions.forEach(item => {
if (item.value == e) {
sendFn('choseTown', { name: item.label })
}
})
}
const farmList = ref([]);
const handTown = (a, s)=>{
breedFarmCount({
areaCode: a,
streetCode: s
}).then(res=>{
farmList.value = res.data.farmList || [];
flag.value = true;
})
}
const getTownList = () => {