orderDetail.js 6.8 KB
"use strict";
var common_vendor = require("../../common/vendor.js");
var api_index = require("../../api/index.js");
require("../../utils/request.js");
if (!Array) {
  const _easycom_u_navbar2 = common_vendor.resolveComponent("u-navbar");
  _easycom_u_navbar2();
}
const _easycom_u_navbar = () => "../../uni_modules/uview-plus/components/u-navbar/u-navbar.js";
if (!Math) {
  (_easycom_u_navbar + shopAddres + orderShops + PayMode + tipPops)();
}
const shopAddres = () => "../../componets/address.js";
const orderShops = () => "../../componets/orderShop.js";
const tipPops = () => "../../componets/tipPop.js";
const PayMode = () => "../../componets/checkPayMode.js";
const _sfc_main = {
  setup(__props) {
    common_vendor.onLoad((e) => {
      console.log(e.id);
      orderId.value = e.id;
      getOrderdetails(e.id);
    });
    let tipShow = common_vendor.ref(false);
    let orderList = common_vendor.ref({});
    let modeShow = common_vendor.ref(false);
    let orderId = common_vendor.ref("");
    let btnType = common_vendor.ref(1);
    let integral = common_vendor.ref(0);
    let tipType = common_vendor.ref(1);
    let placeOrder = common_vendor.ref([
      { id: 1, name: "\u8BA2\u5355\u7F16\u53F7", text: "1212" },
      { id: 2, name: "\u652F\u4ED8\u65B9\u5F0F", text: "1212" },
      { id: 3, name: "\u4E0B\u5355\u65F6\u95F4", text: "1212" },
      { id: 4, name: "\u5FEB\u9012\u7F16\u53F7", text: "1212" }
    ]);
    const leftClickHandler = () => {
      common_vendor.index.navigateBack({ delta: 1 });
    };
    const copy = () => {
      common_vendor.index.setClipboardData({
        data: orderList.value.express_no,
        success: () => {
          common_vendor.index.showToast({ title: "\u590D\u5236\u6210\u529F", icon: "none" });
        }
      });
    };
    const btns = (type) => {
      if (type == 0) {
        tipType.value = btnType.value == 1 ? 1 : 2;
        tipShow.value = true;
      } else {
        btnType.value == 1 ? modeShow.value = true : getReceipts();
      }
    };
    const pointsBtns = (type) => {
      console.log(type);
      tipShow.value = false;
      if (type == 1) {
        tipType.value == 1 ? getCancleOrders() : getRefunds();
      }
    };
    const { proxy } = common_vendor.getCurrentInstance();
    const getOrderdetails = async (id) => {
      try {
        const res = await api_index.getOrderdetail(id);
        orderList.value = res;
        btnType.value = res.order_status;
        placeOrder.value[0].text = res.order_no;
        placeOrder.value[1].text = res.zhifu == 1 ? "\u5FAE\u4FE1" : "\u4F59\u989D";
        placeOrder.value[2].text = res.createtime;
        placeOrder.value[3].text = res.express_no;
        console.log("getOrderdetail", res);
      } catch (err) {
        common_vendor.index.showToast({ title: err, icon: "none" });
        console.log("getOrderdetail", err);
      }
    };
    const getCancleOrders = async () => {
      try {
        const res = await api_index.getCancleOrder(orderId.value);
        proxy.$methods.showTN("\u8BA2\u5355\u5DF2\u53D6\u6D88~");
        console.log("getCancleOrder", res);
      } catch (err) {
        common_vendor.index.showToast({ title: err, icon: "none" });
        console.log("getCancleOrder", err);
      }
    };
    const getRefunds = async () => {
      try {
        const res = await api_index.getRefund(orderId.value);
        proxy.$methods.showTN("\u5DF2\u7533\u8BF7,\u7B49\u5F85\u5BA2\u670D\u5BA1\u6838");
        console.log("getRefund", res);
      } catch (err) {
        common_vendor.index.showToast({ title: err, icon: "none" });
        console.log("getRefund", err);
      }
    };
    const getReceipts = async () => {
      try {
        const res = await api_index.getReceipt(orderId.value);
        proxy.$methods.showTN("\u5DF2\u6536\u8D27,\u671F\u5F85\u4E0B\u6B21\u4E0B\u5355~");
        console.log("getReceipt", res);
      } catch (err) {
        common_vendor.index.showToast({ title: err, icon: "none" });
        console.log("getReceipt", err);
      }
    };
    return (_ctx, _cache) => {
      return common_vendor.e({
        a: common_vendor.o(leftClickHandler),
        b: common_vendor.p({
          bgColor: "transparent",
          placeholder: true
        }),
        c: common_vendor.p({
          isOrder: true,
          adress: common_vendor.unref(orderList)
        }),
        d: common_vendor.p({
          shop: common_vendor.unref(orderList)
        }),
        e: common_vendor.unref(orderList).goodstatus_text !== 3
      }, common_vendor.unref(orderList).goodstatus_text !== 3 ? {
        f: common_vendor.t(common_vendor.unref(orderList).total_price)
      } : {}, {
        g: common_vendor.unref(orderList).goodstatus_text === 3
      }, common_vendor.unref(orderList).goodstatus_text === 3 ? {
        h: common_vendor.t(common_vendor.unref(orderList).express_price),
        i: common_vendor.t(common_vendor.unref(orderList).score),
        j: common_vendor.t(common_vendor.unref(orderList).express_price)
      } : {}, {
        k: common_vendor.f(common_vendor.unref(placeOrder), (item, index, i0) => {
          return common_vendor.e({
            a: common_vendor.t(item.name),
            b: common_vendor.t(item.text),
            c: index == 0
          }, index == 0 ? {
            d: common_vendor.o(copy)
          } : {}, {
            e: item.id
          });
        }),
        l: common_vendor.unref(btnType) == 3
      }, common_vendor.unref(btnType) == 3 ? {} : {}, {
        m: common_vendor.unref(btnType) <= 2
      }, common_vendor.unref(btnType) <= 2 ? {
        n: common_vendor.t(common_vendor.unref(btnType) == 1 ? "\u53D6\u6D88\u4ED8\u6B3E" : common_vendor.unref(btnType) == 2 ? "\u7533\u8BF7\u9000\u6B3E" : "\u8054\u7CFB\u5BA2\u670D"),
        o: common_vendor.o(($event) => btns(0))
      } : {}, {
        p: common_vendor.unref(btnType) == 1 || common_vendor.unref(btnType) == 3
      }, common_vendor.unref(btnType) == 1 || common_vendor.unref(btnType) == 3 ? {
        q: common_vendor.t(common_vendor.unref(btnType) == 1 ? "\u7ACB\u5373\u652F\u4ED8" : "\u786E\u8BA4\u6536\u8D27"),
        r: common_vendor.o(($event) => btns(1))
      } : {}, {
        s: common_vendor.o(($event) => common_vendor.isRef(modeShow) ? modeShow.value = false : modeShow = false),
        t: common_vendor.p({
          orderId: common_vendor.unref(orderId),
          isOrderPay: true,
          totalPrice: common_vendor.unref(orderList).total_price,
          modeShow: common_vendor.unref(modeShow)
        }),
        v: common_vendor.o(pointsBtns),
        w: common_vendor.p({
          integral: common_vendor.unref(integral),
          tipType: common_vendor.unref(tipType),
          tipShow: common_vendor.unref(tipShow)
        })
      });
    };
  }
};
var MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__file", "D:/vue/\u5927\u5065\u5EB7\u5546\u57CE/healthMall/pages/mine/orderDetail.vue"]]);
wx.createPage(MiniProgramPage);