"use strict";
const common_vendor = require("../../common/vendor.js");
const api_index = require("../../api/index.js");
const utils_fun = require("../../utils/fun.js");
if (!Array) {
  const _easycom_wd_navbar2 = common_vendor.resolveComponent("wd-navbar");
  const _easycom_z_paging2 = common_vendor.resolveComponent("z-paging");
  (_easycom_wd_navbar2 + _easycom_z_paging2)();
}
const _easycom_wd_navbar = () => "../../uni_modules/wot-design-uni/components/wd-navbar/wd-navbar.js";
const _easycom_z_paging = () => "../../uni_modules/z-paging/components/z-paging/z-paging.js";
if (!Math) {
  (_easycom_wd_navbar + _easycom_z_paging)();
}
const _sfc_main = /* @__PURE__ */ common_vendor.defineComponent({
  __name: "order",
  setup(__props) {
    const paging = common_vendor.ref(null);
    const dataList = common_vendor.ref([]);
    const queryFrom = common_vendor.ref({
      orderType: 1,
      payStatus: "",
      orderStatus: ""
    });
    const changeStatus = (e) => {
      queryFrom.value.orderStatus = e;
      paging.value.reload();
    };
    const queryList = (pageNo, pageSize) => {
      api_index.api.orderPage({ pageNo, pageSize, ...queryFrom.value }).then((res) => {
        paging.value.complete(res.list);
      }).catch((res) => {
        paging.value.complete(false);
      });
    };
    const toGoods = (e) => {
      common_vendor.index.navigateTo({
        url: "/pages/goods/goods?id=" + e
      });
    };
    return (_ctx, _cache) => {
      return {
        a: common_vendor.p({
          title: "订单",
          safeAreaInsetTop: true
        }),
        b: common_vendor.n(queryFrom.value.orderStatus === "" ? "active" : ""),
        c: common_vendor.o(($event) => changeStatus("")),
        d: common_vendor.n(queryFrom.value.orderStatus === 0 ? "active" : ""),
        e: common_vendor.o(($event) => changeStatus(0)),
        f: common_vendor.n(queryFrom.value.orderStatus == 1 ? "active" : ""),
        g: common_vendor.o(($event) => changeStatus(1)),
        h: common_vendor.n(queryFrom.value.orderStatus == 2 ? "active" : ""),
        i: common_vendor.o(($event) => changeStatus(2)),
        j: common_vendor.f(dataList.value, (item, index, i0) => {
          return common_vendor.e({
            a: common_vendor.t(item.orderNo),
            b: item.orderStatus === 0
          }, item.orderStatus === 0 ? {} : {}, {
            c: item.orderStatus == 1
          }, item.orderStatus == 1 ? {} : {}, {
            d: item.goods.cover,
            e: common_vendor.t(item.goods.name),
            f: common_vendor.t(item.goods.specs),
            g: common_vendor.t(item.goodsNum),
            h: item.deductionAmount
          }, item.deductionAmount ? {
            i: common_vendor.t(item.deductionAmount)
          } : {}, {
            j: common_vendor.t(item.payableAmount),
            k: common_vendor.t(common_vendor.unref(utils_fun.timeFormat)(item.createTime, "yyyy-MM-dd hh:mm:ss")),
            l: item.orderStatus == 1
          }, item.orderStatus == 1 ? {
            m: common_vendor.o(($event) => toGoods(item.goodsId), index)
          } : {}, {
            n: index
          });
        }),
        k: common_vendor.sr(paging, "93207a4f-0", {
          "k": "paging"
        }),
        l: common_vendor.o(queryList),
        m: common_vendor.o(($event) => dataList.value = $event),
        n: common_vendor.p({
          modelValue: dataList.value
        })
      };
    };
  }
});
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-93207a4f"]]);
wx.createPage(MiniProgramPage);
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/order/order.js.map
