123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478 |
- "use strict";
- const common_vendor = require("../../../common/vendor.js");
- const common_assets = require("../../../common/assets.js");
- const sheep_index = require("../../index.js");
- const sheep_hooks_useGoods = require("../../hooks/useGoods.js");
- require("../../api/index.js");
- require("../../api/distri/score.js");
- require("../../request/index.js");
- require("../../config/index.js");
- require("../../store/index.js");
- require("../../store/app.js");
- require("../../api/promotion/diy.js");
- require("../../platform/index.js");
- require("../../platform/provider/wechat/index.js");
- require("../../platform/provider/wechat/miniProgram.js");
- require("../../api/member/auth.js");
- require("../../api/member/social.js");
- require("../../api/member/user.js");
- require("../../platform/provider/apple/index.js");
- require("../../platform/share.js");
- require("../../router/index.js");
- require("../../hooks/useModal.js");
- require("../../helper/index.js");
- require("../../helper/test.js");
- require("../../helper/digit.js");
- require("../../api/member/signin.js");
- require("../../helper/throttle.js");
- require("../../url/index.js");
- require("../../platform/pay.js");
- require("../../api/pay/order.js");
- require("../../store/user.js");
- require("../../store/cart.js");
- require("../../api/trade/cart.js");
- require("../../api/pay/wallet.js");
- require("../../api/trade/order.js");
- require("../../api/promotion/coupon.js");
- require("../../store/sys.js");
- require("../../store/modal.js");
- require("../../api/distri/share.js");
- require("../../api/distri/team.js");
- require("../../api/infra/file.js");
- require("../../api/member/address.js");
- require("../../api/member/point.js");
- require("../../api/migration/app.js");
- require("../../api/migration/chat.js");
- require("../../api/migration/index.js");
- require("../../api/migration/third.js");
- require("../../api/pay/channel.js");
- require("../../api/product/category.js");
- require("../../api/product/comment.js");
- require("../../api/product/favorite.js");
- require("../../api/product/history.js");
- require("../../api/product/spu.js");
- require("../../api/promotion/activity.js");
- require("../../api/promotion/article.js");
- require("../../api/promotion/bargain.js");
- require("../../api/promotion/combination.js");
- require("../../api/promotion/rewardActivity.js");
- require("../../api/promotion/seckill.js");
- require("../../api/system/area.js");
- require("../../api/system/voice.js");
- require("../../api/trade/afterSale.js");
- require("../../api/trade/brokerage.js");
- require("../../api/trade/config.js");
- require("../../api/trade/delivery.js");
- require("../../config/zIndex.js");
- require("../../util/index.js");
- const _sfc_main = {
- __name: "s-goods-column",
- props: {
- goodsFields: {
- type: [Array, Object],
- default() {
- return {
- // 商品价格
- price: {
- show: true
- },
- // 库存
- stock: {
- show: true
- },
- // 商品名称
- name: {
- show: true
- },
- // 商品介绍
- introduction: {
- show: true
- },
- // 市场价
- promotionFee: {
- show: true
- },
- // 销量
- salesCount: {
- show: true
- }
- };
- }
- },
- tagStyle: {
- type: Object,
- default: {}
- },
- data: {
- type: Object,
- default: {}
- },
- size: {
- type: String,
- default: "sl"
- },
- background: {
- type: String,
- default: ""
- },
- topRadius: {
- type: Number,
- default: 0
- },
- bottomRadius: {
- type: Number,
- default: 0
- },
- titleWidth: {
- type: Number,
- default: 0
- },
- titleColor: {
- type: String,
- default: "#333"
- },
- priceColor: {
- type: String,
- default: ""
- },
- originPriceColor: {
- type: String,
- default: "#C4C4C4"
- },
- priceUnit: {
- type: String,
- default: "¥"
- },
- subTitleColor: {
- type: String,
- default: "#999999"
- },
- subTitleBackground: {
- type: String,
- default: ""
- },
- buttonShow: {
- type: Boolean,
- default: true
- },
- seckillTag: {
- type: Boolean,
- default: false
- },
- grouponTag: {
- type: Boolean,
- default: false
- }
- },
- emits: ["click", "getHeight"],
- setup(__props, { emit: __emit }) {
- common_vendor.reactive({});
- const props = __props;
- const elStyles = common_vendor.computed(() => {
- return {
- background: props.background,
- "border-top-left-radius": props.topRadius + "px",
- "border-top-right-radius": props.topRadius + "px",
- "border-bottom-left-radius": props.bottomRadius + "px",
- "border-bottom-right-radius": props.bottomRadius + "px"
- };
- });
- const salesAndStock = common_vendor.computed(() => {
- var _a, _b;
- let text = [];
- if ((_a = props.goodsFields.salesCount) == null ? void 0 : _a.show) {
- text.push(sheep_hooks_useGoods.formatSales(props.data.sales_show_type, props.data.salesCount));
- }
- if ((_b = props.goodsFields.stock) == null ? void 0 : _b.show) {
- text.push(sheep_hooks_useGoods.formatStock(props.data.stock_show_type, props.data.stock));
- }
- return text.join(" | ");
- });
- const emits = __emit;
- const onClick = () => {
- emits("click");
- };
- const {
- proxy
- } = common_vendor.getCurrentInstance();
- const elId = `sheep_${Math.ceil(Math.random() * 1e6).toString(36)}`;
- function getGoodsPriceCardWH() {
- if (props.size === "md") {
- const view = common_vendor.index.createSelectorQuery().in(proxy);
- view.select(`#${elId}`).fields({
- size: true,
- scrollOffset: true
- });
- view.exec((data) => {
- let totalHeight = 0;
- const goodsPriceCard = data[0];
- if (props.data.image_wh) {
- totalHeight = goodsPriceCard.width / props.data.image_wh.w * props.data.image_wh.h + goodsPriceCard.height;
- } else {
- totalHeight = goodsPriceCard.width;
- }
- emits("getHeight", totalHeight);
- });
- }
- }
- common_vendor.onMounted(() => {
- common_vendor.nextTick$1(() => {
- getGoodsPriceCardWH();
- });
- });
- return (_ctx, _cache) => {
- var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q, _r, _s, _t, _u, _v, _w, _x, _y, _z, _A, _B, _C, _D, _E, _F, _G, _H, _I, _J, _K, _L, _M, _N, _O, _P, _Q, _R, _S, _T, _U, _V, _W, _X, _Y, _Z, __, _$, _aa, _ba, _ca, _da, _ea, _fa;
- return common_vendor.e({
- a: __props.size === "xs"
- }, __props.size === "xs" ? common_vendor.e({
- b: __props.tagStyle.show
- }, __props.tagStyle.show ? {
- c: common_vendor.unref(sheep_index.sheep).$url.cdn(__props.tagStyle.src || __props.tagStyle.imgUrl)
- } : {}, {
- d: common_vendor.unref(sheep_index.sheep).$url.cdn(__props.data.image || __props.data.picUrl),
- e: ((_a = __props.goodsFields.title) == null ? void 0 : _a.show) || ((_b = __props.goodsFields.name) == null ? void 0 : _b.show) || ((_c = __props.goodsFields.price) == null ? void 0 : _c.show)
- }, ((_d = __props.goodsFields.title) == null ? void 0 : _d.show) || ((_e = __props.goodsFields.name) == null ? void 0 : _e.show) || ((_f = __props.goodsFields.price) == null ? void 0 : _f.show) ? common_vendor.e({
- f: ((_g = __props.goodsFields.title) == null ? void 0 : _g.show) || ((_h = __props.goodsFields.name) == null ? void 0 : _h.show)
- }, ((_i = __props.goodsFields.title) == null ? void 0 : _i.show) || ((_j = __props.goodsFields.name) == null ? void 0 : _j.show) ? {
- g: common_vendor.t(__props.data.title || __props.data.name),
- h: common_vendor.s({
- color: __props.titleColor,
- width: __props.titleWidth ? __props.titleWidth + "rpx" : ""
- })
- } : {}, {
- i: (_k = __props.goodsFields.price) == null ? void 0 : _k.show
- }, ((_l = __props.goodsFields.price) == null ? void 0 : _l.show) ? common_vendor.e({
- j: __props.data.spuPayType == 2
- }, __props.data.spuPayType == 2 ? {
- k: common_assets._imports_0
- } : {}, {
- l: __props.data.highPrecision
- }, __props.data.highPrecision ? {
- m: common_vendor.t(common_vendor.unref(common_vendor.lodashExports.isArray)(__props.data.highPrecisionPrice) ? common_vendor.unref(sheep_hooks_useGoods.fen2yuan6)(__props.data.highPrecisionPrice[0]) : common_vendor.unref(sheep_hooks_useGoods.fen2yuan6)(__props.data.highPrecisionPrice))
- } : {
- n: common_vendor.t(common_vendor.unref(common_vendor.lodashExports.isArray)(__props.data.price) ? common_vendor.unref(sheep_hooks_useGoods.fen2yuan)(__props.data.price[0]) : common_vendor.unref(sheep_hooks_useGoods.fen2yuan)(__props.data.price))
- }, {
- o: common_vendor.s({
- color: __props.goodsFields.price.color
- })
- }) : {}, {
- p: __props.data.promotionFee >= 0
- }, __props.data.promotionFee >= 0 ? {
- q: common_vendor.t(common_vendor.unref(sheep_hooks_useGoods.fen2yuan)(__props.data.promotionFee))
- } : {}) : {}, {
- r: common_vendor.s(elStyles.value),
- s: common_vendor.o(onClick)
- }) : {}, {
- t: __props.size === "sm"
- }, __props.size === "sm" ? common_vendor.e({
- v: __props.tagStyle.show
- }, __props.tagStyle.show ? {
- w: common_vendor.unref(sheep_index.sheep).$url.cdn(__props.tagStyle.src || __props.tagStyle.imgUrl)
- } : {}, {
- x: common_vendor.unref(sheep_index.sheep).$url.cdn(__props.data.image || __props.data.picUrl),
- y: ((_m = __props.goodsFields.title) == null ? void 0 : _m.show) || ((_n = __props.goodsFields.name) == null ? void 0 : _n.show) || ((_o = __props.goodsFields.price) == null ? void 0 : _o.show)
- }, ((_p = __props.goodsFields.title) == null ? void 0 : _p.show) || ((_q = __props.goodsFields.name) == null ? void 0 : _q.show) || ((_r = __props.goodsFields.price) == null ? void 0 : _r.show) ? common_vendor.e({
- z: ((_s = __props.goodsFields.title) == null ? void 0 : _s.show) || ((_t = __props.goodsFields.name) == null ? void 0 : _t.show)
- }, ((_u = __props.goodsFields.title) == null ? void 0 : _u.show) || ((_v = __props.goodsFields.name) == null ? void 0 : _v.show) ? {
- A: common_vendor.t(__props.data.title || __props.data.name)
- } : {}, {
- B: (_w = __props.goodsFields.price) == null ? void 0 : _w.show
- }, ((_x = __props.goodsFields.price) == null ? void 0 : _x.show) ? common_vendor.e({
- C: __props.data.spuPayType == 2
- }, __props.data.spuPayType == 2 ? {
- D: common_assets._imports_0
- } : {}, {
- E: __props.data.highPrecision
- }, __props.data.highPrecision ? {
- F: common_vendor.t(common_vendor.unref(common_vendor.lodashExports.isArray)(__props.data.highPrecisionPrice) ? common_vendor.unref(sheep_hooks_useGoods.fen2yuan6)(__props.data.highPrecisionPrice[0]) : common_vendor.unref(sheep_hooks_useGoods.fen2yuan6)(__props.data.highPrecisionPrice))
- } : {
- G: common_vendor.t(common_vendor.unref(common_vendor.lodashExports.isArray)(__props.data.price) ? common_vendor.unref(sheep_hooks_useGoods.fen2yuan)(__props.data.price[0]) : common_vendor.unref(sheep_hooks_useGoods.fen2yuan)(__props.data.price))
- }, {
- H: common_vendor.s({
- color: __props.goodsFields.price.color
- })
- }) : {}, {
- I: __props.data.promotionFee >= 0
- }, __props.data.promotionFee >= 0 ? {
- J: common_vendor.t(common_vendor.unref(sheep_hooks_useGoods.fen2yuan)(__props.data.promotionFee))
- } : {}, {
- K: common_vendor.s({
- color: __props.titleColor,
- width: __props.titleWidth ? __props.titleWidth + "rpx" : ""
- })
- }) : {}, {
- L: common_vendor.s(elStyles.value),
- M: common_vendor.o(onClick)
- }) : {}, {
- N: __props.size === "md"
- }, __props.size === "md" ? common_vendor.e({
- O: __props.tagStyle.show
- }, __props.tagStyle.show ? {
- P: common_vendor.unref(sheep_index.sheep).$url.cdn(__props.tagStyle.src || __props.tagStyle.imgUrl)
- } : {}, {
- Q: common_vendor.unref(sheep_index.sheep).$url.cdn(__props.data.image || __props.data.picUrl),
- R: ((_y = __props.goodsFields.title) == null ? void 0 : _y.show) || ((_z = __props.goodsFields.name) == null ? void 0 : _z.show)
- }, ((_A = __props.goodsFields.title) == null ? void 0 : _A.show) || ((_B = __props.goodsFields.name) == null ? void 0 : _B.show) ? {
- S: common_vendor.t(__props.data.title || __props.data.name),
- T: common_vendor.s({
- color: __props.titleColor,
- width: __props.titleWidth ? __props.titleWidth + "rpx" : ""
- })
- } : {}, {
- U: ((_C = __props.goodsFields.subtitle) == null ? void 0 : _C.show) || ((_D = __props.goodsFields.introduction) == null ? void 0 : _D.show)
- }, ((_E = __props.goodsFields.subtitle) == null ? void 0 : _E.show) || ((_F = __props.goodsFields.introduction) == null ? void 0 : _F.show) ? {
- V: common_vendor.t(__props.data.subtitle || __props.data.introduction),
- W: common_vendor.s({
- color: __props.subTitleColor,
- background: __props.subTitleBackground
- })
- } : {}, {
- X: (_G = __props.data.promos) == null ? void 0 : _G.length
- }, ((_H = __props.data.promos) == null ? void 0 : _H.length) ? {
- Y: common_vendor.f(__props.data.promos, (item, k0, i0) => {
- return {
- a: common_vendor.t(item.title),
- b: item.id
- };
- })
- } : {}, {
- Z: (_I = __props.goodsFields.price) == null ? void 0 : _I.show
- }, ((_J = __props.goodsFields.price) == null ? void 0 : _J.show) ? common_vendor.e({
- aa: __props.data.spuPayType == 2
- }, __props.data.spuPayType == 2 ? {
- ab: common_assets._imports_0
- } : {}, {
- ac: __props.data.highPrecision
- }, __props.data.highPrecision ? {
- ad: common_vendor.t(common_vendor.unref(common_vendor.lodashExports.isArray)(__props.data.highPrecisionPrice) ? common_vendor.unref(sheep_hooks_useGoods.fen2yuan6)(__props.data.highPrecisionPrice[0]) : common_vendor.unref(sheep_hooks_useGoods.fen2yuan6)(__props.data.highPrecisionPrice))
- } : {
- ae: common_vendor.t(common_vendor.unref(common_vendor.lodashExports.isArray)(__props.data.price) ? common_vendor.unref(sheep_hooks_useGoods.fen2yuan)(__props.data.price[0]) : common_vendor.unref(sheep_hooks_useGoods.fen2yuan)(__props.data.price))
- }, {
- af: common_vendor.s({
- color: __props.goodsFields.price.color
- })
- }) : {}, {
- ag: __props.data.promotionFee >= 0
- }, __props.data.promotionFee >= 0 ? {
- ah: common_vendor.t(common_vendor.unref(sheep_hooks_useGoods.fen2yuan)(__props.data.promotionFee))
- } : {}, {
- ai: common_vendor.t(salesAndStock.value),
- aj: elId,
- ak: common_vendor.s(elStyles.value),
- al: common_vendor.o(onClick)
- }) : {}, {
- am: __props.size === "lg"
- }, __props.size === "lg" ? common_vendor.e({
- an: __props.tagStyle.show
- }, __props.tagStyle.show ? {
- ao: common_vendor.unref(sheep_index.sheep).$url.cdn(__props.tagStyle.src || __props.tagStyle.imgUrl)
- } : {}, {
- ap: __props.seckillTag
- }, __props.seckillTag ? {} : {}, {
- aq: __props.grouponTag
- }, __props.grouponTag ? {} : {}, {
- ar: common_vendor.unref(sheep_index.sheep).$url.cdn(__props.data.image || __props.data.picUrl),
- as: ((_K = __props.goodsFields.title) == null ? void 0 : _K.show) || ((_L = __props.goodsFields.name) == null ? void 0 : _L.show)
- }, ((_M = __props.goodsFields.title) == null ? void 0 : _M.show) || ((_N = __props.goodsFields.name) == null ? void 0 : _N.show) ? {
- at: common_vendor.t(__props.data.title || __props.data.name),
- av: common_vendor.s({
- color: __props.titleColor
- })
- } : {}, {
- aw: ((_O = __props.goodsFields.subtitle) == null ? void 0 : _O.show) || ((_P = __props.goodsFields.introduction) == null ? void 0 : _P.show)
- }, ((_Q = __props.goodsFields.subtitle) == null ? void 0 : _Q.show) || ((_R = __props.goodsFields.introduction) == null ? void 0 : _R.show) ? {
- ax: common_vendor.t(__props.data.subtitle || __props.data.introduction),
- ay: common_vendor.s({
- color: __props.subTitleColor,
- background: __props.subTitleBackground
- })
- } : {}, {
- az: (_S = __props.data.promos) == null ? void 0 : _S.length
- }, ((_T = __props.data.promos) == null ? void 0 : _T.length) ? {
- aA: common_vendor.f(__props.data.promos, (item, k0, i0) => {
- return {
- a: common_vendor.t(item.title),
- b: item.id
- };
- })
- } : {}, {
- aB: (_U = __props.goodsFields.price) == null ? void 0 : _U.show
- }, ((_V = __props.goodsFields.price) == null ? void 0 : _V.show) ? common_vendor.e({
- aC: __props.data.spuPayType == 2
- }, __props.data.spuPayType == 2 ? {
- aD: common_assets._imports_0
- } : {}, {
- aE: __props.data.highPrecision
- }, __props.data.highPrecision ? {
- aF: common_vendor.t(common_vendor.unref(common_vendor.lodashExports.isArray)(__props.data.highPrecisionPrice) ? common_vendor.unref(sheep_hooks_useGoods.fen2yuan6)(__props.data.highPrecisionPrice[0]) : common_vendor.unref(sheep_hooks_useGoods.fen2yuan6)(__props.data.highPrecisionPrice))
- } : {
- aG: common_vendor.t(common_vendor.unref(common_vendor.lodashExports.isArray)(__props.data.price) ? common_vendor.unref(sheep_hooks_useGoods.fen2yuan)(__props.data.price[0]) : common_vendor.unref(sheep_hooks_useGoods.fen2yuan)(__props.data.price))
- }, {
- aH: common_vendor.s({
- color: __props.goodsFields.price.color
- })
- }) : {}, {
- aI: __props.data.promotionFee >= 0
- }, __props.data.promotionFee >= 0 ? {
- aJ: common_vendor.t(common_vendor.unref(sheep_hooks_useGoods.fen2yuan)(__props.data.promotionFee))
- } : {}, {
- aK: common_vendor.t(salesAndStock.value),
- aL: __props.buttonShow
- }, __props.buttonShow ? {} : {}, {
- aM: common_vendor.s(elStyles.value),
- aN: common_vendor.o(onClick)
- }) : {}, {
- aO: __props.size === "sl"
- }, __props.size === "sl" ? common_vendor.e({
- aP: __props.tagStyle.show
- }, __props.tagStyle.show ? {
- aQ: common_vendor.unref(sheep_index.sheep).$url.cdn(__props.tagStyle.src || __props.tagStyle.imgUrl)
- } : {}, {
- aR: common_vendor.unref(sheep_index.sheep).$url.cdn(__props.data.image || __props.data.picUrl),
- aS: ((_W = __props.goodsFields.title) == null ? void 0 : _W.show) || ((_X = __props.goodsFields.name) == null ? void 0 : _X.show)
- }, ((_Y = __props.goodsFields.title) == null ? void 0 : _Y.show) || ((_Z = __props.goodsFields.name) == null ? void 0 : _Z.show) ? {
- aT: common_vendor.t(__props.data.title || __props.data.name),
- aU: common_vendor.s({
- color: __props.titleColor
- })
- } : {}, {
- aV: ((__ = __props.goodsFields.subtitle) == null ? void 0 : __.show) || ((_$ = __props.goodsFields.introduction) == null ? void 0 : _$.show)
- }, ((_aa = __props.goodsFields.subtitle) == null ? void 0 : _aa.show) || ((_ba = __props.goodsFields.introduction) == null ? void 0 : _ba.show) ? {
- aW: common_vendor.t(__props.data.subtitle || __props.data.introduction),
- aX: common_vendor.s({
- color: __props.subTitleColor,
- background: __props.subTitleBackground
- })
- } : {}, {
- aY: (_ca = __props.data.promos) == null ? void 0 : _ca.length
- }, ((_da = __props.data.promos) == null ? void 0 : _da.length) ? {
- aZ: common_vendor.f(__props.data.promos, (item, k0, i0) => {
- return {
- a: common_vendor.t(item.title),
- b: item.id
- };
- })
- } : {}, {
- ba: (_ea = __props.goodsFields.price) == null ? void 0 : _ea.show
- }, ((_fa = __props.goodsFields.price) == null ? void 0 : _fa.show) ? common_vendor.e({
- bb: __props.data.spuPayType == 2
- }, __props.data.spuPayType == 2 ? {
- bc: common_assets._imports_0
- } : {}, {
- bd: common_vendor.t(common_vendor.unref(common_vendor.lodashExports.isArray)(__props.data.price) ? common_vendor.unref(sheep_hooks_useGoods.fen2yuan)(__props.data.price[0]) : common_vendor.unref(sheep_hooks_useGoods.fen2yuan)(__props.data.price)),
- be: common_vendor.s({
- color: __props.goodsFields.price.color
- }),
- bf: __props.data.promotionFee >= 0
- }, __props.data.promotionFee >= 0 ? {
- bg: common_vendor.t(common_vendor.unref(sheep_hooks_useGoods.fen2yuan)(__props.data.promotionFee))
- } : {}) : {}, {
- bh: common_vendor.t(salesAndStock.value),
- bi: common_vendor.s(elStyles.value),
- bj: common_vendor.o(onClick)
- }) : {});
- };
- }
- };
- const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-1c3d9e07"], ["__file", "D:/zx/mall-front-app/sheep/components/s-goods-column/s-goods-column.vue"]]);
- wx.createComponent(Component);
|