1 line
14 KiB
JavaScript
1 line
14 KiB
JavaScript
(window.webpackJsonp=window.webpackJsonp||[]).push([["chunk-def826fe"],{"33b6":function(t,e,r){},"6fd3":function(t,e,r){r("498a"),r("14d9"),r("13d5"),r("a434"),r("e9f5"),r("9485"),r("d3b7");var n=r("c4c8"),a={name:"addAttr",data:function(){return{spinShow:!1,modal_loading:!1,grid:{xl:3,lg:3,md:12,sm:24,xs:24},modal:!1,index:1,rules:{rule_name:[{required:!0,message:"请输入规格名称",trigger:"blur"}]},formDynamic:{rule_name:"",spec:[]},attrsName:"",attrsVal:"",formDynamicNameData:[],isBtn:!1,formDynamicName:[],results:[],result:[],ids:0}},computed:{},methods:{onCancel:function(){this.ids=0,this.clear()},onClose:function(){this.ids=0,this.clear(),this.modal=!1},addBtn:function(){this.isBtn=!0},getIofo:function(t){var e=this;this.spinShow=!0,this.ids=t.id,Object(n.A)(t.id).then((function(t){e.formDynamic=t.data.info,e.spinShow=!1})).catch((function(t){e.spinShow=!1,e.$message.error(t.msg)}))},handleSubmit:function(t){var e=this;this.$refs[t].validate((function(t){return!!t&&(0===e.formDynamic.spec.length?e.$message.warning("请至少添加一条商品规格!"):(e.modal_loading=!0,void setTimeout((function(){Object(n.z)(e.formDynamic,e.ids).then((function(t){e.$message.success(t.msg),setTimeout((function(){e.modal=!1,e.modal_loading=!1}),500),setTimeout((function(){e.$emit("getList"),e.clear()}),600)})).catch((function(t){e.modal_loading=!1,e.$message.error(t.msg)}))}),1200)))}))},clear:function(){this.$refs.formDynamic.resetFields(),this.formDynamic.spec=[],this.isBtn=!1,this.attrsName="",this.attrsVal="",this.ids=0},offAttrName:function(){this.isBtn=!1},handleRemove:function(t){this.formDynamic.spec.splice(t,1)},handleRemove2:function(t,e){t.splice(e,1)},createAttrName:function(){var t,e;this.attrsName&&this.attrsVal?(t={value:this.attrsName,detail:[this.attrsVal]},this.formDynamic.spec.push(t),e={},this.formDynamic.spec=this.formDynamic.spec.reduce((function(t,r){return e[r.value]||(e[r.value]=t.push(r)),t}),[]),this.attrsName="",this.attrsVal="",this.isBtn=!1):this.$message.warning("请添加规格名称或规格值")},createAttr:function(t,e){var r;t?(this.formDynamic.spec[e].detail.push(t),r={},this.formDynamic.spec[e].detail=this.formDynamic.spec[e].detail.reduce((function(t,e){return r[e]||(r[e]=t.push(e)),t}),[])):this.$message.warning("请添加属性")}}};r("71d8"),r=r("2877"),r=Object(r.a)(a,(function(){var t=this,e=t._self._c;return e("el-dialog",{directives:[{name:"loading",rawName:"v-loading",value:t.spinShow,expression:"spinShow"}],attrs:{visible:t.modal,title:"商品规格",width:"1000px"},on:{"update:visible":function(e){t.modal=e},closed:t.onCancel}},[e("el-form",{ref:"formDynamic",staticClass:"attrFrom",attrs:{model:t.formDynamic,rules:t.rules,"label-width":"110px","label-position":"right"},nativeOn:{submit:function(t){t.preventDefault()}}},[e("el-row",{attrs:{gutter:24}},[e("el-col",{attrs:{span:24}},[e("el-col",{attrs:{span:8}},[e("el-form-item",{attrs:{label:"规格模板名称:",prop:"rule_name"}},[e("el-input",{attrs:{placeholder:"请输入标题名称",maxlength:20},model:{value:t.formDynamic.rule_name,callback:function(e){t.$set(t.formDynamic,"rule_name","string"==typeof e?e.trim():e)},expression:"formDynamic.rule_name"}})],1)],1)],1),t._l(t.formDynamic.spec,(function(r,n){return e("el-col",{key:n,staticClass:"noForm",attrs:{span:23}},[e("el-form-item",[e("div",{staticClass:"acea-row row-middle"},[e("span",{staticClass:"mr5"},[t._v(t._s(r.value))]),e("i",{staticClass:"el-icon-close",staticStyle:{"font-size":"14px"},on:{click:function(e){return t.handleRemove(n)}}})]),e("div",{staticClass:"rulesBox"},[t._l(r.detail,(function(n,a){return e("el-tag",{key:a,staticClass:"mr14 mb10",attrs:{closable:"",color:"primary"},on:{close:function(e){return t.handleRemove2(r.detail,a)}}},[t._v(t._s(n))])})),e("el-input",{staticClass:"mb10 form_content_width",attrs:{placeholder:"请输入属性名称"},nativeOn:{keyup:function(e){return!e.type.indexOf("key")&&t._k(e.keyCode,"enter",13,e.key,"Enter")?null:t.createAttr(r.detail.attrsVal,n)}},model:{value:r.detail.attrsVal,callback:function(e){t.$set(r.detail,"attrsVal","string"==typeof e?e.trim():e)},expression:"item.detail.attrsVal"}},[e("template",{slot:"append"},[e("el-button",{attrs:{type:"primary"},on:{click:function(e){return t.createAttr(r.detail.attrsVal,n)}}},[t._v("确定")])],1)],2)],2)])],1)})),t.isBtn?e("el-col",{staticClass:"mt10",attrs:{span:24}},[e("el-col",{staticClass:"mr15",attrs:{span:8}},[e("el-form-item",{attrs:{label:"规格名称:"}},[e("el-input",{attrs:{placeholder:"请输入规格"},model:{value:t.attrsName,callback:function(e){t.attrsName=e},expression:"attrsName"}})],1)],1),e("el-col",{staticClass:"mr20",attrs:{span:8}},[e("el-form-item",{attrs:{label:"规格值:"}},[e("el-input",{attrs:{placeholder:"请输入规格值"},model:{value:t.attrsVal,callback:function(e){t.attrsVal=e},expression:"attrsVal"}})],1)],1),e("el-col",{attrs:{span:2}},[e("el-button",{attrs:{type:"primary"},on:{click:t.createAttrName}},[t._v("确定")])],1),e("el-col",{attrs:{span:2}},[e("el-button",{on:{click:t.offAttrName}},[t._v("取消")])],1)],1):t._e()],2),t.isBtn?t._e():e("el-button",{staticClass:"add",attrs:{type:"primary"},on:{click:t.addBtn}},[t._v("添加新规格")])],1),e("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[e("el-button",{on:{click:t.onClose}},[t._v("取消")]),e("el-button",{attrs:{type:"primary",loading:t.modal_loading},on:{click:function(e){return t.handleSubmit("formDynamic")}}},[t._v("确定")])],1)],1)}),[],!1,null,"0fec9316",null);e.a=r.exports},"71d8":function(t,e,r){r("33b6")},"7f08":function(t,e,r){r.r(e);var n=r("2909"),a=r("5530"),o=(r("caad"),r("a15b"),r("14d9"),r("e9f5"),r("7d54"),r("d3b7"),r("6062"),r("1e70"),r("79a4"),r("c1a1"),r("8b00"),r("a4e7"),r("1e5a"),r("72c3"),r("3ca3"),r("159b"),r("ddb0"),r("2f62")),c=r("6fd3"),i=r("c4c8");c={name:"productAttr",components:{addAttr:c.a},data:function(){return{loading:!1,artFrom:{page:1,limit:20,rule_name:""},tableList:[],total:0,selectedIds:new Set,ids:[],multipleSelection:[]}},computed:Object(a.a)({},Object(o.c)("admin/order",["orderChartType"])),created:function(){this.getDataList()},methods:{getRowKey:function(t){return t.id},handleSelectAll:function(t){var e=this;0===t.length?this.$refs.table.data.forEach((function(t){e.selectedIds.has(t.id)&&e.selectedIds.delete(t.id)})):t.forEach((function(t){e.selectedIds.add(t.id)})),this.$nextTick((function(){e.setChecked()}))},handleSelectRow:function(t){for(var e=this,r=[],n=[],a=0;a<t.length;a++){var o=t[a];n.includes(o.id)||(r.push(o),n.push(o.id))}this.selectedIds=n,this.multipleSelection=r,this.$nextTick((function(t){e.setChecked()}))},setChecked:function(){this.ids=Object(n.a)(this.selectedIds).join(",")},del:function(t,e){var r=this,n={};if("批量删除规格"===e){if(0===this.selectedIds.size)return this.$message.warning("请选择要删除的规格!");n={ids:this.ids}}else n={ids:t.id};this.$modalSure({title:e,num:0,url:"product/product/rule/delete",method:"DELETE",ids:n}).then((function(t){r.$message.success(t.msg),r.getDataList()})).catch((function(t){r.$message.error(t.msg)}))},addAttr:function(){this.$refs.addattr.modal=!0},edit:function(t){this.$refs.addattr.modal=!0,this.$refs.addattr.getIofo(t)},getDataList:function(){var t=this;this.loading=!0,Object(i.B)(this.artFrom).then((function(e){var r=e.data;t.tableList=r.list,t.$nextTick((function(){t.setChecked()})),t.total=e.data.count,t.loading=!1})).catch((function(e){t.loading=!1,t.$message.error(e.msg)}))},userSearchs:function(){this.artFrom.page=1,this.getDataList()}}},a=r("2877"),o=Object(a.a)(c,(function(){var t=this,e=t._self._c;return e("div",[e("el-card",{staticClass:"ivu-mt",attrs:{bordered:!1,shadow:"never","body-style":{padding:0}}},[e("div",{staticClass:"padding-add"},[e("el-form",{ref:"artFrom",staticClass:"tabform",attrs:{model:t.artFrom,"label-width":"80px","label-position":"right",inline:""},nativeOn:{submit:function(t){t.preventDefault()}}},[e("el-form-item",{attrs:{label:"规格搜索:"}},[e("el-input",{staticClass:"form_content_width",attrs:{clearable:"",placeholder:"请输入规格名称"},model:{value:t.artFrom.rule_name,callback:function(e){t.$set(t.artFrom,"rule_name",e)},expression:"artFrom.rule_name"}})],1),e("el-form-item",[e("el-button",{attrs:{type:"primary"},on:{click:t.userSearchs}},[t._v("查询")])],1)],1)],1)]),e("el-card",{staticClass:"ivu-mt mt16",attrs:{bordered:!1,shadow:"never"}},[e("el-button",{directives:[{name:"auth",rawName:"v-auth",value:["product-rule-save"],expression:"['product-rule-save']"}],attrs:{type:"primary"},on:{click:t.addAttr}},[t._v("添加商品规格")]),e("el-button",{directives:[{name:"auth",rawName:"v-auth",value:["product-product-rule-delete"],expression:"['product-product-rule-delete']"}],on:{click:function(e){return t.del(null,"批量删除规格")}}},[t._v("批量删除")]),e("el-table",{directives:[{name:"loading",rawName:"v-loading",value:t.loading,expression:"loading"}],ref:"table",staticClass:"mt14",attrs:{data:t.tableList,"highlight-current-row":"","row-key":t.getRowKey,"empty-text":"暂无数据"},on:{"selection-change":t.handleSelectRow}},[e("el-table-column",{attrs:{type:"selection",width:"60","reserve-selection":!0}}),e("el-table-column",{attrs:{label:"ID",width:"80"},scopedSlots:t._u([{key:"default",fn:function(r){return[e("span",[t._v(t._s(r.row.id))])]}}])}),e("el-table-column",{attrs:{label:"规格名称","min-width":"130"},scopedSlots:t._u([{key:"default",fn:function(r){return[e("span",[t._v(t._s(r.row.rule_name))])]}}])}),e("el-table-column",{attrs:{label:"商品规格","min-width":"130"},scopedSlots:t._u([{key:"default",fn:function(r){return[e("span",[t._v(t._s(r.row.attr_name))])]}}])}),e("el-table-column",{attrs:{label:"商品属性","min-width":"130"},scopedSlots:t._u([{key:"default",fn:function(r){return t._l(r.row.attr_value,(function(r,n){return e("span",{key:n,staticStyle:{display:"block"},domProps:{textContent:t._s(r)}})}))}}])}),e("el-table-column",{attrs:{label:"操作",fixed:"right",width:"120"},scopedSlots:t._u([{key:"default",fn:function(r){return[e("a",{on:{click:function(e){return t.edit(r.row)}}},[t._v("编辑")]),e("el-divider",{attrs:{direction:"vertical"}}),e("a",{on:{click:function(e){return t.del(r.row,"删除规格",r.$index)}}},[t._v("删除")])]}}])})],1),e("div",{staticClass:"acea-row row-right page"},[t.total?e("pagination",{attrs:{total:t.total,page:t.artFrom.page,limit:t.artFrom.limit},on:{"update:page":function(e){return t.$set(t.artFrom,"page",e)},"update:limit":function(e){return t.$set(t.artFrom,"limit",e)},pagination:t.getDataList}}):t._e()],1)],1),e("add-attr",{ref:"addattr",on:{getList:t.userSearchs}})],1)}),[],!1,null,"403d239e",null);e.default=o.exports},c4c8:function(t,e,r){r.d(e,"j",(function(){return a})),r.d(e,"k",(function(){return o})),r.d(e,"n",(function(){return c})),r.d(e,"c",(function(){return i})),r.d(e,"a",(function(){return u})),r.d(e,"v",(function(){return s})),r.d(e,"C",(function(){return l})),r.d(e,"w",(function(){return d})),r.d(e,"F",(function(){return m})),r.d(e,"d",(function(){return f})),r.d(e,"t",(function(){return p})),r.d(e,"m",(function(){return h})),r.d(e,"u",(function(){return g})),r.d(e,"o",(function(){return b})),r.d(e,"p",(function(){return v})),r.d(e,"E",(function(){return _})),r.d(e,"y",(function(){return y})),r.d(e,"D",(function(){return w})),r.d(e,"f",(function(){return O})),r.d(e,"g",(function(){return k})),r.d(e,"h",(function(){return j})),r.d(e,"i",(function(){return D})),r.d(e,"B",(function(){return C})),r.d(e,"z",(function(){return S})),r.d(e,"A",(function(){return x})),r.d(e,"q",(function(){return $})),r.d(e,"s",(function(){return N})),r.d(e,"r",(function(){return T})),r.d(e,"e",(function(){return F})),r.d(e,"x",(function(){return A})),r.d(e,"G",(function(){return V})),r.d(e,"l",(function(){return B})),r.d(e,"b",(function(){return L})),r("99af");var n=r("6b6c");function a(t){return Object(n.a)({url:"product/product/type_header",method:"get",params:t})}function o(t){return Object(n.a)({url:"product/product",method:"get",params:t})}function c(){return Object(n.a)({url:"product/cache",method:"get"})}function i(){return Object(n.a)({url:"product/cache",method:"delete"})}function u(t,e){return Object(n.a)({url:"product/product/set_show/".concat(t,"/").concat(e),method:"put"})}function s(t){return Object(n.a)({url:"product/product/product_show",method:"put",data:t})}function l(t){return Object(n.a)({url:"product/reply/save_fictitious_reply",method:"post",data:t})}function d(t){return Object(n.a)({url:"product/product/product_unshow",method:"put",data:t})}function m(t){return Object(n.a)({url:"product/category/tree/".concat(t),method:"get"})}function f(t){return Object(n.a)({url:"product/category/cascader/".concat(t),method:"get"})}function p(t){return Object(n.a)({url:"product/product/".concat(t),method:"get"})}function h(t){return Object(n.a)({url:"product/product/".concat(t.id),method:"POST",data:t})}function g(t){return Object(n.a)({url:"product/category",method:"get",params:t})}function b(){return Object(n.a)({url:"product/category/create",method:"get"})}function v(t){return Object(n.a)({url:"product/category/".concat(t),method:"get"})}function _(t){return Object(n.a)({url:"product/category/set_show/".concat(t.id,"/").concat(t.is_show),method:"PUT"})}function y(t){return Object(n.a)({url:"product/reply",method:"get",params:t})}function w(t,e){return Object(n.a)({url:"product/reply/set_reply/".concat(e),method:"PUT",data:t})}function O(){return Object(n.a)({url:"product/copy_config",method:"get"})}function k(t){return Object(n.a)({url:"product/copy",method:"POST",data:t})}function j(t){return Object(n.a)({url:"product/crawl/save",method:"POST",data:t})}function D(t,e,r){return Object(n.a)({url:"product/generate_attr/".concat(e,"/").concat(r),method:"POST",data:t})}function C(t){return Object(n.a)({url:"product/product/rule",method:"GET",params:t})}function S(t,e){return Object(n.a)({url:"product/product/rule/".concat(e),method:"POST",data:t})}function x(t){return Object(n.a)({url:"product/product/rule/".concat(t),method:"get"})}function $(){return Object(n.a)({url:"product/product/get_rule",method:"get"})}function N(){return Object(n.a)({url:"product/product/get_template",method:"get"})}function T(t){return Object(n.a)({url:"product/product/get_temp_keys",method:"get",params:t})}function F(t){return Object(n.a)({url:"product/product/check_activity/".concat(t),method:"get"})}function A(){return Object(n.a)({url:"user/user_tree_label",method:"get"})}function V(){return Object(n.a)({url:"file/upload_type",method:"get"})}function B(t){return Object(n.a)({url:"product/product/import_card",method:"get",params:t})}function L(t){return Object(n.a)({url:"product/batch/setting",method:"POST",data:t})}}}]); |