acdr-ui/dist/dev/mp-weixin/modules/mall/goods/components/detail/detail-tabbar.js

136 lines
4.1 KiB
JavaScript
Raw Normal View History

2024-09-19 07:20:14 +08:00
"use strict";
var __async = (__this, __arguments, generator) => {
return new Promise((resolve, reject) => {
var fulfilled = (value) => {
try {
step(generator.next(value));
} catch (e) {
reject(e);
}
};
var rejected = (value) => {
try {
step(generator.throw(value));
} catch (e) {
reject(e);
}
};
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
step((generator = generator.apply(__this, __arguments)).next());
});
};
const common_vendor = require("../../../../../common/vendor.js");
2024-10-01 09:15:35 +08:00
const modules_mall_sheep_index = require("../../../sheep/index.js");
const modules_mall_sheep_hooks_useModal = require("../../../sheep/hooks/useModal.js");
const modules_mall_sheep_api_product_favorite = require("../../../sheep/api/product/favorite.js");
2024-09-19 07:20:14 +08:00
if (!Array) {
const _easycom_su_fixed2 = common_vendor.resolveComponent("su-fixed");
_easycom_su_fixed2();
}
2024-10-01 09:15:35 +08:00
const _easycom_su_fixed = () => "../../../sheep/ui/su-fixed/su-fixed.js";
2024-09-19 07:20:14 +08:00
if (!Math) {
_easycom_su_fixed();
}
const _sfc_main = {
__name: "detail-tabbar",
props: {
modelValue: {
type: Object,
default() {
}
},
bg: {
type: String,
default: "bg-white"
},
bgStyles: {
type: Object,
default() {
}
},
ui: {
type: String,
default: ""
},
noFixed: {
type: Boolean,
default: false
},
topRadius: {
type: Number,
default: 0
},
collectIcon: {
type: Boolean,
default: true
},
serviceIcon: {
type: Boolean,
default: true
},
shareIcon: {
type: Boolean,
default: true
}
},
setup(__props) {
common_vendor.reactive({});
const props = __props;
function onFavorite() {
return __async(this, null, function* () {
if (props.modelValue.favorite) {
2024-10-01 09:15:35 +08:00
const { code } = yield modules_mall_sheep_api_product_favorite.FavoriteApi.deleteFavorite(props.modelValue.id);
2024-09-19 07:20:14 +08:00
if (code !== 0) {
return;
}
2024-10-01 09:15:35 +08:00
modules_mall_sheep_index.sheep.$helper.toast("取消收藏");
2024-09-19 07:20:14 +08:00
props.modelValue.favorite = false;
} else {
2024-10-01 09:15:35 +08:00
const { code } = yield modules_mall_sheep_api_product_favorite.FavoriteApi.createFavorite(props.modelValue.id);
2024-09-19 07:20:14 +08:00
if (code !== 0) {
return;
}
2024-10-01 09:15:35 +08:00
modules_mall_sheep_index.sheep.$helper.toast("收藏成功");
2024-09-19 07:20:14 +08:00
props.modelValue.favorite = true;
}
});
}
const onChat = () => {
2024-10-01 09:15:35 +08:00
modules_mall_sheep_index.sheep.$router.go("/modules/mall/chat/index", {
2024-09-19 07:20:14 +08:00
id: props.modelValue.id
});
};
return (_ctx, _cache) => {
return common_vendor.e({
a: __props.collectIcon
}, __props.collectIcon ? common_vendor.e({
b: __props.modelValue.favorite
}, __props.modelValue.favorite ? {
2024-10-01 09:15:35 +08:00
c: common_vendor.unref(modules_mall_sheep_index.sheep).$url.static("/static/img/shop/goods/collect_1.gif")
2024-09-19 07:20:14 +08:00
} : {
2024-10-01 09:15:35 +08:00
d: common_vendor.unref(modules_mall_sheep_index.sheep).$url.static("/static/img/shop/goods/collect_0.png")
2024-09-19 07:20:14 +08:00
}, {
e: common_vendor.o(onFavorite)
}) : {}, {
f: __props.serviceIcon
}, __props.serviceIcon ? {
2024-10-01 09:15:35 +08:00
g: common_vendor.unref(modules_mall_sheep_index.sheep).$url.static("/static/img/shop/goods/message.png"),
2024-09-19 07:20:14 +08:00
h: common_vendor.o(onChat)
} : {}, {
i: __props.shareIcon
}, __props.shareIcon ? {
2024-10-01 09:15:35 +08:00
j: common_vendor.unref(modules_mall_sheep_index.sheep).$url.static("/static/img/shop/goods/share.png"),
k: common_vendor.o((...args) => common_vendor.unref(modules_mall_sheep_hooks_useModal.showShareModal) && common_vendor.unref(modules_mall_sheep_hooks_useModal.showShareModal)(...args))
2024-09-19 07:20:14 +08:00
} : {}, {
l: common_vendor.p({
bottom: true,
placeholder: true,
bg: "bg-white"
})
});
};
}
};
const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-3dd4b368"]]);
wx.createComponent(Component);