1 line
12 KiB
JavaScript
1 line
12 KiB
JavaScript
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-9251140c"],{"1d94":function(o,t,e){"use strict";e.r(t);var s=function(){var o=this,t=o.$createElement,e=o._self._c||t;return e("div",{attrs:{id:"exchangeDetail"}},[e("c-title",{attrs:{hide:!1,text:"换货"}}),e("div",{staticClass:"good-box"},[e("div",{staticClass:"left"},[e("img",{attrs:{src:o.popThumb,alt:""}})]),e("div",{staticClass:"right"},[e("p",{staticClass:"title"},[o._v(o._s(o.goodsInfo.title))]),e("div",{staticClass:"ticket"},[e("p",{staticClass:"number text-over"},[o._v(" 兑换券 "+o._s(o.goodsInfo.goods_change?o.goodsInfo.goods_change.certificate:"0")+"张 ")])])])]),o.fun.isTextEmpty(o.goodsInfo.has_many_options)?o._e():e("div",{staticClass:"good-content shopinfo noVantRadio"},o._l(o.goodsInfo.has_many_specs,(function(t,s){return e("dl",{key:s},[e("dt",[o._v(o._s(t.title))]),e("dd",[e("van-radio-group",{attrs:{"checked-color":"#f15353"},on:{change:o.selectSpecs},model:{value:t.description,callback:function(e){o.$set(t,"description",e)},expression:"specs.description"}},o._l(t.specitem,(function(s,i){return e("van-radio",{key:i,class:{vantRadioshow:t.description==s},attrs:{disabled:s.c,name:s}},[o._v(" "+o._s(s.title)+" ")])})),1)],1)])})),0),e("div",{staticClass:"change-num"},[e("p",{staticStyle:{flex:"1","font-weight":"bold"}},[o._v("兑换商品数量")]),e("div",{staticClass:"cart"},[e("span",{staticClass:"del",on:{click:function(t){return t.stopPropagation(),o.reduceGoods.apply(null,arguments)}}},[o._v("-")]),e("input",{directives:[{name:"model",rawName:"v-model.lazy",value:o.goodsCount,expression:"goodsCount",modifiers:{lazy:!0}}],staticClass:"input",attrs:{type:"number",placeholder:"1"},domProps:{value:o.goodsCount},on:{change:function(t){o.goodsCount=t.target.value}}}),e("span",{staticClass:"add",on:{click:function(t){return t.stopPropagation(),o.addGoods.apply(null,arguments)}}},[o._v("+")])])]),e("div",{staticClass:"car-btn",class:[3==o.fun.getPhoneEnv()?"pcStyle":""],style:{width:3==o.fun.getPhoneEnv()?"375px":""}},[e("div",{staticClass:"orange",on:{click:o.gotoMyRepertory}},[e("span",[o._v("换取兑换券")]),e("span",{staticStyle:{"font-size":"12px"}},[o._v("(当前兑换券:"+o._s(o.certificate)+")")])]),e("div",{staticClass:"change",on:{click:o.goExchange}},[e("div",[o._v("兑换")])])])],1)},i=[],a=(e("e7e5"),e("d399")),n=(e("14d9"),e("a4d3"),e("e01a"),e("a434"),e("4e82"),e("6968")),d=[],r=0,c=1,l={data:function(){return{certificate:null,popThumb:"",popPrice:0,popStock:1,goodsDescription:"",goodsCount:1,goodsInfo:{}}},activated:function(){this.init(),this.getData()},methods:{init:function(){d=[],r="",c=1,this.popStock=1,this.goodsDescription="",this.goodsCount=1},getData:function(){var o=this;$http.post("plugin.channel.frontend.goods-change.getGoods",{id:this.$route.params.id},"").then((function(t){1===t.result?(o.goodsInfo=t.data.goods,o.certificate=t.data.my_certificate,o.initPopView()):Object(a["a"])(t.msg)})).catch((function(o){}))},goExchange:function(){var o=this,t=this.goodsInfo.goods_change.certificate?this.goodsInfo.goods_change.certificate*this.goodsCount:this.goodsCount;this.certificate<=0?Object(a["a"])("当前兑换券数量不足,暂不能兑换商品"):this.certificate<t?Object(a["a"])("当前兑换券数量不足"):$http.post("plugin.channel.frontend.goods-change.exchangeGoods",{goods_id:this.$route.params.id,option_id:r,num:this.goodsCount},"").then((function(t){1===t.result?(Object(a["a"])("兑换成功!"),o.getData()):Object(a["a"])(t.msg)})).catch((function(o){}))},gotoMyRepertory:function(){this.$router.push(this.fun.getUrl("myRepertory",{}))},initPopView:function(){if(this.popThumb=this.goodsInfo.thumb,this.popStock=this.goodsInfo.stock?this.goodsInfo.stock:"",this.fun.isTextEmpty(this.goodsInfo.has_many_options))this.popPrice=this.goodsInfo.price,this.goodsDescription="",c=this.goodsInfo.stock?this.goodsInfo.stock:"",this.load=!0;else{this.goodsDescription="选择";for(var o=0;o<this.goodsInfo.has_many_specs.length;o++)this.goodsDescription+=" "+this.goodsInfo.has_many_specs[o].title;if(!r)for(var t=0;t<this.goodsInfo.has_many_specs.length;t++)this.goodsInfo.has_many_specs[t].description=this.goodsInfo.has_many_specs[t].specitem[0],this.selectSpecs(this.goodsInfo.has_many_specs[t].specitem[0]);this.load=!0}},selectSpecs:function(o){this.manageSpecs(o),this.setGoodsSpecs(o),this.setGoodsSpecsChangeInfo(),this.getMaxCount()},manageSpecs:function(o){var t={};if(t.id=o.id,t.specid=o.specid,t.title=o.title,d.length>0){for(var e=0;e<d.length;e++)d[e].specid==t.specid&&d.splice(e,1);d.push(t)}else d.push(t);if(d.length==this.goodsInfo.has_many_specs.length){for(var s=[],i=0;i<this.goodsInfo.has_many_specs.length;i++)for(var a=0;a<d.length;a++)if(this.goodsInfo.has_many_specs[i].id==d[a].specid){s.push(d[a]);break}d=s}this.setGoodsDescription()},setGoodsDescription:function(){var o="";if(d.length==this.goodsInfo.has_many_specs.length){o="已选择 ";for(var t=0;t<d.length;t++)o+=d[t].title+" ";this.goodsDescription=o}else{o="请选择 ";for(var e=0;e<this.goodsInfo.has_many_specs.length;e++)for(var s=0;s<d.length;s++)if(this.goodsInfo.has_many_specs[e].id!=d[s].specid){o+=this.goodsInfo.has_many_specs[e].title+" ";break}this.goodsDescription=o}},setGoodsSpecs:function(o){for(var t=0;t<this.goodsInfo.has_many_specs.length;t++)o.specid!=this.goodsInfo.has_many_specs[t].id&&this.setGoodsSpecsStatus(this.goodsInfo.has_many_specs[t].specitem,o.id)},setGoodsSpecsStatus:function(o,t){for(var e=[],s=0;s<this.goodsInfo.has_many_options.length;s++)for(var i=this.goodsInfo.has_many_options[s].specs.split("_"),a=0;a<i.length;a++)if(i[a]==t)return void e.push(this.goodsInfo.has_many_options[s]);for(var n=0;n<e.length;n++)for(var d=e[n].specs.split("_"),r=0;r<d.length;r++)if(d[r]!=t&&0==e[n].stock){for(var c=0;c<o.length;c++)if(d[r]==o[c].id)return void(o[c].c=!0)}else if(d[r]!=t&&e[n].stock>0)for(var l=0;l<o.length;l++)if(d[r]==o[l].id)return void(o[l].c=!1)},setGoodsSpecsChangeInfo:function(){if(d.sort((function(o,t){return o.id-t.id})),d.length==this.goodsInfo.has_many_specs.length){for(var o="",t=0;t<d.length;t++)o+=d[t].id+"_";o=o.substring(0,o.length-1);for(var e=0;e<this.goodsInfo.has_many_options.length;e++)if(o==this.setGoodsSpecsBySort(this.goodsInfo.has_many_options[e].specs)){this.popPrice=this.goodsInfo.has_many_options[e].product_price,this.popThumb=this.fun.isTextEmpty(this.goodsInfo.has_many_options[e].thumb)?this.goodsInfo.thumb:this.goodsInfo.has_many_options[e].thumb,this.popStock=this.goodsInfo.has_many_options[e].stock,r=this.goodsInfo.has_many_options[e].id,c=this.goodsInfo.has_many_options[e].stock,c>0&&(this.goodsCount=1);break}}},setGoodsSpecsBySort:function(o){var t=o.split("_");t.sort((function(o,t){return o-t}));for(var e="",s=0;s<t.length;s++)e+=t[s]+"_";return e=e.substring(0,e.length-1),e},getMaxCount:function(){d.length==this.goodsInfo.has_many_specs.length&&(0==c&&(this.goodsCount=0),this.goodsCount>c&&(this.goodsCount=c))},addGoods:function(){var o=this.goodsInfo.goods_change.certificate?this.goodsInfo.goods_change.certificate*this.goodsCount:this.goodsCount;this.certificate<o?Object(a["a"])("当前兑换券数量不足"):this.goodsCount++},reduceGoods:function(){1!=this.goodsCount&&0!=this.goodsCount&&this.goodsCount--}},components:{cTitle:n["a"]}},f=l,p=f,h=(e("897c"),e("2877")),g=Object(h["a"])(p,s,i,!1,null,"37d35f9e",null);t["default"]=g.exports},"897c":function(o,t,e){"use strict";e("9315")},9315:function(o,t,e){var s=e("e674");s.__esModule&&(s=s.default),"string"===typeof s&&(s=[[o.i,s,""]]),s.locals&&(o.exports=s.locals);var i=e("499e").default;i("d6857c0c",s,!0,{sourceMap:!1,shadowMode:!1})},e674:function(o,t,e){var s=e("24fb");t=s(!1),t.push([o.i,".noVantRadio .van-radio-group[data-v-37d35f9e]{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-wrap:wrap;-ms-flex-wrap:wrap;flex-wrap:wrap}.noVantRadio .van-radio-group .van-radio[data-v-37d35f9e]{margin-right:.5rem;margin-bottom:.5rem;background:#fff;border:1px solid #efefef;text-align:center;-webkit-box-sizing:border-box;box-sizing:border-box;border-radius:.25rem}.noVantRadio .van-radio-group .vantRadioshow[data-v-37d35f9e]{background-color:#f15353;border-color:#f15353;-webkit-box-shadow:#f15353 -1px 0 0 0;box-shadow:-1px 0 0 0 #f15353}.noVantRadio .van-radio-group .van-radio__label[data-v-37d35f9e]{color:#000}#exchangeDetail[data-v-37d35f9e]{background:#fff;min-height:100vh;padding:1rem}#exchangeDetail .shopinfo[data-v-37d35f9e]{text-align:left;padding-left:.625rem;margin:1rem 0 1rem 0;max-height:50vh;overflow:scroll}#exchangeDetail .shopinfo dl dt[data-v-37d35f9e]{margin-bottom:.5rem;font-weight:700;color:#000}#exchangeDetail .shopinfo dl dd[data-v-37d35f9e]{margin-bottom:.3125rem}.good-box[data-v-37d35f9e]{padding-bottom:.5rem;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex}.good-box .left[data-v-37d35f9e]{-webkit-box-flex:0;-webkit-flex:0 0 5rem;-ms-flex:0 0 5rem;flex:0 0 5rem}.good-box .left img[data-v-37d35f9e]{width:5rem;height:5rem;border-radius:.5rem}.good-box .right[data-v-37d35f9e]{-webkit-box-flex:1;-webkit-flex:1;-ms-flex:1;flex:1;text-align:left;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;margin:.5rem 0 .5rem .5rem;font-size:12px;width:13rem}.good-box .title[data-v-37d35f9e]{font-weight:700;font-size:15px;margin-bottom:.3rem;overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical}.good-box .spec[data-v-37d35f9e]{color:#9f9f9f}.good-box .ticket[data-v-37d35f9e]{margin-top:.75rem;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex}.good-box .number[data-v-37d35f9e]{-webkit-box-flex:1;-webkit-flex:1;-ms-flex:1;flex:1;color:#fb9a00;-webkit-align-self:center;-ms-flex-item-align:center;align-self:center}.good-box .exchange[data-v-37d35f9e]{background-color:#ffae00;border-radius:15px;color:#fff;padding:2px .5rem;line-height:1rem}.good-content[data-v-37d35f9e]{text-align:left}.good-content .title[data-v-37d35f9e]{font-weight:700}.spec_box[data-v-37d35f9e]{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;-webkit-flex-wrap:wrap;-ms-flex-wrap:wrap;flex-wrap:wrap;margin:.5rem 0 1rem 0}.spec_box span[data-v-37d35f9e]{border:1px solid #ccc;border-radius:5px;padding:.1rem .4rem;display:inline-block;margin:.5rem .5rem 0 0;word-break:break-all}.spec_box .red[data-v-37d35f9e]{color:#f01818;border:1px solid #f01818}.spec_box .gray[data-v-37d35f9e]{color:#999;background:#f6f6f6}.change-num[data-v-37d35f9e]{display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;text-align:left}.change-num input[data-v-37d35f9e]{border:none;outline:none}.cart[data-v-37d35f9e]{width:5rem;height:1.25rem;border:1px solid #ccc;border-radius:10px;text-align:center}.cart .input[data-v-37d35f9e]{width:2rem;text-align:center;border:1px solid #eee}.cart .add[data-v-37d35f9e],.cart .del[data-v-37d35f9e]{width:1rem;display:inline-block}.car-btn[data-v-37d35f9e]{position:fixed;bottom:0;left:0;width:100%;display:-webkit-box;display:-webkit-flex;display:-ms-flexbox;display:flex;color:#fff}.car-btn div[data-v-37d35f9e]{-webkit-box-flex:1;-webkit-flex:1;-ms-flex:1;flex:1;padding:.5rem 0}.car-btn .orange[data-v-37d35f9e]{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;background-color:#ffae00}.car-btn .change[data-v-37d35f9e]{background-color:#ff4e00}.pcStyle[data-v-37d35f9e]{left:50%;-webkit-transform:translateX(-50%);transform:translateX(-50%)}",""]),o.exports=t}}]); |