1 |
- (window.webpackJsonp=window.webpackJsonp||[]).push([["chunk-a005cb7c"],{"1b69":function(t,e,n){"use strict";n("96cf");var r=n("1da1"),s=n("5daa"),a=n("5f87"),i={};window.ajaxTimeout=2e4,e.a=Object(r.a)(regeneratorRuntime.mark((function t(){var e,n,o,c,u,d,h,p=arguments;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e=0<p.length&&void 0!==p[0]?p[0]:"",n=1<p.length&&void 0!==p[1]?p[1]:{},c=3<p.length&&void 0!==p[3]?p[3]:{},u=4<p.length&&void 0!==p[4]?p[4]:i,d=5<p.length?p[5]:void 0,o=(o=2<p.length&&void 0!==p[2]?p[2]:"GET").toLowerCase(),h={method:o,baseURL:"",url:s.a.baseURL+e,data:n,params:c,processData:!0,timeout:window.ajaxTimeout,headers:u,onUploadProgress:d},d&&"function"==typeof d&&(h.onUploadProgress=d),axios.interceptors.request.use((function(t){return t.data.token||(t.data.token=Object(a.d)()),t}),(function(t){return Promise.reject(new Error("服务器异常,请联系管理员!"))})),axios.interceptors.response.use(function(){var t=Object(r.a)(regeneratorRuntime.mark((function t(e){var n;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return 200===e.status&&100<=(n=e.data.code)&&n<=104&&Object(a.h)(),t.abrupt("return",e);case 2:case"end":return t.stop()}}),t)})));return function(e){return t.apply(this,arguments)}}(),(function(t){return Promise.reject(t.response.data)})),t.abrupt("return",new Promise((function(t,e){axios(h).then((function(e){t(e.data)})).catch((function(t){t.response&&t.response.data?e(t.response.data):e(t)}))})));case 12:case"end":return t.stop()}}),t)})))},"21eb":function(t,e,n){"use strict";n("d0b4")},d0b4:function(t,e,n){},e6e2:function(t,e,n){"use strict";n.r(e),n("47e2");var r,s,a,i,o,c,u,d=n("2241"),h=(n("20d6"),n("7f7f"),n("ac6a"),n("96cf"),n("1da1")),p=n("9f53"),m=n("1b69"),f="home/",l=function(t,e){return Object(m.a)(f+"orderstock",t,"post",e)},g=function(t,e){return Object(m.a)(f+"orderadd",t,"post",e)},b=function(t,e){return Object(m.a)(f+"addrinfo",t,"post",e)},k=n("5f87"),v={mixins:[p.a],data:function(){return{type:null,addrAdd:n("3436"),bgImg:n("912e"),tags:n("fe8f"),selectActive:0,currIndex:null,num:0,total:0,radioV:"",address:[],unitist:[],productList:[],stock:0,ad:null,canStockBox:"",canStockBag:"",isce:""}},created:function(){this.type=this.$store.getters.type},mounted:function(){this.ad=Object(k.a)()?JSON.parse(Object(k.a)()):{},this.num=isNaN(Object(k.b)())?0:parseInt(Object(k.b)()),this.ad&&this.ad.id?this.initData(this.ad.id):this.address=[],this.getStock()},methods:{changePitem:function(t){this.radioV=this.productList[t].id,this.stock=this.productList[t].stock,this.num>this.stock&&(this.num=this.stock)},getaddress:(u=Object(h.a)(regeneratorRuntime.mark((function t(){var e,n;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,this.set_user_goodsNum(this.num);case 2:return e=t.sent,t.next=5,this.set_user_goodsUnit(this.radioV);case 5:n=t.sent,e&&0===e.code&&n&&0===n.code&&window.vm.$router.push({path:"/address",query:{id:this.ad&&this.ad.id?this.ad.id:"0"}});case 7:case"end":return t.stop()}}),t,this)}))),function(){return u.apply(this,arguments)}),getStock:(c=Object(h.a)(regeneratorRuntime.mark((function t(){var e,n,r;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.loading){t.next=20;break}return t.next=3,l({});case 3:if(!(e=t.sent)||0!=e.code){t.next=14;break}r=e.data,n=r.limit,r=r.stock,n&&0<n.length||(n=[]),this.canStockBag=e.data.stock,this.canStockBox=e.data.stock,this.distributeGoods(n),this.total=parseInt(r+""),t.next=20;break;case 14:if(e&&100<=e.code&&e.code<=104)return t.next=17,this.logout();t.next=19;break;case 17:t.next=20;break;case 19:this.total=0;case 20:case"end":return t.stop()}}),t,this)}))),function(){return c.apply(this,arguments)}),distributeGoods:function(t){var e=this;0<t.length&&(this.productList=[],t.forEach((function(t){t={id:t.id,name:t.good_name,img:n("e078")("./".concat(e.$store.getters.type,"/product/unit").concat(t.id,".png")),stock:parseInt(t.limit_num+""),weight:t.weight,good_desc:t.good_desc,unit:t.name},e.productList.push(t)})),t=this.productList.findIndex((function(t){return t.id==Object(k.c)()+""})),this.changePitem(-1===t?0:t))},initData:(o=Object(h.a)(regeneratorRuntime.mark((function t(e){var n;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,b({id:e});case 2:if(!(n=t.sent)||0!==n.code){t.next=6;break}t.next=12;break;case 6:if(n&&100<=n.code&&n.code<=104)return t.next=9,this.logout();t.next=11;break;case 9:t.next=12;break;case 11:this.$store.dispatch("user/set_ad",{}).then((function(t){}));case 12:case"end":return t.stop()}}),t,this)}))),function(t){return o.apply(this,arguments)}),backNum:function(t){this.num=t},placeOrder:(i=Object(h.a)(regeneratorRuntime.mark((function t(){var e=this;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(this.loading){t.next=14;break}if(!this.ad||!this.ad.id){t.next=13;break}if(this.num=this.num,isNaN(this.num)&&(this.num=0),0===this.stock)return this.show_title("当前商品库存为0,无法购买!"),t.abrupt("return");t.next=7;break;case 7:if(0===this.num)return this.show_title("购买数量不能为0!"),t.abrupt("return");t.next=10;break;case 10:d.a.confirm({title:"确认下单?",message:"同意后,将生成订单!"}).then(Object(h.a)(regeneratorRuntime.mark((function t(){return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e.placeHttpOrder();case 2:case"end":return t.stop()}}),t)})))).catch((function(){})),t.next=14;break;case 13:this.show_title("请选择收货地址!");case 14:case"end":return t.stop()}}),t,this)}))),function(){return i.apply(this,arguments)}),placeHttpOrder:(a=Object(h.a)(regeneratorRuntime.mark((function t(){var e,n;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return this.loading=!0,n={addrid:this.ad.id,num:this.num+"",unit_id:this.radioV},t.next=4,g(n);case 4:if(e=t.sent,this.loading=!1,e&&0==e.code)return t.next=9,this.set_user_goodsNum(0);t.next=13;break;case 9:(n=t.sent)&&0===n.code&&window.vm.$router.push({path:"/orderRes",query:{id:e.data.orderid}}),t.next=19;break;case 13:if(e&&100<=e.code&&e.code<=104)return t.next=16,this.logout();t.next=18;break;case 16:t.next=19;break;case 18:this.show_title(e.msg);case 19:case"end":return t.stop()}}),t,this)}))),function(){return a.apply(this,arguments)}),set_user_goodsNum:(s=Object(h.a)(regeneratorRuntime.mark((function t(e){var n=this;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",new Promise((function(t,r){n.$store.dispatch("user/set_goodsNum",e).then((function(e){t(e)}))})));case 1:case"end":return t.stop()}}),t)}))),function(t){return s.apply(this,arguments)}),set_user_goodsUnit:(r=Object(h.a)(regeneratorRuntime.mark((function t(e){var n=this;return regeneratorRuntime.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",new Promise((function(t,r){n.$store.dispatch("user/set_goodsUnit",e).then((function(e){t(e)}))})));case 1:case"end":return t.stop()}}),t)}))),function(t){return r.apply(this,arguments)})}};n("21eb"),p=n("2877"),v=Object(p.a)(v,(function(){var t=this,e=t.$createElement,n=t._self._c||e;return n("div",{directives:[{name:"loading",rawName:"v-loading",value:t.loading,expression:"loading"}],staticClass:"product"},[n("div",{staticClass:"bgImg"},[n("img",{staticClass:"bgImg-img",attrs:{src:t.bgImg,alt:""}}),n("div",{staticClass:"tags"},[n("img",{attrs:{src:t.tags,alt:""}})])]),n("div",{staticClass:"product-baozhuang"},[t._m(0),n("ul",{staticClass:"productPack clear"},t._l(t.productList,(function(e,r){return n("li",{key:e.id,on:{click:function(e){return t.changePitem(r)}}},[n("div",{staticClass:"box",class:{selected:e.id==t.radioV}},[n("img",{attrs:{src:e.img,alt:""}}),n("p",[t._v(t._s(e.name))]),n("span",[t._v("库存:"+t._s(e.stock)+t._s(e.unit))]),"active1"==t.type?n("span",{staticStyle:{"margin-left":"0px",float:"right"}},[t._v(t._s(e.good_desc))]):t._e()])])})),0),t.ad&&t.ad.id?n("div",{staticClass:"item-ad clear",on:{click:t.getaddress}},[n("p",{staticClass:"item-ad__name"},[n("span",[t._v(t._s(t.ad.name)+" ")]),n("span",{staticClass:"tel"},[t._v(t._s(t.ad.mobile))])]),n("p",{staticClass:"item-ad__address"},[n("van-icon",{attrs:{name:"location-o",size:"14"}}),n("span",[t._v(t._s(t.ad.address))])],1)]):n("div",{staticClass:"kongParents"},[n("div",{staticClass:"kong clear",on:{click:t.getaddress}},[n("img",{attrs:{src:t.addrAdd,alt:""}}),n("span",[t._v("添加地址")])])])]),n("div",{staticClass:"product-footer clear"},[n("div",{staticClass:"fl"},[n("input-number",{attrs:{numb:t.num,max:t.stock},on:{backNum:t.backNum}})],1),n("div",[n("van-button",{staticClass:"fr",attrs:{type:"info"},on:{click:t.placeOrder}},[t._v("确认下单")])],1)])])}),[function(){var t=this,e=t.$createElement;e=t._self._c||e;return e("div",{staticClass:"product-title"},[e("span",[t._v("藏金")]),e("span",[t._v(".")]),e("span",[t._v("1745产品")])])}],!1,null,"487b1800",null);e.default=v.exports}}]);
|