|
|
@ -1,12 +1,14 @@ |
|
|
|
<template> |
|
|
|
<view class="bg" > |
|
|
|
<view class="goods-container"> |
|
|
|
<view class="goods-container" v-if="hotelOrderList.length>0"> |
|
|
|
<view class="goods-type-tag">酒店</view> |
|
|
|
|
|
|
|
|
|
|
|
<view class="cal-price"> |
|
|
|
小计: <text class="price">{{priceParam.hotelPrice/100}}</text> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
|
|
|
|
<view class="goods-container"> |
|
|
|
<view class="goods-container" v-if="postOrderList.length>0"> |
|
|
|
<view class="goods-type-tag">自提</view> |
|
|
|
<view class="post-item" v-for="(item,i) in pickupOrderList" :key="i"> |
|
|
|
<view class="sku-item"> |
|
|
@ -21,7 +23,7 @@ |
|
|
|
<view class="flex-shrink-0">x{{item.sInfo.buyNum}}</view> |
|
|
|
</view> |
|
|
|
<view class="flex text-overflow" v-if="item.sInfo.display_tags"> |
|
|
|
<view class="tag" v-for="(tag,tagIndex) in info.display_tags.split(',')" :key="tagIndex">{{tag}}</view> |
|
|
|
<view class="tag" v-for="(tag,tagIndex) in item.sInfo.display_tags.split(',')" :key="tagIndex">{{tag}}</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
@ -33,11 +35,11 @@ |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="cal-price"> |
|
|
|
小计: <text class="price">205</text> |
|
|
|
小计: <text class="price">{{priceParam.pickupPrice/100}}</text> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
|
|
|
|
<view class="goods-container"> |
|
|
|
<view class="goods-container" v-if="pickupOrderList.length>0"> |
|
|
|
<view class="goods-type-tag">邮寄</view> |
|
|
|
<view class="post-item" v-for="(item,i) in postOrderList" :key="i"> |
|
|
|
<view class="sku-item"> |
|
|
@ -52,7 +54,7 @@ |
|
|
|
<view class="flex-shrink-0">x{{item.sInfo.buyNum}}</view> |
|
|
|
</view> |
|
|
|
<view class="flex text-overflow" v-if="item.sInfo.display_tags"> |
|
|
|
<view class="tag" v-for="(tag,tagIndex) in info.display_tags.split(',')" :key="tagIndex">{{tag}}</view> |
|
|
|
<view class="tag" v-for="(tag,tagIndex) in item.sInfo.display_tags.split(',')" :key="tagIndex">{{tag}}</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
@ -72,19 +74,49 @@ |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="cal-price"> |
|
|
|
小计: <text class="price">205</text> |
|
|
|
小计: <text class="price">{{priceParam.postPrice/100}}</text> |
|
|
|
</view> |
|
|
|
|
|
|
|
</view> |
|
|
|
|
|
|
|
<view class="goods-container"> |
|
|
|
<view class="goods-container" v-if="playOrderList.length>0"> |
|
|
|
<view class="goods-type-tag">游玩</view> |
|
|
|
|
|
|
|
<view class="ticket-item" v-for="(item,i) in playOrderList" :key="i"> |
|
|
|
<view class="sku-item"> |
|
|
|
<image class="sku-img" :src="item.sInfo.headimg"></image> |
|
|
|
<view class="sku-content"> |
|
|
|
<view class="sku-title flex-between" style="align-items: flex-start;"> |
|
|
|
<view class="title flex-1 w-1rpx text-overflowRows">{{item.pInfo.title}}</view> |
|
|
|
<view class="flex-shrink-0 price">¥{{item.sInfo.price/100}}</view> |
|
|
|
</view> |
|
|
|
<view class="flex-between subtitle" > |
|
|
|
<view class=" flex-1 w-1rpx text-overflow">{{item.sInfo.sku_name}}</view> |
|
|
|
<view class="flex-shrink-0">x{{item.sInfo.buyNum}}</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="other-info"> |
|
|
|
<view class="flex" v-if="item.showDate"> |
|
|
|
<view class="flex-shrink-0">使用日期:</view> |
|
|
|
<view style="padding-left: 20rpx;"> |
|
|
|
{{item.showDate.date}} |
|
|
|
<text style="padding-left: 10rpx;" v-if="item.showDate.startTime && item.showDate.endTime"> |
|
|
|
{{item.showDate.startTime}} 至 {{item.showDate.endTime}} |
|
|
|
</text> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="flex" v-if="item.phone"> |
|
|
|
<view class="flex-shrink-0">出行人信息:</view> |
|
|
|
<view style="padding-left: 20rpx;">{{item.phone}}</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="cal-price"> |
|
|
|
小计: <text class="price">{{priceParam.playPrice/100}}</text> |
|
|
|
</view> |
|
|
|
|
|
|
|
</view> |
|
|
|
|
|
|
|
<view style="width: 1rpx;height: 200rpx;"></view> |
|
|
|
|
|
|
|
<!-- 优惠券 --> |
|
|
|
<view @click="goOrderCoupon" class="tickets-container flex-between"> |
|
|
|
<view class="order-title">优惠券</view> |
|
|
@ -100,13 +132,13 @@ |
|
|
|
</view> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<view style="width: 1rpx;height: 200rpx;"></view> |
|
|
|
|
|
|
|
|
|
|
|
<view class="btn-list"> |
|
|
|
<view class="price-box"> |
|
|
|
<view class="text">合计:</view> |
|
|
|
<view class="price">{{ total() }}</view> |
|
|
|
<view class="price">{{ calAllPrice() }}</view> |
|
|
|
<!-- <view class="post-text" v-if="info.is_user_post==1&&post">含邮费:¥{{ post / 100 }}</view> --> |
|
|
|
</view> |
|
|
|
<view class="btn" @click="order()">提交订单</view> |
|
|
@ -121,23 +153,30 @@ export default { |
|
|
|
|
|
|
|
data() { |
|
|
|
return { |
|
|
|
orderList: [], |
|
|
|
hotelOrderList: [], // 酒店 |
|
|
|
postOrderList: [], // 邮寄 |
|
|
|
pickupOrderList: [], // 自提 |
|
|
|
|
|
|
|
playOrderList: [], // 游玩 |
|
|
|
|
|
|
|
coupon: "", |
|
|
|
allprice: 0, |
|
|
|
allprice: 0, // 总价不包含优惠券 |
|
|
|
skuIds: [], |
|
|
|
priceParam: { |
|
|
|
hotelPrice: 0, |
|
|
|
postPrice: 0, |
|
|
|
pickupPrice: 0, |
|
|
|
playPrice: 0, |
|
|
|
}, |
|
|
|
}; |
|
|
|
}, |
|
|
|
onLoad(options) { |
|
|
|
|
|
|
|
this.$store.commit("choseCoupon", ""); |
|
|
|
this.handleOrderGoods() |
|
|
|
}, |
|
|
|
onShow() { |
|
|
|
if (!this.isShoppingCart) { |
|
|
|
this.coupon = this.$store.state.user.coupon |
|
|
|
} |
|
|
|
this.coupon = this.$store.state.user.coupon |
|
|
|
// 不要删输出 |
|
|
|
console.log(this.coupon, this.$store.state.user.coupon) |
|
|
|
}, |
|
|
|
|
|
|
|
onReady () { |
|
|
@ -147,40 +186,150 @@ export default { |
|
|
|
handleOrderGoods () { |
|
|
|
// 特产处理 |
|
|
|
// let techanOrderList = this.$store.state.user.techanOrderList; |
|
|
|
let techanOrderList = JSON.parse(uni.getStorageSync("techanOrderList")) |
|
|
|
console.log(techanOrderList) |
|
|
|
let techanOrderList = JSON.parse(uni.getStorageSync("techanOrderList")) |
|
|
|
// console.log(techanOrderList) |
|
|
|
// 邮寄 |
|
|
|
this.postOrderList = techanOrderList.filter(v=>v.is_user_post == 1) |
|
|
|
// 自提 |
|
|
|
this.pickupOrderList = techanOrderList.filter(v=>v.is_user_post == 2) |
|
|
|
// 游玩处理 采摘 农家烟火 |
|
|
|
// let ticketOrderList = this.$store.state.user.ticketOrderList; |
|
|
|
// let foodOrderList = this.$store.state.user.foodOrderList; |
|
|
|
let ticketOrderList = (uni.getStorageSync("ticketOrderList")) || [] |
|
|
|
let foodOrderList = (uni.getStorageSync("foodOrderList")) || [] |
|
|
|
console.log(ticketOrderList, foodOrderList) |
|
|
|
this.playOrderList = ticketOrderList.concat(foodOrderList) |
|
|
|
// 酒店 |
|
|
|
// let hotelOrderList = this.$store.state.user.hotelOrderList; |
|
|
|
|
|
|
|
let ticketOrderList = this.$store.state.user.ticketOrderList; |
|
|
|
let foodOrderList = this.$store.state.user.foodOrderList; |
|
|
|
let hotelOrderList = this.$store.state.user.hotelOrderList; |
|
|
|
this.calPrice() |
|
|
|
}, |
|
|
|
|
|
|
|
calPrice () { |
|
|
|
let price1 = 0, price2 = 0, price3 =0 , price4 = 0; |
|
|
|
let skuIds = [] |
|
|
|
this.postOrderList.forEach(v=>{ |
|
|
|
price1+= v.sInfo.price * v.sInfo.buyNum + v.post |
|
|
|
skuIds.push(v.sInfo.id) |
|
|
|
}) |
|
|
|
this.pickupOrderList.forEach(v=>{ |
|
|
|
price2+= v.sInfo.price * v.sInfo.buyNum |
|
|
|
skuIds.push(v.sInfo.id) |
|
|
|
}) |
|
|
|
this.playOrderList.forEach(v=>{ |
|
|
|
price3+= v.sInfo.price * v.sInfo.buyNum |
|
|
|
skuIds.push(v.sInfo.id) |
|
|
|
}) |
|
|
|
this.hotelOrderList.forEach(v=>{ |
|
|
|
// price4+= v.sInfo.price * v.sInfo.buyNum |
|
|
|
}) |
|
|
|
|
|
|
|
this.skuIds = skuIds |
|
|
|
this.priceParam = { |
|
|
|
hotelPrice: price4, |
|
|
|
postPrice: price1, |
|
|
|
pickupPrice: price2, |
|
|
|
playPrice: price3, |
|
|
|
} |
|
|
|
this.allprice = price1+price2+price3+price4 |
|
|
|
// this.calAllPrice() |
|
|
|
this.getMaxCouponData() |
|
|
|
}, |
|
|
|
calAllPrice () { |
|
|
|
let price = 0 |
|
|
|
let allPrice = this.allprice |
|
|
|
if (this.coupon) { |
|
|
|
if (this.coupon.activity.fold == 0) { |
|
|
|
if (this.coupon.activity.money>allPrice) { |
|
|
|
price =0 |
|
|
|
}else{ |
|
|
|
price = allPrice - (this.coupon.activity.money) |
|
|
|
} |
|
|
|
|
|
|
|
} else{ |
|
|
|
price = allPrice - allPrice * (this.coupon.activity.fold*10/100) |
|
|
|
} |
|
|
|
} else { |
|
|
|
price = allPrice |
|
|
|
} |
|
|
|
return price < 0 ? 0 : (price/100).toFixed(2) |
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
goOrderCoupon () { |
|
|
|
let allPrice = 0 |
|
|
|
let skuIds= [] |
|
|
|
this.orderList.forEach(v=>{ |
|
|
|
allPrice+= v.sInfo.price*v.sInfo.buyNum |
|
|
|
if (v.sInfo.buyNum>0) { |
|
|
|
skuIds.push(v.sInfo.id) |
|
|
|
} |
|
|
|
}) |
|
|
|
|
|
|
|
uni.navigateTo({ |
|
|
|
url: `/subPackages/order/orderCoupon?allprice=${allPrice}&sku_ids=${skuIds.join(',')}` |
|
|
|
url: `/subPackages/order/orderCoupon?allprice=${this.allPrice}&sku_ids=${this.skuIds.join(',')}` |
|
|
|
}) |
|
|
|
}, |
|
|
|
|
|
|
|
// 总价 |
|
|
|
total() { |
|
|
|
|
|
|
|
}, |
|
|
|
// 预定 |
|
|
|
// 下单 |
|
|
|
order() { |
|
|
|
let goods = [] |
|
|
|
// 邮寄 |
|
|
|
this.postOrderList.forEach(item=>{ |
|
|
|
let param = { |
|
|
|
type: item.pInfo.type, |
|
|
|
product_id: item.pInfo.id, |
|
|
|
sku_id: item.sInfo.id, |
|
|
|
product_num: item.sInfo.buyNum, |
|
|
|
remark: item.remark, |
|
|
|
use_type:1, |
|
|
|
post: item.contacts.id |
|
|
|
} |
|
|
|
goods.push(param) |
|
|
|
}) |
|
|
|
// 自提 |
|
|
|
this.pickupOrderList.forEach(item=>{ |
|
|
|
let param = { |
|
|
|
type: item.pInfo.type, |
|
|
|
product_id: item.pInfo.id, |
|
|
|
sku_id: item.sInfo.id, |
|
|
|
product_num: item.sInfo.buyNum, |
|
|
|
remark: item.remark, |
|
|
|
use_type:2, |
|
|
|
pickup_shop_id : item.pickupAddress.id, |
|
|
|
pickup_shop_info : item.pickupAddress, |
|
|
|
} |
|
|
|
goods.push(param) |
|
|
|
}) |
|
|
|
// 游玩 |
|
|
|
this.playOrderList.forEach(item=>{ |
|
|
|
let param = { |
|
|
|
type: item.pInfo.type, |
|
|
|
product_id: item.pInfo.id, |
|
|
|
sku_id: item.sInfo.id, |
|
|
|
product_num: item.sInfo.buyNum, |
|
|
|
phone: item.phone, |
|
|
|
remark: item.remark, |
|
|
|
} |
|
|
|
if (item.showDate) { |
|
|
|
param.use_date= item.showDate.date ||''; |
|
|
|
param.start_time = item.showDate.start_time || ''; |
|
|
|
param.end_time = item.showDate.end_time || ''; |
|
|
|
} |
|
|
|
goods.push(param) |
|
|
|
}) |
|
|
|
|
|
|
|
let data = { |
|
|
|
product_list: goods, |
|
|
|
coupon_id: this.coupon ? this.coupon.id : null, |
|
|
|
} |
|
|
|
|
|
|
|
this.Post({ |
|
|
|
method: 'POST', |
|
|
|
data: JSON.stringify(data) |
|
|
|
}, '/api/order/create').then(res => { |
|
|
|
if (res.code == 1) { |
|
|
|
console.log(res.data.order_id); |
|
|
|
let order_id = res.data.order_id |
|
|
|
this.$store.commit("choseCoupon", ""); |
|
|
|
this.$store.commit("changeTechanOrderList", []); |
|
|
|
this.$store.commit("changeTicketOrderList", []); |
|
|
|
this.$store.commit("changeFoodOrderList", []); |
|
|
|
this.$store.commit("changeHotelOrderList", []); |
|
|
|
} |
|
|
|
}) |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
@ -188,16 +337,7 @@ export default { |
|
|
|
// 获取最大优惠券 |
|
|
|
async getMaxCouponData () { |
|
|
|
let allPrice =0 |
|
|
|
let skuIds = [] |
|
|
|
if (this.info && Array.isArray(this.info.goods)) { |
|
|
|
this.info.goods.forEach(v=>{ |
|
|
|
allPrice += v.skuInfo.money*v.skuInfo.buyNum |
|
|
|
if (v.skuInfo.buyNum>0) { |
|
|
|
skuIds.push(v.skuInfo.id) |
|
|
|
} |
|
|
|
}) |
|
|
|
} |
|
|
|
let param = {money:allPrice,sku_ids:skuIds.join(',')} |
|
|
|
let param = {money:this.allprice,sku_ids:this.skuIds.join(',')} |
|
|
|
let res = await this.getMaxCoupon(param) |
|
|
|
if (res.id) { |
|
|
|
this.coupon = res |
|
|
@ -305,6 +445,24 @@ view { |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
.ticket-item{ |
|
|
|
margin-bottom: 26rpx; |
|
|
|
border-bottom: 1px solid #D8D8D8; |
|
|
|
.other-info{ |
|
|
|
font-weight: 500; |
|
|
|
font-size: 28rpx; |
|
|
|
color: #333333; |
|
|
|
&>view{ |
|
|
|
padding: 20rpx 0 0; |
|
|
|
&:last-child{ |
|
|
|
padding-bottom: 20rpx; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
.cal-price{ |
|
|
|
font-weight: 500; |
|
|
|
font-size: 28rpx; |
|
|
|