Browse Source

Merge branch 'dev' of http://gogs.ywtinfo.com/chenjunkun/th_net_hospital_ali_mp into dev

liweimin 2 years ago
parent
commit
4f61f67109

+ 2 - 0
antbuilder/industry/hospitalV2/components/deposit-list/index.axml

@@ -5,6 +5,8 @@
     showInpatient="{{ showInpatient }}"
     defaultName="{{ defaultName }}"
     defaultLabel="{{ defaultLabel }}"
+    showTimeSelector="{{ showTimeSelector }}"
+    showAll="{{ showAll }}"
   />
   <view class="container">
     <view class="subscribe-container" data-item="{{ item }}" a:for="{{hospitalList}}" a:key="index">

+ 132 - 127
antbuilder/industry/hospitalV2/components/deposit-list/index.js

@@ -1,138 +1,143 @@
-import { getHospitalRecordList, getCashPledgeList } from './service';
-import history from '../../utils/history';
-import day from 'dayjs';
+import { getHospitalRecordList, getCashPledgeList } from "./service";
+import history from "../../utils/history";
+import day from "dayjs";
 Component({
-  data: {
-    typeOptions: [],
-    // 住院人的选项
-    requestDetail: {
-      // 请求参数
-      startDate: '',
-      endDate: '',
-      inpatientId: '' // 住院人Id
-      // pageNum: 1,
-      // pageSize: 10
+	data: {
+		typeOptions: [],
+		// 住院人的选项
+		requestDetail: {
+			// 请求参数
+			startDate: "",
+			endDate: "",
+			inpatientId: "", // 住院人Id
+			// pageNum: 1,
+			// pageSize: 10
+		},
+		showTimeSelector: false,
+		showAll: false,
+		hospitalList: [],
+		// 缴纳记录列表
+		showInpatient: false,
+		showScroll: true,
+		// 是否还进行触底请求
+		defaultName: "全部住院人",
+		defaultLabel: "全部住院人",
+	},
 
-    },
-    hospitalList: [],
-    // 缴纳记录列表
-    showInpatient: false,
-    showScroll: true,
-    // 是否还进行触底请求
-    defaultName: '全部住院人',
-    defaultLabel: '全部住院人'
-  },
+	async didMount() {
+		await this.getHospitalRecordLists();
+		this.getCashPledgeListRe();
+	},
 
-  didMount() {
-    this.getCashPledgeListRe();
-    this.getHospitalRecordLists();
-  },
+	methods: {
+		getMonth(params) {
+			return day(params).get("month");
+		},
 
-  methods: {
-    getMonth(params) {
-      return day(params).get('month');
-    },
+		getYears(params) {
+			return day(params).get("year");
+		},
 
-    getYears(params) {
-      return day(params).get('year');
-    },
+		goToDetail(e) {
+			const { depositId } = e.target.dataset.item;
+			const { requestDetail } = this.data;
+			history.push({
+				query: {
+					depositId,
+					inpatientId: requestDetail.requestDetail,
+				},
+				title: "押金缴纳详情",
+				pageType: "pay-result",
+			});
+		},
 
-    goToDetail(e) {
-      const {
-        depositId
-      } = e.target.dataset.item;
-      history.push({
-        query: {
-          depositId
-        },
-        title: '押金缴纳详情',
-        pageType: 'pay-result'
-      });
-    },
+		// 获取住院人列表
+		async getHospitalRecordLists() {
+			try {
+				const recordList = await getHospitalRecordList();
+				const typeOptions = recordList.map((item) => ({
+					value: item.inpatientId,
+					label: item.inpatientName,
+				}));
+				this.setData({
+					typeOptions,
+					defaultName:
+						typeOptions && typeOptions.length > 0
+							? typeOptions[0].label
+							: "全部住院人",
+					defaultLabel:
+						typeOptions && typeOptions.length > 0
+							? typeOptions[0].label
+							: "全部住院人",
+					requestDetail: {
+						inpatientId: typeOptions[0].value,
+					},
+				});
+			} catch (error) {
+				console.log(error, "error");
+			}
+		},
 
-    // 获取住院人列表
-    async getHospitalRecordLists() {
-      try {
-        const recordList = await getHospitalRecordList();
-        const typeOptions = recordList.map(item => ({
-          value: item.inpatientId,
-          label: item.inpatientName
-        }));
-        this.setData({
-          typeOptions
-        });
-      } catch (error) {
-        console.log(error, 'error');
-      }
-    },
+		// 获取缴纳费用列表
+		async getCashPledgeListRe() {
+			try {
+				const { requestDetail } = this.data;
+				const hospitalList = await getCashPledgeList(requestDetail);
+				const monthArray = {};
+				hospitalList.forEach((item) => {
+					const year = this.getYears(item.payTime);
+					const month = this.getMonth(item.payTime) + 1;
+					const currentYear = day().get("year");
 
-    // 获取缴纳费用列表
-    async getCashPledgeListRe() {
-      try {
-        const {
-          requestDetail
-        } = this.data;
-        const hospitalList = await getCashPledgeList(requestDetail);
-        const monthArray = {};
-        hospitalList.forEach(item => {
-          const year = this.getYears(item.payTime);
-          const month = this.getMonth(item.payTime) + 1;
-          const currentYear = day().get('year');
+					if (currentYear === year) {
+						item.month = `${month}月`;
+					} else {
+						item.month = `${year}年${month}月`;
+					}
 
-          if (currentYear === year) {
-            item.month = `${month}月`;
-          } else {
-            item.month = `${year}年${month}月`;
-          }
+					if (!monthArray[item.month]) {
+						monthArray[item.month] = [];
+						monthArray[item.month].push(item);
+					} else {
+						monthArray[item.month].push(item);
+					}
+				});
+				const hospitalListDetail = [];
+				Object.keys(monthArray).forEach((res) => {
+					hospitalListDetail.push({
+						month: res,
+						value: monthArray[res],
+					});
+				});
 
-          if (!monthArray[item.month]) {
-            monthArray[item.month] = [];
-            monthArray[item.month].push(item);
-          } else {
-            monthArray[item.month].push(item);
-          }
-        });
-        const hospitalListDetail = [];
-        Object.keys(monthArray).forEach(res => {
-          hospitalListDetail.push({
-            month: res,
-            value: monthArray[res]
-          });
-        });
+				if (hospitalListDetail && hospitalListDetail.length > 0) {
+					this.setData({
+						hospitalList: hospitalListDetail,
+					});
+				} else {
+					this.setData({
+						hospitalList: [],
+						showScroll: false,
+					});
+				}
+			} catch (error) {
+				console.log(error, "error");
+			}
+		},
 
-        if (hospitalListDetail && hospitalListDetail.length > 0) {
-          this.setData({
-            hospitalList: hospitalListDetail
-          });
-        } else {
-          this.setData({
-            showScroll: false
-          });
-        }
-      } catch (error) {
-        console.log(error, 'error');
-      }
-    },
-
-    // 选择不同住院人,或者时间改变时候重新请求列表
-    onFilterHandel(filters) {
-      const {
-        requestDetail
-      } = this.data;
-      const {
-        startTime,
-        endTime,
-        type
-      } = filters;
-      this.setData({
-        requestDetail: { ...requestDetail,
-          startTime,
-          endTime,
-          inpatientId: type
-        }
-      });
-      this.getCashPledgeListRe();
-    }
-
-  }
-});
+		// 选择不同住院人,或者时间改变时候重新请求列表
+		onFilterHandel(filters) {
+			const { requestDetail } = this.data;
+			const { startTime, endTime, type } = filters;
+			this.setData({
+				requestDetail: {
+					...requestDetail,
+					startTime,
+					endTime,
+					inpatientId: type,
+				},
+			});
+			this.getCashPledgeListRe();
+		},
+	},
+});

