This commit is contained in:
zmj 2023-12-12 09:04:28 +08:00
commit 453cd5822f
7 changed files with 77 additions and 60 deletions

View File

@ -9,6 +9,7 @@ if (localStorage.getItem("TRADE_USER")) {
let userInfo = JSON.parse(localStorage.getItem('TRADE_USER'))
areaStroe.changeUserInfo(userInfo)
let { area_code, street_code } = userInfo.user
console.log(area_code,45454)
areaStroe.changeArea({ areaCode: area_code, streetCode: street_code })
}

View File

@ -127,6 +127,10 @@ const backUrl = ref('/')
watch(
() => route.path,
(value, oldValue) => {
console.log(value,oldValue)
if (value == '/index') {
showFn(0)
area.value = '龙马潭区'

View File

@ -4,8 +4,8 @@ import dataV from '@jiaminghi/data-view'
import router from "./router";
import ElementPlus from 'element-plus'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
import VueDatePicker from '@vuepic/vue-datepicker';
import '@vuepic/vue-datepicker/dist/main.css'
// import VueDatePicker from '@vuepic/vue-datepicker';
// import '@vuepic/vue-datepicker/dist/main.css'
import {
createPinia
} from 'pinia'
@ -15,10 +15,8 @@ import 'element-plus/dist/index.css'
import 'amfe-flexible'
const pinia = createPinia()
const app = createApp(App)
app.component('VueDatePicker', VueDatePicker);
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
app.component(key, component)
}
app.use(router)
app.use(dataV)
app.use(pinia)

View File

@ -73,7 +73,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.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.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;color:#3D9EB5';cursor: pointer;>登录</div>`,
]
@ -89,7 +89,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.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.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;color:#3D9EB5; cursor: pointer;'>登录</div>`,
]

View File

@ -36,25 +36,11 @@ import bottomRight from "@/components/index/bottomRight.vue"
import { areaObj } from '@/store/index.js'
import { useRouter } from "vue-router"
const router = useRouter()
const areaStore = areaObj()
const areaCodes = reactive({
...areaStore.area
})
const loading = ref(false)
</script>
<style lang="scss">
@keyframes jump {

View File

@ -7,7 +7,7 @@
<el-select v-model="role" placeholder="请选择你的身份" @change="test" :teleported="false" class="select_box">
<el-option label="商户" :value="1" />
<el-option label="普通用户" :value="2" />
<el-option label="镇" :value="3" />
<el-option label="镇" style="display: none;" :value="3" />
</el-select>
<div style="color: red;position: absolute;" v-show="isRole">请选择</div>
</div>
@ -45,8 +45,8 @@ const areaStroe = areaObj()
const router = useRouter()
const role = ref(null)
const show = ref(false)
const account = ref('17685151643')
const password = ref('123456')
const account = ref('叙永镇')
const password = ref('xuyognzheng')
const isAccount = ref(false)
const isPassword = ref(false)
const isRole = ref(false)
@ -91,46 +91,61 @@ const submit = () => {
account: account.value,
password: password.value
}).then(res => {
res.data.role = role.value
localStorage.setItem("TRADE_USER", JSON.stringify(res.data))
let { area_code, street_code } = res.data.user
areaStroe.changeArea({ areaCode: area_code, streetCode: street_code })
router.replace('/')
})
}
if (role.value == 3) {
if (res.data.user.street_code) {
role.value =3
loginApi({
account: account.value,
password: password.value
}).then(res => {
res.data.role = role.value
localStorage.setItem("TRADE_USER", JSON.stringify(res.data))
let { area_code, street_code } = res.data.user
areaStroe.changeArea({ areaCode: area_code, streetCode: street_code })
router.replace('/townDetail?code=510524102')
}
else {
res.data.role = role.value
localStorage.setItem("TRADE_USER", JSON.stringify(res.data))
let { area_code, street_code } = res.data.user
areaStroe.changeArea({ areaCode: area_code, streetCode: street_code })
router.replace('/')
}
})
}
// if (role.value == 3) {
// loginApi({
// account: account.value,
// password: password.value
// }).then(res => {
// res.data.role = role.value
// localStorage.setItem("TRADE_USER", JSON.stringify(res.data))
// let { area_code, street_code } = res.data.user
// areaStroe.changeArea({ areaCode: area_code, streetCode: street_code })
// router.replace('/townDetail?code=510524102')
// })
// }
}
const test = () => {
if (role.value == 1) {
submit()
}
if (role.value == 2) {
account.value = '泸县'
password.value = 'luxain'
submit()
// if (role.value == 1) {
// submit()
// }
// if (role.value == 2) {
// account.value = ''
// password.value = 'luxain'
// submit()
}
if (role.value == 3) {
account.value = '叙永镇'
password.value = 'xuyongzheng'
submit()
}
// }
// if (role.value == 3) {
// account.value = ''
// password.value = 'xuyongzheng'
// submit()
// }
}

View File

@ -153,6 +153,19 @@ import { merchant_count_mainApi, merchant_product_rankingApi, merchant_product_v
import { areaObj } from "../store";
const areaStore = areaObj()
let query
let userInfo = JSON.parse(localStorage.getItem('TRADE_USER'))
if (userInfo.user?.merchant) {
let { area_id, mer_id, street_id } = userInfo.user.merchant
console.log(area_id, 5645545)
query = {
areaCode: area_id,
streetCode: street_id,
mer_id: mer_id
}
}
@ -221,14 +234,14 @@ let total1 = ''
let total2 = ''
let total3 = ''
merchant_product_rankingApi(
{ ...areaStore.store, start_date: '2023-12-01', end_date: '2023-12-09' }
{ ...query, start_date: '2023-12-01', end_date: '2023-12-09' }
).then(res => {
total1 = res.data.totalCount
addData1(res.data.list)
})
merchant_product_visitApi(
{ ...areaStore.store, start_date: '2023-12-01', end_date: '2023-12-09' }
{ ...query, start_date: '2023-12-01', end_date: '2023-12-09' }
).then(res => {
total2 = res.data.totalCount
@ -236,7 +249,7 @@ merchant_product_visitApi(
})
merchant_product_cartApi(
{ ...areaStore.store, start_date: '2023-01-01', end_date: '2023-12-09' }
{ ...query, start_date: '2023-01-01', end_date: '2023-12-09' }
).then(res => {
total3 = res.data.totalCount
addData3(res.data.list)
@ -301,7 +314,7 @@ const addData3 = (data) => {
merchant_count_mainApi(
{ ...areaStore.store }
{ ...query }
).then((res) => {
for (let key in res.data) {
data[key] = res.data[key]