mirror of
https://gitee.com/hzchunfen/erp.git
synced 2025-11-30 22:20:45 +00:00
2 lines
9.2 KiB
JavaScript
Vendored
2 lines
9.2 KiB
JavaScript
Vendored
"use strict";(self["webpackChunkerp"]=self["webpackChunkerp"]||[]).push([[691],{5691:function(t,e,o){o.r(e),o.d(e,{default:function(){return h}});var a=function(){var t=this,e=t._self._c;return e("div",[e("el-card",{staticClass:"box-card"},[e("el-form",{ref:"form",attrs:{inline:!0,model:t.goodsData,"label-position":"right","label-width":"120px"}},[e("div",[e("el-form-item",{attrs:{label:"商品品种/品类:"}},[e("treeselect",{staticStyle:{width:"200px"},attrs:{options:t.treeList,"disable-branch-nodes":!0,"show-count":!0,normalizer:t.normalizer,placeholder:"请选择品种"},scopedSlots:t._u([{key:"value-label",fn:function({node:o}){return e("div",{},[t._v(t._s(t.parseLabel(o)))])}}]),model:{value:t.goodsData.goods.type_id,callback:function(e){t.$set(t.goodsData.goods,"type_id",e)},expression:"goodsData.goods.type_id"}})],1)],1),e("div",[e("el-form-item",{attrs:{label:"规格名称:"}},[e("el-input",{attrs:{placeholder:"规格名称"},model:{value:t.goodsData.title,callback:function(e){t.$set(t.goodsData,"title",e)},expression:"goodsData.title"}})],1),e("el-form-item",{attrs:{label:"最终编码:"}},[e("el-input",{attrs:{placeholder:"规格编码",disabled:""},model:{value:t.goodsData.external_sku_id,callback:function(e){t.$set(t.goodsData,"external_sku_id",e)},expression:"goodsData.external_sku_id"}})],1),e("el-form-item",{attrs:{label:"颜色/特性:"}},[e("el-input",{attrs:{placeholder:"颜色/特性"},model:{value:t.goodsData.attribute,callback:function(e){t.$set(t.goodsData,"attribute",e)},expression:"goodsData.attribute"}})],1),e("el-form-item",{attrs:{label:"商品状态:"}},[e("el-select",{model:{value:t.goodsData.status,callback:function(e){t.$set(t.goodsData,"status",e)},expression:"goodsData.status"}},t._l(t.options,(function(t){return e("el-option",{key:t.id,attrs:{label:t.label,value:t.id}})})),1)],1),e("div",[e("el-form-item",{attrs:{label:"商品成本:"}},[e("el-input",{attrs:{placeholder:"商品成本"},model:{value:t.goodsData.cost,callback:function(e){t.$set(t.goodsData,"cost",e)},expression:"goodsData.cost"}})],1),e("el-form-item",{attrs:{label:"在售库存:"}},[e("el-input",{attrs:{placeholder:"在售库存"},model:{value:t.goodsData.sale_stock,callback:function(e){t.$set(t.goodsData,"sale_stock",e)},expression:"goodsData.sale_stock"}})],1)],1)],1),e("div",{staticClass:"btn"},[e("el-form-item",{attrs:{label:" "}},[e("el-button",{attrs:{type:"primary"},on:{click:function(e){return t.Edititem()}}},[t._v("保存")]),e("el-button",{attrs:{plain:""},on:{click:function(e){return t.cancel()}}},[t._v("取消")])],1)],1)])],1)],1)},s=[],r=(o(560),o(8858),o(1318),o(3228),o(9036)),n=o(2346),i=o(4301),u=o.n(i),l={components:{Treeselect:u()},data(){return{brand:[],treeList:[],goodschoose:[],skuId:0,goodsData:{goods_id:"",title:"",status:"",num:"",cost:"",sale_stock:"",external_sku_id:"",thumb_url:[],attribute:"",goods:{img_url:"",title:"",type_id:null,brand_id:"",goods_code:""}},options:[{id:"0",label:"下架"},{id:"1",label:"在售"},{id:"2",label:"预警"}],file:[],shopList:[]}},methods:{getGoods_types(){let t={parent_id:0};(0,n.Ci)(t).then((t=>{this.treeList=JSON.parse(JSON.stringify(t.data.data).replace(/name/g,"label"))}))},getGoodsBrand(){(0,n.ar)({per_page:999}).then((t=>{this.brandList=t.data.data}))},handleAvatarSuccess(t,e){let o=new FormData;e.forEach((t=>{o.append("uploadFile",t.raw)}));let a={headers:{"Content-Type":"multipart/form-data"}};(0,r.cM)(o,a).then((t=>{this.goodsData.goods.img_url=t.data.resource}))},handleShopImgSuccess(t){this.goodsData.thumb_url.forEach(((e,o)=>{e.shop_id==t.shop_id&&(this.goodsData.thumb_url[o].img_url=t.resource)}))},beforeAvatarUpload(t){const e=t.size/1024/1024<1;if(!e)return this.$message.error("上传头像图片大小不能超过 1MB!"),!1;const o=new Promise((function(e,o){let a=1200,s=1200,r=window.URL||window.webkitURL,n=new Image;n.onload=function(){let t=n.width<=a&&n.height<=s;t?e():o()},n.src=r.createObjectURL(t)})).then((()=>t),(()=>(this.$message.error("图片尺寸限制为1200 x 1200,大小不可超过1MB"),Promise.reject())));return o},handleList(){(0,r.t5)().then((t=>{this.goodschoose=t.data.data}))},getGoodsSkuData(){(0,r.rQ)(this.skuId).then((t=>{this.goodsData=t.data.data,this.goodsData.goods.type_id=this.goodsData.goods.type_id||null}))},Edititem(){let t={title:this.goodsData.goods.title,img_url:this.goodsData.goods.img_url,type_id:this.goodsData.goods.type_id||"",brand_id:this.goodsData.goods.brand_id,goods_code:this.goodsData.goods.goods_code},e={title:this.goodsData.title,external_sku_id:this.goodsData.external_sku_id,status:this.goodsData.status,num:this.goodsData.num,cost:this.goodsData.cost,sale_stock:this.goodsData.sale_stock,thumb_url:this.goodsData.thumb_url,attribute:this.goodsData.attribute};"下架"==e.status?e.status=0:"在售"==e.status?e.status=1:"预警"==e.status&&(e.status=2);let o={goods_id:this.goodsData.goods_id,goods:t,sku:e};(0,r.e3)(this.skuId,o).then((t=>{this.$message({type:"success",message:"编辑成功"}),this.$router.push("/GOODS_LIST")}))},cancel(){this.$router.push("/GOODS_LIST")},normalizer(t){return(!t.children||t.children&&0==t.children.length)&&1==t.level&&(t.isDisabled=!0),t},parseLabel(t){console.log(t);let e="";return e+=t.parentNode?t.parentNode.label+" / ":"",e+=t.raw?t.raw.label:"",e}},created(){this.skuId=parseInt(this.$route.query.id)},mounted(){this.getGoods_types(),this.getGoodsBrand(),this.handleList(),this.getGoodsSkuData()}},d=l,c=o(1001),g=(0,c.Z)(d,a,s,!1,null,"253f0fda",null),h=g.exports},9036:function(t,e,o){o.d(e,{CD:function(){return _},JS:function(){return v},K1:function(){return d},NR:function(){return p},Rq:function(){return r},Vx:function(){return l},b9:function(){return k},cM:function(){return c},e3:function(){return u},gM:function(){return b},lO:function(){return s},no:function(){return m},od:function(){return g},rQ:function(){return n},sx:function(){return f},t5:function(){return i},zl:function(){return h}});var a=o(8430);function s(t){return(0,a.Z)({url:"/api/goods_skus",method:"get",params:t})}function r(t){return(0,a.Z)({url:"/api/goods",method:"post",data:t})}function n(t){return(0,a.Z)({url:`/api/goods_skus/${t}`,method:"get"})}function i(t){return(0,a.Z)({url:"/api/goods",method:"get",params:t})}function u(t,e){return(0,a.Z)({url:`/api/goods_skus/${t}`,method:"patch",data:e})}function l(t){return(0,a.Z)({url:"/api/batch/goods_skus",method:"patch",data:t})}function d(t,e){return(0,a.Z)({url:`/api/single/goods_skus/${t}`,method:"patch",data:e})}function c(t,e){return(0,a.Z)({url:"/api/upload",Headers:e,method:"post",data:t})}function g(t){return(0,a.Z)({url:"/api/goodsList",method:"get",params:t})}function h(t){return(0,a.Z)({url:"/api/goods_sku_location",method:"get",params:t})}function p(t){return(0,a.Z)({url:"/api/goodsSkusList",method:"get",params:{title:t}})}function f(){return(0,a.Z)({url:"/api/stock/goods_skus",method:"get"})}function m(t){return(0,a.Z)({url:"/api/goods/filter/"+t,method:"get"})}function b(t){return(0,a.Z)({url:"/api/goods_combination",method:"post",data:t})}function _(t){return(0,a.Z)({url:"/api/goods_combination",method:"get",params:t})}function v(t){return(0,a.Z)({url:"/api/goods_combination/"+t,method:"get"})}function k(t){return(0,a.Z)({url:"/api/batch/goods_skus",method:"patch",data:t})}},926:function(t,e,o){var a=o(3043),s=o(9985),r=o(6648),n=o(4201),i=n("toStringTag"),u=Object,l="Arguments"===r(function(){return arguments}()),d=function(t,e){try{return t[e]}catch(o){}};t.exports=a?r:function(t){var e,o,a;return void 0===t?"Undefined":null===t?"Null":"string"==typeof(o=d(e=u(t),i))?o:l?r(e):"Object"===(a=r(e))&&s(e.callee)?"Arguments":a}},2148:function(t,e,o){var a=o(8702),s=o(2560);t.exports=function(t,e,o){return o.get&&a(o.get,e,{getter:!0}),o.set&&a(o.set,e,{setter:!0}),s.f(t,e,o)}},3043:function(t,e,o){var a=o(4201),s=a("toStringTag"),r={};r[s]="z",t.exports="[object z]"===String(r)},4327:function(t,e,o){var a=o(926),s=String;t.exports=function(t){if("Symbol"===a(t))throw new TypeError("Cannot convert a Symbol value to a string");return s(t)}},1500:function(t){var e=TypeError;t.exports=function(t,o){if(t<o)throw new e("Not enough arguments");return t}},8858:function(t,e,o){var a=o(1880),s=o(8844),r=o(4327),n=o(1500),i=URLSearchParams,u=i.prototype,l=s(u.append),d=s(u["delete"]),c=s(u.forEach),g=s([].push),h=new i("a=1&a=2&b=3");h["delete"]("a",1),h["delete"]("b",void 0),h+""!=="a=2"&&a(u,"delete",(function(t){var e=arguments.length,o=e<2?void 0:arguments[1];if(e&&void 0===o)return d(this,t);var a=[];c(this,(function(t,e){g(a,{key:e,value:t})})),n(e,1);var s,i=r(t),u=r(o),h=0,p=0,f=!1,m=a.length;while(h<m)s=a[h++],f||s.key===i?(f=!0,d(this,s.key)):p++;while(p<m)s=a[p++],s.key===i&&s.value===u||l(this,s.key,s.value)}),{enumerable:!0,unsafe:!0})},1318:function(t,e,o){var a=o(1880),s=o(8844),r=o(4327),n=o(1500),i=URLSearchParams,u=i.prototype,l=s(u.getAll),d=s(u.has),c=new i("a=1");!c.has("a",2)&&c.has("a",void 0)||a(u,"has",(function(t){var e=arguments.length,o=e<2?void 0:arguments[1];if(e&&void 0===o)return d(this,t);var a=l(this,t);n(e,1);var s=r(o),i=0;while(i<a.length)if(a[i++]===s)return!0;return!1}),{enumerable:!0,unsafe:!0})},3228:function(t,e,o){var a=o(7697),s=o(8844),r=o(2148),n=URLSearchParams.prototype,i=s(n.forEach);a&&!("size"in n)&&r(n,"size",{get:function(){var t=0;return i(this,(function(){t++})),t},configurable:!0,enumerable:!0})}}]);
|
||
//# sourceMappingURL=691.c4036076.js.map
|