+ 1 - 2
antbuilder/industry/hospitalV2/components/deposit/index.js

@@ -211,7 +211,7 @@ Component({
 					// 模板id列表,最多3个
 					entityIds: [subscribeID],
 
-					callback() {
+					complete() {
 						that.setTrade();
 						resolve(true);
 					},
@@ -232,7 +232,6 @@ Component({
 		// 支付弹窗
 		async setTrade() {
 			const { money, inpatientId } = this.data;
-
 			try {
 				if (money) {
 					const {

+ 73 - 75
antbuilder/industry/hospitalV2/components/pay-result/index.js

@@ -1,85 +1,83 @@
-import { getDepositDetails, getsubscribeID } from './service';
-import { reportApi } from '../../utils/cloudMonitorHelper';
+import { getDepositDetails, getsubscribeID } from "./service";
+import { reportApi } from "../../utils/cloudMonitorHelper";
 Component({
-  data: {
-    showSubscrible: true,
-    // 是否显示订阅部分
-    detail: null,
-    // 缴纳详情
-    isReady: false
-  },
+	data: {
+		showSubscrible: true,
+		// 是否显示订阅部分
+		detail: null,
+		// 缴纳详情
+		isReady: false,
+	},
 
-  didMount() {
-    const {
-      depositId
-    } = this.$page.data.query || {};
-    this.getDepositDetailsFn(depositId);
-    this.subscribeMsg();
-    /* 服务办结,押金缴纳完成 */
+	didMount() {
+		const { depositId, inpatientId } = this.$page.data.query || {};
+		this.getDepositDetailsFn(depositId, inpatientId);
+		// this.subscribeMsg();
+		/* 服务办结,押金缴纳完成 */
 
-    reportApi('押金缴纳完成');
-  },
+		reportApi("押金缴纳完成");
+	},
 
-  methods: {
-    subscribeMsg() {
-      const pluginId = 2021001155639035;
-      my.loadPlugin({
-        plugin: `${pluginId}@*`,
-        success: () => {
-          this.setData({
-            isReady: true
-          }); // 储存插件实列
-          // eslint-disable-next-line no-undef
+	methods: {
+		subscribeMsg() {
+			const pluginId = 2021001155639035;
+			my.loadPlugin({
+				plugin: `${pluginId}@*`,
+				success: () => {
+					this.setData({
+						isReady: true,
+					}); // 储存插件实列
+					// eslint-disable-next-line no-undef
 
-          const pluginInstance = requirePlugin(`dynamic-plugin://${pluginId}`);
-          this.requestSubscribeMessage = pluginInstance.requestSubscribeMessage;
-        }
-      });
-    },
+					const pluginInstance = requirePlugin(`dynamic-plugin://${pluginId}`);
+					this.requestSubscribeMessage = pluginInstance.requestSubscribeMessage;
+				},
+			});
+		},
 
-    showSubscrible() {
-      this.setData({
-        showSubscrible: false
-      });
-    },
+		showSubscrible() {
+			this.setData({
+				showSubscrible: false,
+			});
+		},
 
-    // 订阅插件要用时,请放开注释
-    requestSubscribeMessageFn(subscribeID) {
-      return new Promise(resolve => {
-        this.requestSubscribeMessage({
-          // 模板id列表,最多3个
-          entityIds: [subscribeID],
+		// 订阅插件要用时,请放开注释
+		requestSubscribeMessageFn(subscribeID) {
+			return new Promise((resolve) => {
+				my.requestSubscribeMessage({
+					// 模板id列表,最多3个
+					entityIds: [subscribeID],
 
-          callback() {
-            resolve(true);
-          }
+					callback() {
+						resolve(true);
+					},
+				});
+			});
+		},
 
-        });
-      });
-    },
+		async gotoSubscrible() {
+			try {
+				const subscribeID = await getsubscribeID();
+				await this.requestSubscribeMessageFn(subscribeID.depositTemplateId);
+			} catch (error) {
+				console.log(error, "error");
+			}
+		},
 
-    async gotoSubscrible() {
-      try {
-        const subscribeID = await getsubscribeID();
-        await this.requestSubscribeMessageFn(subscribeID.depositTemplateId);
-      } catch (error) {
-        console.log(error, 'error');
-      }
-    },
-
-    // 获取支付详情
-    async getDepositDetailsFn(depositId) {
-      try {
-        const detail = await getDepositDetails({
-          depositId
-        });
-        this.setData({
-          detail
-        });
-      } catch (error) {
-        console.log(error, 'error');
-      }
-    }
-
-  }
-});
+		// 获取支付详情
+		async getDepositDetailsFn(depositId, inpatientId) {
+			try {
+				const detail = await getDepositDetails({
+					depositId,
+					hisPatientId: inpatientId,
+					receiptNo: depositId,
+				});
+				this.setData({
+					detail,
+				});
+			} catch (error) {
+				console.log(error, "error");
+			}
+		},
+	},
+});