confirmOrder.js 5.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 + payMode + tipPop)();
}
const payMode = () => "../../componets/checkPayMode.js";
const tipPop = () => "../../componets/tipPop.js";
const shopAddres = () => "../../componets/address.js";
const _sfc_main = {
  setup(__props) {
    common_vendor.onLoad((e) => {
      if (e.ids) {
        car_Id.value = e.ids;
        getCarsettlements(e.ids);
      } else {
        shopType.value = e.shopType;
        payParams.value = JSON.parse(e.params);
        getbBuyDatas(JSON.parse(e.params));
        console.log(e.params, "\u5546\u54C1\u89C4\u683C\u4FE1\u606F");
      }
      common_vendor.index.getStorageSync("defaultAdres") ? adress.value = common_vendor.index.getStorageSync("defaultAdres") : "";
    });
    common_vendor.onShow(() => {
      common_vendor.index.getStorageSync("balance") ? balance.value = common_vendor.index.getStorageSync("balance") : "";
    });
    let modeShow = common_vendor.ref(false);
    let payParams = common_vendor.ref({});
    let shopType = common_vendor.ref(1);
    let car_Id = common_vendor.ref("");
    let balance = common_vendor.ref(0);
    let buyShop = common_vendor.ref([]);
    let orderInfo = common_vendor.ref({});
    const getbBuyDatas = async (obj) => {
      try {
        let params = {
          goods_id: obj.id,
          num: obj.num,
          goods_spec_id: obj.specId
        };
        const res = await api_index.getbBuyData(params);
        buyShop.value = res.goods_list;
        orderInfo.value = res;
        console.log("getbBuyData", res);
      } catch (err) {
        common_vendor.index.showToast({ title: err, icon: "none" });
        console.log("getbBuyData", err);
      }
    };
    const getCarsettlements = async (ids) => {
      try {
        const res = await api_index.getCarsettlement(ids);
        buyShop.value = res.goods_list;
        orderInfo.value = res;
        console.log("getCarsettlement", res);
      } catch (err) {
        common_vendor.index.showToast({ title: err, icon: "none" });
        console.log("getCarsettlement", err);
      }
    };
    let adress = common_vendor.ref({});
    const checkAddress = () => {
      common_vendor.index.navigateTo({
        url: `/pages/mine/myAddress?isCheck=${1}`,
        events: {
          steBack: (data) => {
            adress.value = data;
            console.log("\u5730\u5740", data);
          }
        }
      });
    };
    const tipShow = common_vendor.ref(false);
    const pointsBtns = (type) => {
      tipShow.value = false;
      if (type == 1) {
        modeShow.value = true;
      }
    };
    const btns = () => {
      if (shopType.value == 3) {
        console.log("\u7ACB\u5373\u5151\u6362\u6309\u94AE");
        if (common_vendor.index.getStorageSync("myPoints") < orderInfo.value.coscore)
          return common_vendor.index.showToast({ title: "\u60A8\u7684\u79EF\u5206\u4E0D\u8DB3~", icon: "none" });
        tipShow.value = true;
      } else {
        modeShow.value = true;
        console.log("\u7ACB\u5373\u8D2D\u4E70");
      }
    };
    return (_ctx, _cache) => {
      return common_vendor.e({
        a: common_vendor.p({
          bgColor: "#F6F8FA",
          placeholder: true,
          title: "",
          autoBack: true
        }),
        b: !common_vendor.unref(adress).name
      }, !common_vendor.unref(adress).name ? {
        c: common_vendor.o(checkAddress)
      } : {
        d: common_vendor.p({
          adress: common_vendor.unref(adress)
        })
      }, {
        e: common_vendor.f(common_vendor.unref(buyShop), (item, k0, i0) => {
          return common_vendor.e({
            a: item.image,
            b: common_vendor.t(item.name),
            c: common_vendor.t(item.describe)
          }, common_vendor.unref(shopType) != 3 ? {
            d: common_vendor.t(item.goods_price)
          } : {
            e: common_vendor.t(common_vendor.unref(orderInfo).coscore)
          }, {
            f: common_vendor.t(item.total_num),
            g: item.id
          });
        }),
        f: common_vendor.unref(shopType) != 3,
        g: common_vendor.unref(shopType) == 3
      }, common_vendor.unref(shopType) == 3 ? {
        h: common_vendor.t(common_vendor.unref(orderInfo).express_price)
      } : {}, {
        i: common_vendor.unref(shopType) == 3
      }, common_vendor.unref(shopType) == 3 ? {
        j: common_vendor.t(common_vendor.unref(orderInfo).coscore),
        k: common_vendor.t(common_vendor.unref(orderInfo).express_price)
      } : {
        l: common_vendor.t(common_vendor.unref(orderInfo).total_price)
      }, {
        m: common_vendor.t(common_vendor.unref(shopType) == 3 ? "\u7ACB\u5373\u5151\u6362" : "\u7ACB\u5373\u8D2D\u4E70"),
        n: common_vendor.o(btns),
        o: common_vendor.o(($event) => common_vendor.isRef(modeShow) ? modeShow.value = false : modeShow = false),
        p: common_vendor.p({
          car_Id: common_vendor.unref(car_Id),
          balance: common_vendor.unref(balance),
          totalPrice: common_vendor.unref(orderInfo).total_price,
          adressId: common_vendor.unref(adress).id,
          payParams: common_vendor.unref(payParams),
          modeShow: common_vendor.unref(modeShow)
        }),
        q: common_vendor.o(pointsBtns),
        r: common_vendor.p({
          integral: common_vendor.unref(orderInfo).coscore,
          tipShow: tipShow.value
        })
      });
    };
  }
};
var MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__file", "D:/vue/\u5927\u5065\u5EB7\u5546\u57CE/healthMall/pages/shopCar/confirmOrder.vue"]]);
wx.createPage(MiniProgramPage);