Commit 8c56eafc authored by qipeng's avatar qipeng

当兑换码为空时 手动输入兑换码

parent 2e6dd6dc
...@@ -28,6 +28,18 @@ ...@@ -28,6 +28,18 @@
</view> </view>
</view> </view>
</view> </view>
<view class="exchange-mask" v-if="codeMaskType" >
<view class="mask-case mask-caseAct">
<view class="mask-ticketCodeIn">
<input class="uni-input" v-model="ticketCode" placeholder="请输入兑换码" />
</view>
<view class="mask-btn">
<view class="btn-style" @click="exchangeCodeMask()">确定</view>
<view class="btn-style btn-stylehui" @click="codeMaskType=false">关闭</view>
</view>
</view>
</view>
</view> </view>
</template> </template>
...@@ -50,46 +62,47 @@ export default { ...@@ -50,46 +62,47 @@ export default {
maskType:false, maskType:false,
active:0, active:0,
exchangeEndDate:'',//结束兑换时间 exchangeEndDate:'',//结束兑换时间
id:'',
codeMaskType:false,
} }
}, },
onLoad(option) { onLoad(option) {
//this.userId = ''//uni.getStorageSync('openid')
//this.productId = option.productId||'z001700015788731bfffd2581156dcfa' this.ticketCode = this.$commonjs.getKey(option,'ticketCode')||''//获取兑换码
this.ticketCode = this.$commonjs.getKey(option,'ticketCode')||''
this.merchantId = this.$commonjs.getKey(option,'merchantId')||'' this.merchantId = this.$commonjs.getKey(option,'merchantId')||''
console.log(this.merchantId)
this.loadMerchantInfo()
}, },
methods: { methods: {
enterFun(){//产品选择确定 enterFun(){//产品选择确定
this.productId = this.stringProduct[this.active].exchangeProductId this.productId = this.stringProduct[this.active].exchangeProductId
this.exchangeCode() this.exchangePageToFun()
}, },
listNumFun(index){//当可选产品>1时 选择的产品是 listNumFun(index){//当可选产品>1时 选择的产品是
this.active = index this.active = index
this.exchangeEndDate = this.stringProduct[index].exchangeEndDate this.exchangeEndDate = this.stringProduct[index].exchangeEndDate
}, },
loadMerchantInfo(){//景区详情 // loadMerchantInfo(){//景区详情
var data = { // var data = {
id:this.merchantId, // id:this.merchantId,
isDetail :1 // isDetail :1
} // }
this.$request('scenic/newMerchant/loadMerchantInfo',data).then((res)=>{ // this.$request('scenic/newMerchant/loadMerchantInfo',data).then((res)=>{
if(res.code=='00'){ // if(res.code=='00'){
this.companyMess= res.data // this.companyMess= res.data
this.companyId = res.data.productCompanyId // this.companyId = res.data.productCompanyId
this.productListFun(res.data.productCompanyId) // this.productListFun(res.data.productCompanyId)
}else{ // }else{
uni.showToast({ // uni.showToast({
title: res.message, // title: res.message,
icon: 'none' // icon: 'none'
}) // })
} // }
}) // })
}, // },
productListFun(productCompanyId){//可兑换的产品列表 productListFun(merchantCode){//可兑换的产品列表productCompanyId
var data = { var data = {
companyId: productCompanyId, //companyId: productCompanyId,
merchantCode: merchantCode,
} }
this.$request('scenic/exchangeProduct/loadExchangeList',data).then((res)=>{ this.$request('scenic/exchangeProduct/loadExchangeList',data).then((res)=>{
if(res.code=='00'){ if(res.code=='00'){
...@@ -99,6 +112,22 @@ export default { ...@@ -99,6 +112,22 @@ export default {
item.productNameGroup =JSON.parse(JSON.stringify(productNameGroup)) item.productNameGroup =JSON.parse(JSON.stringify(productNameGroup))
}) })
this.exchangeEndDate = this.stringProduct[0].exchangeEndDate this.exchangeEndDate = this.stringProduct[0].exchangeEndDate
var today = this.$commonjs.today()
var todayNum = this.$commonjs.changeTime(today)
var playEndDay = this.$commonjs.changeTime(this.exchangeEndDate)
if(playEndDay<todayNum){
uni.showToast({
title: '当前兑换码已过兑换期限。',
icon: 'none',
duration:5000,
})
return false
}
if(this.stringProduct.length>1){
this.maskType = true
}else{
this.exchangePageToFun()
}
}else{ }else{
uni.showToast({ uni.showToast({
title: res.message, title: res.message,
...@@ -107,25 +136,28 @@ export default { ...@@ -107,25 +136,28 @@ export default {
} }
}) })
}, },
exchangeCodeChoose(){//大于1出现遮罩 等于1跳转 exchangeCodeChoose(){//当没有兑换码则出现输入框 手动输入
if(this.stringProduct.length>1){ if(this.ticketCode!=''){
this.maskType = true
}else{
this.exchangeCode() this.exchangeCode()
}else{
this.codeMaskType=true
} }
}, },
exchangeCode(){//订单查询 exchangeCodeMask(){//遮罩是否填写兑换码
var today = this.$commonjs.today() if(this.ticketCode==''){
var todayNum = this.$commonjs.changeTime(today)
var playEndDay = this.$commonjs.changeTime(this.exchangeEndDate)
if(playEndDay<todayNum){
uni.showToast({ uni.showToast({
title: '当前兑换码已过兑换期限。', title: '请填写兑换码',
icon: 'none', icon: 'none'
duration:5000,
}) })
return false }else{
this.codeMaskType=false
this.exchangeCode()
} }
},
exchangeCode(){//订单查询
var ticketCodeNum = this.ticketCode
var ticketCodeList = ticketCodeNum.replace(/(TBD){0,1}(TO){0,1}(\w+)(:\d+){0,1}/i,'$3')
this.ticketCode = ticketCodeList
var data = { var data = {
ticketCode : this.ticketCode, ticketCode : this.ticketCode,
//userId : this.userId,//上线之前注销 此为普通票 //userId : this.userId,//上线之前注销 此为普通票
...@@ -138,7 +170,8 @@ export default { ...@@ -138,7 +170,8 @@ export default {
this.checkExchangeFun( this.checkExchangeFun(
res.data.list[0].id, res.data.list[0].id,
res.data.list[0].productId, res.data.list[0].productId,
res.data.list[0].userId res.data.list[0].userId,
res.data.list[0].merchantCode
) )
this.fromOrderId = res.data.list[0].thirdOrderId this.fromOrderId = res.data.list[0].thirdOrderId
this.pdFromOrderId = res.data.list[0].id this.pdFromOrderId = res.data.list[0].id
...@@ -156,17 +189,16 @@ export default { ...@@ -156,17 +189,16 @@ export default {
} }
}) })
}, },
checkExchangeFun(id, productId, userId){//兑换检测 checkExchangeFun(id, productId, userId,merchantCode){//兑换检测
this.productId = this.stringProduct[this.active].exchangeProductId this.id = id
this.userId = userId
var data = { var data = {
fromOrderId: id, fromOrderId: id,
} }
this.$request('order/exchange/checkExchange',data).then((res)=>{ this.$request('order/exchange/checkExchange',data).then((res)=>{
if(res.code=='00'){ if(res.code=='00'){
if (res.data.exchangeStatus == 0) { if (res.data.exchangeStatus == 0) {
uni.navigateTo({ this.productListFun(merchantCode)
url: '/pages/my/exchangeCode/exchangePage/exchangePage?productId='+this.productId+'&id='+id+'&userId='+userId+'&merchantId='+this.merchantId+'&fromOrderId='+this.fromOrderId+'&pdFromOrderId='+this.pdFromOrderId+'&ticketCode='+this.ticketCode
})
}else{ }else{
uni.showToast({ uni.showToast({
title: '当前兑换码已兑换。', title: '当前兑换码已兑换。',
...@@ -182,6 +214,13 @@ export default { ...@@ -182,6 +214,13 @@ export default {
} }
}) })
}, },
exchangePageToFun(){
this.productId = this.stringProduct[this.active].exchangeProductId
this.merchantId = this.stringProduct[this.active].merchantId
uni.navigateTo({
url: '/pages/my/exchangeCode/exchangePage/exchangePage?productId='+this.productId+'&id='+this.id+'&userId='+this.userId+'&merchantId='+this.merchantId+'&fromOrderId='+this.fromOrderId+'&pdFromOrderId='+this.pdFromOrderId+'&ticketCode='+this.ticketCode
})
},
orderListFun(){//跳转订单列表 orderListFun(){//跳转订单列表
uni.navigateTo({ uni.navigateTo({
url: '/pages/my/order/orderList/orderList' url: '/pages/my/order/orderList/orderList'
...@@ -293,5 +332,16 @@ export default { ...@@ -293,5 +332,16 @@ export default {
} }
} }
} }
.mask-caseAct{
height: 400rpx;
.mask-ticketCodeIn{
height: 180rpx;
/deep/ .uni-input{
height: 100rpx;
margin-top: 40rpx;
text-align: center;
}
}
}
} }
</style> </style>
...@@ -7,13 +7,13 @@ ...@@ -7,13 +7,13 @@
<view class="left-address">{{companyMess.address}}</view> <view class="left-address">{{companyMess.address}}</view>
</view> </view>
<view class="nav-right"> <view class="nav-right">
<view class="right-list"> <view class="right-list" @click="navigation(merchant)">
<view class="list-title"> <view class="list-title">
<image src="../../static/exchangeCode/icon01.png"></image> <image src="../../static/exchangeCode/icon01.png"></image>
</view> </view>
<view class="list-name">导航</view> <view class="list-name">导航</view>
</view> </view>
<view class="right-list"> <view class="right-list" @click="makePhone(merchant.phone)">
<view class="list-title"> <view class="list-title">
<image src="../../static/exchangeCode/icon02.png"></image> <image src="../../static/exchangeCode/icon02.png"></image>
</view> </view>
...@@ -134,7 +134,13 @@ export default { ...@@ -134,7 +134,13 @@ export default {
docQuery: '', //元素变量 docQuery: '', //元素变量
newCheckTime:'加载中',//当前选择的时间 newCheckTime:'加载中',//当前选择的时间
//changeValue: '', //changeValue: '',
merchant:{
latitude:'',
longitude:'',
name:'',
address:'',
phone:'',
},//基础信息
} }
}, },
onLoad(option) { onLoad(option) {
...@@ -150,6 +156,22 @@ export default { ...@@ -150,6 +156,22 @@ export default {
this.docQuery = uni.createSelectorQuery().in(this) this.docQuery = uni.createSelectorQuery().in(this)
}, },
methods: { methods: {
navigation(merchant){//---导航
uni.openLocation({
latitude:merchant.latitude,
longitude:merchant.longitude,
name:merchant.name,
address:merchant.address,
success: function () {
}
})
},
makePhone(phoneNumber) {//---拨打电话
uni.makePhoneCall({
phoneNumber
})
},
findOrderDetail(){//产品订单信息 findOrderDetail(){//产品订单信息
var data = { var data = {
orderId:this.id, orderId:this.id,
...@@ -176,6 +198,11 @@ export default { ...@@ -176,6 +198,11 @@ export default {
if(res.code=='00'){ if(res.code=='00'){
this.companyMess= res.data this.companyMess= res.data
this.companyId = res.data.productCompanyId this.companyId = res.data.productCompanyId
this.merchant.latitude = res.data.latitude
this.merchant.longitude = res.data.longitude
this.merchant.name = res.data.name
this.merchant.address = res.data.address
this.merchant.phone = res.data.phone
this.loadExchangeProductInfoFun() this.loadExchangeProductInfoFun()
}else{ }else{
uni.showToast({ uni.showToast({
......
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