init version kelfy-mini for new gitea
This commit is contained in:
511
pages/userMsgDel/userMsgDel.js
Normal file
511
pages/userMsgDel/userMsgDel.js
Normal file
@@ -0,0 +1,511 @@
|
||||
// pages/userMsgDel/userMsgDel.js
|
||||
var app = getApp()
|
||||
Page({
|
||||
|
||||
/**
|
||||
* 页面的初始数据
|
||||
*/
|
||||
data: {
|
||||
showPrivacy: true,
|
||||
show: false,
|
||||
show2: false,
|
||||
show3: false,
|
||||
relate: [{
|
||||
name: '本人',
|
||||
relate: '0'
|
||||
},
|
||||
{
|
||||
name: '子女',
|
||||
relate: '1'
|
||||
},
|
||||
{
|
||||
name: '夫妻',
|
||||
relate: '2'
|
||||
},
|
||||
{
|
||||
name: '父母',
|
||||
relate: '3'
|
||||
},
|
||||
{
|
||||
name: '朋友',
|
||||
relate: '4'
|
||||
},
|
||||
],
|
||||
cardType: [
|
||||
// { name: '病历卡', value: 0 },
|
||||
{
|
||||
name: '就诊卡',
|
||||
value: 1,
|
||||
msg: "请输入就诊卡号"
|
||||
},
|
||||
// { name: '保障卡', value: 3 },
|
||||
{
|
||||
name: '社保卡',
|
||||
value: 1,
|
||||
msg: '请输入社保卡号'
|
||||
},
|
||||
{
|
||||
name: '身份证(电子健康卡)',
|
||||
value: 3,
|
||||
msg: '请输入身份证号码'
|
||||
},
|
||||
],
|
||||
sfzList: [],
|
||||
msg: "请输入号码",
|
||||
relateNmae: '', //关系名
|
||||
relateId: '', //关系值
|
||||
trueName: '', //姓名
|
||||
idCard: '', //身份证
|
||||
carNum: '', //就诊卡
|
||||
title: '', //标题
|
||||
cardT: '', //证件类型
|
||||
state: '', //新增编辑状态
|
||||
type: '', //是否默认
|
||||
checked: '', //默认按钮选中状态
|
||||
disabled: '',
|
||||
zjh: '' //证件号
|
||||
},
|
||||
// adds(){
|
||||
// this.setData({
|
||||
// trueName:this.data.trueName+'.'
|
||||
// })
|
||||
// },
|
||||
showPop() {
|
||||
this.setData({
|
||||
show: true
|
||||
});
|
||||
},
|
||||
showPop2() {
|
||||
this.setData({
|
||||
show2: true
|
||||
});
|
||||
},
|
||||
showPop3() {
|
||||
this.setData({
|
||||
show3: true
|
||||
});
|
||||
},
|
||||
onClose() {
|
||||
this.setData({
|
||||
show: false,
|
||||
});
|
||||
},
|
||||
onClose2() {
|
||||
this.setData({
|
||||
show2: false,
|
||||
});
|
||||
},
|
||||
onClose3() {
|
||||
this.setData({
|
||||
show3: false,
|
||||
});
|
||||
},
|
||||
confirm(e) {
|
||||
console.log(e.currentTarget.dataset.item)
|
||||
let item = e.currentTarget.dataset.item
|
||||
this.setData({
|
||||
relateNmae: item.name,
|
||||
relateId: item.relate,
|
||||
show: false
|
||||
})
|
||||
},
|
||||
confirm2(e) {
|
||||
console.log(e.currentTarget.dataset.item)
|
||||
let item = e.currentTarget.dataset.item
|
||||
this.setData({
|
||||
show2: false,
|
||||
cardT: item.name,
|
||||
cardV: item.value,
|
||||
msg: item.msg
|
||||
})
|
||||
},
|
||||
confirm3(e) {
|
||||
console.log(e.currentTarget.dataset.item)
|
||||
let item = e.currentTarget.dataset.item
|
||||
let cardNum = item.cardno
|
||||
let cardtype = item.cardtype
|
||||
let relate = this.data.relateId
|
||||
let type = this.data.type
|
||||
let hzxm = this.data.trueName
|
||||
console.log("cardNum is :" + cardNum)
|
||||
this.setData({
|
||||
show3: false
|
||||
})
|
||||
wx.request({
|
||||
url: 'https://fy.btlsoln.com:8443/patientBindWXUser?cardno&cardtype&openid&relate&type&hzxm',
|
||||
method: "GET",
|
||||
data: {
|
||||
cardno: cardNum,
|
||||
cardtype: cardtype,
|
||||
relate: relate,
|
||||
type: type,
|
||||
openid: app.globalData.openId,
|
||||
hzxm: hzxm
|
||||
},
|
||||
header: {
|
||||
'content-type': 'application/json'
|
||||
},
|
||||
success: (res) => {
|
||||
if (res.data.errCode == 0) {
|
||||
wx.showToast({
|
||||
title: '添加成功',
|
||||
icon: 'success'
|
||||
})
|
||||
setTimeout(item => {
|
||||
wx.navigateBack({
|
||||
delta: 1 //返回上一级页面
|
||||
})
|
||||
}, 1000)
|
||||
} else {
|
||||
wx.showToast({
|
||||
title: "用户不存在",
|
||||
icon: 'error'
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
onChange({
|
||||
detail
|
||||
}) {
|
||||
this.setData({
|
||||
checked: detail
|
||||
});
|
||||
},
|
||||
del() {
|
||||
let medical_card = this.data.carNum
|
||||
wx.showModal({
|
||||
title: '',
|
||||
content: '确定删除此就诊人信息吗?',
|
||||
cancelText: "否",
|
||||
confirmText: '是',
|
||||
success: function (res) {
|
||||
if (res.confirm) {
|
||||
wx.request({
|
||||
url: 'https://fy.btlsoln.com:8443/patientUnbindWXUser?medical_card&openid',
|
||||
method: "GET",
|
||||
data: {
|
||||
medical_card: medical_card,
|
||||
openid: app.globalData.openId
|
||||
},
|
||||
header: {
|
||||
'content-type': 'application/json'
|
||||
},
|
||||
success: (res) => {
|
||||
if (res.data.errCode == 0) {
|
||||
wx.showToast({
|
||||
title: '删除成功',
|
||||
icon: 'success',
|
||||
duration: 1000
|
||||
})
|
||||
setTimeout(item => {
|
||||
wx.navigateBack({
|
||||
delta: 1 //返回上一级页面
|
||||
})
|
||||
}, 1000)
|
||||
} else {
|
||||
wx.showToast({
|
||||
title: res.data.errMsg,
|
||||
icon: 'error'
|
||||
})
|
||||
}
|
||||
console.log(res, "删除就诊人")
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
save() {
|
||||
if (this.data.checked == true) {
|
||||
this.setData({
|
||||
type: 0
|
||||
})
|
||||
} else {
|
||||
this.setData({
|
||||
type: 1
|
||||
})
|
||||
}
|
||||
let relate = this.data.relateId
|
||||
let cardType = this.data.cardV
|
||||
let cardNum = this.data.zjh
|
||||
let type = this.data.type
|
||||
let medical_card = this.data.carNum
|
||||
let hzxm = this.data.trueName
|
||||
console.log(hzxm)
|
||||
if (this.data.state == 0) {
|
||||
if (relate == '' || cardNum == '') {
|
||||
wx.showModal({
|
||||
content: '请填写完整信息',
|
||||
showCancel: false,
|
||||
})
|
||||
} else {
|
||||
if (cardType == 3) {
|
||||
wx.request({
|
||||
url: 'https://fy.btlsoln.com:8443/his/getPatient?cardno&cardtype&hzxm',
|
||||
method: "GET",
|
||||
data: {
|
||||
cardno: cardNum,
|
||||
cardtype: cardType,
|
||||
hzxm: hzxm
|
||||
},
|
||||
header: {
|
||||
'content-type': 'application/json'
|
||||
},
|
||||
success: (res) => {
|
||||
if (res.data.errCode == 0) {
|
||||
console.log(res.data, 'lslslslsl')
|
||||
this.setData({
|
||||
sfzList: res.data.list,
|
||||
show3: true,
|
||||
})
|
||||
} else {
|
||||
let title = "卡号不存在";
|
||||
if (res.data.errMsg) {
|
||||
title = res.data.errMsg;
|
||||
}
|
||||
|
||||
wx.showToast({
|
||||
title: title,
|
||||
icon: 'error'
|
||||
})
|
||||
// setTimeout(item => {
|
||||
// wx.navigateTo({
|
||||
// url: '/pages/addUserMessage/addUserMessage',
|
||||
// })
|
||||
// },1000)
|
||||
}
|
||||
}
|
||||
})
|
||||
} else {
|
||||
let that = this;
|
||||
wx.request({
|
||||
url: 'https://fy.btlsoln.com:8443/patientBindWXUser?cardno&cardtype&openid&relate&type&hzxm',
|
||||
method: "GET",
|
||||
data: {
|
||||
cardno: cardNum,
|
||||
cardtype: cardType,
|
||||
relate: relate,
|
||||
type: type,
|
||||
openid: app.globalData.openId,
|
||||
hzxm: hzxm
|
||||
},
|
||||
header: {
|
||||
'content-type': 'application/json'
|
||||
},
|
||||
success: (res) => {
|
||||
if (res.data.errCode == 0) {
|
||||
wx.showToast({
|
||||
title: '添加成功',
|
||||
icon: 'success'
|
||||
})
|
||||
|
||||
if (that.data.checked) {
|
||||
wx.setStorageSync('trueName', that.data.trueName)
|
||||
wx.setStorageSync('sfId1', that.data.idCard)
|
||||
wx.setStorageSync('cardNo', that.data.carNum)
|
||||
}
|
||||
setTimeout(item => {
|
||||
wx.navigateBack({
|
||||
delta: 1 //返回上一级页面
|
||||
})
|
||||
}, 1000)
|
||||
} else {
|
||||
let title = "卡号不存在";
|
||||
if (res.data.errMsg) {
|
||||
title = res.data.errMsg;
|
||||
}
|
||||
|
||||
wx.showToast({
|
||||
title: title,
|
||||
icon: 'error'
|
||||
})
|
||||
// setTimeout(item => {
|
||||
// wx.navigateTo({
|
||||
// url: '/pages/addUserMessage/addUserMessage',
|
||||
// })
|
||||
// },1000)
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
} else {
|
||||
let that = this;
|
||||
wx.showModal({
|
||||
title: '',
|
||||
content: '确定更改此就诊人信息吗?',
|
||||
cancelText: "否",
|
||||
confirmText: '是',
|
||||
success: function (res) {
|
||||
if (res.confirm) {
|
||||
wx.request({
|
||||
url: 'https://fy.btlsoln.com:8443/updatePatient?medical_card&openid&relate=1&type=1',
|
||||
method: "GET",
|
||||
data: {
|
||||
medical_card: medical_card,
|
||||
relate: relate,
|
||||
type: type,
|
||||
openid: app.globalData.openId
|
||||
},
|
||||
header: {
|
||||
'content-type': 'application/json'
|
||||
},
|
||||
success: (res) => {
|
||||
if (res.data.errCode == 0) {
|
||||
wx.showToast({
|
||||
title: '编辑成功',
|
||||
icon: 'success'
|
||||
})
|
||||
if (that.data.checked) {
|
||||
wx.setStorageSync('trueName', that.data.trueName)
|
||||
wx.setStorageSync('sfId1', that.data.idCard)
|
||||
wx.setStorageSync('cardNo', that.data.carNum)
|
||||
}
|
||||
setTimeout(item => {
|
||||
wx.navigateBack({
|
||||
delta: 1 //返回上一级页面
|
||||
})
|
||||
}, 1000)
|
||||
} else {
|
||||
wx.showToast({
|
||||
title: res.data.errMsg,
|
||||
icon: 'error'
|
||||
})
|
||||
}
|
||||
console.log(res, "编辑就诊人")
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
showModal(error) {
|
||||
wx.showModal({
|
||||
content: error.msg,
|
||||
showCancel: false,
|
||||
})
|
||||
},
|
||||
trueName: function (e) {
|
||||
this.setData({
|
||||
trueName: e.detail.value
|
||||
})
|
||||
},
|
||||
change_trueName(e) {
|
||||
let hzxm = e.detail.value.replace(/\./g, '·')
|
||||
hzxm = hzxm.replace(/\。/g, '·')
|
||||
this.setData({
|
||||
trueName: hzxm
|
||||
})
|
||||
},
|
||||
zjh: function (e) {
|
||||
this.setData({
|
||||
zjh: e.detail.value
|
||||
})
|
||||
},
|
||||
/**
|
||||
* 生命周期函数--监听页面加载
|
||||
*/
|
||||
onLoad: function (options) {
|
||||
console.log(options, "编辑")
|
||||
this.setData({
|
||||
state: options.state,
|
||||
relateId: options.relate
|
||||
})
|
||||
if (options.relate == 0) {
|
||||
this.setData({
|
||||
relateNmae: "本人"
|
||||
})
|
||||
} else if (options.relate == 1) {
|
||||
this.setData({
|
||||
relateNmae: "子女"
|
||||
})
|
||||
} else if (options.relate == 2) {
|
||||
this.setData({
|
||||
relateNmae: "夫妻"
|
||||
})
|
||||
} else if (options.relate == 3) {
|
||||
this.setData({
|
||||
relateNmae: "父母"
|
||||
})
|
||||
} else if (options.relate == 4) {
|
||||
this.setData({
|
||||
relateNmae: "朋友"
|
||||
})
|
||||
}
|
||||
if (options.type == 0) {
|
||||
this.setData({
|
||||
checked: true
|
||||
})
|
||||
} else {
|
||||
this.setData({
|
||||
checked: false
|
||||
})
|
||||
}
|
||||
if (options.state == 0) {
|
||||
this.setData({
|
||||
title: "添加就诊人"
|
||||
})
|
||||
} else {
|
||||
this.setData({
|
||||
title: "编辑就诊人",
|
||||
trueName: options.trueName,
|
||||
idCard: options.idCard,
|
||||
carNum: options.carNum,
|
||||
disabled: "disabled"
|
||||
})
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面初次渲染完成
|
||||
*/
|
||||
onReady: function () {
|
||||
wx.setNavigationBarTitle({
|
||||
title: this.data.title
|
||||
})
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面显示
|
||||
*/
|
||||
onShow: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面隐藏
|
||||
*/
|
||||
onHide: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 生命周期函数--监听页面卸载
|
||||
*/
|
||||
onUnload: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面相关事件处理函数--监听用户下拉动作
|
||||
*/
|
||||
onPullDownRefresh: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 页面上拉触底事件的处理函数
|
||||
*/
|
||||
onReachBottom: function () {
|
||||
|
||||
},
|
||||
|
||||
/**
|
||||
* 用户点击右上角分享
|
||||
*/
|
||||
onShareAppMessage: function () {
|
||||
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user