bztang-admin/addons/yun_shop/static/app/js/chunk-0da5c316.a30be348.js

1 line
8.1 KiB
JavaScript

(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-0da5c316"],{"0843":function(t,o,e){var s=e("f822");s.__esModule&&(s=s.default),"string"===typeof s&&(s=[[t.i,s,""]]),s.locals&&(t.exports=s.locals);var i=e("499e").default;i("0d02602d",s,!0,{sourceMap:!1,shadowMode:!1})},"85a7":function(t,o,e){"use strict";e("0843")},"90a9":function(t,o,e){"use strict";e.r(o);var s=function(){var t=this,o=t.$createElement,e=t._self._c||o;return e("div",{staticClass:"chainStoreSearch"},[e("c-title",{ref:"soso",attrs:{hide:!1,text:"搜索",id:"soso"}}),e("div",{staticClass:"searchInp"},[e("van-search",{attrs:{placeholder:"请输入搜索关键词",shape:"round"},on:{focus:t.hidebox,blur:t.searchBlur,search:t.getData},model:{value:t.keyWork,callback:function(o){t.keyWork=o},expression:"keyWork"}})],1),e("div",{directives:[{name:"show",rawName:"v-show",value:t.pageReload,expression:"pageReload"}]}),e("transition",{attrs:{name:"fateOut"},on:{enter:t.fateOutEnter,"after-leave":t.fateOutLeave}},[e("sarchHistory",{directives:[{name:"show",rawName:"v-show",value:t.showHistory,expression:"showHistory"}],ref:"searchHistory",attrs:{storageName:t.storageName},on:{clickTag:t.serachTag,popTag:t.getSosoHeight}})],1),e("div",{staticClass:"list"},t._l(t.info,(function(o,s){return e("div",{key:s,staticClass:"lis",on:{click:function(e){return t.childGoodTap(o.id)}}},[e("div",{staticClass:"left"},[e("img",{attrs:{src:o.thumb,alt:""}})]),e("div",{staticClass:"right"},[e("div",{staticClass:"title"},[t._v(t._s(o.title))]),e("div",{staticClass:"price"},[t._v("¥"+t._s(o.price))])])])})),0),t.showGood?e("yzGoodsPopup",{attrs:{store_id:t.store_id,cardata:t.carts,goodsCartsTotal:t.goodsCartsTotal,roundShow:!0,_goodsInfo:t._goodsInfo,showgp:t.showGood,goodsInfo:t.activeGood,themeColor:t.themeColor,cartsNum:t.cartsNum,cartsTotal:t.cartsTotal,tag:"search"},on:{updateChild:t.getCart,onEmit:t.yzGoodsPopupClose,toOrder:t.goodsOrder,cartUpdate:t.getCart}}):t._e()],1)},i=[],a=(e("b64b"),e("d3b7"),e("159b"),e("14d9"),e("99af"),e("a9e3"),e("b680"),e("69e3")),r=e("ac0d"),n=e("969d"),l={mixins:[r["a"]],data:function(){return{keyWork:"",storageName:"chainStore",showHistory:!1,searchHistoryList:"",pageReload:!1,info:[],store_id:"",carts:[],goodsCartsTotal:[],_goodsInfo:[],showGood:!1,activeGood:[],themeColor:"",cartsNum:[],cartsTotal:[],isLoadMore:!0,page:1,total_page:0}},components:{sarchHistory:a["a"],yzGoodsPopup:n["a"]},activated:function(){this.$route.params.keyword&&(this.keyWork=this.$route.params.keyword),this.$route.params.store_id&&(this.store_id=this.$route.params.store_id),this.getData(),this.getCart(),this.themeColor=JSON.parse(localStorage.getItem("yz_basic_info")).theme_color||""},methods:{goodsOrder:function(t){var o=this.carts,e=0;(t||this.isHasDifferType(o))&&(this.carts.forEach((function(t){e+=t.total})),0!=e?0!=o.length&&0!=this.carts.length&&this.$router.push(this.fun.getUrl("goodsorder",{},{store_id:this.store_id,tag:"store"})):this.$toast("购物车暂无商品"))},isHasDifferType:function(t){var o=this,e=0,s=0,i="";return t.forEach((function(t){t.live_install&&1==t.live_install.open_state?(e+=1,i=t.live_install.plugin_name):s+=1})),0==e||0==s||(Dialog.confirm({title:"提示",message:"普通商品与".concat(i,"商品一同下单将无法享受").concat(i,",是否继续下单?")}).then((function(){o.goodsOrder(t,!0)})).catch((function(){})),!1)},childGoodTap:function(t){var o=this;$http.post("goods.goods.get-goods-page",{id:Number(t)},"").then((function(t){var e=t.data,s=t.msg,i=t.result;0!=i?(o._goodsInfo=e,o.activeGood=e.get_goods,o.showGood=!0):o.$toast(s)}))},yzGoodsPopupClose:function(){this.showGood=!1,this.activeGood={}},serachTag:function(t){this.keyWork=t,this.getData()},fateOutEnter:function(){this.getSosoHeight()},fateOutLeave:function(){this.getSosoHeight()},hidebox:function(){this.searchHistoryList=window.localStorage.getItem(this.storageName)?JSON.parse(window.localStorage.getItem(this.storageName)):[],this.searchHistoryList.length>0&&(this.showHistory=!0)},getSosoHeight:function(){var t=this;this.pageReload=!this.pageReload,this.$nextTick((function(){t.sosoH=t.$refs.soso.offsetHeight}))},searchBlur:function(){this.showHistory=!1},getData:function(){var t=this;this.$refs.searchHistory&&this.keyWork&&(this.$refs.searchHistory.appendKeywords(this.keyWork),this.getSosoHeight()),$http.get("plugin.chain-store.frontend.controller.index.search-goods",{keyword:this.keyWork,store_id:this.$route.params.store_id},"").then((function(o){1===o.result?(t.info=o.data.list.data,t.isLoadMore=!0,t.total_page=o.data.list.last_page):t.$toast(o.msg)}),(function(t){}))},getMoreData:function(){var t=this;if(this.isLoadMore=!1,!(this.page>=this.total_page)){this.page=this.page+1;var o={page:this.page,keyword:this.keyWork,store_id:this.$route.params.store_id};$http.get("plugin.chain-store.frontend.controller.index.search-goods",o," ").then((function(o){if(1===o.result){var e=o.data.list.data;t.info=t.info.concat(e),t.isLoadMore=!0,t.total_page=o.data.list.last_page}else t.$toast(o.msg)}),(function(t){}))}},getCart:function(t){var o=this,e=this;$http.get("plugin.store-cashier.frontend.shoppingCart.member-cart.index",{store_id:this.store_id}).then((function(t){1===t.result&&(e.carts=t.data,e.goodsCarts=[],e.cartsNum=0,e.cartsTotal=0,e.carts.forEach((function(t){o.$set(e.goodsCarts,t.goods_id,t),e.cartsNum+=t.total,e.cartsTotal+=t.total*t.goods.price})),e.goodsCartsTotal=e.calculateTotal(e.carts),e.cartsTotal=parseFloat(e.cartsTotal).toFixed(2))}),(function(t){})).catch((function(t){}))},calculateTotal:function(t){var o=this,e=[],s={},i=[];for(var a in t){var r=t[a].goods_id;s[r]?s[r].total=s[r].total+t[a].total:(s[r]={},s[r].goods_id=t[a].goods_id,s[r].total=t[a].total)}for(var n in s)e.push(s[n]);return e.forEach((function(t){o.$set(i,t.goods_id,t)})),i}}},c=l,d=(e("85a7"),e("2877")),h=Object(d["a"])(c,s,i,!1,null,"3120b728",null);o["default"]=h.exports},ac0d:function(t,o,e){"use strict";e.d(o,"a",(function(){return a}));var s=document.documentElement,i=document.body,a={data:function(){return{}},activated:function(){window.addEventListener("scroll",this.handleScroll)},deactivated:function(){window.removeEventListener("scroll",this.handleScroll)},methods:{getScrollTop:function(){var t=0;return s&&s.scrollTop?t=s.scrollTop:i&&(t=i.scrollTop),t},getClientHeight:function(){var t=0;return t=i.clientHeight&&s.clientHeight?Math.min(i.clientHeight,s.clientHeight):Math.max(i.clientHeight,s.clientHeight),t},getScrollHeight:function(){return Math.max(i.scrollHeight,s.scrollHeight)},handleScroll:function(){this.otherScroll();var t=document.documentElement.scrollTop||document.body.scrollTop;this.btnFlag=t>60,this.getScrollTop()+this.getClientHeight()+105>this.getScrollHeight()?(this.isLoadMore&&this.getMoreData(),this.isBottom=!0):this.isBottom=!1},otherScroll:function(){}}}},f822:function(t,o,e){var s=e("24fb");o=s(!1),o.push([t.i,".chainStoreSearch[data-v-3120b728]{background:#fff}.searchInp .van-search[data-v-3120b728]{padding:.5rem .75rem}.list[data-v-3120b728]{padding:.53rem .75rem;-webkit-box-sizing:border-box;box-sizing:border-box;background:#fff;padding-bottom:3rem}.list .lis[data-v-3120b728]{margin-bottom:.63rem;padding:.75rem;-webkit-box-sizing:border-box;box-sizing:border-box}.list .lis[data-v-3120b728],.list .lis .right[data-v-3120b728]{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex}.list .lis .right[data-v-3120b728]{-webkit-box-orient:vertical;-webkit-box-direction:normal;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;-webkit-box-pack:justify;-webkit-justify-content:space-between;-ms-flex-pack:justify;justify-content:space-between}.list .lis .right .title[data-v-3120b728]{display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden;text-align:left;font-weight:500;color:#3b3b4a}.list .lis .right .price[data-v-3120b728]{font-size:1rem;font-weight:500;color:#f15353;text-align:left}.list .lis .left[data-v-3120b728]{-webkit-flex-shrink:0;-ms-flex-negative:0;flex-shrink:0;width:4.38rem;height:4.38rem;border-radius:.5rem;margin-right:.63rem}.list .lis .left img[data-v-3120b728]{width:100%;height:100%;border-radius:.5rem}",""]),t.exports=o}}]);