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.
3 lines
118 KiB
3 lines
118 KiB
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["goods"],{"01d7":function(e,t,a){},"0758":function(e,t,a){"use strict";a("6b8c")},"0bb2":function(e,t,a){"use strict";a("bcd0")},1827:function(e,t,a){"use strict";a.d(t,"c",(function(){return o})),a.d(t,"a",(function(){return s})),a.d(t,"b",(function(){return l}));var r=a("b775"),i={list:"/goods.import/list",batch:"/goods.import/batch",delete:"/goods.import/delete"};function o(e){return Object(r["b"])({url:i.list,method:"get",params:e})}function s(e){return Object(r["b"])({url:i.batch,method:"post",data:e})}function l(e){return Object(r["b"])({url:i.delete,method:"post",data:e})}},"1d19b":function(e,t,a){"use strict";a.r(t);var r=function(){var e=this,t=e._self._c;return t("a-card",{attrs:{bordered:!1}},[t("content-header",{attrs:{title:e.$route.meta.title}}),t("div",{staticClass:"table-operator"},[t("a-button",{attrs:{type:"primary",icon:"plus"},on:{click:e.handleAdd}},[e._v("新增")])],1),e.isLoading?e._e():t("a-table",{attrs:{rowKey:"category_id",columns:e.columns,dataSource:e.categoryList,defaultExpandAllRows:!0,expandIconColumnIndex:1,pagination:!1,loading:e.isLoading},scopedSlots:e._u([{key:"status",fn:function(a){return t("span",{},[t("a-tag",{attrs:{color:a?"green":""}},[e._v(e._s(a?"显示":"隐藏"))])],1)}},{key:"action",fn:function(a,r){return t("span",{},[t("a",{staticStyle:{"margin-right":"8px"},on:{click:function(t){return e.handleEdit(r)}}},[e._v("编辑")]),t("a",{on:{click:function(t){return e.handleDelete(r)}}},[e._v("删除")])])}}],null,!1,1485366870)}),t("AddForm",{ref:"AddForm",attrs:{categoryList:e.categoryList},on:{handleSubmit:e.handleRefresh}}),t("EditForm",{ref:"EditForm",attrs:{categoryList:e.categoryList},on:{handleSubmit:e.handleRefresh}})],1)},i=[],o=(a("d3b7"),a("2f71")),s=a("2af9"),l=function(){var e=this,t=e._self._c;return t("a-modal",{attrs:{title:"新增商品分类",width:720,visible:e.visible,confirmLoading:e.confirmLoading,maskClosable:!1,destroyOnClose:!0},on:{ok:e.handleSubmit,cancel:e.handleCancel}},[t("a-spin",{attrs:{spinning:e.confirmLoading}},[t("a-form",{attrs:{form:e.form}},[t("a-form-item",{attrs:{label:"分类名称",labelCol:e.labelCol,wrapperCol:e.wrapperCol}},[t("a-input",{directives:[{name:"decorator",rawName:"v-decorator",value:["name",{rules:[{required:!0,min:2,message:"请输入至少2个字符"}]}],expression:"['name', { rules: [{ required: true, min: 2, message: '请输入至少2个字符' }] }]"}]})],1),t("a-form-item",{attrs:{label:"上级分类",labelCol:e.labelCol,wrapperCol:e.wrapperCol}},[t("a-tree-select",{directives:[{name:"decorator",rawName:"v-decorator",value:["parent_id",{initialValue:0}],expression:"['parent_id', { initialValue: 0}]"}],attrs:{treeData:e.categoryListTree,dropdownStyle:{maxHeight:"400px",overflow:"auto"},allowClear:""}})],1),t("a-form-item",{attrs:{label:"分类图片",labelCol:e.labelCol,wrapperCol:e.wrapperCol}},[t("SelectImage",{directives:[{name:"decorator",rawName:"v-decorator",value:["image_id"],expression:"['image_id']"}]})],1),t("a-form-item",{attrs:{label:"是否加入排行榜",labelCol:e.labelCol,wrapperCol:e.wrapperCol,extra:"是否加入排行榜"}},[t("a-radio-group",{directives:[{name:"decorator",rawName:"v-decorator",value:["is_paihang",{initialValue:0,rules:[{required:!0}]}],expression:"['is_paihang', { initialValue: 0, rules: [{ required: true }] }]"}]},[t("a-radio",{attrs:{value:0}},[e._v("不加入")]),t("a-radio",{attrs:{value:1}},[e._v("加入")])],1)],1),t("a-form-item",{attrs:{label:"是否热门",labelCol:e.labelCol,wrapperCol:e.wrapperCol,extra:"是否热门"}},[t("a-radio-group",{directives:[{name:"decorator",rawName:"v-decorator",value:["is_hot",{initialValue:0,rules:[{required:!0}]}],expression:"['is_hot', { initialValue: 0, rules: [{ required: true }] }]"}]},[t("a-radio",{attrs:{value:0}},[e._v("否")]),t("a-radio",{attrs:{value:1}},[e._v("是")])],1)],1),t("a-form-item",{attrs:{label:"是否店内",labelCol:e.labelCol,wrapperCol:e.wrapperCol}},[t("a-radio-group",{directives:[{name:"decorator",rawName:"v-decorator",value:["is_in_store",{initialValue:0,rules:[{required:!0}]}],expression:"['is_in_store', { initialValue: 0, rules: [{ required: true }] }]"}]},[t("a-radio",{attrs:{value:0}},[e._v("否")]),t("a-radio",{attrs:{value:1}},[e._v("是")])],1)],1),t("a-form-item",{attrs:{label:"状态",labelCol:e.labelCol,wrapperCol:e.wrapperCol,extra:"用户端是否展示"}},[t("a-radio-group",{directives:[{name:"decorator",rawName:"v-decorator",value:["status",{initialValue:1,rules:[{required:!0}]}],expression:"['status', { initialValue: 1, rules: [{ required: true }] }]"}]},[t("a-radio",{attrs:{value:1}},[e._v("显示")]),t("a-radio",{attrs:{value:0}},[e._v("隐藏")])],1)],1),t("a-form-item",{attrs:{label:"排序",labelCol:e.labelCol,wrapperCol:e.wrapperCol,extra:"数字越小越靠前"}},[t("a-input-number",{directives:[{name:"decorator",rawName:"v-decorator",value:["sort",{initialValue:100,rules:[{required:!0,message:"请输入至少1个数字"}]}],expression:"['sort', { initialValue: 100, rules: [{ required: true, message: '请输入至少1个数字' }] }]"}],attrs:{min:0}})],1)],1)],1)],1)},n=[],d=(a("99af"),a("8243")),u={components:{SelectImage:s["g"]},props:{categoryList:{type:Array,required:!0}},data:function(){return{title:"",labelCol:{span:7},wrapperCol:{span:13},visible:!1,confirmLoading:!1,form:this.$form.createForm(this),categoryListTree:[]}},methods:{add:function(){this.visible=!0,this.getCategoryList()},getCategoryList:function(){var e=this.categoryList,t=d["a"].formatTreeData(e);this.categoryListTree=[{title:"顶级分类",key:0,value:0}].concat(t)},handleSubmit:function(e){var t=this;e.preventDefault();var a=this.form.validateFields;a((function(e,a){e||t.onFormSubmit(a)}))},handleCancel:function(){this.visible=!1,this.form.resetFields()},onFormSubmit:function(e){var t=this;this.confirmLoading=!0,o["a"]({form:e}).then((function(a){t.$message.success(a.message,1.5),t.handleCancel(),t.$emit("handleSubmit",e)})).finally((function(e){t.confirmLoading=!1}))}}},c=u,p=a("2877"),m=Object(p["a"])(c,l,n,!1,null,null,null),v=m.exports,f=function(){var e=this,t=e._self._c;return t("a-modal",{attrs:{title:"编辑商品分类",width:720,visible:e.visible,confirmLoading:e.confirmLoading,maskClosable:!1,destroyOnClose:!0},on:{ok:e.handleSubmit,cancel:e.handleCancel}},[t("a-spin",{attrs:{spinning:e.confirmLoading}},[t("a-form",{attrs:{form:e.form}},[t("a-form-item",{attrs:{label:"分类名称",labelCol:e.labelCol,wrapperCol:e.wrapperCol}},[t("a-input",{directives:[{name:"decorator",rawName:"v-decorator",value:["name",{rules:[{required:!0,min:2,message:"请输入至少2个字符"}]}],expression:"['name', { rules: [{ required: true, min: 2, message: '请输入至少2个字符' }] }]"}]})],1),t("a-form-item",{attrs:{label:"上级分类",labelCol:e.labelCol,wrapperCol:e.wrapperCol}},[t("a-tree-select",{directives:[{name:"decorator",rawName:"v-decorator",value:["parent_id"],expression:"['parent_id']"}],attrs:{treeData:e.categoryListTree,dropdownStyle:{maxHeight:"400px",overflow:"auto"},allowClear:""}})],1),t("a-form-item",{attrs:{label:"分类图片",labelCol:e.labelCol,wrapperCol:e.wrapperCol}},[t("SelectImage",{directives:[{name:"decorator",rawName:"v-decorator",value:["image_id"],expression:"['image_id']"}],attrs:{defaultList:e.record.image?[e.record.image]:[]}})],1),t("a-form-item",{attrs:{label:"是否加入排行榜",labelCol:e.labelCol,wrapperCol:e.wrapperCol,extra:"是否加入排行榜"}},[t("a-radio-group",{directives:[{name:"decorator",rawName:"v-decorator",value:["is_paihang",{initialValue:0,rules:[{required:!0}]}],expression:"['is_paihang', { initialValue: 0, rules: [{ required: true }] }]"}]},[t("a-radio",{attrs:{value:0}},[e._v("不加入")]),t("a-radio",{attrs:{value:1}},[e._v("加入")])],1)],1),t("a-form-item",{attrs:{label:"是否热门",labelCol:e.labelCol,wrapperCol:e.wrapperCol,extra:"是否热门"}},[t("a-radio-group",{directives:[{name:"decorator",rawName:"v-decorator",value:["is_hot",{initialValue:0,rules:[{required:!0}]}],expression:"['is_hot', { initialValue: 0, rules: [{ required: true }] }]"}]},[t("a-radio",{attrs:{value:0}},[e._v("否")]),t("a-radio",{attrs:{value:1}},[e._v("是")])],1)],1),t("a-form-item",{attrs:{label:"是否店内",labelCol:e.labelCol,wrapperCol:e.wrapperCol}},[t("a-radio-group",{directives:[{name:"decorator",rawName:"v-decorator",value:["is_in_store",{initialValue:0,rules:[{required:!0}]}],expression:"['is_in_store', { initialValue: 0, rules: [{ required: true }] }]"}]},[t("a-radio",{attrs:{value:0}},[e._v("否")]),t("a-radio",{attrs:{value:1}},[e._v("是")])],1)],1),t("a-form-item",{attrs:{label:"状态",labelCol:e.labelCol,wrapperCol:e.wrapperCol,extra:"用户端是否展示"}},[t("a-radio-group",{directives:[{name:"decorator",rawName:"v-decorator",value:["status",{initialValue:1,rules:[{required:!0}]}],expression:"['status', { initialValue: 1, rules: [{ required: true }] }]"}]},[t("a-radio",{attrs:{value:1}},[e._v("显示")]),t("a-radio",{attrs:{value:0}},[e._v("隐藏")])],1)],1),t("a-form-item",{attrs:{label:"排序",labelCol:e.labelCol,wrapperCol:e.wrapperCol,extra:"数字越小越靠前"}},[t("a-input-number",{directives:[{name:"decorator",rawName:"v-decorator",value:["sort",{initialValue:100,rules:[{required:!0,message:"请输入至少1个数字"}]}],expression:"['sort', { initialValue: 100, rules: [{ required: true, message: '请输入至少1个数字' }] }]"}],attrs:{min:0}})],1)],1)],1)],1)},h=[],g=a("2ef0"),_=a.n(g),b={components:{SelectImage:s["g"]},props:{categoryList:{type:Array,required:!0}},data:function(){return{title:"",labelCol:{span:7},wrapperCol:{span:13},visible:!1,confirmLoading:!1,form:this.$form.createForm(this),categoryListTree:[],record:{}}},methods:{edit:function(e){this.visible=!0,this.record=e,this.getCategoryList(),this.setFieldsValue()},setFieldsValue:function(){var e=this.record,t=this.form.setFieldsValue;this.$nextTick((function(){t(_.a.pick(e,["name","parent_id","image_id","status","sort","is_paihang","is_hot","is_in_store"]))}))},getCategoryList:function(){var e=this.categoryList,t=d["a"].formatTreeData(e);this.categoryListTree=[{title:"顶级分类",key:0,value:0}].concat(t)},handleSubmit:function(e){var t=this;e.preventDefault();var a=this.form.validateFields;a((function(e,a){e||t.onFormSubmit(a)}))},handleCancel:function(){this.visible=!1,this.form.resetFields()},onFormSubmit:function(e){var t=this;this.confirmLoading=!0,o["c"]({categoryId:this.record["category_id"],form:e}).then((function(a){t.$message.success(a.message,1.5),t.handleCancel(),t.$emit("handleSubmit",e)})).finally((function(e){t.confirmLoading=!1}))}}},y=b,C=Object(p["a"])(y,f,h,!1,null,null,null),w=C.exports,x={name:"Index",components:{ContentHeader:s["a"],STable:s["e"],AddForm:v,EditForm:w},data:function(){return{categoryList:[],queryParam:{},isLoading:!1,columns:[{title:"分类ID",dataIndex:"category_id"},{title:"分类名称",dataIndex:"name"},{title:"状态",dataIndex:"status",scopedSlots:{customRender:"status"}},{title:"排序",dataIndex:"sort"},{title:"添加时间",dataIndex:"create_time"},{title:"操作",dataIndex:"action",width:"180px",scopedSlots:{customRender:"action"}}]}},created:function(){this.getCategoryList(!0)},methods:{getCategoryList:function(e){var t=this;e&&(this.isLoading=!0),o["d"]().then((function(e){t.categoryList=e.data.list})).finally((function(){return t.isLoading=!1}))},handleAdd:function(){this.$refs.AddForm.add()},handleEdit:function(e){this.$refs.EditForm.edit(e)},handleDelete:function(e){var t=this,a=this.$confirm({title:"您确定要删除该记录吗?",content:"删除后不可恢复",onOk:function(){return o["b"]({categoryId:e["category_id"]}).then((function(e){t.$message.success(e.message,1.5),t.handleRefresh()})).finally((function(e){return a.destroy()}))}})},handleRefresh:function(){this.getCategoryList()}}},L=x,S=Object(p["a"])(L,r,i,!1,null,null,null);t["default"]=S.exports},"1da1":function(e,t,a){"use strict";a.d(t,"a",(function(){return i}));a("d3b7");function r(e,t,a,r,i,o,s){try{var l=e[o](s),n=l.value}catch(d){return void a(d)}l.done?t(n):Promise.resolve(n).then(r,i)}function i(e){return function(){var t=this,a=arguments;return new Promise((function(i,o){var s=e.apply(t,a);function l(e){r(s,i,o,l,n,"next",e)}function n(e){r(s,i,o,l,n,"throw",e)}l(void 0)}))}}},"34c5":function(e,t,a){},"34e1":function(e,t,a){"use strict";a("e671")},"3bcc":function(e,t,a){"use strict";a("f4a8")},"54d6":function(e,t,a){"use strict";a("01d7")},"59aa":function(e,t,a){"use strict";a.d(t,"a",(function(){return i})),a.d(t,"b",(function(){return o}));var r=a("5c06"),i=new r["a"]([{key:"PHYSICAL",name:"实物商品",value:10},{key:"VIRTUAL",name:"虚拟商品",value:20}]),o=(new r["a"]([{key:"SINGLE",name:"单规格",value:10},{key:"MULTI",name:"多规格",value:20}]),new r["a"]([{key:"NORMAL",name:"进行中",value:10},{key:"COMPLETED",name:"导入完成",value:20}]));new r["a"]([{key:"NORMAL",name:"进行中",value:10},{key:"COMPLETED",name:"采集完成",value:20}])},6948:function(e,t,a){},"6b35":function(e,t,a){"use strict";a("a70e")},"6b8c":function(e,t,a){},"704a":function(e,t,a){"use strict";a.r(t);a("b0c0");var r=function(){var e=this,t=e._self._c;return t("a-card",{attrs:{bordered:!1}},[t("div",{staticClass:"card-title"},[e._v(e._s(e.$route.meta.title))]),t("a-spin",{attrs:{spinning:e.isLoading}},[t("a-form",{attrs:{form:e.form,selfUpdate:!0},on:{submit:e.handleSubmit}},[t("a-tabs",{attrs:{activeKey:e.tabKey,tabBarStyle:{marginBottom:"30px"}},on:{change:e.handleTabs}},[t("a-tab-pane",{key:0,attrs:{tab:"基本信息"}}),t("a-tab-pane",{key:1,attrs:{tab:"规格/库存"}}),t("a-tab-pane",{key:2,attrs:{tab:"商品详情"}}),t("a-tab-pane",{key:3,attrs:{tab:"更多设置"}})],1),t("div",{staticClass:"tabs-content"},[t("div",{directives:[{name:"show",rawName:"v-show",value:0==e.tabKey,expression:"tabKey == 0"}],staticClass:"tab-pane"},[t("a-form-item",{attrs:{label:"商品类型",labelCol:e.labelCol,wrapperCol:e.wrapperCol}},[t("GoodsType",{directives:[{name:"decorator",rawName:"v-decorator",value:["goods_type",{initialValue:10,rules:[{required:!0}]}],expression:"['goods_type', { initialValue: 10, rules: [{ required: true }] }]"}],on:{change:function(t){return e.onForceUpdate(!0)}}})],1),t("a-form-item",{attrs:{label:"商品名称",labelCol:e.labelCol,wrapperCol:e.wrapperCol}},[t("a-input",{directives:[{name:"decorator",rawName:"v-decorator",value:["goods_name",{rules:[{required:!0,min:2,message:"请输入至少2个字符"}]}],expression:"['goods_name', { rules: [{ required: true, min: 2, message: '请输入至少2个字符' }] }]"}],attrs:{placeholder:"请输入商品名称"}})],1),t("a-form-item",{attrs:{label:"商品分类",labelCol:e.labelCol,wrapperCol:e.wrapperCol}},[t("a-tree-select",{directives:[{name:"decorator",rawName:"v-decorator",value:["categorys",{rules:[{required:!0,message:"请至少选择1个商品分类"}]}],expression:"['categorys', { rules: [{ required: true, message: '请至少选择1个商品分类' }] }]"}],attrs:{placeholder:"请选择商品分类",dropdownStyle:{maxHeight:"500px",overflow:"auto"},treeData:e.formData.categoryList,treeCheckable:"",treeCheckStrictly:"",allowClear:""}}),t("div",{staticClass:"form-item-help"},[t("router-link",{attrs:{target:"_blank",to:{path:"/goods/category/index"}}},[e._v("去新增")]),t("a",{attrs:{href:"javascript:;"},on:{click:e.onReloadCategoryList}},[e._v("刷新")])],1)],1),t("a-form-item",{attrs:{label:"商品图片",labelCol:e.labelCol,wrapperCol:e.wrapperCol,extra:"建议尺寸:750*750像素, 最多上传10张, 可拖拽图片调整顺序, 第1张将作为商品首图"}},[t("SelectImage",{directives:[{name:"decorator",rawName:"v-decorator",value:["imagesIds",{rules:[{required:!0,message:"请至少上传1张商品图片"}]}],expression:"['imagesIds', { rules: [{ required: true, message: '请至少上传1张商品图片' }] }]"}],attrs:{multiple:"",maxNum:10}})],1),t("a-form-item",{attrs:{label:"商品编码",labelCol:e.labelCol,wrapperCol:e.wrapperCol}},[t("a-input",{directives:[{name:"decorator",rawName:"v-decorator",value:["goods_no"],expression:"['goods_no']"}],attrs:{placeholder:"请输入商品编码"}})],1),t("a-form-item",{attrs:{label:"热卖指数",labelCol:e.labelCol,wrapperCol:e.wrapperCol}},[t("a-input",{directives:[{name:"decorator",rawName:"v-decorator",value:["remaizhishu"],expression:"['remaizhishu']"}],attrs:{placeholder:"热卖指数"}})],1),t("a-form-item",{attrs:{label:"商品状态",labelCol:e.labelCol,wrapperCol:e.wrapperCol}},[t("a-radio-group",{directives:[{name:"decorator",rawName:"v-decorator",value:["status",{initialValue:10,rules:[{required:!0}]}],expression:"['status', { initialValue: 10, rules: [{ required: true }] }]"}]},[t("a-radio",{attrs:{value:10}},[e._v("上架")]),t("a-radio",{attrs:{value:20}},[e._v("下架")])],1)],1),t("a-form-item",{attrs:{label:"商品排序",labelCol:e.labelCol,wrapperCol:e.wrapperCol,extra:"数字越小越靠前"}},[t("a-input-number",{directives:[{name:"decorator",rawName:"v-decorator",value:["sort",{initialValue:100,rules:[{required:!0}]}],expression:"['sort', { initialValue: 100, rules: [{ required: true }] }]"}],attrs:{min:0}})],1)],1),t("div",{directives:[{name:"show",rawName:"v-show",value:1==e.tabKey,expression:"tabKey == 1"}],staticClass:"tab-pane"},[t("a-form-item",{attrs:{label:"规格类型",labelCol:e.labelCol,wrapperCol:e.wrapperCol}},[t("a-radio-group",{directives:[{name:"decorator",rawName:"v-decorator",value:["spec_type",{initialValue:10,rules:[{required:!0}]}],expression:"['spec_type', { initialValue: 10, rules: [{ required: true }] }]"}],on:{change:function(t){return e.onForceUpdate()}}},[t("a-radio",{attrs:{value:10}},[e._v("单规格")])],1)],1),t("div",{directives:[{name:"show",rawName:"v-show",value:20==e.form.getFieldValue("spec_type"),expression:"form.getFieldValue('spec_type') == 20"}]},[t("MultiSpec",{ref:"MultiSpec"})],1),t("div",{directives:[{name:"show",rawName:"v-show",value:10==e.form.getFieldValue("spec_type"),expression:"form.getFieldValue('spec_type') == 10"}]},[t("a-form-item",{attrs:{label:"商品价格",labelCol:e.labelCol,wrapperCol:e.wrapperCol,extra:"商品的实际购买金额,最低0.01"}},[t("a-input-number",{directives:[{name:"decorator",rawName:"v-decorator",value:["goods_price",{initialValue:1,rules:[{required:!0,message:"请输入商品价格"}]}],expression:"['goods_price', { initialValue: 1, rules: [{ required: true, message: '请输入商品价格' }] }]"}],attrs:{min:.01,precision:2}}),t("span",{staticClass:"ml-10"},[e._v("元")])],1),t("a-form-item",{attrs:{label:"成本价",labelCol:e.labelCol,wrapperCol:e.wrapperCol,extra:"成本价仅用于商品页展示"}},[t("a-input-number",{directives:[{name:"decorator",rawName:"v-decorator",value:["cost_price"],expression:"['cost_price']"}],attrs:{min:0,precision:2}}),t("span",{staticClass:"ml-10"},[e._v("元")])],1),t("a-form-item",{attrs:{label:"当前库存数量",labelCol:e.labelCol,wrapperCol:e.wrapperCol,extra:"商品的实际库存数量,为0时用户无法下单"}},[t("a-input-number",{directives:[{name:"decorator",rawName:"v-decorator",value:["stock_num",{initialValue:100,rules:[{required:!0,message:"请输入库存数量"}]}],expression:"['stock_num', { initialValue: 100, rules: [{ required: true, message: '请输入库存数量' }] }]"}],attrs:{min:0,precision:0}}),t("span",{staticClass:"ml-10"},[e._v("件")])],1),t("a-form-item",{attrs:{label:"商品重量",labelCol:e.labelCol,wrapperCol:e.wrapperCol,extra:"商品的实际重量,用于计算运费"}},[t("a-input-number",{directives:[{name:"decorator",rawName:"v-decorator",value:["goods_weight",{initialValue:0,rules:[{required:!0,message:"请输入库存数量"}]}],expression:"['goods_weight', { initialValue: 0, rules: [{ required: true, message: '请输入库存数量' }] }]"}],attrs:{min:0}}),t("span",{staticClass:"ml-10"},[e._v("千克 (Kg)")])],1)],1)],1),t("div",{directives:[{name:"show",rawName:"v-show",value:2==e.tabKey,expression:"tabKey == 2"}],staticClass:"tab-pane"},[t("a-form-item",{attrs:{label:"商品详情",labelCol:e.labelCol,wrapperCol:{span:16}}},[t("Ueditor",{directives:[{name:"decorator",rawName:"v-decorator",value:["content",{rules:[{required:!0,message:"商品详情不能为空"}]}],expression:"['content', { rules: [{ required: true, message: '商品详情不能为空' }] }]"}]})],1)],1),t("div",{directives:[{name:"show",rawName:"v-show",value:3==e.tabKey,expression:"tabKey == 3"}],staticClass:"tab-pane"},[t("a-form-item",{attrs:{label:"主图视频",labelCol:e.labelCol,wrapperCol:e.wrapperCol,extra:"建议视频宽高比19:9,建议时长8-45秒"}},[t("SelectVideo",{directives:[{name:"decorator",rawName:"v-decorator",value:["video_id"],expression:"['video_id']"}],attrs:{multiple:!1}})],1),t("a-form-item",{attrs:{label:"视频封面",labelCol:e.labelCol,wrapperCol:e.wrapperCol,extra:"建议尺寸:750像素*750像素"}},[t("SelectImage",{directives:[{name:"decorator",rawName:"v-decorator",value:["video_cover_id"],expression:"['video_cover_id']"}],attrs:{multiple:!1}})],1),t("a-form-item",{attrs:{label:"商品卖点",labelCol:e.labelCol,wrapperCol:e.wrapperCol,extra:"一句话简述,例如:此款商品美观大方 性价比较高 不容错过"}},[t("a-input",{directives:[{name:"decorator",rawName:"v-decorator",value:["selling_point"],expression:"['selling_point']"}],attrs:{placeholder:"请输入商品卖点"}})],1),t("a-form-item",{staticStyle:{display:"none"},attrs:{label:"服务与承诺",labelCol:e.labelCol,wrapperCol:e.wrapperCol}},[e.formData.serviceList?t("a-select",{directives:[{name:"decorator",rawName:"v-decorator",value:["serviceIds",{initialValue:e.formData.defaultServiceIds}],expression:"['serviceIds', { initialValue: formData.defaultServiceIds }]"}],attrs:{mode:"multiple",placeholder:"请选择服务与承诺"}},e._l(e.formData.serviceList,(function(a,r){return t("a-select-option",{key:r,attrs:{value:a.service_id}},[e._v(e._s(a.name))])})),1):e._e(),t("div",{staticClass:"form-item-help"},[t("router-link",{attrs:{target:"_blank",to:{path:"/goods/service/index"}}},[e._v("去新增")]),t("a",{attrs:{href:"javascript:;"},on:{click:e.onReloadServiceList}},[e._v("刷新")])],1)],1),t("a-form-item",{attrs:{label:"初始销量",labelCol:e.labelCol,wrapperCol:e.wrapperCol,extra:"用户端展示的销量 = 初始销量 + 实际销量"}},[t("a-input-number",{directives:[{name:"decorator",rawName:"v-decorator",value:["sales_initial",{initialValue:0}],expression:"['sales_initial', { initialValue: 0}]"}]})],1),t("div",[t("a-divider",{attrs:{orientation:"left"}},[e._v("销售区域")]),t("a-form-item",{attrs:{label:"销售区域",labelCol:e.labelCol,wrapperCol:{span:15}}},[t("a-table",{directives:[{name:"show",rawName:"v-show",value:e.ruleList.length,expression:"ruleList.length"}],staticClass:"table-rules",attrs:{columns:e.columns,dataSource:e.ruleList,pagination:!1,bordered:""},scopedSlots:e._u([{key:"region_text",fn:function(a,r,i){return[t("p",{staticClass:"content"},e._l(a,(function(a,r){return t("span",{key:r},[t("span",[e._v(e._s(a.name))]),a.citys.length?[t("span",[e._v("(")]),e._l(a.citys,(function(r,i){return t("span",{key:i,staticClass:"city-name"},[e._v(e._s(r.name)+e._s(a.citys.length>i+1?"、":""))])})),t("span",[e._v(")")])]:e._e(),t("span",[e._v(e._s(" "))])],2)})),0),t("p",{staticClass:"operation"},[t("a",{staticClass:"edit",attrs:{href:"javascript:void(0);"},on:{click:function(t){return e.handleEdit(i,r)}}},[e._v("编辑")]),t("a",{staticClass:"delete",attrs:{href:"javascript:void(0);"},on:{click:function(t){return e.handleDelete(i)}}},[e._v("删除")])])]}}])}),t("a-button",{attrs:{icon:"environment"},on:{click:e.handleAdd}},[e._v("点击添加销售区域")])],1)],1),t("div",{staticStyle:{display:"none"}},[t("a-divider",{attrs:{orientation:"left"}},[e._v("积分设置")]),t("a-form-item",{attrs:{label:"积分赠送",labelCol:e.labelCol,wrapperCol:e.wrapperCol,extra:"开启后用户购买此商品将获得积分"}},[t("a-radio-group",{directives:[{name:"decorator",rawName:"v-decorator",value:["is_points_gift",{initialValue:1,rules:[{required:!0}]}],expression:"['is_points_gift', { initialValue: 1, rules: [{ required: true }] }]"}]},[t("a-radio",{attrs:{value:1}},[e._v("开启")]),t("a-radio",{attrs:{value:0}},[e._v("关闭")])],1)],1),t("a-form-item",{attrs:{label:"积分抵扣",labelCol:e.labelCol,wrapperCol:e.wrapperCol,extra:"开启后用户购买此商品可以使用积分进行抵扣"}},[t("a-radio-group",{directives:[{name:"decorator",rawName:"v-decorator",value:["is_points_discount",{initialValue:1,rules:[{required:!0}]}],expression:"['is_points_discount', { initialValue: 1, rules: [{ required: true }] }]"}]},[t("a-radio",{attrs:{value:1}},[e._v("开启")]),t("a-radio",{attrs:{value:0}},[e._v("关闭")])],1)],1)],1),t("div",{staticStyle:{display:"none"}},[t("a-divider",{attrs:{orientation:"left"}},[e._v("会员折扣设置")]),t("a-form-item",{attrs:{label:"会员折扣",labelCol:e.labelCol,wrapperCol:e.wrapperCol,extra:"开启后会员折扣,会员购买此商品可以享受会员等级折扣价"}},[t("a-radio-group",{directives:[{name:"decorator",rawName:"v-decorator",value:["is_enable_grade",{initialValue:1,rules:[{required:!0}]}],expression:"['is_enable_grade', { initialValue: 1, rules: [{ required: true }] }]"}],on:{change:function(t){return e.onForceUpdate(!0)}}},[t("a-radio",{attrs:{value:1}},[e._v("开启")]),t("a-radio",{attrs:{value:0}},[e._v("关闭")])],1)],1),e.form.getFieldValue("is_enable_grade")?t("a-form-item",{attrs:{label:"会员折扣设置",labelCol:e.labelCol,wrapperCol:e.wrapperCol}},[t("a-radio-group",{directives:[{name:"decorator",rawName:"v-decorator",value:["is_alone_grade",{initialValue:0,rules:[{required:!0}]}],expression:"['is_alone_grade', { initialValue: 0, rules: [{ required: true }] }]"}],on:{change:function(t){return e.onForceUpdate(!0)}}},[t("a-radio",{attrs:{value:0}},[e._v("默认等级折扣")]),t("a-radio",{attrs:{value:1}},[e._v("单独设置折扣")])],1),e.form.getFieldValue("is_alone_grade")?t("div",e._l(e.formData.userGradeList,(function(a){return t("a-form-item",{key:a.grade_id},[t("InputNumberGroup",{directives:[{name:"decorator",rawName:"v-decorator",value:["alone_grade_equity[grade_id:".concat(a.grade_id,"]"),{initialValue:e.formData.defaultUserGradeValue[a.grade_id],rules:[{required:!0,message:"折扣率不能为空"}]}],expression:"[`alone_grade_equity[grade_id:${item.grade_id}]`, {\n initialValue: formData.defaultUserGradeValue[item.grade_id], rules: [{ required: true, message: '折扣率不能为空' }]\n }]"}],attrs:{addonBefore:a.name,addonAfter:"折",inputProps:{min:0,max:9.9}}})],1)})),1):e._e(),t("div",{staticClass:"form-item-help"},[e.form.getFieldValue("is_alone_grade")?t("p",{staticClass:"extra"},[e._v("单独折扣:折扣率范围0.0-9.9,例如: 9.8代表98折,0代表不折扣")]):t("p",{staticClass:"extra"},[e._v("默认折扣:默认为用户所属会员等级的折扣率")])])],1):e._e()],1),t("div",{staticStyle:{display:"none"}},[t("a-divider",{attrs:{orientation:"left"}},[e._v("分销设置")]),t("a-form-item",{attrs:{label:"分销佣金",labelCol:e.labelCol,wrapperCol:e.wrapperCol}},[t("a-radio-group",{directives:[{name:"decorator",rawName:"v-decorator",value:["is_ind_dealer",{initialValue:0,rules:[{required:!0}]}],expression:"['is_ind_dealer', { initialValue: 0, rules: [{ required: true }] }]"}],on:{change:function(t){return e.onForceUpdate(!0)}}},[t("a-radio",{attrs:{value:0}},[e._v("系统默认")]),t("a-radio",{attrs:{value:1}},[e._v("单独设置")])],1),t("div",{staticClass:"form-item-help"},[t("p",{staticClass:"extra"},[e._v("若使用分销功能必须在 [分销中心 - 分销设置] 中开启")])])],1),e.form.getFieldValue("is_ind_dealer")?t("a-form-item",{attrs:{label:"分销佣金类型",labelCol:e.labelCol,wrapperCol:e.wrapperCol}},[t("a-radio-group",{directives:[{name:"decorator",rawName:"v-decorator",value:["dealer_money_type",{initialValue:10,rules:[{required:!0}]}],expression:"['dealer_money_type', { initialValue: 10, rules: [{ required: true }] }]"}],on:{change:function(t){return e.onForceUpdate(!0)}}},[t("a-radio",{attrs:{value:10}},[e._v("百分比")]),t("a-radio",{attrs:{value:20}},[e._v("固定金额")])],1),e._l(e.formData.dealer.levelList,(function(a,r){return t("a-form-item",{key:r},[t("InputNumberGroup",{directives:[{name:"decorator",rawName:"v-decorator",value:[a.value,{rules:[{required:!0,message:"佣金不能为空"}]}],expression:"[item.value, { rules: [{ required: true, message: '佣金不能为空' }] }]"}],attrs:{addonBefore:a.name,addonAfter:10==e.form.getFieldValue("dealer_money_type")?"%":"元",inputProps:{min:0,precision:2}}})],1)}))],2):e._e()],1)],1)]),t("a-form-item",{staticClass:"mt-20",attrs:{wrapperCol:{span:e.wrapperCol.span,offset:e.labelCol.span}}},[t("a-button",{attrs:{type:"primary","html-type":"submit",loading:e.isBtnLoading}},[e._v("提交")])],1)],1),t("AreasModal",{ref:"AreasModal",on:{handleSubmit:e.handleAreaSubmit}})],1)],1)},i=[],o=a("5530"),s=(a("d81d"),a("b64b"),a("d3b7"),a("159b"),a("a434"),a("d084")),l=a("2af9"),n=a("e1fe4"),d=a("a119"),u=a("fd0d"),c=a("caec"),p={key:0,region:[],region_text:[]},m={components:{GoodsType:d["a"],SelectImage:l["g"],SelectVideo:l["h"],Ueditor:l["i"],InputNumberGroup:l["d"],MultiSpec:d["b"],AreasModal:u["a"]},data:function(){return{tabKey:0,labelCol:{span:3},wrapperCol:{span:10},isLoading:!1,isBtnLoading:!1,form:this.$form.createForm(this),formData:n["a"].formData,columns:[{title:"销售区域",dataIndex:"region_text",width:"400px",scopedSlots:{customRender:"region_text"}}],ruleList:[],method:10,citysCount:null}},created:function(){var e=this;this.isLoading=!0,n["a"].getFromData().then((function(){e.isLoading=!1})),c["a"].getCitysCount().then((function(t){e.citysCount=t}))},methods:{onForceUpdate:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.$forceUpdate(),t&&setTimeout((function(){e.$forceUpdate()}),10)},handleTabs:function(e){this.tabKey=e},onReloadCategoryList:function(){var e=this;this.isLoading=!0,n["a"].getCategoryList().then((function(){e.isLoading=!1}))},onReloadServiceList:function(){var e=this;this.isLoading=!0,n["a"].getServiceList().then((function(){e.isLoading=!1}))},onReloadDeliveryList:function(){var e=this;this.isLoading=!0,n["a"].getDeliveryList().then((function(){e.isLoading=!1}))},handleSubmit:function(e){var t=this;e.preventDefault();var a=this.form.validateFields,r=this.ruleList;a((function(e,a){if(e)return t.onTargetTabError(e),!1;if(20===a.spec_type){var i=t.$refs.MultiSpec;if(!i.verifyForm())return t.tabKey=1,!1;a.specData=i.getFromSpecData()}return a.categoryIds=a.categorys.map((function(e){return e.value})),delete a.categorys,a.rules=r,t.onFormSubmit(a),!0}))},onTargetTabError:function(e){var t=[["goods_type","goods_name","categorys","imagesIds","delivery_id","is_ind_delivery_type","delivery_type"],["spec_type","goods_price","is_restrict","restrict_total","restrict_single"],["content"],["alone_grade_equity","first_money","second_money","third_money"]],a=Object.keys(e).shift();for(var r in t)if(t[r].indexOf(a)>-1){this.tabKey=parseInt(r);break}},onFormSubmit:function(e){var t=this;this.isLoading=!0,this.isBtnLoading=!0,s["a"]({form:e}).then((function(e){t.$message.success(e.message,1.5),setTimeout((function(){t.$router.push("./index")}),1500)})).catch((function(){t.isBtnLoading=!1})).finally((function(){return t.isLoading=!1}))},handleAdd:function(){var e=this.ruleList.length,t=Object(o["a"])(Object(o["a"])({},p),{},{key:e}),a=this.getExcludedCityIds();if(a.length===this.citysCount)return this.$message.error("已选择了所有的区域",.8),!1;this.handleAreasModal("add",e,t,a)},handleEdit:function(e,t){var a=this.getExcludedCityIds();this.handleAreasModal("edit",e,t,a)},handleAreaSubmit:function(e){var t=e.custom,a=t.scene,r=t.item;r.region=e.selectedCityIds,r.region_text=e.selectedText,"add"===a&&this.ruleList.push(r)},getExcludedCityIds:function(){var e=[];return this.ruleList.forEach((function(t){t.region.forEach((function(t){e.push(t)}))})),e},handleAreasModal:function(e,t,a,r){this.$refs.AreasModal.handle({scene:e,index:t,item:a},a.region,r)},handleDelete:function(e){var t=this,a=this.$confirm({title:"您确定要删除该记录吗?",onOk:function(){t.ruleList.splice(e,1),a.destroy()}})}}},v=m,f=(a("7e43"),a("2877")),h=Object(f["a"])(v,r,i,!1,null,"5d9dcb4f",null);t["default"]=h.exports},"73f5":function(e,t,a){"use strict";a.d(t,"e",(function(){return o})),a.d(t,"j",(function(){return s})),a.d(t,"h",(function(){return l})),a.d(t,"a",(function(){return n})),a.d(t,"g",(function(){return d})),a.d(t,"b",(function(){return u})),a.d(t,"f",(function(){return c})),a.d(t,"c",(function(){return p})),a.d(t,"d",(function(){return m})),a.d(t,"i",(function(){return v}));var r=a("f6ae"),i=a("b775");function o(e){return Object(i["b"])({url:r["a"].store.list,method:"get",params:e})}function s(e){var t=e.storeId;return Object(i["b"])({url:r["a"].store.superLogin,method:"get",params:{storeId:t}})}function l(e){return Object(i["b"])({url:r["a"].store.recycle,method:"get",params:e})}function n(e){return Object(i["b"])({url:r["a"].store.add,method:"post",data:e})}function d(e){return Object(i["b"])({url:r["a"].store.recovery,method:"post",data:e})}function u(e){return Object(i["b"])({url:r["a"].store.delete,method:"post",data:e})}function c(e){return Object(i["b"])({url:r["a"].store.move,method:"post",data:e})}function p(e){return Object(i["b"])({url:r["a"].store.module.dataList,method:"post",data:e})}function m(e){return Object(i["b"])({url:r["a"].store.module.getStorePlatform,method:"get",params:e})}function v(e){return Object(i["b"])({url:r["a"].store.module.setStorePlatform,method:"post",data:e})}},"78ef":function(e,t,a){"use strict";a("34c5")},"7e43":function(e,t,a){"use strict";a("6948")},"8d47":function(e,t,a){},"90f4":function(e,t,a){"use strict";a.r(t);a("b0c0");var r=function(){var e=this,t=e._self._c;return t("a-card",{attrs:{bordered:!1}},[t("div",{staticClass:"card-title"},[t("span",[e._v(e._s(e.$route.meta.pageTitle))])]),t("a-spin",{attrs:{spinning:e.isLoading}},[t("div",{staticClass:"container"},[t("div",{staticClass:"upload-dragger"},[t("a-upload-dragger",{attrs:{accept:".xls, .xlsx",multiple:!1,fileList:e.fileList,showUploadList:!1,beforeUpload:e.beforeUpload,remove:e.handleRemove}},[t("p",{staticClass:"ant-upload-drag-icon"},[t("a-icon",{attrs:{type:"cloud-upload"}})],1),e.fileList.length?t("div",[t("p",{staticClass:"ant-upload-text"},[t("span",[e._v(e._s(e.fileList[0].name))]),t("a",{staticClass:"ml-10",attrs:{href:"javascript:void(0);"},on:{click:function(t){return t.stopPropagation(),e.handleRemove(e.fileList[0])}}},[e._v("删除")])]),t("a-button",{staticClass:"mt-20",attrs:{type:"primary"},on:{click:function(t){return t.stopPropagation(),e.onFormSubmit.apply(null,arguments)}}},[e._v("立即导入")])],1):t("div",[t("p",{staticClass:"ant-upload-text"},[e._v("点击选择文件,或者将文件拖拽至此区域")]),t("p",{staticClass:"ant-upload-hint"},[e._v("仅支持 .xls, .xlsx 格式的excel文件,限2M以内")])])])],1),t("div",{staticClass:"import-explain"},[t("h2",{staticClass:"title"},[e._v("导入说明")]),t("a-timeline",{staticClass:"timeline"},[t("a-timeline-item",{staticClass:"timeline-item"},[t("p",{staticClass:"name"},[e._v("下载模板")]),t("ul",{staticClass:"content"},[t("li",{staticClass:"content-li"},[t("span",[e._v("批量导入商品需要系统开启队列服务,可在超管后台中查看是否开启")])]),t("li",{staticClass:"content-li"},[t("span",{staticClass:"mr-5"},[e._v("商品导入前需要您用Excel整理需要导入的商品资料,请先")]),t("a",{attrs:{href:"static/template/batch-admin-goods.xlsx",target:"_blank"}},[e._v("下载商品导入模板")])])])]),t("a-timeline-item",{staticClass:"timeline-item"},[t("p",{staticClass:"name"},[e._v("使用模板")]),t("ul",{staticClass:"content"},[t("li",{staticClass:"content-li"},[t("span",[e._v("模板中最多不能超过500个商品,如超过500个商品,请分批导入")])]),t("li",{staticClass:"content-li"},[t("span",[e._v("模板中的字段含义以及填写规则,可查看模板文件中标题栏的标注")])])])])],1)],1),t("FilesModal",{ref:"FilesModal",attrs:{multiple:!0,maxNum:10,actions:["delete","move","copyIds"]}})],1)])],1)},i=[],o=(a("a434"),a("d3b7"),a("1827")),s=a("fd0d"),l={components:{FilesModal:s["b"]},data:function(){return{isLoading:!1,fileList:[],uploadSizeLimit:"2"}},created:function(){},methods:{handleSelectImage:function(){this.$refs.FilesModal.show()},beforeUpload:function(e){var t=e.size/1024/1024;return t>this.uploadSizeLimit?(this.$message.error("上传的文件大小不能超出".concat(this.uploadSizeLimit,"MB")),!1):(this.fileList=[e],!1)},handleRemove:function(e){var t=this.fileList,a=t.indexOf(e);a>-1&&t.splice(a,1)},onFormSubmit:function(){var e=this,t=this.fileList,a=new FormData;a.append("file",t[0]),this.isLoading=!0,o["a"](a).then((function(t){e.fileList=[],e.$message.success(t.message,1.8),setTimeout((function(){return e.$router.push("/goods/import/list")}),1500)})).finally((function(){return e.isLoading=!1}))}}},n=l,d=(a("cca8"),a("2877")),u=Object(d["a"])(n,r,i,!1,null,"6090134a",null);t["default"]=u.exports},a119:function(e,t,a){"use strict";a.d(t,"a",(function(){return c})),a.d(t,"b",(function(){return A}));var r=function(){var e=this,t=e._self._c;return t("div",{staticClass:"goods-type"},e._l(e.list,(function(a,r){return t("div",{directives:[{name:"show",rawName:"v-show",value:!e.onlyShowChecked||e.value==a.value,expression:"!onlyShowChecked || value == item.value"}],key:r,staticClass:"type-item",class:{checked:e.value==a.value},on:{click:function(t){return e.handleItem(a.value)}}},[t("div",{staticClass:"type-title"},[e._v(e._s(a.title))]),t("div",{staticClass:"type-help"},[e._v(e._s(a.help))]),e.value==a.value?t("a-icon",{staticClass:"icon-checked",attrs:{type:"check"}}):e._e()],1)})),0)},i=[],o=(a("b0c0"),a("4d91")),s=a("59aa"),l={name:"GoodsType",model:{prop:"value",event:"change"},props:{value:o["a"].any,onlyShowChecked:o["a"].bool.def(!1)},data:function(){return{defaultValue:s["a"].PHYSICAL.value,list:[{title:s["a"].PHYSICAL.name,help:"物流发货",value:s["a"].PHYSICAL.value}]}},methods:{handleItem:function(e){this.$emit("change",e)}}},n=l,d=(a("6b35"),a("2877")),u=Object(d["a"])(n,r,i,!1,null,"2a2b7db9",null),c=u.exports,p=function(){var e=this,t=e._self._c;return t("div",[t("a-form-item",{attrs:{label:"商品规格",labelCol:e.labelCol,wrapperCol:e.wrapperCol}},[t("div",{staticClass:"form-item-help",staticStyle:{"line-height":"36px"}},[t("small",[e._v("最多添加3个商品规格组,生成的SKU数量不能超出50个")])]),e._l(e.multiSpecData.specList,(function(a,r){return t("div",{key:r,staticClass:"spec-group"},[t("div",{staticClass:"spec-group-item clearfix"},[t("a-input",{staticClass:"group-item-input",attrs:{readOnly:e.isSpecLocked,placeholder:"请输入规格名称"},on:{change:e.onChangeSpecGroupIpt},model:{value:a.spec_name,callback:function(t){e.$set(a,"spec_name",t)},expression:"item.spec_name"}}),e.isSpecLocked?e._e():t("a",{staticClass:"group-item-delete",attrs:{href:"javascript:;"},on:{click:function(t){return e.handleDeleteSpecGroup(r)}}},[e._v("删除规格组")])],1),t("div",{staticClass:"spec-value clearfix"},[e._l(a.valueList,(function(a,i){return t("div",{key:i,staticClass:"spec-value-item"},[t("a-input",{staticClass:"value-item-input",attrs:{readOnly:e.isSpecLocked,placeholder:"请输入规格值"},on:{change:e.onChangeSpecValueIpt},model:{value:a.spec_value,callback:function(t){e.$set(a,"spec_value",t)},expression:"itm.spec_value"}}),e.isSpecLocked?e._e():t("a-icon",{staticClass:"icon-close",attrs:{theme:"filled",type:"close-circle"},on:{click:function(t){return e.handleDeleteSpecValue(r,i)}}})],1)})),e.isSpecLocked?e._e():t("div",{staticClass:"spec-value-add"},[t("a",{staticClass:"group-item-delete",attrs:{href:"javascript:;"},on:{click:function(t){return e.handleAddSpecValue(r)}}},[e._v("新增规格值")])])],2)])})),!e.isSpecLocked&&e.multiSpecData.specList.length<3?t("a-button",{staticClass:"spec-group-add-btn",attrs:{icon:"plus"},on:{click:e.handleAddSpecGroup}},[e._v("添加规格组")]):e._e()],2),t("a-form-item",{directives:[{name:"show",rawName:"v-show",value:e.multiSpecData.skuList.length,expression:"multiSpecData.skuList.length"}],attrs:{label:"SKU列表",labelCol:e.labelCol,wrapperCol:e.wrapperCol}},[t("a-table",{staticClass:"sku-list",attrs:{columns:e.multiSpecData.skuColumns,dataSource:e.multiSpecData.skuList,scroll:{x:!0},pagination:!1,bordered:""},scopedSlots:e._u([{key:"select_goods",fn:function(a,r){return[t("SelectGoods",{attrs:{multiple:!1},on:{change:function(t){return e.handleSelectGoods(t,r)}}})]}},{key:"goods_price",fn:function(t,a){return[e._v(" "+e._s(a.goods_price)+" ")]}},{key:"cost_price",fn:function(t,a){return[e._v(" "+e._s(a.cost_price)+" ")]}},{key:"stock_num",fn:function(t,a){return[e._v(" "+e._s(a.stock_num)+" ")]}},{key:"goods_weight",fn:function(t,a){return[e._v(" "+e._s(a.goods_weight)+" ")]}},{key:"goods_sku_no",fn:function(t,a){return[e._v(" "+e._s(a.goods_sku_no)+" ")]}},{key:"action",fn:function(a,r){return[r.goods_id?t("router-link",{attrs:{to:{path:"/goods/update",query:{goodsId:r.goods_id}}}},[e._v("去修改")]):e._e()]}}])})],1)],1)},m=[],v=a("c7eb"),f=a("1da1"),h=(a("7db0"),a("d3b7"),a("5530")),g=a("d4ec"),_=a("bee2"),b=a("ade3"),y=(a("159b"),a("a15b"),a("d81d"),a("99af"),a("b64b"),a("a434"),a("2ef0")),C=a.n(y),w=a("ca00");a("b775");var x=[{title:"选择商品",dataIndex:"select_goods",width:120,scopedSlots:{customRender:"select_goods"}},{title:"商品价格",dataIndex:"goods_price",width:120,scopedSlots:{customRender:"goods_price"}},{title:"成本价",dataIndex:"cost_price",width:120,scopedSlots:{customRender:"cost_price"}},{title:"库存数量",dataIndex:"stock_num",width:120,scopedSlots:{customRender:"stock_num"}},{title:"商品重量 (KG)",dataIndex:"goods_weight",width:120,scopedSlots:{customRender:"goods_weight"}},{title:"SKU编码",dataIndex:"goods_sku_no",width:140,scopedSlots:{customRender:"goods_sku_no"}},{title:"操作",dataIndex:"action",width:140,scopedSlots:{customRender:"action"}}],L={image_id:0,image:{},goods_id:"",goods_price:"",line_price:"",cost_price:"",stock_num:"",goods_weight:"",goods_sku_no:""},S=function(){function e(){Object(g["a"])(this,e),Object(b["a"])(this,"multiSpecData",{}),Object(b["a"])(this,"error",""),this.multiSpecData={specList:[],skuList:[],skuColumns:C.a.cloneDeep(x),skuBatchForm:C.a.cloneDeep(L)}}return Object(_["a"])(e,[{key:"getData",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];e.length&&(this.multiSpecData.specList=C.a.cloneDeep(e),this.multiSpecData.skuList=C.a.cloneDeep(t));var a=this.specGroupArr(),r=D(a),i=this.rowSpanArr(a,r);return this.buildSkuColumns(i),this.buildSkuList(r),this.multiSpecData}},{key:"isEmpty",value:function(){return 0===this.multiSpecData.specList.length}},{key:"getError",value:function(){return this.error}},{key:"specGroupArr",value:function(){var e=[];return this.multiSpecData.specList.forEach((function(t){var a=[];t.valueList.forEach((function(e){a.push(e)})),e.push(a)})),e}},{key:"rowSpanArr",value:function(e,t){for(var a=[],r=t.length,i=0;i<e.length;i++)a[i]=parseInt(r/e[i].length),r=a[i];return a}},{key:"buildSkuList",value:function(e){for(var t=[],a=function(){var a=Object(h["a"])(Object(h["a"])({},L),{},{key:r,tempId:e[r].map((function(e){return e.spec_value})).join("_"),skuKeys:e[r].map((function(e){return{groupKey:e.groupKey,valueKey:e.key}}))});e[r].forEach((function(e,t){a["spec_value_".concat(t)]=e.spec_value})),t.push(a)},r=0;r<e.length;r++)a();this.multiSpecData.skuList=this.oldSkuList(t)}},{key:"oldSkuList",value:function(e){var t=this.multiSpecData.skuList.concat();if(!t.length||!e.length)return e;var a=function(){var a={},i=e[r],o=i.skuKeys.map((function(e,t){return i["spec_value_".concat(t)]})).join("_");t.forEach((function(e,t){if(e.goods_props){var r=e.goods_props.map((function(e){var t;return null===e||void 0===e||null===(t=e.value)||void 0===t?void 0:t.name})).join("_");r===o&&(a=C.a.cloneDeep(e))}})),a&&(e[r]=Object(h["a"])(Object(h["a"])({},e[r]),C.a.pick(a,Object.keys(L))))};for(var r in e)a();return e}},{key:"buildSkuColumns",value:function(e){for(var t=this.multiSpecData.specList,a=x.concat(),r=function(t,a,r,i){var o={children:a,attrs:{}},s=e[t-1];return o.attrs.rowSpan=i%s===0?s:0,o},i=function(e){var i=t[e-1];a.unshift({title:i.spec_name,dataIndex:"spec_value_".concat(e-1),customRender:function(t,a,i){return r(e,t,a,i)}})},o=t.length;o>0;o--)i(o);this.multiSpecData.skuColumns=a}},{key:"handleAddSpecGroup",value:function(){var e=this.multiSpecData.specList;e.push({key:e.length||0,spec_name:"",valueList:[]});var t=e.length-1;this.handleAddSpecValue(t)}},{key:"handleAddSpecValue",value:function(e){var t=this.multiSpecData.specList[e],a=t.valueList;a.push({key:a.length||0,groupKey:t.key,spec_value:""}),this.onRefreshSpecValueKey(e)}},{key:"handleDeleteSpecGroup",value:function(e){this.multiSpecData.specList.splice(e,1),this.onUpdate(!1)}},{key:"handleDeleteSpecValue",value:function(e,t){this.multiSpecData.specList[e].valueList.splice(t,1),this.onRefreshSpecValueKey(e),this.onUpdate(!1)}},{key:"onRefreshSpecValueKey",value:function(e){var t=this.multiSpecData.specList[e],a=t.valueList;a.forEach((function(e,t){a[t].key=t}))}},{key:"handleSkuBatch",value:function(){var e=this.getFilterObject(this.multiSpecData.skuBatchForm),t=this.multiSpecData.skuList;for(var a in t)t[a]=Object(h["a"])(Object(h["a"])({},t[a]),e);this.onUpdate(!1)}},{key:"getFilterObject",value:function(e){var t={};for(var a in e){var r=e[a];Object(w["e"])(r)||(t[a]=r)}return t}},{key:"verifyForm",value:function(){return!!this.verifySpec()&&!!this.verifySkuList()}},{key:"verifySkuList",value:function(){var e=[{field:"goods_price",name:"商品价格"},{field:"stock_num",name:"库存数量"},{field:"goods_weight",name:"商品重量"}],t=this.multiSpecData.skuList;for(var a in t){var r=t[a];for(var i in e){var o=r[e[i].field];if(""===o||null===o)return this.error="".concat(e[i].name,"不能为空"),!1}}return!0}},{key:"verifySpec",value:function(){var e=this.multiSpecData.specList;if(!e.length)return this.error="亲,还没有添加规格组~",!1;for(var t in e){var a=e[t];if(Object(w["e"])(a.spec_name))return this.error="规格组名称不能为空~",!1;var r=a.valueList;if(!r.length)return this.error="还没有添加规格值~",!1;for(var i in r)if(Object(w["e"])(r[i].spec_value))return this.error="规格值不能为空~",!1}return!0}},{key:"getFromSpecData",value:function(){var e=this.multiSpecData,t=e.specList,a=e.skuList,r={specList:C.a.cloneDeep(t),skuList:C.a.cloneDeep(a)};for(var i in r.skuList){var o=r.skuList[i];delete o.image,delete o.key}return r}},{key:"onUpdate",value:function(){var e=!(arguments.length>0&&void 0!==arguments[0])||arguments[0];e?Object(w["c"])(k,200)(this):k(this)}}]),e}(),k=function(e){return e.getData()},D=function(e){return e.length?Array.prototype.reduce.call(e,(function(e,t){var a=[];return e.forEach((function(e){t.forEach((function(t){a.push(e.concat([t]))}))})),a}),[[]]):[]},V=a("2af9"),q=function(){var e=this,t=e._self._c;return t("div",[t("a-button",{on:{click:e.handleSelectGoods}},[e._v("选择商品")]),t("GoodsModal",{ref:"GoodsModal",attrs:{multiple:e.multiple,maxNum:e.maxNum,defaultList:e.selectedItems},on:{handleSubmit:e.handleSelectGoodsSubmit}})],1)},I=[],N=a("cd3f"),F=a.n(N),O=a("fd0d"),j=[{title:"商品ID",dataIndex:"goods_id"},{title:"商品信息",scopedSlots:{customRender:"item"}},{title:"库存总量",dataIndex:"stock_total"},{title:"操作",width:"180px",dataIndex:"action",scopedSlots:{customRender:"action"}}],$={name:"SelectGoods",components:{GoodsModal:O["c"]},model:{prop:"value",event:"change"},props:{multiple:o["a"].bool.def(!0),maxNum:o["a"].integer.def(100),defaultList:o["a"].array.def([])},data:function(){return{columns:j,selectedItems:[],selectedGoodsIds:[]}},watch:{defaultList:{immediate:!0,handler:function(e){var t=this.selectedItems;e.length&&!t.length&&this.onUpdate(F()(e))}}},created:function(){},methods:{onUpdate:function(e){if(this.multiple||!e.length)this.selectedItems=e,this.selectedGoodsIds=e.map((function(e){return e.goods_id}));else{var t=e[e.length-1];this.selectedItems=[t],this.selectedGoodsIds=[t.goods_id]}this.onChange()},handleSelectGoods:function(){this.$refs.GoodsModal.handle()},handleSelectGoodsSubmit:function(e){var t=e.selectedItems;this.onUpdate(F()(t))},handleDeleteItem:function(e){var t=this.selectedItems;t.splice(e,1),this.onUpdate(t)},onChange:function(){var e=this.multiple,t=this.selectedGoodsIds,a=e?t:t.length?t[0]:void 0;return this.$emit("select",e?this.selectedItems:this.selectedItems[0]),this.$emit("change",a)}}},G=$,T=(a("78ef"),Object(d["a"])(G,q,I,!1,null,"6db32c34",null)),U=T.exports,E=a("d084"),R={components:{SelectImage:V["g"],SelectGoods:U},props:{defaultSpecList:o["a"].array.def([]),defaultSkuList:o["a"].array.def([]),isSpecLocked:o["a"].bool.def(!1),checkList:o["a"].array.def([])},data:function(){return{labelCol:{span:3},wrapperCol:{span:21},MultiSpecModel:new S,multiSpecData:{specList:[],skuList:[]},visible:!1}},watch:{defaultSpecList:function(e){e.length&&this.MultiSpecModel.isEmpty()&&this.getData()}},created:function(){this.getData()},methods:{getData:function(){var e=this.defaultSpecList,t=this.defaultSkuList;this.multiSpecData=this.MultiSpecModel.getData(e,t)},getFromSpecData:function(){return this.MultiSpecModel.getFromSpecData()},handleAddSpecGroup:function(){this.checkSkuMaxNum()&&this.MultiSpecModel.handleAddSpecGroup()},handleDeleteSpecGroup:function(e){var t=this,a=this.$confirm({title:"您确定要删除该规格组吗?",content:"删除后不可恢复",onOk:function(){t.MultiSpecModel.handleDeleteSpecGroup(e),a.destroy()}})},handleAddSpecValue:function(e){this.checkSkuMaxNum()&&this.MultiSpecModel.handleAddSpecValue(e)},handleDeleteSpecValue:function(e,t){var a=this,r=this.$confirm({title:"您确定要删除该规格值吗?",content:"删除后不可恢复",onOk:function(){a.MultiSpecModel.handleDeleteSpecValue(e,t),r.destroy()}})},onChangeSpecGroupIpt:function(){this.MultiSpecModel.onUpdate(!0)},onChangeSpecValueIpt:function(e,t){this.MultiSpecModel.onUpdate(!0)},checkSkuMaxNum:function(){var e=this.multiSpecData.skuList;return!(e.length>=50)||(this.$message.error("生成的sku列表数量不能大于50个,当前数量:".concat(e.length,"个"),2.5),!1)},handleSkuBatch:function(){this.MultiSpecModel.handleSkuBatch()},verifyForm:function(){return!!this.MultiSpecModel.verifyForm()||(this.$message.error(this.MultiSpecModel.getError(),2),!1)},showModal:function(){this.visible=!0},handleSelectGoods:function(e,t){var a=this;return Object(f["a"])(Object(v["a"])().mark((function r(){var i,o;return Object(v["a"])().wrap((function(r){while(1)switch(r.prev=r.next){case 0:if(i=a.multiSpecData.skuList,o=i.find((function(t){return t.goods_id===e})),!o){r.next=5;break}return a.$message.error("一个商品只能选择一次",2),r.abrupt("return",!1);case 5:a.getGoodsDetail(e).then((function(r){var i=a.$route.query.goodsId;if(20===r.spec_type&&i!==e)return a.$message.error("您选择的商品是多规格商品",2),!1;var o=r.skuList[0];t.goods_price=o.goods_price,t.cost_price=o.cost_price,t.stock_num=o.stock_num,t.goods_weight=o.goods_weight,t.goods_sku_no=o.goods_sku_no,t.goods_id=r.goods_id}));case 6:case"end":return r.stop()}}),r)})))()},getGoodsDetail:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return!!e&&new Promise((function(t,a){E["d"]({goodsId:e}).then((function(e){t(e.data.goodsInfo)}))}))}}},M=R,K=(a("0bb2"),Object(d["a"])(M,p,m,!1,null,"8c22ddb2",null)),A=K.exports},a70e:function(e,t,a){},b3cc:function(e,t,a){"use strict";a.r(t);a("b0c0");var r,i=function(){var e=this,t=e._self._c;return t("a-card",{attrs:{bordered:!1}},[t("content-header",{attrs:{title:e.$route.meta.title}}),t("div",{staticClass:"table-operator"},[t("a-row",{staticClass:"row-item-search"},[t("a-form",{staticClass:"search-form",attrs:{form:e.searchForm,layout:"inline"},on:{submit:e.handleSearch}},[t("a-form-item",{attrs:{label:"导入状态"}},[t("a-select",{directives:[{name:"decorator",rawName:"v-decorator",value:["status",{initialValue:-1}],expression:"['status', { initialValue: -1 }]"}]},[t("a-select-option",{attrs:{value:-1}},[e._v("全部")]),e._l(e.ImportStatusEnum.data,(function(a,r){return t("a-select-option",{key:r,attrs:{value:a.value}},[e._v(e._s(a.name))])}))],2)],1),t("a-form-item",{staticClass:"search-btn"},[t("a-button",{attrs:{type:"primary",icon:"search","html-type":"submit"}},[e._v("搜索")])],1)],1)],1),t("div",{staticClass:"row-item-tab clearfix"},[t("a-button",{staticClass:"fl-l",attrs:{type:"primary",icon:"arrow-up"},on:{click:function(t){return e.handleImport()}}},[e._v("批量导入")])],1)],1),t("s-table",{ref:"table",attrs:{rowKey:"id",loading:e.isLoading,columns:e.columns,data:e.loadData,pageSize:15},scopedSlots:e._u([{key:"start_time",fn:function(a){return[t("span",[e._v(e._s(a||"--"))])]}},{key:"end_time",fn:function(a){return[t("span",[e._v(e._s(a||"--"))])]}},{key:"status",fn:function(a){return t("span",{},[t("a-tag",{attrs:{color:e.ImportStatusColorEnum[a]}},[e._v(e._s(e.ImportStatusEnum[a].name))])],1)}},{key:"action",fn:function(a,r){return t("span",{staticClass:"actions"},[t("a",{on:{click:function(t){return e.handleDelete(r)}}},[e._v("删除")]),r.fail_count>0?t("a",{on:{click:function(t){return e.handleFailLog(r)}}},[e._v("失败日志")]):e._e()])}}])}),t("a-modal",{attrs:{title:"失败日志"},on:{ok:function(t){e.visibleFailLog=!1}},model:{value:e.visibleFailLog,callback:function(t){e.visibleFailLog=t},expression:"visibleFailLog"}},[t("div",{staticClass:"modal-content"},e._l(e.failLogContent,(function(a,r){return t("p",{key:r,staticClass:"log-item"},[t("span",{staticClass:"mr-5"},[e._v("序号["+e._s(a.goodsSn)+"]")]),t("span",[e._v(e._s(a.message))])])})),0)])],1)},o=[],s=a("5530"),l=a("ade3"),n=(a("d3b7"),a("1827")),d=a("2af9"),u=a("59aa"),c=(r={},Object(l["a"])(r,u["b"].NORMAL.value,""),Object(l["a"])(r,u["b"].COMPLETED.value,"green"),r),p={name:"Index",components:{STable:d["e"],ContentHeader:d["a"]},data:function(){var e=this;return{searchForm:this.$form.createForm(this),queryParam:{},isLoading:!1,ImportStatusEnum:u["b"],ImportStatusColorEnum:c,columns:[{title:"记录ID",dataIndex:"id"},{title:"导入总数量",dataIndex:"total_count"},{title:"导入成功数量",dataIndex:"success_count"},{title:"导入失败数量",dataIndex:"fail_count"},{title:"开始时间",dataIndex:"start_time",scopedSlots:{customRender:"start_time"}},{title:"结束时间",dataIndex:"end_time",scopedSlots:{customRender:"end_time"}},{title:"导入状态",dataIndex:"status",scopedSlots:{customRender:"status"}},{title:"操作",dataIndex:"action",width:"180px",scopedSlots:{customRender:"action"}}],loadData:function(t){return n["c"](Object(s["a"])(Object(s["a"])({},t),e.queryParam)).then((function(e){return e.data.list}))},visibleFailLog:!1,failLogContent:[]}},created:function(){},methods:{handleImport:function(){this.$router.push("/goods/import/batch")},handleDelete:function(e){var t=this,a=this.$confirm({title:"您确定要删除该记录吗?",content:"删除后不可恢复",onOk:function(){return n["b"]({id:e["id"]}).then((function(e){t.$message.success(e.message,1.5),t.handleRefresh()})).finally((function(e){return a.destroy()}))}})},handleFailLog:function(e){this.visibleFailLog=!0,this.failLogContent=e.fail_log},handleRefresh:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.$refs.table.refresh(e)},handleSearch:function(e){var t=this;e.preventDefault(),this.searchForm.validateFields((function(e,a){e||(t.queryParam=Object(s["a"])(Object(s["a"])({},t.queryParam),a),t.handleRefresh(!0))}))}}},m=p,v=(a("54d6"),a("2877")),f=Object(v["a"])(m,i,o,!1,null,"014c6a30",null);t["default"]=f.exports},bcd0:function(e,t,a){},c7eb:function(e,t,a){"use strict";a.d(t,"a",(function(){return i}));a("a4d3"),a("e01a"),a("d3b7"),a("d28b"),a("3ca3"),a("ddb0"),a("b636"),a("944a"),a("0c47"),a("23dc"),a("3410"),a("159b"),a("b0c0"),a("131a"),a("fb6a");var r=a("53ca");function i(){
|
|
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
|
|
i=function(){return e};var e={},t=Object.prototype,a=t.hasOwnProperty,o=Object.defineProperty||function(e,t,a){e[t]=a.value},s="function"==typeof Symbol?Symbol:{},l=s.iterator||"@@iterator",n=s.asyncIterator||"@@asyncIterator",d=s.toStringTag||"@@toStringTag";function u(e,t,a){return Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}),e[t]}try{u({},"")}catch(I){u=function(e,t,a){return e[t]=a}}function c(e,t,a,r){var i=t&&t.prototype instanceof v?t:v,s=Object.create(i.prototype),l=new D(r||[]);return o(s,"_invoke",{value:x(e,a,l)}),s}function p(e,t,a){try{return{type:"normal",arg:e.call(t,a)}}catch(I){return{type:"throw",arg:I}}}e.wrap=c;var m={};function v(){}function f(){}function h(){}var g={};u(g,l,(function(){return this}));var _=Object.getPrototypeOf,b=_&&_(_(V([])));b&&b!==t&&a.call(b,l)&&(g=b);var y=h.prototype=v.prototype=Object.create(g);function C(e){["next","throw","return"].forEach((function(t){u(e,t,(function(e){return this._invoke(t,e)}))}))}function w(e,t){function i(o,s,l,n){var d=p(e[o],e,s);if("throw"!==d.type){var u=d.arg,c=u.value;return c&&"object"==Object(r["a"])(c)&&a.call(c,"__await")?t.resolve(c.__await).then((function(e){i("next",e,l,n)}),(function(e){i("throw",e,l,n)})):t.resolve(c).then((function(e){u.value=e,l(u)}),(function(e){return i("throw",e,l,n)}))}n(d.arg)}var s;o(this,"_invoke",{value:function(e,a){function r(){return new t((function(t,r){i(e,a,t,r)}))}return s=s?s.then(r,r):r()}})}function x(e,t,a){var r="suspendedStart";return function(i,o){if("executing"===r)throw new Error("Generator is already running");if("completed"===r){if("throw"===i)throw o;return q()}for(a.method=i,a.arg=o;;){var s=a.delegate;if(s){var l=L(s,a);if(l){if(l===m)continue;return l}}if("next"===a.method)a.sent=a._sent=a.arg;else if("throw"===a.method){if("suspendedStart"===r)throw r="completed",a.arg;a.dispatchException(a.arg)}else"return"===a.method&&a.abrupt("return",a.arg);r="executing";var n=p(e,t,a);if("normal"===n.type){if(r=a.done?"completed":"suspendedYield",n.arg===m)continue;return{value:n.arg,done:a.done}}"throw"===n.type&&(r="completed",a.method="throw",a.arg=n.arg)}}}function L(e,t){var a=t.method,r=e.iterator[a];if(void 0===r)return t.delegate=null,"throw"===a&&e.iterator["return"]&&(t.method="return",t.arg=void 0,L(e,t),"throw"===t.method)||"return"!==a&&(t.method="throw",t.arg=new TypeError("The iterator does not provide a '"+a+"' method")),m;var i=p(r,e.iterator,t.arg);if("throw"===i.type)return t.method="throw",t.arg=i.arg,t.delegate=null,m;var o=i.arg;return o?o.done?(t[e.resultName]=o.value,t.next=e.nextLoc,"return"!==t.method&&(t.method="next",t.arg=void 0),t.delegate=null,m):o:(t.method="throw",t.arg=new TypeError("iterator result is not an object"),t.delegate=null,m)}function S(e){var t={tryLoc:e[0]};1 in e&&(t.catchLoc=e[1]),2 in e&&(t.finallyLoc=e[2],t.afterLoc=e[3]),this.tryEntries.push(t)}function k(e){var t=e.completion||{};t.type="normal",delete t.arg,e.completion=t}function D(e){this.tryEntries=[{tryLoc:"root"}],e.forEach(S,this),this.reset(!0)}function V(e){if(e){var t=e[l];if(t)return t.call(e);if("function"==typeof e.next)return e;if(!isNaN(e.length)){var r=-1,i=function t(){for(;++r<e.length;)if(a.call(e,r))return t.value=e[r],t.done=!1,t;return t.value=void 0,t.done=!0,t};return i.next=i}}return{next:q}}function q(){return{value:void 0,done:!0}}return f.prototype=h,o(y,"constructor",{value:h,configurable:!0}),o(h,"constructor",{value:f,configurable:!0}),f.displayName=u(h,d,"GeneratorFunction"),e.isGeneratorFunction=function(e){var t="function"==typeof e&&e.constructor;return!!t&&(t===f||"GeneratorFunction"===(t.displayName||t.name))},e.mark=function(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,h):(e.__proto__=h,u(e,d,"GeneratorFunction")),e.prototype=Object.create(y),e},e.awrap=function(e){return{__await:e}},C(w.prototype),u(w.prototype,n,(function(){return this})),e.AsyncIterator=w,e.async=function(t,a,r,i,o){void 0===o&&(o=Promise);var s=new w(c(t,a,r,i),o);return e.isGeneratorFunction(a)?s:s.next().then((function(e){return e.done?e.value:s.next()}))},C(y),u(y,d,"Generator"),u(y,l,(function(){return this})),u(y,"toString",(function(){return"[object Generator]"})),e.keys=function(e){var t=Object(e),a=[];for(var r in t)a.push(r);return a.reverse(),function e(){for(;a.length;){var r=a.pop();if(r in t)return e.value=r,e.done=!1,e}return e.done=!0,e}},e.values=V,D.prototype={constructor:D,reset:function(e){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(k),!e)for(var t in this)"t"===t.charAt(0)&&a.call(this,t)&&!isNaN(+t.slice(1))&&(this[t]=void 0)},stop:function(){this.done=!0;var e=this.tryEntries[0].completion;if("throw"===e.type)throw e.arg;return this.rval},dispatchException:function(e){if(this.done)throw e;var t=this;function r(a,r){return s.type="throw",s.arg=e,t.next=a,r&&(t.method="next",t.arg=void 0),!!r}for(var i=this.tryEntries.length-1;i>=0;--i){var o=this.tryEntries[i],s=o.completion;if("root"===o.tryLoc)return r("end");if(o.tryLoc<=this.prev){var l=a.call(o,"catchLoc"),n=a.call(o,"finallyLoc");if(l&&n){if(this.prev<o.catchLoc)return r(o.catchLoc,!0);if(this.prev<o.finallyLoc)return r(o.finallyLoc)}else if(l){if(this.prev<o.catchLoc)return r(o.catchLoc,!0)}else{if(!n)throw new Error("try statement without catch or finally");if(this.prev<o.finallyLoc)return r(o.finallyLoc)}}}},abrupt:function(e,t){for(var r=this.tryEntries.length-1;r>=0;--r){var i=this.tryEntries[r];if(i.tryLoc<=this.prev&&a.call(i,"finallyLoc")&&this.prev<i.finallyLoc){var o=i;break}}o&&("break"===e||"continue"===e)&&o.tryLoc<=t&&t<=o.finallyLoc&&(o=null);var s=o?o.completion:{};return s.type=e,s.arg=t,o?(this.method="next",this.next=o.finallyLoc,m):this.complete(s)},complete:function(e,t){if("throw"===e.type)throw e.arg;return"break"===e.type||"continue"===e.type?this.next=e.arg:"return"===e.type?(this.rval=this.arg=e.arg,this.method="return",this.next="end"):"normal"===e.type&&t&&(this.next=t),m},finish:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var a=this.tryEntries[t];if(a.finallyLoc===e)return this.complete(a.completion,a.afterLoc),k(a),m}},catch:function(e){for(var t=this.tryEntries.length-1;t>=0;--t){var a=this.tryEntries[t];if(a.tryLoc===e){var r=a.completion;if("throw"===r.type){var i=r.arg;k(a)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(e,t,a){return this.delegate={iterator:V(e),resultName:t,nextLoc:a},"next"===this.method&&(this.arg=void 0),m}},e}},cca8:function(e,t,a){"use strict";a("8d47")},e1fe4:function(e,t,a){"use strict";var r=a("5530"),i=(a("d3b7"),a("3ca3"),a("ddb0"),a("d81d"),a("4de4"),a("159b"),a("2ef0")),o=a.n(i),s=a("8243"),l=a("d084"),n=a("2e1c"),d=a("b775"),u={list:"/goods.service/list",all:"/goods.service/all",add:"/goods.service/add",edit:"/goods.service/edit",delete:"/goods.service/delete"};function c(e){return Object(d["b"])({url:u.all,method:"get",params:e})}var p={list:"/setting.delivery/list",all:"/setting.delivery/all",detail:"/setting.delivery/detail",add:"/setting.delivery/add",edit:"/setting.delivery/edit",delete:"/setting.delivery/delete"};function m(e){return Object(d["b"])({url:p.all,method:"get",params:e})}t["a"]={goodsId:null,formData:{goods:{},categoryList:[],deliveryList:[],serviceList:[],defaultServiceIds:[],userGradeList:[],defaultUserGradeValue:{},dealer:{levelList:[{name:"一级佣金",value:"first_money"},{name:"二级佣金",value:"second_money"},{name:"三级佣金",value:"third_money"}]}},getFromData:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return this.goodsId=t,new Promise((function(a,r){Promise.all([e.getGoodsDetail(t),e.getCategoryList(),e.getDeliveryList(),e.getServiceList(),e.getUserGradeList()]).then((function(){e.setDefaultData(),a({formData:e.formData})}))}))},getGoodsDetail:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;return!!t&&new Promise((function(a,r){l["d"]({goodsId:t}).then((function(t){e.formData.goods=t.data.goodsInfo,a()}))}))},getFieldsValue:function(){var e=this.formData.goods;e.categorys=this.formatCategoryIds(e.categoryIds);var t=o.a.pick(e,["goods_type","goods_name","categorys","goods_no","sort","is_brand","is_new","paihang","remaizhishu","status","spec_type","deduct_stock_type","is_restrict","content","selling_point","serviceIds","sales_initial","is_points_gift","is_points_discount","is_enable_grade","is_alone_grade","is_ind_dealer","dealer_money_type","first_money","second_money","third_money"]);return Object(r["a"])({},t)},getFieldsValue2:function(){var e=this.formData.goods,t={};if(10==e.goods_type&&(t["delivery_id"]=e["delivery_id"],t["is_ind_delivery_type"]=e["is_ind_delivery_type"],t["delivery_type"]=e["delivery_type"]),10==e.spec_type){var a=o.a.pick(e.skuList[0],["goods_price","line_price","cost_price","stock_num","goods_weight"]);t=Object(r["a"])(Object(r["a"])({},t),a)}return 1==e.is_restrict&&(t["restrict_total"]=e["restrict_total"],t["restrict_single"]=e["restrict_single"]),t},formatCategoryIds:function(e){return e.map((function(e){return{value:e}}))},getCategoryList:function(){var e=this;return new Promise((function(t,a){s["a"].getCategoryTreeSelect().then((function(a){e.formData.categoryList=a,t()}))}))},getDeliveryList:function(){var e=this;return new Promise((function(t,a){m().then((function(a){e.formData.deliveryList=a.data.list,t()}))}))},getServiceList:function(){var e=this;return new Promise((function(t,a){c().then((function(a){e.formData.serviceList=a.data.list,t()}))}))},getUserGradeList:function(){var e=this;return new Promise((function(t,a){n["a"]({status:1}).then((function(a){e.formData.userGradeList=a.data.list,t()}))}))},setDefaultData:function(){this.setDefaultServiceIds(),this.setDefaultUserGradeValue()},setDefaultServiceIds:function(){var e=this.formData.serviceList;if(!this.goodsId){var t=e.filter((function(e){return e.is_default}));this.formData.defaultServiceIds=t.map((function(e){return e.service_id}))}},setDefaultUserGradeValue:function(){var e=this.formData.userGradeList,t=this.goodsId&&this.formData.goods.alone_grade_equity?this.formData.goods.alone_grade_equity:{},a={};e.forEach((function(e){a[e.grade_id]=t[e.grade_id]||e.equity.discount})),this.formData.defaultUserGradeValue=Object(r["a"])({},a)}}},e671:function(e,t,a){},eb68:function(e,t,a){"use strict";a.r(t);a("b0c0");var r=function(){var e=this,t=e._self._c;return t("a-card",{attrs:{bordered:!1}},[t("div",{staticClass:"card-title"},[e._v(e._s(e.$route.meta.title))]),t("a-spin",{attrs:{spinning:e.isLoading}},[t("a-form",{attrs:{form:e.form,selfUpdate:!0},on:{submit:e.handleSubmit}},[t("a-tabs",{attrs:{activeKey:e.tabKey,tabBarStyle:{marginBottom:"30px"}},on:{change:e.handleTabs}},[t("a-tab-pane",{key:0,attrs:{tab:"基本信息"}}),t("a-tab-pane",{key:1,attrs:{tab:"规格/库存"}}),t("a-tab-pane",{key:2,attrs:{tab:"商品详情"}}),t("a-tab-pane",{key:3,attrs:{tab:"更多设置"}})],1),t("div",{staticClass:"tabs-content"},[t("div",{directives:[{name:"show",rawName:"v-show",value:0==e.tabKey,expression:"tabKey == 0"}],staticClass:"tab-pane"},[t("a-form-item",{attrs:{label:"商品类型",labelCol:e.labelCol,wrapperCol:e.wrapperCol}},[t("GoodsType",{directives:[{name:"decorator",rawName:"v-decorator",value:["goods_type",{rules:[{required:!0}]}],expression:"['goods_type', { rules: [{ required: true }] }]"}],attrs:{onlyShowChecked:!0},on:{change:function(t){return e.onForceUpdate(!0)}}})],1),t("a-form-item",{attrs:{label:"商品名称",labelCol:e.labelCol,wrapperCol:e.wrapperCol}},[t("a-input",{directives:[{name:"decorator",rawName:"v-decorator",value:["goods_name",{rules:[{required:!0,min:2,message:"请输入至少2个字符"}]}],expression:"['goods_name', { rules: [{ required: true, min: 2, message: '请输入至少2个字符' }] }]"}],attrs:{placeholder:"请输入商品名称"}})],1),t("a-form-item",{attrs:{label:"商品分类",labelCol:e.labelCol,wrapperCol:e.wrapperCol}},[t("a-tree-select",{directives:[{name:"decorator",rawName:"v-decorator",value:["categorys",{rules:[{required:!0,message:"请至少选择1个商品分类"}]}],expression:"['categorys', { rules: [{ required: true, message: '请至少选择1个商品分类' }] }]"}],attrs:{placeholder:"请选择商品分类",dropdownStyle:{maxHeight:"500px",overflow:"auto"},treeData:e.formData.categoryList,treeCheckable:"",treeCheckStrictly:"",allowClear:""}}),t("div",{staticClass:"form-item-help"},[t("router-link",{attrs:{target:"_blank",to:{path:"/goods/category/index"}}},[e._v("去新增")]),t("a",{attrs:{href:"javascript:;"},on:{click:e.onReloadCategoryList}},[e._v("刷新")])],1)],1),t("a-form-item",{attrs:{label:"商品图片",labelCol:e.labelCol,wrapperCol:e.wrapperCol,extra:"建议尺寸:750*750像素, 最多上传10张, 可拖拽图片调整顺序, 第1张将作为商品首图"}},[t("SelectImage",{directives:[{name:"decorator",rawName:"v-decorator",value:["imagesIds",{rules:[{required:!0,message:"请至少上传1张商品图片"}]}],expression:"['imagesIds', { rules: [{ required: true, message: '请至少上传1张商品图片' }] }]"}],attrs:{multiple:"",maxNum:10,defaultList:e.formData.goods.goods_images}})],1),t("a-form-item",{attrs:{label:"商品编码",labelCol:e.labelCol,wrapperCol:e.wrapperCol}},[t("a-input",{directives:[{name:"decorator",rawName:"v-decorator",value:["goods_no"],expression:"['goods_no']"}],attrs:{placeholder:"请输入商品编码"}})],1),t("a-form-item",{attrs:{label:"热卖指数",labelCol:e.labelCol,wrapperCol:e.wrapperCol}},[t("a-input",{directives:[{name:"decorator",rawName:"v-decorator",value:["remaizhishu"],expression:"['remaizhishu']"}],attrs:{placeholder:"热卖指数"}})],1),t("a-form-item",{attrs:{label:"商品状态",labelCol:e.labelCol,wrapperCol:e.wrapperCol}},[t("a-radio-group",{directives:[{name:"decorator",rawName:"v-decorator",value:["status",{initialValue:10,rules:[{required:!0}]}],expression:"['status', { initialValue: 10, rules: [{ required: true }] }]"}]},[t("a-radio",{attrs:{value:10}},[e._v("上架")]),t("a-radio",{attrs:{value:20}},[e._v("下架")])],1)],1),t("a-form-item",{attrs:{label:"商品排序",labelCol:e.labelCol,wrapperCol:e.wrapperCol,extra:"数字越小越靠前"}},[t("a-input-number",{directives:[{name:"decorator",rawName:"v-decorator",value:["sort",{initialValue:100,rules:[{required:!0}]}],expression:"['sort', { initialValue: 100, rules: [{ required: true }] }]"}],attrs:{min:0}})],1)],1),t("div",{directives:[{name:"show",rawName:"v-show",value:1==e.tabKey,expression:"tabKey == 1"}],staticClass:"tab-pane"},[t("a-form-item",{attrs:{label:"规格类型",labelCol:e.labelCol,wrapperCol:e.wrapperCol}},[t("a-radio-group",{directives:[{name:"decorator",rawName:"v-decorator",value:["spec_type",{initialValue:10,rules:[{required:!0}]}],expression:"['spec_type', { initialValue: 10, rules: [{ required: true }] }]"}],on:{change:function(t){return e.onForceUpdate()}}},[t("a-radio",{attrs:{value:10,disabled:e.formData.goods.isSpecLocked}},[e._v("单规格")]),t("a-radio",{attrs:{value:20,disabled:e.formData.goods.isSpecLocked}},[e._v("多规格")])],1),e.formData.goods.isSpecLocked?t("p",{staticClass:"form-item-help"},[t("small",{staticClass:"c-red"},[e._v("注:该商品当前正在参与其他活动,商品规格不允许更改")])]):e._e()],1),20==e.form.getFieldValue("spec_type")?t("div",[t("MultiSpec",{ref:"MultiSpec",attrs:{isSpecLocked:e.formData.goods.isSpecLocked,defaultSpecList:e.formData.goods.specList,defaultSkuList:e.formData.goods.skuList,checkList:e.checkList}})],1):e._e(),10==e.form.getFieldValue("spec_type")?t("div",[t("a-form-item",{attrs:{label:"商品价格",labelCol:e.labelCol,wrapperCol:e.wrapperCol,extra:"商品的实际购买金额,最低0.01"}},[t("a-input-number",{directives:[{name:"decorator",rawName:"v-decorator",value:["goods_price",{rules:[{required:!0,message:"请输入商品价格"}]}],expression:"['goods_price', { rules: [{ required: true, message: '请输入商品价格' }] }]"}],attrs:{min:.01,precision:2}}),t("span",{staticClass:"ml-10"},[e._v("元")])],1),t("a-form-item",{attrs:{label:"成本价",labelCol:e.labelCol,wrapperCol:e.wrapperCol,extra:"成本价仅用于商品页展示"}},[t("a-input-number",{directives:[{name:"decorator",rawName:"v-decorator",value:["cost_price"],expression:"['cost_price']"}],attrs:{min:0,precision:2}}),t("span",{staticClass:"ml-10"},[e._v("元")])],1),t("a-form-item",{attrs:{label:"当前库存数量",labelCol:e.labelCol,wrapperCol:e.wrapperCol,extra:"商品的实际库存数量,为0时用户无法下单"}},[t("a-input-number",{directives:[{name:"decorator",rawName:"v-decorator",value:["stock_num",{initialValue:100,rules:[{required:!0,message:"请输入库存数量"}]}],expression:"['stock_num', { initialValue: 100, rules: [{ required: true, message: '请输入库存数量' }] }]"}],attrs:{min:0,precision:0}}),t("span",{staticClass:"ml-10"},[e._v("件")])],1),t("a-form-item",{attrs:{label:"商品重量",labelCol:e.labelCol,wrapperCol:e.wrapperCol,extra:"商品的实际重量,用于计算运费"}},[t("a-input-number",{directives:[{name:"decorator",rawName:"v-decorator",value:["goods_weight",{initialValue:0,rules:[{required:!0,message:"请输入库存数量"}]}],expression:"['goods_weight', { initialValue: 0, rules: [{ required: true, message: '请输入库存数量' }] }]"}],attrs:{min:0}}),t("span",{staticClass:"ml-10"},[e._v("千克 (Kg)")])],1)],1):e._e()],1),t("div",{directives:[{name:"show",rawName:"v-show",value:2==e.tabKey,expression:"tabKey == 2"}],staticClass:"tab-pane"},[t("a-form-item",{attrs:{label:"商品详情",labelCol:e.labelCol,wrapperCol:{span:16}}},[t("Ueditor",{directives:[{name:"decorator",rawName:"v-decorator",value:["content",{rules:[{required:!0,message:"商品详情不能为空"}]}],expression:"['content', { rules: [{ required: true, message: '商品详情不能为空' }] }]"}]})],1)],1),t("div",{directives:[{name:"show",rawName:"v-show",value:3==e.tabKey,expression:"tabKey == 3"}],staticClass:"tab-pane"},[t("a-form-item",{attrs:{label:"主图视频",labelCol:e.labelCol,wrapperCol:e.wrapperCol,extra:"建议视频宽高比19:9,建议时长8-45秒"}},[t("SelectVideo",{directives:[{name:"decorator",rawName:"v-decorator",value:["video_id"],expression:"['video_id']"}],attrs:{multiple:!1,defaultList:e.formData.goods.video?[e.formData.goods.video]:[]}})],1),t("a-form-item",{attrs:{label:"视频封面",labelCol:e.labelCol,wrapperCol:e.wrapperCol,extra:"建议尺寸:750像素*750像素"}},[t("SelectImage",{directives:[{name:"decorator",rawName:"v-decorator",value:["video_cover_id"],expression:"['video_cover_id']"}],attrs:{multiple:!1,defaultList:e.formData.goods.videoCover?[e.formData.goods.videoCover]:[]}})],1),t("a-form-item",{attrs:{label:"商品卖点",labelCol:e.labelCol,wrapperCol:e.wrapperCol,extra:"一句话简述,例如:此款商品美观大方 性价比较高 不容错过"}},[t("a-input",{directives:[{name:"decorator",rawName:"v-decorator",value:["selling_point"],expression:"['selling_point']"}],attrs:{placeholder:"请输入商品卖点"}})],1),t("a-form-item",{attrs:{label:"初始销量",labelCol:e.labelCol,wrapperCol:e.wrapperCol,extra:"用户端展示的销量 = 初始销量 + 实际销量"}},[t("a-input-number",{directives:[{name:"decorator",rawName:"v-decorator",value:["sales_initial",{initialValue:0}],expression:"['sales_initial', { initialValue: 0}]"}]})],1),t("div",[t("a-divider",{attrs:{orientation:"left"}},[e._v("销售区域")]),t("a-form-item",{attrs:{label:"销售区域",labelCol:e.labelCol,wrapperCol:{span:15}}},[t("a-table",{directives:[{name:"show",rawName:"v-show",value:e.ruleList.length,expression:"ruleList.length"}],staticClass:"table-rules",attrs:{columns:e.columns,dataSource:e.ruleList,pagination:!1,bordered:""},scopedSlots:e._u([{key:"region_text",fn:function(a,r,i){return[t("p",{staticClass:"content"},e._l(a,(function(a,r){return t("span",{key:r},[t("span",[e._v(e._s(a.name))]),a.citys.length?[t("span",[e._v("(")]),e._l(a.citys,(function(r,i){return t("span",{key:i,staticClass:"city-name"},[e._v(e._s(r.name)+e._s(a.citys.length>i+1?"、":""))])})),t("span",[e._v(")")])]:e._e(),t("span",[e._v(e._s(" "))])],2)})),0),t("p",{staticClass:"operation"},[t("a",{staticClass:"edit",attrs:{href:"javascript:void(0);"},on:{click:function(t){return e.handleEdit(i,r)}}},[e._v("编辑")]),t("a",{staticClass:"delete",attrs:{href:"javascript:void(0);"},on:{click:function(t){return e.handleDelete(i)}}},[e._v("删除")])])]}}])}),t("a-button",{attrs:{icon:"environment"},on:{click:e.handleAdd}},[e._v("点击添加销售区域")])],1)],1),t("div",{staticStyle:{display:"none"}},[t("a-divider",{attrs:{orientation:"left"}},[e._v("积分设置")]),t("a-form-item",{attrs:{label:"积分赠送",labelCol:e.labelCol,wrapperCol:e.wrapperCol,extra:"开启后用户购买此商品将获得积分"}},[t("a-radio-group",{directives:[{name:"decorator",rawName:"v-decorator",value:["is_points_gift",{initialValue:1,rules:[{required:!0}]}],expression:"['is_points_gift', { initialValue: 1, rules: [{ required: true }] }]"}]},[t("a-radio",{attrs:{value:1}},[e._v("开启")]),t("a-radio",{attrs:{value:0}},[e._v("关闭")])],1)],1),t("a-form-item",{attrs:{label:"积分抵扣",labelCol:e.labelCol,wrapperCol:e.wrapperCol,extra:"开启后用户购买此商品可以使用积分进行抵扣"}},[t("a-radio-group",{directives:[{name:"decorator",rawName:"v-decorator",value:["is_points_discount",{initialValue:1,rules:[{required:!0}]}],expression:"['is_points_discount', { initialValue: 1, rules: [{ required: true }] }]"}]},[t("a-radio",{attrs:{value:1}},[e._v("开启")]),t("a-radio",{attrs:{value:0}},[e._v("关闭")])],1)],1)],1),t("div",{staticStyle:{display:"none"}},[t("a-divider",{attrs:{orientation:"left"}},[e._v("会员折扣设置")]),t("a-form-item",{attrs:{label:"会员折扣",labelCol:e.labelCol,wrapperCol:e.wrapperCol,extra:"开启后会员折扣,会员购买此商品可以享受会员等级折扣价"}},[t("a-radio-group",{directives:[{name:"decorator",rawName:"v-decorator",value:["is_enable_grade",{initialValue:1,rules:[{required:!0}]}],expression:"['is_enable_grade', { initialValue: 1, rules: [{ required: true }] }]"}],on:{change:function(t){return e.onForceUpdate(!0)}}},[t("a-radio",{attrs:{value:1}},[e._v("开启")]),t("a-radio",{attrs:{value:0}},[e._v("关闭")])],1)],1),t("a-form-item",{directives:[{name:"show",rawName:"v-show",value:e.form.getFieldValue("is_enable_grade"),expression:"form.getFieldValue('is_enable_grade')"}],attrs:{label:"会员折扣设置",labelCol:e.labelCol,wrapperCol:e.wrapperCol}},[t("a-radio-group",{directives:[{name:"decorator",rawName:"v-decorator",value:["is_alone_grade",{initialValue:0,rules:[{required:!0}]}],expression:"['is_alone_grade', { initialValue: 0, rules: [{ required: true }] }]"}],on:{change:function(t){return e.onForceUpdate(!0)}}},[t("a-radio",{attrs:{value:0}},[e._v("默认等级折扣")]),t("a-radio",{attrs:{value:1}},[e._v("单独设置折扣")])],1),t("div",{directives:[{name:"show",rawName:"v-show",value:e.form.getFieldValue("is_alone_grade"),expression:"form.getFieldValue('is_alone_grade')"}]},e._l(e.formData.userGradeList,(function(a){return t("a-form-item",{key:a.grade_id},[t("InputNumberGroup",{directives:[{name:"decorator",rawName:"v-decorator",value:["alone_grade_equity[grade_id:".concat(a.grade_id,"]"),{initialValue:e.formData.defaultUserGradeValue[a.grade_id],rules:[{required:!0,message:"折扣率不能为空"}]}],expression:"[`alone_grade_equity[grade_id:${item.grade_id}]`, {\n initialValue: formData.defaultUserGradeValue[item.grade_id], rules: [{ required: true, message: '折扣率不能为空'}]\n }]"}],attrs:{addonBefore:a.name,addonAfter:"折",inputProps:{min:0,max:9.9}}})],1)})),1),t("div",{staticClass:"form-item-help"},[e.form.getFieldValue("is_alone_grade")?t("p",{staticClass:"extra"},[e._v("单独折扣:折扣率范围0.0-9.9,例如: 9.8代表98折,0代表不折扣")]):t("p",{staticClass:"extra"},[e._v("默认折扣:默认为用户所属会员等级的折扣率")])])],1)],1),t("div",{staticStyle:{display:"none"}},[t("a-divider",{attrs:{orientation:"left"}},[e._v("分销设置")]),t("a-form-item",{attrs:{label:"分销佣金",labelCol:e.labelCol,wrapperCol:e.wrapperCol}},[t("a-radio-group",{directives:[{name:"decorator",rawName:"v-decorator",value:["is_ind_dealer",{initialValue:0,rules:[{required:!0}]}],expression:"['is_ind_dealer', { initialValue: 0, rules: [{ required: true }] }]"}],on:{change:function(t){return e.onForceUpdate(!0)}}},[t("a-radio",{attrs:{value:0}},[e._v("系统默认")]),t("a-radio",{attrs:{value:1}},[e._v("单独设置")])],1),t("div",{staticClass:"form-item-help"},[t("p",{staticClass:"extra"},[e._v("若使用分销功能必须在 [分销中心 - 分销设置] 中开启")])])],1),t("a-form-item",{directives:[{name:"show",rawName:"v-show",value:e.form.getFieldValue("is_ind_dealer"),expression:"form.getFieldValue('is_ind_dealer')"}],attrs:{label:"分销佣金类型",labelCol:e.labelCol,wrapperCol:e.wrapperCol}},[t("a-radio-group",{directives:[{name:"decorator",rawName:"v-decorator",value:["dealer_money_type",{initialValue:10,rules:[{required:!0}]}],expression:"['dealer_money_type', { initialValue: 10, rules: [{ required: true }] }]"}],on:{change:function(t){return e.onForceUpdate(!0)}}},[t("a-radio",{attrs:{value:10}},[e._v("百分比")]),t("a-radio",{attrs:{value:20}},[e._v("固定金额")])],1),e._l(e.formData.dealer.levelList,(function(a,r){return t("a-form-item",{key:r},[t("InputNumberGroup",{directives:[{name:"decorator",rawName:"v-decorator",value:[a.value,{rules:[{required:!0,message:"佣金不能为空"}]}],expression:"[item.value, { rules: [{ required: true, message: '佣金不能为空'}] }]"}],attrs:{addonBefore:a.name,addonAfter:10==e.form.getFieldValue("dealer_money_type")?"%":"元",inputProps:{min:0,precision:2}}})],1)}))],2)],1)],1)]),t("a-form-item",{staticClass:"mt-20",attrs:{wrapperCol:{span:e.wrapperCol.span,offset:e.labelCol.span}}},[t("a-button",{attrs:{type:"primary","html-type":"submit",loading:e.isBtnLoading}},[e._v("提交")])],1)],1),t("AreasModal",{ref:"AreasModal",on:{handleSubmit:e.handleAreaSubmit}})],1)],1)},i=[],o=a("5530"),s=(a("d81d"),a("b64b"),a("d3b7"),a("159b"),a("a434"),a("d084")),l=a("2af9"),n=a("e1fe4"),d=a("a119"),u=a("ca00"),c=a("fd0d"),p=a("caec"),m={key:0,region:[],region_text:[]},v={components:{GoodsType:d["a"],SelectImage:l["g"],SelectGoods:l["SelectGoods"],SelectVideo:l["h"],Ueditor:l["i"],InputNumberGroup:l["d"],MultiSpec:d["b"],AreasModal:c["a"],Region:p["a"]},data:function(){return{tabKey:0,labelCol:{span:3},wrapperCol:{span:10},isLoading:!1,isBtnLoading:!1,form:this.$form.createForm(this),goodsId:null,formData:n["a"].formData,checkList:[],ruleList:[],columns:[{title:"销售区域",dataIndex:"region_text",width:"400px",scopedSlots:{customRender:"region_text"}}],citysCount:null}},watch:{"$route.query.goodsId":function(e){e&&(this.goodsId=e,this.initData(),this.getDataList())}},created:function(){var e=this;this.initData(),this.getDataList(),p["a"].getCitysCount().then((function(t){e.citysCount=t}))},beforeDestroy:function(){n["a"].formData.goods={}},methods:{initData:function(){var e=this;this.goodsId=this.$route.query.goodsId,this.isLoading=!0,n["a"].getFromData(this.goodsId).then((function(){Object(u["f"])(e.form.getFieldsValue())||(e.form.setFieldsValue(n["a"].getFieldsValue()),e.$nextTick((function(){e.form.setFieldsValue(n["a"].getFieldsValue2()),e.onForceUpdate()}))),e.isLoading=!1}))},onForceUpdate:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.$forceUpdate(),t&&setTimeout((function(){e.$forceUpdate()}),10)},handleTabs:function(e){this.tabKey=e},onReloadCategoryList:function(){var e=this;this.isLoading=!0,n["a"].getCategoryList().then((function(){e.isLoading=!1}))},onReloadServiceList:function(){var e=this;this.isLoading=!0,n["a"].getServiceList().then((function(){e.isLoading=!1}))},onReloadDeliveryList:function(){var e=this;this.isLoading=!0,n["a"].getDeliveryList().then((function(){e.isLoading=!1}))},getDataList:function(){var e=this;return s["f"]().then((function(t){e.checkList=t.data.list.data}))},handleSubmit:function(e){var t=this;e.preventDefault();var a=this.form.validateFields,r=this.ruleList;a((function(e,a){if(e)return t.onTargetTabError(e),!1;if(20===a.spec_type){var i=t.$refs.MultiSpec;if(!i.verifyForm())return t.tabKey=1,!1;a.specData=i.getFromSpecData()}return a.categoryIds=a.categorys.map((function(e){return e.value})),delete a.categorys,a.rules=r,t.onFormSubmit(a),!0}))},onTargetTabError:function(e){var t=[["goods_type","goods_name","categorys","imagesIds","delivery_id","is_ind_delivery_type","delivery_type","is_brand","is_in_store"],["spec_type","goods_price","is_restrict","restrict_total","restrict_single","cost_price"],["content"],["alone_grade_equity","first_money","second_money","third_money"]],a=Object.keys(e).shift();for(var r in t)if(t[r].indexOf(a)>-1){this.tabKey=parseInt(r);break}},onFormSubmit:function(e){var t=this;this.isLoading=!0,this.isBtnLoading=!0,s["e"]({goodsId:this.goodsId,form:e}).then((function(e){t.$message.success(e.message,1.5),setTimeout((function(){t.$router.push("./index")}),1500)})).catch((function(){t.isBtnLoading=!1})).finally((function(){return t.isLoading=!1}))},handleAdd:function(){var e=this.ruleList.length,t=Object(o["a"])(Object(o["a"])({},m),{},{key:e}),a=this.getExcludedCityIds();if(a.length===this.citysCount)return this.$message.error("已选择了所有的区域",.8),!1;this.handleAreasModal("add",e,t,a)},handleEdit:function(e,t){var a=this.getExcludedCityIds();this.handleAreasModal("edit",e,t,a)},handleAreaSubmit:function(e){var t=e.custom,a=t.scene,r=t.item;r.region=e.selectedCityIds,r.region_text=e.selectedText,"add"===a&&this.ruleList.push(r)},getExcludedCityIds:function(){var e=[];return this.ruleList.forEach((function(t){t.region.forEach((function(t){e.push(t)}))})),e},handleAreasModal:function(e,t,a,r){this.$refs.AreasModal.handle({scene:e,index:t,item:a},a.region,r)},handleDelete:function(e){var t=this,a=this.$confirm({title:"您确定要删除该记录吗?",onOk:function(){t.ruleList.splice(e,1),a.destroy()}})}}},f=v,h=(a("34e1"),a("2877")),g=Object(h["a"])(f,r,i,!1,null,"1e384008",null);t["default"]=g.exports},ecf0:function(e,t,a){"use strict";a.r(t);a("b0c0");var r=function(){var e=this,t=e._self._c;return t("a-card",{attrs:{bordered:!1}},[t("div",{staticClass:"card-title"},[e._v(e._s(e.$route.meta.title))]),t("a-spin",{attrs:{spinning:e.isLoading}},[t("a-form",{attrs:{form:e.form,selfUpdate:!0},on:{submit:e.handleSubmit}},[t("a-tabs",{attrs:{activeKey:e.tabKey,tabBarStyle:{marginBottom:"30px"}},on:{change:e.handleTabs}},[t("a-tab-pane",{key:0,attrs:{tab:"基本信息"}}),t("a-tab-pane",{key:1,attrs:{tab:"规格/库存"}}),t("a-tab-pane",{key:2,attrs:{tab:"商品详情"}}),t("a-tab-pane",{key:3,attrs:{tab:"更多设置"}})],1),t("div",{staticClass:"tabs-content"},[t("div",{directives:[{name:"show",rawName:"v-show",value:0==e.tabKey,expression:"tabKey == 0"}],staticClass:"tab-pane"},[t("a-form-item",{attrs:{label:"商品类型",labelCol:e.labelCol,wrapperCol:e.wrapperCol}},[t("GoodsType",{directives:[{name:"decorator",rawName:"v-decorator",value:["goods_type",{rules:[{required:!0}]}],expression:"['goods_type', { rules: [{ required: true }] }]"}],attrs:{onlyShowChecked:!0},on:{change:function(t){return e.onForceUpdate(!0)}}})],1),t("a-form-item",{attrs:{label:"商品名称",labelCol:e.labelCol,wrapperCol:e.wrapperCol}},[t("a-input",{directives:[{name:"decorator",rawName:"v-decorator",value:["goods_name",{rules:[{required:!0,min:2,message:"请输入至少2个字符"}]}],expression:"['goods_name', { rules: [{ required: true, min: 2, message: '请输入至少2个字符' }] }]"}],attrs:{placeholder:"请输入商品名称"}})],1),t("a-form-item",{attrs:{label:"商品分类",labelCol:e.labelCol,wrapperCol:e.wrapperCol}},[t("a-tree-select",{directives:[{name:"decorator",rawName:"v-decorator",value:["categorys",{rules:[{required:!0,message:"请至少选择1个商品分类"}]}],expression:"['categorys', { rules: [{ required: true, message: '请至少选择1个商品分类' }] }]"}],attrs:{placeholder:"请选择商品分类",dropdownStyle:{maxHeight:"500px",overflow:"auto"},treeData:e.formData.categoryList,treeCheckable:"",treeCheckStrictly:"",allowClear:""}}),t("div",{staticClass:"form-item-help"},[t("router-link",{attrs:{target:"_blank",to:{path:"/goods/category/index"}}},[e._v("去新增")]),t("a",{attrs:{href:"javascript:;"},on:{click:e.onReloadCategoryList}},[e._v("刷新")])],1)],1),t("a-form-item",{attrs:{label:"商品图片",labelCol:e.labelCol,wrapperCol:e.wrapperCol,extra:"建议尺寸:750*750像素, 最多上传10张, 可拖拽图片调整顺序, 第1张将作为商品首图"}},[t("SelectImage",{directives:[{name:"decorator",rawName:"v-decorator",value:["imagesIds",{rules:[{required:!0,message:"请至少上传1张商品图片"}]}],expression:"['imagesIds', { rules: [{ required: true, message: '请至少上传1张商品图片' }] }]"}],attrs:{multiple:"",maxNum:10,defaultList:e.formData.goods.goods_images}})],1),t("a-form-item",{attrs:{label:"商品编码",labelCol:e.labelCol,wrapperCol:e.wrapperCol}},[t("a-input",{directives:[{name:"decorator",rawName:"v-decorator",value:["goods_no"],expression:"['goods_no']"}],attrs:{placeholder:"请输入商品编码"}})],1),10==e.form.getFieldValue("goods_type")?t("a-form-item",{attrs:{label:"配送方式",labelCol:e.labelCol,wrapperCol:e.wrapperCol}},[t("a-radio-group",{directives:[{name:"decorator",rawName:"v-decorator",value:["is_ind_delivery_type",{initialValue:0,rules:[{required:!0}]}],expression:"['is_ind_delivery_type', { initialValue: 0, rules: [{ required: true }] }]"}],on:{change:function(t){return e.onForceUpdate()}}},[t("a-radio",{attrs:{value:0}},[e._v("系统默认")]),t("a-radio",{attrs:{value:1}},[e._v("单独配置")])],1),t("div",{directives:[{name:"show",rawName:"v-show",value:e.form.getFieldValue("is_ind_delivery_type"),expression:"form.getFieldValue('is_ind_delivery_type')"}]},[t("a-form-item",{attrs:{extra:"需在 [设置 - 配送方式] 中,开启支持的配送方式才可生效"}},[t("a-checkbox-group",{directives:[{name:"decorator",rawName:"v-decorator",value:["delivery_type",{initialValue:[10,20],rules:[{required:!0,message:"配送方式至少选择一个"}]}],expression:"['delivery_type', { initialValue: [10, 20], rules: [{ required: true, message: '配送方式至少选择一个' }] }]"}],attrs:{options:[{label:"快递配送",value:10},{label:"上门自提",value:20}]}})],1)],1)],1):e._e(),10==e.form.getFieldValue("goods_type")?t("a-form-item",{attrs:{label:"运费模板",labelCol:e.labelCol,wrapperCol:e.wrapperCol}},[t("a-select",{directives:[{name:"decorator",rawName:"v-decorator",value:["delivery_id",{rules:[{required:!0,message:"请选择运费模板"}]}],expression:"['delivery_id', { rules: [{ required: true, message: '请选择运费模板' }] }]"}],staticStyle:{width:"300px"},attrs:{placeholder:"请选择运费模板"}},e._l(e.formData.deliveryList,(function(a,r){return t("a-select-option",{key:r,attrs:{value:a.delivery_id}},[e._v(e._s(a.name))])})),1),t("div",{staticClass:"form-item-help"},[t("router-link",{attrs:{target:"_blank",to:{path:"/setting/delivery/template/create"}}},[e._v("新增模板")]),t("a",{attrs:{href:"javascript:;"},on:{click:e.onReloadDeliveryList}},[e._v("刷新")])],1)],1):e._e(),t("a-form-item",{attrs:{label:"商品状态",labelCol:e.labelCol,wrapperCol:e.wrapperCol}},[t("a-radio-group",{directives:[{name:"decorator",rawName:"v-decorator",value:["status",{initialValue:10,rules:[{required:!0}]}],expression:"['status', { initialValue: 10, rules: [{ required: true }] }]"}]},[t("a-radio",{attrs:{value:10}},[e._v("上架")]),t("a-radio",{attrs:{value:20}},[e._v("下架")])],1)],1),t("a-form-item",{attrs:{label:"商品排序",labelCol:e.labelCol,wrapperCol:e.wrapperCol,extra:"数字越小越靠前"}},[t("a-input-number",{directives:[{name:"decorator",rawName:"v-decorator",value:["sort",{initialValue:100,rules:[{required:!0}]}],expression:"['sort', { initialValue: 100, rules: [{ required: true }] }]"}],attrs:{min:0}})],1)],1),t("div",{directives:[{name:"show",rawName:"v-show",value:1==e.tabKey,expression:"tabKey == 1"}],staticClass:"tab-pane"},[t("a-form-item",{attrs:{label:"规格类型",labelCol:e.labelCol,wrapperCol:e.wrapperCol}},[t("a-radio-group",{directives:[{name:"decorator",rawName:"v-decorator",value:["spec_type",{initialValue:10,rules:[{required:!0}]}],expression:"['spec_type', { initialValue: 10, rules: [{ required: true }] }]"}],on:{change:function(t){return e.onForceUpdate()}}},[t("a-radio",{attrs:{value:10}},[e._v("单规格")]),t("a-radio",{attrs:{value:20}},[e._v("多规格")])],1)],1),20==e.form.getFieldValue("spec_type")?t("div",[t("MultiSpec",{ref:"MultiSpec",attrs:{defaultSpecList:e.formData.goods.specList,defaultSkuList:e.formData.goods.skuList}})],1):e._e(),10==e.form.getFieldValue("spec_type")?t("div",[t("a-form-item",{attrs:{label:"商品价格",labelCol:e.labelCol,wrapperCol:e.wrapperCol,extra:"商品的实际购买金额,最低0.01"}},[t("a-input-number",{directives:[{name:"decorator",rawName:"v-decorator",value:["goods_price",{rules:[{required:!0,message:"请输入商品价格"}]}],expression:"['goods_price', { rules: [{ required: true, message: '请输入商品价格' }] }]"}],attrs:{min:.01,precision:2}}),t("span",{staticClass:"ml-10"},[e._v("元")])],1),t("a-form-item",{attrs:{label:"成本价",labelCol:e.labelCol,wrapperCol:e.wrapperCol,extra:"成本价仅用于商品页展示"}},[t("a-input-number",{directives:[{name:"decorator",rawName:"v-decorator",value:["cost_price"],expression:"['cost_price']"}],attrs:{min:0,precision:2}}),t("span",{staticClass:"ml-10"},[e._v("元")])],1),t("a-form-item",{attrs:{label:"当前库存数量",labelCol:e.labelCol,wrapperCol:e.wrapperCol,extra:"商品的实际库存数量,为0时用户无法下单"}},[t("a-input-number",{directives:[{name:"decorator",rawName:"v-decorator",value:["stock_num",{initialValue:100,rules:[{required:!0,message:"请输入库存数量"}]}],expression:"['stock_num', { initialValue: 100, rules: [{ required: true, message: '请输入库存数量' }] }]"}],attrs:{min:0,precision:0}}),t("span",{staticClass:"ml-10"},[e._v("件")])],1),t("a-form-item",{attrs:{label:"商品重量",labelCol:e.labelCol,wrapperCol:e.wrapperCol,extra:"商品的实际重量,用于计算运费"}},[t("a-input-number",{directives:[{name:"decorator",rawName:"v-decorator",value:["goods_weight",{initialValue:0,rules:[{required:!0,message:"请输入库存数量"}]}],expression:"['goods_weight', { initialValue: 0, rules: [{ required: true, message: '请输入库存数量' }] }]"}],attrs:{min:0}}),t("span",{staticClass:"ml-10"},[e._v("千克 (Kg)")])],1)],1):e._e(),t("a-form-item",{attrs:{label:"库存计算方式",labelCol:e.labelCol,wrapperCol:e.wrapperCol}},[t("a-radio-group",{directives:[{name:"decorator",rawName:"v-decorator",value:["deduct_stock_type",{initialValue:10,rules:[{required:!0}]}],expression:"['deduct_stock_type', { initialValue: 10, rules: [{ required: true }] }]"}]},[t("a-radio",{attrs:{value:10}},[e._v("下单减库存")]),t("a-radio",{attrs:{value:20}},[e._v("付款减库存")])],1)],1),t("a-form-item",{attrs:{label:"商品限购",labelCol:e.labelCol,wrapperCol:e.wrapperCol,extra:"用于限制每人购买该商品的数量"}},[t("a-radio-group",{directives:[{name:"decorator",rawName:"v-decorator",value:["is_restrict",{initialValue:0,rules:[{required:!0}]}],expression:"['is_restrict', { initialValue: 0, rules: [{ required: true }] }]"}],on:{change:function(t){return e.onForceUpdate()}}},[t("a-radio",{attrs:{value:0}},[e._v("关闭")]),t("a-radio",{attrs:{value:1}},[e._v("开启")])],1),e.form.getFieldValue("is_restrict")?t("div",{staticClass:"mt-10"},[t("a-form-item",[t("span",{staticClass:"mr-10"},[e._v("总限购")]),t("a-input-number",{directives:[{name:"decorator",rawName:"v-decorator",value:["restrict_total",{rules:[{required:!0,message:"请输入总限购数量"}]}],expression:"['restrict_total', { rules: [{ required: true, message: '请输入总限购数量' }] }]"}],attrs:{min:1,precision:0}}),t("span",{staticClass:"ml-10"},[e._v("件/人")])],1),t("a-form-item",[t("span",{staticClass:"mr-10"},[e._v("每单限购")]),t("a-input-number",{directives:[{name:"decorator",rawName:"v-decorator",value:["restrict_single",{rules:[{required:!0,message:"请输入每单限购数量"}]}],expression:"['restrict_single', { rules: [{ required: true, message: '请输入每单限购数量' }] }]"}],attrs:{min:1,precision:0}}),t("span",{staticClass:"ml-10"},[e._v("件/人")])],1)],1):e._e()],1)],1),t("div",{directives:[{name:"show",rawName:"v-show",value:2==e.tabKey,expression:"tabKey == 2"}],staticClass:"tab-pane"},[t("a-form-item",{attrs:{label:"商品详情",labelCol:e.labelCol,wrapperCol:{span:16}}},[t("Ueditor",{directives:[{name:"decorator",rawName:"v-decorator",value:["content",{rules:[{required:!0,message:"商品详情不能为空"}]}],expression:"['content', { rules: [{ required: true, message: '商品详情不能为空' }] }]"}]})],1)],1),t("div",{directives:[{name:"show",rawName:"v-show",value:3==e.tabKey,expression:"tabKey == 3"}],staticClass:"tab-pane"},[t("a-form-item",{attrs:{label:"主图视频",labelCol:e.labelCol,wrapperCol:e.wrapperCol,extra:"建议视频宽高比19:9,建议时长8-45秒"}},[t("SelectVideo",{directives:[{name:"decorator",rawName:"v-decorator",value:["video_id"],expression:"['video_id']"}],attrs:{multiple:!1,defaultList:e.formData.goods.video?[e.formData.goods.video]:[]}})],1),t("a-form-item",{attrs:{label:"视频封面",labelCol:e.labelCol,wrapperCol:e.wrapperCol,extra:"建议尺寸:750像素*750像素"}},[t("SelectImage",{directives:[{name:"decorator",rawName:"v-decorator",value:["video_cover_id"],expression:"['video_cover_id']"}],attrs:{multiple:!1,defaultList:e.formData.goods.videoCover?[e.formData.goods.videoCover]:[]}})],1),t("a-form-item",{attrs:{label:"商品卖点",labelCol:e.labelCol,wrapperCol:e.wrapperCol,extra:"一句话简述,例如:此款商品美观大方 性价比较高 不容错过"}},[t("a-input",{directives:[{name:"decorator",rawName:"v-decorator",value:["selling_point"],expression:"['selling_point']"}],attrs:{placeholder:"请输入商品卖点"}})],1),t("a-form-item",{attrs:{label:"服务与承诺",labelCol:e.labelCol,wrapperCol:e.wrapperCol}},[e.formData.serviceList?t("a-select",{directives:[{name:"decorator",rawName:"v-decorator",value:["serviceIds"],expression:"['serviceIds']"}],attrs:{mode:"multiple",placeholder:"请选择服务与承诺"}},e._l(e.formData.serviceList,(function(a,r){return t("a-select-option",{key:r,attrs:{value:a.service_id}},[e._v(e._s(a.name))])})),1):e._e(),t("div",{staticClass:"form-item-help"},[t("router-link",{attrs:{target:"_blank",to:{path:"/goods/service/index"}}},[e._v("去新增")]),t("a",{attrs:{href:"javascript:;"},on:{click:e.onReloadServiceList}},[e._v("刷新")])],1)],1),t("a-form-item",{attrs:{label:"初始销量",labelCol:e.labelCol,wrapperCol:e.wrapperCol,extra:"用户端展示的销量 = 初始销量 + 实际销量"}},[t("a-input-number",{directives:[{name:"decorator",rawName:"v-decorator",value:["sales_initial",{initialValue:0}],expression:"['sales_initial', { initialValue: 0 }]"}]})],1),t("div",[t("a-divider",{attrs:{orientation:"left"}},[e._v("积分设置")]),t("a-form-item",{attrs:{label:"积分赠送",labelCol:e.labelCol,wrapperCol:e.wrapperCol,extra:"开启后用户购买此商品将获得积分"}},[t("a-radio-group",{directives:[{name:"decorator",rawName:"v-decorator",value:["is_points_gift",{initialValue:1,rules:[{required:!0}]}],expression:"['is_points_gift', { initialValue: 1, rules: [{ required: true }] }]"}]},[t("a-radio",{attrs:{value:1}},[e._v("开启")]),t("a-radio",{attrs:{value:0}},[e._v("关闭")])],1)],1),t("a-form-item",{attrs:{label:"积分抵扣",labelCol:e.labelCol,wrapperCol:e.wrapperCol,extra:"开启后用户购买此商品可以使用积分进行抵扣"}},[t("a-radio-group",{directives:[{name:"decorator",rawName:"v-decorator",value:["is_points_discount",{initialValue:1,rules:[{required:!0}]}],expression:"['is_points_discount', { initialValue: 1, rules: [{ required: true }] }]"}]},[t("a-radio",{attrs:{value:1}},[e._v("开启")]),t("a-radio",{attrs:{value:0}},[e._v("关闭")])],1)],1)],1),t("div",[t("a-divider",{attrs:{orientation:"left"}},[e._v("会员折扣设置")]),t("a-form-item",{attrs:{label:"会员折扣",labelCol:e.labelCol,wrapperCol:e.wrapperCol,extra:"开启后会员折扣,会员购买此商品可以享受会员等级折扣价"}},[t("a-radio-group",{directives:[{name:"decorator",rawName:"v-decorator",value:["is_enable_grade",{initialValue:1,rules:[{required:!0}]}],expression:"['is_enable_grade', { initialValue: 1, rules: [{ required: true }] }]"}],on:{change:function(t){return e.onForceUpdate(!0)}}},[t("a-radio",{attrs:{value:1}},[e._v("开启")]),t("a-radio",{attrs:{value:0}},[e._v("关闭")])],1)],1),t("a-form-item",{directives:[{name:"show",rawName:"v-show",value:e.form.getFieldValue("is_enable_grade"),expression:"form.getFieldValue('is_enable_grade')"}],attrs:{label:"会员折扣设置",labelCol:e.labelCol,wrapperCol:e.wrapperCol}},[t("a-radio-group",{directives:[{name:"decorator",rawName:"v-decorator",value:["is_alone_grade",{initialValue:0,rules:[{required:!0}]}],expression:"['is_alone_grade', { initialValue: 0, rules: [{ required: true }] }]"}],on:{change:function(t){return e.onForceUpdate(!0)}}},[t("a-radio",{attrs:{value:0}},[e._v("默认等级折扣")]),t("a-radio",{attrs:{value:1}},[e._v("单独设置折扣")])],1),t("div",{directives:[{name:"show",rawName:"v-show",value:e.form.getFieldValue("is_alone_grade"),expression:"form.getFieldValue('is_alone_grade')"}]},e._l(e.formData.userGradeList,(function(a){return t("a-form-item",{key:a.grade_id},[t("InputNumberGroup",{directives:[{name:"decorator",rawName:"v-decorator",value:["alone_grade_equity[grade_id:".concat(a.grade_id,"]"),{initialValue:e.formData.defaultUserGradeValue[a.grade_id],rules:[{required:!0,message:"折扣率不能为空"}]}],expression:"[`alone_grade_equity[grade_id:${item.grade_id}]`, {\n initialValue: formData.defaultUserGradeValue[item.grade_id], rules: [{ required: true, message: '折扣率不能为空' }]\n }]"}],attrs:{addonBefore:a.name,addonAfter:"折",inputProps:{min:0,max:9.9}}})],1)})),1),t("div",{staticClass:"form-item-help"},[e.form.getFieldValue("is_alone_grade")?t("p",{staticClass:"extra"},[e._v("单独折扣:折扣率范围0.0-9.9,例如: 9.8代表98折,0代表不折扣")]):t("p",{staticClass:"extra"},[e._v("默认折扣:默认为用户所属会员等级的折扣率")])])],1)],1),t("div",[t("a-divider",{attrs:{orientation:"left"}},[e._v("分销设置")]),t("a-form-item",{attrs:{label:"分销佣金",labelCol:e.labelCol,wrapperCol:e.wrapperCol}},[t("a-radio-group",{directives:[{name:"decorator",rawName:"v-decorator",value:["is_ind_dealer",{initialValue:0,rules:[{required:!0}]}],expression:"['is_ind_dealer', { initialValue: 0, rules: [{ required: true }] }]"}],on:{change:function(t){return e.onForceUpdate(!0)}}},[t("a-radio",{attrs:{value:0}},[e._v("系统默认")]),t("a-radio",{attrs:{value:1}},[e._v("单独设置")])],1),t("div",{staticClass:"form-item-help"},[t("p",{staticClass:"extra"},[e._v("若使用分销功能必须在 [分销中心 - 分销设置] 中开启")])])],1),t("a-form-item",{directives:[{name:"show",rawName:"v-show",value:e.form.getFieldValue("is_ind_dealer"),expression:"form.getFieldValue('is_ind_dealer')"}],attrs:{label:"分销佣金类型",labelCol:e.labelCol,wrapperCol:e.wrapperCol}},[t("a-radio-group",{directives:[{name:"decorator",rawName:"v-decorator",value:["dealer_money_type",{initialValue:10,rules:[{required:!0}]}],expression:"['dealer_money_type', { initialValue: 10, rules: [{ required: true }] }]"}],on:{change:function(t){return e.onForceUpdate(!0)}}},[t("a-radio",{attrs:{value:10}},[e._v("百分比")]),t("a-radio",{attrs:{value:20}},[e._v("固定金额")])],1),e._l(e.formData.dealer.levelList,(function(a,r){return t("a-form-item",{key:r},[t("InputNumberGroup",{directives:[{name:"decorator",rawName:"v-decorator",value:[a.value,{rules:[{required:!0,message:"佣金不能为空"}]}],expression:"[item.value, { rules: [{ required: true, message: '佣金不能为空'}] }]"}],attrs:{addonBefore:a.name,addonAfter:10==e.form.getFieldValue("dealer_money_type")?"%":"元",inputProps:{min:0,precision:2}}})],1)}))],2)],1)],1)]),t("a-form-item",{staticClass:"mt-20",attrs:{wrapperCol:{span:e.wrapperCol.span,offset:e.labelCol.span}}},[t("a-button",{attrs:{type:"primary","html-type":"submit",loading:e.isBtnLoading}},[e._v("提交")])],1)],1)],1)],1)},i=[],o=(a("d81d"),a("b64b"),a("d3b7"),a("d084")),s=a("2af9"),l=a("e1fe4"),n=a("a119"),d=a("ca00"),u={components:{GoodsType:n["a"],SelectImage:s["g"],SelectVideo:s["h"],Ueditor:s["i"],InputNumberGroup:s["d"],MultiSpec:n["b"]},data:function(){return{tabKey:0,labelCol:{span:3},wrapperCol:{span:10},isLoading:!1,isBtnLoading:!1,form:this.$form.createForm(this),goodsId:null,formData:l["a"].formData}},created:function(){this.initData()},beforeDestroy:function(){l["a"].formData.goods={}},methods:{initData:function(){var e=this;this.goodsId=this.$route.query.goodsId,this.isLoading=!0,l["a"].getFromData(this.goodsId).then((function(){Object(d["f"])(e.form.getFieldsValue())||(e.form.setFieldsValue(l["a"].getFieldsValue()),e.$nextTick((function(){e.form.setFieldsValue(l["a"].getFieldsValue2()),e.onForceUpdate()}))),e.isLoading=!1}))},onForceUpdate:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.$forceUpdate(),t&&setTimeout((function(){e.$forceUpdate()}),10)},handleTabs:function(e){this.tabKey=e},onReloadCategoryList:function(){var e=this;this.isLoading=!0,l["a"].getCategoryList().then((function(){e.isLoading=!1}))},onReloadServiceList:function(){var e=this;this.isLoading=!0,l["a"].getServiceList().then((function(){e.isLoading=!1}))},onReloadDeliveryList:function(){var e=this;this.isLoading=!0,l["a"].getDeliveryList().then((function(){e.isLoading=!1}))},handleSubmit:function(e){var t=this;e.preventDefault();var a=this.form.validateFields;a((function(e,a){if(e)return t.onTargetTabError(e),!1;if(20===a.spec_type){var r=t.$refs.MultiSpec;if(!r.verifyForm())return t.tabKey=1,!1;a.specData=r.getFromSpecData()}return a.categoryIds=a.categorys.map((function(e){return e.value})),delete a.categorys,t.onFormSubmit(a),!0}))},onTargetTabError:function(e){var t=[["goods_type","goods_name","categorys","imagesIds","delivery_id","is_ind_delivery_type","delivery_type"],["spec_type","goods_price","is_restrict","restrict_total","restrict_single"],["content"],["alone_grade_equity","first_money","second_money","third_money"]],a=Object.keys(e).shift();for(var r in t)if(t[r].indexOf(a)>-1){this.tabKey=parseInt(r);break}},onFormSubmit:function(e){var t=this;this.isLoading=!0,this.isBtnLoading=!0,o["a"]({form:e}).then((function(e){t.$message.success(e.message,1.5),setTimeout((function(){t.$router.push("./index")}),1500)})).catch((function(){t.isBtnLoading=!1})).finally((function(){return t.isLoading=!1}))}}},c=u,p=(a("0758"),a("2877")),m=Object(p["a"])(c,r,i,!1,null,"b748eeb6",null);t["default"]=m.exports},f09f:function(e,t,a){"use strict";a.r(t);a("b0c0");var r=function(){var e=this,t=e._self._c;return t("a-card",{attrs:{bordered:!1}},[t("content-header",{attrs:{title:e.$route.meta.title}}),t("div",{staticClass:"table-operator"},[t("a-row",{staticClass:"row-item-search"},[t("a-form",{staticClass:"search-form",attrs:{form:e.searchForm,layout:"inline"},on:{submit:e.handleSearch}},[t("a-form-item",{attrs:{label:"渠道"}},[t("a-select",{staticStyle:{width:"120px"},attrs:{placeholder:"请选择"},on:{change:e.getChannel}},e._l(e.checkList,(function(a){return t("a-select-option",{key:a.id,attrs:{value:a.id}},[e._v(" "+e._s(a.name)+" ")])})),1)],1),t("a-form-item",{attrs:{label:"数据类型"}},[t("a-select",{staticStyle:{width:"120px"},attrs:{placeholder:"请选择"},on:{change:e.getDataType}},e._l(e.dataType,(function(a){return t("a-select-option",{key:a.val,attrs:{value:a.val}},[e._v(" "+e._s(a.name)+" ")])})),1)],1),t("a-form-item",{attrs:{label:"商品名称"}},[t("a-input",{directives:[{name:"decorator",rawName:"v-decorator",value:["goodsName"],expression:"['goodsName']"}],attrs:{placeholder:"请输入商品名称"}})],1),t("a-form-item",{attrs:{label:"商品编码"}},[t("a-input",{directives:[{name:"decorator",rawName:"v-decorator",value:["goodsNo"],expression:"['goodsNo']"}],attrs:{placeholder:"请输入商品编码"}})],1),t("a-form-item",{attrs:{label:"商品分类"}},[t("a-tree-select",{staticStyle:{"min-width":"180px"},attrs:{placeholder:"请选择商品分类",dropdownStyle:{maxHeight:"500px",overflow:"auto"},treeData:e.categoryListTree,treeCheckable:"",treeCheckStrictly:"",allowClear:"","max-tag-count":1},on:{change:e.onSearchCategory}})],1),t("a-form-item",{attrs:{label:"类型"}},[t("a-select",{staticStyle:{width:"120px"},attrs:{placeholder:"请选择"},on:{change:e.getGoodsType}},e._l(e.goodsType,(function(a){return t("a-select-option",{key:a.val,attrs:{value:a.val}},[e._v(" "+e._s(a.name)+" ")])})),1)],1),t("a-form-item",{attrs:{label:"状态"}},[t("a-select",{staticStyle:{width:"120px"},attrs:{placeholder:"请选择"},on:{change:e.getGoodsStarus}},e._l(e.goodsStatus,(function(a){return t("a-select-option",{key:a.val,attrs:{value:a.val}},[e._v(" "+e._s(a.name)+" ")])})),1)],1),t("a-form-item",{attrs:{label:"前台价"}},[t("div",{staticClass:"goodsType",staticStyle:{display:"flex"}},[t("a-input",{directives:[{name:"decorator",rawName:"v-decorator",value:["goods_price_min"],expression:"['goods_price_min']"}],attrs:{placeholder:"请输入"}}),e._v("- "),t("a-input",{directives:[{name:"decorator",rawName:"v-decorator",value:["goods_price_max"],expression:"['goods_price_max']"}],staticStyle:{"margin-left":"5px"},attrs:{placeholder:"请输入"}})],1)]),t("a-form-item",{attrs:{label:"利润率"}},[t("div",{staticClass:"goodsType",staticStyle:{display:"flex"}},[t("a-input",{directives:[{name:"decorator",rawName:"v-decorator",value:["profit_rate_min"],expression:"['profit_rate_min']"}],attrs:{placeholder:"请输入"}}),e._v("- "),t("a-input",{directives:[{name:"decorator",rawName:"v-decorator",value:["profit_rate_max"],expression:"['profit_rate_max']"}],staticStyle:{"margin-left":"5px"},attrs:{placeholder:"请输入"}})],1)]),t("a-form-item",{staticClass:"search-btn"},[t("a-button",{attrs:{type:"primary",icon:"search","html-type":"submit"}},[e._v("搜索")])],1)],1)],1),t("a-modal",{attrs:{width:"450px",title:"商品分类"},on:{ok:function(t){return e.handleUpdateClassify(e.selectedRowKeys,e.categoryIds)}},model:{value:e.visible,callback:function(t){e.visible=t},expression:"visible"}},[t("a-tree-select",{staticStyle:{"min-width":"400px"},attrs:{placeholder:"请选择商品分类",dropdownStyle:{maxHeight:"500px",overflow:"auto"},treeData:e.categoryListTree,treeCheckable:"",treeCheckStrictly:"",allowClear:""},on:{change:e.onChangeCategory}})],1),t("a-modal",{attrs:{width:"250px",title:"停售类型"},on:{ok:function(t){return e.handleUpdateSales(e.selectedRowKeys,e.is_sale)}},model:{value:e.saleVisible,callback:function(t){e.saleVisible=t},expression:"saleVisible"}},[t("a-select",{staticStyle:{width:"200px"},attrs:{placeholder:"请选择"},on:{change:e.getSale},model:{value:e.is_sale,callback:function(t){e.is_sale=t},expression:"is_sale"}},e._l(e.saleStatus,(function(a){return t("a-select-option",{key:a.val,attrs:{value:a.val}},[e._v(" "+e._s(a.name)+" ")])})),1)],1),t("div",{staticClass:"row-item-tab clearfix"},[t("div",{staticClass:"tab-list fl-l"},[t("a-radio-group",{attrs:{defaultValue:e.queryParam.listType},on:{change:e.handleTabs}},[t("a-radio-button",{attrs:{value:"all"}},[e._v("全部")]),t("a-radio-button",{attrs:{value:"on_sale"}},[e._v("出售中")]),t("a-radio-button",{attrs:{value:"off_sale"}},[e._v("已下架")]),t("a-radio-button",{attrs:{value:"sold_out"}},[e._v("已售罄")])],1)],1),t("a-button",{staticClass:"fl-l",attrs:{type:"primary",icon:"plus"},on:{click:function(t){return e.handleCreate()}}},[e._v("创建商品")]),t("a-button",{staticClass:"fl-l",attrs:{icon:"arrow-up"},on:{click:function(t){return e.handleImport()}}},[e._v("批量导入")]),e.selectedRowKeys.length?t("div",{staticClass:"button-group"},[t("a-button-group",{staticClass:"ml-10"},[t("a-button",{staticStyle:{"background-color":"red",color:"#fff"},attrs:{icon:"arrow-up"},on:{click:function(t){return e.handleUpdateStatus(e.selectedRowKeys,1)}}},[e._v("上架")]),t("a-button",{staticStyle:{"background-color":"gray",color:"#fff"},attrs:{icon:"arrow-down"},on:{click:function(t){return e.handleUpdateStatus(e.selectedRowKeys,2)}}},[e._v("移除")]),t("a-button",{staticStyle:{"background-color":"green",color:"#fff"},on:{click:function(t){e.visible=!0}}},[e._v("归类")]),t("a-button",{staticStyle:{"background-color":"blue",color:"#fff"},on:{click:function(t){e.saleVisible=!0}}},[e._v("停售")]),t("a-button",{attrs:{icon:"delete"},on:{click:function(t){return e.handleDelete(e.selectedRowKeys)}}},[e._v("删除")])],1)],1):e._e()],1)],1),t("s-table",{ref:"table",attrs:{rowKey:"goods_id",loading:e.isLoading,columns:e.columns,data:e.loadData,rowSelection:e.rowSelection,pageSize:15},scopedSlots:e._u([{key:"goods_image",fn:function(e){return t("span",{},[t("a",{attrs:{title:"点击查看原图",href:e,target:"_blank"}},[t("img",{attrs:{width:"50",height:"50",src:e,alt:"商品图片"}})])])}},{key:"is_pool",fn:function(a){return t("span",{},[t("p",{staticClass:"twoline-hide",staticStyle:{width:"40px"},style:{color:0==a?"red":1==a?"green":"gray"}},[e._v(" "+e._s(0==a?"待处理":1==a?"已入池":"未入池")+" ")])])}},{key:"is_sale",fn:function(a,r){return t("span",{},[t("a-tag",{staticClass:"cur-p",attrs:{color:0==a?"red":1==a?"green":"gray"}},[e._v(e._s(0==a?"已下架":1==a?"出售中":"已售罄"))])],1)}},{key:"action",fn:function(a,r){return t("div",{staticClass:"actions",staticStyle:{width:"140px"}},[t("router-link",{attrs:{to:{path:"/goods/update",query:{goodsId:r.goods_id}}}},[e._v("编辑")]),t("router-link",{attrs:{to:{path:"/goods/copy",query:{goodsId:r.goods_id}}}},[e._v("复制")]),1==r.is_sale?t("a",{on:{click:function(t){return e.handleUpdateStatus([r.goods_id],2)}}},[e._v("下架")]):t("a",{on:{click:function(t){return e.handleUpdateStatus([r.goods_id],1)}}},[e._v("上架")]),t("a",{on:{click:function(t){return e.handleDelete([r.goods_id])}}},[e._v("删除")])],1)}}])})],1)},i=[],o=a("5530"),s=(a("4e82"),a("d3b7"),a("159b"),a("b64b"),a("a15b"),a("d084")),l=a("2af9"),n=a("8243"),d=a("73f5"),u=[{title:"商品ID",dataIndex:"goods_id",sorter:!0},{title:"渠道",dataIndex:"channel_name",width:"60px"},{title:"商品图片",dataIndex:"goods_image",scopedSlots:{customRender:"goods_image"}},{title:"商品名称",dataIndex:"goods_name",width:"270px",scopedSlots:{customRender:"goods_name"}},{title:"前台价",dataIndex:"goods_price_min",scopedSlots:{customRender:"goods_price_min"},sorter:!0},{title:"利润",dataIndex:"profit",sorter:!0},{title:"利润率",dataIndex:"profit_rate",sorter:!0},{title:"库存",dataIndex:"stock_total",sorter:!0},{title:"商品池",dataIndex:"is_pool",scopedSlots:{customRender:"is_pool"}},{title:"状态",dataIndex:"is_sale",scopedSlots:{customRender:"is_sale"}},{title:"添加时间",width:"180px",dataIndex:"create_time",sorter:!0},{title:"操作",dataIndex:"action",width:"150px",scopedSlots:{customRender:"action"}}],c={name:"Index",components:{ContentHeader:l["a"],STable:l["e"]},data:function(){var e=this;return{searchForm:this.$form.createForm(this),categoryListTree:[],queryParam:{listType:"all",channel:"",is_self:"",is_pool:"",data_type:"",categoryId:""},isLoading:!1,columns:u,selectedRowKeys:[],loadData:function(t){var a=Object(o["a"])(Object(o["a"])({},t),e.queryParam),r={ascend:"asc",descend:"desc"};return a.sortField&&a.sortOrder&&r[a.sortOrder]?(a.sort=a.sortField,a.order=r[a.sortOrder],delete a.sortField,delete a.sortOrder):(delete a.sortField,delete a.sortOrder),s["f"](a).then((function(e){return e.data.list}))},checkList:[],visible:!1,saleVisible:!1,goodsType:[{name:"自营",val:1},{name:"POP",val:2}],goodsStatus:[{name:"待处理",val:0},{name:"已入池",val:1},{name:"未入池",val:2}],dataType:[{name:"API数据",val:0},{name:"人工数据",val:1},{name:"商品池",val:2}],saleStatus:[{name:"停售",val:0},{name:"在售",val:1}],is_sale:0,categoryIds:[]}},created:function(){this.getDataList(),this.$route.query.listType&&(this.queryParam.listType=this.$route.query.listType),this.getCategoryList()},computed:{rowSelection:function(){return{selectedRowKeys:this.selectedRowKeys,onChange:this.onSelectChange}}},methods:{onSelectChange:function(e){this.selectedRowKeys=e},handleTabs:function(e){this.queryParam.listType=e.target.value,this.handleRefresh(!0)},handleSearch:function(e){var t=this;e.preventDefault(),this.searchForm.validateFields((function(e,a){e||(t.queryParam=Object(o["a"])(Object(o["a"])({},t.queryParam),a),t.handleRefresh(!0))}))},handleReset:function(){this.searchForm.resetFields()},getDataList:function(){var e=this;return d["c"]().then((function(t){var a=t.data;Object.keys(a).forEach((function(t){e.checkList.push({id:t,name:a[t]})}))}))},getChannel:function(e){this.queryParam.channel=e},getDataType:function(e){this.queryParam.data_type=e},getGoodsType:function(e){this.queryParam.is_self=e},getGoodsStarus:function(e){this.queryParam.is_pool=e},getSale:function(e){this.is_sale=e},onSearchCategory:function(e){var t=[];e.forEach((function(e){t.push(e.value)})),this.queryParam.categoryId=t.join(",")},getCategoryList:function(){var e=this;this.isLoading=!0,n["a"].getListFromScreen().then((function(t){e.categoryListTree=t})).finally((function(){return e.isLoading=!1}))},handleUpdateStatus:function(e,t){var a=this;this.isLoading=!0,s["h"]({goodsIds:e,is_pool:t}).then((function(e){a.$message.success(e.message,1.5),a.handleRefresh()})).finally((function(e){a.isLoading=!1}))},onChangeCategory:function(e){var t=this;this.categoryIds=[],e.forEach((function(e){t.categoryIds.push(e.value)}))},handleUpdateClassify:function(e,t){var a=this;0!=t.length?(this.isLoading=!0,s["b"]({goodsIds:e,categoryIds:t}).then((function(e){a.visible=!1,a.$message.success(e.message,1.5),a.handleRefresh()})).finally((function(e){a.isLoading=!1}))):this.$message.warn("请至少选择1个商品分类",1.5)},handleUpdateSales:function(e,t){var a=this;this.isLoading=!0,s["g"]({goodsIds:e,is_sale:t}).then((function(e){a.saleVisible=!1,a.$message.success(e.message,1.5),a.handleRefresh()})).finally((function(e){a.isLoading=!1}))},handleDelete:function(e){var t=this,a=this.$confirm({title:"您确定要删除该记录吗?",content:"删除后不可恢复",onOk:function(){return s["c"]({goodsIds:e}).then((function(e){t.$message.success(e.message,1.5),t.handleRefresh()})).finally((function(e){return a.destroy()}))}})},handleCreate:function(){this.$router.push("/goods/create")},handleImport:function(){this.$router.push("/goods/import/batch")},handleRefresh:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];this.selectedRowKeys=[],this.$refs.table.refresh(e)}}},p=c,m=(a("3bcc"),a("2877")),v=Object(m["a"])(p,r,i,!1,null,"5c884fe4",null);t["default"]=v.exports},f4a8:function(e,t,a){}}]); |