Commit e93cc300 authored by 潘永坪's avatar 潘永坪

组合下单和单产品下单优化

parent 38e2578c
var baseUrl = ''
if(process.env.NODE_ENV === 'development'){//开发环境
baseUrl= 'http://pay.tuyoyoo.com/'
// baseUrl= 'http://pay.tuyoyoo.com/'
baseUrl='http://192.168.0.213:7888/'
}else{
baseUrl= 'https://manager.pangdly.com/'
}
......
......@@ -8,7 +8,7 @@ import commonjs from 'common/common.js'
Vue.prototype.$commonjs = commonjs
Vue.prototype.$request = request
Vue.prototype.$wxurl = 'https://wx.pangdly.com/#/'
Vue.prototype.$wxurl = 'https://lx.pangdly.com/#/'
Vue.prototype.imageError ='@/static/img/common/pangdingLogo.png'
Vue.use(uView)
uni.$u.config.unit = 'rpx'
......
......@@ -262,7 +262,10 @@
<view class="bottom-btn" :style="{ background: payBackground }">
<text v-if="orderStatus == 1">已下架</text>
<text v-if="orderStatus!= 1" @click="goPay()">去支付</text>
<template v-else>
<text v-if="parseInt(maxBookNum)<1">暂无库存</text>
<text v-if="parseInt(maxBookNum)>0" @click="goPay()">去支付</text>
</template>
</view>
</view>
</view>
......@@ -384,6 +387,7 @@ export default {
contactTotal: [], //所有联系人列表
originalTotal:0,//原价总价
sellTotal:0,//卖价总价
maxBookNum:999,//最大购买数量
}
},
onLoad(option) {
......@@ -417,29 +421,12 @@ export default {
this.productIdList=this.productList.map((item)=>{//id集合用于请求价格库存列表接口
return item.id
})
for(let i=0;i<this.productList.length;i++){
let item=this.productList[i]
//任何一个产品需要填写游客信息,下面的联系电话必须填写
if(item.tripTemplateFlag!=2){
this.showTelephone=true
}
//需要优化
// if(item.defaultAreaCode){
// item.areaObj={}
// item.areaObj.areaCode=item.areaCode
// item.areaObj.areaName=item.areaName
// }else{
// item.areaObj={}
// }
// if(item.isFetch==1&&item.productAreaList.length>1){
// //多个排号点
// this.areaIndex=index
// this.sortUpDown(item.merchantVo.code)
// }else if(item.isFetch==1&&item.productAreaList.length==1){
// //只有一个排号点
// item.areaObj=item.productAreaList[0]
// }
item.dateActive=0//默认选中第一个日期
item.buyNum=1,//默认为1
item.chooseContact=[]//选中的游客信息列表
......@@ -455,11 +442,6 @@ export default {
}
}
this.getPriceList()
// this.getDiscountPrice() //获取优惠价格
if (this.showTelephone) {
//需要填写联系人信息和手机号码
this.getContactList()
}
} else {
uni.showToast({
title: res.message,
......@@ -488,7 +470,8 @@ export default {
let today = this.$commonjs.today() //今天
let tomorrow = this.$commonjs.tomorrow() //明天
let afterTomorrow = this.$commonjs.afterTomorrow() //后天
this.productList.forEach(item=>{
for(let index=0;index<this.productList.length;index++){
let item=this.productList[index]
if(item.priceStockList.length>0){
//获取价格列表的第一个日期+预订最晚时间
let time1=item.priceStockList[0].startTime.substr(0,10)+item.bookTime
......@@ -516,6 +499,7 @@ export default {
if(item.priceStockList.length==0){
uni.showToast({title: '没有库存',icon: 'none'})
this.payBackground = '#C0C0C0'
this.maxBookNum=0
return
}
//下面参数是默认选择每个产品第一个日期的值
......@@ -541,11 +525,24 @@ export default {
if(item.productType==3&&item.priceStockList.length>0){
this.getTimeStock(item)
}
//获取优惠券
this.initCoupon(item)
//需要排号
if(item.isFetch==1){
this.areaIndex=index
this.sortUpDown(item.merchantVo.code)
}
}else{
uni.showToast({title: '没有库存',icon: 'none'})
this.payBackground = '#C0C0C0'
this.maxBookNum=0
return
}
}
if (this.showTelephone) {
//需要填写联系人信息和手机号码
this.getContactList()
}
})
this.computedPrice()//计算价格
//解决初始化日期不显示的情况
this.$forceUpdate()
......@@ -575,18 +572,28 @@ export default {
//有库存并且需要选择两个站点以上的票种,显示区域组件
for (let item2 in data.main) {
if (data.main[item2].sceneSortStatus == '1'){
//暂时下面只适应长江索道
this.showChooseArea = true
//上架
item.areaUp = true
if(item.defaultAreaCode){
//有默认的站点
item.areaObj={}
item.areaObj.areaCode=item.areaCode
item.areaObj.areaName=item.areaName
}else{
item.areaObj={}
}
//暂时下面只适应长江索道
this.showChooseArea = true
}
}
}else if (item.productAreaList.length == 1) {
//只有一个站点时,直接选中站点(现目前还没有一个站点的景区)
for (let item in data.main) {
if (data.main[item].sceneSortStatus == '1') {
item.areaObj = item.productAreaList[0]
//上架
item.areaUp = true
item.areaObj.areaCode = item.productAreaList[0].areaCode
item.areaObj.areaName = item.productAreaList[0].areaName
}
}
}
......@@ -1017,12 +1024,24 @@ export default {
let item=this.productList[i]
//没有库存情况
if(!item.priceStockList||item.priceStockList.length==0){
uni.showToast({
title:item.merchantName+'没有库存',
icon: 'none'
})
return
}
//由于默认购买数量为1,没有判断产品的最大购买数量是否大于等于1,故下单的时候需要判断产品的最大购买数量大于1,才可以下单
if(parseFloat(item.maxBookNum)<1){
uni.showToast({
title:item.merchantName+'没有库存',
icon: 'none'
})
return
}
}
if (this.showTelephone) {
//需要填写电话号码
if (!this.$commonjs.phoneReg().test(this.ticketPhone) && this.productIfo.tripTemplateFlag != 2) {
if (!this.$commonjs.phoneReg().test(this.ticketPhone)) {
//未填写正确手机号码
uni.showToast({
title: '请填写正确的手机号码',
......@@ -1031,9 +1050,9 @@ export default {
return
}
}
// if (!this.startDate || !this.endDate) {
// if (!item.startDate || !item.endDate) {
// uni.showToast({
// title: '请选择游玩日期',
// title:item.merchantName+'请选择游玩日期',
// icon: 'none'
// })
// return
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment