You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
1 line
11 KiB
1 line
11 KiB
3 months ago
|
(window.webpackJsonp=window.webpackJsonp||[]).push([["chunk-d82352e0"],{"1e0c":function(t,e,a){"use strict";a.r(e);var i=a("2f62"),r=a("b0e7"),o=a("b7be"),s=a("c4ad"),n=a("d708");function l(t){return(l="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function c(t,e){var a=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter((function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable}))),a.push.apply(a,i)}return a}function d(t){for(var e=1;e<arguments.length;e++){var a=null!=arguments[e]?arguments[e]:{};e%2?c(Object(a),!0).forEach((function(e){u(t,e,a[e])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(a)):c(Object(a)).forEach((function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(a,e))}))}return t}function u(t,e,a){return(e=function(t){var e=function(t,e){if("object"!=l(t)||!t)return t;var a=t[Symbol.toPrimitive];if(void 0!==a){var i=a.call(t,e||"default");if("object"!=l(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===e?String:Number)(t)}(t,"string");return"symbol"==l(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:a,enumerable:!0,configurable:!0,writable:!0}):t[e]=a,t}var m={name:"create",components:{uploadPictures:r.a,goodsList:s.default},data:function(){return{roterPre:n.a.roterPre,currentTab:"1",modals:!1,gridBtn:{xl:4,lg:8,md:8,sm:8,xs:8},gridPic:{xl:6,lg:8,md:12,sm:12,xs:12},headeNum:[{type:"1",name:"基础设置"},{type:"2",name:"关联商品"}],formValidate:{desc:"",image:"",sort:0,video_url:"",product_id:[]},modalPic:!1,isChoice:"单选",ruleValidate:{desc:[{required:!0,message:"请输入视频简介",trigger:"blur"}],video_url:[{required:!0,message:"请上传视频",validator:function(t,e,a){if(!e)return a(new Error("请上传视频"));a()},trigger:"change"}],image:[{required:!0,validator:function(t,e,a){if(!e)return a(new Error("请上传视频封面图"));a()},trigger:"change"}]},columns:[{type:"selection",width:60,align:"center"},{title:"商品信息",slot:"info",minWidth:180},{title:"商品分类",key:"cate_name",minWidth:180},{title:"售价",key:"price",minWidth:180},{title:"库存",key:"stock",minWidth:180},{title:"操作",slot:"action",fixed:"right",width:100}],tableData:[],id:0,formSelection:[],typeTit:""}},computed:d(d({},Object(i.e)("admin/layout",["isMobile","menuCollapse"])),{},{labelWidth:function(){return this.isMobile?void 0:90},labelPosition:function(){return this.isMobile?"top":"right"}}),created:function(){this.id=this.$route.params.id||0,this.id&&this.getInfo()},methods:{delVideo:function(){this.$set(this.formValidate,"video_url",""),this.$refs.formValidate.validateField("video_url")},del:function(t){var e=this;this.tableData.forEach((function(a,i){if(t.id===a.id)return e.tableData.splice(i,1)}))},batchDel:function(){for(var t=0;t<this.formSelection.length;t++)for(var e=0;e<this.tableData.length;e++)this.tableData[e].id===this.formSelection[t].id&&(this.tableData.splice(e,1),e--)},selectChange:function(t){this.formSelection=t},addGoods:function(){this.modals=!0},cancel:function(){this.modals=!1},unique:function(t){var e=new Map;return t.filter((function(t){return!e.has(t.id)&&e.set(t.id,1)}))},getProductId:function(t){this.modals=!1;var e=this.tableData.concat(t);this.tableData=this.unique(e)},getInfo:function(){var t=this;Object(o.Qb)(this.id).then((function(e){t.formValidate=e.data,t.tableData=e.data.productInfo})).catch((function(e){t.$Message.error(e.msg)}))},upTab:function(){this.currentTab="1"},downTab:function(t){var e=this;this.$refs[t].validate((function(t){t?e.currentTab="2":e.$Message.warning("请完善数据")}))},handleSubmit:function(t){var e=this;this.$refs[t].validate((function(t){if(t){var a=[];e.tableData.forEach((function(t){a.push(t.id)})),e.formValidate.product_id=a,Object(o.Tb)(e.formValidate,e.id).then((function(t){e.$router.push({path:"".concat
|