Files
coupon/pages/orderdetail/orderdetail.js

533 lines
13 KiB
JavaScript
Raw Normal View History

2023-02-18 16:24:17 +08:00
//获取应用实例
var app = getApp();
Page({
/**
* 页面的初始数据
*/
data: {
resp:{
"detail": {
"address": "陕西省人民医院地铁口A口",
"charge_phone": "13772530001",
"goods_id": "f76f6fc1e44f7627a3f54c55cbe3b984",
"goods_name": "专业陪护服务",
"id": "19fdf93c85c2f9f393a59bb8d64c3948",
"index_img": "https://www.zoowoo.net/uploadnv/2022/02/09/164437226246602.png",
"mechanism_name": "贺**",
"num": "1",
"refund": "1",
"total_money": "0.01",
"wechat_logo": "https://www.zoowoo.net/uploadnv/2022/02/08/164430729380625.png"
},
"erro": 0,
"msg": "查询成功",
"order": {
"num": "1",
"order_id": "2022021514543285003305",
"phone": "18133922183",
"time": "2022-02-15 14:54:32",
"total_money": "0.01"
}
},
dingdan_msg:false,
ewm_msg:false,
mengceng:false,
order_id:0,
goods_id:'',
btn1:'',
qrcode:'',
id:'',
item: {},
url: app.globalData.url,
refund:'',
charge_phone:'',
refund_box:false,
list:[
{
text:'不喜欢/不想要',
},
{
text:'商品信息与描述不符'
},
{
text:'买多/买错/计划有变'
},
{
text:'更换其他项目、购买了其他项目'
},
{
text:'没有时间/个人原因'
},
{
text:'其他原因'
}
],
show: false,
statusType: ["拼团"],
status:[ "0"],
currentType: 0,
nav_type:0,
is_ok_click:false,
height:''
},
statusTap: function (e) {
var curType = e.currentTarget.dataset.index;
this.setData({
currentType: curType,
nav_type:curType
});
app.console("================="+curType)
},
onClickShow() {
this.setData({ show: true });
},
onClickHide() {
this.setData({ show: false });
},
isok(){
var that = this;
wx.request({
url: app.buildUrl("/app/Goddesswechat/submitRefund"),
header: app.getRequestHeader(),
method:'POST',
data: {
version_number: app.globalData.version_number,
uid:wx.getStorageSync('uid'),
token:wx.getStorageSync('token'),
id:'',
refund_id:'',
refund_remark:'',
voucher_img:'',
},
success: function (res) {
var resp = res.data;
console.log(resp+"=================dddddddddddddddddddddddddddddddddddddddddddd")
if(resp.erro==0){
that.setData({
status:resp.infro.status
});
if(resp.infro.infro==1){
wx.navigateTo({
url: '/pages/tuiguang/tuiguang'
})
}
}
}
});
this.setData({
refund_box:false,
mengceng:false
})
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (e) {
var statusBarHeight = wx.getSystemInfoSync().statusBarHeight;
app.console(statusBarHeight+"=================xxxxxxxxxxxxxxxxxxxxxxxx")
this.setData({
statusBarHeight: statusBarHeight,
height: 46 + statusBarHeight,
});
app.console(this.data.height+"=================xxxxxxxxxxxxxxxxxxxxxxxx")
console.log(e.type)
console.log(e.id)
//条目点击进入详情页
this.setData({
btn1:2,
order_id:e.id
})
var that = this;
let item = JSON.parse(e.item);
that.setData({
item: item,
charge_phone:18133233292
});
// if(options.type==1){
// this.setData({
// btn1:1,
// order_id:options.id
// })
// }
// if(options.type==2){
// this.setData({
// btn1:2,
// order_id:options.id
// })
// }else if(options.type==3){
// this.setData({
// btn1:3,
// order_id:options.id
// })
// }
app.console("类型================="+this.data.btn1)
},
mengceng(){
this.setData({
dingdan_msg:false,
ewm_msg:false,
mengceng:false,
refund_box:false
})
},
seeQcode(){
console.log('点击了查看二维码')
//console.log(that.data.order_id)
this.setData({
ewm_msg:true,
mengceng:true
})
var that=this;
wx.request({
url: app.globalData.url + '/app/Goddesswechat/getOrderQrcode',
data: {
version_number: app.globalData.version_number,
uid:wx.getStorageSync('uid'),
token:wx.getStorageSync('token'),
id:that.data.order_id
},
method: 'POST',
header: { 'content-type': 'application/x-www-form-urlencoded' },
success:(res)=>{
console.log(res)
if(res.data.erro==0){
this.setData({
qrcode:res.data.qrcode,
})
console.log(this.data.qrcode+"=================dddxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxd")
}else{
wx.showToast({
title: res.data.msg,
icon: 'none',
duration: 2000
})
}
}
})
},
cancelOrder(){
console.log('点击了取消订单')
this.setData({
dingdan_msg:true,
mengceng:true
})
},
okcancel(){
var that = this;
wx.request({
url: app.globalData.url + '/system/order/concelOrder/'+this.data.item.orderId,
header: app.getRequestHeader(),
method: 'GET',
data: {
// id: this.data.item.orderId,
},
success: (res) => {
var resp = res.data;
if (res.data.code == 200) {
wx.showToast({ title: res.data.msg, icon: 'none' });
}
}
});
console.log('点击了坚持取消');
// var _this=this;
// wx.request({
// url: app.globalData.url + '/app/Goddesswechat/cancelOrder',
// data: {
// version_number: app.globalData.version_number,
// uid: wx.getStorageSync('uid'),
// token:wx.getStorageSync('token'),
// order_id:this.data.order_id
// },
// method: 'POST',
// header: { 'content-type': 'application/x-www-form-urlencoded' },
// success(res) {
// console.log(1111111)
// console.log(res)
// if (res.data.erro == 0) {
// wx.showToast({ title: res.data.msg, icon: 'none' });
// }else{
// }
// }
// }
// )
this.setData({
dingdan_msg:false,
mengceng:false
})
},
nocancel(){
this.setData({
dingdan_msg:false,
mengceng:false
})
},
/**
* 拨打电话
*/
callphone(){
wx.makePhoneCall({
phoneNumber: this.data.charge_phone,
})
},
/**
* 发起拼团
*/
pintuan(){
this.setData({ show: true });
},
tiaoguo(){
this.setData({ show: false });
},
/**
* 同意发起
*/
tongyifaqi(){
this.confirmCollage()
},
//确认发起团购/砍价
confirmCollage: function () {
var that = this;
wx.request({
url: app.buildUrl("/app/Goddesswechat/confirmCollage"),
header: app.getRequestHeader(),
method:'POST',
data: {
version_number: app.globalData.version_number,
uid:wx.getStorageSync('uid'),
token:wx.getStorageSync('token'),
order_id:this.data.order_id
},
success: function (res) {
var resp = res.data;
console.log(resp+"=================dddddddddddddddddddddddddddddddddddddddddddd")
if(resp.erro==0){
wx.showToast({ title: resp.msg, icon: 'none' });
that.setData({ show: false });
}
}
});
},
refund(){
if (this.data.refund==0) {
app.tip({content: '该订单不支持退款'});
return
}
wx.navigateTo({
url: '/pages/reforderdetail/reforderdetail?'+"type="+'3'+ '&id=' +this.data.id,
})
// this.setData({
// refund_box:true,
// mengceng:true
// })
},
gang(){
this.setData({
refund_box:false,
mengceng:false
})
},
// 确认支付
confirm_pay: async function (){
var that = this;
if (!this.data.is_ok_click){
that.setData({
is_ok_click:true
})
//你要执行的操作
this.godetail()
setTimeout(function () {
that.setData({
is_ok_click: false
})
}, 10000) //阻止一秒点击多次
}else{
// wx.showToast({
// title: '请勿重复操作!',
// })
}
},
godetail(){
console.log('点击了去付款');
var _this=this;
console.log(this.data.id+'tttttttttttttttttttttttttttttttttt')
wx.request({
2023-03-01 22:50:02 +08:00
url: app.globalData.url + '/system/weixinPay/12345678',
header: app.getRequestHeader(),
method: 'GET',
data: {
},
// url: app.globalData.url + '/system/weixinPay/123',
// header: app.getRequestHeader(),
// data: {
// version_number: app.globalData.version_number,
// uid: wx.getStorageSync('uid'),
// token:wx.getStorageSync('token'),
// goods_id:this.data.goods_id,
// order_id:this.data.order_id,
// tg_order:''
// },
//method: 'POST',
// header: { 'content-type': 'application/x-www-form-urlencoded' },
2023-02-18 16:24:17 +08:00
success(res) {
console.log(1111111)
console.log(res)
2023-03-01 22:50:02 +08:00
if (res.data.code == 200) {
2023-02-18 16:24:17 +08:00
wx.requestPayment({
timeStamp: res.data.data.timeStamp,
nonceStr: res.data.data.nonceStr,
package: res.data.data.package,
signType: 'MD5',
paySign: res.data.data.paySign,
success (res) {
console.log('支付成功');
wx.navigateTo({
url: '/shopping/pages/paysuccess/paysuccess',
})
},
fail (res) {
console.log('支付失败');
}
})
}else{
wx.showToast({
title: res.data.msg,
icon: 'error',
duration: 2000
})
}
}
}
// wx.navigateTo({
// url: '/shopping/pages/paysuccess/paysuccess',
// }
)
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
// this.getOrderDetail();
//假数据
var that = this;
if(this.data.resp.erro==0){
that.setData({
detail:this.data.resp.detail,
order:this.data.resp.order,
goods_id:this.data.resp.detail.goods_id,
id:this.data.resp.detail.id,
refund:this.data.resp.detail.refund,
charge_phone:this.data.resp.detail.charge_phone
});
}
},
/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {
},
onClickLeft() {
wx.navigateBack()
},
/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {
},
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {
},
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {
},
/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {
},
//订单详情
getOrderDetail: function () {
var that = this;
wx.request({
url: app.buildUrl("/app/Goddesswechat/getOrderDetail"),
header: app.getRequestHeader(),
method:'POST',
data: {
version_number: this.data.version_number,
uid:wx.getStorageSync('uid'),
token:wx.getStorageSync('token'),
order_id:this.data.order_id
},
success: function (res) {
var resp = res.data;
console.log(resp+"=================dddddddddddddddddddddddddddddddddddddddddddd")
console.log(resp.erro+"=================dddddddddddddddddddddddddddddddddddddddddddd")
if(resp.erro==0){
that.setData({
detail:resp.detail,
order:resp.order,
goods_id:resp.detail.goods_id,
id:resp.detail.id,
refund:resp.detail.refund,
charge_phone:resp.detail.charge_phone
});
}
}
});
},
})