304 lines
12 KiB
JavaScript
304 lines
12 KiB
JavaScript
"use strict";
|
|
const common_vendor = require("../../common/vendor.js");
|
|
const utils_helper = require("../../utils/helper.js");
|
|
const api_house_goods = require("../../api/house_goods.js");
|
|
const api_house_order = require("../../api/house_order.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");
|
|
const _easycom_nut_icon2 = common_vendor.resolveComponent("nut-icon");
|
|
const _easycom_nut_collapse_item2 = common_vendor.resolveComponent("nut-collapse-item");
|
|
const _easycom_nut_collapse2 = common_vendor.resolveComponent("nut-collapse");
|
|
const _easycom_nut_button2 = common_vendor.resolveComponent("nut-button");
|
|
(_easycom_nut_watermark2 + _easycom_nut_cell_group2 + _easycom_nut_icon2 + _easycom_nut_collapse_item2 + _easycom_nut_collapse2 + _easycom_nut_button2)();
|
|
}
|
|
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";
|
|
const _easycom_nut_icon = () => "../../uni_modules/nutui-uni/components/icon/icon.js";
|
|
const _easycom_nut_collapse_item = () => "../../uni_modules/nutui-uni/components/collapseitem/collapseitem.js";
|
|
const _easycom_nut_collapse = () => "../../uni_modules/nutui-uni/components/collapse/collapse.js";
|
|
const _easycom_nut_button = () => "../../uni_modules/nutui-uni/components/button/button.js";
|
|
if (!Math) {
|
|
(_easycom_nut_watermark + _easycom_nut_cell_group + _easycom_nut_icon + _easycom_nut_collapse_item + _easycom_nut_collapse + _easycom_nut_button)();
|
|
}
|
|
const _sfc_main = {
|
|
__name: "houseDetail",
|
|
setup(__props) {
|
|
const audit = common_vendor.ref(true);
|
|
const isWarehouse = common_vendor.ref(false);
|
|
const singleRule = common_vendor.ref([]);
|
|
const rangeRule = common_vendor.ref([]);
|
|
const warehouseRule = common_vendor.reactive({
|
|
val: 0,
|
|
val_type: 1
|
|
});
|
|
const GetPriceRules = () => {
|
|
api_config.fetchGetPriceRules().then((res) => {
|
|
var _a;
|
|
common_vendor.index.__f__("log", "at pages/mall/houseDetail.vue:174", "res", res);
|
|
rangeRule.value = (res == null ? void 0 : res.range) ?? [];
|
|
singleRule.value = (res == null ? void 0 : res.single) ?? [];
|
|
Object.assign(warehouseRule, ((_a = res == null ? void 0 : res.warehouse) == null ? void 0 : _a[0]) ?? {
|
|
val: 0,
|
|
val_type: 1
|
|
});
|
|
});
|
|
};
|
|
const getPrice = (goods) => {
|
|
if (isWarehouse.value) {
|
|
common_vendor.index.__f__("log", "at pages/mall/houseDetail.vue:192", "开启整仓调价");
|
|
const list = singleRule.value || singleRule;
|
|
const rule = list.find((item) => item.product_id === goods.goods_id);
|
|
if (rule) {
|
|
const basePrice = Number(goods.goods_price);
|
|
const val = Number(rule.val);
|
|
let finalPrice = basePrice;
|
|
if (rule.val_type == 1) {
|
|
finalPrice = basePrice + val;
|
|
} else if (rule.val_type == 2) {
|
|
finalPrice = basePrice + basePrice * val / 100;
|
|
}
|
|
return finalPrice.toFixed(2);
|
|
} else {
|
|
const basePrice = Number(goods.goods_price);
|
|
const val = Number(warehouseRule.val);
|
|
let finalPrice = basePrice;
|
|
if (warehouseRule.val_type == 1) {
|
|
finalPrice = basePrice + val;
|
|
} else if (warehouseRule.val_type == 2) {
|
|
finalPrice = basePrice + basePrice * val / 100;
|
|
}
|
|
return finalPrice.toFixed(2);
|
|
}
|
|
} else {
|
|
common_vendor.index.__f__("log", "at pages/mall/houseDetail.vue:223", "未开启整仓调价");
|
|
const singleRuleList = singleRule.value || singleRule;
|
|
const oneRule = singleRuleList.find((item) => item.product_id === goods.goods_id);
|
|
if (oneRule) {
|
|
const basePrice = Number(goods.goods_price);
|
|
const val = Number(oneRule.val);
|
|
let finalPrice = basePrice;
|
|
if (oneRule.val_type == 1) {
|
|
finalPrice = basePrice + val;
|
|
} else if (oneRule.val_type == 2) {
|
|
finalPrice = basePrice + basePrice * val / 100;
|
|
}
|
|
return finalPrice.toFixed(2);
|
|
} else {
|
|
const basePrice = Number(goods.goods_price);
|
|
const rangeRulelist = rangeRule.value || rangeRule;
|
|
const quRule = rangeRulelist.find((item) => {
|
|
const min = Number(item.min_price);
|
|
const max = Number(item.max_price);
|
|
return basePrice >= min && basePrice < max;
|
|
}) || null;
|
|
if (quRule) {
|
|
const val = Number(quRule.val);
|
|
let finalPrice = basePrice;
|
|
if (quRule.val_type == 1) {
|
|
finalPrice = basePrice + val;
|
|
} else if (quRule.val_type == 2) {
|
|
finalPrice = basePrice + basePrice * val / 100;
|
|
}
|
|
return finalPrice.toFixed(2);
|
|
} else {
|
|
return basePrice;
|
|
}
|
|
}
|
|
}
|
|
};
|
|
const id = common_vendor.ref(0);
|
|
const detail = common_vendor.reactive({});
|
|
const user_goods_cart_ids = common_vendor.ref([]);
|
|
const goods_cart_ids = common_vendor.ref([]);
|
|
const buyNow = (goodsId) => {
|
|
let token = common_vendor.index.getStorageSync("token");
|
|
if (token) {
|
|
api_house_order.houseFetchCheckGoods({
|
|
goods_id: goodsId
|
|
}).then((res) => {
|
|
common_vendor.index.__f__("log", "at pages/mall/houseDetail.vue:292", res);
|
|
common_vendor.index.__f__("log", "at pages/mall/houseDetail.vue:293", "已经登陆");
|
|
common_vendor.index.navigateTo({
|
|
url: `/pages/order/housePreview?ids=${goodsId}&from=item`
|
|
});
|
|
});
|
|
} else {
|
|
utils_helper.goToLoginPage();
|
|
}
|
|
};
|
|
const getConfig = () => {
|
|
api_config.fetchGetConfig().then((res) => {
|
|
common_vendor.index.__f__("log", "at pages/mall/houseDetail.vue:309", "getConfig=====>", res);
|
|
audit.value = res.appConfig.is_audit == 1;
|
|
isWarehouse.value = res.appConfig.is_warehouse == 1;
|
|
});
|
|
};
|
|
common_vendor.onLoad((options) => {
|
|
common_vendor.index.__f__("log", "at pages/mall/houseDetail.vue:317", "init");
|
|
getConfig();
|
|
GetPriceRules();
|
|
id.value = options.id;
|
|
api_house_goods.houseFetchGoodsDetail(id.value).then((res) => {
|
|
Object.assign(detail, res);
|
|
});
|
|
api_house_goods.houseFetchCartGoodsIds().then((res) => {
|
|
common_vendor.index.__f__("log", "at pages/mall/houseDetail.vue:331", res);
|
|
user_goods_cart_ids.value = res.user_cart_goods_ids;
|
|
goods_cart_ids.value = res.cart_goods_ids;
|
|
});
|
|
});
|
|
common_vendor.onShareTimeline((res) => {
|
|
return {
|
|
title: detail.goods_name,
|
|
path: "/pages/mall/houseDetail?id=" + detail.goods_id,
|
|
imageUrl: detail.image[0].file_path
|
|
};
|
|
});
|
|
common_vendor.onShareAppMessage((res) => {
|
|
return {
|
|
title: detail.goods_name,
|
|
path: "/pages/mall/houseDetail?id=" + detail.goods_id,
|
|
imageUrl: detail.image[0].file_path
|
|
};
|
|
});
|
|
const activeNames = common_vendor.ref([1, 2]);
|
|
const onChange = (modelValue, currName, status) => {
|
|
common_vendor.index.__f__("log", "at pages/mall/houseDetail.vue:364", modelValue, currName, status);
|
|
};
|
|
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, _h, _i, _j, _k;
|
|
return common_vendor.e({
|
|
a: ((_a = detail.shelves_status) == null ? void 0 : _a.value) === 10
|
|
}, ((_b = detail.shelves_status) == null ? void 0 : _b.value) === 10 ? {
|
|
b: common_vendor.p({
|
|
["z-index"]: 1,
|
|
content: "此商品已下架"
|
|
})
|
|
} : {}, {
|
|
c: ((_c = detail.shelves_status) == null ? void 0 : _c.value) === 30
|
|
}, ((_d = detail.shelves_status) == null ? void 0 : _d.value) === 30 ? {
|
|
d: common_vendor.p({
|
|
["z-index"]: 1,
|
|
content: "此商品已售出"
|
|
})
|
|
} : {}, {
|
|
e: detail.is_locked
|
|
}, detail.is_locked ? {
|
|
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(getPrice(detail)),
|
|
i: common_vendor.t((_e = detail.degree) == null ? void 0 : _e.degree_name),
|
|
j: common_vendor.t(detail.goods_name),
|
|
k: common_vendor.t(detail.content),
|
|
l: common_vendor.t(detail.service_txt),
|
|
m: common_vendor.p({
|
|
name: "tips",
|
|
size: "12",
|
|
["custom-color"]: "#ff3535"
|
|
}),
|
|
n: common_vendor.t((_f = detail.report_tags) == null ? void 0 : _f.bad_count),
|
|
o: common_vendor.f((_g = detail == null ? void 0 : detail.report_tags) == null ? void 0 : _g.bad, (item, idx, i0) => {
|
|
return {
|
|
a: common_vendor.t(item.name),
|
|
b: common_vendor.f(item.value_list, (iitem, iidx, i1) => {
|
|
return {
|
|
a: "cec1cea2-9-" + i0 + "-" + i1 + ",cec1cea2-7",
|
|
b: common_vendor.t(iitem.name),
|
|
c: iidx
|
|
};
|
|
}),
|
|
c: idx
|
|
};
|
|
}),
|
|
p: common_vendor.p({
|
|
name: "tips",
|
|
size: "12",
|
|
["custom-color"]: "#ff3535"
|
|
}),
|
|
q: common_vendor.p({
|
|
name: 1,
|
|
icon: "rect-down"
|
|
}),
|
|
r: common_vendor.p({
|
|
name: "success",
|
|
size: "12",
|
|
["custom-color"]: "#5dcc30"
|
|
}),
|
|
s: common_vendor.t((_h = detail.report_tags) == null ? void 0 : _h.ok_count),
|
|
t: common_vendor.f((_i = detail == null ? void 0 : detail.report_tags) == null ? void 0 : _i.ok, (item, idx, i0) => {
|
|
return {
|
|
a: common_vendor.t(item.name),
|
|
b: common_vendor.f(item.value_list, (iitem, iidx, i1) => {
|
|
return {
|
|
a: "cec1cea2-12-" + i0 + "-" + i1 + ",cec1cea2-10",
|
|
b: common_vendor.t(iitem.name),
|
|
c: iidx
|
|
};
|
|
}),
|
|
c: idx
|
|
};
|
|
}),
|
|
v: common_vendor.p({
|
|
name: "success",
|
|
size: "12",
|
|
["custom-color"]: "#5dcc30"
|
|
}),
|
|
w: common_vendor.p({
|
|
name: 2,
|
|
icon: "rect-down"
|
|
}),
|
|
x: common_vendor.o(onChange),
|
|
y: common_vendor.o(($event) => activeNames.value = $event),
|
|
z: common_vendor.p({
|
|
modelValue: activeNames.value
|
|
}),
|
|
A: common_vendor.p({
|
|
title: "验机报告"
|
|
}),
|
|
B: common_vendor.p({
|
|
name: "service"
|
|
}),
|
|
C: ((_j = detail.shelves_status) == null ? void 0 : _j.value) === 20 && !goods_cart_ids.value.includes(detail.goods_id)
|
|
}, ((_k = detail.shelves_status) == null ? void 0 : _k.value) === 20 && !goods_cart_ids.value.includes(detail.goods_id) ? common_vendor.e({
|
|
D: !audit.value
|
|
}, !audit.value ? {
|
|
E: common_vendor.o(($event) => buyNow(detail.goods_id)),
|
|
F: common_vendor.p({
|
|
type: "primary"
|
|
})
|
|
} : {}) : common_vendor.e({
|
|
G: !audit.value
|
|
}, !audit.value ? {
|
|
H: common_vendor.p({
|
|
plain: true
|
|
})
|
|
} : {}));
|
|
};
|
|
}
|
|
};
|
|
const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-cec1cea2"]]);
|
|
_sfc_main.__runtimeHooks = 6;
|
|
wx.createPage(MiniProgramPage);
|
|
//# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/mall/houseDetail.js.map
|