2 lines
28 KiB
JavaScript
2 lines
28 KiB
JavaScript
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-2b55121f"],{"1a77":function(e,o,t){},2626:function(e,o,t){},"3ea8":function(e,o,t){},"42b6":function(e,o,t){"use strict";t("f3f4")},"55ba":function(e,o,t){},"5e31":function(e,o,t){"use strict";var m=function(){var e=this,o=e._self._c;return o("div",{staticClass:"upload-image-container"},[e._l(e.photos,(function(t,m){return o("div",{key:m,staticClass:"image-item"},[o("el-image",{staticStyle:{width:"100px",height:"100px"},attrs:{src:t,fit:"cover","preview-src-list":e.photos}}),o("i",{staticClass:"el-icon-delete delete-icon",on:{click:function(o){return e.removeImage(m)}}})],1)})),e.photos.length<e.imageCount?o("div",{staticClass:"upload-button",on:{click:e.triggerUpload}},[o("i",{staticClass:"el-icon-plus"})]):e._e(),o("input",{ref:"fileInput",attrs:{type:"file",accept:"image/*",hidden:""},on:{change:e.handleFileChange}})],2)},n=[],i=t("3549"),d={name:"UploadImageUrl",props:{imageCount:{type:Number,default:1}},data(){return{photos:[],photosUrl:[]}},methods:{triggerUpload(){this.$refs.fileInput.click()},async handleFileChange(e){const o=e.target.files[0];if(!o)return;if(o.size>2097152)return void this.$message.error("图片大小不能超过2MB");const t=new FileReader;t.onload=e=>{this.photos.push(e.target.result)},t.readAsDataURL(o);try{const e=new FormData;e.append("uploadFile",o),e.append("communityId","-1");const{data:t}=await Object(i["b"])(e);this.photosUrl.push(t.url),this.$emit("notifyUploadCoverImage",this.photosUrl)}catch(m){this.$message.error(m.message||"上传失败")}e.target.value=null},removeImage(e){this.photos.splice(e,1),this.photosUrl.splice(e,1),this.$emit("notifyUploadCoverImage",this.photosUrl)},clearImages(){this.photos=[],this.photosUrl=[]},setImages(e){this.clearImages(),e.forEach(e=>{if(!(e.indexOf("base64,")>-1))return e.indexOf("http")>-1?(this.photos.push(e),void this.photosUrl.push(e)):void this.photosUrl.push(e);this.photos.push(e)})}}},c=d,s=(t("e457"),t("2877")),a=Object(s["a"])(c,m,n,!1,null,"c3e7566c",null);o["a"]=a.exports},"911c":function(e,o,t){"use strict";t("2626")},9497:function(e,o,t){"use strict";t("c379")},a392:function(e,o,t){"use strict";t("c571")},a4e6:function(e,o,t){"use strict";t.r(o);var m=function(){var e=this,o=e._self._c;return o("div",[o("el-row",{attrs:{gutter:20}},[o("el-col",{staticClass:"padding-r-0",attrs:{span:4}},[o("admin-community",{on:{"community-change":e.handleCommunityChange}})],1),o("el-col",{attrs:{span:20}},[o("el-card",{},[o("div",{staticClass:"clearfix flex justify-between",attrs:{slot:"header"},slot:"header"},[o("div",[e._v(e._s(e.$t("communityRecommend.queryCondition")))])]),o("div",{},[o("el-form",{staticClass:"flex justify-start",attrs:{inline:!0,model:e.communityRecommendInfo.conditions}},[o("el-form-item",[o("el-select",{staticStyle:{width:"100%"},attrs:{placeholder:e.$t("communityRecommend.selectRecommendType")},model:{value:e.communityRecommendInfo.conditions.recommendType,callback:function(o){e.$set(e.communityRecommendInfo.conditions,"recommendType",o)},expression:"communityRecommendInfo.conditions.recommendType"}},e._l(e.recommendTypeOptions,(function(e){return o("el-option",{key:e.value,attrs:{label:e.label,value:e.value}})})),1)],1),o("el-form-item",[o("el-button",{attrs:{type:"primary",size:"small"},on:{click:e._queryCommunityRecommendMethod}},[e._v(" "+e._s(e.$t("common.query"))+" ")])],1)],1)],1)]),o("el-card",{staticClass:"margin-top-sm"},[o("div",{staticClass:"clearfix flex justify-between",attrs:{slot:"header"},slot:"header"},[o("div",[e._v(e._s(e.$t("communityRecommend.communityRecommend")))]),e.communityRecommendInfo.conditions.communityId?o("div",{staticStyle:{float:"right"}},[o("el-button",{attrs:{type:"primary",size:"small"},on:{click:e._openAddShopRecommend}},[e._v(" "+e._s(e.$t("communityRecommend.linkGoods"))+" ")]),o("el-button",{attrs:{type:"primary",size:"small"},on:{click:e._openAddServRecommend}},[e._v(" "+e._s(e.$t("communityRecommend.linkService"))+" ")]),o("el-button",{attrs:{type:"primary",size:"small"},on:{click:e._openAddCommunityRecommendModal}},[e._v(" "+e._s(e.$t("communityRecommend.linkExternal"))+" ")])],1):e._e()]),o("div",{staticClass:"card-body"},[o("el-table",{staticStyle:{width:"100%"},attrs:{data:e.communityRecommendInfo.recommends}},[o("el-table-column",{attrs:{prop:"logo",label:e.$t("communityRecommend.logo"),width:"100",align:"center"},scopedSlots:e._u([{key:"default",fn:function(e){return[o("img",{staticStyle:{width:"60px",height:"60px","border-radius":"5px"},attrs:{src:e.row.logo}})]}}])}),o("el-table-column",{attrs:{prop:"communityName",label:e.$t("communityRecommend.communityName"),align:"center"}}),o("el-table-column",{attrs:{prop:"shopName",label:e.$t("communityRecommend.shopName"),align:"center"}}),o("el-table-column",{attrs:{prop:"recommendTypeName",label:e.$t("communityRecommend.recommendType"),align:"center"}}),o("el-table-column",{attrs:{prop:"prodName",label:e.$t("communityRecommend.name"),align:"center"}}),o("el-table-column",{attrs:{prop:"price",label:e.$t("communityRecommend.price"),align:"center"}}),o("el-table-column",{attrs:{prop:"createTime",label:e.$t("communityRecommend.createTime"),align:"center"}}),o("el-table-column",{attrs:{label:e.$t("common.operation"),align:"center",width:"180"},scopedSlots:e._u([{key:"default",fn:function(t){return[o("el-button",{attrs:{size:"mini"},on:{click:function(o){return e._openEditCommunityRecommendModel(t.row)}}},[e._v(" "+e._s(e.$t("common.edit"))+" ")]),o("el-button",{attrs:{size:"mini",type:"danger"},on:{click:function(o){return e._openDeleteCommunityRecommendModel(t.row)}}},[e._v(" "+e._s(e.$t("common.delete"))+" ")])]}}])})],1),o("el-pagination",{attrs:{"current-page":e.communityRecommendInfo.conditions.page,"page-size":e.communityRecommendInfo.conditions.row,layout:"total, prev, pager, next",total:e.communityRecommendInfo.total},on:{"current-change":e.handleCurrentChange}})],1)])],1)],1),o("add-community-recommend",{ref:"addCommunityRecommend",on:{refresh:e._queryCommunityRecommendMethod}}),o("edit-community-recommend",{ref:"editCommunityRecommend",on:{refresh:e._queryCommunityRecommendMethod}}),o("delete-community-recommend",{ref:"deleteCommunityRecommend",on:{refresh:e._queryCommunityRecommendMethod}}),o("add-shop-recommend",{ref:"addShopRecommend",on:{refresh:e._queryCommunityRecommendMethod}}),o("add-serv-recommend",{ref:"addServRecommend",on:{refresh:e._queryCommunityRecommendMethod}})],1)},n=[],i=t("b775");function d(e){return new Promise((o,t)=>{Object(i["a"])({url:"/recommend.listCommunityRecommend",method:"get",params:e}).then(e=>{const t=e.data;o(t)}).catch(e=>{t(e)})})}function c(e){return new Promise((o,t)=>{Object(i["a"])({url:"/recommend.saveCommunityRecommend",method:"post",data:e}).then(e=>{const t=e.data;o(t)}).catch(e=>{t(e)})})}function s(e){return new Promise((o,t)=>{Object(i["a"])({url:"/recommend.updateCommunityRecommend",method:"post",data:e}).then(e=>{const t=e.data;o(t)}).catch(e=>{t(e)})})}function a(e){return new Promise((o,t)=>{Object(i["a"])({url:"/recommend.deleteCommunityRecommend",method:"post",data:e}).then(e=>{const t=e.data;o(t)}).catch(e=>{t(e)})})}function r(e){return new Promise((o,t)=>{Object(i["a"])({url:"/shop.queryShopsByAdmin",method:"get",params:e}).then(e=>{const t=e.data;o(t)}).catch(e=>{t(e)})})}function l(e){return new Promise((o,t)=>{Object(i["a"])({url:"/product.queryProduct",method:"get",params:e}).then(e=>{const t=e.data;o(t)}).catch(e=>{t(e)})})}function u(e){return new Promise((o,t)=>{Object(i["a"])({url:"/housekeepingServ.queryAdminServ",method:"get",params:e}).then(e=>{const t=e.data;o(t)}).catch(e=>{t(e)})})}var p=t("7323"),h=function(){var e=this,o=e._self._c;return o("el-card",{staticClass:"list-selector"},[o("ul",{staticClass:"list-selector-list"},[o("li",{class:{selected:""===e.adminCommunityInfo.communityId},on:{click:function(o){return e.swatchAdminCommunityId({communityId:"",name:"全部"})}}},[e._v(" "+e._s(e.$t("common.all"))+" ")]),e._l(e.adminCommunityInfo.communitys,(function(t,m){return o("li",{key:m,class:{selected:e.adminCommunityInfo.communityId==t.communityId},on:{click:function(o){return e.swatchAdminCommunityId(t)}}},[e._v(" "+e._s(t.name)+" ")])}))],2)])},f=[];function y(e){return new Promise((o,t)=>{Object(i["a"])({url:"/community.queryAdminCommunity",method:"get",params:e}).then(e=>{const t=e.data;o(t)}).catch(e=>{t(e)})})}console.log(p["f"]);var R={name:"AdminCommunity",data(){return{adminCommunityInfo:{communitys:[],communityId:""}}},created(){this._listAdminCommunitys(1,100)},methods:{async _listAdminCommunitys(e,o){try{const t=await y({page:e,row:o});this.adminCommunityInfo.communitys=t.data}catch(t){console.error("获取小区列表失败:",t)}},swatchAdminCommunityId(e){this.adminCommunityInfo.communityId=e.communityId,this.$emit("community-change",e)}}},I=R,g=(t("42b6"),t("2877")),v=Object(g["a"])(I,h,f,!1,null,"d57f9fe6",null),b=v.exports,C=function(){var e=this,o=e._self._c;return o("el-dialog",{attrs:{title:e.$t("communityRecommend.add"),visible:e.dialogVisible,width:"70%"},on:{"update:visible":function(o){e.dialogVisible=o},close:e.handleClose}},[o("el-form",{ref:"addForm",attrs:{model:e.addCommunityRecommendInfo,"label-width":"120px",rules:e.rules}},[o("el-form-item",{attrs:{label:e.$t("communityRecommend.logo"),prop:"logo"}},[o("upload-image-url",{ref:"uploadImage",attrs:{callBackListener:"addCommunityRecommend",callBackFunction:"notifyUploadCoverImage",imageCount:1}})],1),o("el-form-item",{attrs:{label:e.$t("communityRecommend.productName"),prop:"prodName"}},[o("el-input",{attrs:{placeholder:e.$t("communityRecommend.requiredProductName")},model:{value:e.addCommunityRecommendInfo.prodName,callback:function(o){e.$set(e.addCommunityRecommendInfo,"prodName",o)},expression:"addCommunityRecommendInfo.prodName"}})],1),o("el-form-item",{attrs:{label:e.$t("communityRecommend.price"),prop:"price"}},[o("el-input",{attrs:{placeholder:e.$t("communityRecommend.requiredPrice")},model:{value:e.addCommunityRecommendInfo.price,callback:function(o){e.$set(e.addCommunityRecommendInfo,"price",o)},expression:"addCommunityRecommendInfo.price"}})],1),o("el-form-item",{attrs:{label:e.$t("communityRecommend.accessUrl"),prop:"url"}},[o("el-input",{attrs:{placeholder:e.$t("communityRecommend.requiredAccessUrl")},model:{value:e.addCommunityRecommendInfo.url,callback:function(o){e.$set(e.addCommunityRecommendInfo,"url",o)},expression:"addCommunityRecommendInfo.url"}})],1)],1),o("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[o("el-button",{on:{click:function(o){e.dialogVisible=!1}}},[e._v(e._s(e.$t("common.cancel")))]),o("el-button",{attrs:{type:"primary"},on:{click:e.saveCommunityRecommend}},[e._v(e._s(e.$t("common.save")))])],1)],1)},$=[],S=t("5e31"),_={name:"AddCommunityRecommend",components:{UploadImageUrl:S["a"]},data(){return{dialogVisible:!1,addCommunityRecommendInfo:{crId:"",communityName:"",shopName:"未知",shopId:"9999",recommendType:"OUT",logo:"",prodName:"",price:"",url:""},rules:{logo:[{required:!0,message:this.$t("communityRecommend.logoRequired"),trigger:"blur"}],prodName:[{required:!0,message:this.$t("communityRecommend.productNameRequired"),trigger:"blur"},{max:256,message:this.$t("communityRecommend.max256Chars"),trigger:"blur"}],price:[{required:!0,message:this.$t("communityRecommend.priceRequired"),trigger:"blur"},{max:10,message:this.$t("communityRecommend.max10Chars"),trigger:"blur"}],url:[{required:!0,message:this.$t("communityRecommend.urlRequired"),trigger:"blur"}]}}},methods:{open(e){this.addCommunityRecommendInfo.shopId=e.shopId,this.addCommunityRecommendInfo.communityName=e.communityName,this.dialogVisible=!0,this.$nextTick(()=>{this.$refs.uploadImage.clearImage()})},handleClose(){this.$refs.addForm.resetFields(),this.clearAddCommunityRecommendInfo()},async saveCommunityRecommend(){this.$refs.addForm.validate(async e=>{if(e)try{await c(this.addCommunityRecommendInfo),this.$message.success(this.$t("common.saveSuccess")),this.dialogVisible=!1,this.$emit("refresh")}catch(o){console.error("保存失败:",o)}})},clearAddCommunityRecommendInfo(){this.addCommunityRecommendInfo={crId:"",communityName:"",shopName:"未知",shopId:"9999",recommendType:"OUT",logo:"",prodName:"",price:"",url:""}}}},N=_,w=(t("911c"),Object(g["a"])(N,C,$,!1,null,"7105dd4f",null)),k=w.exports,x=function(){var e=this,o=e._self._c;return o("el-dialog",{attrs:{title:e.$t("communityRecommend.edit"),visible:e.dialogVisible,width:"70%"},on:{"update:visible":function(o){e.dialogVisible=o},close:e.handleClose}},[o("el-form",{ref:"editForm",attrs:{model:e.editCommunityRecommendInfo,"label-width":"120px",rules:e.rules}},[o("el-form-item",{attrs:{label:e.$t("communityRecommend.logo"),prop:"logo"}},[o("upload-image-url",{ref:"uploadImage",attrs:{callBackListener:"editCommunityRecommend",callBackFunction:"notifyUploadCoverImage",imageCount:1}})],1),o("el-form-item",{attrs:{label:e.$t("communityRecommend.productName"),prop:"prodName"}},[o("el-input",{attrs:{placeholder:e.$t("communityRecommend.requiredProductName")},model:{value:e.editCommunityRecommendInfo.prodName,callback:function(o){e.$set(e.editCommunityRecommendInfo,"prodName",o)},expression:"editCommunityRecommendInfo.prodName"}})],1),o("el-form-item",{attrs:{label:e.$t("communityRecommend.price"),prop:"price"}},[o("el-input",{attrs:{placeholder:e.$t("communityRecommend.requiredPrice")},model:{value:e.editCommunityRecommendInfo.price,callback:function(o){e.$set(e.editCommunityRecommendInfo,"price",o)},expression:"editCommunityRecommendInfo.price"}})],1)],1),o("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[o("el-button",{on:{click:function(o){e.dialogVisible=!1}}},[e._v(e._s(e.$t("common.cancel")))]),o("el-button",{attrs:{type:"primary"},on:{click:e.editCommunityRecommend}},[e._v(e._s(e.$t("common.save")))])],1)],1)},q=[],A={name:"EditCommunityRecommend",components:{UploadImageUrl:S["a"]},data(){return{dialogVisible:!1,editCommunityRecommendInfo:{crId:"",communityName:"",shopName:"",recommendType:"",logo:"",prodName:"",price:"",url:""},rules:{logo:[{required:!0,message:this.$t("communityRecommend.logoRequired"),trigger:"blur"},{max:512,message:this.$t("communityRecommend.max512Chars"),trigger:"blur"}],prodName:[{required:!0,message:this.$t("communityRecommend.productNameRequired"),trigger:"blur"},{max:256,message:this.$t("communityRecommend.max256Chars"),trigger:"blur"}],price:[{required:!0,message:this.$t("communityRecommend.priceRequired"),trigger:"blur"},{max:10,message:this.$t("communityRecommend.max10Chars"),trigger:"blur"}]}}},methods:{open(e){this.dialogVisible=!0,this.$nextTick(()=>{this.$refs.editForm.resetFields(),Object.assign(this.editCommunityRecommendInfo,e),this.$refs.uploadImage.notifyPhotos([e.logo])})},handleClose(){this.$refs.editForm.resetFields(),this.refreshEditCommunityRecommendInfo()},async editCommunityRecommend(){this.$refs.editForm.validate(async e=>{if(e)try{await s(this.editCommunityRecommendInfo),this.$message.success(this.$t("common.saveSuccess")),this.dialogVisible=!1,this.$emit("refresh")}catch(o){console.error("更新失败:",o)}})},refreshEditCommunityRecommendInfo(){this.editCommunityRecommendInfo={crId:"",communityName:"",shopName:"",recommendType:"",logo:"",prodName:"",price:"",url:""}}}},O=A,V=(t("a392"),Object(g["a"])(O,x,q,!1,null,"f05079fc",null)),U=V.exports,F=function(){var e=this,o=e._self._c;return o("el-dialog",{attrs:{title:e.$t("common.confirm"),visible:e.dialogVisible,width:"30%"},on:{"update:visible":function(o){e.dialogVisible=o},close:e.handleClose}},[o("div",{staticClass:"text-center"},[o("p",[e._v(e._s(e.$t("deleteCommunityRecommend.confirmDelete")))])]),o("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[o("el-button",{on:{click:function(o){e.dialogVisible=!1}}},[e._v(e._s(e.$t("common.cancel")))]),o("el-button",{attrs:{type:"primary"},on:{click:e.deleteCommunityRecommend}},[e._v(e._s(e.$t("common.confirmDelete")))])],1)])},P=[],T={name:"DeleteCommunityRecommend",data(){return{dialogVisible:!1,deleteCommunityRecommendInfo:{}}},methods:{open(e){this.dialogVisible=!0,this.deleteCommunityRecommendInfo={...e}},handleClose(){this.deleteCommunityRecommendInfo={}},async deleteCommunityRecommend(){try{await a({...this.deleteCommunityRecommendInfo,shopId:Object(p["f"])()}),this.$message.success(this.$t("common.submitSuccess")),this.dialogVisible=!1,this.$emit("refresh")}catch(e){console.error("删除失败:",e)}}}},j=T,M=(t("9497"),Object(g["a"])(j,F,P,!1,null,"6219b266",null)),D=M.exports,E=function(){var e=this,o=e._self._c;return o("el-dialog",{attrs:{title:e.$t("communityRecommend.linkGoods"),visible:e.dialogVisible,width:"70%"},on:{"update:visible":function(o){e.dialogVisible=o},close:e.handleClose}},[o("el-form",{ref:"addForm",attrs:{model:e.addShopRecommendInfo,"label-width":"120px",rules:e.rules}},[o("el-form-item",{attrs:{label:e.$t("communityRecommend.selectProduct")}},[o("el-row",{attrs:{gutter:20}},[o("el-col",{attrs:{span:10}},[o("el-select",{staticStyle:{width:"100%"},attrs:{placeholder:e.$t("communityRecommend.selectShop")},on:{change:e.queryAShopGoods},model:{value:e.addShopRecommendInfo.shopId,callback:function(o){e.$set(e.addShopRecommendInfo,"shopId",o)},expression:"addShopRecommendInfo.shopId"}},e._l(e.addShopRecommendInfo.shops,(function(e){return o("el-option",{key:e.shopId,attrs:{label:e.shopName,value:e.shopId}})})),1)],1),o("el-col",{attrs:{span:10}},[o("el-select",{staticStyle:{width:"100%"},attrs:{placeholder:e.$t("communityRecommend.selectProduct")},on:{change:e.selectGoods},model:{value:e.addShopRecommendInfo.prodId,callback:function(o){e.$set(e.addShopRecommendInfo,"prodId",o)},expression:"addShopRecommendInfo.prodId"}},e._l(e.addShopRecommendInfo.products,(function(e){return o("el-option",{key:e.productId,attrs:{label:e.prodName,value:e.productId}})})),1)],1)],1)],1),o("el-form-item",{attrs:{label:e.$t("communityRecommend.logo"),prop:"logo"}},[o("upload-image-url",{ref:"uploadImage",attrs:{callBackListener:"addShopRecommend",callBackFunction:"notifyUploadCoverImage",imageCount:1}})],1),o("el-form-item",{attrs:{label:e.$t("communityRecommend.productName"),prop:"prodName"}},[o("el-input",{attrs:{placeholder:e.$t("communityRecommend.requiredProductName")},model:{value:e.addShopRecommendInfo.prodName,callback:function(o){e.$set(e.addShopRecommendInfo,"prodName",o)},expression:"addShopRecommendInfo.prodName"}})],1),o("el-form-item",{attrs:{label:e.$t("communityRecommend.price"),prop:"price"}},[o("el-input",{attrs:{placeholder:e.$t("communityRecommend.requiredPrice")},model:{value:e.addShopRecommendInfo.price,callback:function(o){e.$set(e.addShopRecommendInfo,"price",o)},expression:"addShopRecommendInfo.price"}})],1)],1),o("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[o("el-button",{on:{click:function(o){e.dialogVisible=!1}}},[e._v(e._s(e.$t("common.cancel")))]),o("el-button",{attrs:{type:"primary"},on:{click:e.saveShopRecommendInfo}},[e._v(e._s(e.$t("common.save")))])],1)],1)},G=[],B={name:"AddShopRecommend",components:{UploadImageUrl:S["a"]},data(){return{dialogVisible:!1,addShopRecommendInfo:{communityId:"",communityName:"",shopName:"",shopId:"",prodId:"",recommendType:"GOODS",logo:"",prodName:"",price:"",url:"",shops:[],products:[]},rules:{logo:[{required:!0,message:this.$t("communityRecommend.logoRequired"),trigger:"blur"}],prodName:[{required:!0,message:this.$t("communityRecommend.productNameRequired"),trigger:"blur"}],price:[{required:!0,message:this.$t("communityRecommend.priceRequired"),trigger:"blur"}]}}},methods:{open(e){this.dialogVisible=!0,this.addShopRecommendInfo.communityId=e.communityId,this.addShopRecommendInfo.communityName=e.communityName,this._listAShopRecommendShops(),this.$nextTick(()=>{this.$refs.uploadImage.clearImage()})},handleClose(){this.$refs.addForm.resetFields(),this.clearAddShopRecommendInfo()},async saveShopRecommendInfo(){this.$refs.addForm.validate(async e=>{if(e){this.addShopRecommendInfo.url=`/pages/goods/goods?productId=${this.addShopRecommendInfo.prodId}&shopId=${this.addShopRecommendInfo.shopId}`;try{await c(this.addShopRecommendInfo),this.$message.success(this.$t("common.saveSuccess")),this.dialogVisible=!1,this.$emit("refresh")}catch(o){console.error("保存失败:",o)}}})},clearAddShopRecommendInfo(){this.addShopRecommendInfo={communityId:"",communityName:"",shopName:"",shopId:"",prodId:"",recommendType:"GOODS",logo:"",prodName:"",price:"",url:"",shops:[],products:[]}},async _listAShopRecommendShops(){try{const e=await r({page:1,row:100});this.addShopRecommendInfo.shops=e.data}catch(e){console.error("获取店铺列表失败:",e)}},queryAShopGoods(){const e=this.addShopRecommendInfo.shops.find(e=>e.shopId===this.addShopRecommendInfo.shopId);e&&(this.addShopRecommendInfo.shopName=e.shopName),this._listAGoodsProducts()},async _listAGoodsProducts(){try{const e=await l({page:1,row:500,shopId:this.addShopRecommendInfo.shopId});this.addShopRecommendInfo.products=e.data}catch(e){console.error("获取商品列表失败:",e)}},selectGoods(){const e=this.addShopRecommendInfo.products.find(e=>e.productId===this.addShopRecommendInfo.prodId);e&&(this.addShopRecommendInfo.prodName=e.prodName,this.addShopRecommendInfo.price=e.price,this.addShopRecommendInfo.logo=e.coverPhoto,this.$refs.uploadImage.notifyPhotos([e.coverPhoto]))}}},z=B,L=(t("ae29"),Object(g["a"])(z,E,G,!1,null,"d277de3e",null)),J=L.exports,H=function(){var e=this,o=e._self._c;return o("el-dialog",{attrs:{title:e.$t("communityRecommend.linkService"),visible:e.dialogVisible,width:"70%"},on:{"update:visible":function(o){e.dialogVisible=o},close:e.handleClose}},[o("el-form",{ref:"addForm",attrs:{model:e.addServRecommendInfo,"label-width":"120px",rules:e.rules}},[o("el-form-item",{attrs:{label:e.$t("communityRecommend.selectService")}},[o("el-row",{attrs:{gutter:20}},[o("el-col",{attrs:{span:10}},[o("el-select",{staticStyle:{width:"100%"},attrs:{placeholder:e.$t("communityRecommend.selectShop")},on:{change:e.queryAShopServs},model:{value:e.addServRecommendInfo.shopId,callback:function(o){e.$set(e.addServRecommendInfo,"shopId",o)},expression:"addServRecommendInfo.shopId"}},e._l(e.addServRecommendInfo.shops,(function(e){return o("el-option",{key:e.shopId,attrs:{label:e.shopName,value:e.shopId}})})),1)],1),o("el-col",{attrs:{span:10}},[o("el-select",{staticStyle:{width:"100%"},attrs:{placeholder:e.$t("communityRecommend.selectService")},on:{change:e.selectServs},model:{value:e.addServRecommendInfo.servId,callback:function(o){e.$set(e.addServRecommendInfo,"servId",o)},expression:"addServRecommendInfo.servId"}},e._l(e.addServRecommendInfo.servs,(function(e){return o("el-option",{key:e.servId,attrs:{label:e.servName,value:e.servId}})})),1)],1)],1)],1),o("el-form-item",{attrs:{label:e.$t("communityRecommend.logo"),prop:"logo"}},[o("upload-image-url",{ref:"uploadImage",attrs:{callBackListener:"addServRecommend",callBackFunction:"notifyUploadCoverImage",imageCount:1}})],1),o("el-form-item",{attrs:{label:e.$t("communityRecommend.serviceName"),prop:"prodName"}},[o("el-input",{attrs:{placeholder:e.$t("communityRecommend.requiredServiceName")},model:{value:e.addServRecommendInfo.prodName,callback:function(o){e.$set(e.addServRecommendInfo,"prodName",o)},expression:"addServRecommendInfo.prodName"}})],1),o("el-form-item",{attrs:{label:e.$t("communityRecommend.price"),prop:"price"}},[o("el-input",{attrs:{placeholder:e.$t("communityRecommend.requiredPrice")},model:{value:e.addServRecommendInfo.price,callback:function(o){e.$set(e.addServRecommendInfo,"price",o)},expression:"addServRecommendInfo.price"}})],1)],1),o("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[o("el-button",{on:{click:function(o){e.dialogVisible=!1}}},[e._v(e._s(e.$t("common.cancel")))]),o("el-button",{attrs:{type:"primary"},on:{click:e.saveServRecommend}},[e._v(e._s(e.$t("common.save")))])],1)],1)},K=[],Q={name:"AddServRecommend",components:{UploadImageUrl:S["a"]},data(){return{dialogVisible:!1,addServRecommendInfo:{communityId:"",communityName:"",shopName:"",shopId:"",servId:"",recommendType:"SERV",logo:"",prodName:"",price:"",url:"",shops:[],servs:[]},rules:{logo:[{required:!0,message:this.$t("communityRecommend.logoRequired"),trigger:"blur"}],prodName:[{required:!0,message:this.$t("communityRecommend.serviceNameRequired"),trigger:"blur"}],price:[{required:!0,message:this.$t("communityRecommend.priceRequired"),trigger:"blur"}]}}},methods:{open(e){this.dialogVisible=!0,this.addServRecommendInfo.communityId=e.communityId,this.addServRecommendInfo.communityName=e.communityName,this._listAServRecommendShops(),this.$nextTick(()=>{this.$refs.uploadImage.clearImage()})},handleClose(){this.$refs.addForm.resetFields(),this.clearAddServRecommendInfo()},async saveServRecommend(){this.$refs.addForm.validate(async e=>{if(e){this.addServRecommendInfo.url=`/pages/homemaking/detail?servId=${this.addServRecommendInfo.servId}&shopId=${this.addServRecommendInfo.shopId}`;try{await c(this.addServRecommendInfo),this.$message.success(this.$t("common.saveSuccess")),this.dialogVisible=!1,this.$emit("refresh")}catch(o){console.error("保存失败:",o)}}})},clearAddServRecommendInfo(){this.addServRecommendInfo={communityId:"",communityName:"",shopName:"",shopId:"",servId:"",recommendType:"SERV",logo:"",prodName:"",price:"",url:"",shops:[],servs:[]}},async _listAServRecommendShops(){try{const e=await r({page:1,row:100});this.addServRecommendInfo.shops=e.data}catch(e){console.error("获取店铺列表失败:",e)}},async queryAShopServs(){const e=this.addServRecommendInfo.shops.find(e=>e.shopId===this.addServRecommendInfo.shopId);e&&(this.addServRecommendInfo.shopName=e.shopName),await this._listAShopServ()},async _listAShopServ(){try{const e=await u({page:1,row:500,shopId:this.addServRecommendInfo.shopId});this.addServRecommendInfo.servs=e.data}catch(e){console.error("获取服务列表失败:",e)}},selectServs(){const e=this.addServRecommendInfo.servs.find(e=>e.servId===this.addServRecommendInfo.servId);e&&(this.addServRecommendInfo.prodName=e.servName,this.addServRecommendInfo.price=e.defaultFee,this.addServRecommendInfo.logo=e.coverPhoto,this.$refs.uploadImage.notifyPhotos([e.coverPhoto]))}}},W=Q,X=(t("b0be"),Object(g["a"])(W,H,K,!1,null,"4b96f952",null)),Y=X.exports,Z={name:"CommunityRecommend",components:{AdminCommunity:b,AddCommunityRecommend:k,EditCommunityRecommend:U,DeleteCommunityRecommend:D,AddShopRecommend:J,AddServRecommend:Y},data(){return{communityRecommendInfo:{recommends:[],total:0,records:1,moreCondition:!1,crId:"",communityName:"",conditions:{communityId:"",recommendType:"",prodName:"",page:1,row:10}},recommendTypeOptions:[{value:"",label:this.$t("communityRecommend.selectRecommendType")},{value:"GOODS",label:this.$t("communityRecommend.goods")},{value:"SERV",label:this.$t("communityRecommend.housekeepingService")},{value:"OUT",label:this.$t("communityRecommend.external")}]}},created(){this.shopId=Object(p["f"])(),console.log(this.shopId),this._listCommunityRecommends(1,10)},methods:{handleCommunityChange(e){this.communityRecommendInfo.conditions.communityId=e.communityId,this.communityRecommendInfo.communityName=e.name,this._listCommunityRecommends(1,10)},async _listCommunityRecommends(e,o){this.communityRecommendInfo.conditions.page=e,this.communityRecommendInfo.conditions.row=o;try{const e=await d(this.communityRecommendInfo.conditions);this.communityRecommendInfo.total=e.total,this.communityRecommendInfo.records=e.records,this.communityRecommendInfo.recommends=e.data}catch(t){console.error("获取推荐列表失败:",t)}},handleCurrentChange(e){this._listCommunityRecommends(e,this.communityRecommendInfo.conditions.row)},_openAddShopRecommend(){this.$refs.addShopRecommend.open({communityId:this.communityRecommendInfo.conditions.communityId,communityName:this.communityRecommendInfo.communityName})},_openAddServRecommend(){this.$refs.addServRecommend.open({communityId:this.communityRecommendInfo.conditions.communityId,communityName:this.communityRecommendInfo.communityName})},_openAddCommunityRecommendModal(){this.$refs.addCommunityRecommend.open({communityId:this.communityRecommendInfo.conditions.communityId,communityName:this.communityRecommendInfo.communityName})},_openEditCommunityRecommendModel(e){this.$refs.editCommunityRecommend.open(e)},_openDeleteCommunityRecommendModel(e){this.$refs.deleteCommunityRecommend.open(e)},_queryCommunityRecommendMethod(){this._listCommunityRecommends(1,10)}}},ee=Z,oe=(t("b909"),Object(g["a"])(ee,m,n,!1,null,"84f7028a",null));o["default"]=oe.exports},ae29:function(e,o,t){"use strict";t("1a77")},aef8:function(e,o,t){},b0be:function(e,o,t){"use strict";t("3ea8")},b909:function(e,o,t){"use strict";t("aef8")},c379:function(e,o,t){},c571:function(e,o,t){},e457:function(e,o,t){"use strict";t("55ba")},f3f4:function(e,o,t){}}]);
|
|
//# sourceMappingURL=chunk-2b55121f.bd61a7f9.js.map
|