|
|
|
(global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["pages/life/addGoods/index"],{"1f1c":function(t,i,e){"use strict";e.r(i);var s=e("8413"),n=e.n(s);for(var a in s)"default"!==a&&function(t){e.d(i,t,(function(){return s[t]}))}(a);i["default"]=n.a},"31aa":function(t,i,e){"use strict";e.r(i);var s=e("4bb0"),n=e("1f1c");for(var a in n)"default"!==a&&function(t){e.d(i,t,(function(){return n[t]}))}(a);e("d09a");var o,r=e("f0c5"),u=Object(r["a"])(n["default"],s["b"],s["c"],!1,null,null,null,!1,s["a"],o);i["default"]=u.exports},"4bb0":function(t,i,e){"use strict";var s;e.d(i,"b",(function(){return n})),e.d(i,"c",(function(){return a})),e.d(i,"a",(function(){return s}));var n=function(){var t=this,i=t.$createElement;t._self._c;t._isMounted||(t.e0=function(i){t.maskShow=!1,t.addOptionsDialog=!1})},a=[]},5629:function(t,i,e){"use strict";(function(t){e("ef82");s(e("66fd"));var i=s(e("31aa"));function s(t){return t&&t.__esModule?t:{default:t}}t(i.default)}).call(this,e("543d")["createPage"])},8413:function(t,i,e){"use strict";(function(t){Object.defineProperty(i,"__esModule",{value:!0}),i.default=void 0;var s=e("b6d1"),n=e("2df4"),a={data:function(){return{id:"",store_name:"",unit_name:"",image:"",slider_image:[],description:"",tempId:1,temp:"全国包邮",attrs:[{pic:"",price:"",ot_orice:"",stock:"",weight:"",volume:""}],attrArr:[],attr:{},state:0,maskShow:!1,addOptionsDialog:!1,infinite:!1}},onLoad:function(){var i=this;this.id=this.$yroute.query.id||"",this.id?(t.setNavigationBarTitle({title:"修改商品"}),(0,n.getProductInfo)({id:this.id}).then((function(t){var e=t.data;i.slider_image=e.slider_image,i.image=e.slider_image[0],i.unit_name=e.unit_name,i.description=e.description,i.store_name=e.store_name,i.attrs=e.attrs}))):console.log("新增")},methods:{uploadImgs:function(){var t=this;(0,s.chooseImages)((function(i){t.slider_image.push(i)}))},uploadImg:function(t){var i=this;(0,s.chooseImage)((function(e){i.slider_image[t]?i.$set(i.slider_image,t,e):i.slider_image.push(e)}))},uploadSkuImg:function(t){var i=this;(0,s.chooseImage)((function(e){i.$set(i.attrs,t,{pic:e})}))},toGoodsDetails:function(){t.navigateTo({url:"/pages/life/goodsDetails/index?desc="+encodeURIComponent(this.description)})},toTempList:function(){t.navigateTo({url:"/pages/life/tempList/index"})},addAttr:function(){var t={attrName:"",attrOptions:[{name:""}]};this.attr=t,this.maskShow=!0,this.addOptionsDialog=!0},editAttr:function(t){this.attr=this.attrArr[t],this.maskShow=!0,this.addOptionsDialog=!0},delAttr:function(t){this.attrArr.splice(t,1)},addOption:function(){this.attr.attrOptions.push({name:""})},delOption:function(t,i){this.attr.attrOptions.splice(i,1)},submitAddAttr:function(){this.addOptionsDialog=!1,this.maskShow=!1,this.attrArr.push(this.attr),console.log(this.attrArr,"attrArr")},addSku:function(){var i={pic:"",price:"",ot_orice:"",stock:"",weight:"",volume:""};this.attrs.push(i),t.pageScrollTo({scrollTop:999999})},delSku:function(t){this.attrs.splice(t,1)},stockChange:function(t){this.infinite=!t.detail.value},radioChange:function(t){this.state=t.detail.value},submit:function(){var i=this,e={store_name:this.store_name,unit_name:this.unit_name,image:this.slider_image[0],slider_image:this.slider_image,description:this.description,tempId:1,attrs:this.attrs,state:this.state,spec_type:this.attrs.length>1?1:0};""!=e.store_name?""!=e.slider_image[0]?""!=e.description&&""!=e.description?(e.attrs.forEach((function(t,e){""!=t.price?""!=t.stock||i.alertMessage("请商品规格库存"):i.alertMessage("请商品规格价格")})),""!=this.id?(e.id=this.id,(0,n.editProduct)(e).then((function(i){i.success?(t.showToast({title:i.msg,duration:1500}),setTimeout((function(i){t.navigateTo({url:"pages/user/goodsManage/index"})}),1500)):t.showToast({title:i.msg,icon:"none"})}))):(0,n.addProduct)(e).then((function(i){i.success?(t.showToast({title:i.msg,duration:1500}),setTimeout((function(i){t.navigateTo({url:"pages/user/goodsManage/index"})}),1500)):t.showToast({title:i.msg,icon:"none"})})),console.log(e,"form")):this.alertMessage("请填写商品详情"):this.
|