dame
This commit is contained in:
parent
9da0771d9d
commit
ea7fc3573a
|
@ -9,6 +9,7 @@ if (localStorage.getItem("TRADE_USER")) {
|
||||||
let userInfo = JSON.parse(localStorage.getItem('TRADE_USER'))
|
let userInfo = JSON.parse(localStorage.getItem('TRADE_USER'))
|
||||||
areaStroe.changeUserInfo(userInfo)
|
areaStroe.changeUserInfo(userInfo)
|
||||||
let { area_code, street_code } = userInfo.user
|
let { area_code, street_code } = userInfo.user
|
||||||
|
console.log(area_code,45454)
|
||||||
areaStroe.changeArea({ areaCode: area_code, streetCode: street_code })
|
areaStroe.changeArea({ areaCode: area_code, streetCode: street_code })
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -127,6 +127,10 @@ const backUrl = ref('/')
|
||||||
watch(
|
watch(
|
||||||
() => route.path,
|
() => route.path,
|
||||||
(value, oldValue) => {
|
(value, oldValue) => {
|
||||||
|
|
||||||
|
|
||||||
|
console.log(value,oldValue)
|
||||||
|
|
||||||
if (value == '/index') {
|
if (value == '/index') {
|
||||||
showFn(0)
|
showFn(0)
|
||||||
area.value = '龙马潭区'
|
area.value = '龙马潭区'
|
||||||
|
|
10
src/main.js
10
src/main.js
|
@ -4,8 +4,8 @@ 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 VueDatePicker from '@vuepic/vue-datepicker';
|
||||||
import '@vuepic/vue-datepicker/dist/main.css'
|
// import '@vuepic/vue-datepicker/dist/main.css'
|
||||||
import {
|
import {
|
||||||
createPinia
|
createPinia
|
||||||
} from 'pinia'
|
} from 'pinia'
|
||||||
|
@ -15,10 +15,8 @@ import 'element-plus/dist/index.css'
|
||||||
import 'amfe-flexible'
|
import 'amfe-flexible'
|
||||||
const pinia = createPinia()
|
const pinia = createPinia()
|
||||||
const app = createApp(App)
|
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(router)
|
||||||
app.use(dataV)
|
app.use(dataV)
|
||||||
app.use(pinia)
|
app.use(pinia)
|
||||||
|
|
|
@ -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.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 +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.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>`,
|
||||||
]
|
]
|
||||||
|
|
|
@ -36,27 +36,11 @@ 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 areaStore = areaObj()
|
const areaStore = areaObj()
|
||||||
console.log(areaStore.areaCodes, 45454)
|
|
||||||
|
|
||||||
|
|
||||||
const areaCodes = reactive({
|
const areaCodes = reactive({
|
||||||
...areaStore.area
|
...areaStore.area
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
const loading = ref(false)
|
const loading = ref(false)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
@keyframes jump {
|
@keyframes jump {
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<el-select v-model="role" placeholder="请选择你的身份" @change="test" :teleported="false" class="select_box">
|
<el-select v-model="role" placeholder="请选择你的身份" @change="test" :teleported="false" class="select_box">
|
||||||
<el-option label="商户" :value="1" />
|
<el-option label="商户" :value="1" />
|
||||||
<el-option label="普通用户" :value="2" />
|
<el-option label="普通用户" :value="2" />
|
||||||
<el-option label="镇" :value="3" />
|
<el-option label="镇" style="display: none;" :value="3" />
|
||||||
</el-select>
|
</el-select>
|
||||||
<div style="color: red;position: absolute;" v-show="isRole">请选择</div>
|
<div style="color: red;position: absolute;" v-show="isRole">请选择</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -45,8 +45,8 @@ const areaStroe = areaObj()
|
||||||
const router = useRouter()
|
const router = useRouter()
|
||||||
const role = ref(null)
|
const role = ref(null)
|
||||||
const show = ref(false)
|
const show = ref(false)
|
||||||
const account = ref('17685151643')
|
const account = ref('叙永镇')
|
||||||
const password = ref('123456')
|
const password = ref('xuyognzheng')
|
||||||
const isAccount = ref(false)
|
const isAccount = ref(false)
|
||||||
const isPassword = ref(false)
|
const isPassword = ref(false)
|
||||||
const isRole = ref(false)
|
const isRole = ref(false)
|
||||||
|
@ -91,46 +91,61 @@ const submit = () => {
|
||||||
account: account.value,
|
account: account.value,
|
||||||
password: password.value
|
password: password.value
|
||||||
}).then(res => {
|
}).then(res => {
|
||||||
res.data.role = role.value
|
|
||||||
localStorage.setItem("TRADE_USER", JSON.stringify(res.data))
|
if (res.data.user.street_code) {
|
||||||
let { area_code, street_code } = res.data.user
|
|
||||||
areaStroe.changeArea({ areaCode: area_code, streetCode: street_code })
|
role.value =3
|
||||||
router.replace('/')
|
|
||||||
|
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) {
|
// if (role.value == 3) {
|
||||||
|
|
||||||
loginApi({
|
// loginApi({
|
||||||
account: account.value,
|
// account: account.value,
|
||||||
password: password.value
|
// password: password.value
|
||||||
}).then(res => {
|
// }).then(res => {
|
||||||
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))
|
||||||
let { area_code, street_code } = res.data.user
|
// let { area_code, street_code } = res.data.user
|
||||||
areaStroe.changeArea({ areaCode: area_code, streetCode: street_code })
|
// areaStroe.changeArea({ areaCode: area_code, streetCode: street_code })
|
||||||
router.replace('/townDetail?code=510524102')
|
// router.replace('/townDetail?code=510524102')
|
||||||
})
|
// })
|
||||||
}
|
// }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const test = () => {
|
const test = () => {
|
||||||
|
|
||||||
if (role.value == 1) {
|
// if (role.value == 1) {
|
||||||
submit()
|
// submit()
|
||||||
}
|
// }
|
||||||
if (role.value == 2) {
|
// if (role.value == 2) {
|
||||||
account.value = '泸县'
|
// account.value = '泸县'
|
||||||
password.value = 'luxain'
|
// password.value = 'luxain'
|
||||||
submit()
|
// submit()
|
||||||
|
|
||||||
}
|
// }
|
||||||
if (role.value == 3) {
|
// if (role.value == 3) {
|
||||||
account.value = '叙永镇'
|
// account.value = '叙永镇'
|
||||||
password.value = 'xuyongzheng'
|
// password.value = 'xuyongzheng'
|
||||||
submit()
|
// submit()
|
||||||
}
|
// }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -153,6 +153,19 @@ import { merchant_count_mainApi, merchant_product_rankingApi, merchant_product_v
|
||||||
import { areaObj } from "../store";
|
import { areaObj } from "../store";
|
||||||
|
|
||||||
const areaStore = areaObj()
|
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 total2 = ''
|
||||||
let total3 = ''
|
let total3 = ''
|
||||||
merchant_product_rankingApi(
|
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 => {
|
).then(res => {
|
||||||
total1 = res.data.totalCount
|
total1 = res.data.totalCount
|
||||||
addData1(res.data.list)
|
addData1(res.data.list)
|
||||||
})
|
})
|
||||||
|
|
||||||
merchant_product_visitApi(
|
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 => {
|
).then(res => {
|
||||||
total2 = res.data.totalCount
|
total2 = res.data.totalCount
|
||||||
|
@ -236,7 +249,7 @@ merchant_product_visitApi(
|
||||||
|
|
||||||
})
|
})
|
||||||
merchant_product_cartApi(
|
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 => {
|
).then(res => {
|
||||||
total3 = res.data.totalCount
|
total3 = res.data.totalCount
|
||||||
addData3(res.data.list)
|
addData3(res.data.list)
|
||||||
|
@ -301,7 +314,7 @@ const addData3 = (data) => {
|
||||||
|
|
||||||
merchant_count_mainApi(
|
merchant_count_mainApi(
|
||||||
|
|
||||||
{ ...areaStore.store }
|
{ ...query }
|
||||||
).then((res) => {
|
).then((res) => {
|
||||||
for (let key in res.data) {
|
for (let key in res.data) {
|
||||||
data[key] = res.data[key]
|
data[key] = res.data[key]
|
||||||
|
|
Loading…
Reference in New Issue