index.94950e41.js 6.6 KB

1
  1. import{d as T,Q as j,S as h,W as C,g as u,af as b,V as y,y as p,i as S,j as e,A as i,F as m,w as n,aS as I,B as f}from"./ResizeObserver.es.39b48a47.js";import{C as O}from"./index.970ad07b.js";import{s as V}from"./icon_student.c3c58354.js";import{I as E}from"./index.fcbcb027.js";import{T as B}from"./index.e90d2179.js";import{t as P}from"./tradeOrder.c5307744.js";import{o as s}from"./orderStatus.fbc0ddaf.js";import"./index.dc19bc54.js";const Y="_discountCardContainer_1p9fj_1",A="_cardContainer_1p9fj_20",F="_imgSection_1p9fj_24",N="_userSection_1p9fj_32",w="_userImgSection_1p9fj_36",M="_userImg_1p9fj_36",G="_showMemeber_1p9fj_50",k="_userVip_1p9fj_57",x="_isVip_1p9fj_61",U="_userSVip_1p9fj_68",R="_userInfo_1p9fj_79",L="_userName_1p9fj_83",$="_name_1p9fj_88",q="_phone_1p9fj_99",H="_member_time_1p9fj_103",Q="_cardSection_1p9fj_113",W="_top_1p9fj_121",z="_iconTitle1_1p9fj_127",J="_priceSection_1p9fj_131",K="_currentPrice_1p9fj_137",X="_l_1p9fj_147",Z="_c_1p9fj_20",ee="_r_1p9fj_156",te="_originPrice_1p9fj_160",oe="_chapter_1p9fj_166",re="_chapterTop_1p9fj_180",ie="_chapterBottom_1p9fj_187",ae="_btnGroup_1p9fj_203",ne="_submitBtn_1p9fj_207",se="_dialogContainer_1p9fj_227",ce="_dialogTitle_1p9fj_235",de="_dialogContent_1p9fj_241",le="_dialogBtnGroup_1p9fj_247",ue="_orderGroup_1p9fj_250",pe="_dialogBtn_1p9fj_247";var t={discountCardContainer:Y,cardContainer:A,imgSection:F,userSection:N,userImgSection:w,userImg:M,showMemeber:G,userVip:k,isVip:x,userSVip:U,userInfo:R,userName:L,name:$,phone:q,member_time:H,cardSection:Q,top:W,iconTitle1:z,priceSection:J,currentPrice:K,l:X,c:Z,r:ee,originPrice:te,chapter:oe,chapterTop:re,chapterBottom:ie,btnGroup:ae,submitBtn:ne,dialogContainer:se,dialogTitle:ce,dialogContent:de,dialogBtnGroup:le,orderGroup:ue,dialogBtn:pe},_e="./assets/memo.cbe8b917.png",me="./assets/tip.4f0f2a51.png",fe="./assets/title1.a2035261.png",ye=T({name:"discount-card",setup(){const _=j(),r=h({discountDetail:{},titleOpacity:0,orderVisible:!1,orderDetail:{}}),a=C(()=>{const o=u.user.data;return{username:o==null?void 0:o.username,phone:o==null?void 0:o.phone,avatar:o==null?void 0:o.heardUrl,id:o==null?void 0:o.userId,discountCardFlag:o==null?void 0:o.discountCardFlag,discountEndTime:o==null?void 0:o.discountEndTime,userVip:o==null?void 0:o.userVip}});b("scroll",()=>{const o=window.scrollY||window.pageYOffset||document.documentElement.scrollTop;r.titleOpacity=o>30?1:0});const g=async()=>{try{await p.post(`${u.platformApi}/userOrder/orderCancel`,{data:{orderNo:r.orderDetail.orderNo}})}catch{}r.orderVisible=!1},v=async()=>{const o=r.orderDetail||{};P(o,()=>{_.push({path:"/orderDetail",query:{orderType:o.orderType}})})},D=async()=>{var o;try{const d=await p.post(`${u.platformApi}/userOrder/getPendingOrder`,{data:{goodType:"DISCOUNT"}});if((o=d==null?void 0:d.data)!=null&&o.id){r.orderVisible=!0,r.orderDetail=d.data||{};return}let c=new Date;a.value.discountCardFlag&&(c=n(a.value.discountEndTime||new Date).toDate());let l=new Date;r.discountDetail.period==="MONTH"?l=n(c).add(1,"month").toDate():r.discountDetail.period==="QUARTERLY"?l=n(c).add(3,"month").toDate():r.discountDetail.period==="YEAR_HALF"?l=n(c).add(6,"month").toDate():r.discountDetail.period==="YEAR"&&(l=n(c).add(1,"year").toDate()),s.orderObject.orderType="DISCOUNT",s.orderObject.orderName="\u7545\u5B66\u5361",s.orderObject.orderDesc="\u7545\u5B66\u5361",s.orderObject.actualPrice=r.discountDetail.salePrice||0,s.orderObject.recomUserId=null,s.orderObject.activityId=null,s.orderObject.orderNo="",s.orderObject.orderList=[{orderType:"DISCOUNT",goodsName:"\u7545\u5B66\u5361",id:r.discountDetail.id,title:"\u7545\u5B66\u5361",num:1,salePrice:r.discountDetail.salePrice,period:r.discountDetail.period,price:r.discountDetail.salePrice,startTime:a.value.discountCardFlag?n(c).add(1,"day").format("YYYY-MM-DD"):n(c).format("YYYY-MM-DD"),endTime:n(l).format("YYYY-MM-DD")}],_.push({path:"/orderDetail",query:{orderType:"DISCOUNT"}})}catch{}};return y(async()=>{try{const o=await p.get(u.platformType==="TEACHER"?"/api-teacher/teacher/queryUserInfo":"/api-student/student/queryUserInfo");S(o.data);const{data:d}=await p.get(`${u.platformApi}/memberPriceSettings/getDiscount`);r.discountDetail=d}catch{}}),()=>e("div",{class:t.discountCardContainer},[e(O,{background:`rgba(255,255,255, ${r.titleOpacity})`,backIconColor:"black",hideHeader:!1,border:!1},null),e("div",{class:t.cardContainer},[e("div",{class:t.userSection},[e("div",{class:[t.userImgSection,a.value.userVip.vipType.indexOf("VIP")!==-1&&t.userVip,(a.value.userVip.vipType.indexOf("SVIP")!==-1||a.value.userVip.vipType.indexOf("PERMANENT_SVIP")!==-1)&&t.userSVip,a.value.userVip.vipType.indexOf("NOT_VIP")===-1?t.isVip:""]},[e(E,{class:t.userImg,src:a.value.avatar||V,fit:"cover"},null),e("i",{class:t.showMemeber},null)]),e("div",{class:t.userInfo},[e("div",{class:t.userName},[e("span",{class:t.name},[a.value.username]),a.value.phone&&e("span",{class:t.phone},[i("("),a.value.phone,i(")")])]),e("div",{class:t.member_time},[a.value.discountCardFlag?e(m,null,[i("\u6709\u6548\u671F\u81F3"),e("span",null,[n(a.value.discountEndTime).format("YYYY-MM-DD")])]):"\u60A8\u5F53\u524D\u5C1A\u672A\u5F00\u901A\u7545\u5B66\u5361"])])]),e("div",{class:t.cardSection},[e("div",{class:t.top},[e("img",{src:fe,class:t.iconTitle1},null),e("div",{class:t.priceSection},[e("div",{class:t.currentPrice},[e("div",{class:t.l},[i("\xA5")]),e("div",{class:t.c},[r.discountDetail.salePrice||0]),e("div",{class:t.r},[i("/\u5E74")])]),e("del",{class:t.originPrice},[i("\u539F\u4EF7\xA5"),r.discountDetail.originalPrice,i("/\u5E74")])])]),e("div",{class:t.chapter},[e("div",{class:t.chapterTop},[i("\u8BFE\u7A0B\u5168\u90E8")]),e("div",{class:t.chapterBottom},[(r.discountDetail.discountRate||0)*100,e("i",null,[i("\u6298")])])])]),e("div",{class:t.imgSection},[e("img",{src:_e,class:t.iconMemo},null),e("img",{src:me,class:t.iconTip},null)])]),e(B,{position:"bottom"},{default:()=>[e("div",{class:t.btnGroup},[e("div",{class:t.submitBtn,onClick:D},[a.value.discountCardFlag?"\u7ACB\u5373\u7EED\u8D39":e(m,null,[e("i",null,[i("\xA5")]),r.discountDetail.salePrice||0,i("\u5143\u7ACB\u5373\u5F00\u901A")])])])]}),e(I,{show:r.orderVisible,"onUpdate:show":o=>r.orderVisible=o,style:{background:"transparent"},closeOnClickOverlay:!1},{default:()=>[e("div",{class:t.dialogContainer},[e("div",{class:t.dialogTitle},[i("\u63D0\u793A")]),e("div",{class:t.dialogContent},[i("\u60A8\u6709\u5F85\u652F\u4ED8\u7684\u8BA2\u5355,\u662F\u5426\u7EE7\u7EED\u652F\u4ED8")]),e("div",{class:[t.dialogBtnGroup,t.orderGroup]},[e(f,{round:!0,type:"default",plain:!0,block:!0,onClick:g},{default:()=>[i("\u53D6\u6D88\u8BA2\u5355")]}),e(f,{round:!0,type:"primary",block:!0,class:t.dialogBtn,onClick:v},{default:()=>[i("\u7EE7\u7EED\u652F\u4ED8")]})])])]})])}});export{ye as default};