init version kelfy-mini for new gitea
This commit is contained in:
370
app.js
Normal file
370
app.js
Normal file
@@ -0,0 +1,370 @@
|
||||
// app.js
|
||||
|
||||
App({
|
||||
onLaunch() {
|
||||
// 展示本地存储能力
|
||||
const logs = wx.getStorageSync('logs') || []
|
||||
logs.unshift(Date.now())
|
||||
wx.setStorageSync('logs', logs)
|
||||
// 登录
|
||||
// o-ZxO47Otvo5Rsq7kN-4PHvZIOt8
|
||||
// this.globalData.openId = 'o-ZxO47Otvo5Rsq7kN-4PHvZIOt8'
|
||||
wx.checkSession({
|
||||
success() {
|
||||
// this.globalData.openId = '421322'
|
||||
|
||||
|
||||
|
||||
|
||||
},
|
||||
fail() {
|
||||
wx.login({
|
||||
success: res => {
|
||||
// 发送 res.code 到后台换取 openId, sessionKey, unionId
|
||||
if (res.code) {
|
||||
wx.request({
|
||||
url: 'https://fy.btlsoln.com:8443/getOpenid',
|
||||
method: "GEt",
|
||||
data: {
|
||||
code: res.code
|
||||
},
|
||||
success: res => {
|
||||
console.log(res.data, 'id')
|
||||
this.globalData.openId = res.data
|
||||
// this.globalData.openId = '421322'
|
||||
console.log(this.globalData.openId, 'id')
|
||||
}
|
||||
})
|
||||
} else {
|
||||
console.log('获取用户登录态失败!' + res.errMsg)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}),
|
||||
wx.login({
|
||||
success: res => {
|
||||
wx.showLoading({
|
||||
title: '加载中...',
|
||||
mask: true,
|
||||
})
|
||||
// 发送 res.code 到后台换取 openId, sessionKey, unionId
|
||||
if (res.code) {
|
||||
wx.request({
|
||||
url: 'https://fy.btlsoln.com:8443/getOpenid',
|
||||
method: "GEt",
|
||||
data: {
|
||||
code: res.code
|
||||
},
|
||||
success: res => {
|
||||
if (res.data) {
|
||||
this.globalData.openId = res.data
|
||||
wx.setStorageSync("openid", res.data)
|
||||
// this.globalData.openId = "421322"
|
||||
wx.request({
|
||||
url: 'https://fy.btlsoln.com:8443/getPatientByOpenid?openid',
|
||||
method: "GET",
|
||||
data: {
|
||||
openid: res.data
|
||||
},
|
||||
header: {
|
||||
'content-type': 'application/json'
|
||||
},
|
||||
success: (res) => {
|
||||
// console.log(res,"患者1111")
|
||||
|
||||
if (res.data.length > 0) {
|
||||
for (var i = 0; i < res.data.length; i++) {
|
||||
if (res.data[i].TYPE == 0) {
|
||||
this.globalData.name = res.data[i].TRUE_NAME
|
||||
this.globalData.sfId = res.data[i].ID_CARD
|
||||
this.globalData.painId = res.data[i].PATIENT_ID
|
||||
this.globalData.relate = res.data[i].RELATE
|
||||
this.globalData.cardNum = res.data[i].MEDICAL_CARD
|
||||
this.globalData.cardType = res.data[i].CARD_TYPE
|
||||
}
|
||||
}
|
||||
} else {
|
||||
wx.showModal({
|
||||
title: '',
|
||||
content: '您还未绑定就诊人,请先绑定就诊人信息!',
|
||||
cancelText: "否",
|
||||
confirmText: '是',
|
||||
success: function (res) {
|
||||
if (res.confirm) {
|
||||
wx.navigateTo({
|
||||
url: '/pages/userMsgDel/userMsgDel?state=0',
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
wx.request({
|
||||
url: 'https://fy.btlsoln.com:8443/findHospital',
|
||||
method: "GET",
|
||||
data: {},
|
||||
header: {
|
||||
'content-type': 'application/json'
|
||||
},
|
||||
success: (res) => {
|
||||
// console.log(res,"医院导航")
|
||||
this.globalData.hosName = res.data.HOSPITAL_NAME,
|
||||
this.globalData.hosLocation = res.data.HOSPITAL_ADDRESS,
|
||||
this.globalData.bus = res.data.HOSPITAL_BUS_ROUTE,
|
||||
this.globalData.hosPhone = res.data.HOSPITAL_PHONE
|
||||
}
|
||||
})
|
||||
wx.hideLoading({
|
||||
success: (res) => {},
|
||||
})
|
||||
} else {
|
||||
wx.showToast({
|
||||
title: '未获取到用户信息',
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
} else {
|
||||
console.log('获取用户登录态失败!' + res.errMsg)
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
globalData: {
|
||||
scene: '',
|
||||
authCode: '',
|
||||
userInfo: null,
|
||||
openId: '',
|
||||
url2: 'https://fy.btlsoln.com:8443',
|
||||
mapKey: 'VN4BZ-PDJKF-6VLJW-NSRG7-W2JOQ-5ZF56',
|
||||
appId: 'wx83bc9715be856b14',
|
||||
// 患者信息
|
||||
name: "",
|
||||
sfId: '',
|
||||
cardNum: '',
|
||||
hosp_out_trade_no: '',
|
||||
cardType: '',
|
||||
painId: '',
|
||||
relate: '',
|
||||
type: '',
|
||||
hosName: '',
|
||||
hosLocation: '',
|
||||
hosPhone: '',
|
||||
lat: 41.766064,
|
||||
lon: 86.153306,
|
||||
bus: '',
|
||||
userLat: '',
|
||||
userLon: '',
|
||||
datas: {},
|
||||
paramsData: {},
|
||||
paramsData1: {},
|
||||
show: false,
|
||||
radioVal: 0,
|
||||
areadly: true,
|
||||
gStandardList: [],
|
||||
gStandardContent: '',
|
||||
gAddtionList: [],
|
||||
gdefaultflag: '',
|
||||
gname: '',
|
||||
gsex: '',
|
||||
gage: '',
|
||||
gdeptId: '',
|
||||
gclassName: '',
|
||||
gschoolName: '',
|
||||
gnationId: '',
|
||||
gpatid: ''
|
||||
},
|
||||
|
||||
watch: function (variate, method) {
|
||||
var obj = this.globalData;
|
||||
let val = obj[variate]; // 单独变量来存储原来的值
|
||||
Object.defineProperty(obj, variate, {
|
||||
configurable: false,
|
||||
enumerable: true,
|
||||
set: function (value) {
|
||||
val = value; // 重新赋值
|
||||
method(variate, value); // 执行回调方法
|
||||
},
|
||||
get: function () {
|
||||
// 在其他界面调用getApp().globalData.variate的时候,这里就会执行。
|
||||
return val; // 返回当前值
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
wxRequest(method, url, data, callback, errFun) {
|
||||
var that = this
|
||||
wx.request({
|
||||
url: that.globalData.url2 + url,
|
||||
method: method,
|
||||
data: data,
|
||||
header: {
|
||||
'content-type': method == 'GET' ? 'application/json' : 'application/x-www-form-urlencoded',
|
||||
'Accept': 'application/json'
|
||||
},
|
||||
dataType: 'json',
|
||||
success: function (res) {
|
||||
callback(res.data);
|
||||
},
|
||||
fail: function (err) {
|
||||
errFun(err);
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
getAuthNo(openid, qrcode) {
|
||||
console.log(openid, qrcode, 'openid,qrcode')
|
||||
wx.request({
|
||||
url: 'https://fy.btlsoln.com:8443/getAuthNo',
|
||||
method: 'POST',
|
||||
data: {
|
||||
openid: openid,
|
||||
qrcode: qrcode
|
||||
},
|
||||
dataType: 'json',
|
||||
header: {
|
||||
'content-type': 'application/json'
|
||||
},
|
||||
success: (res) => {
|
||||
console.log(res, '返回开始ewd')
|
||||
console.log(res.data, '返回开始')
|
||||
if (res.data.code == '0') {
|
||||
console.log(res.data, '经纬度开始')
|
||||
this.globalData.datas = res.data
|
||||
console.log(res.data, '经纬度结束')
|
||||
this.PreSettlement()
|
||||
} else {
|
||||
wx.showModal({
|
||||
content: res.data.errMsg,
|
||||
showCancel: false,
|
||||
confirmText: '确定',
|
||||
confirmColor: '#3CC51F',
|
||||
success(res) {
|
||||
if (res.confirm) {
|
||||
console.log('用户点击确定')
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
fail: (res) => {
|
||||
wx.showModal({
|
||||
content: res.data.errMsg,
|
||||
showCancel: false,
|
||||
confirmText: '确定',
|
||||
confirmColor: '#3CC51F',
|
||||
success(res) {
|
||||
if (res.confirm) {
|
||||
console.log('用户点击确定')
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
})
|
||||
},
|
||||
|
||||
//预结算
|
||||
PreSettlement() {
|
||||
this.globalData.show = true
|
||||
let item = this.globalData.paramsData1
|
||||
let num = this.globalData.datas
|
||||
let zfjsbz = ''
|
||||
let uldLatlnt = ''
|
||||
let inpayAuthNo = ''
|
||||
let ybrc = {}
|
||||
let c = {}
|
||||
if (this.globalData.radioVal == 0) {
|
||||
zfjsbz = '0'
|
||||
if (num.longitude == undefined && num.latitude == undefined) {
|
||||
uldLatlnt = 0 + ',' + 0
|
||||
} else {
|
||||
uldLatlnt = num.longitude + ',' + num.latitude
|
||||
}
|
||||
c = {
|
||||
"type": "wx",
|
||||
"IdNo": num.user_card_no,
|
||||
"insuCode": num.city_id
|
||||
}
|
||||
inpayAuthNo = num.pay_auth_no
|
||||
ybrc = JSON.stringify(c)
|
||||
} else {
|
||||
zfjsbz = '1'
|
||||
uldLatlnt = ''
|
||||
inpayAuthNo = ''
|
||||
ybrc = ''
|
||||
}
|
||||
let {
|
||||
cfxh,
|
||||
ghxh,
|
||||
patid,
|
||||
out_ksmc
|
||||
} = item
|
||||
let a = {
|
||||
cfxh: cfxh,
|
||||
ghxh: ghxh,
|
||||
patid: patid,
|
||||
zfjsbz: zfjsbz,
|
||||
uldLatlnt: uldLatlnt,
|
||||
inpayAuthNo: inpayAuthNo,
|
||||
ybrc: ybrc,
|
||||
out_ksmc: out_ksmc
|
||||
}
|
||||
// let hosp_out_trade_no = 'JJ20240104130042'
|
||||
// wx.navigateTo({
|
||||
// url:'/pages/newChatDetail/newChatDetail?hosp_out_trade_no='+hosp_out_trade_no
|
||||
// })
|
||||
wx.request({
|
||||
url: 'https://fy.btlsoln.com:8443/PreSettlement',
|
||||
method: "POST",
|
||||
data: a,
|
||||
header: {
|
||||
'content-type': 'application/json'
|
||||
},
|
||||
success: (res) => {
|
||||
this.globalData.show = false
|
||||
if (res.data.errCode == 0) {
|
||||
this.globalData.hosp_out_trade_no = res.data.data.hosp_out_trade_no
|
||||
let lists = JSON.stringify(res.data.data)
|
||||
let paramsDatas = JSON.stringify(item)
|
||||
wx.navigateTo({
|
||||
url: '/pages/yib/yib?obj=' + paramsDatas + "&radioValue=" + this.globalData.radioVal + "&list=" + lists
|
||||
})
|
||||
this.globalData.areadly = true
|
||||
} else {
|
||||
wx.showModal({
|
||||
content: res.data.errMsg,
|
||||
showCancel: false,
|
||||
confirmText: '确定',
|
||||
confirmColor: '#3CC51F',
|
||||
success(res) {
|
||||
if (res.confirm) {
|
||||
console.log('用户点击确定')
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
}
|
||||
}
|
||||
})
|
||||
|
||||
},
|
||||
|
||||
|
||||
onShow: function (options) {
|
||||
this.globalData.scene = options.scene;
|
||||
if (this.globalData.scene === 1038) {
|
||||
if (options.path == 'pages/topay/topay') {
|
||||
this.globalData.authCode = options.referrerInfo.extraData.authCode;
|
||||
this.getAuthNo(this.globalData.openId, this.globalData.authCode)
|
||||
} else if (options.path == 'pages/yib/yib' && this.globalData.radioVal == 0) {
|
||||
wx.navigateTo({
|
||||
url: '/pages/newChatDetail/newChatDetail?hosp_out_trade_no=' + this.globalData.hosp_out_trade_no,
|
||||
})
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
})
|
||||
Reference in New Issue
Block a user