Files
mp-weixin-2811-xcx.aigc-qui…/components/diy-components/diy-goods-list.js

11 lines
14 KiB
JavaScript

(global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["components/diy-components/diy-goods-list"],{"2d73":function(o,e,t){},"47a0":function(o,e,t){"use strict";var l=t("2d73"),a=t.n(l);a.a},5931:function(o,e,t){"use strict";t.d(e,"b",(function(){return a})),t.d(e,"c",(function(){return n})),t.d(e,"a",(function(){return l}));var l={xSkeleton:function(){return Promise.all([t.e("common/vendor"),t.e("uni_modules/x-skeleton/components/x-skeleton/x-skeleton")]).then(t.bind(null,"1226"))},diyIcon:function(){return t.e("components/diy-components/diy-icon").then(t.bind(null,"8ba4"))}},a=function(){var o=this,e=o.$createElement,t=(o._self._c,"horizontal-slide"!=o.goodsValue.template?o.__map(o.list,(function(e,t){var l=o.__get_orig(e),a=o.$util.img(e.goods_image,{size:"large-mode"==o.goodsValue.template?"big":"mid"}),n=(o.goodsValue.goodsNameStyle.control||o.goodsValue.tag&&"hidden"!=o.goodsValue.tag.value||o.goodsValue.priceStyle.mainControl||o.goodsValue.priceStyle.lineControl||o.goodsValue.btnStyle.control)&&o.goodsValue.priceStyle.mainControl?o.showPrice(e).split("."):null,i=(o.goodsValue.goodsNameStyle.control||o.goodsValue.tag&&"hidden"!=o.goodsValue.tag.value||o.goodsValue.priceStyle.mainControl||o.goodsValue.priceStyle.lineControl||o.goodsValue.btnStyle.control)&&o.goodsValue.priceStyle.mainControl?o.showPrice(e).split("."):null,r=o.goodsValue.goodsNameStyle.control||o.goodsValue.tag&&"hidden"!=o.goodsValue.tag.value||o.goodsValue.priceStyle.mainControl||o.goodsValue.priceStyle.lineControl||o.goodsValue.btnStyle.control?e.member_price&&e.member_price==o.showPrice(e)||1==e.promotion_type:null,s=(o.goodsValue.goodsNameStyle.control||o.goodsValue.tag&&"hidden"!=o.goodsValue.tag.value||o.goodsValue.priceStyle.mainControl||o.goodsValue.priceStyle.lineControl||o.goodsValue.btnStyle.control)&&r?e.member_price&&e.member_price==o.showPrice(e):null,d=(o.goodsValue.goodsNameStyle.control||o.goodsValue.tag&&"hidden"!=o.goodsValue.tag.value||o.goodsValue.priceStyle.mainControl||o.goodsValue.priceStyle.lineControl||o.goodsValue.btnStyle.control)&&r&&s?o.$util.img("public/uniapp/index/VIP.png"):null,u=(o.goodsValue.goodsNameStyle.control||o.goodsValue.tag&&"hidden"!=o.goodsValue.tag.value||o.goodsValue.priceStyle.mainControl||o.goodsValue.priceStyle.lineControl||o.goodsValue.btnStyle.control)&&r&&!s&&1==e.promotion_type?o.$util.img("public/uniapp/index/discount.png"):null,g=o.goodsValue.goodsNameStyle.control||o.goodsValue.tag&&"hidden"!=o.goodsValue.tag.value||o.goodsValue.priceStyle.mainControl||o.goodsValue.priceStyle.lineControl||o.goodsValue.btnStyle.control?o.goodsValue.priceStyle.lineControl&&o.showMarketPrice(e):null,c=(o.goodsValue.goodsNameStyle.control||o.goodsValue.tag&&"hidden"!=o.goodsValue.tag.value||o.goodsValue.priceStyle.mainControl||o.goodsValue.priceStyle.lineControl||o.goodsValue.btnStyle.control)&&g?o.showMarketPrice(e):null;return{$orig:l,g0:a,g1:n,g2:i,m0:r,m1:s,g3:d,g4:u,m2:g,m3:c}})):null),l="horizontal-slide"==o.goodsValue.template&&"scroll"==o.goodsValue.slideMode?o.__map(o.list,(function(e,t){var l=o.__get_orig(e),a=o.$util.img(e.goods_image,{size:"mid"}),n=(o.goodsValue.goodsNameStyle.control||o.goodsValue.tag&&"hidden"!=o.goodsValue.tag.value||o.goodsValue.priceStyle.mainControl||o.goodsValue.priceStyle.lineControl)&&o.goodsValue.priceStyle.mainControl?o.showPrice(e).split("."):null,i=(o.goodsValue.goodsNameStyle.control||o.goodsValue.tag&&"hidden"!=o.goodsValue.tag.value||o.goodsValue.priceStyle.mainControl||o.goodsValue.priceStyle.lineControl)&&o.goodsValue.priceStyle.mainControl?o.showPrice(e).split("."):null,r=o.goodsValue.goodsNameStyle.control||o.goodsValue.tag&&"hidden"!=o.goodsValue.tag.value||o.goodsValue.priceStyle.mainControl||o.goodsValue.priceStyle.lineControl?e.member_price&&e.member_price==o.showPrice(e)||1==e.promotion_type:null,s=(o.goodsValue.goodsNameStyle.control||o.goodsValue.tag&&"hidden"!=o.goodsValue.tag.value||o.goodsValue.priceStyle.mainControl||o.goodsValue.priceStyle.lineControl)&&r?e.member_price&&e.member_price==o.showPrice(e):null,d=(o.goodsValue.goodsNameStyle.control||o.goodsValue.tag&&"hidden"!=o.goodsValue.tag.value||o.goodsValue.priceStyle.mainControl||o.goodsValue.priceStyle.lineControl)&&r&&s?o.$util.img("public/uniapp/index/VIP.png"):null,u=(o.goodsValue.goodsNameStyle.control||o.goodsValue.tag&&"hidden"!=o.goodsValue.tag.value||o.goodsValue.priceStyle.mainControl||o.goodsValue.priceStyle.lineControl)&&r&&!s&&1==e.promotion_type?o.$util.img("public/uniapp/index/discount.png"):null,g=o.goodsValue.goodsNameStyle.control||o.goodsValue.tag&&"hidden"!=o.goodsValue.tag.value||o.goodsValue.priceStyle.mainControl||o.goodsValue.priceStyle.lineControl?o.goodsValue.priceStyle.lineControl&&o.showMarketPrice(e):null,c=(o.goodsValue.goodsNameStyle.control||o.goodsValue.tag&&"hidden"!=o.goodsValue.tag.value||o.goodsValue.priceStyle.mainControl||o.goodsValue.priceStyle.lineControl)&&g?o.showMarketPrice(e):null;return{$orig:l,g5:a,g6:n,g7:i,m4:r,m5:s,g8:d,g9:u,m6:g,m7:c}})):null,a="horizontal-slide"==o.goodsValue.template&&"slide"==o.goodsValue.slideMode?o.__map(o.page,(function(e,t){var l=o.__get_orig(e),a=o.list.length&&[o.list[t].length/3]>=1&&"flex-between",n=o.__map(o.list[t],(function(e,t){var l=o.__get_orig(e),a=o.$util.img(e.goods_image,{size:"mid"}),n=(o.goodsValue.goodsNameStyle.control||o.goodsValue.tag&&"hidden"!=o.goodsValue.tag.value||o.goodsValue.priceStyle.mainControl||o.goodsValue.priceStyle.lineControl)&&o.goodsValue.priceStyle.mainControl?o.showPrice(e).split("."):null,i=(o.goodsValue.goodsNameStyle.control||o.goodsValue.tag&&"hidden"!=o.goodsValue.tag.value||o.goodsValue.priceStyle.mainControl||o.goodsValue.priceStyle.lineControl)&&o.goodsValue.priceStyle.mainControl?o.showPrice(e).split("."):null,r=o.goodsValue.goodsNameStyle.control||o.goodsValue.tag&&"hidden"!=o.goodsValue.tag.value||o.goodsValue.priceStyle.mainControl||o.goodsValue.priceStyle.lineControl?e.member_price&&e.member_price==o.showPrice(e)||1==e.promotion_type:null,s=(o.goodsValue.goodsNameStyle.control||o.goodsValue.tag&&"hidden"!=o.goodsValue.tag.value||o.goodsValue.priceStyle.mainControl||o.goodsValue.priceStyle.lineControl)&&r?e.member_price&&e.member_price==o.showPrice(e):null,d=(o.goodsValue.goodsNameStyle.control||o.goodsValue.tag&&"hidden"!=o.goodsValue.tag.value||o.goodsValue.priceStyle.mainControl||o.goodsValue.priceStyle.lineControl)&&r&&s?o.$util.img("public/uniapp/index/VIP.png"):null,u=(o.goodsValue.goodsNameStyle.control||o.goodsValue.tag&&"hidden"!=o.goodsValue.tag.value||o.goodsValue.priceStyle.mainControl||o.goodsValue.priceStyle.lineControl)&&r&&!s&&1==e.promotion_type?o.$util.img("public/uniapp/index/discount.png"):null,g=o.goodsValue.goodsNameStyle.control||o.goodsValue.tag&&"hidden"!=o.goodsValue.tag.value||o.goodsValue.priceStyle.mainControl||o.goodsValue.priceStyle.lineControl?o.goodsValue.priceStyle.lineControl&&o.showMarketPrice(e):null,c=(o.goodsValue.goodsNameStyle.control||o.goodsValue.tag&&"hidden"!=o.goodsValue.tag.value||o.goodsValue.priceStyle.mainControl||o.goodsValue.priceStyle.lineControl)&&g?o.showMarketPrice(e):null;return{$orig:l,g11:a,g12:n,g13:i,m8:r,m9:s,g14:d,g15:u,m10:g,m11:c}}));return{$orig:l,g10:a,l2:n}})):null;o._isMounted||(o.e0=function(e,t){var l=arguments[arguments.length-1].currentTarget.dataset,a=l.eventParams||l["event-params"];t=a.item;return e.stopPropagation(),o.$refs.goodsSkuIndex.addCart(o.goodsValue.btnStyle.cartEvent,t,e)},o.e1=function(e,t){var l=arguments[arguments.length-1].currentTarget.dataset,a=l.eventParams||l["event-params"];t=a.item;return e.stopPropagation(),o.$refs.goodsSkuIndex.addCart(o.goodsValue.btnStyle.cartEvent,t,e)},o.e2=function(e,t){var l=arguments[arguments.length-1].currentTarget.dataset,a=l.eventParams||l["event-params"];t=a.item;return e.stopPropagation(),o.$refs.goodsSkuIndex.addCart(o.goodsValue.btnStyle.cartEvent,t,e)},o.e3=function(e,t){var l=arguments[arguments.length-1].currentTarget.dataset,a=l.eventParams||l["event-params"];t=a.item;return e.stopPropagation(),o.$refs.goodsSkuIndex.addCart(o.goodsValue.btnStyle.cartEvent,t,e)}),o.$mp.data=Object.assign({},{$root:{l0:t,l1:l,l3:a}})},n=[]},"5f0c3":function(o,e,t){"use strict";t.r(e);var l=t("5931"),a=t("f25f");for(var n in a)["default"].indexOf(n)<0&&function(o){t.d(e,o,(function(){return a[o]}))}(n);t("47a0");var i=t("828b"),r=Object(i["a"])(a["default"],l["b"],l["c"],!1,null,"1878217b",null,!1,l["a"],void 0);e["default"]=r.exports},a878:function(o,e,t){"use strict";(function(o){Object.defineProperty(e,"__esModule",{value:!0}),e.default=void 0;var l={name:"diy-goods-list",components:{nsGoodsSkuIndex:function(){t.e("components/ns-goods-sku/ns-goods-sku-index").then(function(){return resolve(t("91d0"))}.bind(null,t)).catch(t.oe)}},props:{value:{type:Object,default:function(){return{}}}},data:function(){return{loading:!0,skeletonType:"",skeletonConfig:{},list:[],goodsValue:{},page:1,carIconList:{},cartAnimation:{},lang:o.getStorageSync("lang")}},created:function(){this.goodsValue=this.value,this.initSkeleton(),this.getGoodsList()},watch:{"globalStoreInfo.store_id":{handler:function(o,e){o!=e&&this.getGoodsList()},deep:!0},componentRefresh:function(o){this.getGoodsList()}},computed:{goodsListWarpCss:function(){var o="";return o+="background-color:"+this.goodsValue.componentBgColor+";","round"==this.goodsValue.componentAngle&&(o+="border-top-left-radius:"+2*this.goodsValue.topAroundRadius+"rpx;",o+="border-top-right-radius:"+2*this.goodsValue.topAroundRadius+"rpx;",o+="border-bottom-left-radius:"+2*this.goodsValue.bottomAroundRadius+"rpx;",o+="border-bottom-right-radius:"+2*this.goodsValue.bottomAroundRadius+"rpx;"),o},goodsItemCss:function(){var e="";e+="background-color:"+this.goodsValue.elementBgColor+";","round"==this.goodsValue.elementAngle&&(e+="border-top-left-radius:"+2*this.goodsValue.topElementAroundRadius+"rpx;",e+="border-top-right-radius:"+2*this.goodsValue.topElementAroundRadius+"rpx;",e+="border-bottom-left-radius:"+2*this.goodsValue.bottomElementAroundRadius+"rpx;",e+="border-bottom-right-radius:"+2*this.goodsValue.bottomElementAroundRadius+"rpx;"),"shadow"==this.goodsValue.ornament.type&&(e+="box-shadow:0 0 10rpx "+this.goodsValue.ornament.color+";"),"stroke"==this.goodsValue.ornament.type&&(e+="border:2rpx solid "+this.goodsValue.ornament.color+";");var t=o.getSystemInfoSync().windowWidth;if("horizontal-slide"==this.value.template){var l="";l="scroll"==this.value.slideMode&&"diy"==this.value.goodsMarginType?this.rpxUpPx(2*this.value.goodsMarginNum):[t-2*this.rpxUpPx(20)-3*this.rpxUpPx(200)-2*this.rpxUpPx(2*this.value.margin.both)]/6,e+="margin-left:"+l+"px;",e+="margin-right:"+l+"px;"}return e},swiperHeight:function(){return"multiple"==this.value.nameLineMode?"shadow"==this.value.ornament.type?"414rpx":"402rpx":"shadow"==this.value.ornament.type?"370rpx":"358rpx"},cartPosition:function(){return this.$store.state.cartPosition}},methods:{initSkeleton:function(){"row1-of1"==this.goodsValue.template?(this.skeletonType="list",this.skeletonConfig={}):"row1-of2"==this.goodsValue.template?(this.skeletonType="waterfall",this.skeletonConfig={headHeight:"320rpx",textRows:2,textWidth:["100%","80%"]}):"row1-of3"==this.goodsValue.template?(this.skeletonType="waterfall",this.skeletonConfig={gridColumns:3,headHeight:"200rpx",textRows:2,textWidth:["100%","80%"]}):"horizontal-slide"==this.goodsValue.template?(this.skeletonType="waterfall",this.skeletonConfig={gridRows:1,gridColumns:3,headHeight:"200rpx",textRows:2,textWidth:["100%","80%"]}):"large-mode"==this.goodsValue.template&&(this.skeletonType="list",this.skeletonConfig={itemDirection:"column",headWidth:"100%",headHeight:"320rpx",textRows:2,textWidth:["100%","80%"]})},rpxUpPx:function(e){var t=o.getSystemInfoSync().windowWidth,l=t*parseInt(e)/750;return Math.floor(l)},getGoodsList:function(){var o=this,e={num:this.goodsValue.count};"category"==this.goodsValue.sources?(e.category_id=this.goodsValue.categoryId,e.category_level=1):"diy"==this.goodsValue.sources&&(e.num=0,e.goods_id_arr=this.goodsValue.goodsId.toString()),e.order=this.goodsValue.sortWay,this.$api.sendRequest({url:"/api/goodssku/components",data:e,success:function(e){if(0==e.code&&e.data){var t=e.data;if(o.list=t.map((function(e){return e.id=o.genNonDuplicate(),e})),"horizontal-slide"==o.goodsValue.template&&"slide"==o.goodsValue.slideMode){var l=[];o.page=Math.ceil(o.list.length/3);for(var a=0;a<o.page;a++){l[a]=[];for(var n=3*a;n<o.list.length;n++){if(3==l[a].length)break;l[a].push(o.list[n])}}o.list=l}}o.loading=!1}})},toDetail:function(o){this.$util.redirectTo("/pages/goods/detail",{goods_id:o.goods_id})},imgError:function(o){this.list[o]&&(this.list[o].goods_image=this.$util.getDefaultImage().goods)},showPrice:function(o){var e=o.discount_price;return o.member_price&&parseFloat(o.member_price)<parseFloat(e)&&(e=o.member_price),e},showMarketPrice:function(o){var e=this.showPrice(o);return o.market_price>0?o.market_price:parseFloat(o.price)>parseFloat(e)?o.price:""},addCartPoint:function(e){var t=this;if(this.cartPosition){var l=o.createSelectorQuery().in(this);l.select("#"+e+" .click-event").boundingClientRect((function(o){if(o){var e=o.left,l=o.top;if(e<t.cartPosition.left)var a=[{x:e,y:l},{x:e+50,y:l-150},{x:t.cartPosition.left,y:t.cartPosition.top}];else a=[{x:e,y:l},{x:e-50,y:l-150},{x:t.cartPosition.left,y:t.cartPosition.top}];var n=(new Date).getTime();t.$set(t.carIconList,n,{left:e,top:l,index:0,bezierPos:t.$util.bezier(a,6).bezier_points,timer:null}),t.startAnimation(n)}})).exec()}},startAnimation:function(e){var t=this,l=this.carIconList[e].bezierPos,a=this.carIconList[e].index;this.carIconList[e].timer=setInterval((function(){if(a<6)t.carIconList[e].left=l[a].x,t.carIconList[e].top=l[a].y,a++;else{clearInterval(t.carIconList[e].timer),delete t.carIconList[e],t.$forceUpdate();var n=o.createAnimation({duration:200,timingFunction:"ease"});n.scale(1.2).step(),t.cartAnimation=n.export(),setTimeout((function(){n.scale(1).step(),t.cartAnimation=n.export()}),300)}}),50)},genNonDuplicate:function(){var o=arguments.length>0&&void 0!==arguments[0]?arguments[0]:6;return Number(Math.random().toString().substr(3,o)+Date.now()).toString(36)}}};e.default=l}).call(this,t("df3c")["default"])},f25f:function(o,e,t){"use strict";t.r(e);var l=t("a878"),a=t.n(l);for(var n in l)["default"].indexOf(n)<0&&function(o){t.d(e,o,(function(){return l[o]}))}(n);e["default"]=a.a}}]);
;(global["webpackJsonp"] = global["webpackJsonp"] || []).push([
'components/diy-components/diy-goods-list-create-component',
{
'components/diy-components/diy-goods-list-create-component':(function(module, exports, __webpack_require__){
__webpack_require__('df3c')['createComponent'](__webpack_require__("5f0c3"))
})
},
[['components/diy-components/diy-goods-list-create-component']]
]);