import PageContainerBehavior from "../../../../core/behavior/page-container.behavior";
import tickleBehavior, { getTickleContext } from "../../../../core/behavior/tickle.behavior";
import { getDietMethod } from "../../request";
// module/diet/pages/delivery-address/delivery-address.ts
Page({
  behaviors: [
    PageContainerBehavior,
    tickleBehavior,
  ],
  lifetimes: {
    attached() {
    }
  },
  properties: {
  },
  data: {
    title: '',
    successImg: 'https://wx.hzliuzhi.com:4433/manager/file/statics/2025/07/11/img_success@3x_20250711171518A500.png',
  },
  onLoad(options: any) {
    if (options.title) {
      this.setData({ title: options.title });
    }
  },
    onBackOrderList() {
      // wx.redirectTo({ url: '/module/article/pages/order-list/order-list' });
      // 先到「我的」再自动进订单列表，这样订单列表返回时栈上是「我的」
      wx.setStorageSync("fromSuccessToOrderList", "1");
      wx.redirectTo({ url: "/pages/mine/mine" });
    },
    async load() {
      wx.showLoading({ title: '加载中' });
      try {
        const dataset = await getDietMethod(this.data.id);
        this.setData({ dataset, title: dataset.name });
      } catch (error) {
        getTickleContext.call(this).showWarnMessage(error.errMsg);
      }
      wx.hideLoading();
    },
})