niucloud-admin/niucloud/public/admin/assets/edit_hotel-941e4842.js
2023-11-15 15:57:04 +08:00

2 lines
12 KiB
JavaScript

/* empty css *//* empty css */import{a as oe,E as ie}from"./el-form-item-1b16c9fc.js";/* empty css */import{_ as re}from"./index.vue_vue_type_script_setup_true_lang-d4db3fbb.js";/* empty css */import{_ as se}from"./index-2d04c504.js";/* empty css *//* empty css *//* empty css *//* empty css */import{ac as ne,aw as de,au as B,ax as me,ay as ue}from"./index-7eafba5f.js";/* empty css *//* empty css */import{t as i}from"./index-0ca94763.js";import{b as ce,c as pe,e as _e,f as he}from"./tourism-6d4e6397.js";import{u as be,a as fe}from"./vue-router-48fdc1e3.js";import{a as ve,E as ge}from"./index-24fb848e.js";import{E as ye}from"./index-e27c3bb0.js";import{a as Ve,E as we}from"./index-4601cf3b.js";import{E as ke}from"./index-c5914bde.js";import{E as xe}from"./index-6fe330c9.js";import{E as Ce}from"./index-9ecd3f93.js";import{d as Ee,r as P,O as N,o as Pe,c as Le,e as d,f as c,g as _,u as r,B as f,y as o,x as n,F as V,z as w,v as L,A,H as S,w as Ae,aA as Fe,aB as Me}from"./plugin-vue_export-helper-85a4d40b.js";import{_ as Se}from"./_plugin-vue_export-helper-c27b6911.js";import"./index-cf9a2dd7.js";import"./event-f85d77b0.js";import"./index-bcd7a424.js";import"./_baseClone-3dbf39d6.js";import"./index.vue_vue_type_style_index_0_lang-14193028.js";import"./el-overlay-08181e74.js";import"./index-313cd2ce.js";import"./focus-trap-64c402c5.js";import"./index-1ad115d7.js";import"./index-de1d3b53.js";import"./attachment-afdaf51f.js";/* empty css *//* empty css *//* empty css *//* empty css *//* empty css */import"./el-tooltip-4ed993c7.js";/* empty css *//* empty css *//* empty css *//* empty css */import"./index-d469ae66.js";import"./index-489c18c0.js";import"./index-4d8f36c6.js";import"./common-c3be41fd.js";import"./index-ee5275c6.js";import"./aria-adfa05c5.js";import"./validator-bcf701e4.js";import"./index-ebc73046.js";import"./index-e1882aa8.js";import"./index-a7e8e96f.js";import"./index-888853cf.js";import"./index-344f0086.js";import"./debounce-6c3123a6.js";import"./position-37364850.js";import"./index-448a4893.js";import"./index-95b00894.js";import"./isEqual-0b9509fd.js";import"./flatten-749195f8.js";import"./index-21f38393.js";import"./directive-64fb15dc.js";import"./index-e513479b.js";import"./el-main-86eb724f.js";import"./index-b9e5f5cb.js";import"./strings-53351eda.js";import"./index-99b65a15.js";import"./index-bd04154b.js";const T=k=>(Fe("data-v-d507b61d"),k=k(),Me(),k),Te={class:"main-container"},Ue={class:"detail-head"},De=T(()=>_("span",{class:"iconfont iconxiangzuojiantou !text-xs"},null,-1)),Ie={class:"ml-[1px]"},Oe=T(()=>_("span",{class:"adorn"},"|",-1)),je={key:0,class:"right"},qe={key:1,class:"right"},He={key:0},Be=T(()=>_("div",{class:"mt-4"},[_("div",{id:"TxMap",class:"map-item w-[800px] h-[500px]"})],-1)),Ne={key:1},Re={key:2},$e={class:"fixed-footer-wrap"},ze={class:"fixed-footer"},Ge=Ee({__name:"edit_hotel",setup(k){const U=be(),R=fe();U.meta.title;const g=P("first"),v=N({province:[],city:[],district:[]});(()=>{de(1).then(l=>{v.province=l.data})})();const D=l=>{Object.keys(l).length==0?l.id=e.province_id:(e.province_id=l.id,e.province_name=l.name),B(l.id).then(t=>{v.city=t.data})},I=l=>{Object.keys(l).length==0?l.id=e.city_id:(e.city_id=l.id,e.city_name=l.name),B(l.id).then(t=>{v.district=t.data})},$=l=>{e.district_id=l.id,e.district_name=l.name},z=()=>{e.province_id&&e.city_id&&e.district_id&&e.address&&(e.full_address=e.province_name+e.city_name+e.district_name+e.address,me({address:e.full_address}).then(l=>{e.latitude=l.data.result.location.lat,e.longitude=l.data.result.location.lng}))};let y;const G=()=>{let l=e.latitude,t=e.longitude;e.latitude==0&&(l="39.90469"),e.longitude==0&&(t="116.40717");let s=new window.TMap.LatLng(l,t);y=new window.TMap.Map("TxMap",{center:s,zoom:17,viewMode:"2D",showControl:!0}),y.on("click",h=>{const u={lat:h.latLng.getLat().toFixed(6),lng:h.latLng.getLng().toFixed(6)};J(u.lat,u.lng,1),p.updateGeometries({id:"shop",position:h.latLng})});let p=new window.TMap.MultiMarker({id:"marker-layer",map:y,minimumClusterSize:1});p.updateGeometries({id:"shop",position:s}),y.on("idle",()=>{Ae(()=>e.latitude,(h,u)=>{let m=new window.TMap.LatLng(e.latitude,e.longitude);y.panTo(m,1),p.updateGeometries({id:"shop",position:m})})})};Pe(()=>{const l=document.createElement("script");ne().then(t=>{l.type="text/javascript",l.src="https://map.qq.com/api/gljs?v=1.exp&key="+t.data.key,document.body.appendChild(l)}),l.onload=()=>{setTimeout(()=>{G()},500)}});const J=(l,t,s)=>{ue({location:l+","+t}).then(p=>{e.province_name=p.data.result.address_component.province,e.city_name=p.data.result.address_component.city,e.district_name=p.data.result.address_component.district,s==1&&(e.address=p.data.result.formatted_addresses.recommend,e.full_address=e.province_name+e.city_name+e.district_name+e.address,e.latitude=l,e.longitude=t)})},O=P([]);(()=>{ce().then(l=>{O.value=l.data})})();const K=l=>{e.hotel_attribute.length<=0?e.hotel_attribute.push(l):e.hotel_attribute.indexOf(l)!=-1?e.hotel_attribute.splice(e.hotel_attribute.indexOf(l),1):e.hotel_attribute.push(l)},x=parseInt(U.query.id),C=P(!1),j={hotel_id:0,hotel_name:"",hotel_star:"",hotel_tag:"",hotel_cover:"",hotel_images:"",hotel_attribute:[],province_id:"",province_name:"",city_id:"",city_name:"",district_id:"",district_name:"",address:"",longitude:0,latitude:0,hotel_desc:"",price:"",cover_thumb_small:"",image_thumb_small:"",full_address:""},e=N({...j});x&&(async(l=0)=>{Object.assign(e,j);const t=await(await pe(l)).data;Object.keys(e).forEach(s=>{t[s]!=null&&s!="hotel_attribute"&&(e[s]=t[s]),s=="hotel_attribute"&&t[s]!=null&&(e[s]=t[s].split(",")),s=="image_thumb_small"&&t[s]!=null&&(e[s]=t[s].join(","))}),e.hotel_id=l,e.province_id>0&&D({}),e.city_id>0&&I({})})(x);const q=P(),Q=Le(()=>({hotel_name:[{required:!0,message:i("hotelNamePlaceholder"),trigger:"blur"}],hotel_star:[{required:!0,message:i("starRatingPlaceholder"),trigger:"blur"}],hotel_cover:[{required:!0,validator:X,trigger:"blur"}],address_area:[{required:!0,validator:W,trigger:"blur"}],address:[{required:!0,message:i("hotelAddressDetailPlaceholder"),trigger:"blur"}]})),W=(l,t,s)=>{(e.province_name==""||e.city_name==""||e.district_name=="")&&s(new Error(i("hotelAddressPlaceholder"))),s()},X=(l,t,s)=>{e.cover_thumb_small==""&&s(new Error(i("hotelCoverPlaceholder"))),s()},Y=async l=>{C.value||!l||await l.validate(async t=>{t&&(C.value=!0,e.hotel_attribute=e.hotel_attribute.join(","),e.hotel_cover=e.cover_thumb_small,e.hotel_images=e.image_thumb_small,(x?_e:he)(e).then(h=>{C.value=!1,history.back()}).catch(h=>{C.value=!1}))})},Z=()=>{history.back()};return(l,t)=>{const s=ve,p=ge,h=ye,u=oe,m=Ve,E=we,H=se,F=ke,ee=re,te=xe,le=ie,ae=Ce;return d(),c("div",Te,[_("div",Ue,[_("div",{class:"left",onClick:t[0]||(t[0]=a=>r(R).push("/tourism/product/hotel/hotel"))},[De,_("span",Ie,f(r(i)("returnToPreviousPage")),1)]),Oe,r(x)?(d(),c("span",je,f(r(i)("editHotel")),1)):(d(),c("span",qe,f(r(i)("addHotel")),1))]),o(ae,{class:"box-card !border-none",shadow:"never"},{default:n(()=>[o(p,{modelValue:g.value,"onUpdate:modelValue":t[1]||(t[1]=a=>g.value=a),class:"demo-tabs"},{default:n(()=>[o(s,{label:r(i)("basicInformation"),name:"first"},null,8,["label"]),o(s,{label:r(i)("hotelIntroduce"),name:"introduce"},null,8,["label"]),o(s,{label:r(i)("hotelPeriphery"),name:"periphery"},null,8,["label"])]),_:1},8,["modelValue"]),o(le,{model:e,"label-width":"120px",ref_key:"formRef",ref:q,rules:r(Q),class:"page-form"},{default:n(()=>[g.value=="first"?(d(),c("div",He,[o(u,{label:r(i)("hotelName"),prop:"hotel_name"},{default:n(()=>[o(h,{modelValue:e.hotel_name,"onUpdate:modelValue":t[2]||(t[2]=a=>e.hotel_name=a),clearable:"",placeholder:r(i)("hotelNamePlaceholder"),class:"input-width"},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),o(u,{label:r(i)("starRating"),prop:"hotel_star"},{default:n(()=>[o(E,{modelValue:e.hotel_star,"onUpdate:modelValue":t[3]||(t[3]=a=>e.hotel_star=a),clearable:"",class:"input-width"},{default:n(()=>[o(m,{label:r(i)("oneStar"),value:1},null,8,["label"]),o(m,{label:r(i)("twoStar"),value:2},null,8,["label"]),o(m,{label:r(i)("threeStar"),value:3},null,8,["label"]),o(m,{label:r(i)("fourStar"),value:4},null,8,["label"]),o(m,{label:r(i)("fiveStar"),value:5},null,8,["label"])]),_:1},8,["modelValue"])]),_:1},8,["label"]),o(u,{label:r(i)("hotelLabel")},{default:n(()=>[o(h,{modelValue:e.hotel_tag,"onUpdate:modelValue":t[4]||(t[4]=a=>e.hotel_tag=a),clearable:"",placeholder:r(i)("hotelLabelPlaceholder"),class:"input-width"},null,8,["modelValue","placeholder"])]),_:1},8,["label"]),o(u,{label:r(i)("hotelCover"),prop:"hotel_cover"},{default:n(()=>[o(H,{modelValue:e.cover_thumb_small,"onUpdate:modelValue":t[5]||(t[5]=a=>e.cover_thumb_small=a)},null,8,["modelValue"])]),_:1},8,["label"]),o(u,{label:r(i)("hotelImages")},{default:n(()=>[o(H,{modelValue:e.image_thumb_small,"onUpdate:modelValue":t[6]||(t[6]=a=>e.image_thumb_small=a),limit:"10"},null,8,["modelValue"])]),_:1},8,["label"]),o(u,{label:r(i)("hotelAddress"),prop:"address_area"},{default:n(()=>[o(E,{modelValue:e.province_name,"onUpdate:modelValue":t[7]||(t[7]=a=>e.province_name=a),"value-key":"id",clearable:"",class:"w-[200px]",onChange:D},{default:n(()=>[o(m,{label:r(i)("provincePlaceholder"),value:""},null,8,["label"]),(d(!0),c(V,null,w(v.province,(a,b)=>(d(),L(m,{key:b,label:a.name,value:a},null,8,["label","value"]))),128))]),_:1},8,["modelValue"]),o(E,{modelValue:e.city_name,"onUpdate:modelValue":t[8]||(t[8]=a=>e.city_name=a),"value-key":"id",clearable:"",class:"w-[200px] ml-3",onChange:I},{default:n(()=>[o(m,{label:r(i)("cityPlaceholder"),value:""},null,8,["label"]),(d(!0),c(V,null,w(v.city,(a,b)=>(d(),L(m,{key:b,label:a.name,value:a},null,8,["label","value"]))),128))]),_:1},8,["modelValue"]),o(E,{modelValue:e.district_name,"onUpdate:modelValue":t[9]||(t[9]=a=>e.district_name=a),"value-key":"id",clearable:"",class:"w-[200px] ml-3",onChange:$},{default:n(()=>[o(m,{label:r(i)("districtPlaceholder"),value:""},null,8,["label"]),(d(!0),c(V,null,w(v.district,(a,b)=>(d(),L(m,{key:b,label:a.name,value:a},null,8,["label","value"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["label"]),o(u,{label:r(i)("hotelAddressDetail"),prop:"address"},{default:n(()=>[_("div",null,[_("div",null,[o(h,{modelValue:e.address,"onUpdate:modelValue":t[10]||(t[10]=a=>e.address=a),clearable:"",placeholder:r(i)("hotelAddressDetailPlaceholder"),class:"input-width"},null,8,["modelValue","placeholder"]),o(F,{class:"ml-3",onClick:z},{default:n(()=>[A(f(r(i)("search")),1)]),_:1})]),Be])]),_:1},8,["label"])])):S("",!0),g.value=="introduce"?(d(),c("div",Ne,[o(u,{label:r(i)("hotelIntroduce")},{default:n(()=>[o(ee,{modelValue:e.hotel_desc,"onUpdate:modelValue":t[11]||(t[11]=a=>e.hotel_desc=a)},null,8,["modelValue"])]),_:1},8,["label"])])):S("",!0),g.value=="periphery"?(d(),c("div",Re,[(d(!0),c(V,null,w(O.value,(a,b)=>(d(),L(u,{label:a.name,key:b},{default:n(()=>[(d(!0),c(V,null,w(a.attr,(M,We)=>(d(),c("span",{key:l.idenx},[o(te,{style:{"margin-right":"8px"},checked:e.hotel_attribute.indexOf(M[0])!=-1,onChange:Xe=>K(M[0])},{default:n(()=>[A(f(M[0]),1)]),_:2},1032,["checked","onChange"])]))),128))]),_:2},1032,["label"]))),128))])):S("",!0)]),_:1},8,["model","rules"])]),_:1}),_("div",$e,[_("div",ze,[o(F,{type:"primary",onClick:t[12]||(t[12]=a=>Y(q.value))},{default:n(()=>[A(f(r(i)("save")),1)]),_:1}),o(F,{onClick:t[13]||(t[13]=a=>Z())},{default:n(()=>[A(f(r(i)("cancel")),1)]),_:1})])])])}}});const bl=Se(Ge,[["__scopeId","data-v-d507b61d"]]);export{bl as default};