bztang-admin/addons/yun_shop/static/app/js/chunk-a9a5db64.60cd684d.js

1 line
18 KiB
JavaScript

(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-a9a5db64"],{"43be":function(t,e,i){"use strict";i.r(e);var o=function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",{style:{"--color":""+t.themeColor},attrs:{id:"storePriceTagIndex"}},[i("c-title",{attrs:{hide:!1,text:"自助买单"}}),i("div",{staticClass:"scanCode"},[t.storeInfo.store_info?i("div",{staticClass:"storeDetail"},[i("img",{attrs:{src:t.storeInfo.store_info.store_thumb,alt:""}}),i("div",{staticClass:"storeName"},[t._v(t._s(t.storeInfo.store_info.store_name))])]):t._e(),i("div",{staticClass:"codeImg",on:{click:t.toScanCode}},[t._m(0),i("div",{staticClass:"txt"},[t._v("请扫码签码或条形码")])])]),i("div",{staticClass:"shoplistHead"},[i("div",{staticClass:"left"},[t._v("我的商品列表")]),i("div",{staticClass:"right",on:{click:t.clearCart}},[i("img",{attrs:{src:"https://mini-app-img-1251768088.cos.ap-guangzhou.myqcloud.com/storePriceTag%2Fdelete.png",alt:""}}),t._v(" 全部清空 ")])]),i("div",{staticClass:"forBox"},t._l(t.carts,(function(e,o){return i("div",{key:o,staticClass:"shopLis"},[e.goods?i("div",{staticClass:"left"},[i("img",{attrs:{src:e.goods.thumb,alt:""}})]):t._e(),e.goods?i("div",{staticClass:"right"},[i("div",{staticClass:"title"},[t._v(t._s(e.goods.title))]),i("div",{staticClass:"specification"},[i("div",{staticClass:"txt"},[t._v(t._s(e.goods_option?e.goods_option.title:""))]),i("div",{staticClass:"editCount"},[i("div",{staticClass:"cut",on:{click:function(i){return i.stopPropagation(),t.CutTap(e)}}},[t._v("-")]),i("van-field",{attrs:{type:"digit","input-align":"center"},on:{focus:function(i){return t.clickCount(e.total)},blur:function(i){return t.changeCount(e.total,e.id)}},model:{value:e.total,callback:function(i){t.$set(e,"total",i)},expression:"item.total"}}),i("div",{staticClass:"add",on:{click:function(i){return i.stopPropagation(),t.AddTap(e,"cart",o)}}},[t._v("+")])],1)])]):t._e()])})),0),t.carts.legth<=0?i("div",{staticClass:"none set-pc-style"},[i("div",{staticClass:"noneBox"},[t._v("请扫码添加商品")])]):i("div",{staticClass:"btn set-pc-style"},[i("div",{staticClass:"left"},[t._v(" ¥"+t._s(t.cartsTotal)+" "),i("div",{staticClass:"txt"},[t._v("(共"+t._s(t.cartsNum)+"件商品)")])]),i("div",{staticClass:"right",on:{click:t.goodsOrder}},[t._v("去结算")])]),i("yz_goodsPopup",{attrs:{themeColor:t.themeColor,isScanCode:!0,goodsInfo:t.goodsInfo,addCartBtn:!1},on:{toOrderChild:t.toOrderChild,addCart:t.childAddCart,closeCart:t.closeCart},model:{value:t.goodsPopupShow,callback:function(e){t.goodsPopupShow=e},expression:"goodsPopupShow"}}),i("van-popup",{staticStyle:{width:"17.5rem",height:"15.875rem","border-radius":"0.25rem"},attrs:{closeable:""},on:{close:function(e){t.addShow=!1}},model:{value:t.addShow,callback:function(e){t.addShow=e},expression:"addShow"}},[i("div",{staticClass:"popView"},[i("div",{staticClass:"addShowTitle"},[t._v("加入购物车成功")]),i("img",{attrs:{src:"https://mini-app-img-1251768088.cos.ap-guangzhou.myqcloud.com/storePriceTag%2Fcart.png",alt:""}}),i("div",{staticClass:"codeTxt",on:{click:t.continueCode}},[t._v("继续扫码")]),i("div",{staticClass:"cart",on:{click:function(e){return t.closeShowAdd()}}},[t._v("查看购物车")])])])],1)},a=[function(){var t=this,e=t.$createElement,i=t._self._c||e;return i("div",{staticClass:"codeImgBox"},[i("img",{attrs:{src:"https://mini-app-img-1251768088.cos.ap-guangzhou.myqcloud.com/storePriceTag%2Fcode.png",alt:""}})])}],s=(i("e17f"),i("2241")),r=i("c7eb"),n=i("1da1"),d=(i("e7e5"),i("d399")),c=(i("d3b7"),i("159b"),i("14d9"),i("99af"),i("a9e3"),i("b64b"),i("b680"),i("ac1f"),i("5319"),i("caad"),i("2532"),i("ebc5")),l=0,g={data:function(){return{valueNUm:1,goodsInfo:"",config:[],goodsPopupShow:!1,store_id:"",goodsId:"",storeInfo:[],carts:[],goodsCarts:[],cartsNum:0,cartsTotal:0,goodsCartsTotal:"",popNum:"",goodsCartsOld:"",themeColor:"#f14e4e",addShow:!1}},components:{yz_goodsPopup:c["a"]},mounted:function(){},activated:function(){this.$route.params.store_id&&(this.store_id=this.$route.params.store_id,this.getStoreInfo(),this.getCart()),this.$route.params.id&&(this.goodsId=this.$route.params.id,this.getGoodsDetail(this.goodsId))},methods:{toOrderChild:function(){this.goodsCarts.length<=0?Object(d["a"])("购物车暂无商品"):(this.goodsPopupShow=!1,this.goodsId="",this.goodsOrder())},goodsOrder:function(){var t=this.goodsCarts;this._goodsOrder(t)},_goodsOrder:function(t,e){var i=this;return Object(n["a"])(Object(r["a"])().mark((function o(){var a;return Object(r["a"])().wrap((function(o){while(1)switch(o.prev=o.next){case 0:if(1!=i.operating_state){o.next=3;break}return Object(d["a"])("门店休息中"),o.abrupt("return");case 3:return o.next=5,i.checkInviter();case 5:if(!o.sent){o.next=7;break}return o.abrupt("return");case 7:if(a=0,e||i.isHasDifferType(t)){o.next=10;break}return o.abrupt("return");case 10:if(i.carts.forEach((function(t){a+=t.total})),0!=a){o.next=13;break}return o.abrupt("return");case 13:if(0!=t.length&&0!=i.carts.length){o.next=17;break}return o.abrupt("return");case 17:i.$router.push(i.fun.getUrl("goodsorder",{},{store_id:i.store_id,tag:"store"}));case 18:case"end":return o.stop()}}),o)})))()},checkInviter:function(){var t=this;return Object(n["a"])(Object(r["a"])().mark((function e(){var i;return Object(r["a"])().wrap((function(e){while(1)switch(e.prev=e.next){case 0:if(-1!==t.is_invite){e.next=16;break}return e.next=3,$http.get("member.member.isValidatePageGoods",{});case 3:if(i=e.sent,1!==i.result){e.next=13;break}if(t.is_invite=i.data.is_invite,!t.goodsInfo.has_one_invite_page||1!==t.goodsInfo.has_one_invite_page.status||0!==i.data.is_invite){e.next=10;break}t.$router.push(t.fun.getUrl("Inviter",{},{fromGood:1})),e.next=11;break;case 10:return e.abrupt("return",!1);case 11:e.next=14;break;case 13:return e.abrupt("return",!1);case 14:e.next=17;break;case 16:return e.abrupt("return",!1);case 17:case"end":return e.stop()}}),e)})))()},isHasDifferType:function(t){var e=this,i=0,o=0,a="";return t.forEach((function(t){t.live_install&&1==t.live_install.open_state?(i+=1,a=t.live_install.plugin_name):o+=1})),0==i||0==o||(s["a"].confirm({title:"提示",message:"普通商品与".concat(a,"商品一同下单将无法享受").concat(a,",是否继续下单?")}).then((function(){e._goodsOrder(t,!0)})).catch((function(){})),!1)},continueCode:function(){this.goodsPopupShow=!1,this.goodsId="",this.addShow=!1,this.toScanCode()},closeShowAdd:function(){this.goodsPopupShow=!1,this.goodsId="",this.addShow=!1},childAddCart:function(t){var e=t.goodsInfo,i=t.optionsId,o=t.goodsCount,a=null;if(i){for(var s=0;s<this.carts.length;s++)this.carts[s].option_id==i&&(a=s);if(null==a)this.addCart(e,"goodPopup",o,i);else{var r=Number(o)+Number(this.carts[a].total)-Number(this.carts[a].total);this.updateCartRequest(this.carts[a].id,r,"goodPopup")}}else{for(var n=0;n<this.carts.length;n++)this.carts[n].goods_id==e.id&&(a=n);if(null==a)this.addCart(e,"goodPopup",o,i);else{var d=Number(o)+Number(this.carts[a].total)-Number(this.carts[a].total);this.updateCartRequest(this.carts[a].id,d,"goodPopup")}}},getStoreInfo:function(){var t=this;$http.get("plugin.store-cashier.frontend.store.get-store-info.get-stores-details",{store_id:this.store_id},"").then((function(e){1==e.result?(t.themeColor=JSON.parse(localStorage.getItem("yz_basic_info")).theme_color,t.storeInfo=e.data):t.$dialog.alert({message:e.msg})})).catch((function(t){}))},getCart:function(){var t=this;$http.get("plugin.store-cashier.frontend.shoppingCart.member-cart.index",{store_id:this.store_id},"").then((function(e){1==e.result?t.getFirstCart(e.data):t.$dialog.alert({message:e.msg})})).catch((function(t){}))},getFirstCart:function(t){var e=this;this.carts=t,this.goodsCarts=[],this.cartsNum=0,this.cartsTotal=0,this.carts.forEach((function(t){e.$set(e.goodsCarts,t.goods_id,t),e.cartsNum+=t.total,e.cartsTotal+=t.total*t.goods.price})),this.goodsCartsTotal=this.calculateTotal(this.carts),this.cartsTotal=parseFloat(this.cartsTotal).toFixed(2)},calculateTotal:function(t){var e=this,i=[],o={},a=[];for(var s in t){var r=t[s].goods_id;o[r]?o[r].total=o[r].total+t[s].total:(o[r]={},o[r].goods_id=t[s].goods_id,o[r].total=t[s].total)}for(var n in o)i.push(o[n]);return i.forEach((function(t){e.$set(a,t.goods_id,t)})),a},clickCount:function(t){this.goodsCartsOld=t},changeCount:function(t,e){var i=Number(t);if(i<0)return Object(d["a"])("商品数量不能为负数"),void this.getCart();if(i!=this.goodsCartsOld)if(i<this.goodsCartsOld){var o=this.goodsCartsOld-i;this.updateCart(e,-o)}else if(i>this.goodsCartsOld){var a=i-this.goodsCartsOld;this.updateCart(e,a)}},AddTap:function(t,e,i){this.addCart(t,e)},CutTap:function(t){this.updateCartRequest(t.id,"-1")},addCart:function(t,e,i,o){var a=this,s="";s="cart"===e?t.goods_id:t.id,$http.get("plugin.store-cashier.frontend.shoppingCart.member-cart.store",{goods_id:s,total:"goodPopup"==e?i:1,store_id:this.store_id,option_id:"goodPopup"==e?o:t.option_id||0},"添加中").then((function(i){1===i.result?("goodPopup"==e&&(a.addShow=!0),a.getCart(t)):a.$dialog.alert({message:i.msg})}),(function(t){}))},updateCart:function(t,e,i){if(e<0){var o=0;if(this.carts.forEach((function(e){e.id==t&&(o=e.total)})),o+e<0)return void(0===l&&(l=1,this.delItemByCart(t),setTimeout((function(){l=0}),500)));0===l&&(l=1,this.updateCartRequest(t,e,i),setTimeout((function(){l=0}),500))}else 0===l&&(l=1,this.updateCartRequest(t,e,i),setTimeout((function(){l=0}),500))},delItemByCart:function(t){var e=this;$http.get("plugin.store-cashier.frontend.shoppingCart.member-cart.destroy",{store_id:this.store_id,ids:t},"删除中...").then((function(t){1==t.result?(e.getCart(),e.popNum--):e.$dialog.alert({message:t.msg})}))},clearCart:function(){var t=this,e=[];this.carts.forEach((function(t){e.push(t.id)})),e.length<=0||$http.get("plugin.store-cashier.frontend.shoppingCart.member-cart.destroy",{store_id:this.store_id,ids:e}).then((function(e){1==e.result?(t.getCart(),t.showCart=!1,t.popNum=0):t.$dialog.alert({message:e.msg})}))},updateCartRequest:function(t,e,i){var o=this;$http.get("plugin.store-cashier.frontend.shoppingCart.member-cart.updateNum",{id:t,num:e,store_id:this.store_id},"加载中").then((function(t){1==t.result?(o.popNum=o.popNum+e,"goodPopup"==i&&(o.addShow=!0),o.getCart()):(o.$dialog.alert({message:t.msg}),o.getCart())}),(function(t){}))},closeCart:function(){this.goodsPopupShow=!1},getGoodsDetail:function(t){var e=this;this.goodsId=t,$http.get("plugin.store-price-tag.frontend.goods.get-goods-page",{id:this.goodsId},"").then((function(t){if(1==t.result){if(t.data.get_store_info&&t.data.get_store_info.store_id!=e.store_id)return void e.$dialog.confirm({title:"提示",message:"当前商品不属于此门店是否跳转到该门店"}).then((function(){e.$router.replace(e.fun.getUrl("storePriceTagIndex",{store_id:t.data.get_store_info.store_id,id:e.goodsId}))})).catch((function(){that.$router.go(-1)}));e.goodsInfo=t.data.get_goods,e.goodsPopupShow=!0}else Object(d["a"])(t.msg)})).catch((function(t){}))},toScanCode:function(){var t=this;this.fun.isWeiXin()?wx.ready((function(){wx.scanQRCode({desc:"scanQRCode desc",needResult:1,scanType:["qrCode","barCode"],success:function(e){var i=e.resultStr;i.includes(",")&&t.getGoodsDetail(i.split(",")[1])},error:function(e){t.$dialog.alert({message:"请使用微信浏览器"})}})})):this.$dialog.alert({message:"请使用微信浏览器打开"})}}},f=g,u=(i("4fd36"),i("2877")),h=Object(u["a"])(f,o,a,!1,null,"3126da31",null);e["default"]=h.exports},"4fd36":function(t,e,i){"use strict";i("afa2")},afa2:function(t,e,i){var o=i("e1ca");o.__esModule&&(o=o.default),"string"===typeof o&&(o=[[t.i,o,""]]),o.locals&&(t.exports=o.locals);var a=i("499e").default;a("2257a9a9",o,!0,{sourceMap:!1,shadowMode:!1})},e1ca:function(t,e,i){var o=i("24fb");e=o(!1),e.push([t.i,".none[data-v-3126da31]{width:100%;position:fixed;bottom:0;left:0;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-align:center;-webkit-align-items:center;-ms-flex-align:center;align-items:center;background:#fff;padding:.25rem 0;-webkit-box-sizing:border-box;box-sizing:border-box}.none .noneBox[data-v-3126da31]{width:21.88rem;height:2.56rem;background:#ccc;border-radius:1.28rem;line-height:2.56rem;text-align:center;margin:0 auto;color:#fff}.btn[data-v-3126da31]{width:100%;position:fixed;bottom:0;left:0;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-align:center;-webkit-align-items:center;-ms-flex-align:center;align-items:center;padding:.25rem .81rem .25rem .75rem;-webkit-box-pack:justify;-webkit-justify-content:space-between;-ms-flex-pack:justify;justify-content:space-between;background:#fff}.btn .right[data-v-3126da31]{width:6.13rem;height:2.56rem;background:var(--color);font-size:.88rem;color:#fff;border-radius:1.28rem;text-align:center;line-height:2.56rem}.btn .left[data-v-3126da31]{font-size:1rem;font-weight:700;color:#ef5452;line-height:1.41rem;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-align:center;-webkit-align-items:center;-ms-flex-align:center;align-items:center}.btn .left .txt[data-v-3126da31]{font-size:.75rem;color:#999;margin-left:.5rem}.forBox[data-v-3126da31]{padding-bottom:4rem}.shopLis[data-v-3126da31]:last-child{padding-bottom:.75rem}.shopLis[data-v-3126da31]:first-child{padding-top:.75rem}.shopLis[data-v-3126da31]{padding:.75rem;padding-top:1.03rem;padding-bottom:0;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;background:#fff}.shopLis .left[data-v-3126da31]{-webkit-flex-shrink:0;-ms-flex-negative:0;flex-shrink:0;width:3.75rem;height:3.75rem;border-radius:.13rem;margin-right:.5rem}.shopLis .left img[data-v-3126da31]{width:100%;height:100%;border-radius:.13rem}.shopLis .right[data-v-3126da31]{-webkit-box-flex:1;-webkit-flex:1;-ms-flex:1;flex:1}.shopLis .right .title[data-v-3126da31]{font-size:.88rem;text-align:left;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2;overflow:hidden}.shopLis .right .specification[data-v-3126da31]{margin-top:.25rem;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-pack:justify;-webkit-justify-content:space-between;-ms-flex-pack:justify;justify-content:space-between;-webkit-box-align:center;-webkit-align-items:center;-ms-flex-align:center;align-items:center;font-size:.75rem;color:#999}.shopLis .right .specification .txt[data-v-3126da31]{font-size:.75rem;color:#999}.shopLis .right .specification .editCount[data-v-3126da31]{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex}.shopLis .right .specification .editCount .add[data-v-3126da31],.shopLis .right .specification .editCount .cut[data-v-3126da31]{width:1.5rem;height:1.5rem;border:1px solid #ccc;border-radius:50%;color:#000;font-size:1.3rem;-webkit-box-sizing:border-box;box-sizing:border-box;overflow:hidden;line-height:1.2rem}.shopLis .right .specification .editCount .van-cell[data-v-3126da31]{padding:0;background:transparent;width:2.22rem;text-align:center}.shopLis .right .specification .editCount .van-field__control[data-v-3126da31]{text-align:center}.shoplistHead[data-v-3126da31]{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-pack:justify;-webkit-justify-content:space-between;-ms-flex-pack:justify;justify-content:space-between;-webkit-box-align:center;-webkit-align-items:center;-ms-flex-align:center;align-items:center;padding:.75rem;-webkit-box-sizing:border-box;box-sizing:border-box}.shoplistHead .left[data-v-3126da31]{font-size:1rem;line-height:1.41rem;font-weight:700}.shoplistHead .right[data-v-3126da31]{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-align:center;-webkit-align-items:center;-ms-flex-align:center;align-items:center;font-size:.75rem;color:#999;font-weight:400}.shoplistHead .right img[data-v-3126da31]{margin-right:.25rem;width:.75rem;height:.75rem}.codeImg[data-v-3126da31]{-webkit-box-orient:vertical;-webkit-box-direction:normal;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;padding-top:1.25rem}.codeImg[data-v-3126da31],.codeImg .codeImgBox[data-v-3126da31]{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-align:center;-webkit-align-items:center;-ms-flex-align:center;align-items:center;-webkit-box-pack:center;-webkit-justify-content:center;-ms-flex-pack:center;justify-content:center}.codeImg .codeImgBox[data-v-3126da31]{width:6.75rem;height:6.75rem;border-radius:100%;border:.25rem solid #edf2f8;background:var(--color)}.codeImg img[data-v-3126da31]{width:4rem;height:4rem;border-radius:100}.codeImg .txt[data-v-3126da31]{font-size:.88rem;line-height:1.25rem;color:#999;margin-top:.25rem}.scanCode[data-v-3126da31]{padding:.75rem;padding-bottom:1.25rem;-webkit-box-sizing:border-box;box-sizing:border-box;background:#fff}.scanCode .storeDetail[data-v-3126da31]{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-pack:start;-webkit-justify-content:flex-start;-ms-flex-pack:start;justify-content:flex-start;-webkit-box-align:center;-webkit-align-items:center;-ms-flex-align:center;align-items:center}.scanCode .storeDetail img[data-v-3126da31]{width:1.5rem;height:1.5rem;border-radius:50%;margin:0;margin-right:.38rem}.scanCode .storeDetail .storeName[data-v-3126da31]{font-weight:700;font-size:1rem}.popView[data-v-3126da31]{width:100%;overflow:hidden;padding:1.25rem 0;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-box-orient:vertical;-webkit-box-direction:normal;-webkit-flex-direction:column;-ms-flex-direction:column;flex-direction:column;-webkit-box-align:center;-webkit-align-items:center;-ms-flex-align:center;align-items:center}.addShowTitle[data-v-3126da31]{font-size:1.125rem;color:#333;text-align:center}.popView img[data-v-3126da31]{width:10.25rem;height:6.125rem;margin:0 auto;margin-top:.625rem}.popView .codeTxt[data-v-3126da31]{width:15rem;height:2.0313rem;line-height:2.0313rem;background:var(--color);border-radius:1.0313rem;text-align:center;font-size:1.125rem;color:#fff;margin-top:1rem;margin-bottom:.5rem}.popView .cart[data-v-3126da31]{font-size:.875rem;color:#999;text-align:center}",""]),t.exports=e}}]);