(global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["pages/replace-manage/replace-manage"],{"03fc":function(t,n,i){"use strict";i.r(n);var e=i("d3f1"),s=i("2834");for(var u in s)"default"!==u&&function(t){i.d(n,t,(function(){return s[t]}))}(u);i("2bcb"),i("4682");var c,o=i("f0c5"),r=Object(o["a"])(s["default"],e["b"],e["c"],!1,null,"5850c142",null,!1,e["a"],c);n["default"]=r.exports},"1a52":function(t,n,i){},2834:function(t,n,i){"use strict";i.r(n);var e=i("a70d"),s=i.n(e);for(var u in e)"default"!==u&&function(t){i.d(n,t,(function(){return e[t]}))}(u);n["default"]=s.a},"2bcb":function(t,n,i){"use strict";var e=i("1a52"),s=i.n(e);s.a},4682:function(t,n,i){"use strict";var e=i("b568"),s=i.n(e);s.a},"5dd1":function(t,n,i){"use strict";(function(t){i("fdf4");e(i("66fd"));var n=e(i("03fc"));function e(t){return t&&t.__esModule?t:{default:t}}wx.__webpack_require_UNI_MP_PLUGIN__=i,t(n.default)}).call(this,i("543d")["createPage"])},a70d:function(t,n,i){"use strict";(function(t){Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var e=i("057a"),s={data:function(){return{skuList:"",sku:[],isShare:"",user_id:"",isVip:"",oldVip:"",newVip:"",checkSku:[],userInfo:"",hasOrder:1,showHint:!0}},onLoad:function(t){this.isShare=t.isShare,this.user_id=t.user_id,this.getSku(1)},onShow:function(){this.getUserInfo(this.user_id)},computed:{totalPrice:function(){var t=0;return this.skuList&&this.skuList.map((function(n){n.sku.map((function(i){i.isChecked&&(t+=i.new_num*n.price)}))})),t},vipPrice:function(){var t=0;return this.skuList&&this.skuList.map((function(n){n.sku.map((function(i){i.isChecked&&(t+=i.new_num*n.vip_price)}))})),t},totalNum:function(){var t=0;return this.skuList&&this.skuList.map((function(n){n.sku.map((function(n){n.isChecked&&(t+=n.new_num)}))})),t}},methods:{setVip:function(n){var i=this,s=0==n?e.setVip:e.cancelVip;t.showLoading({title:"加载中..."}),s({user_id:this.user_id}).then((function(e){200==e.code?(t.showToast({title:0==n?"升级成功":"取消成功"}),i.newVip=i.isVip=i.oldVip=0==n?1:0):t.showModal({content:e.data||"操作失败",showCancel:!1}),t.hideLoading()})).catch((function(){t.hideLoading()}))},getUserInfo:function(n){var i=this;(0,e.getUser)({user_id:n}).then((function(n){if(200==n.code){var e=n.data,s=e.is_vip,u=e.has_order;i.hasOrder=u,i.oldVip=i.isVip=i.newVip=s,i.userInfo=n.data}else t.showModal({content:n.data||"获取客户信息失败",showCancel:!1})}))},getSku:function(n){var i=this;(0,e.getSku)({type:n}).then((function(n){if(200==n.code){for(var e=n.data,s=0;s<e.length;s++){i.$set(e[s],"sku",[]);var u=e[s].size;for(var c in u)for(var o=u[c],r=0;r<o.length;r++)i.$set(o[r],"new_num",0)}i.skuList=e,console.log(e,111)}else t.showModal({content:n.data,showCancel:fasle})}))},checkVip:function(){var t=this,n=this.skuList;n.map((function(n){n.sku.map((function(n){n.new_num>0&&t.checkSku.push(n)}))}));var i="";1==this.checkSku.length&&(i=this.checkSku[0].new_num),this.checkSku.length>=2||i>=2?this.isVip=1:this.isVip=0},down:function(n,i,e){if(0==e)return t.showToast({title:"数量至少为1",icon:"none"}),!1;this.skuList[n].sku[i].new_num--,1!=this.oldVip&&(this.checkSku=[],this.checkVip())},up:function(n,i,e,s){if(e>=999)return t.showToast({title:"超出最大下单数量",icon:"none"}),!1;this.skuList[n].sku[i].new_num++,1!=this.oldVip&&(this.checkSku=[],this.checkVip())},getVal:function(t,n,i,e){this.skuList[n].sku[i].new_num=Number(t.detail.value),1!=this.oldVip&&(this.checkSku=[],this.checkVip())},showSize:function(t,n,i,e){if(t.isChecked=!t.isChecked,t.isChecked)this.skuList[n].sku.push(t);else for(var s=this.skuList[n].sku,u=0;u<s.length;u++)s[u].id==t.id&&s.splice(u,1)},delSku:function(t,n,i){i.isChecked=!1,this.skuList[t].sku.splice(n,1)},placeOrder:function(){var n=this.skuList,i=[];if(n.map((function(t){t.sku.map((function(t){t.new_num>0&&i.push(t)}))})),0==i.length)return t.showModal({content:"请至少选择一项",showCancel:!1}),!1;t.setStorageSync("order",n),t.navigateTo({url:"../firm-order/firm-order?user_id=".concat(this.user_id)})}}};n.default=s}).call(this,i("543d")["default"])},b568:function(t,n,i){},d3f1:function(t,n,i){"use strict";var e;i.d(n,"b",(function(){return s})),i.d(n,"c",(function(){return u})),i.d(n,"a",(function(){return e}));var s=function(){var t=this,n=t.$createElement,i=(t._self._c,1==t.hasOrder&&t.userInfo.nickname!=t.userInfo.phone&&t.userInfo.nickname?t._f("getName")(t.userInfo.nickname,10):null),e=1!=t.hasOrder?t._f("getName")(t.userInfo.nickname,10):null,s=t.__map(t.skuList,(function(n,i){var e=t.__get_orig(n),s=1!=t.isVip?Number(n.price)-Number(n.vip_price)||0:null;return{$orig:e,m0:s}}));t._isMounted||(t.e0=function(n){t.showHint=!1}),t.$mp.data=Object.assign({},{$root:{f0:i,f1:e,l0:s}})},u=[]}},[["5dd1","common/runtime","common/vendor"]]]);