Browse Source

期票和优惠券调整

master
shaojing 2 years ago
parent
commit
d79602fcc3
  1. 2
      app.js
  2. 3
      app.json
  3. 10
      pages/index/index.wxml
  4. 12
      pages/index/index.wxss
  5. 15
      pages/info/sceneProductInfo/index.js
  6. 13
      pages/order/components/coupon/index.js
  7. 4
      pages/order/components/date/index.wxml
  8. 6
      pages/order/components/date/index.wxss
  9. 39
      pages/order/scene/index.js
  10. 6
      pages/order/scene/index.wxml
  11. 2
      pages/user/cartlist/list.js
  12. 756
      subPackages/gwcOrder/index.js
  13. 8
      subPackages/gwcOrder/index.json
  14. 96
      subPackages/gwcOrder/index.wxml
  15. 343
      subPackages/gwcOrder/index.wxss

2
app.js

@ -21,7 +21,7 @@ App({
unique_key: "wechatxcx" unique_key: "wechatxcx"
}).then(res => { }).then(res => {
let data = JSON.parse(res.data); let data = JSON.parse(res.data);
data.isTest = data.isTest141? true : false; data.isTest = data.isTest142? true : false;
this.globalData.configJson = data this.globalData.configJson = data
}).then(() => { }).then(() => {
// 获取ui配置文件 // 获取ui配置文件

3
app.json

@ -193,7 +193,8 @@
"techanNew/index", "techanNew/index",
"techanCart/index", "techanCart/index",
"feiyiNew/index", "feiyiNew/index",
"postSearch/index" "postSearch/index",
"gwcOrder/index"
] ]
}], }],
"plugins": { "plugins": {

10
pages/index/index.wxml

@ -172,9 +172,13 @@
</view> </view>
<!-- 2024年 夏季改UI新增景区舒适度和实时路况 --> <!-- 2024年 夏季改UI新增景区舒适度和实时路况 -->
<view style="display: flex;"> <view style="display: flex;">
<view bindtap="gotoUrl" data-event="comfort_click" data-title="景区舒适度" data-url="https://m.cloud.sz-trip.com/ScenicComfort" class="jqssd"></view> <!-- <view bindtap="gotoUrl" data-event="comfort_click" data-title="景区舒适度" data-url="https://m.cloud.sz-trip.com/aiPlay" class="jqssd"> -->
<!-- <view bindtap="gotoUrl" data-event="xlqc" data-url="https://wlsjzx.wglj.suzhou.com.cn:8096/kt_h5/index.html#/home" class="sslk"></view> --> <view bindtap="gotoUrl" data-event="comfort_click" data-title="景区舒适度" data-url="https://m.cloud.sz-trip.com/ScenicComfort" class="jqssd">
<view bindtap="gotoUrls" data-event="xlqc" class="sslk"></view> <image src="{{indexSeason.ai}}" mode=""/>
</view>
<view bindtap="gotoUrls" data-event="xlqc" class="sslk">
<image src="{{indexSeason.avoid}}" mode=""/>
</view>
</view> </view>
<!-- 元旦修改 限时特惠--新版--> <!-- 元旦修改 限时特惠--新版-->
<view class="sale-road-boxes xpth" style="margin-bottom: 18.67rpx;margin-top: 0;padding-top: 0;" wx:if="{{!isTest}}"> <view class="sale-road-boxes xpth" style="margin-bottom: 18.67rpx;margin-top: 0;padding-top: 0;" wx:if="{{!isTest}}">

12
pages/index/index.wxss

@ -1178,15 +1178,19 @@ page {
bottom: 64rpx; bottom: 64rpx;
} }
.jqssd { .jqssd {
background: url("https://static.ticket.sz-trip.com/uploads/20240606/20c06c5bf8d5e498667ebd954a1d95f8.png"); /* background: url("https://static.ticket.sz-trip.com/uploads/20240606/20c06c5bf8d5e498667ebd954a1d95f8.png");
background-size: 100% 100%; background-size: 100% 100%; */
width: 365.33rpx; width: 365.33rpx;
height: 166rpx; height: 166rpx;
flex-shrink: 0; flex-shrink: 0;
} }
.jqssd image, .sslk image{
width: 100%;
height: 100%;
}
.sslk { .sslk {
background: url("https://static.ticket.sz-trip.com/uploads/20240729/c1554fdd645a0d3a47c8e683186e1a73.png"); /* background: url("https://static.ticket.sz-trip.com/uploads/20240729/c1554fdd645a0d3a47c8e683186e1a73.png");
background-size: 100% 100%; background-size: 100% 100%; */
width: 365.33rpx; width: 365.33rpx;
height: 166rpx; height: 166rpx;
flex-shrink: 0; flex-shrink: 0;

15
pages/info/sceneProductInfo/index.js

@ -360,7 +360,9 @@ Page({
app.globalData.list = [] app.globalData.list = []
app.globalData.listName = null app.globalData.listName = null
if (this.data.skuFlag == 'order') { if (this.data.skuFlag == 'order') {
if (e.currentTarget.dataset.disable === 1) return; console.log(app.globalData.sku);
if (app.globalData.product.product.flag==0 || app.globalData.product.sku.flag=='off') return;
// if (e.currentTarget.dataset.disable === 1) return;
util.pagePoint({ util.pagePoint({
event: 'scene_order', event: 'scene_order',
param: { param: {
@ -770,7 +772,8 @@ Page({
}, },
product = { product = {
product: e.currentTarget.dataset.product product: e.currentTarget.dataset.product
} },
ticket_type = e.currentTarget.dataset.sku.ticket_type
console.log(sku,product); console.log(sku,product);
product.productNum = 1 product.productNum = 1
app.globalData.product = { app.globalData.product = {
@ -778,6 +781,8 @@ Page({
...product ...product
} }
console.log(app.globalData.product); console.log(app.globalData.product);
console.log(ticket_type);
if (ticket_type != 2) {
this.setData({ this.setData({
showDate: true, showDate: true,
}) })
@ -787,6 +792,12 @@ Page({
skuFlag: 'order', skuFlag: 'order',
showPrice:e.currentTarget.dataset.sku.price showPrice:e.currentTarget.dataset.sku.price
}) })
}else {
this.setData({
skuFlag: 'order'
})
this.order()
}
}, },
//立即预定 //立即预定
showOrder: function () { showOrder: function () {

13
pages/order/components/coupon/index.js

@ -13,6 +13,19 @@ Component({
sku:{ sku:{
type:String, type:String,
value:"" value:""
},
couponFlag:{
type:Boolean,
value:false,
observer(nv, ov) {
console.log(nv,ov)
if (nv) {
app.globalData.couponInfo = null
this.setData({
coupon:null
})
}
}
} }
}, },

4
pages/order/components/date/index.wxml

@ -24,7 +24,7 @@
<view class="date-box"> <view class="date-box">
<view class="box-title">{{skuName}}</view> <view class="box-title">{{skuName}}</view>
<view style="border-top: 1rpx solid #ccc;padding: 48rpx 0 0 21rpx;"> <view style="border-top: 1rpx solid #ccc;padding: 48rpx 0 0 21rpx;">
<view style="font-weight: 500;font-size: 31rpx;color: #000000;"> <view style="font-weight: 500;font-size: 31rpx;color: #000000;margin-bottom: 40rpx;">
使用日期 使用日期
</view> </view>
<view class="dates-boxes"> <view class="dates-boxes">
@ -55,7 +55,7 @@
</view> </view>
</view> </view>
<view wx:if="{{timelist.length>0}}"> <view wx:if="{{timelist.length>0}}">
<view style="margin-top: 10rpx;padding-left: 18rpx;"> <view style="margin-top: 10rpx;padding-left: 18rpx;margin-bottom: 40rpx;">
选择时段 选择时段
</view> </view>
<view class="date-times" wx:if="{{timelist.length>0}}"> <view class="date-times" wx:if="{{timelist.length>0}}">

6
pages/order/components/date/index.wxss

@ -16,7 +16,9 @@
.dates-boxes { .dates-boxes {
display: flex; display: flex;
align-items: center; align-items: center;
padding: 31rpx 0; padding: 0 0 31rpx;
border:none;
/* padding: 31rpx 0; */
/* padding: 31rpx 21rpx; */ /* padding: 31rpx 21rpx; */
/* border-top: 1rpx solid #ccc; */ /* border-top: 1rpx solid #ccc; */
} }
@ -79,7 +81,7 @@
justify-content: space-between; justify-content: space-between;
align-items: center; align-items: center;
margin: 0 21rpx; margin: 0 21rpx;
padding-top: 34rpx; /* padding-top: 34rpx; */
padding-bottom: 10rpx; padding-bottom: 10rpx;
/* border-top: 1rpx dashed #ccc; */ /* border-top: 1rpx dashed #ccc; */
flex-wrap: wrap; flex-wrap: wrap;

39
pages/order/scene/index.js

@ -44,7 +44,8 @@ Page({
bookingInfoTitle: "", bookingInfoTitle: "",
showDate:false, showDate:false,
showDate2:false, showDate2:false,
showYhq:null showYhq:null,
couponFlag:false
}, },
/** /**
@ -164,6 +165,26 @@ Page({
}) })
} }
// console.log(this.data.singlePrice); // console.log(this.data.singlePrice);
}else {
let price
if (this.data.coupon) {
if (this.data.coupon.discount_type == 'pricebreak') {
price = this.data.singlePrice * this.data.productNum - this.data.coupon.activity.money
} else {
price =(this.data.singlePrice * this.data.productNum * this.data.coupon.activity.fold)/ 10
}
} else {
price = this.data.singlePrice * this.data.productNum
}
if (price >0) {
this.setData({
price:price/100
})
}else {
this.setData({
price:0
})
}
} }
// let price = this.data.singlePrice * this.data.productNum - (this.data.coupon?this.data.coupon.activity.money:0) // let price = this.data.singlePrice * this.data.productNum - (this.data.coupon?this.data.coupon.activity.money:0)
// 多写了一遍 // 多写了一遍
@ -274,9 +295,11 @@ Page({
} }
app.globalData.couponInfo = null; app.globalData.couponInfo = null;
console.log(this.data.couponFlag);
this.setData({ this.setData({
productNum: (this.data.productNum - 1), productNum: (this.data.productNum - 1),
coupon: null coupon: null,
couponFlag:true
}) })
this.data.product.num = this.data.productNum this.data.product.num = this.data.productNum
// this.changePrice() // this.changePrice()
@ -389,6 +412,15 @@ Page({
linkmanIds.push(item.id) linkmanIds.push(item.id)
}) })
} }
if (this.data.is_authentication == 0) { //是否实名:0否1是
if (this.data.phone == '') {
wx.showToast({
title: '请填写手机号',
icon: 'none'
})
return
}
}
let data = { let data = {
coupon_id: this.data.coupon ? this.data.coupon.id : null, coupon_id: this.data.coupon ? this.data.coupon.id : null,
source: "WECHATXCX", source: "WECHATXCX",
@ -759,6 +791,9 @@ Page({
* 生命周期函数--监听页面隐藏 * 生命周期函数--监听页面隐藏
*/ */
onHide: function () { onHide: function () {
this.setData({
couponFlag:false
})
}, },
/** /**

6
pages/order/scene/index.wxml

@ -13,7 +13,7 @@
<view style="font-weight: 500;font-size: 36rpx;color: #000000;margin-bottom: 39rpx;" class="textOver2"> <view style="font-weight: 500;font-size: 36rpx;color: #000000;margin-bottom: 39rpx;" class="textOver2">
{{product.product.title}} {{product.product.title}}
</view> </view>
<view style="font-weight: 400;font-size: 25rpx;color: #666666;padding-left: 2rpx;"> <view style="font-weight: 400;font-size: 25rpx;color: #666666;padding-left: 2rpx;" wx:if="{{ticket_type!= 2}}">
<view style="margin-bottom: 20rpx;"> <view style="margin-bottom: 20rpx;">
{{date.date}} {{date.week}} {{date.date}} {{date.week}}
</view> </view>
@ -22,7 +22,7 @@
</view> </view>
</view> </view>
</view> </view>
<view class="change-date" bindtap="changeDate"> <view class="change-date" bindtap="changeDate" wx:if="{{ticket_type!= 2}}">
修改 > 修改 >
</view> </view>
</view> </view>
@ -71,7 +71,7 @@
</view> </view>
<coupon bind:getNewCoupon = 'getNewCoupon' wx:if="{{!kjId && !gp_id && type!='activity' && product && product.isGroup!=1 && isCar=='single' && type!='museum' && showYhq}}" id="coupon" <coupon bind:getNewCoupon = 'getNewCoupon' wx:if="{{!kjId && !gp_id && type!='activity' && product && product.isGroup!=1 && isCar=='single' && type!='museum' && showYhq}}" id="coupon"
money="{{singlePrice * productNum}}" sku="{{product.sku.id}}"></coupon> money="{{singlePrice * productNum}}" sku="{{product.sku.id}}" couponFlag="{{couponFlag}}"></coupon>
<!-- <view class="box" wx:if="{{type!='activity' && product && product.isGroup!=1}}"> <!-- <view class="box" wx:if="{{type!='activity' && product && product.isGroup!=1}}">
<view class="box-title" wx:if="{{flag!='mix'}}"> <view class="box-title" wx:if="{{flag!='mix'}}">

2
pages/user/cartlist/list.js

@ -216,7 +216,7 @@ Page({
}) })
} else { } else {
wx.navigateTo({ wx.navigateTo({
url: '/pages/order/scene/index?isCar=' + this.data.isCar, url: '/subPackages/gwcOrder/index?isCar=' + this.data.isCar,
}) })
} }
} }

756
subPackages/gwcOrder/index.js

@ -0,0 +1,756 @@
// pages/order/scene/index.js
let app = getApp()
import util from "../../utils/util"
import commonApi from "../../utils/https/common"
Page({
/**
* 页面的初始数据
*/
data: {
product:null,
productNum: 1,
linkmanList: [],
date: "",
time: "",
remark: "",
singlePrice: 0,
type: null,
coupon:null,
isLogin: false,
kjId: null,
gp_id: null,
groupName: "",
prizeId: null,
select_allowance: false,
showAllowance: false,
allowance_data: null,
allowance_price: 0,
pIndex: 0,
flag:null,
ticket_type:1,
isCar:'single',
showMask: false,
price:0,
is_need_idcard:1,
is_authentication:1, // 是否实名,0否1是,默认实名
phone:'', //不实名时传的手机号
is_real_name:1, // 是否是一证一票,0否1是,
status:false
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.setData({
product: app.globalData.product,
type: options.type,
kjId: app.globalData.kjId,
gp_id: app.globalData.gp_id || app.globalData.team_id,
prizeId: wx.getStorageSync('prizeId'),
flag:options.flag,
date:null,
ticket_type:app.globalData.product.sku.ticket_type || 1,
isCar:options.isCar,
is_need_idcard:app.globalData.product.sku.sku_model.is_need_idcard,
is_authentication:app.globalData.product.sku.sku_model.is_authentication,
is_real_name:app.globalData.product.sku.sku_model.is_real_name,
})
console.log('-------',app.globalData.product.sku.sku_model.is_need_idcard);
console.log('---是否实名----',app.globalData.product.sku.sku_model.is_authentication);
console.log('---一证一票----',app.globalData.product.sku.sku_model.is_real_name);
if (!app.globalData.product) {
util.back();
return;
}
if (app.globalData.product.productNum) {
this.setData({
productNum: app.globalData.product.productNum < 1 ? 1 : app.globalData.product.productNum
})
}else{
this.setData({
productNum: app.globalData.product.num == null ? 1 : app.globalData.product.num
})
}
this.setData({
product: app.globalData.product,
singlePrice: this.data.gp_id ? app.globalData.product.sku.event_price : app.globalData.product.sku.price
})
console.log(this.data.singlePrice);
this.showAllPrice()
this.getNewCoupon()
// console.log('********',this.data.product);
if (!this.data.kjId && !this.data.gp_id && this.data.product.isGroup != 1 && this.data.type!='museum') {
this.couponCom = this.selectAllComponents("#coupon")[0];
}
},
// next: function () {
// this.setData({
// showMask:true
// })
// },
showAllPrice:function () {
// console.log('detail',app.globalData.product);
// console.log('singlePrice',this.data.singlePrice);
// console.log('productNum',this.data.productNum);
console.log('couponInfo',app.globalData.couponInfo);
if (this.data.ticket_type != 1) {
// this.setData({
// singlePrice:app.globalData.product.product.price
// })
let price
if (this.data.coupon) {
console.log(app.globalData.couponInfo,this.data.coupon);
if (this.data.coupon.activity.discount_type == 'pricebreak') {
price = this.data.singlePrice * this.data.productNum - this.data.coupon.activity.money
} else {
price =(this.data.singlePrice * this.data.productNum * this.data.coupon.activity.fold)/ 10
}
} else {
price = this.data.singlePrice * this.data.productNum
}
if (price >0) {
this.setData({
price:price/100
})
}else {
this.setData({
price:0
})
}
// console.log(this.data.singlePrice);
}else {
let price
if (this.data.coupon) {
if (this.data.coupon.discount_type == 'pricebreak') {
price = this.data.singlePrice * this.data.productNum - this.data.coupon.activity.money
} else {
price =(this.data.singlePrice * this.data.productNum * this.data.coupon.activity.fold)/ 10
}
} else {
price = this.data.singlePrice * this.data.productNum
}
if (price >0) {
this.setData({
price:price/100
})
}else {
this.setData({
price:0
})
}
}
// let price = this.data.singlePrice * this.data.productNum - (this.data.coupon?this.data.coupon.activity.money:0)
// 多写了一遍
// let price
// if (this.data.coupon) {
// if (this.data.coupon.discount_type == 'pricebreak') {
// price = this.data.singlePrice * this.data.productNum - this.data.coupon.activity.money
// } else {
// price =(this.data.singlePrice * this.data.productNum * this.data.coupon.activity.fold)/ 10
// }
// } else {
// price = this.data.singlePrice * this.data.productNum
// }
// if (price >0) {
// this.setData({
// price:price/100
// })
// }else {
// this.setData({
// price:0
// })
// }
},
cancel: function () {
this.setData({
showMask:false
})
},
changeGroupName: function (e) {
this.setData({
groupName: e.detail.value
})
},
setLinkman: function (e) {
if (e.detail.phone || e.detail.phone=='') {
this.setData({
phone:e.detail.phone
})
}else {
console.log(e);
let linkmanList = e.detail;
if (this.data.productNum != linkmanList.length && this.data.coupon) {
wx.showToast({
title: '订单价格发生变化,请重新选择优惠券',
icon: 'none'
})
// if (!this.data.kjId && !this.data.gp_id && this.data.product.isGroup != 1) {
// this.couponCom.setNullCoupon()
// }
// app.globalData.couponInfo = null;
// this.setData({
// coupon: null
// })
}
// let productNum = linkmanList.length == 0 ? 1 : this.data.productNum < linkmanList.length ? linkmanList.length : this.data.productNum;
// if (this.data.gp_id) {
// productNum = app.globalData.product.maxNum;
// }
this.setData({
// productNum: productNum,
linkmanList: linkmanList
})
console.log(this.data.linkmanList);
// this.changePrice()
this.totalPrice(this.data.singlePrice)
}
},
add: function () {
if (this.data.productNum==undefined) {
wx.showToast({
title: '请先添加出行人',
icon: 'none'
})
return
}
if (this.data.product.sku.sku_model.traveller_limit_num != 0 && this.data.productNum == this.data.product.sku.sku_model.traveller_limit_num) {
wx.showToast({
title: '本产品单笔限购' + this.data.product.sku.sku_model.traveller_limit_num + "份",
icon: 'none'
})
return;
}
this.setData({
productNum: this.data.productNum + 1
})
this.data.product.num = this.data.productNum
// this.changePrice()
// this.showAllPrice()
this.totalPrice(this.data.singlePrice)
},
minus: function () {
if (this.data.productNum==undefined) {
wx.showToast({
title: '请先添加出行人',
icon: 'none'
})
return
}
if (this.data.productNum == 1) return;
if (this.data.coupon) {
wx.showToast({
title: '订单价格发生变化,请重新选择优惠券',
icon: 'none'
})
}
if (!this.data.kjId && !this.data.gp_id && this.data.product.isGroup != 1 && !this.data.flag && this.data.type!='museum') {
// this.couponCom.setNullCoupon()
}
app.globalData.couponInfo = null;
this.setData({
productNum: (this.data.productNum - 1),
coupon: null
})
this.data.product.num = this.data.productNum
// this.changePrice()
// this.showAllPrice()
this.totalPrice(this.data.singlePrice)
},
totalPrice(price) {
let allPrice
if (this.data.coupon) {
if (this.data.coupon.activity.discount_type == 'pricebreak') {
allPrice = this.data.singlePrice * this.data.productNum - this.data.coupon.activity.money
} else {
allPrice =(this.data.singlePrice * this.data.productNum * this.data.coupon.activity.fold)/ 10
}
} else {
allPrice = this.data.singlePrice * this.data.productNum
}
// allPrice = price * this.data.productNum - (this.data.coupon?this.data.coupon.activity.money:0)
if (allPrice >0) {
this.setData({
price:allPrice/100,
singlePrice:price
})
}else {
this.setData({
price:0,
singlePrice:price
})
}
console.log('singlePrice',this.data.singlePrice);
},
changeDate: function (e) {
console.log('打印',e);
// debugger
// this.showAllPrice()
this.totalPrice(e.detail.price)
if (e.detail.price != this.data.singlePrice && this.data.coupon) {
wx.showToast({
title: '订单价格发生变化,请重新选择优惠券',
icon: 'none'
})
this.setData({
coupon: null,
singlePrice:e.detail.price
})
if (!this.data.kjId && !this.data.gp_id && this.data.product.isGroup != 1 && this.data.type!='museum') {
this.couponCom.setNullCoupon()
}
app.globalData.couponInfo = null;
}
this.setData({
date: e.detail,
singlePrice: this.data.gp_id ? this.data.product.sku.event_price : e.detail.price
})
// this.changePrice()
},
changeTime: function (e) {
this.setData({
time: e.detail
})
},
changeAllowance: function () {
this.setData({
showAllowance: !this.data.showAllowance
})
},
changeRemark: function (e) {
this.setData({
remark: e.detail.value
})
},
/**
* 补贴价
*/
changePrice: function () {
let product = this.data.product, price = product.sku.price;
if (this.data.allowance_data && this.data.select_allowance && this.data.allowance_price) {
let spread_price = Number(this.data.allowance_data.discount_limit_price - this.data.allowance_data.user_used_price);
price -= this.data.allowance_price < spread_price ? this.data.allowance_price : spread_price
}
this.setData({
singlePrice: app.globalData.kjId ? 0 : price
})
},
order:function() {
let linkmanList = this.data.linkmanList, productNum = this.data.productNum, date = this.data.date, time = this.data.time, remark = this.data.remark, product = this.data.product;
let linkmanIds = [];
if (linkmanList.length==0 && this.data.is_authentication == 1) {
wx.showToast({
title: '请选择出行人',
icon: 'none'
})
return
}
if (this.data.is_authentication == 1) {
linkmanList.map(item => {
linkmanIds.push(item.id)
})
}
let data = {
coupon_id: this.data.coupon ? this.data.coupon.id : null,
source: "WECHATXCX",
product_list: [{
type: product.product.type,
product_id: product.product.id,
sku_id: (date && date.sku_id) ? date.sku_id : product.sku.id,
start_time: time.start_time,
end_time: time.end_time,
use_date: date ? date.date : '',
visitors: linkmanIds.join(","),
remark: remark,
product_num: app.globalData.product.isGroup == 1 ? 1 : productNum,
phone:this.data.phone,// 不实名的时候传的手机号参数
}],
originate_order_id: this.data.kjId,
gp_id: app.globalData.gp_id,
team_id: app.globalData.team_id,
linkmanList:this.data.is_authentication == 1?this.data.linkmanList:[]
}
if (app.globalData.from) {
data.system_name = app.globalData.from;
}
if (app.globalData.retailId) {
data.commission_code = app.globalData.retailId;
app.globalData.retailId = null;
}
if (app.globalData.category_id) {
data.category_id = app.globalData.category_id;
}
if (this.data.prizeId) {
data.lottery_id = this.data.prizeId
}
let service = 'order/create', postData = {
data: JSON.stringify(data)
}
if (app.globalData.product.isGroup == 1) {
service = "team_order/appoint"
postData.member_num = this.data.productNum
postData.team_name = this.data.groupName
postData.type = 1;
}
if(app.globalData.list){
app.globalData.list[app.globalData.index] = this.data.product
// app.globalData.list[app.globalData.index].linkmanList = this.data.linkmanList
if (app.globalData.list[app.globalData.index].sku.sku_model.is_authentication == 0) {
app.globalData.list[app.globalData.index].phone = this.data.phone
app.globalData.list[app.globalData.index].linkmanList = []
}else {
app.globalData.list[app.globalData.index].linkmanList = this.data.linkmanList
}
}
// app.globalData.linkmanList = this.data.linkmanList
app.globalData.ticketPrice += (this.data.singlePrice * this.data.productNum - (this.data.coupon?this.data.coupon.activity.money:0))/100;
console.log(app.globalData);
if(app.globalData.list && app.globalData.list.length > app.globalData.index + 1 &&this.data.type!='museum'){
if(app.globalData.createDate){
app.globalData.createDate.product_list.push(data.product_list[0])
}else{
app.globalData.createDate = data
}
console.log(app.globalData.createDate);
app.globalData.index = app.globalData.index + 1
app.globalData.product = app.globalData.list[app.globalData.index]
wx.redirectTo({
url: '/subPackages/gwcOrder/index?flag='+ this.data.flag+'&isCar='+this.data.isCar,
})
return
}else{
if(app.globalData.list && app.globalData.list.length > 1 || app.globalData.postProduct.length>0){
if(app.globalData.createDate){
app.globalData.createDate.product_list.push(data.product_list[0])
}
wx.redirectTo({
url: '/pages/order/orderList/index?flag='+ this.data.flag
})
}else{
commonApi.user_post(service, postData).then(res => {
if (app.globalData.kjId) {
this.setData({
kjId: null
});
app.globalData.kjId = null;
}
if (app.globalData.gp_id) {
this.setData({
gp_id: null
});
app.globalData.gp_id = null;
}
if (res.code == 1 && app.globalData.product.isGroup == 1) {
// 团购跳转到团购详情
wx.navigateTo({
url: '/pages/info/groupOrderInfo/index?id=' + res.data.order_id + '&from=order'
})
}
})
}
}
},
next: function () {
console.log(this.data)
let linkmanList = this.data.linkmanList, productNum = this.data.productNum, date = this.data.date, time = this.data.time, remark = this.data.remark, product = this.data.product;
let linkmanIds = [];
if (this.data.is_need_idcard == 1) {
if (linkmanList.length < productNum && app.globalData.product.isGroup != 1) {
wx.showToast({
title: '请添加出行人',
icon: "none"
})
return;
}
}
if (!date && this.data.ticket_type == 1) {
wx.showToast({
title: '请选择使用日期',
icon: 'none'
})
return
}
if (linkmanList.length!=productNum && this.data.is_authentication == 1 && this.data.is_real_name == 1) {
wx.showToast({
title: '购票数量要和出行人数量一致',
icon: 'none'
})
return
}
if (!util.isTel(this.data.phone) &&this.data.is_authentication == 0) {
wx.showToast({
title: '请输入正确的手机号',
icon: 'none'
})
return
}
if (!time && date && date.is_time_stock == true) {
wx.showToast({
title: '请选择使用时间',
icon: 'none'
})
return
}
if (app.globalData.product.isGroup == 1 && !this.data.groupName) {
wx.showToast({
title: '请输入团队主体名称',
icon: 'none'
})
return;
}
// if (this.data.phone) {
// linkmanList.map(item => {
// linkmanIds.push(item.id)
// })
// }
// console.log(app.globalData);
// debugger
this.setData({
showMask:true
})
// linkmanList.map(item => {
// linkmanIds.push(item.id)
// })
// console.log(date)
// let data = {
// coupon_id: this.data.coupon ? this.data.coupon.id : null,
// source: "WECHATXCX",
// product_list: [{
// type: product.product.type,
// product_id: product.product.id,
// sku_id: (date && date.sku_id) ? date.sku_id : product.sku.id,
// start_time: time.start_time,
// end_time: time.end_time,
// use_date: date ? date.date : '',
// visitors: linkmanIds.join(","),
// remark: remark,
// product_num: app.globalData.product.isGroup == 1 ? 1 : productNum
// }],
// originate_order_id: this.data.kjId,
// gp_id: app.globalData.gp_id,
// team_id: app.globalData.team_id,
// linkmanList:this.data.linkmanList
// }
// if (app.globalData.from) {
// data.system_name = app.globalData.from;
// }
// if (app.globalData.retailId) {
// data.commission_code = app.globalData.retailId;
// app.globalData.retailId = null;
// }
// if (app.globalData.category_id) {
// data.category_id = app.globalData.category_id;
// }
// if (this.data.prizeId) {
// data.lottery_id = this.data.prizeId
// }
// let service = 'order/create', postData = {
// data: JSON.stringify(data)
// }
// if (app.globalData.product.isGroup == 1) {
// service = "team_order/appoint"
// postData.member_num = this.data.productNum
// postData.team_name = this.data.groupName
// postData.type = 1;
// }
// if(app.globalData.list){
// app.globalData.list[app.globalData.index] = this.data.product
// app.globalData.list[app.globalData.index].linkmanList = this.data.linkmanList
// }
// // app.globalData.linkmanList = this.data.linkmanList
// app.globalData.ticketPrice += (this.data.singlePrice * this.data.productNum - (this.data.coupon?this.data.coupon.activity.money:0))/100;
// console.log(app.globalData);
// if(app.globalData.list && app.globalData.list.length > app.globalData.index + 1 &&this.data.type!='museum'){
// if(app.globalData.createDate){
// app.globalData.createDate.product_list.push(data.product_list[0])
// }else{
// app.globalData.createDate = data
// }
// app.globalData.index = app.globalData.index + 1
// app.globalData.product = app.globalData.list[app.globalData.index]
// wx.redirectTo({
// url: '/pages/order/scene/index?flag='+ this.data.flag+'&isCar='+this.data.isCar,
// })
// return
// }else{
// if(app.globalData.list && app.globalData.list.length > 1 || app.globalData.postProduct.length>0){
// if(app.globalData.createDate){
// app.globalData.createDate.product_list.push(data.product_list[0])
// }
// wx.redirectTo({
// url: '/pages/order/orderList/index?flag='+ this.data.flag
// })
// }else{
// commonApi.user_post(service, postData).then(res => {
// if (app.globalData.kjId) {
// this.setData({
// kjId: null
// });
// app.globalData.kjId = null;
// }
// if (app.globalData.gp_id) {
// this.setData({
// gp_id: null
// });
// app.globalData.gp_id = null;
// }
// if (res.code == 1 && app.globalData.product.isGroup == 1) {
// // 团购跳转到团购详情
// wx.navigateTo({
// url: '/pages/info/groupOrderInfo/index?id=' + res.data.order_id + '&from=order'
// })
// }
// })
// }
// }
},
// 活动预约
activityOrder: function () {
if (this.data.linkmanList && this.data.linkmanList.length > 0) {
commonApi.user_post("pbservice/Culture/booking", {
id: this.data.product.product.id,
name: this.data.linkmanList[0].name,
card_number: this.data.linkmanList[0].id_number,
tel: this.data.linkmanList[0].tel
}).then(res => {
if (res.code == 1) {
wx.showToast({
title: '预约成功',
icon: 'success'
})
setTimeout(() => {
wx.navigateBack()
}, 1000)
return;
}
})
}
else {
wx.showToast({
title: '请选择出行人',
icon: 'none'
})
return;
}
},
/**
* 选择补贴
*/
selectAllowance: function () {
this.setData({
select_allowance: !this.data.select_allowance
})
this.changePrice()
},
//获取最高优惠券
getNewCoupon(e){
this.setData({
coupon:e.detail
})
this.showAllPrice()
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
// this.setData({
// productNum:1
// })
// app.globalData.productNum =1
if(app.globalData.list && app.globalData.list.length != 0 && this.data.type!='museum'){
app.globalData.product = app.globalData.list[app.globalData.index]
}
if (!this.data.isLogin) {
commonApi.user_post("token/check").then(res => {
if (res.code == 1) {
this.setData({
isLogin: true
})
}
})
}
// this.setData({
// coupon: app.globalData.couponInfo
// })
// 获取补贴
// if (this.data.product) {
// commonApi.user_post("product/getProductAllowancePrice", {
// product_code: this.data.product.product.product_code
// }).then(resTwo => {
// if (resTwo && resTwo.code == 1) {
// this.setData({
// allowance_data: resTwo.data
// })
// let spread_price = Number(this.data.allowance_data.discount_limit_price - this.data.allowance_data.user_used_price)
// let sInfo = this.data.product.sku
// if (spread_price > 0) {
// if (spread_price < this.data.allowance_data.discount_rate / 100 * sInfo.price) {
// this.setData({
// allowance_price: spread_price
// })
// } else {
// this.setData({
// allowance_price: this.data.allowance_data.discount_rate / 100 * sInfo.price
// })
// }
// this.changePrice()
// } else {
// this.setData({
// allowance_price: 0
// })
// }
// }
// })
// }
// console.log('-----',app.globalData.product.sku.price);
// app.globalData.product = delete(app.globalData.product.detail)
// this.showAllPrice()
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
this.setData({
kjId: null,
gp_id: null
});
app.globalData.kjId = null;
app.globalData.gp_id = null;
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
}
})

8
subPackages/gwcOrder/index.json

@ -0,0 +1,8 @@
{
"usingComponents": {
"title":"/pages/component/TitleHeader",
"date":"../../pages/order/components/date/index",
"contact":"../../pages/order/components/contact/index",
"coupon":"../../pages/order/components/coupon/index"
}
}

96
subPackages/gwcOrder/index.wxml

@ -0,0 +1,96 @@
<!--pages/order/scene/index.wxml-->
<view class="{{product && product.isGroup==1?'group-order':''}}">
<title title="订单填写"></title>
<view class="product-info" wx:if="{{product && product.sku.ticket_type == 2}}">
<view class="product-title">{{product.product.title + product.isGroup==1?'(团体预约)':product.sku.sku_name}}</view>
<view class="product-price" wx:if="{{type=='museum' || type=='activity'}}">免费</view>
</view>
<date wx:if="{{isLogin && type!='activity' && ticket_type == 1}}" bind:onChangeDate="changeDate" bind:onChangeTime="changeTime"
product="{{product}}"></date>
<view class="box" wx:if="{{product && product.isGroup==1}}">
<view class="box-title">
<view style="flex-shrink:0">团体主体名称:</view>
<input type="text" placeholder="请输入名称" bindinput="changeGroupName"></input>
</view>
</view>
<view class="box">
<view class="box-title">
<view style="flex:1">{{product && product.isGroup!=1?'购票数量':'预约人数'}}</view>
<view class="iconfont icon-sami-select" wx:if="{{!kjId && !gp_id && type!='activity'}}" bindtap="minus"></view>
<view class="number-box">{{productNum}}</view>
<view class="iconfont icon-add-select" wx:if="{{!kjId && !gp_id && type!='activity'}}" bindtap="add"></view>
</view>
</view>
<contact wx:if="{{isLogin}}" type="{{type}}" bind:setLinkman="setLinkman" productNum="{{productNum}}" is_authentication="{{is_authentication}}" is_real_name="{{is_real_name}}"></contact>
<!-- 补贴 -->
<view class="box">
<view class="box-title allowance" wx:if="{{allowance_price}}">
<view bindtap="changeAllowance">惠民补贴</view>
<view class="com-flex-tao" bindtap="selectAllowance">
-¥{{allowance_price / 100}}
<image src="https://sz-qd.oss-cn-hangzhou.aliyuncs.com/uploads/20220602/6ecdbc41527c0c603608686967d4493b.png"
alt="" wx:if="{{select_allowance}}"></image>
<view class="border" wx:else></view>
</view>
</view>
</view>
<coupon bind:getNewCoupon = 'getNewCoupon' wx:if="{{!kjId && !gp_id && type!='activity' && product && product.isGroup!=1 && isCar=='single' && type!='museum'}}" id="coupon"
money="{{singlePrice * productNum}}" sku="{{product.sku.id}}"></coupon>
<!-- <view class="box" wx:if="{{type!='activity' && product && product.isGroup!=1}}">
<view class="box-title" wx:if="{{flag!='mix'}}">
<view style="flex-shrink:0">订单备注</view>
<input type="text" bindinput="changeRemark" placeholder="选填"></input>
</view>
</view> -->
<view style="{{type=='museum' || type=='activity'?'height:138rpx':'height:113rpx'}}"></view>
<view class="fixed-bottom" wx:if="{{type!='museum' && type!='activity'}}">
<view class="fixed-price-box" wx:if="{{kjId || prizeId}}"><text>合计:</text><text class="price">¥0</text></view>
<!-- <view class="fixed-price-box" wx:elif="{{prizeId}}"><text>合计:</text><text class="price">¥0</text></view> -->
<view class="fixed-price-box" wx:else><text>合计:</text>
<text class="price">¥{{price}}</text>
</view>
<view class="fixed-btn" bindtap="next">下一步</view>
</view>
<view class="fixed-bottom yuyue-box" wx:else>
<view class="fixed-btn yuyue-btn" bindtap="order" wx:if="{{type=='museum'}}">立即预约</view>
<view class="fixed-btn yuyue-btn" bindtap="activityOrder" wx:else>立即预约</view>
</view>
<view class="mask" style="align-items:flex-end" wx:if="{{showMask}}">
<view class="mask-bg" bindtap="cancel"></view>
<view class="mask-content1">
<view class="dialog-top">
<view class="scene-title">{{product.product.title}}-{{product.sku.sku_name}}</view>
<view class="people-message">出行人信息</view>
<view style="max-height:430rpx;overflow: scroll;" wx:if="{{is_authentication=='1'}}">
<view class="people" wx:for="{{linkmanList}}">
<view class="flex">
<view>姓名:</view>
<view style="color: #333;">{{item.name}}</view>
</view>
<view class="flex" style="margin: 19.33rpx 0;">
<view>证件号:</view>
<view style="color: #333;">{{item.id_number}}</view>
</view>
<view class="flex">
<view>手机号:</view>
<view style="color: #333;">{{item.tel}}</view>
</view>
</view>
</view>
<view wx:else>
<view class="flex" style="margin: 10rpx 0 30rpx;">
<view>手机号:</view>
<view style="color: #333;">{{phone}}</view>
</view>
</view>
</view>
<view class="bottom-btn">
<view class="cancle" bindtap="cancel">取消</view>
<view class="confirm" bindtap="order">无问题,下一步</view>
</view>
</view>
</view>
</view>

343
subPackages/gwcOrder/index.wxss

@ -0,0 +1,343 @@
/* pages/.wxss */
page {
background: #f6f6f6;
}
.group-order {
background: #fff;
}
.product-info {
padding: 20rpx 47rpx;
border-bottom: 1rpx solid #ccc;
}
.product-title {
font-size: 33rpx;
color: #000;
font-weight: 500;
}
.product-price {
color: #D62828;
font-size: 27rpx;
}
.group-order .box-title {
margin: 0;
}
.group-order .box,
.group-order .date-box {
border-bottom: 1rpx solid #D8D8D8;
border-radius: 0;
margin: 0 25rpx;
}
.group-order .dates-boxes {
border-top: none;
padding-top: 0;
}
.group-order .date-time.disable {
background: #CCCCCC;
color: #fff;
}
.box {
margin: 30rpx 25rpx;
background: white;
border-radius: 9rpx;
}
.box-title {
height: 113rpx;
margin: 0 20rpx;
font-size: 31rpx;
color: #000;
font-weight: 500;
display: flex;
align-items: center;
}
.dates-boxes {
display: flex;
align-items: center;
padding: 31rpx 21rpx;
border-top: 1rpx solid #ccc;
}
.date-item {
width: 162rpx;
height: 97rpx;
border-radius: 10rpx;
border: 1rpx solid #333;
text-align: center;
font-size: 27rpx;
color: #000;
margin-right: 20rpx;
display: flex;
justify-content: center;
align-items: center;
flex-direction: column;
}
.date-item.active {
border-color: #0B898E;
color: #fff;
background: #0B898E;
}
.date-item.disable {
border-color: #CCCCCC;
color: #666;
}
.date-item .price {
font-size: 25rpx;
color: #D62828;
}
.date-item.active .price {
color: #fff;
}
.date-item.disable .price {
color: #666;
}
.more-item {
width: 99rpx;
margin-right: 0;
}
.date-times {
display: flex;
justify-content: space-between;
align-items: center;
margin: 0 21rpx;
padding-top: 34rpx;
padding-bottom: 10rpx;
border-top: 1rpx dashed #ccc;
flex-wrap: wrap;
}
.date-time {
width: 315rpx;
line-height: 58rpx;
border: 1px solid #333;
border-radius: 10rpx;
text-align: center;
font-size: 25rpx;
flex-shrink: 0;
margin-bottom: 24rpx;
color: #000;
}
.date-time.disable {
border-color: #ccc;
color: #666666;
}
.date-time.active {
border-color: #0B898E;
background: #0B898E;
color: #fff;
}
.box-title .iconfont {
font-size: 28rpx;
flex-shrink: 0;
}
.number-box {
font-size: 29rpx;
font-weight: 500;
color: #000;
flex-shrink: 0;
width: 67rpx;
line-height: 49rpx;
background: #F0F0F0;
border-radius: 7rpx;
text-align: center;
margin: 0 20rpx;
}
.fixed-bottom {
position: fixed;
left: 0;
right: 0;
bottom: 0;
height: 113rpx;
display: flex;
align-items: center;
justify-content: space-between;
background: white;
z-index: 1;
box-shadow: 0px 0px 16rpx 0px rgba(6, 0, 1, 0.1);
}
.yuyue-box {
height: 138rpx;
justify-content: center;
}
.fixed-btn {
width: 320rpx;
line-height: 113rpx;
background: #D62828;
color: #fff;
text-align: center;
font-size: 36rpx;
font-weight: 500;
}
.fixed-price-box {
margin-left: 25rpx;
flex-shrink: 0;
font-size: 29rpx;
color: #333;
font-weight: 500;
}
.fixed-price-box .price {
color: #D62828;
font-size: 36rpx;
margin-left: 10rpx;
}
.allowance {
justify-content: space-between;
}
.allowance>view:nth-child(2) {
display: flex;
align-items: center;
}
.allowance image {
width: 40rpx;
height: 40rpx;
margin-left: 10rpx;
}
.allowance .border {
width: 30rpx;
height: 30rpx;
border-radius: 50%;
border: 4rpx solid #0B98BE;
margin-left: 10rpx;
}
.coupon-btn {
width: 138rpx;
line-height: 56rpx;
border: 1px solid #333333;
border-radius: 29rpx;
text-align: center;
font-size: 28rpx;
color: #000;
}
.box-title input {
flex: 1;
display: block;
font-size: 31rpx;
color: #666;
margin-left: 15rpx;
font-weight: 400;
text-align: right;
}
.yuyue-btn {
width: 657rpx;
line-height: 78rpx;
border-radius: 39rpx;
}
.group-order .yuyue-box {
height: 100rpx;
}
.group-order .yuyue-btn {
width: 100%;
/* height: 100%; */
line-height: 100rpx;
border-radius: 0;
}
.mask-allowance .mask-content {
margin: auto;
top: initial;
bottom: initial;
padding: 20rpx;
}
.mask-allowance .mask-content .rule-title {
text-align: center;
margin-bottom: 20rpx;
}
.dialog-top {
color: #999;
font-weight: 500;
padding: 40rpx 33.33rpx 0;
}
.scene-title {
font-size: 35rpx;
font-weight: bold;
color: #333;
margin-bottom: 32.67rpx;
}
.people-message {
margin-bottom: 26.67rpx;
/* padding-bottom: 26.67rpx; */
/* border-bottom: 1px solid #F0F0F0; */
font-weight: bold;
font-size: 32rpx;
}
.people {
border-top: 1rpx solid #F0F0F0;
padding: 26.67rpx 0 24rpx;
}
.flex {
display: flex;
}
.bottom-btn {
display: flex;
border-top: 1rpx solid #F0F0F0;
height: 96rpx;
/* padding: 32.67rpx 0; */
}
.cancle {
width: 50%;
color: #999;
text-align: center;
line-height: 96rpx;
}
.confirm {
width: 50%;
text-align: center;
color: #D62828;
line-height: 96rpx;
border-left: 1rpx solid #F0F0F0;
}
.mask-content1 {
max-height: 710rpx;
position: relative;
z-index: 1;
width: 80%;
background: white;
border-radius: 12rpx;
/* margin-bottom: 45%; */
overflow-y: auto;
margin: auto;
}
Loading…
Cancel
Save