| 12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- import { getOfflineTreatmentListMethod } from "../../request";
- Page({
- data: {
- currentTab: "",
- treatmentList: [],
- isLoading: false,
- },
- onLoad() {
- this.getOfflineTreatmentList("");
- },
- // 跳转到核销记录
- switchVerifyRecode() {
- wx.navigateTo({
- url: "/pages/care/verifyRecode",
- });
- },
- onTabChange(e: any) {
- const progress = e.detail.value;
- this.setData({
- currentTab: progress,
- });
- // 不立即清空数据,避免空状态闪烁
- this.getOfflineTreatmentList(progress);
- },
- // 获取线下非药物治疗记录列表
- async getOfflineTreatmentList(progress: string) {
- // 启用加载态,保留当前列表,避免空态闪烁
- this.setData({ isLoading: true });
- try {
- const res = await getOfflineTreatmentListMethod(progress);
- const list = res && res.data ? res.data : [];
- // 只有在数据加载完成后才更新列表
- this.setData({ treatmentList: list, isLoading: false });
- } catch (error: any) {
- wx.showToast({
- title: error.errMsg || "获取数据失败",
- icon: "none",
- });
- this.setData({ treatmentList: [], isLoading: false });
- }
- },
- });
|