Commit 8c56eafc authored by qipeng's avatar qipeng

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

parent 2e6dd6dc
......@@ -28,6 +28,18 @@
</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>
</template>
......@@ -50,46 +62,47 @@ export default {
maskType:false,
active:0,
exchangeEndDate:'',//结束兑换时间
id:'',
codeMaskType:false,
}
},
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')||''
console.log(this.merchantId)
this.loadMerchantInfo()
},
methods: {
enterFun(){//产品选择确定
this.productId = this.stringProduct[this.active].exchangeProductId
this.exchangeCode()
this.exchangePageToFun()
},
listNumFun(index){//当可选产品>1时 选择的产品是
this.active = index
this.exchangeEndDate = this.stringProduct[index].exchangeEndDate
},
loadMerchantInfo(){//景区详情
var data = {
id:this.merchantId,
isDetail :1
}
this.$request('scenic/newMerchant/loadMerchantInfo',data).then((res)=>{
if(res.code=='00'){
this.companyMess= res.data
this.companyId = res.data.productCompanyId
this.productListFun(res.data.productCompanyId)
}else{
uni.showToast({
title: res.message,
icon: 'none'
})
}
})
},
productListFun(productCompanyId){//可兑换的产品列表
// loadMerchantInfo(){//景区详情
// var data = {
// id:this.merchantId,
// isDetail :1
// }
// this.$request('scenic/newMerchant/loadMerchantInfo',data).then((res)=>{
// if(res.code=='00'){
// this.companyMess= res.data
// this.companyId = res.data.productCompanyId
// this.productListFun(res.data.productCompanyId)
// }else{
// uni.showToast({
// title: res.message,
// icon: 'none'
// })
// }
// })
// },
productListFun(merchantCode){//可兑换的产品列表productCompanyId
var data = {
companyId: productCompanyId,
//companyId: productCompanyId,
merchantCode: merchantCode,
}
this.$request('scenic/exchangeProduct/loadExchangeList',data).then((res)=>{
if(res.code=='00'){
......@@ -99,6 +112,22 @@ export default {
item.productNameGroup =JSON.parse(JSON.stringify(productNameGroup))
})
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{
uni.showToast({
title: res.message,
......@@ -107,25 +136,28 @@ export default {
}
})
},
exchangeCodeChoose(){//大于1出现遮罩 等于1跳转
if(this.stringProduct.length>1){
this.maskType = true
}else{
exchangeCodeChoose(){//当没有兑换码则出现输入框 手动输入
if(this.ticketCode!=''){
this.exchangeCode()
}else{
this.codeMaskType=true
}
},
exchangeCode(){//订单查询
var today = this.$commonjs.today()
var todayNum = this.$commonjs.changeTime(today)
var playEndDay = this.$commonjs.changeTime(this.exchangeEndDate)
if(playEndDay<todayNum){
exchangeCodeMask(){//遮罩是否填写兑换码
if(this.ticketCode==''){
uni.showToast({
title: '当前兑换码已过兑换期限。',
icon: 'none',
duration:5000,
title: '请填写兑换码',
icon: 'none'
})
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 = {
ticketCode : this.ticketCode,
//userId : this.userId,//上线之前注销 此为普通票
......@@ -138,7 +170,8 @@ export default {
this.checkExchangeFun(
res.data.list[0].id,
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.pdFromOrderId = res.data.list[0].id
......@@ -156,17 +189,16 @@ export default {
}
})
},
checkExchangeFun(id, productId, userId){//兑换检测
this.productId = this.stringProduct[this.active].exchangeProductId
checkExchangeFun(id, productId, userId,merchantCode){//兑换检测
this.id = id
this.userId = userId
var data = {
fromOrderId: id,
}
this.$request('order/exchange/checkExchange',data).then((res)=>{
if(res.code=='00'){
if (res.data.exchangeStatus == 0) {
uni.navigateTo({
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
})
this.productListFun(merchantCode)
}else{
uni.showToast({
title: '当前兑换码已兑换。',
......@@ -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(){//跳转订单列表
uni.navigateTo({
url: '/pages/my/order/orderList/orderList'
......@@ -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>
......@@ -7,13 +7,13 @@
<view class="left-address">{{companyMess.address}}</view>
</view>
<view class="nav-right">
<view class="right-list">
<view class="right-list" @click="navigation(merchant)">
<view class="list-title">
<image src="../../static/exchangeCode/icon01.png"></image>
</view>
<view class="list-name">导航</view>
</view>
<view class="right-list">
<view class="right-list" @click="makePhone(merchant.phone)">
<view class="list-title">
<image src="../../static/exchangeCode/icon02.png"></image>
</view>
......@@ -134,7 +134,13 @@ export default {
docQuery: '', //元素变量
newCheckTime:'加载中',//当前选择的时间
//changeValue: '',
merchant:{
latitude:'',
longitude:'',
name:'',
address:'',
phone:'',
},//基础信息
}
},
onLoad(option) {
......@@ -150,6 +156,22 @@ export default {
this.docQuery = uni.createSelectorQuery().in(this)
},
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(){//产品订单信息
var data = {
orderId:this.id,
......@@ -176,6 +198,11 @@ export default {
if(res.code=='00'){
this.companyMess= res.data
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()
}else{
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