You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

1 lines
4.3 KiB

(global["webpackJsonp"]=global["webpackJsonp"]||[]).push([["pages/life/addGoods/index"],{"0f5d":function(t,i,e){"use strict";e.r(i);var s=e("3c5d"),n=e("fe18");for(var a in n)"default"!==a&&function(t){e.d(i,t,(function(){return n[t]}))}(a);e("5796");var o,r=e("f0c5"),c=Object(r["a"])(n["default"],s["b"],s["c"],!1,null,null,null,!1,s["a"],o);i["default"]=c.exports},"3c5d":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=[]},5796:function(t,i,e){"use strict";var s=e("7cb6"),n=e.n(s);n.a},"7cb6":function(t,i,e){},bf90:function(t,i,e){"use strict";(function(t){Object.defineProperty(i,"__esModule",{value:!0}),i.default=void 0;var s=e("8c38"),n=e("fc49"),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.alertMessage("请至少上传一张商品图片"):this.alertMessage("请填写商品名称")},alertMessage:function(i){t.showToast({title:i,icon:"none"})}}};i.default=a}).call(this,e("543d")["default"])},d81a:function(t,i,e){"use strict";(function(t){e("0371");s(e("66fd"));var i=s(e("0f5d"));function s(t){return t&&t.__esModule?t:{default:t}}t(i.default)}).call(this,e("543d")["createPage"])},fe18:function(t,i,e){"use strict";e.r(i);var s=e("bf90"),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}},[["d81a","common/runtime","common/vendor"]]]);