Commit 87315ca7 authored by 沈良进's avatar 沈良进

首页搜索条件适配移动端,路由,登录跳转,商品详情打开优化

parent ce3ad935
...@@ -19,6 +19,7 @@ ...@@ -19,6 +19,7 @@
"babel-plugin-transform-remove-console": "^6.9.4", "babel-plugin-transform-remove-console": "^6.9.4",
"dayjs": "^1.11.7", "dayjs": "^1.11.7",
"js-md5": "^0.7.3", "js-md5": "^0.7.3",
"lodash-es": "^4.17.21",
"qrcode.vue": "^1.7.0", "qrcode.vue": "^1.7.0",
"qrcodejs2": "^0.0.2", "qrcodejs2": "^0.0.2",
"quasar": "^1.22.5", "quasar": "^1.22.5",
......
...@@ -196,12 +196,25 @@ Vue.prototype.OpenNewUrl = function(URL) { ...@@ -196,12 +196,25 @@ Vue.prototype.OpenNewUrl = function(URL) {
} }
//公用跳转 //公用跳转
Vue.prototype.CommonJump = function(path, obj) { Vue.prototype.CommonJump = function(path, obj, type = 'push') {
let p = typeof(path) == 'string' ? path : this.$product.genernalUrl(path) let p = typeof(path) == 'string' ? path : this.$product.genernalUrl(path)
this.$router.push({ if(type === 'blank') { // 新窗口打开
path: p, let routeUrl = this.$router.resolve({
query: obj path: p,
}); query: obj
});
window.open(routeUrl.href, '_blank');
} else if (type === 'replace') { // replace
this.$router.replace({
path: p,
query: obj
});
} else if (type === 'push') { // push
this.$router.push({
path: p,
query: obj
});
}
} }
Vue.prototype.$user = user Vue.prototype.$user = user
Vue.prototype.createCalendar = function(dateStr) { Vue.prototype.createCalendar = function(dateStr) {
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
{{ formatEnum(product.ProductType) }} {{ formatEnum(product.ProductType) }}
</div> </div>
</q-img> </q-img>
<div class="ellipsis-2-lines text-body1 q-ma-md cursor-pointer" style="height: 74px;" @click="CommonJump(product,{})">{{ product.Title }}</div> <div class="ellipsis-2-lines text-body1 q-ma-md cursor-pointer" style="height: 74px;" @click="CommonJump(product,{},'blank')">{{ product.Title }}</div>
<div class="text-subtitle2 text-weight-bolder text-dark q-mx-md"> <div class="text-subtitle2 text-weight-bolder text-dark q-mx-md">
<span>CNY {{moneyFormat(product.B2CPrice,2)}}</span> <span>CNY {{moneyFormat(product.B2CPrice,2)}}</span>
<span class="f12 q-ml-sm"></span> <span class="f12 q-ml-sm"></span>
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
</div> </div>
</q-img> </q-img>
<div class="q-px-md col"> <div class="q-px-md col">
<div class="ellipsis-2-lines text-body1 q-ma-md cursor-pointer" style="height:50px;" @click="CommonJump(product,{})">{{ product.Title }}</div> <div class="ellipsis-2-lines text-body1 q-ma-md cursor-pointer" style="height:50px;" @click="CommonJump(product,{},'blank')">{{ product.Title }}</div>
<div class="text-subtitle2 text-weight-bolder text-dark q-mx-md"> <div class="text-subtitle2 text-weight-bolder text-dark q-mx-md">
<span>CNY {{moneyFormat(product.B2CPrice,2)}}</span> <span>CNY {{moneyFormat(product.B2CPrice,2)}}</span>
<span class="f12 q-ml-sm"></span> <span class="f12 q-ml-sm"></span>
......
...@@ -178,7 +178,9 @@ ...@@ -178,7 +178,9 @@
class="zk_toolbar flex justify-between" class="zk_toolbar flex justify-between"
:class="{ 'q-px-none': $q.platform.is.desktop }" :class="{ 'q-px-none': $q.platform.is.desktop }"
> >
<div v-if="$q.platform.is.mobile" @click="showDialog = true">菜单</div> <div class="flex"><div class="f24" v-if="$q.platform.is.mobile && isHome" @click="handleShowDialog">
<i class="iconfont iconmore1" style="font-size: 24px;"></i>
</div>
<img <img
:src="baseData.logo" :src="baseData.logo"
style=" style="
...@@ -189,7 +191,7 @@ ...@@ -189,7 +191,7 @@
" "
class="q-mr-lg q-ml-sm" class="q-mr-lg q-ml-sm"
@click="CommonJump('/index', {})" @click="CommonJump('/index', {})"
/> /></div>
<!-- pc --> <!-- pc -->
<div v-if="$q.platform.is.desktop"> <div v-if="$q.platform.is.desktop">
<q-btn label="繁體中文" flat> <q-btn label="繁體中文" flat>
...@@ -297,17 +299,26 @@ ...@@ -297,17 +299,26 @@
/> />
</div> </div>
</q-toolbar> </q-toolbar>
<city-category v-if="$q.platform.is.desktop" :baseData="baseData" :dataList="dataList"></city-category> <city-category
<q-dialog v-model="showDialog"> v-if="$q.platform.is.desktop"
<city-category-mobile></city-category-mobile></q-dialog> :baseData="baseData"
:dataList="dataList"
></city-category>
<popup @mousemove.prevent id="city-category" v-model="showDialog" mode="bottom" @close="handleDialogClose">
<city-category-mobile @close="showDialog = false"
:baseData="baseData"
:dataList="dataList"
></city-category-mobile
></popup>
</q-header> </q-header>
</template> </template>
<script> <script>
import CityCategoryMobile from './city-category-mobile.vue'; import popup from "../props/index";
import CityCategoryMobile from "./city-category-mobile.vue";
import cityCategory from "./city-category.vue"; import cityCategory from "./city-category.vue";
export default { export default {
components: { cityCategory, CityCategoryMobile }, components: { cityCategory, CityCategoryMobile, popup },
props: { props: {
baseData: { baseData: {
type: Object, type: Object,
...@@ -398,6 +409,19 @@ export default { ...@@ -398,6 +409,19 @@ export default {
// this.getCategoryList(); // this.getCategoryList();
}, },
methods: { methods: {
handler(event) {event.preventDefault();},
handleShowDialog() {
this.showDialog = true;
this.scrollTop = document.querySelector('body').scrollTop;
document.querySelector(
"body"
).style = `position: fixed; top: -${this.scrollTop}px`;
},
handleDialogClose() {
document.querySelector(
"body"
).style = '';},
avatarClick() { avatarClick() {
if (this.LoginUser.token) { if (this.LoginUser.token) {
this.CommonJump("/userCenter"); this.CommonJump("/userCenter");
......
...@@ -733,7 +733,7 @@ this.dayArray = this.dayArray.filter(item => arr.includes(item.id)) ...@@ -733,7 +733,7 @@ this.dayArray = this.dayArray.filter(item => arr.includes(item.id))
// this.msg.dayNumList = arr; // this.msg.dayNumList = arr;
}, },
GotoDetails(item) { GotoDetails(item) {
this.CommonJump(item,{}); this.CommonJump(item,{}, 'blank');
}, },
}, },
}; };
......
...@@ -416,13 +416,22 @@ export default { ...@@ -416,13 +416,22 @@ export default {
// this.getHomeData(); // this.getHomeData();
}, },
mounted() { mounted() {
this.init()
this.timer = setInterval(() => {
this.init()
}, 100)
},
methods: {
init() {
var jObj = JSON.parse(localStorage.getItem("groupinfo")); var jObj = JSON.parse(localStorage.getItem("groupinfo"));
if(jObj) {
this.RB_Group_Id = jObj.GroupId; this.RB_Group_Id = jObj.GroupId;
this.getHomeData(); this.getHomeData();
if(this.timer) {
}, clearInterval(this.timer)
methods: { }
}
},
getHomeData() { getHomeData() {
let locationName = this.GetDomain(); let locationName = this.GetDomain();
var msg = { var msg = {
......
...@@ -44,7 +44,7 @@ export default { ...@@ -44,7 +44,7 @@ export default {
}, },
created() { created() {
this.cityInfo = this.city this.cityInfo = this.city
this.cityInfo.Introduction=this.cityInfo.Introduction.replace(/\n/g,"<br>") this.cityInfo.Introduction=this.cityInfo.Introduction?.replace(/\n/g,"<br>")
}, },
} }
</script> </script>
......
...@@ -261,7 +261,8 @@ export default { ...@@ -261,7 +261,8 @@ export default {
created() {}, created() {},
mounted() { mounted() {
console.log("login", this.$route.query); console.log("login", this.$route.query);
const { code, state } = this.$route.query; const { code, state, path } = this.$route.query;
this.path = path
if (code) { if (code) {
this.fetchLoginInfo(code, state); this.fetchLoginInfo(code, state);
this.isLogin = false; this.isLogin = false;
...@@ -519,7 +520,11 @@ export default { ...@@ -519,7 +520,11 @@ export default {
var jsonData = JSON.stringify(res.data.data); var jsonData = JSON.stringify(res.data.data);
window.localStorage.setItem("b2bUser", jsonData); window.localStorage.setItem("b2bUser", jsonData);
console.log("userInfo", jsonData, res.data.data); console.log("userInfo", jsonData, res.data.data);
if(this.path) {
this.CommonJump(this.path, {});
} else {
this.CommonJump("/index", {}); this.CommonJump("/index", {});
}
} else { } else {
this.$q.notify({ this.$q.notify({
type: "negative", type: "negative",
......
...@@ -57,6 +57,19 @@ background: #FAF9F9; ...@@ -57,6 +57,19 @@ background: #FAF9F9;
border-radius: 9px; border-radius: 9px;
margin: 10px 13px 0 13px; margin: 10px 13px 0 13px;
} }
.order-number {
text-align: center;
position: absolute;
right: 10px;
top: 0;
height: 14px;
width: 14px;
font-size: 9px;
line-height: 14px;
border-radius: 50%;
color: #fff;
background-color: $primary;
}
</style> </style>
<template> <template>
<div class="user-nav-box"> <div class="user-nav-box">
...@@ -84,7 +97,7 @@ margin: 10px 13px 0 13px; ...@@ -84,7 +97,7 @@ margin: 10px 13px 0 13px;
</div> </div>
<div class="bg-white card"> <div class="bg-white card">
<div <div
class="order-item cursor-pointer" class="order-item cursor-pointer relative"
@click="navigateTo(item.key)" @click="navigateTo(item.key)"
v-for="item in orderList" v-for="item in orderList"
:key="item.key" :key="item.key"
...@@ -93,15 +106,15 @@ margin: 10px 13px 0 13px; ...@@ -93,15 +106,15 @@ margin: 10px 13px 0 13px;
<div class="column flex-center"> <div class="column flex-center">
<img class="order-img" :src="require(`../../assets/img/userCenter/${item.icon}.png`)" /> <img class="order-img" :src="require(`../../assets/img/userCenter/${item.icon}.png`)" />
<div>{{ item.label }}</div> <div>{{ item.label }}</div>
<div class="absoulte order-number" v-if="item.number">{{item.number}}</div>
</div> </div>
<!-- <span class="text-primary">{{ item.label }}</span> --> <!-- <span class="text-primary">{{ item.label }}</span> -->
</div> </div>
<div class="flex play-box q-mt-md" v-if="useOrder">
<div class="flex play-box q-mt-md"> <img class="go-play q-mr-md" :src="useOrder.GoodsPic" />
<img class="go-play q-mr-md" src="../../assets/img/userCenter/set.png" />
<div class="f12"> <div class="f12">
<div>即將出行</div> <div>即將出行</div>
<div class="text-grey-6">[2023年3月6日]日本富士山尊享一日遊</div> <div class="text-grey-6">[{{useOrder.UseDate}}]{{useOrder.GoodsName}}</div>
</div> </div>
</div> </div>
</div> </div>
...@@ -143,6 +156,7 @@ export default { ...@@ -143,6 +156,7 @@ export default {
return { return {
selectKey: "", selectKey: "",
LoginUser: {}, LoginUser: {},
useOrder: null,
orderList: [ orderList: [
{ {
icon: "order-pay", icon: "order-pay",
...@@ -221,6 +235,7 @@ export default { ...@@ -221,6 +235,7 @@ export default {
this.selectKey = this.$route.path; this.selectKey = this.$route.path;
if (localStorage.b2bUser) { if (localStorage.b2bUser) {
this.LoginUser = JSON.parse(window.localStorage.getItem("b2bUser")); this.LoginUser = JSON.parse(window.localStorage.getItem("b2bUser"));
this.getUserOrderInfo()
} }
}, },
methods: { methods: {
...@@ -228,6 +243,34 @@ export default { ...@@ -228,6 +243,34 @@ export default {
this.selectKey = route; this.selectKey = route;
this.CommonJump(route, {}); this.CommonJump(route, {});
}, },
getUserOrderInfo() {
this.apipost(
"GetMyOrderNum_post",
{},
(res) => {
if (res.data.resultCode == 1) {
const { NoPayCount, PayCount, RetultList } = res.data.data;
this.useOrder = RetultList[0] ? RetultList[0] : null
this.orderList.forEach(item => {
if(item.label === '待付款') {
item.number = NoPayCount
} else if(item.label === '待出行') {
item.number = PayCount
}
})
} else {
// // this.$notify(res.data.message);
// this.$q.notify({
// type: "negative",
// message: res.data.message,
// position: "top",
// timeout: 2000, // 以毫秒为单位; 0意味着没有超时
// });
}
},
null
);
},
}, },
}; };
</script> </script>
\ No newline at end of file
...@@ -32,9 +32,12 @@ export default function (/* { store, ssrContext } */) { ...@@ -32,9 +32,12 @@ export default function (/* { store, ssrContext } */) {
Router.beforeEach((to, from, next) => { Router.beforeEach((to, from, next) => {
let user = undefined let user = undefined
if(typeof window === 'object') { if(typeof window === 'object') {
if(to.meta.title) {
document.title = to.meta.title
}
user = JSON.parse(window.localStorage.getItem('b2bUser')) user = JSON.parse(window.localStorage.getItem('b2bUser'))
if(to.meta.needLogin && !user) { if(to.meta.needLogin && !user) {
next({path: '/login'}) next({path: '/login?path=' + encodeURIComponent(to.fullPath)})
} else { } else {
next() next()
} }
......
This diff is collapsed.
...@@ -5915,6 +5915,11 @@ locate-path@^5.0.0: ...@@ -5915,6 +5915,11 @@ locate-path@^5.0.0:
dependencies: dependencies:
p-locate "^4.1.0" p-locate "^4.1.0"
lodash-es@^4.17.21:
version "4.17.21"
resolved "https://registry.yarnpkg.com/lodash-es/-/lodash-es-4.17.21.tgz#43e626c46e6591b7750beb2b50117390c609e3ee"
integrity sha512-mKnC+QJ9pWVzv+C4/U3rRsHapFfHvQFoFB92e52xeyGMcX6/OlIl78je1u8vePzYZSkkogMPJ2yjxxsb89cxyw==
lodash._reinterpolate@^3.0.0: lodash._reinterpolate@^3.0.0:
version "3.0.0" version "3.0.0"
resolved "https://registry.npmmirror.com/lodash._reinterpolate/-/lodash._reinterpolate-3.0.0.tgz" resolved "https://registry.npmmirror.com/lodash._reinterpolate/-/lodash._reinterpolate-3.0.0.tgz"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment