| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051 |
- import I18nBehavior from "../../../../i18n/behavior";
- import { getOfflineTreatmentListMethod } from "../../request";
- Page({
- behaviors: [I18nBehavior],
- data: {
- i18n: {
- offlineTreatment: { title: '线下', ing: '进行中', finish: '完成' },
- },
- currentTab: "",
- treatmentList: [],
- isLoading: false,
- },
- onLoad() {
- this.getOfflineTreatmentList("");
- },
- // 跳转到核销记录
- onRecord(e: any) {
- const id = e.currentTarget.dataset.id;
- if (id) {
- wx.navigateTo({
- url: `/module/care/pages/care/verifyRecord?id=${id}`,
- });
- }
- },
- 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 });
- }
- },
- });
|