// module/health/components/field-ruler/field-ruler.ts
import I18nBehavior from "../../../../i18n/behavior";
import {  getCareRecordMethod } from "../../request";
Component({
  behaviors: ["wx://form-field-group", I18nBehavior],
  lifetimes: {
    attached() {
      this.getCareRecordList();
    },
  },
   /**
   * 组件的初始数据
   */
   data: {
    i18n: { health: { condition: '方案' } },
    loading: false,
    careRecordList: [],
  },
  methods: {
  // 获取调养记录列表
  async getCareRecordList(e: any) {
    const data = await getCareRecordMethod();  
    if(data  && data.length > 0) {
      this.setData({
        careRecordList: data,
      });
    } else {
      this.setData({
        careRecordList: [],
      });
    }
    // console.log(this.data.careRecordList,'调理中的调养记录列表11');
    },
    // 跳转调养方案详情
    goDetail(e: any) {
      const id = e.currentTarget.dataset.id;
      if(id) {
        wx.navigateTo({
          url: `/module/care/pages/careDetail/careDetail?id=${id}`,
        });
      }
  },
  },
  properties: {},
  observers: {},
 
});
