jiazhipeng 1 year ago
parent
commit
bcbbcc43ad
  1. 1
      pages/index/index.vue
  2. 10
      static/js/CommonFunction.js
  3. 56
      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) {
this.Post({id: item.id},'/api/article/getArticleById')
this.goOtherDetail(item)
if(!item.link_type) {
if(type) {

10
static/js/CommonFunction.js

@ -231,8 +231,9 @@ Date.prototype.Format = function(fmt)
return fmt;
}
// 获取最大优惠券 params:{money:100,sku_ids:1,2}
// 获取最大优惠券 params:{money:100,sku_ids:1,2} money单位分
Vue.prototype.getMaxCoupon = async function (param) {
param.money = (param.money||0)/100
let res = await this.Post(param, "/api/coupon/use_max_coupon_list")
if (res.code == 1 && res.data.id) {
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 = [
{name:'景区门票', url: '/subPackages/ticketBooking/detail',genre:'ticket'},
{name:'酒店民宿',url:'/subPackages/hotelHomestay/detail',genre:'hotel'},
@ -272,8 +275,7 @@ Vue.prototype.goDetailByType=(item)=>{
let detailData = urlData.find(v=>v.genre == item.genre)
if (detailData) {
let param = ""
if (detailData.genre == 'article') {this.Post({id: item.id},'/api/article/getArticleById')}
uni.navigateTo({
url: `${detailData.url}?id=${(['ticket','hotel'].includes(detailData.genre)?item.scenic_id:item.id)}`
})

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

31
subPackages/hotelHomestay/order.vue

@ -156,7 +156,9 @@
buyNum: 1,
roomUser: [{
name: ''
}]
}],
allSeldDate: []
}
@ -195,6 +197,8 @@
this.phone = ''
}
this.getPriceCal(this.skuInfo.id, this.skuInfo.goods_id)
},
//
viewDetail () {
@ -214,7 +218,13 @@
},
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 () {
@ -300,6 +310,23 @@
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>

4
subPackages/techan/order.vue

@ -419,12 +419,12 @@ export default {
} else{
// 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 {
price = (this.info.money) * this.info.buyNum + postPrice
}
return price < 0 ? 0 : price/100
return price < 0 ? 0 : (price/100).toFixed(2)
},
//
order() {

55
subPackages/ticketBooking/order.vue

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

1
subPackages/travelGuide/travelGuide.vue

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

Loading…
Cancel
Save