"use strict";
const common_vendor = require("../../../common/vendor.js");
const sheep_index = require("../../../sheep/index.js");
const sheep_api_trade_afterSale = require("../../../sheep/api/trade/afterSale.js");
const sheep_api_trade_delivery = require("../../../sheep/api/trade/delivery.js");
require("../../../sheep/url/index.js");
require("../../../sheep/store/index.js");
require("../../../sheep/store/app.js");
require("../../../sheep/api/promotion/diy.js");
require("../../../sheep/request/index.js");
require("../../../sheep/config/index.js");
require("../../../sheep/platform/index.js");
require("../../../sheep/platform/provider/wechat/index.js");
require("../../../sheep/platform/provider/wechat/miniProgram.js");
require("../../../sheep/api/member/auth.js");
require("../../../sheep/api/member/social.js");
require("../../../sheep/api/member/user.js");
require("../../../sheep/platform/provider/apple/index.js");
require("../../../sheep/platform/share.js");
require("../../../sheep/router/index.js");
require("../../../sheep/hooks/useModal.js");
require("../../../sheep/helper/index.js");
require("../../../sheep/helper/test.js");
require("../../../sheep/helper/digit.js");
require("../../../sheep/helper/throttle.js");
require("../../../sheep/platform/pay.js");
require("../../../sheep/api/pay/order.js");
require("../../../sheep/store/user.js");
require("../../../sheep/store/cart.js");
require("../../../sheep/api/trade/cart.js");
require("../../../sheep/api/pay/wallet.js");
require("../../../sheep/api/trade/order.js");
require("../../../sheep/api/promotion/coupon.js");
require("../../../sheep/store/sys.js");
require("../../../sheep/store/modal.js");
require("../../../sheep/config/zIndex.js");
if (!Array) {
  const _easycom_s_layout2 = common_vendor.resolveComponent("s-layout");
  _easycom_s_layout2();
}
const _easycom_s_layout = () => "../../../sheep/components/s-layout/s-layout.js";
if (!Math) {
  _easycom_s_layout();
}
const _sfc_main = {
  __name: "return-delivery",
  setup(__props) {
    const state = common_vendor.reactive({
      id: 0,
      // 售后编号
      expressIndex: 0,
      // 选中的 expresses 下标
      expresses: []
      // 可选的快递列表
    });
    function bindPickerChange(e) {
      state.expressIndex = e.detail.value;
    }
    async function subRefund(e) {
      let data = {
        id: state.id,
        logisticsId: state.expresses[state.expressIndex].id,
        logisticsNo: e.detail.value.logisticsNo
      };
      const { code } = await sheep_api_trade_afterSale.AfterSaleApi.deliveryAfterSale(data);
      if (code !== 0) {
        return;
      }
      common_vendor.index.showToast({
        title: "填写退货成功"
      });
      sheep_index.sheep.$router.go("/pages/order/aftersale/detail", { id: state.id });
    }
    async function getExpressList() {
      const { code, data } = await sheep_api_trade_delivery.DeliveryApi.getDeliveryExpressList();
      if (code !== 0) {
        return;
      }
      state.expresses = data;
    }
    common_vendor.onLoad((options) => {
      if (!options.id) {
        sheep_index.sheep.$helper.toast(`缺少订单信息，请检查`);
        return;
      }
      state.id = options.id;
      getExpressList();
    });
    return (_ctx, _cache) => {
      return {
        a: common_vendor.t(state.expresses[state.expressIndex].name),
        b: common_vendor.o(bindPickerChange),
        c: state.expressIndex,
        d: state.expresses,
        e: common_vendor.o(subRefund),
        f: common_vendor.p({
          title: "退货物流"
        })
      };
    };
  }
};
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-e2252b3c"], ["__file", "/Users/RuHu.Xu/Desktop/mall-newfeifan-zx-app/pages/order/aftersale/return-delivery.vue"]]);
wx.createPage(MiniProgramPage);
