2 lines
8.9 KiB
JavaScript
2 lines
8.9 KiB
JavaScript
var e,t,a,i;import{u as n}from"./useInterface.f3e95e31.js";import{aJ as l,aK as r,x as o,y as s,o as c,c as p,w as d,j as u,n as h,A as m,d as b,g as f,a as y,p as S,h as v,t as g,B as C}from"./index-3714412c.js";import{w as D}from"./order.770d13ec.js";import{_ as k}from"./_plugin-vue_export-helper.1b428a4d.js";import{_ as w}from"./uv-icon.c593f91d.js";import{r as z}from"./useRouter.f44141c1.js";const{loading:_,hideLoading:P}=n(),x="weixin_h5",I="weixin_applet",$="weixin_app",B={0:"wechat",1:"balance",2:"alipay"},j="app",L="miniProgram",N="h5InWechat",H="h5OutWechat";async function W(e){_({title:"支付中..."});const t=await async function(e){const{type:t,payInfo:a}=e;let i;if(t===B[0])switch(function(){let e;return e=r()?N:H,e}()){case j:i=await function(e){return new Promise((async(t,a)=>{const i=await A({from:"app",paytype:$,uni:e.orderId}),n={appid:i.appId,prepayid:i.merchant_id,timestamp:i.timeStamp,sign:i.paySign,partnerid:i.out_trade_no,noncestr:i.nonceStr,package:"Sign=WXPay"};uni.requestPayment({provider:"wxpay",orderInfo:n,success:e=>t(l("用户支付成功",e)),fail:e=>a(l("用户支付失败",e))})}))}(a);break;case L:i=await function(e){return new Promise((async(t,a)=>{const i=await A({from:"routine",paytype:I,uni:e.orderId});uni.requestPayment({timeStamp:i.timeStamp,nonceStr:i.nonceStr,signType:i.signType,paySign:i.paySign,package:i.package,provider:"wxpay",success:e=>t(l("用户支付成功",e)),fail:e=>a(l("用户支付失败",e))})}))}(a);break;case N:i=await async function(e){return new Promise((async(t,a)=>{const i=await A({from:"h5",paytype:x,uni:e.orderId});jweixin.config({debug:!1,appId:i.appId,timestamp:i.timeStamp,nonceStr:i.nonceStr,signature:i.paySign,jsApiList:["chooseWXPay"]}),jweixin.ready((()=>{jweixin.checkJsApi({jsApiList:["chooseWXPay"],success:()=>{},fail:e=>a(l("微信版本过低,请升级微信版本",e))}),jweixin.chooseWXPay({timestamp:i.timeStamp,nonceStr:i.nonceStr,package:i.package,signType:i.signType,paySign:i.paySign,success:e=>t(l("用户支付成功",e)),cancel:e=>a(l("用户取消支付",{})),fail:e=>a(l("跳转微信支付失败",e))})})),jweixin.error((e=>a(l("JS-SDK加载错误",e))))}))}(a);break;case H:i=await async function(e){const t=await A({from:"h5",paytype:x,uni:e.orderId});return t&&t.mwebUrl?(location.replace(t.mwebUrl),Promise.resolve(l("用户支付成功",{type:"h5"}))):Promise.reject(l("服务端拉起支付失败",{type:"h5",error:t}))}(a)}t===B[2]&&(i=await Promise.reject("暂不支持支付宝支付"));return i}(e);return P(),t}async function A(e){return await D(e)}const T=k({name:"uv-radio-group",mixins:[o,s,{props:{value:{type:[String,Number,Boolean],default:""},modelValue:{type:[String,Number,Boolean],default:""},disabled:{type:Boolean,default:!1},shape:{type:String,default:"circle"},activeColor:{type:String,default:"#2979ff"},inactiveColor:{type:String,default:"#c8c9cc"},name:{type:String,default:""},size:{type:[String,Number],default:18},placement:{type:String,default:"row"},label:{type:[String],default:""},labelColor:{type:[String],default:"#303133"},labelSize:{type:[String,Number],default:14},labelDisabled:{type:Boolean,default:!1},iconColor:{type:String,default:"#fff"},iconSize:{type:[String,Number],default:12},borderBottom:{type:Boolean,default:!1},iconPlacement:{type:String,default:"left"},...null==(t=null==(e=uni.$uv)?void 0:e.props)?void 0:t.radioGroup}}],computed:{parentData(){return[this.value||this.modelValue,this.disabled,this.inactiveColor,this.activeColor,this.size,this.labelDisabled,this.shape,this.iconSize,this.borderBottom,this.placement]},bemClass(){return this.bem("radio-group",["placement"])}},watch:{parentData(){this.children.length&&this.children.map((e=>{"function"==typeof e.init&&e.init()}))}},data:()=>({}),created(){this.children=[]},methods:{unCheckedOther(e){this.children.map((t=>{e!==t&&(t.checked=!1)}));const{name:t}=e;this.$emit("update:modelValue",t),this.$emit("change",t)}}},[["render",function(e,t,a,i,n,l){const r=b;return c(),p(r,{class:h(["uv-radio-group",l.bemClass]),style:m([e.$uv.addStyle(this.customStyle)])},{default:d((()=>[u(e.$slots,"default",{},void 0,!0)])),_:3},8,["class","style"])}],["__scopeId","data-v-fe601beb"]]);const V=k({name:"uv-radio",mixins:[o,s,{props:{name:{type:[String,Number,Boolean],default:""},shape:{type:String,default:""},disabled:{type:[String,Boolean],default:""},labelDisabled:{type:[String,Boolean],default:""},activeColor:{type:String,default:""},inactiveColor:{type:String,default:""},iconSize:{type:[String,Number],default:""},labelSize:{type:[String,Number],default:""},label:{type:[String,Number,Boolean],default:""},size:{type:[String,Number],default:""},iconColor:{type:String,default:""},labelColor:{type:String,default:""},...null==(i=null==(a=uni.$uv)?void 0:a.props)?void 0:i.radio}}],data:()=>({checked:!1,parentData:{iconSize:12,labelSize:14,labelDisabled:null,disabled:null,shape:null,activeColor:null,inactiveColor:null,size:18,value:null,modelValue:null,iconColor:null,placement:"row",borderBottom:!1,iconPlacement:"left"}}),computed:{elDisabled(){return""!==this.disabled?this.disabled:null!==this.parentData.disabled&&this.parentData.disabled},elLabelDisabled(){return""!==this.labelDisabled?this.labelDisabled:null!==this.parentData.labelDisabled&&this.parentData.labelDisabled},elSize(){return this.size?this.size:this.parentData.size?this.parentData.size:21},elIconSize(){return this.iconSize?this.iconSize:this.parentData.iconSize?this.parentData.iconSize:12},elActiveColor(){return this.activeColor?this.activeColor:this.parentData.activeColor?this.parentData.activeColor:"#2979ff"},elInactiveColor(){return this.inactiveColor?this.inactiveColor:this.parentData.inactiveColor?this.parentData.inactiveColor:"#c8c9cc"},elLabelColor(){return this.labelColor?this.labelColor:this.parentData.labelColor?this.parentData.labelColor:"#606266"},elShape(){return this.shape?this.shape:this.parentData.shape?this.parentData.shape:"circle"},elLabelSize(){return this.$uv.addUnit(this.labelSize?this.labelSize:this.parentData.labelSize?this.parentData.labelSize:"15")},elIconColor(){const e=this.iconColor?this.iconColor:this.parentData.iconColor?this.parentData.iconColor:"#ffffff";return this.elDisabled?this.checked?this.elInactiveColor:"transparent":this.checked?e:"transparent"},iconClasses(){let e=[];return e.push("uv-radio__icon-wrap--"+this.elShape),this.elDisabled&&e.push("uv-radio__icon-wrap--disabled"),this.checked&&this.elDisabled&&e.push("uv-radio__icon-wrap--disabled--checked"),e},iconWrapStyle(){const e={};return e.backgroundColor=this.checked&&!this.elDisabled?this.elActiveColor:"#ffffff",e.borderColor=this.checked&&!this.elDisabled?this.elActiveColor:this.elInactiveColor,e.width=this.$uv.addUnit(this.elSize),e.height=this.$uv.addUnit(this.elSize),"right"===this.parentData.iconPlacement&&(e.marginRight=0),e},radioStyle(){const e={};return this.parentData.borderBottom&&"row"===this.parentData.placement&&error("检测到您将borderBottom设置为true,需要同时将uv-radio-group的placement设置为column才有效"),this.parentData.borderBottom&&"column"===this.parentData.placement&&(e.paddingBottom="ios"===this.$uv.os()?"12px":"8px"),this.$uv.deepMerge(e,this.$uv.addStyle(this.customStyle))}},mounted(){this.init()},methods:{init(){this.updateParentData(),this.parent||error("uv-radio必须搭配uv-radio-group组件使用"),this.$nextTick((()=>{let e=null;e=this.parentData.modelValue,this.checked=this.name===e}))},updateParentData(){this.getParentData("uv-radio-group")},iconClickHandler(e){this.preventEvent(e),this.elDisabled||this.setRadioCheckedStatus()},wrapperClickHandler(e){"right"===this.parentData.iconPlacement&&this.iconClickHandler(e)},labelClickHandler(e){this.preventEvent(e),this.elLabelDisabled||this.elDisabled||this.setRadioCheckedStatus()},emitEvent(){this.checked||(this.$emit("change",this.name),this.$nextTick((()=>{this.$uv.formValidate(this,"change")})))},setRadioCheckedStatus(){this.emitEvent(),this.checked=!0,"function"==typeof this.parent.unCheckedOther&&this.parent.unCheckedOther(this)}}},[["render",function(e,t,a,i,n,l){const r=z(f("uv-icon"),w),o=b,s=C;return c(),p(o,{class:h(["uv-radio",[`uv-radio-label--${n.parentData.iconPlacement}`,n.parentData.borderBottom&&"column"===n.parentData.placement&&"uv-border-bottom"]]),onClick:S(l.wrapperClickHandler,["stop"]),style:m([l.radioStyle])},{default:d((()=>[y(o,{class:h(["uv-radio__icon-wrap",l.iconClasses]),onClick:S(l.iconClickHandler,["stop"]),style:m([l.iconWrapStyle])},{default:d((()=>[u(e.$slots,"icon",{},(()=>[y(r,{class:"uv-radio__icon-wrap__icon",name:"checkbox-mark",size:l.elIconSize,color:l.elIconColor},null,8,["size","color"])]),!0)])),_:3},8,["onClick","class","style"]),u(e.$slots,"default",{},(()=>[y(s,{class:"uv-radio__text",onClick:S(l.labelClickHandler,["stop"]),style:m({color:l.elDisabled?l.elInactiveColor:l.elLabelColor,fontSize:l.elLabelSize,lineHeight:l.elLabelSize})},{default:d((()=>[v(g(e.label),1)])),_:1},8,["onClick","style"])]),!0)])),_:3},8,["onClick","style","class"])}],["__scopeId","data-v-e4830c1b"]]);export{B as P,T as _,V as a,W as d};
|