461 lines
11 KiB
JavaScript
461 lines
11 KiB
JavaScript
|
|
|
|||
|
|
var app = getApp();
|
|||
|
|
var that=null;
|
|||
|
|
var sopenFrame=null;
|
|||
|
|
var WxParse = null;
|
|||
|
|
var iftj=0;
|
|||
|
|
Page( {
|
|||
|
|
data: {
|
|||
|
|
loadingHidden:false,
|
|||
|
|
orderpayHidden:true,
|
|||
|
|
orderyhHidden:true,
|
|||
|
|
orderyhHidden0:true,
|
|||
|
|
orderseefHidden:true,
|
|||
|
|
orderseef0Hidden:true,
|
|||
|
|
checked:0,
|
|||
|
|
xytitle:"",
|
|||
|
|
xybody:"",
|
|||
|
|
bhyy:"",
|
|||
|
|
myorder:[],
|
|||
|
|
shipments:[],
|
|||
|
|
zftype:2,
|
|||
|
|
ttype:0,
|
|||
|
|
t:0,
|
|||
|
|
image:"",
|
|||
|
|
image0:"",
|
|||
|
|
Payed:0,
|
|||
|
|
Shipped:0,
|
|||
|
|
FHEnable2:"0",
|
|||
|
|
orderid:"",
|
|||
|
|
oid:0,
|
|||
|
|
apiurl:""
|
|||
|
|
},
|
|||
|
|
|
|||
|
|
onLoad: function(options) {
|
|||
|
|
that = this
|
|||
|
|
WxParse = require('../../wxParse/wxParse.js');
|
|||
|
|
if(options.id){
|
|||
|
|
that.setData({
|
|||
|
|
oid:options.id
|
|||
|
|
})
|
|||
|
|
}
|
|||
|
|
if(options.orderid){
|
|||
|
|
that.setData({
|
|||
|
|
orderid:options.orderid
|
|||
|
|
})
|
|||
|
|
}
|
|||
|
|
if(options.t){
|
|||
|
|
that.setData({
|
|||
|
|
t:options.t
|
|||
|
|
});
|
|||
|
|
}
|
|||
|
|
that.rdata()
|
|||
|
|
|
|||
|
|
},rdata: function() {
|
|||
|
|
var userId = wx.getStorageSync("userId")
|
|||
|
|
var LoginId = wx.getStorageSync("LoginId")
|
|||
|
|
var userInfodata = wx.getStorageSync("userInfo")
|
|||
|
|
if(userId&&LoginId&&userInfodata){
|
|||
|
|
var userInfo = JSON.parse(userInfodata)
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
wx.request({
|
|||
|
|
url: app.globalData.apiurl + "/xapiajax.ashx",
|
|||
|
|
data: {
|
|||
|
|
action:"getordersinfo",
|
|||
|
|
orderId:that.data.oid,
|
|||
|
|
id:that.data.orderid,
|
|||
|
|
userId:(userId==null?"":userId),
|
|||
|
|
LoginId:(LoginId==null?"":LoginId)
|
|||
|
|
},
|
|||
|
|
method:"GET",
|
|||
|
|
dataType:"json",
|
|||
|
|
header: {
|
|||
|
|
"content-type": "application/json" // 默认值
|
|||
|
|
},
|
|||
|
|
success (res) {
|
|||
|
|
if(res.data.status==1){
|
|||
|
|
// 处理每个订单数据,将status0中的<br>替换为逗号
|
|||
|
|
for(var i=0; i<res.data.data.length; i++){
|
|||
|
|
if(res.data.data[i].status0){
|
|||
|
|
res.data.data[i].status0 = res.data.data[i].status0.replace(/<br\s*\/?>/gi, ',');
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
that.setData({
|
|||
|
|
myorder: res.data.data,
|
|||
|
|
shipments: res.data.shipments,
|
|||
|
|
xytitle:res.data.xytitle,
|
|||
|
|
loadingHidden:true
|
|||
|
|
})
|
|||
|
|
WxParse.wxParse('xybody', 'html', res.data.xybody, that);
|
|||
|
|
}else{
|
|||
|
|
wx.showToast({
|
|||
|
|
title: res.data.msg,
|
|||
|
|
icon: "none",
|
|||
|
|
duration: 3000
|
|||
|
|
})
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
})
|
|||
|
|
},viewimages0:function(e) {
|
|||
|
|
var src = e.currentTarget.dataset.index;
|
|||
|
|
var src0 = e.currentTarget.dataset.index0;
|
|||
|
|
var imgList=new Array();
|
|||
|
|
imgList[0]=src;
|
|||
|
|
imgList[1]=src0;
|
|||
|
|
wx.previewImage({
|
|||
|
|
urls: imgList,
|
|||
|
|
current:imgList[0]
|
|||
|
|
})
|
|||
|
|
},viewimages1:function(e) {
|
|||
|
|
var src = e.currentTarget.dataset.index;
|
|||
|
|
var src0 = e.currentTarget.dataset.index0;
|
|||
|
|
var imgList=new Array();
|
|||
|
|
imgList[0]=src;
|
|||
|
|
imgList[1]=src0;
|
|||
|
|
wx.previewImage({
|
|||
|
|
urls: imgList,
|
|||
|
|
current:imgList[1]
|
|||
|
|
})
|
|||
|
|
},onshowpay:function(e) {
|
|||
|
|
var id = e.currentTarget.dataset.id
|
|||
|
|
that.setData({
|
|||
|
|
orderpayHidden:false,
|
|||
|
|
orderid:id
|
|||
|
|
})
|
|||
|
|
},weixinpay:function(e) {
|
|||
|
|
that.setData({
|
|||
|
|
zftype:0
|
|||
|
|
})
|
|||
|
|
},jianjinpay:function(e) {
|
|||
|
|
that.setData({
|
|||
|
|
zftype:2
|
|||
|
|
})
|
|||
|
|
},qypay:function() {
|
|||
|
|
var userId = wx.getStorageSync("userId")
|
|||
|
|
var LoginId = wx.getStorageSync("LoginId")
|
|||
|
|
var openid = wx.getStorageSync("openid");
|
|||
|
|
if(iftj==0){
|
|||
|
|
iftj=1;
|
|||
|
|
wx.request({
|
|||
|
|
url: app.globalData.apiurl + "/xapiajax.ashx",
|
|||
|
|
data: {
|
|||
|
|
action:"payorder",
|
|||
|
|
userId:(userId==null?"":userId),
|
|||
|
|
LoginId:(LoginId==null?"":LoginId),
|
|||
|
|
openid:(!openid?"":openid),
|
|||
|
|
orderid:that.data.orderid,
|
|||
|
|
zftype:that.data.zftype
|
|||
|
|
},
|
|||
|
|
method:"POST",
|
|||
|
|
dataType:"json",
|
|||
|
|
header: {
|
|||
|
|
"content-type": "application/x-www-form-urlencoded" // 默认值
|
|||
|
|
},
|
|||
|
|
success (res0) {
|
|||
|
|
iftj=0;
|
|||
|
|
if(res0.data.ResultId>0){
|
|||
|
|
wx.requestPayment({
|
|||
|
|
timeStamp: res0.data.timeStamp,
|
|||
|
|
nonceStr: res0.data.noncestr,
|
|||
|
|
package: res0.data.package,
|
|||
|
|
signType: 'MD5',
|
|||
|
|
paySign: res0.data.paySign,
|
|||
|
|
success (res) {
|
|||
|
|
app.globalData.IFRefreshmyorder=1;
|
|||
|
|
that.rdata();
|
|||
|
|
},
|
|||
|
|
fail (res) {
|
|||
|
|
wx.showToast({
|
|||
|
|
title: JSON.stringify(res),
|
|||
|
|
icon: "none",
|
|||
|
|
duration: 3000
|
|||
|
|
})}
|
|||
|
|
})
|
|||
|
|
}else{
|
|||
|
|
wx.showToast({
|
|||
|
|
title: res0.data.msg,
|
|||
|
|
icon: "none",
|
|||
|
|
duration: 3000
|
|||
|
|
})
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
})
|
|||
|
|
}
|
|||
|
|
},closeorderpay:function(e) {
|
|||
|
|
that.setData({
|
|||
|
|
orderpayHidden:true
|
|||
|
|
})
|
|||
|
|
},inorderpay:function(e) {
|
|||
|
|
|
|||
|
|
},closeorderseef:function(e) {
|
|||
|
|
that.setData({
|
|||
|
|
orderseefHidden:true
|
|||
|
|
})
|
|||
|
|
},closeorderseef0:function(e) {
|
|||
|
|
that.setData({
|
|||
|
|
orderseef0Hidden:true
|
|||
|
|
})
|
|||
|
|
},oncancel:function(e) {
|
|||
|
|
var id = e.currentTarget.dataset.id
|
|||
|
|
that.setData({
|
|||
|
|
orderid:id
|
|||
|
|
})
|
|||
|
|
wx.showModal({
|
|||
|
|
title: '取消提示',
|
|||
|
|
content: '此操作不可恢复!您确认要取消吗?',
|
|||
|
|
success (res1) {
|
|||
|
|
if (res1.confirm) {
|
|||
|
|
var userId = wx.getStorageSync("userId")
|
|||
|
|
var LoginId = wx.getStorageSync("LoginId")
|
|||
|
|
if(iftj==0){
|
|||
|
|
iftj=1;
|
|||
|
|
wx.request({
|
|||
|
|
url: app.globalData.apiurl + "/xapiajax.ashx",
|
|||
|
|
data: {
|
|||
|
|
action:"CancelOrder",
|
|||
|
|
userId:(userId==null?"":userId),
|
|||
|
|
LoginId:(LoginId==null?"":LoginId),
|
|||
|
|
orderid:that.data.orderid
|
|||
|
|
},
|
|||
|
|
method:"POST",
|
|||
|
|
dataType:"json",
|
|||
|
|
header: {
|
|||
|
|
"content-type": "application/x-www-form-urlencoded" // 默认值
|
|||
|
|
},
|
|||
|
|
success (res) {
|
|||
|
|
iftj=0;
|
|||
|
|
if(res.data.status==1){
|
|||
|
|
wx.showToast({
|
|||
|
|
title: res.data.msg,
|
|||
|
|
icon: "success",
|
|||
|
|
duration: 3000
|
|||
|
|
})
|
|||
|
|
app.globalData.IFRefreshmyorder=1;
|
|||
|
|
that.rdata();
|
|||
|
|
}else{
|
|||
|
|
wx.showToast({
|
|||
|
|
title: res.data.msg,
|
|||
|
|
icon: "none",
|
|||
|
|
duration: 3000
|
|||
|
|
})
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
})
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
})
|
|||
|
|
},onwyth:function(e) {
|
|||
|
|
var id = e.currentTarget.dataset.id
|
|||
|
|
that.setData({
|
|||
|
|
orderid:id
|
|||
|
|
})
|
|||
|
|
wx.showModal({
|
|||
|
|
title: '友情提示',
|
|||
|
|
content: '此操作不可恢复?您确认要提货吗?',
|
|||
|
|
success (res1) {
|
|||
|
|
if (res1.confirm) {
|
|||
|
|
var userId = wx.getStorageSync("userId")
|
|||
|
|
var LoginId = wx.getStorageSync("LoginId")
|
|||
|
|
if(iftj==0){
|
|||
|
|
iftj=1;
|
|||
|
|
wx.request({
|
|||
|
|
url: app.globalData.apiurl + "/xapiajax.ashx",
|
|||
|
|
data: {
|
|||
|
|
action:"qythorder",
|
|||
|
|
userId:(userId==null?"":userId),
|
|||
|
|
LoginId:(LoginId==null?"":LoginId),
|
|||
|
|
orderid:that.data.orderid
|
|||
|
|
},
|
|||
|
|
method:"POST",
|
|||
|
|
dataType:"json",
|
|||
|
|
header: {
|
|||
|
|
"content-type": "application/x-www-form-urlencoded" // 默认值
|
|||
|
|
},
|
|||
|
|
success (res) {
|
|||
|
|
iftj=0;
|
|||
|
|
if(res.data.status==1){
|
|||
|
|
wx.showToast({
|
|||
|
|
title: res.data.msg,
|
|||
|
|
icon: "success",
|
|||
|
|
duration: 3000
|
|||
|
|
})
|
|||
|
|
that.rdata();
|
|||
|
|
}else{
|
|||
|
|
wx.showToast({
|
|||
|
|
title: res.data.msg,
|
|||
|
|
icon: "none",
|
|||
|
|
duration: 3000
|
|||
|
|
})
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
})
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
})
|
|||
|
|
},onshowwyyh:function(e) {
|
|||
|
|
|
|||
|
|
that.setData({
|
|||
|
|
orderyhHidden:false
|
|||
|
|
})
|
|||
|
|
},closeorderyh:function(e) {
|
|||
|
|
that.setData({
|
|||
|
|
orderyhHidden:true
|
|||
|
|
})
|
|||
|
|
},closeorderyh0:function(e) {
|
|||
|
|
that.setData({
|
|||
|
|
orderyhHidden0:true
|
|||
|
|
})
|
|||
|
|
},onchecked:function(e) {
|
|||
|
|
if(that.data.checked==0){
|
|||
|
|
that.setData({
|
|||
|
|
checked:1
|
|||
|
|
})
|
|||
|
|
}else{
|
|||
|
|
that.setData({
|
|||
|
|
checked:0
|
|||
|
|
})
|
|||
|
|
}
|
|||
|
|
},openxy:function(e) {
|
|||
|
|
that.setData({
|
|||
|
|
orderyhHidden0:false
|
|||
|
|
})
|
|||
|
|
},onwyyh:function(e) {
|
|||
|
|
|
|||
|
|
if(that.data.checked==0){
|
|||
|
|
wx.showToast({
|
|||
|
|
title: "请先阅读" + that.data.xytitle,
|
|||
|
|
icon: "none",
|
|||
|
|
duration: 3000
|
|||
|
|
})
|
|||
|
|
}else{
|
|||
|
|
|
|||
|
|
|
|||
|
|
var userId = wx.getStorageSync("userId")
|
|||
|
|
var LoginId = wx.getStorageSync("LoginId")
|
|||
|
|
if(iftj==0){
|
|||
|
|
iftj=1;
|
|||
|
|
wx.request({
|
|||
|
|
url: app.globalData.apiurl + "/xapiajax.ashx",
|
|||
|
|
data: {
|
|||
|
|
action:"qyyhorder",
|
|||
|
|
userId:(userId==null?"":userId),
|
|||
|
|
LoginId:(LoginId==null?"":LoginId),
|
|||
|
|
orderid:that.data.orderid
|
|||
|
|
},
|
|||
|
|
method:"POST",
|
|||
|
|
dataType:"json",
|
|||
|
|
header: {
|
|||
|
|
"content-type": "application/x-www-form-urlencoded" // 默认值
|
|||
|
|
},
|
|||
|
|
success (res) {
|
|||
|
|
iftj=0;
|
|||
|
|
if(res.data.status==1){
|
|||
|
|
wx.showToast({
|
|||
|
|
title: res.data.msg,
|
|||
|
|
icon: "success",
|
|||
|
|
duration: 3000
|
|||
|
|
})
|
|||
|
|
that.setData({
|
|||
|
|
orderyhHidden:true
|
|||
|
|
})
|
|||
|
|
that.rdata();
|
|||
|
|
}else{
|
|||
|
|
wx.showToast({
|
|||
|
|
title: res.data.msg,
|
|||
|
|
icon: "none",
|
|||
|
|
duration: 3000
|
|||
|
|
})
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
})
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
},onqysh:function(e) {
|
|||
|
|
var id = e.currentTarget.dataset.id
|
|||
|
|
|
|||
|
|
wx.showModal({
|
|||
|
|
title: '友情提示',
|
|||
|
|
content: '确认收货前请确认您是否真的已经收到货了?您确认要收货吗?',
|
|||
|
|
success (res1) {
|
|||
|
|
if (res1.confirm) {
|
|||
|
|
var userId = wx.getStorageSync("userId")
|
|||
|
|
var LoginId = wx.getStorageSync("LoginId")
|
|||
|
|
if(iftj==0){
|
|||
|
|
iftj=1;
|
|||
|
|
wx.request({
|
|||
|
|
url: app.globalData.apiurl + "/xapiajax.ashx",
|
|||
|
|
data: {
|
|||
|
|
action:"qyshorder",
|
|||
|
|
userId:(userId==null?"":userId),
|
|||
|
|
LoginId:(LoginId==null?"":LoginId),
|
|||
|
|
id:id
|
|||
|
|
},
|
|||
|
|
method:"POST",
|
|||
|
|
dataType:"json",
|
|||
|
|
header: {
|
|||
|
|
"content-type": "application/x-www-form-urlencoded" // 默认值
|
|||
|
|
},
|
|||
|
|
success (res) {
|
|||
|
|
iftj=0;
|
|||
|
|
if(res.data.status==1){
|
|||
|
|
wx.showToast({
|
|||
|
|
title: res.data.msg,
|
|||
|
|
icon: "success",
|
|||
|
|
duration: 3000
|
|||
|
|
})
|
|||
|
|
app.globalData.IFRefreshmyorder=1;
|
|||
|
|
that.rdata();
|
|||
|
|
}else{
|
|||
|
|
wx.showToast({
|
|||
|
|
title: res.data.msg,
|
|||
|
|
icon: "none",
|
|||
|
|
duration: 3000
|
|||
|
|
})
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
|
|||
|
|
}
|
|||
|
|
})
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
}
|
|||
|
|
})
|
|||
|
|
},ondetail:function(e) {
|
|||
|
|
var id = e.currentTarget.dataset.id
|
|||
|
|
wx.navigateTo({
|
|||
|
|
url: "../details/index?id=" + id
|
|||
|
|
})
|
|||
|
|
},onckwl:function(e) {
|
|||
|
|
var wlxx = e.currentTarget.dataset.id
|
|||
|
|
wx.navigateTo({
|
|||
|
|
url: "../myorderwlxx/index?wlxx=" + wlxx
|
|||
|
|
})
|
|||
|
|
},copyText:function(e) {
|
|||
|
|
wx.setClipboardData({
|
|||
|
|
data: e.currentTarget.dataset.text,
|
|||
|
|
success: function (res) {
|
|||
|
|
wx.getClipboardData({
|
|||
|
|
success: function (res) {
|
|||
|
|
wx.showToast({
|
|||
|
|
title: '复制成功'
|
|||
|
|
})
|
|||
|
|
}
|
|||
|
|
})
|
|||
|
|
}
|
|||
|
|
})
|
|||
|
|
}
|
|||
|
|
})
|