Commit 15ca8469 authored by 罗超's avatar 罗超

新增优惠券

parent c7c8ab67
......@@ -135,7 +135,7 @@ Vue.prototype.apiJavaPost = function(cmd, msg, successCall, faildCall) {
var GroupId = 0;
if (this.getLocalStorage() != null) {
token = this.getLocalStorage().token;
key = this.getLocalStorage().secretKey;
key = '' //this.getLocalStorage().secretKey;
}
if (localStorage.groupinfo && localStorage.groupinfo != 'undefined') {
var groupJson = JSON.parse(localStorage.groupinfo);
......
<template>
<q-card flat class="q-pa-md q-mt-lg">
<q-card flat class="q-pa-md q-mt-lg" v-if="coupons">
<div class="row items-center">
<div class="text-subtitle1 text-weight-bolder q-mb-md col">
<span>優惠券</span>
<span class="text-weight-regular q-ml-sm text-body2">(可用優惠券 0 張)</span>
<span class="text-weight-regular q-ml-sm text-body2">(可用優惠券 {{ coupons.length }} 張)</span>
</div>
<q-toggle v-model="showDisable" label="顯示不可用優惠券" style="zoom:0.8;margin-top: -24px;" v-if="isExplends"/>
<!-- <q-toggle v-model="showDisable" label="顯示不可用優惠券" style="zoom:0.8;margin-top: -24px;" v-if="isExplends"/> -->
<q-icon :name="isExplends?'keyboard_arrow_up':'keyboard_arrow_down'" @click="$event=>isExplends=!isExplends" size="32px" color="grey-9" class="q-ml-md cursor-pointer" style="margin-top:-10px;"/>
</div>
<div v-if="isExplends">
<div class="row q-col-gutter-md">
<div :class="filedWidth">
<div class="cursor-pointer">
<div :class="filedWidth" v-for="(x,i) in coupons" :key="i">
<div class="cursor-pointer" :class="{'unUsed':currentPrice<x.useCondition}">
<div class="coupon-head">
<div class="check-tools">
<q-checkbox v-model="chosenCouponId" :value="1" dense color="teal" />
<div class="check-tools" v-if="currentPrice>=x.useCondition">
{{ x.couponId }}
<q-checkbox v-model="chosenCouponId" :val="x.couponId" label="" dense color="teal" />
{{ chosenCouponId }}
</div>
<div class="q-pa-lg q-mt-lg">
<div class="row items-center">
<div class="text-h4 text-weight-bold text-white col">
{{ moneyFormat(500,2) }}
<div class="text-h4 text-weight-bold text-white col" v-if="x.couponsType==1">
{{ moneyFormat(x.denomination,2) }}
</div>
<div class=" f12 text-white">滿 2000 可用</div>
<div class="text-h4 text-weight-bold text-white col" v-if="x.couponsType==2">
{{ x.denomination }}
<span class="q-ml-sm text-weight-thin text-subtitle1"></span>
</div>
<div class=" f12 text-white">滿 {{ x.useCondition }} 可用</div>
</div>
<div class="q-mt-sm f12" style="color:#195954">有效期至:2023.02.30</div>
<div class="q-mt-sm f12" style="color:#195954">有效期至:{{ x.expirationDate}}</div>
</div>
</div>
<div class="q-px-lg q-py-md coupon-content">
......@@ -34,12 +40,12 @@
</div>
<div class="row q-mt-sm">
<div class="col-5">使用品類:</div>
<div class="">多日遊行程適用</div>
<div class="">{{ x.rangeName }}</div>
</div>
</div>
</div>
</div>
<div :class="filedWidth">
<!-- <div :class="filedWidth">
<div class="unUsed">
<div class="coupon-head">
<div class="q-pa-lg q-mt-lg">
......@@ -63,9 +69,9 @@
</div>
</div>
</div>
</div>
</div> -->
</div>
<div class="text-center q-mt-lg" v-if="1==2">
<div class="text-center q-mt-lg" v-if="coupons.length==0">
<p>
<img src="~assets/sad.svg" style="width: 50px" />
</p>
......@@ -76,8 +82,21 @@
</template>
<script>
import EnumHelper from 'src/utils/enumhelper';
import ProductTypeEnum from 'src/utils/producttypeenum';
import {date} from 'quasar'
export default {
props:["goodsInfo"],
props:{
productType:{
type:Number,
required:true
},
currentPrice:{
type:Number,
required:false,
default:0
}
},
computed: {
filedWidth() {
return {
......@@ -90,13 +109,43 @@ export default {
return {
showDisable:false,
isExplends:false,
chosenCouponId:false
chosenCouponId:[],
couponsUseScope:1,
coupons:null
};
},
created() {
this.couponsUseScope = this.productType+1
this.getProductCouponHandler()
},
methods: {
changeDiscountHandler(){
changeDiscountHandler(x){
}
},
getProductCouponHandler(){
this.apiJavaPost(
"/api/b2b/user/getUserCanUseCouponList",
{
lineId:0,
lineteamId:0,
CouponsUseScope:this.couponsUseScope
},
res => {
this.coupons = res.data.data
if(this.coupons && this.coupons.length>0){
this.coupons.forEach(x=>{
x.rangeName = EnumHelper.ParseToEnum(ProductTypeEnum,this.couponsUseScope,'value').desc
x.expirationDate = date.formatDate(x.expirationDate,'YYYY.MM.DD')
})
this.isExplends = this.coupons.length>0
}else{
this.coupons = []
}
},
null
);
},
},
}
</script>
......
......@@ -703,7 +703,7 @@ export default {
this.$nextTick(() => {
this.isPic =
document.URL.indexOf("localhost") != -1 ||
document.URL.indexOf("t.oytour.com") != -1;
document.URL.indexOf("www.oytour.com") != -1;
});
},
err => {}
......
......@@ -117,15 +117,18 @@ export default {
},
created() {
this.prices = this.priceList;
console.log(this.prices)
this.init();
},
methods: {
init() {
this.createChosenDateHandler();
let firstMonth = date.formatDate(
new Date(this.prices[0].startDate),
"YYYY/MM"
);
console.log(firstMonth)
let current = this.months.findIndex((x) => x.monthValue == firstMonth)
this.currentMonth = current>-1?current:0;
this.changeMonthHandler();
......
......@@ -505,9 +505,10 @@ export default {
let order = {
configId:this.travel.id,
tcid:this.p.tcid,
startCityId:this.currentUnionCity?this.currentUnionCity.cityId:this.travel.startCityId,
startCityId:this.currentUnionCity && this.currentUnionCity.cityId ?this.currentUnionCity.cityId:this.travel.startCityId,
orderInfo:this.chosenObj
}
let key = this.$md5(JSON.stringify(order))
let lineCars = localStorage.getItem('lineCars')
lineCars = lineCars?JSON.parse(lineCars):[]
......
......@@ -439,7 +439,7 @@ export default {
}
}
this.$nextTick(()=>{
this.isPic = document.URL.indexOf("localhost")!=-1||document.URL.indexOf("t.oytour.com")!=-1
this.isPic = document.URL.indexOf("localhost")!=-1||document.URL.indexOf("www.oytour.com")!=-1
});
},
(err) => {}
......
......@@ -306,7 +306,7 @@
/>
</q-card>
<coupon></coupon>
<coupon v-if="price && price.tcid" :product-type="productType" :current-price="sumPrice"></coupon>
</div>
<div
class="relative-position"
......@@ -458,6 +458,8 @@ import coupon from "../../components/common/coupon.vue";
import NoneData from "src/components/common/noneData.vue";
import auth from "src/components/common/auth.vue";
import {date} from 'quasar'
import ProductTypeEnum from '../../utils/producttypeenum'
import EnumHelper from '../../utils/enumhelper'
export default {
components: {
coupon,
......@@ -546,7 +548,8 @@ export default {
unionCity: null,
sumPrice:0,
submiting:false,
CouponIds:[]
CouponIds:[],
productType:0
};
},
computed: {
......@@ -564,6 +567,7 @@ export default {
}
},
created() {
if (this.checkParamsHandler()) {
this.initGuestHandler();
this.getTripData();
......@@ -594,6 +598,8 @@ export default {
}
this.submiting=false
},
submitOrderHandler(){
let msg={
OrderId:0,
......@@ -702,7 +708,7 @@ export default {
GoodsId:this.order.order.tcid,
GoodsName:this.trip.title,
GoodsPic:this.trip.imgCover[0].Url,
GoodsType:this.price.teamType==0?2:(this.price.teamType==2?1:3),
GoodsType:this.productType,
OrderMake:`${ this.unionCity && this.unionCity.goFlight? this.unionCity.goFlight.startDate :this.price.startDate}${this.unionCity?this.unionCity.cityName:this.trip.startCityName }出發 ${guestInfo}`,
TotalPrice:this.sumPrice,
PreferentialPrice:this.chosenObj.discountPrice,
......@@ -721,6 +727,9 @@ export default {
}
})
},
getProductTypeHandler(){
return (this.price.teamType==0?ProductTypeEnum.TEAM_TRIP:(this.price.teamType==2?ProductTypeEnum.ONE_DAY:ProductTypeEnum.UNIT_TRIP)).value
},
goPayHandler(pay){
let key = this.$md5(JSON.stringify(pay))
let pays = localStorage.getItem('pays')
......@@ -886,6 +895,7 @@ export default {
},
getTripData() {
this.$q.loading.show();
let msg = {
cityId: this.order.order.startCityId,
......@@ -904,8 +914,8 @@ export default {
this.trip = r.data.data;
this.trip.imgCover = JSON.parse(this.trip.imgCover);
this.price = this.trip.priceList[0];
if(this.order.order.startCityId!=this.trip.startCityId){
this.price = this.trip.currentPriceInfo;
if(this.order.order.startCityId && this.order.order.startCityId!=this.trip.startCityId){
this.unionCity = this.price.unionCityList.find(x=>x.cityId == this.order.order.startCityId)
if(this.unionCity.backFlight && this.unionCity.backFlight.addPrice){
this.price.originalB2CPrice+=this.unionCity.backFlight.addPrice
......@@ -915,8 +925,8 @@ export default {
}
}
this.calcMoney()
this.productType=this.getProductTypeHandler()
} else {
this.$q.notify({
type: "negative",
......
const EnumHelper = {
ParseToEnum(TEnum, value, comparison = '') {
if (Object.isFrozen) {
let t = Object.values(TEnum)
console.log(t, Symbol(1) == 1)
let r = t.find(x => (comparison != '' && x[comparison] == value) || (comparison == '' && x == value))
return r
} else {
throw new Error("这不是一个枚举类型");
}
}
}
export default EnumHelper
\ No newline at end of file
const ProductTypeEnum = Object.freeze({
/**
* 一日游
*/
ONE_DAY: {
value: 1,
desc: '一日游产品'
},
/**
* 多日游
*/
TEAM_TRIP: {
value: 2,
desc: '多日游产品'
},
/**
* 小包团
*/
UNIT_TRIP: {
value: 3,
desc: '小包团产品'
},
/**
* 景点门票
*/
SCENIC_SPOT: {
value: 4,
desc: '景点门票产品'
},
/**
* 主题乐园
*/
THEME_PART: {
value: 5,
desc: '主题乐园门票'
},
/**
* 博物馆
*/
MUSEUM: {
value: 6,
desc: '博物馆门票'
},
/**
* 历史景点
*/
HISTORY: {
value: 7,
desc: '历史景点门票'
},
/**
* 温泉酒店
*/
HOT_SPRING: {
value: 8,
desc: '温泉酒店产品'
},
/**
* 星级酒店
*/
STAR_HOTEL: {
value: 9,
desc: '星级酒店产品'
},
/**
* 度假酒店
*/
RESORT_HOTEL: {
value: 10,
desc: '度假酒店产品'
},
/**
* 民宿
*/
HOMESTAY: {
value: 11,
desc: '民宿产品'
},
/**
* 包车
*/
CHARTER: {
value: 12,
desc: '包车产品'
},
/**
* 接机
*/
PICK_UP: {
value: 13,
desc: '接机产品'
},
/**
* 送机
*/
DROP_OFF: {
value: 14,
desc: '送机产品'
}
})
export default ProductTypeEnum
\ No newline at end of file
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