(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-2ce8ac14"],{"0cb1":function(t,e,r){"use strict";r.r(e);var n=function(){var t=this,e=t.$createElement,r=t._self._c||e;return r("div",{staticClass:"padding24"},[r("a-form-model",{ref:"ruleForm",attrs:{model:t.form,rules:t.rules,labelAlign:"right","label-col":t.labelCol,"wrapper-col":t.wrapperCol}},[r("a-form-model-item",{attrs:{label:"商品名称",prop:"name"}},[r("a-input",{attrs:{maxLength:32,placeholder:"商品名称"},model:{value:t.form.name,callback:function(e){t.$set(t.form,"name",e)},expression:"form.name"}},[r("div",{attrs:{slot:"addonAfter"},slot:"addonAfter"},[t._v(t._s(t.form.name.length)+"/32")])])],1),r("a-form-model-item",{attrs:{label:"商品列表图",prop:"coverImg"}},[r("UpdataImg",{attrs:{UpdataImg:"",imgUrl:t.form.coverImg?[t.form.coverImg]:[]},on:{avatarfns:function(e){return t.form.coverImg=e[0]}}}),r("span",[t._v("建议尺寸:194 * 194,图片大小不超过500k")])],1),r("a-form-model-item",{attrs:{label:"商品头图",prop:"headImg","wrapper-col":{span:18}}},[t.draggable.coverBtn?r("div",[r("UpdataImg",{attrs:{UpdataImg:"",imageUrlNum:5,imgUrl:t.form.headImg},on:{avatarfns:function(e){return t.form.headImg=e}}}),r("a-button",{staticStyle:{"margin-top":"10px"},attrs:{type:"primary",disabled:0===t.form.headImg.length},on:{click:function(e){t.draggable.coverBtn=!1}}},[t._v("重新排序")])],1):r("div",[r("draggable",{staticClass:"listBox",attrs:{options:{animation:500}},model:{value:t.form.headImg,callback:function(e){t.$set(t.form,"headImg",e)},expression:"form.headImg"}},t._l(t.form.headImg,(function(t,e){return r("li",{key:e,staticClass:"listClass"},[r("img",{attrs:{src:t}})])})),0),r("a-button",{staticStyle:{"margin-top":"10px","margin-left":"6px"},on:{click:function(e){t.draggable.coverBtn=!0}}},[t._v("取消")])],1),r("span",[t._v("建议尺寸:750*750,图片大小不超过500k,最多可添加5张头图,可拖动改变显示顺序")])]),r("a-form-model-item",{attrs:{label:"商品描述",prop:"description"}},[r("a-textarea",{attrs:{placeholder:"请输入内容,不超过200字",rows:3},model:{value:t.form.description,callback:function(e){t.$set(t.form,"description",e)},expression:"form.description"}})],1),r("a-form-model-item",{attrs:{label:"商品详情图",prop:"detailsImg","wrapper-col":{span:18}}},[t.draggable.detailBtn?r("div",[r("UpdataImg",{attrs:{UpdataImg:"",imageUrlNum:3,imgUrl:t.form.detailsImg,urlSize:1024},on:{avatarfns:function(e){return t.form.detailsImg=e}}}),r("a-button",{staticStyle:{"margin-top":"10px"},attrs:{type:"primary",disabled:0===t.form.detailsImg.length},on:{click:function(e){t.draggable.detailBtn=!1}}},[t._v("重新排序")])],1):r("div",[r("draggable",{staticClass:"listBox",attrs:{options:{animation:500}},model:{value:t.form.detailsImg,callback:function(e){t.$set(t.form,"detailsImg",e)},expression:"form.detailsImg"}},t._l(t.form.detailsImg,(function(t,e){return r("li",{key:e,staticClass:"listClass"},[r("img",{attrs:{src:t}})])})),0),r("a-button",{staticStyle:{"margin-top":"10px","margin-left":"6px"},on:{click:function(e){t.draggable.detailBtn=!0}}},[t._v("取消")])],1),r("span",[t._v("建议尺寸:750*750,图片大小不超过1M,最多可添加3张图,可拖动改变显示顺序")])]),r("a-form-model-item",{attrs:{label:"商品分类",prop:"categoryId",required:""}},[r("a-select",{staticStyle:{width:"150px"},on:{change:t.handleCategoryChange},model:{value:t.form.categoryIdOne,callback:function(e){t.$set(t.form,"categoryIdOne",e)},expression:"form.categoryIdOne"}},t._l(t.firstTypes,(function(e,n){return r("a-select-option",{key:n,attrs:{value:e.id}},[t._v(t._s(e.name))])})),1),r("a-select",{staticStyle:{width:"150px","margin-left":"10px"},model:{value:t.form.categoryId,callback:function(e){t.$set(t.form,"categoryId",e)},expression:"form.categoryId"}},t._l(t.secondTypes,(function(e){return r("a-select-option",{key:e.id,attrs:{value:e.id}},[t._v(t._s(e.name))])})),1)],1),r("a-form-model-item",{attrs:{label:"商品价格",prop:"required_price",required:""}},[r("a-radio-group",{staticClass:"sale-radio-group",on:{change:t.changeSaleType},model:{value:t.form.saleType,callback:function(e){t.$set(t.form,"saleType",e)},expression:"form.saleType"}},[r("a-radio",{staticClass:"radio-item",attrs:{value:1}},[r("span",{staticClass:"label-text"},[t._v("仅支持现金售卖")]),r("a-input",{staticStyle:{width:"200px"},attrs:{addonBefore:"销售价"},on:{blur:t.changeSaleType},model:{value:t.saleTypeObj["1"].price,callback:function(e){t.$set(t.saleTypeObj["1"],"price",t._n(e))},expression:"saleTypeObj['1'].price"}})],1),r("a-radio",{staticClass:"radio-item",attrs:{value:2}},[r("span",{staticClass:"label-text"},[t._v("仅支持积分售卖")]),r("a-input",{staticStyle:{width:"200px"},attrs:{addonBefore:"积分值"},on:{blur:t.changeSaleType},model:{value:t.saleTypeObj["2"].creditPrice,callback:function(e){t.$set(t.saleTypeObj["2"],"creditPrice",t._n(e))},expression:"saleTypeObj['2'].creditPrice"}})],1),r("a-radio",{staticClass:"radio-item",attrs:{value:3}},[r("span",{staticClass:"label-text"},[t._v("现金或积分售卖")]),r("a-input",{staticStyle:{width:"200px"},attrs:{addonBefore:"销售价"},on:{blur:t.changeSaleType},model:{value:t.saleTypeObj["3"].price,callback:function(e){t.$set(t.saleTypeObj["3"],"price",t._n(e))},expression:"saleTypeObj['3'].price"}}),t._v(" 或 "),r("a-input",{staticStyle:{width:"200px"},attrs:{addonBefore:"积分值"},on:{blur:t.changeSaleType},model:{value:t.saleTypeObj["3"].creditPrice,callback:function(e){t.$set(t.saleTypeObj["3"],"creditPrice",t._n(e))},expression:"saleTypeObj['3'].creditPrice"}})],1)],1)],1),r("a-form-model-item",{attrs:{label:"商品库存",prop:"stock"}},[r("a-input-number",{staticStyle:{width:"150px"},attrs:{min:0},model:{value:t.form.stock,callback:function(e){t.$set(t.form,"stock",e)},expression:"form.stock"}})],1),r("a-form-model-item",{attrs:{label:"商品排序",prop:"rank"}},[r("a-input-number",{staticStyle:{width:"150px"},attrs:{min:0,placeholder:"数字越大越靠前"},model:{value:t.form.rank,callback:function(e){t.$set(t.form,"rank",e)},expression:"form.rank"}})],1),r("a-form-model-item",{attrs:{label:"是否实物",prop:"virtual",required:""}},[r("a-radio-group",{model:{value:t.form.virtual,callback:function(e){t.$set(t.form,"virtual",e)},expression:"form.virtual"}},[r("a-radio",{attrs:{value:0}},[t._v(" 是 ")]),r("a-radio",{attrs:{value:1}},[t._v(" 否 ")])],1)],1),r("a-form-model-item",{attrs:{label:"是否上架",prop:"state",required:""}},[r("a-radio-group",{model:{value:t.form.state,callback:function(e){t.$set(t.form,"state",e)},expression:"form.state"}},[r("a-radio",{attrs:{value:1}},[t._v(" 是 ")]),r("a-radio",{attrs:{value:2}},[t._v(" 否 ")])],1)],1)],1),r("FooterToolBar",{attrs:{collapsed:t.sideCollapsed}},[r("a-button",{staticClass:"margin_right60",on:{click:function(){return t.$router.go(-1)}}},[t._v("返回")]),r("a-button",{attrs:{type:"primary"},on:{click:t.handleSave}},[t._v("保存")])],1)],1)},a=[],o=r("5530"),i=r("1da1"),c=(r("96cf"),r("b76a")),s=r.n(c),u=r("5a70"),l=r("432b"),d=r("a65c"),f=r("acda"),p=(r("313e"),{mixins:[l["a"]],components:{draggable:s.a,UpdataImg:d["a"],FooterToolBar:u["a"]},data:function(){return{isAdd:!0,labelCol:{span:2},wrapperCol:{span:10},draggable:{coverBtn:!0,detailBtn:!0},form:{id:0!==+this.$route.params.productId?this.$route.params.productId:"",name:"",coverImg:"",description:"",headImg:[],detailsImg:[],categoryIdOne:0,priceType:"0",stock:0,state:1,rank:"",virtual:0,saleType:1,required_price:"",categoryId:0},firstTypes:[],secondTypes:[],rules:{name:[{required:!0,message:"请输入商品名称",trigger:"blur"},{max:32,message:"最多输入32个字符",trigger:"blur"}],coverImg:[{required:!0,message:"请上传商品列表图",trigger:["change","blur"]}],description:[{required:!0,message:"请输入商品描述",trigger:"blur"},{max:200,message:"最多输入200个字符",trigger:"blur"}],headImg:[{required:!0,message:"请上传商品头图",type:"array",trigger:["change","blur"]}],detailsImg:[{required:!0,message:"请上传封面图",type:"array",trigger:["change","blur"]}],categoryId:[{required:!0,type:"number",min:1,message:"请选择商品分类",trigger:["change","blur"]}],required_price:[{validator:this.validatePrice,trigger:["change","blur"]}],stock:[{required:!0,message:"请设置商品库存",type:"number",min:1,trigger:["change","blur"]}],rank:[{required:!0,message:"请设置商品排序",trigger:["change","blur"]}]},saleTypeObj:{1:{price:""},2:{creditPrice:""},3:{price:"",creditPrice:""}},changeType:!1}},created:function(){var t=this;return Object(i["a"])(regeneratorRuntime.mark((function e(){return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:if(0===+t.$route.params.productId){e.next=4;break}return t.isAdd=!1,e.next=4,t.getDetail();case 4:t.getCategoryLink();case 5:case"end":return e.stop()}}),e)})))()},methods:{validatePrice:function(t,e,r){var n,a=null===(n=this.saleTypeObj[this.form.saleType])||void 0===n?void 0:n.creditPrice;this.form.required_price?a&&parseInt(this.form.creditPrice,10)!==this.form.creditPrice?r(new Error("积分只能设置整数")):r():r(new Error("请输入商品价格"))},handleCategoryChange:function(t){this.changeType=!0,this.getCategoryLink(t)},getCategoryLink:function(){var t=arguments,e=this;return Object(i["a"])(regeneratorRuntime.mark((function r(){var n,a,o,i,c,s;return regeneratorRuntime.wrap((function(r){while(1)switch(r.prev=r.next){case 0:return n=t.length>0&&void 0!==t[0]?t[0]:0,a={parentId:n},r.next=4,Object(f["m"])(a);case 4:if(o=r.sent,i=o.code,c=o.data,200===i){r.next=9;break}return r.abrupt("return");case 9:if(0!==n){r.next=16;break}e.firstTypes=c,s=e.isAdd?c[0].id:e.form.categoryIdOne,e.form.categoryIdOne=s,e.getCategoryLink(s),r.next=21;break;case 16:if(e.secondTypes=c,0!==c.length){r.next=20;break}return e.form.categoryId=0,r.abrupt("return");case 20:(e.isAdd||e.changeType)&&(e.form.categoryId=c[0].id);case 21:case"end":return r.stop()}}),r)})))()},getDetail:function(){var t=this;return Object(i["a"])(regeneratorRuntime.mark((function e(){var r,n,a,o;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return r={id:+t.form.id},e.next=3,Object(f["o"])(r);case 3:if(n=e.sent,a=n.code,o=n.data,200===a){e.next=8;break}return e.abrupt("return");case 8:Object.assign(t.form,o),t.saleTypeObj[t.form.saleType].creditPrice=t.form.creditPrice,t.saleTypeObj[t.form.saleType].price=t.form.price,t.changeSaleType();case 12:case"end":return e.stop()}}),e)})))()},handleSave:function(){var t=this;this.$refs.ruleForm.validate(function(){var e=Object(i["a"])(regeneratorRuntime.mark((function e(r){return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:if(r){e.next=2;break}return e.abrupt("return");case 2:if(1===+t.form.saleType&&(t.form.creditPrice=0),2===+t.form.saleType&&(t.form.price=0),!t.isAdd){e.next=9;break}return e.next=7,t.add();case 7:e.next=11;break;case 9:return e.next=11,t.edit();case 11:case"end":return e.stop()}}),e)})));return function(t){return e.apply(this,arguments)}}())},add:function(){var t=this;return Object(i["a"])(regeneratorRuntime.mark((function e(){var r,n,a;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return delete t.form.id,r=Object(o["a"])({},t.form),e.next=4,Object(f["h"])(r);case 4:if(n=e.sent,a=n.code,200===a){e.next=8;break}return e.abrupt("return");case 8:t.$message.success("添加成功"),t.$router.push("/physicalCard/physicalGoods");case 10:case"end":return e.stop()}}),e)})))()},edit:function(){var t=this;return Object(i["a"])(regeneratorRuntime.mark((function e(){var r,n,a;return regeneratorRuntime.wrap((function(e){while(1)switch(e.prev=e.next){case 0:return r=Object(o["a"])({},t.form),e.next=3,Object(f["k"])(r);case 3:if(n=e.sent,a=n.code,200===a){e.next=7;break}return e.abrupt("return");case 7:t.$message.success("修改成功"),t.$router.push("/physicalCard/physicalGoods");case 9:case"end":return e.stop()}}),e)})))()},changeSaleType:function(t){var e,r,n=this.form.saleType;this.form.price=null===(e=this.saleTypeObj[n])||void 0===e?void 0:e.price,this.form.creditPrice=null===(r=this.saleTypeObj[n])||void 0===r?void 0:r.creditPrice,this.form.required_price=this.form.price||this.form.creditPrice}}}),m=p,h=(r("3850"),r("2877")),g=Object(h["a"])(m,n,a,!1,null,"24eff97e",null);e["default"]=g.exports},"1da1":function(t,e,r){"use strict";r.d(e,"a",(function(){return a}));r("d3b7");function n(t,e,r,n,a,o,i){try{var c=t[o](i),s=c.value}catch(u){return void r(u)}c.done?e(s):Promise.resolve(s).then(n,a)}function a(t){return function(){var e=this,r=arguments;return new Promise((function(a,o){var i=t.apply(e,r);function c(t){n(i,a,o,c,s,"next",t)}function s(t){n(i,a,o,c,s,"throw",t)}c(void 0)}))}}},3850:function(t,e,r){"use strict";r("a505")},"432b":function(t,e,r){"use strict";r.d(e,"a",(function(){return o}));var n=r("5530"),a=r("2f62"),o={computed:Object(n["a"])({},Object(a["b"])({sideCollapsed:function(t){return t.app.sideCollapsed}}))}},5530:function(t,e,r){"use strict";r.d(e,"a",(function(){return o}));r("b64b"),r("a4d3"),r("4de4"),r("e439"),r("159b"),r("dbb4");var n=r("ade3");function a(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),r.push.apply(r,n)}return r}function o(t){for(var e=1;e=0;--o){var i=this.tryEntries[o],c=i.completion;if("root"===i.tryLoc)return a("end");if(i.tryLoc<=this.prev){var s=n.call(i,"catchLoc"),u=n.call(i,"finallyLoc");if(s&&u){if(this.prev=0;--r){var a=this.tryEntries[r];if(a.tryLoc<=this.prev&&n.call(a,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),P(r),h}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var a=n.arg;P(r)}return a}}throw new Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:L(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),h}},t}(t.exports);try{regeneratorRuntime=n}catch(a){Function("r","regeneratorRuntime = r")(n)}},9940:function(t,e,r){},a505:function(t,e,r){},acda:function(t,e,r){"use strict";r.d(e,"g",(function(){return a})),r.d(e,"a",(function(){return o})),r.d(e,"f",(function(){return i})),r.d(e,"c",(function(){return c})),r.d(e,"d",(function(){return s})),r.d(e,"b",(function(){return u})),r.d(e,"e",(function(){return l})),r.d(e,"i",(function(){return d})),r.d(e,"l",(function(){return f})),r.d(e,"n",(function(){return p})),r.d(e,"s",(function(){return m})),r.d(e,"j",(function(){return h})),r.d(e,"p",(function(){return g})),r.d(e,"h",(function(){return v})),r.d(e,"k",(function(){return y})),r.d(e,"o",(function(){return b})),r.d(e,"r",(function(){return w})),r.d(e,"q",(function(){return x})),r.d(e,"m",(function(){return O}));var n=r("284b"),a=function(t){return n["a"].post("/adminv2/productPageList",t)},o=function(t){return n["a"].post("/adminv2/addProduct",t)},i=function(t){return n["a"].post("/adminv2/productDetail",t)},c=function(t){return n["a"].post("/adminv2/editProduct",t)},s=function(t){return n["a"].post("/adminv2/enableProduct",t)},u=function(t){return n["a"].post("/adminv2/disableProduct",t)},l=function(t){return n["a"].post("/adminv2/getCourseList",t)},d=function(t){return n["a"].post("/adminv2/shopgoods/addCategory",t)},f=function(t){return n["a"].post("/adminv2/shopgoods/editCategory",t)},p=function(t){return n["a"].post("/adminv2/shopgoods/categoryLists",t)},m=function(t){return n["a"].post("/adminv2/shopgoods/removedCategory",t)},h=function(t){return n["a"].post("/adminv2/shopgoods/delCategory",t)},g=function(t){return n["a"].post("/adminv2/shopgoods/lists",t)},v=function(t){return n["a"].post("/adminv2/shopgoods/add",t)},y=function(t){return n["a"].post("/adminv2/shopgoods/edit",t)},b=function(t){return n["a"].post("/adminv2/shopgoods/getOne",t)},w=function(t){return n["a"].post("/adminv2/shopgoods/removed",t)},x=function(t){return n["a"].post("/adminv2/shopgoods/goodsOrderInfo",t)},O=function(t){return n["a"].post("/adminv2/shopgoods/categoryLink",t)}},b64b:function(t,e,r){var n=r("23e7"),a=r("7b0b"),o=r("df75"),i=r("d039"),c=i((function(){o(1)}));n({target:"Object",stat:!0,forced:c},{keys:function(t){return o(a(t))}})},dbb4:function(t,e,r){var n=r("23e7"),a=r("83ab"),o=r("56ef"),i=r("fc6a"),c=r("06cf"),s=r("8418");n({target:"Object",stat:!0,sham:!a},{getOwnPropertyDescriptors:function(t){var e,r,n=i(t),a=c.f,u=o(n),l={},d=0;while(u.length>d)r=a(n,e=u[d++]),void 0!==r&&s(l,e,r);return l}})},e439:function(t,e,r){var n=r("23e7"),a=r("d039"),o=r("fc6a"),i=r("06cf").f,c=r("83ab"),s=a((function(){i(1)})),u=!c||s;n({target:"Object",stat:!0,forced:u,sham:!c},{getOwnPropertyDescriptor:function(t,e){return i(o(t),e)}})},e481:function(t,e,r){"use strict";r("9940")}}]); //# sourceMappingURL=chunk-2ce8ac14.92944336.js.map