import{d as r,b as e,F as c,G as A,j as s,q as l,P as f,D as g,T as u,H as w,m as T,p as h,J as d,B as x}from"./vendor.2bcdc9cf.js";/* empty css *//* empty css */import{C}from"./index.8f85fe36.js";import{r as y,s as m,v as P}from"./index.f45ba589.js";/* empty css *//* empty css *//* empty css */const _="_colProtocol_12n7o_1",k="_protocolText_12n7o_7",v="_boxStyle_12n7o_11";var i={colProtocol:_,protocolText:k,boxStyle:v},S="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACQAAAAkCAYAAADhAJiYAAAEEElEQVRYR82Yf2xTVRTHv+e161o6hp1sKqSLbhMoW0eCOpiUuSWG/cF/JKsYE38kZkKCERP5wz/0Lwn+RTBDRFHBRCK8auIfGgMxmZaxbpnO2DJW3IC5ykTGdFJn96vvmPfeumxd2/feNsy7f728e+45n3vPPefcewkGW3Wn+BBJQqME9gHsYUIpMa2U1TBxnBiDAPUKoDYWpHPhLf7rRkyQLmFRtFSXUhOY9zHwOAB942RGoB1ER8ODHIDfn9Syp6nYGzr7JEAtADZoKdPojwL8cqT2qW9zyWUFerD1pH2lo+AIgGawPNFlaEQM4IN44p/9Aw0vjGfSmNFQRVAsduThawCPLQNGJhVdiSns7K/zD6d3LgBSYSgI8FJdpDEXiiamuC4dah6Q4ia7M3gXVyYdsis+PlY3133zgLwdgeNgfukuuSmzWqL3I1ub9qQ6Z4GUaCLh/LJtYL2zkjc6SztS0acCiaLF68alZQhtvRjpctFIDFVynlKAqjsCu5n5s8Vq0zNu933lKMqz49hvPRnFiejp8NamMypQSGxjYJsexYuR2bm6FAfLayAQoWXwEk4M9S5QQ8DFcK3fR94LX5TBmuw3UA4MMdW71uDwulpYScCtyQSe62nFjYmxTDqYBJTTps7P90iS9J4hKzqFawpL8O4GH/IFC0anJvD85e9wLXEn62gBwl7yhgKfAvxMLhv3WG0YnZ7UiaGKeQuKcMLzBFZYrBhLTuHFy9+jZ+wvrWR5mrwh8UcAm7NJuvOdOFXZgC+HB9ASkwNRu1U4VuF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FOc7C0TlQcg4mDuJTMwApBxsQ4WZsCz7naXtHd1gJijdTIyRsrZLc1MUVC7Jc0CJTe3tLFEReOWDCuZJConerioBaJmisYiGrBsVURLJ1pfWRBkkRKFUxZz2cGQnR7hEQOA5+v6HP4AJCt9udWWhiIAAAAASUVORK5CYII=",G=r({name:"protocol",props:{showHeader:{type:Boolean,default:!1},modelValue:{type:Boolean,default:!1},userId:{type:String,default:""},musicGroupId:{type:String,default:""},courseView:{type:String,default:""},protocolTitle:{type:String,default:"\u4EA7\u54C1\u53CA\u670D\u52A1\u534F\u8BAE"}},data(){return{exists:!0,checked:this.modelValue,popupStatus:!1,protocolHTML:"",protocolPopup:null,isProtocol:!0}},async mounted(){try{if(console.log("getContractDetail"),!this.protocolHTML){const t=await y.get(m.platformApi+"/contracts/queryProduceContract",{params:{userId:this.userId?this.userId:null,musicGroupId:this.musicGroupId?this.musicGroupId:null,courseViewType:this.courseView}});this.protocolHTML=t.data.productContract||"",console.log(t),this.exists=t.data.exists,this.checked=this.checked||this.exists,this.$emit("update:modelValue",this.checked||this.exists)}this.protocolHTML||(this.isProtocol=!!this.protocolHTML,this.checked=!0,this.$emit("input",this.checked||this.exists))}catch{}this.checked=this.modelValue,window.addEventListener("hashchange",this.onHash,!1)},unmounted(){window.removeEventListener("hashchange",this.onHash,!1)},watch:{checked(t){this.$emit("update:modelValue",t)}},methods:{async getContractDetail(){try{if(console.log("getContractDetail"),!this.protocolHTML){const t=await y.get(m.platformApi+"/contracts/queryProduceContract",{params:{contractType:"BUY_ORDER"}});this.protocolHTML=t.data,console.log(t)}this.onPopupClose()}catch{}},onHash(){this.popupStatus=!1},onPopupClose(){if(this.popupStatus=!this.popupStatus,this.popupStatus){const t=this.$route;let o=0;for(let W in t.query)o+=1;const n=window.location.href,p=o>0?"&pto="+ +new Date:"?pto="+ +new Date;history.pushState("","",`${n}${p}`)}else window.history.go(-1);this.protocolPopup&&(this.protocolPopup.scrollTop=0)}},render(){return e("div",{class:this.isProtocol&&i.colProtocol},[this.isProtocol&&e(c,null,[!this.exists&&e(A,{modelValue:this.checked,"onUpdate:modelValue":t=>this.checked=t},{default:()=>[s("\u6211\u5DF2\u9605\u8BFB\u5E76\u540C\u610F")],icon:t=>e(l,{class:i.boxStyle,name:t.checked?S:F,size:"15"},null)}),this.exists&&e(c,null,[s("\u67E5\u770B")]),e("span",{onClick:this.onPopupClose,class:i.protocolText},[s("\u300A"),this.protocolTitle,s("\u300B")])]),e(f,{ref:this.protocolPopup,show:this.popupStatus,position:"bottom",style:{height:"100%"}},{default:()=>[this.showHeader&&e(C,{title:this.protocolTitle},null),this.popupStatus&&e("div",{class:i.protocolContent,id:"mProtocol"},[e("div",{class:i.protocolContent,innerHTML:this.protocolHTML},null)])]})])}});const B="_payment_mcc4r_1",L="_title_mcc4r_13",R="_payAmount_mcc4r_21",b="_amount_mcc4r_31",I="_blank_mcc4r_39",D="_message_mcc4r_42",M="_payBtn_mcc4r_48";var a={payment:B,title:L,payAmount:R,amount:b,blank:I,message:D,payBtn:M},O=r({name:"payment",props:{modelValue:{type:Boolean,default:!1},paymentWay:{type:Array,default:()=>["wx","alipay"]},orderInfo:{type:Object,default:()=>({})},onBackOut:{type:Function,default:()=>{}},paymentType:{type:String,default:"orderPay"}},data(){return{payType:"ali_app",pay_channel:"",message:"",isWx:!0,isAlipay:!0}},mounted(){this.paymentWay.length>0&&(this.isWx=this.paymentWay.indexOf("wx")!=-1,this.isAlipay=this.paymentWay.indexOf("alipay")!=-1,this.isAlipay&&(this.payType="ali_app"),this.isWx&&!this.isAlipay&&(this.payType="wx_app"),this.isAlipay?this.isWx||(this.message="\u6E29\u99A8\u63D0\u793A\uFF1A\u7531\u4E8E\u5FAE\u4FE1\u652F\u4ED8\u5347\u7EA7\uFF0C\u4E34\u65F6\u6682\u505C\u652F\u4ED8\u901A\u9053"):this.message="\u6E29\u99A8\u63D0\u793A\uFF1A\u7531\u4E8E\u652F\u4ED8\u5B9D\u652F\u4ED8\u5347\u7EA7\uFF0C\u4E34\u65F6\u6682\u505C\u652F\u4ED8\u901A\u9053",console.log({isWx:this.isWx,isAlipay:this.isAlipay}))},methods:{onClose(){g.confirm({message:"\u662F\u5426\u653E\u5F03\u672C\u6B21\u4ED8\u6B3E",confirmButtonText:"\u7EE7\u7EED\u4ED8\u6B3E",cancelButtonText:"\u653E\u5F03"}).then(()=>{}).catch(async()=>{this.onCancel()})},async onCancel(t){this.$emit("update:modelValue",!1),!t&&this.$router.go(-1),this.onBackOut&&this.onBackOut()},async onSubmit(){try{console.log(this.orderInfo,"orderInfo payment"),u.loading({message:"\u652F\u4ED8\u4E2D...",forbidClick:!0,duration:3e3,loadingType:"spinner"});const t=this.payType,o=window.navigator.userAgent.toLowerCase();o.match(/MicroMessenger/i)+""=="micromessenger"?t=="ali_app"?(this.pay_channel="alipay_qr",this.getCodePay("qrCode")):t=="wx_app"&&(this.pay_channel="wx_pub",this.getCodePay("pay")):o.match(/AlipayClient/i)+""=="alipayclient"?t=="ali_app"?(this.pay_channel="alipay_wap",this.getCodePay("pay")):t=="wx_app"&&(this.pay_channel="wx_pub",this.getCodePay("qrCode")):(t=="ali_app"?this.pay_channel="alipay_qr":t=="wx_app"&&(this.pay_channel="wx_pub"),this.getCodePay("qrCode")),this.$emit("update:modelValue",!1),setTimeout(()=>{u.clear()},1e3)}catch(t){console.log(t)}},getCodePay(t){let o=P();t=="qrCode"?o+="/#/payQRCode":o+="/#/payResult";const n=this.orderInfo;n.payMap.returnUrl=n.payMap.returnUrl.replace(/&/gi,"^^");const p=sessionStorage.getItem("navHeight")||0;o+=`?payType=${this.pay_channel}&payment=${JSON.stringify(this.orderInfo)}&navHeight=${p}'&platform=goods`,window.location.replace(o)}},render(){return e("div",{class:a.payment},[e(l,{onClick:this.onClose,name:"cross",size:20},null),e("div",{class:[a.title,"van-hairline--bottom"]},[s("\u9009\u62E9\u652F\u4ED8\u65B9\u5F0F")]),e("div",{class:a.payAmount},[e("p",null,[s("\u5E94\u4ED8\u91D1\u989D")]),e("div",{class:a.amount},[this.$filters.moneyFormat(this.orderInfo.payMap.amount||0),e("span",null,[s("\u5143")])])]),e(w,{modelValue:this.payType,"onUpdate:modelValue":t=>this.payType=t},{default:()=>[e(T,{border:!1},{default:()=>[e(h,{title:"\u652F\u4ED8\u5B9D\u652F\u4ED8",border:!1,center:!0,onClick:()=>{!this.isAlipay||(this.payType="ali_app")}},{icon:()=>e(l,{name:"alipay",color:"#009fe9",size:22},null),"right-icon":()=>e(d,{name:"ali_app",disabled:!this.isAlipay},null)}),e(h,{title:"\u5FAE\u4FE1\u652F\u4ED8",border:!1,center:!0,onClick:()=>{!this.isWx||(this.payType="wx_app")}},{icon:()=>e(l,{name:"wechat-pay",color:"#15c434",size:22},null),"right-icon":()=>e(d,{name:"wx_app",disabled:!this.isWx},null)})]})]}),e("div",{class:a.blank},[this.message&&e("p",{class:a.message},[this.message])]),e(x,{type:"primary",class:a.payBtn,block:!0,round:!0,onClick:this.onSubmit},{default:()=>[s("\u786E\u8BA4\u652F\u4ED8")]})])}});export{G as C,O as P};