jiazhipeng 4 months ago
parent
commit
b80bfdb7a3
  1. 10
      static/js/CommonFunction.js
  2. 19
      store/modules/user.js
  3. 2
      subPackages/order/orderCoupon.vue
  4. 110
      subPackages/techan/detail.vue
  5. 8
      subPackages/techan/order.vue
  6. 6
      subPackages/ticket/detail.vue
  7. 32
      subPackages/ticket/order.vue

10
static/js/CommonFunction.js

@ -225,6 +225,16 @@ Vue.prototype.getHeadImg = id => {
});
}
// 获取最大优惠券 params:{money:100,sku_ids:1,2} money单位分
Vue.prototype.getMaxCoupon = async function (param) {
param.money = (param.money||0)
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);
}
return res.data
}
// 根据类型跳转详情
Vue.prototype.gotoDetailByType = item => {
let url = ''

19
store/modules/user.js

@ -14,6 +14,11 @@ export default {
coupon: "",//景点下单选择优惠券
eshoppingCart: [],//自提产品购物车下单数据
sshoppingCart: [],//邮寄产品购物车下单数据
ticketOrderList: [], // 门票类下单
foodOrderList: [], // 农家烟火下单
techanOrderList: [], // 邮寄自提下单
meetRoomReserve: {
date: null, //使用日期信息
coupon: null, // 优惠券信息
@ -75,6 +80,18 @@ export default {
// 线路下单
changeLineInfo(state, data){
state.lineInfo = data
}
},
// 特产下单
changeTechanOrderList(state, data){
state.techanOrderList = data
},
// 门票下单
changeTicketOrderList(state, data){
state.ticketOrderList = data
},
// 农家烟火下单
changeFoodOrderList(state, data){
state.foodOrderList = data
},
}
}

2
subPackages/order/orderCoupon.vue

@ -86,7 +86,7 @@
this.getList();
},
onLoad(options) {
this.allPrice = (options.allprice) /100
this.allPrice = (options.allprice)
this.sku_ids = options.sku_ids
this.needDefault = options.needDefault
console.log('11111',options);

110
subPackages/techan/detail.vue

@ -1,6 +1,15 @@
<template>
<view class="bg" id="bg" v-if="info">
<view class="swipe-box">
<view class="scroll-all-box" id="menus">
<view :class="'scroll-menus fixed-menus'">
<view :class="'scroll-menu-item' + (type == 1 ? ' active' : '')" @click="changeMenu(1)">基本信息</view>
<view :class="'scroll-menu-item' + (type == 2 ? ' active' : '')" @click="changeMenu(2)">产品详情</view>
</view>
</view>
<view style="height: 88rpx"></view>
<view class="swipe-box info-box-query" id="box1">
<swiper class="swiper" :autoplay="true" :interval="3000" :duration="1000"
@change="swiperChange" circular>
<swiper-item v-for="(item, index) in info.listimg" :key="item.id">
@ -15,7 +24,7 @@
</view> -->
</view>
<view class="w-full relative">
<view class="w-full relative " >
<view class="price-box ">
<view class="flex flex-between" style="font-weight: 500;font-size: 24rpx;color: #666666;">
<view >
@ -34,7 +43,7 @@
</view>
</view>
<view class="price-box" style="margin-top: 20rpx;">
<view class="price-box info-box-query" id="box2" style="margin-top: 20rpx;">
<view class="pro-title">产品详情</view>
<view class="notice" >
<view class="rich-text" v-html="formateRichText(info.content)"></view>
@ -131,6 +140,10 @@
components: {cartDataVue},
data() {
return {
down: false,
type: 1,
fixed: false,
swiperCurrent: 0,
id: null,
@ -146,6 +159,23 @@
};
},
onPageScroll(e){
let query = uni.createSelectorQuery()
if (this.down) {
return
}else{
this.down = true
query.selectAll(".info-box-query").boundingClientRect(res=>{
let i = res.findLastIndex(v=>v.top-100<=0)
console.log(res, i)
if (i>=0) {
this.type = i+1
}
}).exec()
this.down = false
}
},
onLoad(option) {
this.id = option.id;
this.getInfo();
@ -255,6 +285,30 @@
swiperChange (e) {
this.swiperCurrent = e.detail.current
},
changeMenu(e) {
this.down = true
let index = e;
let that = this
const query = uni.createSelectorQuery(); //
query.select('#box'+index).boundingClientRect(); //toViewid
query.selectViewport().scrollOffset(); //
query.exec(function (res) {
console.log(res)
let scrollTop = res[0].top + res[1].scrollTop;
uni.pageScrollTo({
scrollTop: scrollTop-50,
duration: 200,
fail: (e)=>{
console.log(e)
},
complete: ()=>{
that.type = index
setTimeout(()=>{that.down = false},1000)
}
});
});
},
},
onReachBottom() {
@ -722,7 +776,7 @@
align-items: center;
justify-content: center;
position: fixed;
bottom: 140rpx;
bottom: 200rpx;
right: 20rpx;
z-index: 10;
image{
@ -730,5 +784,51 @@
height: 42rpx;
}
}
.scroll-all-box {
background-color: #fff;
.scroll-menus {
padding: 0 40rpx;
display: flex;
justify-content: space-between;
align-items: center;
font-size: 29rpx;
color: #333;
height: 84rpx;
padding-bottom: 12rpx;
.scroll-menu-item {
position: relative;
line-height: 84rpx;
flex: 1;
flex-shrink: 0;
text-align: center;
font-weight: bold;
font-size: 31rpx;
color: #010101;
}
.scroll-menu-item.active::after {
content: '1';
font-size: 0;
display: block;
position: absolute;
width: 73rpx;
height: 6rpx;
border-radius: 3rpx;
background: #6A8A27;
left: 50%;
margin-left: -37rpx;
bottom: 0rpx;
}
}
.fixed-menus {
position: fixed;
top: 0;
left: 0;
right: 0;
background: white;
z-index: 1;
}
}
</style>

8
subPackages/techan/order.vue

@ -256,10 +256,10 @@ export default {
goOrderCoupon () {
let allPrice = 0
let skuIds= []
this.info.goods.forEach(v=>{
allPrice+= v.skuInfo.money*v.skuInfo.buyNum
if (v.skuInfo.buyNum>0) {
skuIds.push(v.skuInfo.id)
this.orderList.forEach(v=>{
allPrice+= v.sInfo.price*v.sInfo.buyNum
if (v.sInfo.buyNum>0) {
skuIds.push(v.sInfo.id)
}
})
uni.navigateTo({

6
subPackages/ticket/detail.vue

@ -275,6 +275,7 @@
this.skuDoms = []
this.id = options.id;
this.getInfo();
this.getCartList()
// this.getGoodsList()
},
methods: {
@ -578,7 +579,8 @@
console.log(param)
uni.setStorageSync('ticketOrder', JSON.stringify(param));
this.$store.commit("changeTicketOrderList", param);
uni.navigateTo({
url:'/subPackages/ticket/order',
})
@ -714,7 +716,7 @@
.tip{
position: absolute;
left: 0;
bottom: 4rpx;
bottom: 0rpx;
width: 100%;
background: #EFF7DF;
height: 8rpx;

32
subPackages/ticket/order.vue

@ -186,10 +186,10 @@
goOrderCoupon () {
let allPrice = 0
let skuIds= []
this.pInfo.specifications.forEach(v=>{
allPrice+= v.price*v.buyNum
if (v.buyNum>0) {
skuIds.push(v.id)
this.orderList.forEach(v=>{
allPrice+= v.sInfo.price*v.sInfo.buyNum
if (v.sInfo.buyNum>0) {
skuIds.push(v.sInfo.id)
}
})
uni.navigateTo({
@ -200,10 +200,14 @@
//
async getMaxCouponData () {
let allPrice = 0
this.pInfo.specifications.forEach(v=>{
allPrice+= v.price*v.buyNum
let skuIds= []
this.orderList.forEach(v=>{
allPrice+= v.sInfo.price*v.sInfo.buyNum
if (v.sInfo.buyNum>0) {
skuIds.push(v.sInfo.id)
}
})
let param = {money:allPrice,sku_ids:this.sInfo.id}
let param = {sku_ids: skuIds.join(','), money: allPrice}
let res = await this.getMaxCoupon(param)
if (res.id) {
this.coupon = res
@ -211,9 +215,8 @@
},
initPageData () {
let data = uni.getStorageSync('ticketOrder');
let data = this.$store.state.user.ticketOrderList;
try{
data = JSON.parse(data)
data.forEach(v=>{
v.allSeldDate = v.allSeldDate || [];
v.seldDateIndex = v.seldDateIndex>=0?v.seldDateIndex:-1
@ -231,7 +234,7 @@
} catch(e){
console.log(e)
}
// this.getMaxCouponData()
this.getMaxCouponData()
},
clearTel () {this.phone = ''},
@ -969,19 +972,14 @@
margin-left: 15rpx;
font-size: 48rpx;
font-weight: bold;
color: #6A8A2D;
color: #D62828;
&:before {
content: '¥';
display: inline-block;
color: #6A8A2D;
color: #D62828;
font-size: 24rpx;
}
}
.post-text {
margin-left: 15rpx;
color: #6A8A2D;
font-size: 24rpx;
}
}
}

Loading…
Cancel
Save