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

102 lines
3.7 KiB
JavaScript

"use strict";
const common_vendor = require("../../common/vendor.js");
const api_goods = require("../../api/goods.js");
const api_config = require("../../api/config.js");
if (!Array) {
const _easycom_nut_watermark2 = common_vendor.resolveComponent("nut-watermark");
const _easycom_nut_cell_group2 = common_vendor.resolveComponent("nut-cell-group");
(_easycom_nut_watermark2 + _easycom_nut_cell_group2)();
}
const _easycom_nut_watermark = () => "../../uni_modules/nutui-uni/components/watermark/watermark.js";
const _easycom_nut_cell_group = () => "../../uni_modules/nutui-uni/components/cellgroup/cellgroup.js";
if (!Math) {
(_easycom_nut_watermark + _easycom_nut_cell_group)();
}
const _sfc_main = {
__name: "goodsDetail",
setup(__props) {
const serviceTxt = common_vendor.ref("");
const id = common_vendor.ref(0);
const detail = common_vendor.reactive({});
common_vendor.onLoad((options) => {
common_vendor.index.__f__("log", "at pages/config/goodsDetail.vue:83", "init");
getConfig();
id.value = options.id;
api_goods.fetchGoodsDetail(id.value).then((res) => {
Object.assign(detail, res);
});
});
const getConfig = () => {
api_config.fetchGetConfig().then((res) => {
common_vendor.index.__f__("log", "at pages/config/goodsDetail.vue:102", "getConfig=====>", res);
serviceTxt.value = res.appConfig.service_txt;
});
};
common_vendor.onShareTimeline((res) => {
return {
title: detail.goods_name,
path: "/pages/mall/detail?id=" + detail.goods_id,
imageUrl: detail.image[0].file_path
};
});
common_vendor.onShareAppMessage((res) => {
return {
title: detail.goods_name,
path: "/pages/mall/detail?id=" + detail.goods_id,
imageUrl: detail.image[0].file_path
};
});
const showGoodsImages = (index) => {
common_vendor.index.previewImage({
current: index,
// 指定当前显示的图片索引
urls: detail.image.map((e) => {
return e.file_path;
})
});
};
return (_ctx, _cache) => {
var _a, _b, _c, _d, _e, _f, _g;
return common_vendor.e({
a: ((_a = detail.status) == null ? void 0 : _a.value) === 10
}, ((_b = detail.status) == null ? void 0 : _b.value) === 10 ? {
b: common_vendor.p({
["z-index"]: 1,
content: "此商品已下架"
})
} : {}, {
c: ((_c = detail.status) == null ? void 0 : _c.value) === 30
}, ((_d = detail.status) == null ? void 0 : _d.value) === 30 ? {
d: common_vendor.p({
["z-index"]: 1,
content: "此商品已锁定"
})
} : {}, {
e: ((_e = detail.status) == null ? void 0 : _e.value) === 40
}, ((_f = detail.status) == null ? void 0 : _f.value) === 40 ? {
f: common_vendor.p({
["z-index"]: 1,
content: "此商品已售出"
})
} : {}, {
g: common_vendor.f(detail.image, (item, idx, i0) => {
return {
a: item.file_path,
b: common_vendor.o(($event) => showGoodsImages(idx), idx),
c: idx
};
}),
h: common_vendor.t(detail.goods_price),
i: common_vendor.t((_g = detail.degree) == null ? void 0 : _g.degree_name),
j: common_vendor.t(detail.goods_name),
k: common_vendor.t(detail.content),
l: common_vendor.t(serviceTxt.value)
});
};
}
};
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-d67bd9c3"]]);
_sfc_main.__runtimeHooks = 6;
wx.createPage(MiniProgramPage);
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/config/goodsDetail.js.map