|
|
@ -3,418 +3,470 @@ import commonApi from "../../../../utils/https/common" |
|
|
import userApi from "../../../../utils/https/user" |
|
|
import userApi from "../../../../utils/https/user" |
|
|
import QRCode from '../../../../utils/weapp-qrcode.js' |
|
|
import QRCode from '../../../../utils/weapp-qrcode.js' |
|
|
import util from '../../../../utils/util' |
|
|
import util from '../../../../utils/util' |
|
|
let app = getApp(),timer |
|
|
let app = getApp(), |
|
|
|
|
|
timer |
|
|
Page({ |
|
|
Page({ |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 页面的初始数据 |
|
|
* 页面的初始数据 |
|
|
*/ |
|
|
*/ |
|
|
data: { |
|
|
data: { |
|
|
id:null, |
|
|
id: null, |
|
|
info:null, |
|
|
info: null, |
|
|
orderState:app.globalData.orderState, |
|
|
orderState: app.globalData.orderState, |
|
|
productState:app.globalData.productState, |
|
|
productState: app.globalData.productState, |
|
|
product_model:null, |
|
|
product_model: null, |
|
|
isRefund:false, |
|
|
isRefund: false, |
|
|
feeInfoFlag:false, |
|
|
feeInfoFlag: false, |
|
|
codeIndex:0, |
|
|
codeIndex: 0, |
|
|
codeImgs:[], |
|
|
codeImgs: [], |
|
|
minute:0, |
|
|
minute: 0, |
|
|
second:0, |
|
|
second: 0, |
|
|
cardTypes:{}, |
|
|
cardTypes: {}, |
|
|
cxr1:false, |
|
|
cxr1: false, |
|
|
cxr1Text:'更多', |
|
|
cxr1Text: '更多', |
|
|
sysm:false, |
|
|
sysm: false, |
|
|
sysmText:'更多', |
|
|
sysmText: '更多', |
|
|
sysm2:false, |
|
|
sysm2: false, |
|
|
sysm2Text:'更多', |
|
|
sysm2Text: '更多', |
|
|
imgLen:[], |
|
|
imgLen: [], |
|
|
ids:[], |
|
|
ids: [], |
|
|
|
|
|
|
|
|
isPost: false, // 有没有邮寄产品
|
|
|
isPost: false, // 有没有邮寄产品
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
showProgressPopup: false, |
|
|
* 生命周期函数--监听页面加载 |
|
|
reversedProgressList: [] // 数据源
|
|
|
*/ |
|
|
}, |
|
|
onLoad: function (options) { |
|
|
|
|
|
this.setData({ |
|
|
|
|
|
id:options.id |
|
|
|
|
|
}) |
|
|
|
|
|
userApi.user_post("user/getCardTypeList").then(res=>{ |
|
|
|
|
|
let cardTypes = {}; |
|
|
|
|
|
res.data.map(item=>{ |
|
|
|
|
|
cardTypes[item.type]=item.title; |
|
|
|
|
|
}) |
|
|
|
|
|
this.setData({ |
|
|
|
|
|
cardTypes:cardTypes |
|
|
|
|
|
}) |
|
|
|
|
|
}) |
|
|
|
|
|
}, |
|
|
|
|
|
copy:function(e){ |
|
|
|
|
|
let code = e.currentTarget.dataset.num; |
|
|
|
|
|
wx.setClipboardData({ |
|
|
|
|
|
data: code, |
|
|
|
|
|
success: function (res) { |
|
|
|
|
|
wx.showToast({ |
|
|
|
|
|
title: '复制成功', |
|
|
|
|
|
icon:'success' |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
}, |
|
|
|
|
|
getCodeImg:function(){ |
|
|
|
|
|
let that = this,sys =wx.getSystemInfoSync(),radio = sys.screenWidth / 750,qrcode=this.data.info.order_product_list[0].qrcode,codeImgs=[],codeId=0,arr = []; |
|
|
|
|
|
this.data.info.order_product_list.forEach(qrcode=>{ |
|
|
|
|
|
qrcode.qrcode.map((item,index)=>{ |
|
|
|
|
|
console.log(qrcode.is_force_display_code); |
|
|
|
|
|
item.is_force_display_code = qrcode.is_force_display_code |
|
|
|
|
|
console.log(item.is_force_display_code); |
|
|
|
|
|
arr.push(index) |
|
|
|
|
|
this.setData({ |
|
|
|
|
|
imgLen:arr |
|
|
|
|
|
}) |
|
|
|
|
|
if(item.use_url&&item.use_code){ |
|
|
|
|
|
codeImgs.push({img:item.use_url,code:item.use_code,text:item.use_code_display_text,state:item.stateText,is_force_display_code:item.is_force_display_code,flag:item.state}); |
|
|
|
|
|
// if(codeImgs.length==qrcode.qrcode.length){
|
|
|
|
|
|
// that.setData({
|
|
|
|
|
|
// codeImgs:codeImgs
|
|
|
|
|
|
// })
|
|
|
|
|
|
// }
|
|
|
|
|
|
that.setData({ |
|
|
|
|
|
codeImgs:codeImgs |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
else { |
|
|
|
|
|
console.log(item); |
|
|
|
|
|
new QRCode('damocode'+codeId,{ |
|
|
|
|
|
text: item.use_code, |
|
|
|
|
|
width: 300 * radio, |
|
|
|
|
|
height: 300 * radio, |
|
|
|
|
|
padding:10, // 生成二维码四周自动留边宽度,不传入默认为0
|
|
|
|
|
|
correctLevel: QRCode.CorrectLevel.H, // 二维码可辨识度
|
|
|
|
|
|
callback: (res) => { |
|
|
|
|
|
console.log(res); |
|
|
|
|
|
codeImgs.push({img:res.path,code:item.use_code,text:item.use_code_display_text,state:item.stateText,is_force_display_code:item.is_force_display_code,flag:item.state}); |
|
|
|
|
|
that.setData({ |
|
|
|
|
|
codeImgs:codeImgs |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
console.log(this.data.codeImgs); |
|
|
|
|
|
codeId = codeId + 1 |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
}) |
|
|
|
|
|
console.log(this.data.imgLen); |
|
|
|
|
|
console.log(this.data.codeImgs); |
|
|
|
|
|
}, |
|
|
|
|
|
prevCodeImg:function(){ |
|
|
|
|
|
let qrcode=this.data.codeImgs,codeIndex = this.data.codeIndex; |
|
|
|
|
|
console.log(codeIndex) |
|
|
|
|
|
if(codeIndex==0){ |
|
|
|
|
|
this.setData({ |
|
|
|
|
|
codeIndex:qrcode.length-1 |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
else { |
|
|
|
|
|
this.setData({ |
|
|
|
|
|
codeIndex:codeIndex-1 |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
console.log(codeIndex) |
|
|
|
|
|
}, |
|
|
|
|
|
nextCodeImg:function(){ |
|
|
|
|
|
console.log(this.data.codeImgs); |
|
|
|
|
|
let qrcode=this.data.codeImgs,codeIndex = this.data.codeIndex; |
|
|
|
|
|
codeIndex = codeIndex + 1; |
|
|
|
|
|
if(codeIndex==qrcode.length){ |
|
|
|
|
|
codeIndex = 0; |
|
|
|
|
|
} |
|
|
|
|
|
this.setData({ |
|
|
|
|
|
codeIndex:codeIndex |
|
|
|
|
|
|
|
|
|
|
|
}) |
|
|
/** |
|
|
}, |
|
|
* 生命周期函数--监听页面加载 |
|
|
showFeeInfo:function(){ |
|
|
*/ |
|
|
this.setData({ |
|
|
onLoad: function(options) { |
|
|
feeInfoFlag:!this.data.feeInfoFlag |
|
|
this.setData({ |
|
|
}) |
|
|
id: options.id |
|
|
}, |
|
|
}) |
|
|
close:function(){ |
|
|
userApi.user_post("user/getCardTypeList").then(res => { |
|
|
let _this = this,info = _this.data.info; |
|
|
let cardTypes = {}; |
|
|
wx.showModal({ |
|
|
res.data.map(item => { |
|
|
title:'提示', |
|
|
cardTypes[item.type] = item.title; |
|
|
content:"确定取消吗", |
|
|
}) |
|
|
success:function(res){ |
|
|
this.setData({ |
|
|
if(res.confirm){ |
|
|
cardTypes: cardTypes |
|
|
commonApi.user_post("order/close",{ |
|
|
}) |
|
|
order_id:info.order_id |
|
|
}) |
|
|
}).then(res=>{ |
|
|
}, |
|
|
if(res.code==1){ |
|
|
// 防止弹窗背景滚动
|
|
|
wx.showToast({ |
|
|
preventTouchMove() { |
|
|
title: '取消成功', |
|
|
return; |
|
|
icon:'success' |
|
|
}, |
|
|
}) |
|
|
|
|
|
info.state = "CLOSED"; |
|
|
|
|
|
info.order_product_list.map(item=>{ |
|
|
|
|
|
item.state='CLOSED' |
|
|
|
|
|
}) |
|
|
|
|
|
_this.setData({ |
|
|
|
|
|
info:info |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
}, |
|
|
|
|
|
refund:function(){ |
|
|
|
|
|
let _this = this,info = _this.data.info; |
|
|
|
|
|
wx.showModal({ |
|
|
|
|
|
title:'提示', |
|
|
|
|
|
content:"确定取消吗", |
|
|
|
|
|
success:function(res){ |
|
|
|
|
|
if(res.confirm){ |
|
|
|
|
|
commonApi.user_post("order/refund",{ |
|
|
|
|
|
order_id:info.order_id |
|
|
|
|
|
}).then(res=>{ |
|
|
|
|
|
if(res.code==1){ |
|
|
|
|
|
wx.showToast({ |
|
|
|
|
|
title: '取消成功', |
|
|
|
|
|
icon:'success' |
|
|
|
|
|
}) |
|
|
|
|
|
info.state = "WAIT_REFUND"; |
|
|
|
|
|
info.order_product_list.map(item=>{ |
|
|
|
|
|
item.state='WAIT_REFUND' |
|
|
|
|
|
}) |
|
|
|
|
|
_this.setData({ |
|
|
|
|
|
info:info |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
}, |
|
|
|
|
|
daojishi:function(time){ |
|
|
|
|
|
let now = new Date().getTime(); |
|
|
|
|
|
if(now>time){ |
|
|
|
|
|
clearTimeout(timer); |
|
|
|
|
|
timer = null; |
|
|
|
|
|
util.back(); |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
let times = time - now,minute = Math.floor(times / (60 * 1000)),second = Math.round((times - minute * 60 * 1000) / 1000); |
|
|
|
|
|
this.setData({ |
|
|
|
|
|
minute:util.formatNumber(minute), |
|
|
|
|
|
second:util.formatNumber(second) |
|
|
|
|
|
}) |
|
|
|
|
|
timer = setTimeout(()=>{ |
|
|
|
|
|
this.daojishi(time); |
|
|
|
|
|
},1000) |
|
|
|
|
|
}, |
|
|
|
|
|
// 查看苏康码
|
|
|
|
|
|
gotoSku:function(){ |
|
|
|
|
|
commonApi.user_post("pbservice/Ztfw/sukangCode").then(res=>{ |
|
|
|
|
|
console.log(res) |
|
|
|
|
|
app.globalData.weburl = res.data.url; |
|
|
|
|
|
wx.navigateTo({ |
|
|
|
|
|
url: '/pages/pbService/web/index' |
|
|
|
|
|
}) |
|
|
|
|
|
return; |
|
|
|
|
|
}) |
|
|
|
|
|
}, |
|
|
|
|
|
goDetail(e){ |
|
|
|
|
|
console.log(e.currentTarget.dataset); |
|
|
|
|
|
let item = e.currentTarget.dataset.set |
|
|
|
|
|
// 组合产品 跳线路
|
|
|
|
|
|
if (item.compose_product_id) { |
|
|
|
|
|
wx.navigateTo({ |
|
|
|
|
|
url: '/pages/info/roadInfo/index?id='+item.compose_product_id |
|
|
|
|
|
}) |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
if (item.is_package == 1) { |
|
|
|
|
|
wx.navigateTo({ |
|
|
|
|
|
url:"/pages/info/postProductInfo/index?id="+item.product_id |
|
|
|
|
|
}) |
|
|
|
|
|
return |
|
|
|
|
|
} else if (item.is_package==2) { |
|
|
|
|
|
wx.navigateTo({ |
|
|
|
|
|
url: '/subPackages/goods/oneCardTour/info/index?id='+item.scene_id |
|
|
|
|
|
}); |
|
|
|
|
|
return |
|
|
|
|
|
} else if (item.is_package==3) { |
|
|
|
|
|
wx.navigateTo({ |
|
|
|
|
|
url: '/subPackages/goods/memberCard/index?id='+item.product_id |
|
|
|
|
|
}); |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if (item.product_model=='ticket') { |
|
|
// 关闭弹窗
|
|
|
wx.navigateTo({ |
|
|
closeProgressPopup() { |
|
|
url:"/pages/info/sceneProductInfo/index?id="+item.scene_id |
|
|
this.setData({ |
|
|
}) |
|
|
showProgressPopup: false |
|
|
}else if (item.product_model=='post') { |
|
|
}); |
|
|
wx.navigateTo({ |
|
|
}, |
|
|
url:"/pages/info/postProductInfo/index?id="+item.product_id |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
|
|
|
showMsg(e){ |
|
|
|
|
|
console.log(e.currentTarget.dataset); |
|
|
|
|
|
let msg = e.currentTarget.dataset.msg |
|
|
|
|
|
switch (msg) { |
|
|
|
|
|
case 'cxr1': |
|
|
|
|
|
this.setData({ |
|
|
|
|
|
cxr1:!this.data.cxr1, |
|
|
|
|
|
cxr1Text:this.data.cxr1?'更多':'收起', |
|
|
|
|
|
|
|
|
|
|
|
}) |
|
|
// 打开弹窗
|
|
|
break; |
|
|
openProgressPopup() { |
|
|
case 'sysm1': |
|
|
this.setData({ |
|
|
this.setData({ |
|
|
showProgressPopup: true |
|
|
sysm:!this.data.sysm, |
|
|
}); |
|
|
sysmText:this.data.sysm?'更多':'收起', |
|
|
}, |
|
|
}) |
|
|
copy: function(e) { |
|
|
break; |
|
|
let code = e.currentTarget.dataset.num; |
|
|
case 'sysm2': |
|
|
wx.setClipboardData({ |
|
|
this.setData({ |
|
|
data: code, |
|
|
sysm2:!this.data.sysm2, |
|
|
success: function(res) { |
|
|
sysm2Text:this.data.sysm2?'更多':'收起', |
|
|
wx.showToast({ |
|
|
}) |
|
|
title: '复制成功', |
|
|
break; |
|
|
icon: 'success' |
|
|
default: |
|
|
}) |
|
|
break; |
|
|
} |
|
|
} |
|
|
}) |
|
|
}, |
|
|
}, |
|
|
/** |
|
|
getCodeImg: function() { |
|
|
* 生命周期函数--监听页面初次渲染完成 |
|
|
let that = this, |
|
|
*/ |
|
|
sys = wx.getSystemInfoSync(), |
|
|
onReady: function () { |
|
|
radio = sys.screenWidth / 750, |
|
|
|
|
|
qrcode = this.data.info.order_product_list[0].qrcode, |
|
|
|
|
|
codeImgs = [], |
|
|
|
|
|
codeId = 0, |
|
|
|
|
|
arr = []; |
|
|
|
|
|
this.data.info.order_product_list.forEach(qrcode => { |
|
|
|
|
|
qrcode.qrcode.map((item, index) => { |
|
|
|
|
|
console.log(qrcode.is_force_display_code); |
|
|
|
|
|
item.is_force_display_code = qrcode.is_force_display_code |
|
|
|
|
|
console.log(item.is_force_display_code); |
|
|
|
|
|
arr.push(index) |
|
|
|
|
|
this.setData({ |
|
|
|
|
|
imgLen: arr |
|
|
|
|
|
}) |
|
|
|
|
|
if (item.use_url && item.use_code) { |
|
|
|
|
|
codeImgs.push({ |
|
|
|
|
|
img: item.use_url, |
|
|
|
|
|
code: item.use_code, |
|
|
|
|
|
text: item.use_code_display_text, |
|
|
|
|
|
state: item.stateText, |
|
|
|
|
|
is_force_display_code: item.is_force_display_code, |
|
|
|
|
|
flag: item.state |
|
|
|
|
|
}); |
|
|
|
|
|
// if(codeImgs.length==qrcode.qrcode.length){
|
|
|
|
|
|
// that.setData({
|
|
|
|
|
|
// codeImgs:codeImgs
|
|
|
|
|
|
// })
|
|
|
|
|
|
// }
|
|
|
|
|
|
that.setData({ |
|
|
|
|
|
codeImgs: codeImgs |
|
|
|
|
|
}) |
|
|
|
|
|
} else { |
|
|
|
|
|
console.log(item); |
|
|
|
|
|
new QRCode('damocode' + codeId, { |
|
|
|
|
|
text: item.use_code, |
|
|
|
|
|
width: 300 * radio, |
|
|
|
|
|
height: 300 * radio, |
|
|
|
|
|
padding: 10, // 生成二维码四周自动留边宽度,不传入默认为0
|
|
|
|
|
|
correctLevel: QRCode.CorrectLevel.H, // 二维码可辨识度
|
|
|
|
|
|
callback: (res) => { |
|
|
|
|
|
console.log(res); |
|
|
|
|
|
codeImgs.push({ |
|
|
|
|
|
img: res.path, |
|
|
|
|
|
code: item.use_code, |
|
|
|
|
|
text: item.use_code_display_text, |
|
|
|
|
|
state: item.stateText, |
|
|
|
|
|
is_force_display_code: item |
|
|
|
|
|
.is_force_display_code, |
|
|
|
|
|
flag: item.state |
|
|
|
|
|
}); |
|
|
|
|
|
that.setData({ |
|
|
|
|
|
codeImgs: codeImgs |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
console.log(this.data.codeImgs); |
|
|
|
|
|
codeId = codeId + 1 |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
}) |
|
|
|
|
|
console.log(this.data.imgLen); |
|
|
|
|
|
console.log(this.data.codeImgs); |
|
|
|
|
|
}, |
|
|
|
|
|
prevCodeImg: function() { |
|
|
|
|
|
let qrcode = this.data.codeImgs, |
|
|
|
|
|
codeIndex = this.data.codeIndex; |
|
|
|
|
|
console.log(codeIndex) |
|
|
|
|
|
if (codeIndex == 0) { |
|
|
|
|
|
this.setData({ |
|
|
|
|
|
codeIndex: qrcode.length - 1 |
|
|
|
|
|
}) |
|
|
|
|
|
} else { |
|
|
|
|
|
this.setData({ |
|
|
|
|
|
codeIndex: codeIndex - 1 |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
console.log(codeIndex) |
|
|
|
|
|
}, |
|
|
|
|
|
nextCodeImg: function() { |
|
|
|
|
|
console.log(this.data.codeImgs); |
|
|
|
|
|
let qrcode = this.data.codeImgs, |
|
|
|
|
|
codeIndex = this.data.codeIndex; |
|
|
|
|
|
codeIndex = codeIndex + 1; |
|
|
|
|
|
if (codeIndex == qrcode.length) { |
|
|
|
|
|
codeIndex = 0; |
|
|
|
|
|
} |
|
|
|
|
|
this.setData({ |
|
|
|
|
|
codeIndex: codeIndex |
|
|
|
|
|
|
|
|
}, |
|
|
}) |
|
|
|
|
|
}, |
|
|
|
|
|
showFeeInfo: function() { |
|
|
|
|
|
this.setData({ |
|
|
|
|
|
feeInfoFlag: !this.data.feeInfoFlag |
|
|
|
|
|
}) |
|
|
|
|
|
}, |
|
|
|
|
|
close: function() { |
|
|
|
|
|
let _this = this, |
|
|
|
|
|
info = _this.data.info; |
|
|
|
|
|
wx.showModal({ |
|
|
|
|
|
title: '提示', |
|
|
|
|
|
content: "确定取消吗", |
|
|
|
|
|
success: function(res) { |
|
|
|
|
|
if (res.confirm) { |
|
|
|
|
|
commonApi.user_post("order/close", { |
|
|
|
|
|
order_id: info.order_id |
|
|
|
|
|
}).then(res => { |
|
|
|
|
|
if (res.code == 1) { |
|
|
|
|
|
wx.showToast({ |
|
|
|
|
|
title: '取消成功', |
|
|
|
|
|
icon: 'success' |
|
|
|
|
|
}) |
|
|
|
|
|
info.state = "CLOSED"; |
|
|
|
|
|
info.order_product_list.map(item => { |
|
|
|
|
|
item.state = 'CLOSED' |
|
|
|
|
|
}) |
|
|
|
|
|
_this.setData({ |
|
|
|
|
|
info: info |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
}, |
|
|
|
|
|
refund: function() { |
|
|
|
|
|
let _this = this, |
|
|
|
|
|
info = _this.data.info; |
|
|
|
|
|
wx.showModal({ |
|
|
|
|
|
title: '提示', |
|
|
|
|
|
content: "确定取消吗", |
|
|
|
|
|
success: function(res) { |
|
|
|
|
|
if (res.confirm) { |
|
|
|
|
|
commonApi.user_post("order/refund", { |
|
|
|
|
|
order_id: info.order_id |
|
|
|
|
|
}).then(res => { |
|
|
|
|
|
if (res.code == 1) { |
|
|
|
|
|
wx.showToast({ |
|
|
|
|
|
title: '取消成功', |
|
|
|
|
|
icon: 'success' |
|
|
|
|
|
}) |
|
|
|
|
|
info.state = "WAIT_REFUND"; |
|
|
|
|
|
info.order_product_list.map(item => { |
|
|
|
|
|
item.state = 'WAIT_REFUND' |
|
|
|
|
|
}) |
|
|
|
|
|
_this.setData({ |
|
|
|
|
|
info: info |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
}, |
|
|
|
|
|
daojishi: function(time) { |
|
|
|
|
|
let now = new Date().getTime(); |
|
|
|
|
|
if (now > time) { |
|
|
|
|
|
clearTimeout(timer); |
|
|
|
|
|
timer = null; |
|
|
|
|
|
util.back(); |
|
|
|
|
|
return; |
|
|
|
|
|
} |
|
|
|
|
|
let times = time - now, |
|
|
|
|
|
minute = Math.floor(times / (60 * 1000)), |
|
|
|
|
|
second = Math.round((times - minute * 60 * 1000) / 1000); |
|
|
|
|
|
this.setData({ |
|
|
|
|
|
minute: util.formatNumber(minute), |
|
|
|
|
|
second: util.formatNumber(second) |
|
|
|
|
|
}) |
|
|
|
|
|
timer = setTimeout(() => { |
|
|
|
|
|
this.daojishi(time); |
|
|
|
|
|
}, 1000) |
|
|
|
|
|
}, |
|
|
|
|
|
// 查看苏康码
|
|
|
|
|
|
gotoSku: function() { |
|
|
|
|
|
commonApi.user_post("pbservice/Ztfw/sukangCode").then(res => { |
|
|
|
|
|
console.log(res) |
|
|
|
|
|
app.globalData.weburl = res.data.url; |
|
|
|
|
|
wx.navigateTo({ |
|
|
|
|
|
url: '/pages/pbService/web/index' |
|
|
|
|
|
}) |
|
|
|
|
|
return; |
|
|
|
|
|
}) |
|
|
|
|
|
}, |
|
|
|
|
|
goDetail(e) { |
|
|
|
|
|
console.log(e.currentTarget.dataset); |
|
|
|
|
|
let item = e.currentTarget.dataset.set |
|
|
|
|
|
// 组合产品 跳线路
|
|
|
|
|
|
if (item.compose_product_id) { |
|
|
|
|
|
wx.navigateTo({ |
|
|
|
|
|
url: '/pages/info/roadInfo/index?id=' + item.compose_product_id |
|
|
|
|
|
}) |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
if (item.is_package == 1) { |
|
|
|
|
|
wx.navigateTo({ |
|
|
|
|
|
url: "/pages/info/postProductInfo/index?id=" + item.product_id |
|
|
|
|
|
}) |
|
|
|
|
|
return |
|
|
|
|
|
} else if (item.is_package == 2) { |
|
|
|
|
|
wx.navigateTo({ |
|
|
|
|
|
url: '/subPackages/goods/oneCardTour/info/index?id=' + item.scene_id |
|
|
|
|
|
}); |
|
|
|
|
|
return |
|
|
|
|
|
} else if (item.is_package == 3) { |
|
|
|
|
|
wx.navigateTo({ |
|
|
|
|
|
url: '/subPackages/goods/memberCard/index?id=' + item.product_id |
|
|
|
|
|
}); |
|
|
|
|
|
return |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
if (item.product_model == 'ticket') { |
|
|
* 生命周期函数--监听页面显示 |
|
|
wx.navigateTo({ |
|
|
*/ |
|
|
url: "/pages/info/sceneProductInfo/index?id=" + item.scene_id |
|
|
onShow: function () { |
|
|
}) |
|
|
commonApi.user_post("order/query",{ |
|
|
} else if (item.product_model == 'post') { |
|
|
order_id:this.data.id |
|
|
wx.navigateTo({ |
|
|
}).then(res=>{ |
|
|
url: "/pages/info/postProductInfo/index?id=" + item.product_id |
|
|
if(res.data.create_time && res.data.auto_close_time && res.data.state=='UNPAID'){ |
|
|
}) |
|
|
let time = (new Date(res.data.create_time.replace(/-/g,'/')).getTime() + Number(res.data.auto_close_time) * 1000); |
|
|
} |
|
|
this.daojishi(time); |
|
|
}, |
|
|
} |
|
|
showMsg(e) { |
|
|
let proId = [] |
|
|
console.log(e.currentTarget.dataset); |
|
|
res.data.order_product_list.forEach(item => { |
|
|
let msg = e.currentTarget.dataset.msg |
|
|
proId.push(item.product_id) |
|
|
switch (msg) { |
|
|
}) |
|
|
case 'cxr1': |
|
|
let state = "" |
|
|
this.setData({ |
|
|
res.data.order_product_list.map(order=>{ |
|
|
cxr1: !this.data.cxr1, |
|
|
order.qrcode.map(item=>{ |
|
|
cxr1Text: this.data.cxr1 ? '更多' : '收起', |
|
|
item.stateText = app.globalData.codeState[item.state]; |
|
|
|
|
|
}) |
|
|
|
|
|
order.contacts_info = order.contacts_info?JSON.parse(order.contacts_info):[]; |
|
|
|
|
|
state = state + order.state; |
|
|
|
|
|
}) |
|
|
|
|
|
this.setData({ |
|
|
|
|
|
isRefund:state.indexOf("REFUND")!=-1, |
|
|
|
|
|
info:res.data, |
|
|
|
|
|
product_model:"ticket"||res.data.order_product_list[0].product_model, |
|
|
|
|
|
ids: proId.join(","), |
|
|
|
|
|
isPost: res.data.order_product_list.some(x=>x.product_model == 'post'), |
|
|
|
|
|
}) |
|
|
|
|
|
console.log(res.data); |
|
|
|
|
|
// debugger
|
|
|
|
|
|
console.log('ids',this.data.ids); |
|
|
|
|
|
this.getCodeImg() |
|
|
|
|
|
// 获取行程规划
|
|
|
|
|
|
let that = this; |
|
|
|
|
|
wx.getLocation({ |
|
|
|
|
|
type: 'gcj02', |
|
|
|
|
|
success: function (r) { |
|
|
|
|
|
let ajaxes=[]; |
|
|
|
|
|
res.data.order_product_list.map(item=>{ |
|
|
|
|
|
ajaxes.push(commonApi.user_post("order/tripplan",{ |
|
|
|
|
|
point_type:"gd", |
|
|
|
|
|
child_order_id:item.child_order_id, |
|
|
|
|
|
lon:r.longitude, |
|
|
|
|
|
lat:r.latitude |
|
|
|
|
|
})) |
|
|
|
|
|
}) |
|
|
|
|
|
Promise.all(ajaxes).then(r=>{ |
|
|
|
|
|
console.log(r) |
|
|
|
|
|
let orderInfo = that.data.info; |
|
|
|
|
|
r.map((item,index)=>{ |
|
|
|
|
|
if(item && item.data && item.data.url){ |
|
|
|
|
|
orderInfo.order_product_list[index].btnUrl = item.data.url; |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
that.setData({ |
|
|
|
|
|
info:orderInfo |
|
|
|
|
|
}) |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
}) |
|
|
|
|
|
}, |
|
|
|
|
|
// 行程规划
|
|
|
|
|
|
leadRoad:function(e){ |
|
|
|
|
|
let url = e.currentTarget.dataset.url; |
|
|
|
|
|
app.globalData.weburl = url; |
|
|
|
|
|
wx.navigateTo({ |
|
|
|
|
|
url: '/pages/pbService/web/index' |
|
|
|
|
|
}) |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
expandPost:function (e) { |
|
|
}) |
|
|
let index = e.currentTarget.dataset.index |
|
|
break; |
|
|
let productList = this.data.info.order_product_list |
|
|
case 'sysm1': |
|
|
let item = productList[index] |
|
|
this.setData({ |
|
|
item.showMore = !item.showMore |
|
|
sysm: !this.data.sysm, |
|
|
this.setData({ |
|
|
sysmText: this.data.sysm ? '更多' : '收起', |
|
|
info: this.data.info |
|
|
}) |
|
|
}) |
|
|
break; |
|
|
}, |
|
|
case 'sysm2': |
|
|
|
|
|
this.setData({ |
|
|
|
|
|
sysm2: !this.data.sysm2, |
|
|
|
|
|
sysm2Text: this.data.sysm2 ? '更多' : '收起', |
|
|
|
|
|
}) |
|
|
|
|
|
break; |
|
|
|
|
|
default: |
|
|
|
|
|
break; |
|
|
|
|
|
} |
|
|
|
|
|
}, |
|
|
|
|
|
/** |
|
|
|
|
|
* 生命周期函数--监听页面初次渲染完成 |
|
|
|
|
|
*/ |
|
|
|
|
|
onReady: function() { |
|
|
|
|
|
|
|
|
expandMsg: function(e) { |
|
|
}, |
|
|
let index = e.currentTarget.dataset.index |
|
|
|
|
|
let productList = this.data.info.order_product_list |
|
|
|
|
|
let item = productList[index] |
|
|
|
|
|
item.showMsg = !item.showMsg |
|
|
|
|
|
this.setData({ |
|
|
|
|
|
info: this.data.info |
|
|
|
|
|
}) |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 生命周期函数--监听页面隐藏 |
|
|
* 生命周期函数--监听页面显示 |
|
|
*/ |
|
|
*/ |
|
|
onHide: function () { |
|
|
onShow: function() { |
|
|
clearTimeout(timer) |
|
|
commonApi.user_post("order/query", { |
|
|
timer = null |
|
|
order_id: this.data.id |
|
|
}, |
|
|
}).then(res => { |
|
|
|
|
|
if (res.data.create_time && res.data.auto_close_time && res.data.state == 'UNPAID') { |
|
|
|
|
|
let time = (new Date(res.data.create_time.replace(/-/g, '/')).getTime() + Number(res |
|
|
|
|
|
.data.auto_close_time) * 1000); |
|
|
|
|
|
this.daojishi(time); |
|
|
|
|
|
} |
|
|
|
|
|
let proId = [] |
|
|
|
|
|
res.data.order_product_list.forEach(item => { |
|
|
|
|
|
proId.push(item.product_id) |
|
|
|
|
|
}) |
|
|
|
|
|
let state = "" |
|
|
|
|
|
res.data.order_product_list.map(order => { |
|
|
|
|
|
order.qrcode.map(item => { |
|
|
|
|
|
item.stateText = app.globalData.codeState[item.state]; |
|
|
|
|
|
}) |
|
|
|
|
|
order.contacts_info = order.contacts_info ? JSON.parse(order |
|
|
|
|
|
.contacts_info) : []; |
|
|
|
|
|
state = state + order.state; |
|
|
|
|
|
}) |
|
|
|
|
|
let reversedList = [...res.data.reservation_log].reverse(); |
|
|
|
|
|
this.setData({ |
|
|
|
|
|
isRefund: state.indexOf("REFUND") != -1, |
|
|
|
|
|
info: res.data, |
|
|
|
|
|
product_model: "ticket" || res.data.order_product_list[0].product_model, |
|
|
|
|
|
ids: proId.join(","), |
|
|
|
|
|
isPost: res.data.order_product_list.some(x => x.product_model == 'post'), |
|
|
|
|
|
reversedProgressList: reversedList |
|
|
|
|
|
}) |
|
|
|
|
|
console.log(res.data); |
|
|
|
|
|
// debugger
|
|
|
|
|
|
console.log('ids', this.data.ids); |
|
|
|
|
|
this.getCodeImg() |
|
|
|
|
|
// 获取行程规划
|
|
|
|
|
|
let that = this; |
|
|
|
|
|
wx.getLocation({ |
|
|
|
|
|
type: 'gcj02', |
|
|
|
|
|
success: function(r) { |
|
|
|
|
|
let ajaxes = []; |
|
|
|
|
|
res.data.order_product_list.map(item => { |
|
|
|
|
|
ajaxes.push(commonApi.user_post("order/tripplan", { |
|
|
|
|
|
point_type: "gd", |
|
|
|
|
|
child_order_id: item.child_order_id, |
|
|
|
|
|
lon: r.longitude, |
|
|
|
|
|
lat: r.latitude |
|
|
|
|
|
})) |
|
|
|
|
|
}) |
|
|
|
|
|
Promise.all(ajaxes).then(r => { |
|
|
|
|
|
console.log(r) |
|
|
|
|
|
let orderInfo = that.data.info; |
|
|
|
|
|
r.map((item, index) => { |
|
|
|
|
|
if (item && item.data && item.data.url) { |
|
|
|
|
|
orderInfo.order_product_list[index] |
|
|
|
|
|
.btnUrl = item.data.url; |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
that.setData({ |
|
|
|
|
|
info: orderInfo |
|
|
|
|
|
}) |
|
|
|
|
|
}) |
|
|
|
|
|
} |
|
|
|
|
|
}) |
|
|
|
|
|
}) |
|
|
|
|
|
}, |
|
|
|
|
|
// 行程规划
|
|
|
|
|
|
leadRoad: function(e) { |
|
|
|
|
|
let url = e.currentTarget.dataset.url; |
|
|
|
|
|
app.globalData.weburl = url; |
|
|
|
|
|
wx.navigateTo({ |
|
|
|
|
|
url: '/pages/pbService/web/index' |
|
|
|
|
|
}) |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
/** |
|
|
expandPost: function(e) { |
|
|
* 生命周期函数--监听页面卸载 |
|
|
let index = e.currentTarget.dataset.index |
|
|
*/ |
|
|
let productList = this.data.info.order_product_list |
|
|
onUnload: function () { |
|
|
let item = productList[index] |
|
|
|
|
|
item.showMore = !item.showMore |
|
|
|
|
|
this.setData({ |
|
|
|
|
|
info: this.data.info |
|
|
|
|
|
}) |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
}, |
|
|
expandMsg: function(e) { |
|
|
|
|
|
let index = e.currentTarget.dataset.index |
|
|
|
|
|
let productList = this.data.info.order_product_list |
|
|
|
|
|
let item = productList[index] |
|
|
|
|
|
item.showMsg = !item.showMsg |
|
|
|
|
|
this.setData({ |
|
|
|
|
|
info: this.data.info |
|
|
|
|
|
}) |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* 页面相关事件处理函数--监听用户下拉动作 |
|
|
* 生命周期函数--监听页面隐藏 |
|
|
*/ |
|
|
*/ |
|
|
onPullDownRefresh: function () { |
|
|
onHide: function() { |
|
|
|
|
|
clearTimeout(timer) |
|
|
|
|
|
timer = null |
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
}, |
|
|
/** |
|
|
|
|
|
* 生命周期函数--监听页面卸载 |
|
|
|
|
|
*/ |
|
|
|
|
|
onUnload: function() { |
|
|
|
|
|
|
|
|
/** |
|
|
}, |
|
|
* 页面上拉触底事件的处理函数 |
|
|
|
|
|
*/ |
|
|
|
|
|
onReachBottom: function () { |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
/** |
|
|
|
|
|
* 页面相关事件处理函数--监听用户下拉动作 |
|
|
|
|
|
*/ |
|
|
|
|
|
onPullDownRefresh: function() { |
|
|
|
|
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* 页面上拉触底事件的处理函数 |
|
|
|
|
|
*/ |
|
|
|
|
|
onReachBottom: function() { |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
}) |
|
|
}) |