2 lines
15 KiB
JavaScript
2 lines
15 KiB
JavaScript
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-0d06173f"],{1726:function(t,e,o){"use strict";o.d(e,"e",(function(){return r})),o.d(e,"l",(function(){return c})),o.d(e,"f",(function(){return n})),o.d(e,"i",(function(){return s})),o.d(e,"c",(function(){return d})),o.d(e,"g",(function(){return l})),o.d(e,"a",(function(){return u})),o.d(e,"h",(function(){return i})),o.d(e,"k",(function(){return p})),o.d(e,"d",(function(){return f})),o.d(e,"b",(function(){return h})),o.d(e,"j",(function(){return m}));var a=o("b775");function r(t){return new Promise((e,o)=>{Object(a["a"])({url:"/product.queryProduct",method:"get",params:t}).then(t=>{const o=t.data;e(o)}).catch(t=>{o(t)})})}function c(t){return new Promise((e,o)=>{Object(a["a"])({url:"/product.updateProduct",method:"post",data:t}).then(t=>{const o=t.data;e(o)}).catch(t=>{o(t)})})}function n(t){return new Promise((e,o)=>{Object(a["a"])({url:"/productCategory.queryProductCategory",method:"get",params:t}).then(t=>{const o=t.data;e(o)}).catch(t=>{o(t)})})}function s(t){return new Promise((e,o)=>{Object(a["a"])({url:"/shopHouse.queryShopHouse",method:"get",params:t}).then(t=>{const o=t.data;e(o)}).catch(t=>{o(t)})})}function d(t){return new Promise((e,o)=>{Object(a["a"])({url:"/housekeepingType.queryHousekeepingType",method:"get",params:t}).then(t=>{const o=t.data;e(o)}).catch(t=>{o(t)})})}function l(t){return new Promise((e,o)=>{Object(a["a"])({url:"/productH5Menu.listProductH5Menu",method:"get",params:t}).then(t=>{const o=t.data;e(o)}).catch(t=>{o(t)})})}function u(t){return new Promise((e,o)=>{Object(a["a"])({url:"/product.deleteProduct",method:"post",data:t}).then(t=>{const o=t.data;e(o)}).catch(t=>{o(t)})})}function i(t){return new Promise((e,o)=>{Object(a["a"])({url:"/product/queryProductSpec",method:"get",params:t}).then(t=>{const o=t.data;e(o)}).catch(t=>{o(t)})})}function p(t){return new Promise((e,o)=>{Object(a["a"])({url:"/product/saveProductLabel",method:"post",data:t}).then(t=>{const o=t.data;e(o)}).catch(t=>{o(t)})})}function f(t){return new Promise((e,o)=>{Object(a["a"])({url:"/label/queryLabel",method:"get",params:t}).then(t=>{const o=t.data;e(o)}).catch(t=>{o(t)})})}function h(t){return new Promise((e,o)=>{Object(a["a"])({url:"/export.exportData",method:"get",params:t}).then(t=>{const o=t.data;e(o)}).catch(t=>{o(t)})})}function m(t){return new Promise((e,o)=>{Object(a["a"])({url:"/product.saveProduct",method:"post",data:t}).then(t=>{const o=t.data;e(o)}).catch(t=>{o(t)})})}},2132:function(t,e,o){"use strict";o("45d6")},4123:function(t,e,o){"use strict";o.r(e);var a=function(){var t=this,e=t._self._c;return e("div",[e("el-card",{staticClass:"ibox"},[e("div",{staticClass:"flex justify-between",attrs:{slot:"header"},slot:"header"},[e("span",[t._v("商品信息")])]),e("div",{},[e("el-form",{attrs:{"label-width":"120px"}},[e("el-row",{attrs:{gutter:20}},[e("el-col",{attrs:{span:12}},[e("el-form-item",{attrs:{label:"商品名称"}},[e("el-input",{attrs:{placeholder:"必填,请填写商品名称"},model:{value:t.addProductInfo.prodName,callback:function(e){t.$set(t.addProductInfo,"prodName",e)},expression:"addProductInfo.prodName"}})],1)],1),e("el-col",{attrs:{span:12}},[e("el-form-item",{attrs:{label:"商品分组"}},[e("el-select",{staticStyle:{width:"100%"},model:{value:t.addProductInfo.categoryId,callback:function(e){t.$set(t.addProductInfo,"categoryId",e)},expression:"addProductInfo.categoryId"}},[e("el-option",{attrs:{label:"必填,请选择商品分组",value:"",disabled:""}}),t._l(t.addProductInfo.productCategorys,(function(t,o){return e("el-option",{key:o,attrs:{label:t.categoryName,value:t.categoryId}})}))],2)],1)],1)],1),e("el-row",{attrs:{gutter:20}},[e("el-col",{attrs:{span:12}},[e("el-form-item",{attrs:{label:"单位"}},[e("el-input",{attrs:{placeholder:"选填,请填写单位"},model:{value:t.addProductInfo.unitName,callback:function(e){t.$set(t.addProductInfo,"unitName",e)},expression:"addProductInfo.unitName"}})],1)],1),e("el-col",{attrs:{span:12}},[e("el-form-item",{attrs:{label:"排序"}},[e("el-input",{attrs:{placeholder:"必填,请填写排序"},model:{value:t.addProductInfo.sort,callback:function(e){t.$set(t.addProductInfo,"sort",e)},expression:"addProductInfo.sort"}})],1)],1)],1),e("el-row",{attrs:{gutter:20}},[e("el-col",{attrs:{span:12}},[e("el-form-item",{attrs:{label:"关键词"}},[e("el-input",{attrs:{placeholder:"必填,请填写关键词,多个关键词用;分隔"},model:{value:t.addProductInfo.keyword,callback:function(e){t.$set(t.addProductInfo,"keyword",e)},expression:"addProductInfo.keyword"}})],1)],1),e("el-col",{staticClass:"text-left",attrs:{span:12}},[e("el-form-item",{attrs:{label:"手机菜单"}},[e("el-checkbox-group",{model:{value:t.addProductInfo.hktIds,callback:function(e){t.$set(t.addProductInfo,"hktIds",e)},expression:"addProductInfo.hktIds"}},t._l(t.addProductInfo.housekeepingTypes,(function(o,a){return e("el-checkbox",{key:a,attrs:{label:o.hktId}},[t._v(" "+t._s(o.hktName)+" ")])})),1)],1)],1)],1),e("el-row",{attrs:{gutter:20}},[e("el-col",{attrs:{span:12}},[e("el-form-item",{attrs:{label:"仓库"}},[e("el-select",{staticStyle:{width:"100%"},on:{change:function(e){return t._changeShopHouseAdd(t.addProductInfo.shId)}},model:{value:t.addProductInfo.shId,callback:function(e){t.$set(t.addProductInfo,"shId",e)},expression:"addProductInfo.shId"}},[e("el-option",{attrs:{label:"请选择仓库",value:"",disabled:""}}),t._l(t.addProductInfo.shopHouses,(function(t,o){return e("el-option",{key:o,attrs:{label:t.shName,value:t.shId}})}))],2)],1)],1),e("el-col",{staticClass:"text-left",attrs:{span:12}},[e("el-form-item",{attrs:{label:"库存警告数量"}},[e("el-input-number",{attrs:{placeholder:"必填,请填写库存警告数量"},model:{value:t.addProductInfo.warnStock,callback:function(e){t.$set(t.addProductInfo,"warnStock",e)},expression:"addProductInfo.warnStock"}})],1)],1)],1),e("el-row",[e("el-col",{attrs:{span:24}},[e("el-form-item",{attrs:{label:"商品简介"}},[e("el-input",{attrs:{type:"textarea",rows:3,placeholder:"必填,请填写商品简介",maxlength:"250"},model:{value:t.addProductInfo.prodDesc,callback:function(e){t.$set(t.addProductInfo,"prodDesc",e)},expression:"addProductInfo.prodDesc"}})],1)],1)],1)],1)],1)]),e("el-card",{staticClass:"ibox"},[e("div",{staticClass:"flex justify-between",attrs:{slot:"header"},slot:"header"},[e("span",[t._v("商品图片")])]),e("div",{},[e("el-form",{attrs:{"label-width":"120px"}},[e("el-row",[e("el-col",{attrs:{span:24}},[e("el-form-item",{attrs:{label:"商品封面"}},[e("upload-image-url",{ref:"coverImageUpload",attrs:{"image-count":1},on:{notifyUploadCoverImage:t.handleCoverImageUpload}})],1)],1)],1),e("el-row",[e("el-col",{attrs:{span:24}},[e("el-form-item",{attrs:{label:"商品轮播"}},[e("upload-image-url",{ref:"carouselImageUpload",attrs:{"image-count":3},on:{notifyUploadCoverImage:t.handleCarouselImageUpload}})],1)],1)],1)],1)],1)]),e("el-card",{staticClass:"ibox"},[e("div",{staticClass:"flex justify-between",attrs:{slot:"header"},slot:"header"},[e("span",[t._v("商品规格")]),e("el-button",{staticStyle:{float:"right"},attrs:{type:"primary",size:"small"},on:{click:function(e){return t._openAddSpecModal()}}},[e("i",{staticClass:"el-icon-plus"}),t._v("添加 ")])],1),e("div",{},[e("el-table",{staticStyle:{width:"100%"},attrs:{data:t.addProductInfo.productSpecs,border:""}},[e("el-table-column",{attrs:{prop:"specName",label:"规格名称",align:"center"},scopedSlots:t._u([{key:"default",fn:function(o){return[e("el-input",{attrs:{placeholder:"请输入规格名称"},model:{value:o.row.specName,callback:function(e){t.$set(o.row,"specName",e)},expression:"scope.row.specName"}})]}}])}),e("el-table-column",{attrs:{prop:"stock",label:"库存",align:"center"},scopedSlots:t._u([{key:"default",fn:function(o){return[e("el-input-number",{model:{value:o.row.stock,callback:function(e){t.$set(o.row,"stock",e)},expression:"scope.row.stock"}})]}}])}),e("el-table-column",{attrs:{prop:"sales",label:"销量",align:"center"},scopedSlots:t._u([{key:"default",fn:function(o){return[e("el-input-number",{model:{value:o.row.sales,callback:function(e){t.$set(o.row,"sales",e)},expression:"scope.row.sales"}})]}}])}),e("el-table-column",{attrs:{prop:"price",label:"价格/积分",align:"center"},scopedSlots:t._u([{key:"default",fn:function(o){return[e("el-input-number",{model:{value:o.row.price,callback:function(e){t.$set(o.row,"price",e)},expression:"scope.row.price"}})]}}])}),e("el-table-column",{attrs:{prop:"costPrice",label:"成本价",align:"center"},scopedSlots:t._u([{key:"default",fn:function(o){return[e("el-input-number",{model:{value:o.row.costPrice,callback:function(e){t.$set(o.row,"costPrice",e)},expression:"scope.row.costPrice"}})]}}])}),e("el-table-column",{attrs:{prop:"ownerPrice",label:"业主价",align:"center"},scopedSlots:t._u([{key:"default",fn:function(o){return[e("el-input-number",{model:{value:o.row.ownerPrice,callback:function(e){t.$set(o.row,"ownerPrice",e)},expression:"scope.row.ownerPrice"}})]}}])}),e("el-table-column",{attrs:{prop:"vipPrice",label:"会员价格",align:"center"},scopedSlots:t._u([{key:"default",fn:function(o){return[e("el-input-number",{model:{value:o.row.vipPrice,callback:function(e){t.$set(o.row,"vipPrice",e)},expression:"scope.row.vipPrice"}})]}}])}),e("el-table-column",{attrs:{prop:"otPrice",label:"市场价",align:"center"},scopedSlots:t._u([{key:"default",fn:function(o){return[e("el-input-number",{model:{value:o.row.otPrice,callback:function(e){t.$set(o.row,"otPrice",e)},expression:"scope.row.otPrice"}})]}}])}),e("el-table-column",{attrs:{prop:"deduction",label:"抵扣金",align:"center"},scopedSlots:t._u([{key:"default",fn:function(o){return[e("el-input-number",{model:{value:o.row.deduction,callback:function(e){t.$set(o.row,"deduction",e)},expression:"scope.row.deduction"}})]}}])}),e("el-table-column",{attrs:{prop:"barCode",label:"条形码",align:"center"},scopedSlots:t._u([{key:"default",fn:function(o){return[e("el-input",{model:{value:o.row.barCode,callback:function(e){t.$set(o.row,"barCode",e)},expression:"scope.row.barCode"}})]}}])}),e("el-table-column",{attrs:{label:"操作",align:"center",width:"180"},scopedSlots:t._u([{key:"default",fn:function(o){return[e("el-button",{attrs:{type:"danger",size:"mini"},on:{click:function(e){return t._openAddDeleteProductSpec(o.row)}}},[t._v(" 删除 ")]),"T"!=o.row.isDefault?e("el-button",{attrs:{type:"primary",size:"mini"},on:{click:function(e){return t._doAddDefaultProductSpec(t.addProductInfo,o.row)}}},[t._v(" 默认规格 ")]):t._e()]}}])})],1),e("div",{staticStyle:{"margin-top":"15px"}},[e("span",[t._v("抵扣金:商品购买时抵扣金会自动送客户用来 缴相应的物业费停车费")])])],1)]),e("el-card",{staticClass:"ibox"},[e("div",{staticClass:"flex justify-between",attrs:{slot:"header"},slot:"header"},[e("span",[t._v("商品扩展")])]),e("div",{},[e("el-form",{attrs:{"label-width":"120px"}},[e("el-row",[e("el-col",{attrs:{span:24}},[e("el-form-item",{attrs:{label:"商品状态"}},[e("el-select",{staticStyle:{width:"100%"},model:{value:t.addProductInfo.state,callback:function(e){t.$set(t.addProductInfo,"state",e)},expression:"addProductInfo.state"}},[e("el-option",{attrs:{label:"选填,请选择状态",value:"",disabled:""}}),e("el-option",{attrs:{label:"未上架",value:"1001"}}),e("el-option",{attrs:{label:"上架",value:"2002"}})],1)],1)],1)],1),e("el-row",[e("el-col",{attrs:{span:24}},[e("el-form-item",{attrs:{label:"商品详情"}},[e("RichTextEditor",{on:{input:t.handleContentChange},model:{value:t.addProductInfo.content,callback:function(e){t.$set(t.addProductInfo,"content",e)},expression:"addProductInfo.content"}})],1)],1)],1)],1),e("div",{staticStyle:{"margin-top":"20px","text-align":"right"}},[e("el-button",{attrs:{type:"warning"},on:{click:function(e){return t._closeAddProduct()}}},[t._v(" 取消 ")]),e("el-button",{attrs:{type:"primary"},on:{click:function(e){return t.saveProductInfo()}}},[e("i",{staticClass:"el-icon-check"}),t._v("保存 ")])],1)],1)])],1)},r=[],c=o("5e31"),n=o("e01b"),s=o("7323"),d=o("1726"),l={name:"AddProduct",components:{UploadImageUrl:c["a"],RichTextEditor:n["a"]},data(){return{addProductInfo:{shId:"",shName:"",warnStock:"",productId:"",categoryId:"",prodName:"",prodDesc:"",keyword:"",barCode:"1",unitName:"",sort:"",isPostage:"2",postage:"0.00",productCategorys:[],content:"",states:[],state:"",coverPhoto:"",carouselFigurePhoto:[],productSpecs:[],areaCode:"",distributionModes:[],hktIds:[],housekeepingTypes:[],shopHouses:[]},shopId:""}},created(){this.shopId=Object(s["f"])(),this.initData()},methods:{async initData(){try{const{data:t}=await Object(s["e"])("product","state");this.addProductInfo.states=t,this._initAddProduct(),this._listShopHouses(),this._listAddHousekeepingTypes(),this._listAddProductCategorys()}catch(t){console.error("初始化数据失败:",t)}},handleCoverImageUpload(t){t.length>0?this.addProductInfo.coverPhoto=t[0]:this.addProductInfo.coverPhoto=""},handleCarouselImageUpload(t){this.addProductInfo.carouselFigurePhoto=[],t.forEach(t=>{this.addProductInfo.carouselFigurePhoto.push(t)})},addProductValidate(){return!0},handleContentChange(t){this.addProductInfo.content=t},async saveProductInfo(){try{const t=this.addProductInfo.productSpecs.some(t=>"T"===t.isDefault);if(!t&&this.addProductInfo.productSpecs.length>0)return void this.$message.warning("未选择默认规格");if(!this.addProductValidate())return;this.addProductInfo.shopId=this.shopId,this.addProductInfo.areaCode=Object(s["b"])();const e=await Object(d["j"])(this.addProductInfo);0===e.code?(this.$message.success("添加成功"),this.$router.go(-1)):this.$message.error(e.msg)}catch(t){console.error("保存商品失败:",t),this.$message.error("保存商品失败")}},_initAddProduct(){},_openAddSpecModal(){const t={specCd:"0",stock:"0",sales:"0",price:"0.00",costPrice:"0.00",ownerPrice:"0.00",vipPrice:"0.00",otPrice:"0.00",deduction:"0.00",isDefault:"F",barCode:""};this.addProductInfo.productSpecs.push(t),!this.addProductInfo.productSpecs.some(t=>"T"===t.isDefault)&&this.addProductInfo.productSpecs.length>0&&(this.addProductInfo.productSpecs[0].isDefault="T")},_openAddDeleteProductSpec(t){const e=this.addProductInfo.productSpecs.indexOf(t);e>-1&&this.addProductInfo.productSpecs.splice(e,1),!this.addProductInfo.productSpecs.some(t=>"T"===t.isDefault)&&this.addProductInfo.productSpecs.length>0&&(this.addProductInfo.productSpecs[0].isDefault="T")},_doAddDefaultProductSpec(t,e){t.productSpecs.forEach(t=>{t.isDefault="F"}),e.isDefault="T",this.addProductInfo.productSpecs=JSON.parse(JSON.stringify(t.productSpecs))},_changeShopHouseAdd(t){const e=this.addProductInfo.shopHouses.find(e=>e.shId===t);e&&(this.addProductInfo.shName=e.shName)},async _listAddHousekeepingTypes(){try{const t={page:1,row:30,typeCd:"2002",shopId:"9999",skipType:"3"},e=await Object(d["c"])(t);this.addProductInfo.housekeepingTypes=e.data}catch(t){console.error("获取家政类型失败:",t)}},async _listShopHouses(){try{const t={page:1,row:100,shopId:this.shopId},e=await Object(d["i"])(t);this.addProductInfo.shopHouses=e.data}catch(t){console.error("获取仓库列表失败:",t)}},async _listAddProductCategorys(){try{const t={page:1,row:50,shopId:this.shopId},e=await Object(d["f"])(t);this.addProductInfo.productCategorys=e.data}catch(t){console.error("获取商品分类失败:",t)}},_closeAddProduct(){this.$router.go(-1)}}},u=l,i=(o("2132"),o("2877")),p=Object(i["a"])(u,a,r,!1,null,"bafeacc0",null);e["default"]=p.exports},"45d6":function(t,e,o){}}]);
|
|
//# sourceMappingURL=chunk-0d06173f.a1e3a07d.js.map
|