Files
cmgd-mini-app/unpackage/dist/dev/mp-weixin/pages/order/preview.js
2026-01-05 12:47:14 +08:00

158 lines
6.1 KiB
JavaScript

"use strict";
const common_vendor = require("../../common/vendor.js");
const api_order = require("../../api/order.js");
if (!Array) {
const _easycom_nut_cell2 = common_vendor.resolveComponent("nut-cell");
const _easycom_nut_cell_group2 = common_vendor.resolveComponent("nut-cell-group");
const _easycom_nut_tag2 = common_vendor.resolveComponent("nut-tag");
const _easycom_nut_price2 = common_vendor.resolveComponent("nut-price");
const _easycom_nut_button2 = common_vendor.resolveComponent("nut-button");
(_easycom_nut_cell2 + _easycom_nut_cell_group2 + _easycom_nut_tag2 + _easycom_nut_price2 + _easycom_nut_button2)();
}
const _easycom_nut_cell = () => "../../uni_modules/nutui-uni/components/cell/cell.js";
const _easycom_nut_cell_group = () => "../../uni_modules/nutui-uni/components/cellgroup/cellgroup.js";
const _easycom_nut_tag = () => "../../uni_modules/nutui-uni/components/tag/tag.js";
const _easycom_nut_price = () => "../../uni_modules/nutui-uni/components/price/price.js";
const _easycom_nut_button = () => "../../uni_modules/nutui-uni/components/button/button.js";
if (!Math) {
(_easycom_nut_cell + _easycom_nut_cell_group + _easycom_nut_tag + _easycom_nut_price + _easycom_nut_button)();
}
const _sfc_main = {
__name: "preview",
setup(__props) {
const chooseAddress = () => {
common_vendor.index.chooseAddress({
success(res) {
common_vendor.index.__f__("log", "at pages/order/preview.vue:145", res);
Object.assign(form, {
address_info: {
address_id: res.addressID || 1,
user_name: res.userName,
tel_number: res.telNumber,
city_name: res.cityName || "",
county_name: res.countyName || "",
detail_info: res.detailInfo || "",
detail_info_new: res.detailInfoNew || "",
national_code: res.nationalCode || "",
national_code_full: res.nationalCodeFull || "",
postal_code: res.postalCode || "",
province_name: res.provinceName || "",
street_name: res.streetName || ""
}
});
}
});
};
common_vendor.ref([]);
const list = common_vendor.reactive([]);
const order_total_price = common_vendor.ref(0);
const order_total_num = common_vendor.ref(0);
const form = common_vendor.reactive({
goods_id: 0,
address_info: {}
});
const fromStr = common_vendor.ref("");
common_vendor.onLoad((options) => {
common_vendor.index.__f__("log", "at pages/order/preview.vue:186", "🚀 ~ from:", options.from);
fromStr.value = options.from;
common_vendor.index.__f__("log", "at pages/order/preview.vue:188", "🚀 ~ ids:", options.ids);
form.goods_id = options.ids;
});
common_vendor.onShow(() => {
common_vendor.index.__f__("log", "at pages/order/preview.vue:196", "🚀 ~ onShowfrom:", fromStr.value);
if (fromStr.value === "list" || fromStr.value === "item") {
api_order.fetchOrderPreview(form).then((res) => {
Object.assign(list, res.goods_list);
Object.assign(form.address_info, res.address_info);
order_total_price.value = res.order_total_price;
order_total_num.value = res.order_total_num;
});
}
});
common_vendor.onHide(() => {
fromStr.value = "";
});
const onSubmitClick = () => {
var _a;
if (!((_a = form.address_info) == null ? void 0 : _a.address_id)) {
common_vendor.index.showToast({
title: "请选择收货地址",
icon: "none"
});
return;
}
api_order.fetchOrderbuyNow(form).then((res) => {
common_vendor.index.__f__("log", "at pages/order/preview.vue:223", res);
common_vendor.index.redirectTo({
url: "/pages/order/detail?id=" + res.order_id,
success: (res2) => {
},
fail: () => {
},
complete: () => {
}
});
});
};
return (_ctx, _cache) => {
var _a, _b;
return common_vendor.e({
a: !((_a = form.address_info) == null ? void 0 : _a.address_id)
}, !((_b = form.address_info) == null ? void 0 : _b.address_id) ? {
b: common_vendor.o(chooseAddress),
c: common_vendor.p({
title: "添加地址",
["is-link"]: true
})
} : {
d: common_vendor.o(chooseAddress),
e: common_vendor.p({
title: form.address_info.user_name + " " + form.address_info.tel_number,
["is-link"]: true,
["sub-title"]: form.address_info.province_name + form.address_info.city_name + form.address_info.county_name + form.address_info.street_name + form.address_info.detail_info_new
})
}, {
f: common_vendor.f(list, (goods, index, i0) => {
return {
a: common_vendor.t(goods.degree.degree_name),
b: "2ea27d69-5-" + i0 + "," + ("2ea27d69-4-" + i0),
c: common_vendor.t(goods.goods_name),
d: common_vendor.t(goods.goods_no),
e: "2ea27d69-6-" + i0 + "," + ("2ea27d69-4-" + i0),
f: common_vendor.p({
price: goods.goods_price,
size: "small",
["need-symbol"]: true
}),
g: index,
h: "2ea27d69-4-" + i0 + ",2ea27d69-3"
};
}),
g: common_vendor.p({
["custom-color"]: "#1a1a1a"
}),
h: common_vendor.p({
center: true
}),
i: common_vendor.t(order_total_num.value),
j: common_vendor.p({
price: order_total_price.value,
["need-symbol"]: true
}),
k: common_vendor.p({
size: "large",
price: order_total_price.value,
["need-symbol"]: true
}),
l: common_vendor.o(onSubmitClick),
m: common_vendor.p({
type: "primary"
})
});
};
}
};
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-2ea27d69"]]);
wx.createPage(MiniProgramPage);
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/order/preview.js.map