1.22
This commit is contained in:
@@ -0,0 +1,265 @@
|
||||
// pages/medinceOrderDetail/medinceOrderDetail.js
|
||||
const app = getApp()
|
||||
import {productDetail,cancelPayProduct,delProduct} from "../../../api/medinceOrder"
|
||||
import {fllowDoctor,notfllowDoctor} from "../../../api/consultExpert"
|
||||
import {throttle} from "../../../utils/util"
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
time: 30 * 60 * 60 * 1000,
|
||||
order_product_id:'',
|
||||
showDialog:false,
|
||||
message:'',
|
||||
fromType:'',
|
||||
order_product:{},
|
||||
order_product_item:{},
|
||||
user_doctor:{},
|
||||
patient_family_data:'',
|
||||
img_host:'https://oss.prod.applets.igandanyiyuan.com/applet/patient/static'
|
||||
},
|
||||
goBack(){
|
||||
let {fromType}=this.data;
|
||||
if(app.globalData.origion==1){
|
||||
wx.reLaunch({
|
||||
url: '/pages/index/index',
|
||||
})
|
||||
}else if(app.globalData.origion==2){
|
||||
wx.reLaunch({
|
||||
url: '/pages/index/index',
|
||||
})
|
||||
}else{
|
||||
if(fromType){
|
||||
let url=decodeURIComponent(fromType);
|
||||
let goUrl='';
|
||||
if(url.indexOf('?')!=-1){
|
||||
goUrl='/'+url+"&fromType="+url;
|
||||
}else{
|
||||
goUrl='/'+url+"?fromType="+url;
|
||||
}
|
||||
//处理聊天收到消息不及时;
|
||||
if(url.indexOf("TUIService/pages/index")!=-1){
|
||||
app.method.navigateTo({
|
||||
url:goUrl
|
||||
})
|
||||
}else{
|
||||
wx.redirectTo({
|
||||
url: goUrl
|
||||
})
|
||||
}
|
||||
|
||||
}else{
|
||||
wx.navigateBack({
|
||||
delta: 1,
|
||||
fail:function(){
|
||||
wx.reLaunch({
|
||||
url: '/pages/index/index',
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
goExpress:throttle(function(event){
|
||||
let id=event.currentTarget.dataset.id;
|
||||
app.method.navigateTo({
|
||||
url: '/pages/expressDetail/expressDetail?logistics_no='+id,
|
||||
})
|
||||
}),
|
||||
goExpert:throttle(function(){
|
||||
let id=this.data.user_doctor.doctor_id;
|
||||
app.method.navigateTo({
|
||||
url: '/pages/expertDetail/expertDetail?doctor_id='+id,
|
||||
})
|
||||
}),
|
||||
handleProductDetail(flag=false){
|
||||
let id =this.data.order_product_id;
|
||||
productDetail(id).then(data=>{
|
||||
if(flag){
|
||||
let pages = getCurrentPages();
|
||||
let prevPage = pages[pages.length - 2]; //上一页
|
||||
this.setData({
|
||||
prevData:JSON.stringify({
|
||||
changeStatus: data.inquiry_status,
|
||||
changeId:id
|
||||
})
|
||||
});
|
||||
prevPage.setData({
|
||||
changeStatus:data.order_product.order_product_status,
|
||||
changeId:id
|
||||
});
|
||||
};
|
||||
this.setData({
|
||||
order_product:data.order_product,
|
||||
order_product_item:data.order_product_item,
|
||||
user_doctor:data.user_doctor
|
||||
});
|
||||
})
|
||||
},
|
||||
confirmDelOrder(){
|
||||
this.setData({
|
||||
showDialog:true,
|
||||
message:"您确定是要删除订单记录么?"
|
||||
})
|
||||
},
|
||||
confirmCancelPay(){
|
||||
this.setData({
|
||||
showDialog:true,
|
||||
message:"您确定取消支付么?"
|
||||
})
|
||||
},
|
||||
confirm:throttle(function(event){
|
||||
if(event.detail && this.data.message=="您确定是要删除订单记录么?"){
|
||||
this.handelDelProduct();
|
||||
}else{
|
||||
this.handelCancelPayProduct();
|
||||
}
|
||||
}),
|
||||
handelCancelPayProduct(){
|
||||
let id =this.data.order_product_id;
|
||||
cancelPayProduct(id).then(data=>{
|
||||
wx.showToast({
|
||||
title: '取消支付成功',
|
||||
icon:"none"
|
||||
})
|
||||
this.handleProductDetail();
|
||||
})
|
||||
},
|
||||
copy(event){
|
||||
let text=event.target.dataset.text;
|
||||
wx.setClipboardData({
|
||||
data:text
|
||||
})
|
||||
},
|
||||
goPay:throttle(function(){
|
||||
let {order_product_id,order_product_no}=this.data.order_product;
|
||||
app.method.navigateTo({
|
||||
url: '/patient/pages/payOrder/payOrder?inquiry_no='+ order_product_no +"&order_product_id="+order_product_id+"&order_type=2&fromType="+encodeURIComponent('pages/medinceOrder/medinceOrder')
|
||||
})
|
||||
}),
|
||||
handelDelProduct(){
|
||||
let id =this.data.order_product_id;
|
||||
delProduct(id).then(data=>{
|
||||
let pages = getCurrentPages();
|
||||
//获取所需页面
|
||||
let prevPage = pages[pages.length - 2]; //上一页
|
||||
prevPage.setData({
|
||||
delId: id//需要传过去的数据
|
||||
});
|
||||
wx.navigateBack({
|
||||
delta: 1,
|
||||
})
|
||||
wx.showToast({
|
||||
title: '订单删除成功',
|
||||
icon:"none"
|
||||
});
|
||||
|
||||
})
|
||||
},
|
||||
goPrescriptionDetail:throttle(function(event){
|
||||
let id=event.currentTarget.dataset.id;
|
||||
app.method.navigateTo({
|
||||
url: '/patient/pages/prescriptDetail/prescriptDetail?order_prescription_id='+id,
|
||||
})
|
||||
}),
|
||||
handelfllowDoctor(){
|
||||
let id=this.data.user_doctor.doctor_id
|
||||
fllowDoctor(id).then(data=>{
|
||||
this.setData({
|
||||
"user_doctor.follow":true
|
||||
})
|
||||
wx.showToast({
|
||||
title: '关注成功',
|
||||
icon:"none"
|
||||
})
|
||||
})
|
||||
},
|
||||
handenotfllowDoctor(){
|
||||
let id=this.data.user_doctor.doctor_id;
|
||||
notfllowDoctor(id).then(data=>{
|
||||
this.setData({
|
||||
"user_doctor.follow":false
|
||||
})
|
||||
wx.showToast({
|
||||
title: '已取消关注',
|
||||
icon:"none"
|
||||
})
|
||||
})
|
||||
},
|
||||
toggleFllow(){
|
||||
if(this.data.order.user_doctor.follow){
|
||||
this.handenotfllowDoctor()
|
||||
}else{
|
||||
this.handelfllowDoctor()
|
||||
}
|
||||
},
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad(options) {
|
||||
if(options.fromType){
|
||||
this.setData({
|
||||
fromType:options.fromType
|
||||
})
|
||||
}
|
||||
let order_product_id=options.order_product_id;
|
||||
if(order_product_id){
|
||||
this.setData({
|
||||
order_product_id
|
||||
});
|
||||
this.handleProductDetail();
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow() {
|
||||
this.setData({
|
||||
img_host:app.hostConfig().imghost
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom() {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
|
||||
})
|
||||
Reference in New Issue
Block a user