|
@@ -6,129 +6,137 @@ import history from "../../utils/history";
|
|
|
import doLogin from "../../utils/doLogin";
|
|
|
const app = getApp();
|
|
|
const qrImage =
|
|
|
- "https://gw.alipayobjects.com/mdn/rms_373ab8/afts/img/A*z8duR6vAPp0AAAAAAAAAAAAAARQnAQ";
|
|
|
+ "https://gw.alipayobjects.com/mdn/rms_373ab8/afts/img/A*z8duR6vAPp0AAAAAAAAAAAAAARQnAQ";
|
|
|
const addIcon =
|
|
|
- "https://gw.alipayobjects.com/mdn/rms_373ab8/afts/img/A*dqcsTZEuGTgAAAAAAAAAAAAAARQnAQ";
|
|
|
+ "https://gw.alipayobjects.com/mdn/rms_373ab8/afts/img/A*dqcsTZEuGTgAAAAAAAAAAAAAARQnAQ";
|
|
|
Component(
|
|
|
- createSubscribe({
|
|
|
- onShow() {
|
|
|
- const { isLogin } = this.data;
|
|
|
- if (isLogin) this.fetchCardInfo();
|
|
|
- },
|
|
|
- })(
|
|
|
- connect({
|
|
|
- mapStateToProps: {
|
|
|
- scopes: ({ $global }) => $global.scopes,
|
|
|
- userInfo: ({ $global }) => $global.userInfo || {},
|
|
|
- isLogin: ({ $global }) => $global.userInfo.isLogin,
|
|
|
- },
|
|
|
- })({
|
|
|
- props: {
|
|
|
- componentData: {},
|
|
|
- },
|
|
|
- data: {
|
|
|
- addIcon,
|
|
|
- qrImage,
|
|
|
- cardInfo: null,
|
|
|
- showPatient: false,
|
|
|
- imgSrcPrefix: app.globalData.imgSrcPrefix,
|
|
|
- },
|
|
|
+ createSubscribe({
|
|
|
+ onShow() {
|
|
|
+ const { isLogin } = this.data;
|
|
|
+ if (isLogin) this.fetchCardInfo();
|
|
|
+ },
|
|
|
+ })(
|
|
|
+ connect({
|
|
|
+ mapStateToProps: {
|
|
|
+ scopes: ({ $global }) => $global.scopes,
|
|
|
+ userInfo: ({ $global }) => $global.userInfo || {},
|
|
|
+ isLogin: ({ $global }) => $global.userInfo.isLogin,
|
|
|
+ },
|
|
|
+ })({
|
|
|
+ props: {
|
|
|
+ componentData: {},
|
|
|
+ },
|
|
|
+ data: {
|
|
|
+ addIcon,
|
|
|
+ qrImage,
|
|
|
+ cardInfo: null,
|
|
|
+ showPatient: false,
|
|
|
+ imgSrcPrefix: app.globalData.imgSrcPrefix,
|
|
|
+ },
|
|
|
|
|
|
- async didUpdate(_, preState) {
|
|
|
- const { isLogin = false } = preState;
|
|
|
- const { isLogin: curLogin } = this.data;
|
|
|
+ async didUpdate(_, preState) {
|
|
|
+ const { isLogin = false } = preState;
|
|
|
+ const { isLogin: curLogin } = this.data;
|
|
|
|
|
|
- if (isLogin !== curLogin && curLogin) {
|
|
|
- await this.fetchCardInfo();
|
|
|
- }
|
|
|
- },
|
|
|
+ if (isLogin !== curLogin && curLogin) {
|
|
|
+ await this.fetchCardInfo();
|
|
|
+ }
|
|
|
+ },
|
|
|
|
|
|
- methods: {
|
|
|
- async fetchCardInfo() {
|
|
|
- const info = await getMyCardInfo();
|
|
|
- this.setData({
|
|
|
- cardInfo: info,
|
|
|
- });
|
|
|
- },
|
|
|
+ methods: {
|
|
|
+ async fetchCardInfo() {
|
|
|
+ const info = await getMyCardInfo();
|
|
|
+ this.setData({
|
|
|
+ cardInfo: info,
|
|
|
+ });
|
|
|
+ },
|
|
|
|
|
|
- setQuery(patientId) {
|
|
|
- setPagesQuery({
|
|
|
- currentUserId: patientId,
|
|
|
- });
|
|
|
- },
|
|
|
+ onHandleYb2() {
|
|
|
+ history.push({
|
|
|
+ title: "确认支付",
|
|
|
+ query: {},
|
|
|
+ pageType: "hospital-payment-detail-yibao",
|
|
|
+ });
|
|
|
+ },
|
|
|
|
|
|
- /**
|
|
|
- * 去登陆
|
|
|
- */
|
|
|
- async onLogin() {
|
|
|
- await doLogin.call(this, {
|
|
|
- scopes: "auth_user",
|
|
|
- });
|
|
|
- },
|
|
|
+ setQuery(patientId) {
|
|
|
+ setPagesQuery({
|
|
|
+ currentUserId: patientId,
|
|
|
+ });
|
|
|
+ },
|
|
|
|
|
|
- /**
|
|
|
- * 切换就诊人
|
|
|
- */
|
|
|
- changeBtn() {
|
|
|
- console.log("1111111");
|
|
|
- this.setData({
|
|
|
- showPatient: true,
|
|
|
- });
|
|
|
- },
|
|
|
+ /**
|
|
|
+ * 去登陆
|
|
|
+ */
|
|
|
+ async onLogin() {
|
|
|
+ await doLogin.call(this, {
|
|
|
+ scopes: "auth_user",
|
|
|
+ });
|
|
|
+ },
|
|
|
|
|
|
- onClose() {
|
|
|
- this.setData({
|
|
|
- showPatient: false,
|
|
|
- });
|
|
|
- },
|
|
|
+ /**
|
|
|
+ * 切换就诊人
|
|
|
+ */
|
|
|
+ changeBtn() {
|
|
|
+ console.log("1111111");
|
|
|
+ this.setData({
|
|
|
+ showPatient: true,
|
|
|
+ });
|
|
|
+ },
|
|
|
|
|
|
- onChange(item) {
|
|
|
- const { cardInfo } = this.data;
|
|
|
- const { id: patientId, bindCardNum: cardNum, hisPatientId } = item;
|
|
|
- this.setData({
|
|
|
- showPatient: false,
|
|
|
- cardInfo: { ...cardInfo, cardNum, patientId, hisPatientId },
|
|
|
- });
|
|
|
- my.showToast({
|
|
|
- duration: 1500,
|
|
|
- content: "就诊人切换成功",
|
|
|
- });
|
|
|
- },
|
|
|
+ onClose() {
|
|
|
+ this.setData({
|
|
|
+ showPatient: false,
|
|
|
+ });
|
|
|
+ },
|
|
|
|
|
|
- toPatientDetail() {
|
|
|
- const { patientId } = this.data.cardInfo;
|
|
|
- history.push({
|
|
|
- title: "就诊人详情",
|
|
|
- query: {
|
|
|
- id: patientId,
|
|
|
- },
|
|
|
- pageType: "patient-detail",
|
|
|
- });
|
|
|
- },
|
|
|
+ onChange(item) {
|
|
|
+ const { cardInfo } = this.data;
|
|
|
+ const { id: patientId, bindCardNum: cardNum, hisPatientId } = item;
|
|
|
+ this.setData({
|
|
|
+ showPatient: false,
|
|
|
+ cardInfo: { ...cardInfo, cardNum, patientId, hisPatientId },
|
|
|
+ });
|
|
|
+ my.showToast({
|
|
|
+ duration: 1500,
|
|
|
+ content: "就诊人切换成功",
|
|
|
+ });
|
|
|
+ },
|
|
|
|
|
|
- toAddCard() {
|
|
|
- const { userInfo } = this.data;
|
|
|
- const { gender } = userInfo || {};
|
|
|
- const editForm = {
|
|
|
- // idCardNo,
|
|
|
- // name: fullName,
|
|
|
- defaultCard: "是",
|
|
|
- // phoneNumber: phone,
|
|
|
- // relationShip: "本人",
|
|
|
- sex: gender === "m" ? "男" : "女",
|
|
|
- };
|
|
|
- history.push({
|
|
|
- title: "添加就诊人",
|
|
|
- pageType: "edit-patient",
|
|
|
- query: {
|
|
|
- // editType: "card",
|
|
|
- },
|
|
|
- componentData: {
|
|
|
- editForm,
|
|
|
- },
|
|
|
- });
|
|
|
- },
|
|
|
- },
|
|
|
- })
|
|
|
- )
|
|
|
+ toPatientDetail() {
|
|
|
+ const { patientId } = this.data.cardInfo;
|
|
|
+ history.push({
|
|
|
+ title: "就诊人详情",
|
|
|
+ query: {
|
|
|
+ id: patientId,
|
|
|
+ },
|
|
|
+ pageType: "patient-detail",
|
|
|
+ });
|
|
|
+ },
|
|
|
+
|
|
|
+ toAddCard() {
|
|
|
+ const { userInfo } = this.data;
|
|
|
+ const { gender } = userInfo || {};
|
|
|
+ const editForm = {
|
|
|
+ // idCardNo,
|
|
|
+ // name: fullName,
|
|
|
+ defaultCard: "是",
|
|
|
+ // phoneNumber: phone,
|
|
|
+ // relationShip: "本人",
|
|
|
+ sex: gender === "m" ? "男" : "女",
|
|
|
+ };
|
|
|
+ history.push({
|
|
|
+ title: "添加就诊人",
|
|
|
+ pageType: "edit-patient",
|
|
|
+ query: {
|
|
|
+ // editType: "card",
|
|
|
+ },
|
|
|
+ componentData: {
|
|
|
+ editForm,
|
|
|
+ },
|
|
|
+ });
|
|
|
+ },
|
|
|
+ },
|
|
|
+ })
|
|
|
+ )
|
|
|
);
|