jiazhipeng 1 year ago
parent
commit
bcbbcc43ad
  1. 1
      pages/index/index.vue
  2. 12
      static/js/CommonFunction.js
  3. 58
      subPackages/food/foodOrder.vue
  4. 31
      subPackages/hotelHomestay/order.vue
  5. 4
      subPackages/techan/order.vue
  6. 55
      subPackages/ticketBooking/order.vue
  7. 1
      subPackages/travelGuide/travelGuide.vue

1
pages/index/index.vue

@ -299,6 +299,7 @@
}, },
// 线 // 线
goCalendarDetail(item,type) { goCalendarDetail(item,type) {
this.Post({id: item.id},'/api/article/getArticleById')
this.goOtherDetail(item) this.goOtherDetail(item)
if(!item.link_type) { if(!item.link_type) {
if(type) { if(type) {

12
static/js/CommonFunction.js

@ -231,8 +231,9 @@ Date.prototype.Format = function(fmt)
return fmt; return fmt;
} }
// 获取最大优惠券 params:{money:100,sku_ids:1,2} // 获取最大优惠券 params:{money:100,sku_ids:1,2} money单位分
Vue.prototype.getMaxCoupon = async function (param) { Vue.prototype.getMaxCoupon = async function (param) {
param.money = (param.money||0)/100
let res = await this.Post(param, "/api/coupon/use_max_coupon_list") let res = await this.Post(param, "/api/coupon/use_max_coupon_list")
if (res.code == 1 && res.data.id) { if (res.code == 1 && res.data.id) {
this.$store.commit("choseCoupon",res.data); this.$store.commit("choseCoupon",res.data);
@ -258,7 +259,9 @@ Vue.prototype.goOtherDetail = (item,type) => {
} }
// 根据类型判断详情页 // 根据类型判断详情页
Vue.prototype.goDetailByType=(item)=>{ Vue.prototype.goDetailByType= function(item){
this.goOtherDetail(item)
let urlData = [ let urlData = [
{name:'景区门票', url: '/subPackages/ticketBooking/detail',genre:'ticket'}, {name:'景区门票', url: '/subPackages/ticketBooking/detail',genre:'ticket'},
{name:'酒店民宿',url:'/subPackages/hotelHomestay/detail',genre:'hotel'}, {name:'酒店民宿',url:'/subPackages/hotelHomestay/detail',genre:'hotel'},
@ -269,11 +272,10 @@ Vue.prototype.goDetailByType=(item)=>{
// {name:'游玩公告',url:'/subPackages/notice/noticeDetail'}, // {name:'游玩公告',url:'/subPackages/notice/noticeDetail'},
{name:'活动日历',url:'/subPackages/eventCalendar/detail',genre:'activity'} {name:'活动日历',url:'/subPackages/eventCalendar/detail',genre:'activity'}
] ]
let detailData = urlData.find(v=>v.genre == item.genre) let detailData = urlData.find(v=>v.genre == item.genre)
if (detailData) { if (detailData) {
let param = "" if (detailData.genre == 'article') {this.Post({id: item.id},'/api/article/getArticleById')}
uni.navigateTo({ uni.navigateTo({
url: `${detailData.url}?id=${(['ticket','hotel'].includes(detailData.genre)?item.scenic_id:item.id)}` url: `${detailData.url}?id=${(['ticket','hotel'].includes(detailData.genre)?item.scenic_id:item.id)}`
}) })

58
subPackages/food/foodOrder.vue

@ -22,9 +22,10 @@
<!-- 优惠券 --> <!-- 优惠券 -->
<navigator :url="'/subPackages/order/orderCoupon?allprice='+ allprice*100 + '&sku_ids='+ info.id" class="tickets-box flex-between msg-box"> <navigator :url="'/subPackages/order/orderCoupon?allprice='+ allprice*100 + '&sku_ids='+ info.id" class="tickets-box flex-between msg-box">
<div class="order-title">优惠券</div> <div class="order-title">优惠券</div>
<div class="coupon-btn" v-if="coupon==''"> <view class="coupon-btn" v-if="coupon==''">
请选择 <view class="select">请选择</view>
</div> <uni-icons style="height: 42rpx;" color="#999999" type="right" size="18"></uni-icons>
</view>
<div class="coupon-price" v-else> <div class="coupon-price" v-else>
<span v-if="coupon.percent == 0">-{{coupon.discounts/100}}</span> <span v-if="coupon.percent == 0">-{{coupon.discounts/100}}</span>
<span v-else>-{{coupon.percent}}%</span> <span v-else>-{{coupon.percent}}%</span>
@ -54,7 +55,7 @@
合计 合计
</view> </view>
<view class="totalPrice"> <view class="totalPrice">
{{ allprice }} {{ total() }}
</view> </view>
</view> </view>
<view class="order" @click="order"> <view class="order" @click="order">
@ -71,7 +72,7 @@
coupon:"", coupon:"",
reserve_name: '', reserve_name: '',
reserve_phone: '', reserve_phone: '',
info:null, info:{},
detail:null,// detail:null,//
allprice: 0, allprice: 0,
num:0, num:0,
@ -93,7 +94,9 @@
} }
console.log(this.info); console.log(this.info);
this.reserve_phone = JSON.parse(uni.getStorageSync('userInfo')).mobile this.reserve_phone = JSON.parse(uni.getStorageSync('userInfo')).mobile
this.total()
this.getMaxCouponData()
}, },
methods: { methods: {
cha() { cha() {
@ -182,18 +185,29 @@
// //
total() { total() {
let price = 0 let price = 0
this.allprice = this.info.money * this.num
if (this.coupon) { if (this.coupon) {
if (this.coupon.percent == 0) { if (this.coupon.percent == 0) {
price = this.info.money * this.num - this.coupon.discounts price = this.info.money * this.num - this.coupon.discounts
} else{ } else{
price = this.info.money * this.num - ((this.info.money * this.num + this.post) * this.coupon.percent) price = this.info.money * this.num - ((this.info.money * this.num ) * this.coupon.percent/100)
} }
} else{ } else{
price = this.info.money * this.num price = this.info.money * this.num
} }
price < 0 ? 0 : price price < 0 ? 0 : price
this.allprice = price / 100 return (price / 100).toFixed(2)
}, },
//
async getMaxCouponData () {
let param = {money:this.info.money * this.num,sku_ids:this.info.id}
let res = await this.getMaxCoupon(param)
if (res.id) {
this.coupon = res
}
this.total()
}
} }
} }
</script> </script>
@ -391,24 +405,20 @@
} }
.coupon-btn { .coupon-btn {
width: 140rpx; color: #999999;;
height: 57rpx; display: flex;
border: 1px solid #333333; align-items: center;
border-radius: 29rpx;
font-size: 28rpx;
font-family: PingFangSC;
font-weight: 400;
color: #000000;
text-align: center;
line-height: 57rpx;
.select { .select {
padding: 10rpx 18rpx; display: block;
background: #ED9230; width: 140rpx;
border-radius: 10rpx; height: 58rpx;
font-size: 28rpx; text-align: right;
line-height: 58rpx;
font-size: 31rpx;
font-family: PingFang SC;
font-weight: 400; font-weight: 400;
color: #fff; margin-right: 20rpx;
} }
} }

31
subPackages/hotelHomestay/order.vue

@ -156,7 +156,9 @@
buyNum: 1, buyNum: 1,
roomUser: [{ roomUser: [{
name: '' name: ''
}] }],
allSeldDate: []
} }
@ -195,6 +197,8 @@
this.phone = '' this.phone = ''
} }
this.getPriceCal(this.skuInfo.id, this.skuInfo.goods_id)
}, },
// //
viewDetail () { viewDetail () {
@ -214,7 +218,13 @@
}, },
total () { total () {
return this.skuInfo.money/100 * this.buyNum * this.selectDate.differDays || 0
let disfferMoney = 0
this.allSeldDate.forEach(v=>{
disfferMoney+=(v.money||0)
})
return (disfferMoney/100 * this.buyNum * this.selectDate.differDays || 0).toFixed(2)
}, },
order () { order () {
@ -300,6 +310,23 @@
this.$refs.popupRule.open() this.$refs.popupRule.open()
}, },
getPriceCal(skuId,goodId) {
this.Post({
specifications_id: skuId,
goods_id: goodId,
start_date: this.selectDate.startDay,
end_date:this.selectDate.endDay,
}, '/api/goods/getPriceCalendarListBySpecifications').then(res => {
this.allSeldDate = res.data || []
if (this.allSeldDate.length>0) {
this.allSeldDate.pop()
}
})
},
} }
} }
</script> </script>

