require('../common/vendor.js');(global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["pagesA/business/editBusiness"],{"3b51":function(t,n,i){"use strict";(function(t){Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var e=i("0c59"),o=i("dc92"),c={components:{selectCustomer:function(){Promise.all([i.e("common/vendor"),i.e("components/selectCustomer")]).then(function(){return resolve(i("5bcd"))}.bind(null,i)).catch(i.oe)},popupList:function(){Promise.all([i.e("common/vendor"),i.e("components/selectProduct/index")]).then(function(){return resolve(i("a99f"))}.bind(null,i)).catch(i.oe)},popupProductConfig:function(){i.e("components/selectProductConfig/index").then(function(){return resolve(i("55ad"))}.bind(null,i)).catch(i.oe)},formItem:function(){Promise.all([i.e("common/vendor"),i.e("components/form/formitem")]).then(function(){return resolve(i("d7bf"))}.bind(null,i)).catch(i.oe)}},data:function(){return{BASE_IMG_URL:e.BASE_IMG_URL,noClick:!0,customerObj:{},listForm:[],productList:[],id:"",info:{}}},onLoad:function(t){this.id=t.id,this.getDetail()},methods:{getDetail:function(){var t=this;(0,o.netBusinessDetail)({id:this.id}).then((function(n){t.info=n.data,t.productList=n.data.product,t.customerObj=n.data.customer,t.getForm()}))},getForm:function(){var t=this;(0,o.netSetForm)({type:"business"}).then((function(n){n=n.data.data,n.forEach((function(n){n.value=t.info[n.id]})),t.listForm=n}))},changeCus:function(t){this.$refs.customerChild.init()},sureSelect:function(t){this.customerObj=t},changeOtherData:function(t,n,i){var e=this,o=this.listForm;o.forEach((function(t,o){t.id==i.id&&(t.value=n,e.$set(e.listForm,o,t))}))},addPart:function(){this.$refs.productChild.init()},selectList:function(t){t.forEach((function(t){t.minprice=t.price,t.parts=[],t.product_id=t.id})),this.productList=this.deWeight(t.concat(this.productList))},deWeight:function(t){for(var n=0;n<t.length-1;n++)for(var i=n+1;i<t.length;i++)t[n].id==t[i].id&&(t.splice(i,1),i--);return t},changeNumber:function(t,n){var i=this.productList[n];i.number=t,this.$set(this.productList,n,i)},delProduct:function(t){this.productList.splice(t,1)},toSelectConfig:function(t,n){this.configIndex=n,this.$refs.productConfig.init(t.product_id)},configList:function(t){var n=this.productList[this.configIndex];n.parts=n.parts?n.parts:[],n.parts=this.deWeight(n.parts.concat(t)),this.$set(this.productList,this.configIndex,n)},changeConfigNumber:function(t,n,i){var e=this.productList[i];e.parts[n].number=t,this.$set(this.productList,i,e)},delPeizhi:function(t,n){var i=this.productList[t];i.parts.splice(n,1),this.$set(this.productList,t,i)},toSave:function(){if(this.customerObj.id){var n=this.checkCommonForm(this.listForm);if(n){var i=[];this.productList.length>0&&this.productList.forEach((function(t){i.push({product_id:t.product_id,price:t.price,number:t.number,parts:t.parts,min_price:t.min_price})})),n=Object.assign({},n,{customer_id:this.customerObj.id,product:i,id:this.id}),(0,o.netEditBusiness)(n).then((function(n){t.showToast({title:n.msg,icon:"none"}),setTimeout((function(){t.navigateBack({delta:1})}),2e3)}))}}else t.showToast({title:"请选择客户名称",icon:"none"})}}};n.default=c}).call(this,i("543d")["default"])},"3dd0":function(t,n,i){"use strict";i.d(n,"b",(function(){return o})),i.d(n,"c",(function(){return c})),i.d(n,"a",(function(){return e}));var e={uniNumberBox:function(){return i.e("uni_modules/uni-number-box/components/uni-number-box/uni-number-box").then(i.bind(null,"2e8f"))}},o=function(){var t=this.$createElement,n=(this._self._c,this.productList.length);this.$mp.data=Object.assign({},{$root:{g0:n}})},c=[]},7400:function(t,n,i){"use strict";i.r(n);var e=i("3b51"),o=i.n(e);for(var c in e)["default"].indexOf(c)<0&&function(t){i.d(n,t,(function(){return e[t]}))}(c);n["default"]=o.a},"7b88":function(t,n,i){"use strict";(function(t,n){var e=i("4ea4");i("8886");e(i("66fd"));var o=e(i("91a5"));t.__webpack_require_UNI_MP_PLUGIN__=i,n(o.default)}).call(this,i("bc2e")["default"],i("543d")["createPage"])},"7c8e":function(t,n,i){},"91a5":function(t,n,i){"use strict";i.r(n);var e=i("3dd0"),o=i("7400");for(var c in o)["default"].indexOf(c)<0&&function(t){i.d(n,t,(function(){return o[t]}))}(c);i("a3ca");var s=i("f0c5"),r=Object(s["a"])(o["default"],e["b"],e["c"],!1,null,"08797610",null,!1,e["a"],void 0);n["default"]=r.exports},a3ca:function(t,n,i){"use strict";var e=i("7c8e"),o=i.n(e);o.a}},[["7b88","common/runtime","common/vendor"]]]);