2 lines
9.1 KiB
JavaScript
2 lines
9.1 KiB
JavaScript
var e,t,a,i;import{aN as n,aO as r,aA as l,aP as o,G as s,H as c,o as p,c as d,w as u,j as h,n as m,A as f,d as b,g as y,a as S,B as g,h as v,t as C,K as D}from"./index-d76b1e7a.js";import{u as k}from"./useInterface.5df3648b.js";import{w}from"./order.6c3b873a.js";import{C as _}from"./config.166461d9.js";import{_ as z}from"./_plugin-vue_export-helper.1b428a4d.js";import{_ as I}from"./uv-icon.5730d4d2.js";import{r as P}from"./useRouter.2bdb47a0.js";const{loading:x,hideLoading:$}=k(),B="weixin_h5",j="weixin_applet",N="weixin_app",A={0:"wechat",1:"balance",2:"alipay"},L="app",H="miniProgram",O="h5InWechat",W="h5OutWechat";async function T(e){x({title:"支付中..."});const t=await async function(e){const{type:t,payInfo:a}=e;let i;if(t===A[0])switch(function(){let e;return e=o()?O:W,e}()){case L:i=await function(e){return new Promise((async(t,a)=>{const i=await V({from:N,paytype:N,uni:e.orderId}),r={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:r,success:e=>t(n("用户支付成功",e)),fail:e=>a(n("用户支付失败",e))})}))}(a);break;case H:i=await function(e){return new Promise((async(t,a)=>{const i=await V({from:j,paytype:j,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(n("用户支付成功",e)),fail:e=>a(n("用户支付失败",e))})}))}(a);break;case O:i=await async function(e){return new Promise((async(t,a)=>{const i=await V({from:"h5",paytype:B,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(n("微信版本过低,请升级微信版本",e))}),jweixin.chooseWXPay({timestamp:i.timeStamp,nonceStr:i.nonceStr,package:i.package,signType:i.signType,paySign:i.paySign,success:a=>(r(_.PAY_INFO,JSON.stringify({from:"h5",paytype:B,uni:e.orderId})),setTimeout((()=>{l({url:"/pages/payStatus/index"})}),3e3),t(n("用户支付成功",a))),cancel:e=>a(n("用户取消支付",{})),fail:e=>a(n("跳转微信支付失败",e))})})),jweixin.error((e=>a(n("JS-SDK加载错误",e))))}))}(a);break;case W:i=await async function(e){const t=await V({from:"h5",paytype:B,uni:e.orderId});return t&&t.mwebUrl?(r(_.PAY_INFO,JSON.stringify({from:"h5",paytype:B,uni:e.orderId})),location.replace(t.mwebUrl),Promise.resolve(n("用户支付成功",{type:"h5"}))):Promise.reject(n("服务端拉起支付失败",{type:"h5",error:t}))}(a)}t===A[2]&&(i=await Promise.reject("暂不支持支付宝支付"));return i}(e);return $(),t}async function V(e){return await w(e)}const E=z({name:"uv-radio-group",mixins:[s,c,{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,r){const l=b;return p(),d(l,{class:m(["uv-radio-group",r.bemClass]),style:f([e.$uv.addStyle(this.customStyle)])},{default:u((()=>[h(e.$slots,"default",{},void 0,!0)])),_:3},8,["class","style"])}],["__scopeId","data-v-af73ede3"]]);const R=z({name:"uv-radio",mixins:[s,c,{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,r){const l=P(y("uv-icon"),I),o=b,s=D;return p(),d(o,{class:m(["uv-radio",[`uv-radio-label--${n.parentData.iconPlacement}`,n.parentData.borderBottom&&"column"===n.parentData.placement&&"uv-border-bottom"]]),onClick:g(r.wrapperClickHandler,["stop"]),style:f([r.radioStyle])},{default:u((()=>[S(o,{class:m(["uv-radio__icon-wrap",r.iconClasses]),onClick:g(r.iconClickHandler,["stop"]),style:f([r.iconWrapStyle])},{default:u((()=>[h(e.$slots,"icon",{},(()=>[S(l,{class:"uv-radio__icon-wrap__icon",name:"checkbox-mark",size:r.elIconSize,color:r.elIconColor},null,8,["size","color"])]),!0)])),_:3},8,["onClick","class","style"]),h(e.$slots,"default",{},(()=>[S(s,{class:"uv-radio__text",onClick:g(r.labelClickHandler,["stop"]),style:f({color:r.elDisabled?r.elInactiveColor:r.elLabelColor,fontSize:r.elLabelSize,lineHeight:r.elLabelSize})},{default:u((()=>[v(C(e.label),1)])),_:1},8,["onClick","style"])]),!0)])),_:3},8,["onClick","style","class"])}],["__scopeId","data-v-1c99beea"]]);export{A as P,E as _,R as a,T as d};
|