4
subPackages/techan/order.vue

@ -419,12 +419,12 @@ export default {
} else{ } else{
// bug // bug
price = ((this.info.money) * this.info.buyNum + postPrice) - (((this.info.money) * this.info.buyNum + postPrice) * this.coupon.percent/100) price = ((this.info.money) * this.info.buyNum + postPrice) - (((this.info.money) * this.info.buyNum) * this.coupon.percent/100)
} }
} else { } else {
price = (this.info.money) * this.info.buyNum + postPrice price = (this.info.money) * this.info.buyNum + postPrice
} }
return price < 0 ? 0 : price/100 return price < 0 ? 0 : (price/100).toFixed(2)
}, },
// //
order() { order() {

55
subPackages/ticketBooking/order.vue

@ -17,12 +17,15 @@
<view class="flex-between num-left"> <view class="flex-between num-left">
<view class="left-title text-overflow">{{skuItem.title}}</view> <view class="left-title text-overflow">{{skuItem.title}}</view>
<view class="left-price">{{skuItem.price / 100}}</view> <view class="left-price">{{skuItem.price / 100}}</view>
<view class="num-right"> <view class="num-right" v-if="skuItem.store>0">
<view :class="['btn-num',skuItem.buyNum<=0||(skuItem.id==sInfo.id&&skuItem.buyNum<=1)?'disabled':'']" <view :class="['btn-num',skuItem.buyNum<=0||(skuItem.id==sInfo.id&&skuItem.buyNum<=1)?'disabled':'']"
v-if="!skuItem.originate_order_id && !skuItem.gp_id" @click="delNumber(skuItem)" >-</view> v-if="!skuItem.originate_order_id && !skuItem.gp_id" @click="delNumber(skuItem)" >-</view>
<view class="num-span">{{ skuItem.buyNum }}</view> <view class="num-span">{{ skuItem.buyNum }}</view>
<view class="btn-num" v-if="!skuItem.originate_order_id && !skuItem.gp_id" @click="addNumber(skuItem)" >+</view> <view class="btn-num" v-if="!skuItem.originate_order_id && !skuItem.gp_id" @click="addNumber(skuItem)" >+</view>
</view> </view>
<view class="num-right" style="width: 160rpx;" v-else>
<view>无库存</view>
</view>
</view> </view>
<view style="padding: 30rpx 0 20rpx;" class="num-subtitle text-overflow" @click="showpopRule(true, skuItem)"> <view style="padding: 30rpx 0 20rpx;" class="num-subtitle text-overflow" @click="showpopRule(true, skuItem)">
<view class="flex" v-if="skuItem.specifications_new_tag"> <view class="flex" v-if="skuItem.specifications_new_tag">
@ -357,11 +360,12 @@
}, },
onLoad(options) { onLoad(options) {
// this.getList(); // this.getList();
this.$store.commit("choseCoupon", "");
this.initPageData() this.initPageData()
}, },
onShow() { onShow() {
this.coupon = this.$store.state.user.coupon
}, },
onUnload () { onUnload () {
@ -395,15 +399,15 @@
}, },
// skumoney // skumoney
async initPriceCal(skuId, goodsId,date) { async initPriceCal(skuId) {
let res = await this.Post({ let res = await this.Post({
specifications_id: skuId, specifications_id: skuId,
goods_id: goodsId, date: this.showDate.date,
end_date:date, start_time:this.showDate.startTime,
start_date:date end_time:this.showDate.endTime
}, '/api/goods/getPriceCalendarListBySpecifications') }, '/api/goods/getSpecificationsPriceCalendarAndTime')
if (res.code == 1) { if (res.code == 1) {
return {code:1,money: res.data[0].money, store: ''} return {code:1,...res.data}
} }
return {code:2} return {code:2}
}, },
@ -448,18 +452,8 @@
let is_time_stock = data.sInfo.is_time_stock let is_time_stock = data.sInfo.is_time_stock
let is_price_calendar = data.sInfo.is_price_calendar let is_price_calendar = data.sInfo.is_price_calendar
data.pInfo.specifications = data.pInfo.specifications.filter(v=>v.is_time_stock==is_time_stock && v.is_price_calendar==is_price_calendar) data.pInfo.specifications = data.pInfo.specifications.filter(v=>v.is_time_stock==is_time_stock && v.is_price_calendar==is_price_calendar)
let date = data.allSeldDate[data.seldDateIndex].date
let time = data.timesArr[data.seldTimeIndex]
for(let sku of data.pInfo.specifications) {
let res = await this.initPriceCal(sku.id, sku.goods_id, date)
if (res.code === 1) {
sku.price = res.money
}
}
this.pInfo = data.pInfo
this.sInfo = data.sInfo
this.minSeldDate=data.minSeldDate this.minSeldDate=data.minSeldDate
this.maxSeldDate = data.maxSeldDate this.maxSeldDate = data.maxSeldDate
this.calendarParam = data.calendarParam this.calendarParam = data.calendarParam
@ -475,6 +469,19 @@
} }
for(let sku of data.pInfo.specifications) {
let res = await this.initPriceCal(sku.id)
if (res.code === 1) {
sku.price = res.money
sku.store = res.store
}
}
this.pInfo = data.pInfo
this.sInfo = data.sInfo
} catch(e){ } catch(e){
console.log(e) console.log(e)
} }
@ -498,10 +505,9 @@
result = personAge>=age_limit.start result = personAge>=age_limit.start
} }
if (age_limit.end&&result) { if (age_limit.end&&result) {
result = personAge<=age_limit.start result = personAge<=age_limit.end
} }
} }
return result return result
}, },
@ -782,7 +788,7 @@
} else { } else {
price = allPrice price = allPrice
} }
return price < 0 ? 0 : price/100 return price < 0 ? 0 : (price/100).toFixed(2)
}, },
// sku // sku
@ -907,9 +913,10 @@
sku.selPerson = { sku.selPerson = {
id:null,id_number:null,name:null,tel:null,user_id:null,age:null, id:null,id_number:null,name:null,tel:null,user_id:null,age:null,
} }
let res = this.initPriceCal(sku.id, sku.goods_id, date) let res = this.initPriceCal(sku.id)
if (res.code === 1) { if (res.code === 1) {
sku.price = res.money sku.price = res.money
sku.store = res.store
} }
} }
}, },
@ -1021,10 +1028,10 @@
method: 'POST', method: 'POST',
data: JSON.stringify(data) data: JSON.stringify(data)
}, '/api/order/place').then(res => { }, '/api/order/place').then(res => {
if (res.code == 200) { if (res.code == 1) {
uni.removeStorageSync('ticketOrder')
console.log(res.data.order_id); console.log(res.data.order_id);
let order_id = res.data.order_id let order_id = res.data.order_id
this.$store.commit("changeOrderInfo", null);
this.$store.commit("choseCoupon", ""); this.$store.commit("choseCoupon", "");
this.Post({ this.Post({
order_id: order_id, order_id: order_id,

1
subPackages/travelGuide/travelGuide.vue

@ -112,6 +112,7 @@
this.getArticleByType() this.getArticleByType()
}, },
viewDetail (item) { viewDetail (item) {
this.Post({id: item.id},'/api/article/getArticleById')
this.goOtherDetail(item) this.goOtherDetail(item)
if(!item.link_type) { if(!item.link_type) {
uni.navigateTo({ uni.navigateTo({

Loading…
Cancel
Save