123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398 |
- "use strict";
- const common_vendor = require("../../../common/vendor.js");
- const sheep_index = require("../../index.js");
- const sheep_hooks_useGoods = require("../../hooks/useGoods.js");
- require("../../url/index.js");
- require("../../store/index.js");
- require("../../store/app.js");
- require("../../api/promotion/diy.js");
- require("../../request/index.js");
- require("../../config/index.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("../../helper/throttle.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("../../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 },
- // 市场价
- marketPrice: { 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: emits }) {
- const props = __props;
- common_vendor.reactive({});
- 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 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, _ga, _ha, _ia, _ja, _ka, _la, _ma, _na, _oa, _pa, _qa, _ra;
- 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) ? {
- j: common_vendor.t(__props.priceUnit),
- k: 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)),
- l: common_vendor.s({
- color: __props.goodsFields.price.color
- })
- } : {}) : {}, {
- m: common_vendor.s(common_vendor.unref(elStyles)),
- n: common_vendor.o(onClick)
- }) : {}, {
- o: __props.size === "sm"
- }, __props.size === "sm" ? common_vendor.e({
- p: __props.tagStyle.show
- }, __props.tagStyle.show ? {
- q: common_vendor.unref(sheep_index.sheep).$url.cdn(__props.tagStyle.src || __props.tagStyle.imgUrl)
- } : {}, {
- r: common_vendor.unref(sheep_index.sheep).$url.cdn(__props.data.image || __props.data.picUrl),
- s: ((_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({
- t: ((_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) ? {
- v: common_vendor.t(__props.data.title || __props.data.name)
- } : {}, {
- w: (_w = __props.goodsFields.price) == null ? void 0 : _w.show
- }, ((_x = __props.goodsFields.price) == null ? void 0 : _x.show) ? {
- x: common_vendor.t(__props.priceUnit),
- y: 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)),
- z: common_vendor.s({
- color: __props.goodsFields.price.color
- })
- } : {}, {
- A: common_vendor.s({
- color: __props.titleColor,
- width: __props.titleWidth ? __props.titleWidth + "rpx" : ""
- })
- }) : {}, {
- B: common_vendor.s(common_vendor.unref(elStyles)),
- C: common_vendor.o(onClick)
- }) : {}, {
- D: __props.size === "md"
- }, __props.size === "md" ? common_vendor.e({
- E: __props.tagStyle.show
- }, __props.tagStyle.show ? {
- F: common_vendor.unref(sheep_index.sheep).$url.cdn(__props.tagStyle.src || __props.tagStyle.imgUrl)
- } : {}, {
- G: common_vendor.unref(sheep_index.sheep).$url.cdn(__props.data.image || __props.data.picUrl),
- H: ((_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) ? {
- I: common_vendor.t(__props.data.title || __props.data.name),
- J: common_vendor.s({
- color: __props.titleColor,
- width: __props.titleWidth ? __props.titleWidth + "rpx" : ""
- })
- } : {}, {
- K: ((_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) ? {
- L: common_vendor.t(__props.data.subtitle || __props.data.introduction),
- M: common_vendor.s({
- color: __props.subTitleColor,
- background: __props.subTitleBackground
- })
- } : {}, {
- N: (_G = __props.data.promos) == null ? void 0 : _G.length
- }, ((_H = __props.data.promos) == null ? void 0 : _H.length) ? {
- O: common_vendor.f(__props.data.promos, (item, k0, i0) => {
- return {
- a: common_vendor.t(item.title),
- b: item.id
- };
- })
- } : {}, {
- P: (_I = __props.goodsFields.price) == null ? void 0 : _I.show
- }, ((_J = __props.goodsFields.price) == null ? void 0 : _J.show) ? {
- Q: common_vendor.t(__props.priceUnit),
- R: 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)),
- S: common_vendor.s({
- color: __props.goodsFields.price.color
- })
- } : {}, {
- T: (((_K = __props.goodsFields.original_price) == null ? void 0 : _K.show) || ((_L = __props.goodsFields.marketPrice) == null ? void 0 : _L.show)) && (__props.data.original_price > 0 || __props.data.marketPrice > 0)
- }, (((_M = __props.goodsFields.original_price) == null ? void 0 : _M.show) || ((_N = __props.goodsFields.marketPrice) == null ? void 0 : _N.show)) && (__props.data.original_price > 0 || __props.data.marketPrice > 0) ? {
- U: common_vendor.t(__props.priceUnit),
- V: common_vendor.t(common_vendor.unref(sheep_hooks_useGoods.fen2yuan)(__props.data.marketPrice)),
- W: common_vendor.s({
- color: __props.originPriceColor
- })
- } : {}, {
- X: common_vendor.t(common_vendor.unref(salesAndStock)),
- Y: elId,
- Z: common_vendor.s(common_vendor.unref(elStyles)),
- aa: common_vendor.o(onClick)
- }) : {}, {
- ab: __props.size === "lg"
- }, __props.size === "lg" ? common_vendor.e({
- ac: __props.tagStyle.show
- }, __props.tagStyle.show ? {
- ad: common_vendor.unref(sheep_index.sheep).$url.cdn(__props.tagStyle.src || __props.tagStyle.imgUrl)
- } : {}, {
- ae: __props.seckillTag
- }, __props.seckillTag ? {} : {}, {
- af: __props.grouponTag
- }, __props.grouponTag ? {} : {}, {
- ag: common_vendor.unref(sheep_index.sheep).$url.cdn(__props.data.image || __props.data.picUrl),
- ah: ((_O = __props.goodsFields.title) == null ? void 0 : _O.show) || ((_P = __props.goodsFields.name) == null ? void 0 : _P.show)
- }, ((_Q = __props.goodsFields.title) == null ? void 0 : _Q.show) || ((_R = __props.goodsFields.name) == null ? void 0 : _R.show) ? {
- ai: common_vendor.t(__props.data.title || __props.data.name),
- aj: common_vendor.s({
- color: __props.titleColor
- })
- } : {}, {
- ak: ((_S = __props.goodsFields.subtitle) == null ? void 0 : _S.show) || ((_T = __props.goodsFields.introduction) == null ? void 0 : _T.show)
- }, ((_U = __props.goodsFields.subtitle) == null ? void 0 : _U.show) || ((_V = __props.goodsFields.introduction) == null ? void 0 : _V.show) ? {
- al: common_vendor.t(__props.data.subtitle || __props.data.introduction),
- am: common_vendor.s({
- color: __props.subTitleColor,
- background: __props.subTitleBackground
- })
- } : {}, {
- an: (_W = __props.data.promos) == null ? void 0 : _W.length
- }, ((_X = __props.data.promos) == null ? void 0 : _X.length) ? {
- ao: common_vendor.f(__props.data.promos, (item, k0, i0) => {
- return {
- a: common_vendor.t(item.title),
- b: item.id
- };
- })
- } : {}, {
- ap: (_Y = __props.goodsFields.price) == null ? void 0 : _Y.show
- }, ((_Z = __props.goodsFields.price) == null ? void 0 : _Z.show) ? {
- aq: common_vendor.t(__props.priceUnit),
- ar: 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)),
- as: common_vendor.s({
- color: __props.goodsFields.price.color
- })
- } : {}, {
- at: (((__ = __props.goodsFields.original_price) == null ? void 0 : __.show) || ((_$ = __props.goodsFields.marketPrice) == null ? void 0 : _$.show)) && (__props.data.original_price > 0 || __props.data.marketPrice > 0)
- }, (((_aa = __props.goodsFields.original_price) == null ? void 0 : _aa.show) || ((_ba = __props.goodsFields.marketPrice) == null ? void 0 : _ba.show)) && (__props.data.original_price > 0 || __props.data.marketPrice > 0) ? {
- av: common_vendor.t(__props.priceUnit),
- aw: common_vendor.t(common_vendor.unref(sheep_hooks_useGoods.fen2yuan)(__props.data.marketPrice)),
- ax: common_vendor.s({
- color: __props.originPriceColor
- })
- } : {}, {
- ay: common_vendor.t(common_vendor.unref(salesAndStock)),
- az: __props.buttonShow
- }, __props.buttonShow ? {} : {}, {
- aA: common_vendor.s(common_vendor.unref(elStyles)),
- aB: common_vendor.o(onClick)
- }) : {}, {
- aC: __props.size === "sl"
- }, __props.size === "sl" ? common_vendor.e({
- aD: __props.tagStyle.show
- }, __props.tagStyle.show ? {
- aE: common_vendor.unref(sheep_index.sheep).$url.cdn(__props.tagStyle.src || __props.tagStyle.imgUrl)
- } : {}, {
- aF: common_vendor.unref(sheep_index.sheep).$url.cdn(__props.data.image || __props.data.picUrl),
- aG: ((_ca = __props.goodsFields.title) == null ? void 0 : _ca.show) || ((_da = __props.goodsFields.name) == null ? void 0 : _da.show)
- }, ((_ea = __props.goodsFields.title) == null ? void 0 : _ea.show) || ((_fa = __props.goodsFields.name) == null ? void 0 : _fa.show) ? {
- aH: common_vendor.t(__props.data.title || __props.data.name),
- aI: common_vendor.s({
- color: __props.titleColor
- })
- } : {}, {
- aJ: ((_ga = __props.goodsFields.subtitle) == null ? void 0 : _ga.show) || ((_ha = __props.goodsFields.introduction) == null ? void 0 : _ha.show)
- }, ((_ia = __props.goodsFields.subtitle) == null ? void 0 : _ia.show) || ((_ja = __props.goodsFields.introduction) == null ? void 0 : _ja.show) ? {
- aK: common_vendor.t(__props.data.subtitle || __props.data.introduction),
- aL: common_vendor.s({
- color: __props.subTitleColor,
- background: __props.subTitleBackground
- })
- } : {}, {
- aM: (_ka = __props.data.promos) == null ? void 0 : _ka.length
- }, ((_la = __props.data.promos) == null ? void 0 : _la.length) ? {
- aN: common_vendor.f(__props.data.promos, (item, k0, i0) => {
- return {
- a: common_vendor.t(item.title),
- b: item.id
- };
- })
- } : {}, {
- aO: (_ma = __props.goodsFields.price) == null ? void 0 : _ma.show
- }, ((_na = __props.goodsFields.price) == null ? void 0 : _na.show) ? common_vendor.e({
- aP: common_vendor.t(__props.priceUnit),
- aQ: 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)),
- aR: common_vendor.s({
- color: __props.goodsFields.price.color
- }),
- aS: (((_oa = __props.goodsFields.original_price) == null ? void 0 : _oa.show) || ((_pa = __props.goodsFields.marketPrice) == null ? void 0 : _pa.show)) && (__props.data.original_price > 0 || __props.data.marketPrice > 0)
- }, (((_qa = __props.goodsFields.original_price) == null ? void 0 : _qa.show) || ((_ra = __props.goodsFields.marketPrice) == null ? void 0 : _ra.show)) && (__props.data.original_price > 0 || __props.data.marketPrice > 0) ? {
- aT: common_vendor.t(__props.priceUnit),
- aU: common_vendor.t(common_vendor.unref(sheep_hooks_useGoods.fen2yuan)(__props.data.marketPrice)),
- aV: common_vendor.s({
- color: __props.originPriceColor
- })
- } : {}) : {}, {
- aW: common_vendor.t(common_vendor.unref(salesAndStock)),
- aX: common_vendor.s(common_vendor.unref(elStyles)),
- aY: common_vendor.o(onClick)
- }) : {});
- };
- }
- };
- const Component = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["__scopeId", "data-v-1c3d9e07"], ["__file", "/Users/RuHu.Xu/Desktop/mall-newfeifan-zx-app/sheep/components/s-goods-column/s-goods-column.vue"]]);
- wx.createComponent(Component);
|