Commit 66fd2411 authored by 吴春's avatar 吴春

Merge branch 'master' of http://gitlab.oytour.com/viitto/million

parents f6cbdb70 4844a58a
...@@ -170,7 +170,8 @@ module.exports = function( /* ctx */ ) { ...@@ -170,7 +170,8 @@ module.exports = function( /* ctx */ ) {
'QStep', 'QStep',
'QToggle', 'QToggle',
'QTime', 'QTime',
'QSpace' 'QSpace',
'QInnerLoading'
], ],
directives: [ directives: [
......
...@@ -10,7 +10,7 @@ export default { ...@@ -10,7 +10,7 @@ export default {
}; };
</script> </script>
<style> <style>
@import url("//at.alicdn.com/t/c/font_1890699_l4zj0bx0p69.css"); @import url("//at.alicdn.com/t/c/font_1890699_yrr2mh5n7ln.css");
@font-face { @font-face {
font-family: "oswald"; font-family: "oswald";
src: url("https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/smallapp/Oswald-Regular.ttf"); src: url("https://viitto-1301420277.cos.ap-chengdu.myqcloud.com/smallapp/Oswald-Regular.ttf");
......
<template>
<div class="column full-height">
<div class="col">
<div class="text-right" v-if="$q.platform.is.desktop">
<q-btn
color="primary"
icon="refresh"
label="全部重選"
@click="resetHandler"
flat
/>
</div>
<div class="text-grey-6 f12 q-my-md">選擇門票類型</div>
<div class="row wrap">
<div v-for="(x,i) in dataList.TicketList" :key="i">
<q-chip size="14px" clickable @click="handleSelect(x)"
:text-color="selectedObj&&selectedObj.Id==x.Id?'white':'dark'"
:color="selectedObj&&selectedObj.Id==x.Id?'primary':'grey-3'" square>{{ x.TicketName }}</q-chip>
</div>
</div>
<div class="text-grey-6 f12 q-my-md">選擇數量</div>
<div class="row items-end">
<div class="col" :class="{'column':$q.platform.is.mobile}">
<div v-if="selectedObj">
<span class="text-subtitle2 text-weight-bold">{{selectedObj.TicketName}}</span>
<span class="text-grey-6 f12 q-ml-sm"></span>(1人/票)</span>
</div>
<div v-if="$q.platform.is.mobile">
<span class="text-grey-7 product-price" style="font-size: 13px">
CNY {{ moneyFormat(p.originalB2CPrice, 0) }} /每票
</span>
</div>
</div>
<div class="row items-end">
<span v-if="$q.platform.is.desktop" class="text-grey-7 product-price" style="font-size: 13px">
CNY {{ moneyFormat(p.originalB2CPrice, 0) }} /每票
</span>
<q-input
style="width: 150px"
@input="changePeople"
v-model="chosenObj.Count"
class="col"
:class="{
'q-ml-sm q-px-none q-pl-none': $q.platform.is.desktop,
}"
mask="#"
reverse-fill-mask
dense
standout
readonly
>
<template v-slot:prepend>
<q-btn
color="primary"
size="sm"
class="q-px-none"
flat
icon="remove"
@click="addPeople('Count', -1)"
/>
</template>
<template v-slot:append>
<q-btn
color="primary"
size="sm"
class="q-px-none"
flat
icon="add"
@click="addPeople('Count', 1)"
/>
</template>
</q-input>
</div>
</div>
</div>
<div class="q-mt-md q-pt-md" style="border-top: 1px dashed #eee">
<div class="row items-center">
<span class="text-subtitle2 text-grey-6 col">總金額</span>
<span class="text-h6 text-primary product-price">CNY {{ moneyFormat(sumPrice,0) }}</span>
</div>
<div class="q-mt-md text-right"
:class="{'row wrap justify-end items-start':$q.platform.is.mobile}">
<span :class="{'col-12 q-mb-sm':$q.platform.is.mobile}">
<span class="f12 text-negative" v-if="!p.startDate"
:class="{'q-mr-lg':$q.platform.is.desktop}">
{{$q.platform.is.mobile?'請選擇上面的出行日期':'請選擇左側的出行日期'}}
</span>
<span class="f12 text-negative"
:class="{'q-mr-lg':$q.platform.is.desktop}"
v-if="p.startDate&&!selectedObj">
{{`請選擇上面的門票類型`}}
</span>
</span>
<q-btn color="primary" label="立即訂購" unelevated class="q-px-lg"
:disable="sumPrice==0||!selectedObj"
@click="goOrderHandler"/>
</div>
</div>
</div>
</template>
<script>
import { date } from "quasar";
export default {
props: ["dataList","price","configId","Month"],
watch: {
price: {
handler(n, o) {
this.p = n;
if(n&&n.startDate){
this.chosenObj.startDate = n.startDate;
}
this.calcMoney()
},
deep: true,
immediate: false
},
dataList: {
handler(n, o) {
this.dataList = n;
},
deep: true,
immediate: true
},
},
data() {
return {
p: {},
chosenObj: null,
sumPrice:0,
selectedObj: null,
priceList: [],
};
},
created() {
this.initModel();
if(this.p.startDate){
this.chosenObj.startDate = this.p.startDate;
this.calcMoney()
this.getCarPriceData2()
}
},
methods: {
goOrderHandler(){
let order = {
CouponsId: this.configId,
TicketId: this.selectedObj.Id,
Month: this.Month,
startDate: this.p.startDate,
originalB2CPrice: this.p.originalB2CPrice,
orderInfo: this.chosenObj,
}
let key = this.$md5(JSON.stringify(order))
let pickuporderScenTickets = localStorage.getItem('pickuporderScenTickets')
pickuporderScenTickets = pickuporderScenTickets?JSON.parse(pickuporderScenTickets):[]
pickuporderScenTickets.push({
key,
order
})
localStorage.setItem("pickuporderScenTickets",JSON.stringify(pickuporderScenTickets))
this.CommonJump('/PickuporderForm/'+key, {});
},
// 获取报价的详情
getCarPriceData2() {
this.priceList = []
this.apipost(
"b2c_get_GetTicketCouponsMonthPrice",
{
CouponsId: this.configId,
TicketId: this.selectedObj.Id,
Month: this.Month,
},
(r) => {
if (r.data.resultCode == 1) {
let arr = []
r.data.data.forEach(x=>{
if(x.Price){
if(this.chosenObj.startDate==x.Date){
this.p.originalB2CPrice = x.Price
}
let dataObj = {
startDate: x.Date,
originalB2CPrice: x.Price,
remainNum: 1,
Count: 1,
isSupportChildren: 1,
safeMoney: 0,
}
if(date.formatDate(Date.now(), 'YYYY-MM-DD')!=x.Date&&x.Date>date.formatDate(Date.now(), 'YYYY-MM-DD')){
arr.push(dataObj)
}
}
})
const temp= JSON.parse(JSON.stringify(r.data.data))
let PriceArr = temp.filter(x=>{ return x.Price>0 })
if(PriceArr.length>0){
this.$emit('getPriceList',JSON.stringify(arr),this.selectedObj.Id)
}else{
let dataObj = {
startDate: '',
originalB2CPrice: '',
remainNum: 0,
Count: 0,
safeMoney: 0,
PeopleNum: 1
}
this.priceList.push(dataObj)
this.$emit('getPriceList',JSON.stringify(this.priceList),this.selectedObj.Id)
this.p.originalB2CPrice = 0
this.resetHandler()
}
}
},null)
},
handleSelect(item){
this.selectedObj = item
setTimeout(()=>{
this.getCarPriceData2()
},100)
},
initModel() {
this.sumPrice=0
this.chosenObj = {
startDate: "",
Count: 1,
remark: "",
};
},
resetHandler(type) {
if(type){
this.selectedObj = null
}
setTimeout(()=>{
this.p = {};
this.initModel()
},100)
this.$emit("reset");
},
changePeople(val) {},
addPeople(m, i, isDf = false) {
this.chosenObj[m] = parseInt(this.chosenObj[m]) + i;
if(m!='Count'){
this.chosenObj[m] = this.chosenObj[m] < 0 ? 0 : this.chosenObj[m]++;
}else{
this.chosenObj[m] = this.chosenObj[m] < 1 ? 1 : this.chosenObj[m]++;
}
this.calcMoney()
},
calcMoney() {
if (!this.p) return;
let money = this.p.originalB2CPrice * this.chosenObj.Count;
this.sumPrice = money;
},
},
};
</script>
<style></style>
...@@ -121,6 +121,17 @@ export default { ...@@ -121,6 +121,17 @@ export default {
if(this.chosenCouponId.length>1){ if(this.chosenCouponId.length>1){
this.chosenCouponId.splice(0,1) this.chosenCouponId.splice(0,1)
} }
let t= null
if(this.chosenCouponId.length==1){
t=this.coupons.find(x=>x.couponId==this.chosenCouponId[0])
if(t.couponsType==1){
t.discountMoney=t.denomination
}else{
t.discountMoney=((1-parseFloat(t.denomination)/10.0)*parseFloat(this.currentPrice)).toFixed(2)
}
}
console.log(t)
this.$emit("change",t)
}, },
getProductCouponHandler(){ getProductCouponHandler(){
this.apiJavaPost( this.apiJavaPost(
......
<template>
<div class="flex flex-center">
<div>
<img class="img" src="../assets/img/none.png">
<div class="text">{{text}}</div>
</div>
</div>
</template>
<style scoped>
.img {
width: 267px;
height: 150px;
}
.text {
text-align: center;
}
</style>
<script>
export default {
props: {
text: {
default: '暂无数据'
}
},
data() {
return {
inputSelect: false
}
},
}
</script>
\ No newline at end of file
<template>
<div>
<q-dialog v-model="$q.platform.is.desktop" persistent>
<q-card flat class="q-pa-lg" style="width:600px !important;max-width:600px !important">
<div class="text-h6 text-weight-bold q-mb-lg">微信支付</div>
<div class="text-center">
<q-inner-loading :showing="loading" label="正在加載中"></q-inner-loading>
<div v-if="$q.platform.is.desktop && orderNo && payUrl!='' && !loading">
<div class="row justify-center">
<QrcodeVue level="H" size="200" :value="payUrl" class="light-shadow"></QrcodeVue>
<img src="../../assets/img/pay/wx_tip.jpg" class="q-ml-md" style="height:200px;">
</div>
<div class="text-body2 q-mt-lg text-grey-6">請打開微信(WeChat),使用 [掃一掃]掃描上方二維碼進行支付</div>
<div class="q-mt-lg text-right">
<q-btn outline dense label="取消支付" color="primary" class="q-px-md q-mr-md" @click="cancelPayHandler"></q-btn>
<q-btn unelevated dense label="已完成付款" :loading="checkLoading" color="primary" class="q-px-md" @click="checkPaySatausHandler"></q-btn>
</div>
</div>
<div class="q-ma-xl" v-if="!orderNo && !loading">
創建付款連接失敗,請刷新頁面重試
</div>
</div>
</q-card>
</q-dialog>
</div>
</template>
<script>
import QrcodeVue from 'qrcode.vue'
export default {
data() {
return {
loading:true,
showDialog:true,
payUrl:'weixin://wxpay/bizpayurl?pr=CDXqaD1zz',
checkLoading:false
}
},
props:{
orderNo:{
type:String,
required:true
}
},
components:{QrcodeVue},
created () {
if(this.orderNo){
this.initPayInfo()
}else{
this.loading=false
}
},
methods: {
initPayInfo(){
this.apipost("GetCodeByOrderNo_post",{OrderNo:this.orderNo},r=>{
if(r.data.resultCode==1){
this.payUrl = r.data.data.code_url
if(this.$q.platform.is.mobile){
location.href=this.payUrl
}
}
this.loading=false
})
},
checkPaySatausHandler(){
this.checkLoading=true
this.apipost("GetDetailsByOrderNo_post",{OrderNo:this.orderNo},r=>{
if(r.data.resultCode==1){
if(r.data.data.OrderStatus==2||r.data.data.OrderStatus==3){
this.CommonJump("/paysuccess/" + this.orderNo, {});
}else{
this.$message.error("當前訂單未支付,請您繼續完成訂單支付")
}
}else{
location.reload()
}
this.checkLoading=false
},e=>{
this.checkLoading=false
})
},
cancelPayHandler(){
this.$emit("cancel")
}
},
}
</script>
<style>
</style>
\ No newline at end of file
...@@ -745,6 +745,12 @@ this.dayArray = this.dayArray.filter(item => arr.includes(item.id)) ...@@ -745,6 +745,12 @@ this.dayArray = this.dayArray.filter(item => arr.includes(item.id))
{} {}
); );
return return
}else if(item.productType === 2) { // 景区门票
this.CommonJump(
"/detailsScenicSpotTicket/"+item.configId,
{}
);
return
} }
this.CommonJump( this.CommonJump(
"/detail/" + encodeURIComponent(item.id) + "/" + item.tcid + "/" + item.configId, "/detail/" + encodeURIComponent(item.id) + "/" + item.tcid + "/" + item.configId,
......
...@@ -72,6 +72,7 @@ export default { ...@@ -72,6 +72,7 @@ export default {
methods: { methods: {
formatTeam(){ formatTeam(){
let p = this.trip.priceList[0] let p = this.trip.priceList[0]
if(!p) return
let t = p.priceTeamType??1 let t = p.priceTeamType??1
t=t==0?1:t t=t==0?1:t
if(t==1){ if(t==1){
......
...@@ -141,4 +141,7 @@ ...@@ -141,4 +141,7 @@
color: #2D90FF; color: #2D90FF;
margin:0 20px; margin:0 20px;
cursor: pointer; cursor: pointer;
}
.border-b {
border-bottom: 1px solid #eee;
} }
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
...@@ -132,11 +132,10 @@ ...@@ -132,11 +132,10 @@
class="q-mr-sm" class="q-mr-sm"
/> />
<span <span
>日本 - v-for="(x, i) in dataList.CityList2" :key="i">{{x.CountryName}} -
<span>
<span v-for="(x, i) in citys" :key="i"> <span class="cursor-pointer">{{ x.CityName }} </span>
<span class="cursor-pointer">{{ x }} </span> <span v-if="i + 1 != dataList.CityList2.length" class="q-mr-sm">,</span>
<span v-if="i + 1 != citys.length" class="q-mr-sm">,</span>
</span> </span>
</span> </span>
</div> </div>
...@@ -1011,7 +1010,6 @@ export default { ...@@ -1011,7 +1010,6 @@ export default {
originalB2CPrice: x.Price, originalB2CPrice: x.Price,
remainNum: 1, remainNum: 1,
Count: 1, Count: 1,
isSupportChildren: 1,
safeMoney: 0, safeMoney: 0,
} }
if(date.formatDate(Date.now(), 'YYYY-MM-DD')!=x.Date){ if(date.formatDate(Date.now(), 'YYYY-MM-DD')!=x.Date){
...@@ -1025,69 +1023,6 @@ export default { ...@@ -1025,69 +1023,6 @@ export default {
},null) },null)
}, },
getCarPriceData() {
this.$q.loading.show();
this.apipost(
"b2c_get_GetCarSingleProductMonthPriceAll",
{ ProductId: this.msg.configId, Month: this.currentYM.str },
(r) => {
let list = [[]];
let y = 0; // 元素纵向下标
let day = 0;
if (r.data.resultCode == 1) {
let week = dayjs(this.currentYM.str + "-01").day();
console.log("week", week);
list[0].length = week;
const isCurrent =
this.currentYM.year === dayjs().year() &&
this.currentYM.month === dayjs().month() + 1;
this.isCurrent = isCurrent;
this.isLast = this.currentYM.year === dayjs().year() +1 &&
this.currentYM.month === dayjs().month() + 1;
// 如果是当前月
if (isCurrent) {
let days = dayjs(r.data.data[0].Date).date();
day = days;
for (let i = 1; i <= days; i++) {
list[y].push({
day: i,
disabled: true,
});
week++;
if (week === 7) {
week = 0;
y++;
list[y] = [];
}
}
}
r.data.data.forEach((item) => {
list[y].push({
...item,
day: ++day,
});
week++;
if (week === 7) {
week = 0;
y++;
list[y] = [];
}
});
this.daysList = list;
console.log("list", list);
} else {
this.$q.notify({
type: "negative",
message: r.data.message,
position: "top",
timeout: 2000, // 以毫秒为单位; 0意味着没有超时
});
}
this.$q.loading.hide();
},
null
);
},
menu() { menu() {
this.scroll = this.scroll =
document.documentElement.scrollTop || document.body.scrollTop; document.documentElement.scrollTop || document.body.scrollTop;
......
...@@ -196,7 +196,7 @@ ...@@ -196,7 +196,7 @@
/> />
</div> </div>
</div> </div>
<div class="q-mt-lg"> <div class="q-mt-lg" v-if="dataList.productRecommend">
<div <div
class="q-mt-sm" class="q-mt-sm"
v-for="(x, i) in dataList.productRecommend.split('\n')" v-for="(x, i) in dataList.productRecommend.split('\n')"
...@@ -388,7 +388,7 @@ ...@@ -388,7 +388,7 @@
<div <div
class="col q-ml-xl position-relative" class="col q-ml-xl position-relative"
v-if=" v-if="
(!(dataList.priceList && dataList.priceList[0].teamType==2)&&!(dataList.currentPrice && dataList.currentPrice.teamType==2)) && dataList.priceList.length>0&&(!(dataList.priceList && dataList.priceList[0].teamType==2)&&!(dataList.currentPrice && dataList.currentPrice.teamType==2)) &&
currentHeight > days[0].top - 60 && currentHeight > days[0].top - 60 &&
currentHeight < navs[2].top && currentHeight < navs[2].top &&
$q.platform.is.desktop $q.platform.is.desktop
...@@ -452,7 +452,7 @@ ...@@ -452,7 +452,7 @@
'q-px-md': $q.screen.width < 1220 && $q.platform.is.desktop, 'q-px-md': $q.screen.width < 1220 && $q.platform.is.desktop,
}" }"
></smaple> ></smaple>
<template v-if="(dataList.priceList && dataList.priceList[0].teamType==2)||(dataList.currentPrice && dataList.currentPrice.teamType==2)"> <template v-if="dataList.priceList.length>0&&(dataList.priceList && dataList.priceList[0].teamType==2)||(dataList.currentPrice && dataList.currentPrice.teamType==2)">
<trip :trip="dataList" @change="changeTripShowHandler"></trip> <trip :trip="dataList" @change="changeTripShowHandler"></trip>
</template> </template>
<template v-else> <template v-else>
......
This diff is collapsed.
<template>
<div class="content-page order-preview">
<q-stepper
v-model="step"
ref="stepper"
color="primary"
inactive-color="grey-5 "
done-color="primary"
class="bg-transparent"
flat
animated
>
<q-step
:name="1"
title="確認訂單"
icon="settings"
:done="step > 1"
></q-step>
<q-step
:name="2"
title="付款"
icon="iconfont iconPayment-1"
:done="step > 2"
></q-step>
<q-step
:name="3"
title="訂購完成"
icon="iconfont iconicon_finish_R"
:done="step == 3"
></q-step>
</q-stepper>
</div>
</template>
<script>
export default {
data() {
return {
step:2
}
},
}
</script>
<style>
</style>
\ No newline at end of file
<template>
<div class="content-page order-preview order-pay-page" style="min-height:80vh;">
<q-stepper
v-model="step"
ref="stepper"
color="primary"
inactive-color="grey-5 "
done-color="primary"
class="bg-transparent"
flat
animated
>
<q-step
:name="1"
title="確認訂單"
icon="settings"
:done="step > 1"
></q-step>
<q-step
:name="2"
title="付款"
icon="iconfont iconPayment-1"
:done="step > 2"
></q-step>
<q-step
:name="3"
title="訂購完成"
icon="iconfont iconicon_finish_R"
:done="step == 3"
></q-step>
</q-stepper>
<q-inner-loading :showing="loading" label="正在加載中"></q-inner-loading>
<div v-if="!loading && orderInfo" :class="{ 'q-mx-md': $q.platform.is.mobile }">
<q-banner
class="bg-orange-2 text-orange"
rounded
dense
>我們將會在您下單後為您鎖定空位。若您未能在半小時內完成支付,我們將自動取消訂單並且釋放位置。</q-banner
>
<div class="q-my-xl text-center" v-if="orderInfo.OrderStatus==1">
<span class="text-body1">待支付金額:</span>
<span class="text-h3 q-ml-sm text-dark text-weight-bold">{{(moneyFormat(orderInfo.TotalPrice,2))}}</span>
</div>
<div class="q-my-xl text-center" v-else>
<span class="text-h3 q-ml-sm text-dark text-weight-bold">
{{ orderInfo.OrderStatus==2||orderInfo.OrderStatus==3?'已支付成功':'訂單已取消' }}
</span>
</div>
<q-card flat class="q-pa-md" v-if="orderInfo.OrderStatus==1">
<div class="row q-mb-md items-center">
<div class="col text-h6 text-weight-bolder">支付方式</div>
</div>
<div class="row q-gutter-md">
<div
class="rounded-borders q-pa-sm bg-grey-2 cursor-pointer"
:class="{
'pay-active': showPay == 'wechat',
'pay-un-active': showPay != 'wechat',
}"
@click="showPayFormHandler('wechat')"
>
<q-img
src="../../assets/img/pay/wepay.png"
spinner-color="white"
style="width: 100px"
/>
</div>
<!-- <div class="rounded-borders q-pa-sm bg-grey-2 cursor-pointer">
<q-img src="../assets/img/pay/alipay.png" spinner-color="white" style="height:25px;max-width: 150px;min-width: 30px" />
</div> -->
</div>
<div class="q-mt-md" v-if="showPay != ''">
<wechatpay @cancel="cancelPayHandler" v-if="showPay == 'wechat'" :order-no="orderNo"></wechatpay>
</div>
</q-card>
<q-card flat class="q-pa-md q-my-xl">
<div class="row q-mb-md items-center">
<div class="col text-h6 text-weight-bolder">訂單資訊</div>
<div class="text-grey-5"># {{ orderNo }}</div>
</div>
<div class="row">
<q-img
:src="orderInfo.GoodsPic"
class="rounded-borders q-mr-md"
spinner-color="grey-2"
style="width: 150px"
/>
<div class="col">
<div class="text-body1 ellipsis">{{ orderInfo.GoodsName }}</div>
<div class="q-mt-sm text-grey-6">{{ orderInfo.OrderMake }}</div>
<div class="q-mt-sm text-dark">
聯絡訊息:{{orderInfo.Name}}/{{ orderInfo.SurName }} {{ orderInfo.ContactNumber }} {{ orderInfo.Mailbox }}
</div>
</div>
</div>
</q-card>
</div>
<div v-if="(!orderNo || orderNo == '') && !loading" class="text-center q-my-xl">
<none-data
iconType="order"
title="沒有找到您的訂單信息哦"
subtitle="趕緊去挑選心儀的旅遊產品吧,三秒後自動跳轉到首頁"
></none-data>
</div>
</div>
</template>
<script>
import wechatpay from "../../components/pay/wepay";
import NoneData from "src/components/common/noneData.vue";
export default {
data() {
return {
step: 2,
showPay: "",
orderNo: "",
loading:true,
orderInfo:null
};
},
components: { wechatpay,NoneData },
created() {
this.checkParamsHandler()
},
methods: {
showPayFormHandler(payStr) {
this.showPay = payStr;
},
checkParamsHandler() {
if (this.$route.params && this.$route.params.id) {
this.getOrderInfoHandler(this.$route.params.id)
}else{
this.goHomeHandler()
}
},
getOrderInfoHandler(OrderNo){
this.apipost("GetDetailsByOrderNo_post",{OrderNo},r=>{
if(r.data.resultCode==1){
this.orderNo=OrderNo
this.orderInfo=r.data.data
this.loading=false
}else{
this.goHomeHandler()
}
})
},
goHomeHandler(){
this.loading=false
// setTimeout(() => {
// location.href = location.origin;
// }, 3000);
},
cancelPayHandler(){
this.showPay=''
location.reload()
}
},
};
</script>
<style>
.order-pay-page .q-stepper__content {
display: none !important;
}
.pay-active {
border: 2px solid var(--q-color-primary);
}
.pay-un-active {
border: 2px solid #f5f5f5;
}
</style>
<template>
<div class="content-page order-preview" style="min-height:60vh;">
<q-stepper v-model="step" ref="stepper" color="primary" inactive-color="grey-5 " done-color="primary" class="bg-transparent" flat animated>
<q-step :name="1" title="確認訂單" icon="settings" :done="step > 1"></q-step>
<q-step :name="2" title="付款" icon="iconfont iconPayment-1" :done="step > 2"></q-step>
<q-step :name="3" title="訂購完成" icon="iconfont iconicon_finish_R" :done="step == 3"></q-step>
</q-stepper>
<q-inner-loading :showing="loading" label="正在加載中"></q-inner-loading>
<q-card flat class="q-pa-lg q-mb-lg" :class="{ 'q-mx-md': $q.platform.is.mobile }" v-if="!loading && orderInfo">
<div style="width:350px;margin:0 auto;">
<div class="row items-center">
<q-icon name="iconfont iconsuccess" color="positive" size="40px"></q-icon>
<span class="q-ml-lg text-subtitle1">支付成功</span>
</div>
<div class="q-mt-lg">
<div class="row">
<div style="width:80px;" class="text-subtitle2">商品訂單:</div>
<div class="q-ml-md text-grey-6">{{ orderNo }}</div>
</div>
<div class="row q-mt-md">
<div style="width:80px;padding-top:5px;" class="text-subtitle2">支付金額:</div>
<div class="q-ml-md col">
<div class="row items-center">
<span class="text-positive text-subtitle1 col">CNY 8960.00</span>
<div class="text-grey-6 q-mr-sm cursor-pointer" @click="$event=>isExplends=!isExplends">訂單詳情</div>
<q-icon :name="isExplends?'keyboard_arrow_up':'keyboard_arrow_down'" @click="$event=>isExplends=!isExplends" size="14px" color="grey-6" class="cursor-pointer" />
</div>
<div v-if="isExplends">
<div class="q-mt-md text-grey-6">商品名称: {{ orderInfo.GoodsName }}</div>
<div class="q-mt-md text-grey-6">出行摘要: {{ orderInfo.OrderMake }}</div>
<div class="q-mt-md text-grey-6">应付金额: CNY {{(moneyFormat(orderInfo.TotalPrice,2))}}</div>
<div class="q-mt-md text-grey-6">购买时间: {{ orderInfo.CreateTime }}</div>
</div>
</div>
</div>
</div>
<div class="q-mt-lg">
<q-btn unelevated dense color="primary" label="回到首頁" @click="CommonJump('/',{})" class="q-px-md"></q-btn>
</div>
</div>
</q-card>
<div v-if="(!orderNo || orderNo == '') && !loading" class="text-center q-my-xl">
<none-data iconType="order" title="沒有找到您的訂單信息哦" subtitle="趕緊去挑選心儀的旅遊產品吧,三秒後自動跳轉到首頁"></none-data>
</div>
</div>
</template>
<script>
import { date } from "quasar";
export default {
data() {
return {
step: 3,
orderNo: "",
loading: true,
orderInfo: null,
isExplends: false
};
},
created() {
this.checkParamsHandler()
},
methods: {
showPayFormHandler(payStr) {
this.showPay = payStr;
},
checkParamsHandler() {
if (this.$route.params && this.$route.params.id) {
this.getOrderInfoHandler(this.$route.params.id)
} else {
this.goHomeHandler()
}
},
getOrderInfoHandler(OrderNo) {
this.apipost("GetDetailsByOrderNo_post", { OrderNo }, r => {
if (r.data.resultCode == 1) {
this.orderNo = OrderNo
this.orderInfo = r.data.data
this.orderInfo.CreateTime = date.formatDate(this.orderInfo.CreateTime.replaceAll('T',' '),'YYYY年MM月DD日 HH時mm分')
this.loading = false
if(this.orderInfo.OrderStatus!=2 ||this.orderInfo.OrderStatus!=3){
this.CommonJump("/pay/" + this.orderNo, {});
}
} else {
this.goHomeHandler()
}
})
},
goHomeHandler() {
this.loading = false
// setTimeout(() => {
// location.href = location.origin;
// }, 3000);
}
},
}
</script>
<style>
.order-pay-page .q-stepper__content {
display: none !important;
}
</style>
\ No newline at end of file
...@@ -12,7 +12,14 @@ ...@@ -12,7 +12,14 @@
display: block; display: block;
} }
.nav-item { .nav-item {
padding: 10px 30px; margin: 10px 28px;
padding: 10px;
}
.select {
height: 41px;
background: #F43849;
border-radius: 8px;
color: #ffffff;
} }
</style> </style>
<template> <template>
...@@ -29,12 +36,13 @@ ...@@ -29,12 +36,13 @@
@click="navigateTo(item.key)" @click="navigateTo(item.key)"
v-for="item in menuList" v-for="item in menuList"
:key="item.key" :key="item.key"
:class="{'select': selectKey === item.key}"
> >
<div class="flex items-center"> <div class="flex items-center">
<i class="iconfont icontime"></i> <i class="iconfont" :class="item.icon"></i>
<span class="q-ml-lg">{{ item.label }}</span> <span class="q-ml-lg">{{ item.label }}</span>
</div> </div>
<span class="text-primary">{{ item.label }}</span> <!-- <span class="text-primary">{{ item.label }}</span> -->
</div> </div>
</div> </div>
</div> </div>
...@@ -44,9 +52,10 @@ ...@@ -44,9 +52,10 @@
@click="navigateTo(item.key)" @click="navigateTo(item.key)"
v-for="item in menuList2" v-for="item in menuList2"
:key="item.key" :key="item.key"
:class="{'select': selectKey === item.key}"
> >
<div class="flex items-center"> <div class="flex items-center">
<i class="iconfont icontime"></i> <i class="iconfont" :class="item.icon"></i>
<span class="q-ml-lg">{{ item.label }}</span> <span class="q-ml-lg">{{ item.label }}</span>
</div> </div>
<!-- <span class="text-primary">{{item.label}}</span> --> <!-- <span class="text-primary">{{item.label}}</span> -->
...@@ -58,28 +67,29 @@ ...@@ -58,28 +67,29 @@
export default { export default {
data() { data() {
return { return {
selectKey: '',
LoginUser: {}, LoginUser: {},
menuList: [ menuList: [
{ {
icon: "", icon: "iconqianbao",
key: "/coupon", key: "/coupon",
label: "可用優惠券", label: "可用優惠券",
number: "", number: "",
}, },
{ {
icon: "", icon: "iconorder",
key: "/order", key: "/order",
label: "訂單", label: "訂單",
number: "", number: "",
}, },
{ {
icon: "", icon: "iconmessage",
key: "", key: "",
label: "我的评价", label: "我的评价",
number: "", number: "",
}, },
{ {
icon: "", icon: "iconmoney-credit-card",
key: "/payInfo", key: "/payInfo",
label: "支付管理", label: "支付管理",
number: "", number: "",
...@@ -87,25 +97,25 @@ export default { ...@@ -87,25 +97,25 @@ export default {
], ],
menuList2: [ menuList2: [
{ {
icon: "", icon: "iconpeople1",
key: "/setUsersList", key: "/setUsersList",
label: "出行人信息管理", label: "出行人信息管理",
number: "", number: "",
}, },
{ {
icon: "", icon: "iconemail",
key: "/setAddress", key: "/setAddress",
label: "管理邮寄地址", label: "管理邮寄地址",
number: "", number: "",
}, },
{ {
icon: "", icon: "iconcomputer",
key: "/loginInfo", key: "/loginInfo",
label: "登录方式管理", label: "登录方式管理",
number: "", number: "",
}, },
{ {
icon: "", icon: "iconset",
key: "/setInfo", key: "/setInfo",
label: "账户设置", label: "账户设置",
number: "", number: "",
...@@ -114,13 +124,14 @@ export default { ...@@ -114,13 +124,14 @@ export default {
}; };
}, },
mounted() { mounted() {
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"));
} }
}, },
methods: { methods: {
navigateTo(route) { navigateTo(route) {
console.log("usercenter navigateTo", route); this.selectKey= route
this.CommonJump(route, {}); this.CommonJump(route, {});
}, },
}, },
......
...@@ -15,6 +15,13 @@ ...@@ -15,6 +15,13 @@
padding: 0 35px; padding: 0 35px;
line-height: 42px; line-height: 42px;
} }
.bg-grey {
background: #aaa;
border-radius: 8px 8px 0 0;
.use {
color: #fff !important;
}
}
.bg-blue { .bg-blue {
background: #70b1fa; background: #70b1fa;
border-radius: 8px 8px 0 0; border-radius: 8px 8px 0 0;
...@@ -26,21 +33,21 @@ ...@@ -26,21 +33,21 @@
background: #ee727d; background: #ee727d;
border-radius: 8px 8px 0 0; border-radius: 8px 8px 0 0;
.use { .use {
color: #6F242B; color: #6f242b;
} }
} }
.bg-yellow { .bg-yellow {
background: #f2c16b; background: #f2c16b;
border-radius: 8px 8px 0 0; border-radius: 8px 8px 0 0;
.use { .use {
color: #8A5D10; color: #8a5d10;
} }
} }
.bg-green { .bg-green {
background: #67cac2; background: #67cac2;
border-radius: 8px 8px 0 0; border-radius: 8px 8px 0 0;
.use { .use {
color: #195954 ; color: #195954;
} }
} }
.card { .card {
...@@ -64,8 +71,32 @@ ...@@ -64,8 +71,32 @@
} }
.img { .img {
width: 201px; width: 201px;
margin-bottom: -6px; margin-bottom: -6px;
} }
.deadline {
width: 68px;
height: 68px;
background: #ffea01;
border-radius: 8px 0 0 0;
clip-path: polygon(0 0, 0% 100%, 100% 0);
.text {
transform: translate(-5px, 10px) rotate(315deg);
}
}
.circle {
width: 24px;
height: 10px;
left: 88px;
border-radius: 0 0 14px 14px;
background: #f9f9f9;
}
// .circle:after {
// content: '.';
// display: block;
// height: 0;
// clear: both;
// visibility: hidden;
// }
</style> </style>
<template> <template>
<div class="content q-ma-lg bg-white"> <div class="content q-ma-lg bg-white">
...@@ -74,73 +105,152 @@ ...@@ -74,73 +105,152 @@
<div <div
@click="changeCouponType(item)" @click="changeCouponType(item)"
class="nav-item cursor-pointer" class="nav-item cursor-pointer"
v-for="item in ['可使用', '已使用', '已过期']" v-for="item in statusMap"
:key="item" :key="item.key"
> >
{{ item }} {{ item.label }}
<div :class="selectedKey === item ? 'border-bottom' : ''"></div> <div :class="CouponTimeStatus === item.key ? 'border-bottom' : ''"></div>
</div> </div>
</div> </div>
<div class="flex flex-wrap"> <div class="flex flex-wrap">
<div class="card" v-for="item in 10" :key="item"> <div class="card" v-for="item in couponList" :key="item.id">
<div class="bg-blue"> <div class="bg-blue relative" :class="[colorMap[item.couponsUseScope], {'bg-grey': CouponTimeStatus !== 1}]">
<div class="white text-center f16 q-pt-sm">CYN</div> <div v-if="item.IsEnd" class="absolute deadline">
<div class="white text-center f26">10</div> <div class="text f12">即將過期</div>
</div>
<div class="absolute circle"></div>
<div class="white text-center f16 q-pt-lg">CYN</div>
<div class="white text-center f26">{{ item.denomination }}</div>
<div class="white text-center"> <div class="white text-center">
<span>限用品類:</span><span>滿2000可用</span> <span>{{ item.useCondition }}可用</span>
</div> </div>
<div class="use text-center q-pb-sm"> <div class="use text-center q-pt-sm">
<span>限用品類:</span><span>滿2000可用</span> <span>{{ item.effectDate }}</span
>-<span>{{ item.expirationDate }}</span>
</div> </div>
<img class="img" src="../../assets/img/coupon.png"> <img class="img" src="../../assets/img/coupon.png" />
</div> </div>
<div class="q-pa-sm"> <div class="q-pa-sm">
<div class="q-my-sm"> <div class="q-my-sm">
<span class="text-grey-6">限用品類:</span><span>滿2000可用</span> <span class="text-grey-6">限用品類:</span
><span>{{ useScopeMap[item.couponsUseScope] }}</span>
</div> </div>
<div class="q-my-sm"> <div class="q-my-sm">
<span class="text-grey-6">限用品類:</span><span>滿2000可用</span> <span class="text-grey-6">券碼編號:</span
><span>{{ item.activateCode }}</span>
</div> </div>
<div class="flex flex-center q-mt-xl"> <div class="flex flex-center q-mt-lg">
<q-btn color="primary" unelevated outline label="立即使用"></q-btn> <q-btn :disable="CouponTimeStatus !== 1"
color="primary"
@click="useCoupon(item)"
unelevated
outline
label="立即使用"
></q-btn>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div v-if="!couponList.length ">
<none-data></none-data>
</div>
</div>
<div v-show="pageCount" class="mt flex justify-end">
<q-pagination
v-model="current"
:max="pageCount"
direction-links
color="primary"
active-color="primary"
:max-pages="5"
@input="pageChange"
/>
</div> </div>
</div> </div>
</template> </template>
<script> <script>
import noneData from '../../components/noneData.vue'
export default { export default {
components: {
noneData
},
data() { data() {
return { return {
selectedKey: "可使用", couponList: [],
form: { current: 1,
lastName: "", pageCount: 0,
firstName: "", couponsType: 1, // 优惠券类型 1:抵用券,2:折扣卷
CouponTimeStatus: 1, // 优惠券状态(b2b)1-可使用,2-已使用,3-已过期
CouponsUseScope: 1, // 平台1:全场通用,2:团队,3:签证,4:机票,5:门票,6:车辆,7:自由行,8:当地游
useScopeMap: {
1: "全场通用",
2: "团队",
3: "签证",
4: "机票",
5: "门票",
6: "车辆",
7: "自由行",
8: "当地游",
}, },
model: "", statusMap: [{key: 1, label: "可使用", },{key: 2, label: "已使用",},{key: 3, label: "已过期"}],
date: "", colorMap: {
options: [], 1: "bg-blue",
2: "bg-blue",
3: "bg-red",
4: "bg-yellow",
5: "bg-green",
6: "bg-green",
7: "bg-red",
8: "bg-yellow",
}
}; };
}, },
mounted() {
this.getCouponList();
},
methods: { methods: {
useCoupon(coupon) {
console.log('useCoupon', coupon)
const id = coupon.couponsType - 1
if(id) {
this.CommonJump('/search', {categoryId: id})
} else {
this.CommonJump('/index')
}
},
pageChange(value) {
this.current = value;
this.getCouponList();
},
changeCouponType(item) { changeCouponType(item) {
this.selectedKey = item; this.CouponTimeStatus = item.key;
this.current = 1
this.pageCount = 0
this.couponList = []
this.getCouponList()
}, },
submit() { getCouponList() {
const verifyArr = ["fastName", "lastName"]; this.apipost(
verifyArr.forEach((item) => { "GetMyCouponPageList_post",
this.$refs[item].validate(); { pageIndex: this.current, pageSize: 10, CouponTimeStatus: this.CouponTimeStatus },
}); (res) => {
verifyArr.forEach((item) => { if (res.data.resultCode == 1) {
if (item.$refs[item].hasError) { const { count, pageData, pageCount } = res.data.data;
this.formHasError = true; this.count = count;
} this.pageCount = pageCount;
}); this.couponList = pageData;
if ((this.formHasError = true)) { } else {
return; // this.$notify(res.data.message);
} this.$q.notify({
type: "negative",
message: res.data.message,
position: "top",
timeout: 2000, // 以毫秒为单位; 0意味着没有超时
});
}
},
null
);
}, },
}, },
}; };
......
...@@ -13,9 +13,9 @@ ...@@ -13,9 +13,9 @@
} }
.card { .card {
margin: 10px; margin: 10px;
background: #FFFFFF; background: #ffffff;
border: 1px solid #EEEEEE; border: 1px solid #eeeeee;
border-radius: 8px; border-radius: 8px;
} }
.card-title { .card-title {
height: 37px; height: 37px;
...@@ -49,18 +49,27 @@ border-radius: 8px; ...@@ -49,18 +49,27 @@ border-radius: 8px;
margin-left: 100px; margin-left: 100px;
} }
.name { .name {
width: 300px; padding: 10px;
max-width: 400px;
} }
.user-name { .user-name {
padding-top: 10px;
border-left: 1px solid #eee;
width: 120px; width: 120px;
} }
.pay-info { .pay-info {
padding-top: 10px;
border-left: 1px solid #eee;
width: 120px; width: 120px;
} }
.order-info { .order-info {
padding-top: 10px;
border-left: 1px solid #eee;
width: 120px; width: 120px;
} }
.order-action { .order-action {
padding-top: 10px;
border-left: 1px solid #eee;
width: 120px; width: 120px;
} }
.nav-item { .nav-item {
...@@ -75,110 +84,171 @@ border-radius: 8px; ...@@ -75,110 +84,171 @@ border-radius: 8px;
background-color: $primary; background-color: $primary;
margin: -8px auto 0 auto; margin: -8px auto 0 auto;
} }
.product-img {
width: 64px;
height: 64px;
}
</style> </style>
<template> <template>
<div class="content q-ma-lg bg-white"> <div class="content q-ma-lg bg-white">
<div class="flex justify-between"> <div class="flex justify-between">
<div> <div>
<q-input <q-input
ref="lastName"
class="form-item" class="form-item"
placeholder="名字(需與旅遊證件一致)" placeholder="輸入商品名稱/訂單號"
v-model="form.lastName" v-model="GoodsName"
clearable
outlined outlined
:rules="[(val) => val !== '' || '请输入名字']"
></q-input> ></q-input>
</div> </div>
<div>
<q-select
square
outlined
class="form-item"
v-model="model"
:options="options"
placeholder="Filled"
></q-select>
</div>
</div> </div>
<div class="tips flex"> <div class="tips flex">
<div <div
@click="changeCouponType(item)" @click="changeOrderType(item)"
class="nav-item cursor-pointer" class="nav-item cursor-pointer"
v-for="item in ['全部', '待付款', '待出行', '已完成', '已取消']" v-for="item in orderEnums"
:key="item" :key="item.ID"
> >
{{ item }} {{ item.Name }}
<div :class="selectedKey === item ? 'border-bottom' : ''"></div> <div :class="orderStatus === item.ID ? 'border-bottom' : ''"></div>
</div>
</div> </div>
</div>
<div> <div>
<div class="card"> <div class="card" v-for="item in orderList" :key="item.id">
<div class="flex card-title justify-between"> <div class="flex card-title justify-between">
<div class="flex"> <div class="flex">
<span>订单号</span> <span><span class="text-grey-6">订单号:</span>{{ item.orderNo }}</span>
<span class="phone">联系客服</span> <span class="phone text-grey-6">
<i class="iconfont iconmessage"></i>
联系客服
</span>
</div> </div>
<span>2023-02-23 14:31:52</span> <span class="text-grey-6">{{ item.createTimeStr }}</span>
</div> </div>
<div class="flex q-py-sm"> <div class="flex justify-between">
<img src="../../assets/img/avatar.png" /> <div class="name flex no-wrap">
<div class="name"> <img class="product-img mr" :src="item.goodsPic" />
<div> <div style="max-width: 300px">
【限量300张·售完即止】2023客路春季踏青 <div class="ellipsis-2">{{ item.goodsName }}</div>
卡(春季特惠不约可退+广东省内周边9大路 <div>x1</div>
</div> </div>
<div>xl</div>
</div>
<div class="user-name">王然</div>
<div class="pay-info">
<div>CNY1188.00</div>
<div>在線支付</div>
</div>
<div class="order-info">
<div>等待收貨</div>
<div>订单详情</div>
</div> </div>
<div class="order-action"> <div class="flex">
<div>确认收货</div> <div class="user-name text-center">
<div>取消订单</div> <i class="iconfont iconpeople1"></i>{{ item.surName
<div>查看發票</div> }} {{ item.name }}
</div>
<div class="pay-info text-center">
<div class=" text-grey-6">CNY{{ item.totalPrice }}</div>
<div>{{ item.payTypeStr }}</div>
</div>
<div class="order-info text-center">
<div class="primary">{{item.orderStatusStr}}</div>
<div class="q-mt-sm cursor-pointer">订单详情</div>
</div>
<div class="order-action text-center">
<q-btn
color="primary"
@click="cancalOrder(item)"
unelevated
outline
size="sm"
label="取消订单">
</q-btn>
<div>查看發票</div>
</div>
</div> </div>
</div> </div>
</div> </div>
<noneData v-show="!orderList.length"></noneData>
</div> </div>
</div> </div>
</template> </template>
<script> <script>
import noneData from "../../components/noneData.vue";
export default { export default {
components: {
noneData,
},
data() { data() {
return { return {
selectedKey: "全部", orderEnums: [],
form: { GoodsName: '',
lastName: "", orderList: [],
firstName: "", current: 1,
}, pageCount: 0,
model: "", orderStatus: "",
date: "",
options: [],
}; };
}, },
mounted() {
this.getOrderEnums();
this.getOrderList();
},
methods: { methods: {
changeCouponType(item) { cancalOrder() {},
this.selectedKey = item; pageChange(value) {
this.current = value;
this.getOrderList();
}, },
submit() { changeOrderType(item) {
const verifyArr = ["fastName", "lastName"]; if (this.orderStatus === item.ID) {
verifyArr.forEach((item) => { this.orderStatus = "";
this.$refs[item].validate(); } else {
}); this.orderStatus = item.ID;
verifyArr.forEach((item) => {
if (item.$refs[item].hasError) {
this.formHasError = true;
}
});
if ((this.formHasError = true)) {
return;
} }
this.current = 1;
this.pageCount = 0;
this.orderList = [];
this.getOrderList();
},
getOrderEnums() {
this.apipost(
"GetDirectOrderStatusEnum_post",
{},
(res) => {
if (res.data.resultCode == 1) {
this.orderEnums = res.data.data;
} else {
// this.$notify(res.data.message);
this.$q.notify({
type: "negative",
message: res.data.message,
position: "top",
timeout: 2000, // 以毫秒为单位; 0意味着没有超时
});
}
},
null
);
},
getOrderList() {
this.apipost(
"GetMyDirectOrderPageList_post",
{
pageIndex: this.current,
pageSize: 10,
orderStatus: this.orderStatus,
GoodsName: this.GoodsName,
},
(res) => {
if (res.data.resultCode == 1) {
const { count, pageData, pageCount } = res.data.data;
this.count = count;
this.pageCount = pageCount;
this.orderList = pageData;
} else {
// this.$notify(res.data.message);
this.$q.notify({
type: "negative",
message: res.data.message,
position: "top",
timeout: 2000, // 以毫秒为单位; 0意味着没有超时
});
}
},
null
);
}, },
}, },
}; };
......
...@@ -103,7 +103,7 @@ ...@@ -103,7 +103,7 @@
class="form-item" class="form-item"
v-model="form.Country" v-model="form.Country"
:options="countList" :options="countList"
placeholder="Filled" placeholder="请选择居住國家/地區"
:rules="[(val) => Boolean(val) || '请选择居住國家/地區']" :rules="[(val) => Boolean(val) || '请选择居住國家/地區']"
/> />
</div> </div>
...@@ -120,7 +120,7 @@ ...@@ -120,7 +120,7 @@
option-label="Name" option-label="Name"
v-model="form.Appellation" v-model="form.Appellation"
:options="AppellationList" :options="AppellationList"
placeholder="Filled" placeholder="请选择稱謂"
:rules="[(val) => Boolean(val) || '请选择稱謂']" :rules="[(val) => Boolean(val) || '请选择稱謂']"
/> />
</div> </div>
...@@ -140,7 +140,7 @@ ...@@ -140,7 +140,7 @@
class="form-item" class="form-item"
v-model="form.PhoneCountry" v-model="form.PhoneCountry"
:options="phoneCountList" :options="phoneCountList"
placeholder="Filled" placeholder="请选择國家/地區代碼"
:rules="[(val) => Boolean(val) || '请选择國家/地區代碼']" :rules="[(val) => Boolean(val) || '请选择國家/地區代碼']"
/> />
</div> </div>
...@@ -298,9 +298,9 @@ export default { ...@@ -298,9 +298,9 @@ export default {
}, },
submitUserInfo() { submitUserInfo() {
let params = {...this.form} let params = {...this.form}
params.Appellation = params.Appellation.ID // params.Appellation = params.Appellation.ID
params.Country = params.Country.ID // params.Country = params.Country.ID
params.PhoneCountry = params.PhoneCountry.ID // params.PhoneCountry = params.PhoneCountry.ID
this.apipost( this.apipost(
"UpdateUserInfo_post", "UpdateUserInfo_post",
params, params,
......
This diff is collapsed.
...@@ -2,7 +2,6 @@ import Vue from 'vue' ...@@ -2,7 +2,6 @@ import Vue from 'vue'
import VueRouter from 'vue-router' import VueRouter from 'vue-router'
import routes from './routes' import routes from './routes'
Vue.use(VueRouter) Vue.use(VueRouter)
const routerPush = VueRouter.prototype.push const routerPush = VueRouter.prototype.push
...@@ -30,6 +29,18 @@ export default function (/* { store, ssrContext } */) { ...@@ -30,6 +29,18 @@ export default function (/* { store, ssrContext } */) {
mode: process.env.VUE_ROUTER_MODE, mode: process.env.VUE_ROUTER_MODE,
base: process.env.VUE_ROUTER_BASE base: process.env.VUE_ROUTER_BASE
}) })
Router.beforeEach((to, from, next) => {
let user = undefined
if(typeof window === 'object') {
user = JSON.parse(window.localStorage.getItem('b2bUser'))
if(to.meta.needLogin && !user) {
next({path: '/login'})
} else {
next()
}
}else {
next()
}
})
return Router return Router
} }
This diff is collapsed.
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