This commit is contained in:
zmj 2023-12-18 18:49:23 +08:00
parent 453cd5822f
commit f4c2333170
9 changed files with 133 additions and 54 deletions

View File

@ -189,6 +189,11 @@ export function merchant_product_visitApi(params) {
export function merchant_product_cartApi(params) { export function merchant_product_cartApi(params) {
return instacne.get('/api/dataview/merchant_product_cart', { params }) return instacne.get('/api/dataview/merchant_product_cart', { params })
} }
export function merchantApi(params) {
return instacne.get('/api/dataview/merchant', { params })
}
// //
///api/dataview/merchant_product_cart?areaCode=510524&streetCode=510524100&mer_id=42&start_date=2023-01-01&end_date=2023-12-09 //api/dataview/merchant?mer_id=36&areaCode=510524&streetCode=510524100
// } // }

View File

@ -52,7 +52,7 @@
</div> </div>
</div> </div>
<div class="right"> <div class="right">
<datePicker v-if="route.path != '/storeLogin'"></datePicker> <datePicker></datePicker>
<div class="rigth-li" @click="choseAreaFn"> <img style="width: 1VW;height:1VW;margin-right: 0.5vw;" <div class="rigth-li" @click="choseAreaFn"> <img style="width: 1VW;height:1VW;margin-right: 0.5vw;"
:src="u('DW')" alt=""> {{ area }} :src="u('DW')" alt=""> {{ area }}
</div> </div>
@ -129,11 +129,10 @@ watch(
(value, oldValue) => { (value, oldValue) => {
console.log(value,oldValue)
if (value == '/index') { if (value == '/index') {
showFn(0) showFn(0)
area.value = '龙马潭区' area.value = '泸县'
} }
if (value == '/townDetail') { if (value == '/townDetail') {
showFn(0) showFn(0)

View File

@ -4,13 +4,11 @@ import dataV from '@jiaminghi/data-view'
import router from "./router"; import router from "./router";
import ElementPlus from 'element-plus' import ElementPlus from 'element-plus'
import * as ElementPlusIconsVue from '@element-plus/icons-vue' import * as ElementPlusIconsVue from '@element-plus/icons-vue'
// import VueDatePicker from '@vuepic/vue-datepicker';
// import '@vuepic/vue-datepicker/dist/main.css'
import { import {
createPinia createPinia
} from 'pinia' } from 'pinia'
import 'element-plus/dist/index.css' import 'element-plus/dist/index.css'
// import '@/components/townDetail/test.js'
import 'amfe-flexible' import 'amfe-flexible'
const pinia = createPinia() const pinia = createPinia()

View File

@ -35,12 +35,9 @@ export const areaObj = defineStore('counter', {
this.store.mer_id = mer_id this.store.mer_id = mer_id
} }
},
storeLogin(obj) {
this.userInfo.user = obj
} }
} }

View File

@ -1,5 +1,10 @@
<template> <template>
<div class="box"> <div v-if="showLogin" class="center">
<dv-loading>正在登陆商户...</dv-loading>
</div>
<div class="box" v-else>
<div class="img-cls"> <div class="img-cls">
<img src="/static/town/TABBG.png" style="width: 100%;height: 100%;position: absolute;" alt=""> <img src="/static/town/TABBG.png" style="width: 100%;height: 100%;position: absolute;" alt="">
<div class="content"> <div class="content">
@ -21,8 +26,10 @@
// 102B3 // 102B3
import { ref, reactive, onMounted } from "vue" import { ref, reactive, onMounted } from "vue"
import { useRouter } from 'vue-router' import { useRouter } from 'vue-router'
import { merchant_listApi } from "@/api.js" import { merchant_listApi, merchantApi } from "@/api.js"
import { areaObj } from '@/store/index.js' import { areaObj } from '@/store/index.js'
import router from "../router";
const showLogin = ref(false)
const areaStore = areaObj() const areaStore = areaObj()
const route = useRouter() const route = useRouter()
@ -36,6 +43,8 @@ const num = (n) => {
} }
let baseData = {}
const changeTable = (num) => { const changeTable = (num) => {
configs.data.splice(0, configs.data.length) configs.data.splice(0, configs.data.length)
@ -47,6 +56,7 @@ const changeTable = (num) => {
limit: 50 limit: 50
} }
).then(res => { ).then(res => {
baseData = res.data.list
addConfigData(res.data.list) addConfigData(res.data.list)
}) })
@ -55,7 +65,18 @@ const changeTable = (num) => {
const hdClick = (e) => { const hdClick = (e) => {
if (e.columnIndex == 10) { if (e.columnIndex == 10) {
route.replace('/storeLogin') merchantApi(
{
mer_id: baseData[e.rowIndex].mer_id,
...areaStore.area
}
).then(res => {
areaStore.storeLogin(res.data)
router.push('/storeLogin')
console.log(areaStore.userInfo)
})
} }
@ -73,7 +94,7 @@ const addConfigData = (data) => {
`<div style='width: 100%;text-align: center; height: 100%; color: aliceblue; background: #02243D;'>${item.is_best ? "推荐" : "不推荐"}</div>`, `<div style='width: 100%;text-align: center; height: 100%; color: aliceblue; background: #02243D;'>${item.is_best ? "推荐" : "不推荐"}</div>`,
`<div style='width: 100%;text-align: center; height: 100%; color: aliceblue; background: #02243D;'>${item.create_time}</div>`, `<div style='width: 100%;text-align: center; height: 100%; color: aliceblue; background: #02243D;'>${item.create_time}</div>`,
`<div style='width: 100%;text-align: center; height: 100%; color: aliceblue; background: #02243D;'>${item.margin}</div>`, `<div style='width: 100%;text-align: center; height: 100%; color: aliceblue; background: #02243D;'>${item.margin}</div>`,
`<div style='width: 100%;text-align: center; height: 100%; color: aliceblue; background: #02243D;'>${item.merchantCategory?.category_name||'--'}</div>`, `<div style='width: 100%;text-align: center; height: 100%; color: aliceblue; background: #02243D;'>${item.merchantCategory?.category_name || '--'}</div>`,
`<div style='width: 100%;text-align: center; height: 100%; color: aliceblue; background: #02243D;'>${item.status ? '开启' : '关闭'}</div>`, `<div style='width: 100%;text-align: center; height: 100%; color: aliceblue; background: #02243D;'>${item.status ? '开启' : '关闭'}</div>`,
`<div style='width: 100%;text-align: center; height: 100%; color: aliceblue; background: #02243D;color:#3D9EB5';cursor: pointer;>登录</div>`, `<div style='width: 100%;text-align: center; height: 100%; color: aliceblue; background: #02243D;color:#3D9EB5';cursor: pointer;>登录</div>`,
] ]
@ -89,7 +110,7 @@ const addConfigData = (data) => {
`<div style='width: 100%;text-align: center; height: 100%; color: aliceblue; background: #102B3E;'>${item.is_best ? "推荐" : "不推荐"}</div>`, `<div style='width: 100%;text-align: center; height: 100%; color: aliceblue; background: #102B3E;'>${item.is_best ? "推荐" : "不推荐"}</div>`,
`<div style='width: 100%;text-align: center; height: 100%; color: aliceblue; background: #102B3E;'>${item.create_time}</div>`, `<div style='width: 100%;text-align: center; height: 100%; color: aliceblue; background: #102B3E;'>${item.create_time}</div>`,
`<div style='width: 100%;text-align: center; height: 100%; color: aliceblue; background: #102B3E;'>${item.margin}</div>`, `<div style='width: 100%;text-align: center; height: 100%; color: aliceblue; background: #102B3E;'>${item.margin}</div>`,
`<div style='width: 100%;text-align: center; height: 100%; color: aliceblue; background: #102B3E;'>${item.merchantCategory?.category_name||'--'}</div>`, `<div style='width: 100%;text-align: center; height: 100%; color: aliceblue; background: #102B3E;'>${item.merchantCategory?.category_name || '--'}</div>`,
`<div style='width: 100%;text-align: center; height: 100%; color: aliceblue; background: #102B3E;'>${item.status ? '开启' : '关闭'}</div>`, `<div style='width: 100%;text-align: center; height: 100%; color: aliceblue; background: #102B3E;'>${item.status ? '开启' : '关闭'}</div>`,
`<div style='width: 100%;text-align: center; height: 100%; color: aliceblue; background: #102B3E;color:#3D9EB5; cursor: pointer;'>登录</div>`, `<div style='width: 100%;text-align: center; height: 100%; color: aliceblue; background: #102B3E;color:#3D9EB5; cursor: pointer;'>登录</div>`,
] ]
@ -210,6 +231,11 @@ onMounted(() => {
.center {
.row {} position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
color: white;
}
</style> </style>

View File

@ -1,5 +1,9 @@
<template> <template>
<div class="box" :style="{ opacity: loading ? 0 : 1 }"> <div v-if="showLoading" class="center">
<dv-loading>Loading...</dv-loading>
</div>
<div class="box" :style="{ opacity: showLoading ? 0 : 1 }">
<div class="body"> <div class="body">
<div class="l"> <div class="l">
<topLeft :areaCodes="areaCodes" /> <topLeft :areaCodes="areaCodes" />
@ -36,11 +40,19 @@ import bottomRight from "@/components/index/bottomRight.vue"
import { areaObj } from '@/store/index.js' import { areaObj } from '@/store/index.js'
import { useRouter } from "vue-router" import { useRouter } from "vue-router"
const router = useRouter() const router = useRouter()
const showLoading = ref(true)
const areaStore = areaObj() const areaStore = areaObj()
const areaCodes = reactive({ const areaCodes = reactive({
...areaStore.area ...areaStore.area
}) })
const loading = ref(false)
setTimeout(() => {
showLoading.value = false
}, 1000);
</script> </script>
<style lang="scss"> <style lang="scss">
@keyframes jump { @keyframes jump {
@ -118,4 +130,12 @@ const loading = ref(false)
position: relative; position: relative;
} }
} }
.center {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
color: white;
}
</style> </style>

View File

@ -94,7 +94,7 @@ const submit = () => {
if (res.data.user.street_code) { if (res.data.user.street_code) {
role.value =3 role.value = 3
res.data.role = role.value res.data.role = role.value
localStorage.setItem("TRADE_USER", JSON.stringify(res.data)) localStorage.setItem("TRADE_USER", JSON.stringify(res.data))

View File

@ -149,13 +149,29 @@
<script setup> <script setup>
import { ref, reactive, onMounted } from "vue" import { ref, reactive, onMounted } from "vue"
import { merchant_count_mainApi, merchant_product_rankingApi, merchant_product_visitApi, merchant_product_cartApi } from "@/api.js" import { merchant_count_mainApi, merchant_product_rankingApi, merchant_product_visitApi, merchant_product_cartApi, } from "@/api.js"
import { areaObj } from "../store"; import { areaObj } from "../store";
const areaStore = areaObj() const areaStore = areaObj()
let query let query
let userInfo = JSON.parse(localStorage.getItem('TRADE_USER')) let userInfo = JSON.parse(localStorage.getItem('TRADE_USER'))
// console.log
if (areaStore.userInfo.user?.merchant) {
let { area_id, mer_id, street_id } = areaStore.userInfo.user?.merchant
console.log(area_id, 5645545)
query = {
areaCode: area_id,
streetCode: street_id,
mer_id: mer_id
}
}
if (userInfo.user?.merchant) { if (userInfo.user?.merchant) {
let { area_id, mer_id, street_id } = userInfo.user.merchant let { area_id, mer_id, street_id } = userInfo.user.merchant
console.log(area_id, 5645545) console.log(area_id, 5645545)
@ -234,14 +250,14 @@ let total1 = ''
let total2 = '' let total2 = ''
let total3 = '' let total3 = ''
merchant_product_rankingApi( merchant_product_rankingApi(
{ ...query, start_date: '2023-12-01', end_date: '2023-12-09' } { ...query, start_date: '2020-12-18', end_date: '2023-12-18' }
).then(res => { ).then(res => {
total1 = res.data.totalCount total1 = res.data.totalCount
addData1(res.data.list) addData1(res.data.list)
}) })
merchant_product_visitApi( merchant_product_visitApi(
{ ...query, start_date: '2023-12-01', end_date: '2023-12-09' } { ...query, start_date: '2020-12-18', end_date: '2023-12-18' }
).then(res => { ).then(res => {
total2 = res.data.totalCount total2 = res.data.totalCount
@ -249,7 +265,7 @@ merchant_product_visitApi(
}) })
merchant_product_cartApi( merchant_product_cartApi(
{ ...query, start_date: '2023-01-01', end_date: '2023-12-09' } { ...query, start_date: '2020-01-01', end_date: '2023-12-18' }
).then(res => { ).then(res => {
total3 = res.data.totalCount total3 = res.data.totalCount
addData3(res.data.list) addData3(res.data.list)

View File

@ -1,4 +1,11 @@
<template> <template>
<div v-if="show" class="center">
<dv-loading>Loading...</dv-loading>
</div>
<div :style="{ opacity: show ? 0 : 1 }">
<div class="top box"> <div class="top box">
<div class="l"> <div class="l">
<topLeft :code="route.query.code"></topLeft> <topLeft :code="route.query.code"></topLeft>
@ -25,6 +32,7 @@
</div> </div>
</div> </div>
</div>
</template> </template>
<script setup> <script setup>
import { onMounted } from 'vue'; import { onMounted } from 'vue';
@ -35,9 +43,9 @@ import { useRoute } from 'vue-router';
import topCenter from "@/components/townDetail/topCenter.vue" import topCenter from "@/components/townDetail/topCenter.vue"
import topLeft from "@/components/townDetail/topLeft.vue" import topLeft from "@/components/townDetail/topLeft.vue"
import topRight from "@/components/townDetail/topRight.vue" import topRight from "@/components/townDetail/topRight.vue"
import { ref } from 'vue'
const show = ref(true)
const route = useRoute() const route = useRoute()
@ -45,7 +53,9 @@ const route = useRoute()
onMounted(() => { onMounted(() => {
setTimeout(() => {
show.value = false
}, 1000)
}) })
@ -160,4 +170,12 @@ onMounted(() => {
background: linear-gradient(to right, #455CCC, #51C2E0); background: linear-gradient(to right, #455CCC, #51C2E0);
transition: width 0.5s ease-in-out; transition: width 0.5s ease-in-out;
} }
.center {
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
color: white;
}
</style> </style>