331 lines
7.6 KiB
JavaScript
331 lines
7.6 KiB
JavaScript
|
|
// pages/record/record.js
|
||
|
|
var app = getApp()
|
||
|
|
let common = require('../../config/common.js')
|
||
|
|
Page({
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 页面的初始数据
|
||
|
|
*/
|
||
|
|
data: {
|
||
|
|
list:[],
|
||
|
|
moneyList:[
|
||
|
|
{id:0,num:"50"},
|
||
|
|
{id:1,num:"100"},
|
||
|
|
{id:2,num:"200"},
|
||
|
|
{id:3,num:"500"},
|
||
|
|
{id:4,num:"1000"},
|
||
|
|
],
|
||
|
|
show:false,
|
||
|
|
name:'',
|
||
|
|
painId:'',
|
||
|
|
relate:'',
|
||
|
|
card:'',
|
||
|
|
cardNum:'',
|
||
|
|
cardType:'',
|
||
|
|
curId:'6',
|
||
|
|
money1:'',
|
||
|
|
money2:'',
|
||
|
|
ye:'',
|
||
|
|
money:''
|
||
|
|
},
|
||
|
|
confirmCz(){
|
||
|
|
let money = this.data.money
|
||
|
|
if(isNaN(parseFloat(money))){
|
||
|
|
wx.showToast(
|
||
|
|
{
|
||
|
|
title: '请输入正确金额',
|
||
|
|
icon: 'error'
|
||
|
|
}
|
||
|
|
);
|
||
|
|
}else if(money == ''){
|
||
|
|
wx.showToast(
|
||
|
|
{
|
||
|
|
title: '请选择充值金额',
|
||
|
|
icon: 'error'
|
||
|
|
}
|
||
|
|
);
|
||
|
|
}else if(money < 0.01){
|
||
|
|
wx.showToast({
|
||
|
|
title: '金额不低于0.01',
|
||
|
|
})
|
||
|
|
}else{
|
||
|
|
wx.request({
|
||
|
|
url:'https://fy.btlsoln.com:8443/getPayRequest?openid&totalAmount&patid',
|
||
|
|
method:"GET",
|
||
|
|
data:{
|
||
|
|
openid:app.globalData.openId,
|
||
|
|
totalAmount:money,
|
||
|
|
patid:this.data.painId,
|
||
|
|
cardno:this.data.cardNum,
|
||
|
|
cardtype:this.data.cardType
|
||
|
|
},
|
||
|
|
header: {
|
||
|
|
'content-type': 'application/json'
|
||
|
|
},
|
||
|
|
success: (res)=> {
|
||
|
|
if(res.data.errCode == "BAD_REQUEST") {
|
||
|
|
wx.showToast(
|
||
|
|
{
|
||
|
|
title: '请输入正确金额',
|
||
|
|
icon: 'error'
|
||
|
|
}
|
||
|
|
);
|
||
|
|
}else if(res.data.error){
|
||
|
|
wx.showToast({
|
||
|
|
title: '检查输入金额',
|
||
|
|
icon:"error"
|
||
|
|
})
|
||
|
|
}else if(res.data.errCode == "LossReported"){
|
||
|
|
wx.showToast({
|
||
|
|
title: res.data.errMsg,
|
||
|
|
icon:"none"
|
||
|
|
})
|
||
|
|
}else{
|
||
|
|
console.log(res,"获取银联商务支付信息")
|
||
|
|
let noncestr = res.data.miniPayRequest.nonceStr
|
||
|
|
let timeStamp = res.data.miniPayRequest.timeStamp
|
||
|
|
let package1 = res.data.miniPayRequest.package
|
||
|
|
let sign = res.data.miniPayRequest.paySign
|
||
|
|
let signType = res.data.miniPayRequest.signType
|
||
|
|
let merOrderId = res.data.merOrderId
|
||
|
|
wx.requestPayment({
|
||
|
|
timeStamp: timeStamp+'',
|
||
|
|
nonceStr: noncestr,
|
||
|
|
package:package1,
|
||
|
|
signType:signType,
|
||
|
|
paySign: sign,
|
||
|
|
success (res) {
|
||
|
|
console.log(res,"支付")
|
||
|
|
wx.request({
|
||
|
|
url:'https://fy.btlsoln.com:8443/addHisRecharge?merOrderId',
|
||
|
|
method:"GET",
|
||
|
|
data:{
|
||
|
|
merOrderId:merOrderId
|
||
|
|
},
|
||
|
|
header: {
|
||
|
|
'content-type': 'application/json'
|
||
|
|
},
|
||
|
|
success: (res)=> {
|
||
|
|
console.log(res,"支付回写")
|
||
|
|
}
|
||
|
|
})
|
||
|
|
},
|
||
|
|
fail (res) {
|
||
|
|
console.log(res,"fail")
|
||
|
|
},
|
||
|
|
complete (res) {
|
||
|
|
console.log(res,'支付完成');
|
||
|
|
},
|
||
|
|
})
|
||
|
|
}
|
||
|
|
},
|
||
|
|
})
|
||
|
|
}
|
||
|
|
|
||
|
|
},
|
||
|
|
|
||
|
|
naviToCz(){
|
||
|
|
wx.navigateTo({
|
||
|
|
url: '/pages/record/record?id=3',
|
||
|
|
})
|
||
|
|
},
|
||
|
|
sel(e){
|
||
|
|
console.log(e.currentTarget.dataset.item)
|
||
|
|
let item = e.currentTarget.dataset.item
|
||
|
|
this.setData({
|
||
|
|
curId:item.id,
|
||
|
|
money:item.num
|
||
|
|
})
|
||
|
|
},
|
||
|
|
sel2(){
|
||
|
|
this.setData({
|
||
|
|
curId:5
|
||
|
|
})
|
||
|
|
},
|
||
|
|
getPerMsg(cardno,cardtype,hzxm){
|
||
|
|
wx.request({
|
||
|
|
url:'https://fy.btlsoln.com:8443/his/getPatient?cardno&cardtype&hzxm',
|
||
|
|
method:"GET",
|
||
|
|
data:{
|
||
|
|
cardno:cardno,
|
||
|
|
cardtype:cardtype,
|
||
|
|
hzxm:hzxm
|
||
|
|
},
|
||
|
|
header: {
|
||
|
|
'content-type': 'application/json'
|
||
|
|
},
|
||
|
|
success: (res)=> {
|
||
|
|
console.log(res.data,"患者详细信息")
|
||
|
|
this.setData({
|
||
|
|
ye:res.data.list[0].zhye
|
||
|
|
})
|
||
|
|
}
|
||
|
|
})
|
||
|
|
},
|
||
|
|
getPerList(){
|
||
|
|
wx.request({
|
||
|
|
url:'https://fy.btlsoln.com:8443/getPatientByOpenid?openid',
|
||
|
|
method:"GET",
|
||
|
|
data:{
|
||
|
|
openid:app.globalData.openId
|
||
|
|
},
|
||
|
|
header: {
|
||
|
|
'content-type': 'application/json'
|
||
|
|
},
|
||
|
|
success: (res)=> {
|
||
|
|
console.log(res,"患者")
|
||
|
|
if(res.data.length > 0){
|
||
|
|
let data = res.data
|
||
|
|
data.map((item,index) =>{
|
||
|
|
if(item.TYPE == 0){
|
||
|
|
let cardno = item.MEDICAL_CARD
|
||
|
|
let cardtype = item.CARD_TYPE
|
||
|
|
this.getPerMsg(cardno,cardtype,item.TRUE_NAME)
|
||
|
|
this.setData({
|
||
|
|
name:item.TRUE_NAME,
|
||
|
|
painId:item.PATIENT_ID,
|
||
|
|
relate:item.RELATE,
|
||
|
|
cardNum:item.MEDICAL_CARD,
|
||
|
|
cardType:item.CARD_TYPE
|
||
|
|
})
|
||
|
|
}
|
||
|
|
})
|
||
|
|
this.setData({
|
||
|
|
list:data
|
||
|
|
})
|
||
|
|
}else{
|
||
|
|
wx.showModal({
|
||
|
|
title: '',
|
||
|
|
content: '您还未绑定就诊人,请先绑定就诊人信息!',
|
||
|
|
cancelText:"否",
|
||
|
|
confirmText:'是',
|
||
|
|
success: function(res) {
|
||
|
|
if (res.confirm) {
|
||
|
|
wx.navigateTo({
|
||
|
|
url: '/pages/userMsgDel/userMsgDel?state=0',
|
||
|
|
})
|
||
|
|
}else{
|
||
|
|
wx.switchTab({
|
||
|
|
url: '/pages/index/index',
|
||
|
|
})
|
||
|
|
}
|
||
|
|
}
|
||
|
|
})
|
||
|
|
}
|
||
|
|
}
|
||
|
|
})
|
||
|
|
},
|
||
|
|
|
||
|
|
showPop(){
|
||
|
|
this.setData({ show: true });
|
||
|
|
},
|
||
|
|
onClose() {
|
||
|
|
this.setData({ show: false });
|
||
|
|
},
|
||
|
|
confirm(e){
|
||
|
|
console.log(e.currentTarget.dataset.item)
|
||
|
|
let user = e.currentTarget.dataset.item
|
||
|
|
let cardNum = user.MEDICAL_CARD
|
||
|
|
let cardType = user.CARD_TYPE
|
||
|
|
this.setData({
|
||
|
|
name:user.TRUE_NAME,
|
||
|
|
painId:user.PATIENT_ID,
|
||
|
|
relate:user.RELATE,
|
||
|
|
card:user.ID_CARD,
|
||
|
|
cardNum:user.MEDICAL_CARD,
|
||
|
|
cardType:user.CARD_TYPE,
|
||
|
|
show:false
|
||
|
|
});
|
||
|
|
this.getPerMsg(cardNum,cardType,user.TRUE_NAME)
|
||
|
|
},
|
||
|
|
money:function(e){
|
||
|
|
let price = e.detail.value
|
||
|
|
// if(isNaN(parseFloat(price))){
|
||
|
|
// wx.showToast(
|
||
|
|
// {
|
||
|
|
// title: '请输入正确金额',
|
||
|
|
// icon: 'error'
|
||
|
|
// }
|
||
|
|
// );
|
||
|
|
// }else{
|
||
|
|
this.setData({
|
||
|
|
money:price
|
||
|
|
})
|
||
|
|
// }
|
||
|
|
},
|
||
|
|
/**
|
||
|
|
* 生命周期函数--监听页面加载
|
||
|
|
*/
|
||
|
|
onLoad: function (options) {
|
||
|
|
if(app.globalData.openId == ""||app.globalData.openId==null){
|
||
|
|
common.checkGlobalOpenId().then(res=>{
|
||
|
|
console.log(res)
|
||
|
|
app.globalData.openId = res
|
||
|
|
this.getPerList()
|
||
|
|
},
|
||
|
|
err=>{
|
||
|
|
//初始化失败,弹框提示
|
||
|
|
})
|
||
|
|
}else{
|
||
|
|
this.getPerList()
|
||
|
|
}
|
||
|
|
this.setData({
|
||
|
|
name:app.globalData.name,
|
||
|
|
painId:app.globalData.painId,
|
||
|
|
type:app.globalData.relate,
|
||
|
|
card:app.globalData.sfId,
|
||
|
|
cardNum:app.globalData.cardNum
|
||
|
|
})
|
||
|
|
},
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 生命周期函数--监听页面初次渲染完成
|
||
|
|
*/
|
||
|
|
onReady: function () {
|
||
|
|
wx.setNavigationBarTitle({
|
||
|
|
title: "门诊充值"
|
||
|
|
})
|
||
|
|
},
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 生命周期函数--监听页面显示
|
||
|
|
*/
|
||
|
|
onShow: function () {
|
||
|
|
// this.getPerList()
|
||
|
|
},
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 生命周期函数--监听页面隐藏
|
||
|
|
*/
|
||
|
|
onHide: function () {
|
||
|
|
|
||
|
|
},
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 生命周期函数--监听页面卸载
|
||
|
|
*/
|
||
|
|
onUnload: function () {
|
||
|
|
|
||
|
|
},
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 页面相关事件处理函数--监听用户下拉动作
|
||
|
|
*/
|
||
|
|
onPullDownRefresh: function () {
|
||
|
|
|
||
|
|
},
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 页面上拉触底事件的处理函数
|
||
|
|
*/
|
||
|
|
onReachBottom: function () {
|
||
|
|
|
||
|
|
},
|
||
|
|
|
||
|
|
/**
|
||
|
|
* 用户点击右上角分享
|
||
|
|
*/
|
||
|
|
onShareAppMessage: function () {
|
||
|
|
|
||
|
|
}
|
||
|
|
})
|