2 lines
14 KiB
JavaScript
Executable File
2 lines
14 KiB
JavaScript
Executable File
import{d as e,A as a,o as t,c as s,w as l,b as r,h as i,x as o,E as n,l as u,t as d,g as c,s as p,k as h,y as f,r as m,a as y,z as _,aQ as b,a8 as x,af as g,aZ as w,N as v,e as S,F as C,f as D,ab as k,a_ as z,a$ as I,b0 as $,az as N,H as V,a1 as P,b1 as j,m as A,W as F,aa as U,I as L,i as E}from"./index.26a6cf84.js";import{_ as R}from"./u-button.ae3a4a51.js";import{_ as B,a as O,b as W,g as T,p as q}from"./pay.7f11ad07.js";import{f as G,s as H}from"./util.871c1879.js";import{_ as M}from"./plugin-vue_export-helper.21dcd24c.js";import{_ as X}from"./u-icon.7191c6e8.js";import{E as Q}from"./emitter.5b880544.js";import{_ as Z}from"./u-popup.08086621.js";import{u as J}from"./useLockFn.4d99e11c.js";import{r as K,a as Y}from"./recharge.ff7c9ddf.js";var ee=M(e({__name:"price",props:{content:{default:""},prec:{default:2},autoPrec:{type:Boolean,default:!0},color:{default:"#FA8919"},mainSize:{default:"36rpx"},minorSize:{default:"28rpx"},lineThrough:{type:Boolean,default:!1},fontWeight:{default:"normal"},prefix:{default:"¥"},suffix:{default:""}},setup(e){const m=e,y=a((()=>G({price:m.content,take:"int"}))),_=a((()=>{let e=G({price:m.content,take:"dec",prec:m.prec});return e=e%10==0?e.substr(0,e.length-1):e,m.autoPrec?1*e?"."+e:"":m.prec?"."+e:""}));return(a,m)=>{const b=h,x=f;return t(),s(b,{class:"price-container"},{default:l((()=>[r(b,{class:p(["price-wrap",{"price-wrap--disabled":e.lineThrough}]),style:o({color:e.color})},{default:l((()=>[i(" Prefix "),r(b,{class:"fix-pre",style:o({fontSize:e.minorSize})},{default:l((()=>[n(a.$slots,"prefix",{},(()=>[u(d(e.prefix),1)]),!0)])),_:3},8,["style"]),i(" Content "),r(b,{style:o({"font-weight":e.fontWeight})},{default:l((()=>[i(" Integer "),r(x,{style:o({fontSize:e.mainSize})},{default:l((()=>[u(d(c(y)),1)])),_:1},8,["style"]),i(" Decimals "),r(x,{style:o({fontSize:e.minorSize})},{default:l((()=>[u(d(c(_)),1)])),_:1},8,["style"])])),_:1},8,["style"]),i(" Suffix "),r(b,{class:"fix-suf",style:o({fontSize:e.minorSize})},{default:l((()=>[n(a.$slots,"suffix",{},(()=>[u(d(e.suffix),1)]),!0)])),_:3},8,["style"])])),_:3},8,["class","style"])])),_:3})}}}),[["__scopeId","data-v-171c6bc6"]]);var ae=M({name:"u-radio",emits:["change"],props:{name:{type:[String,Number],default:""},size:{type:[String,Number],default:34},shape:{type:String,default:""},disabled:{type:[String,Boolean],default:""},labelDisabled:{type:[String,Boolean],default:""},activeColor:{type:String,default:""},iconSize:{type:[String,Number],default:""},labelSize:{type:[String,Number],default:""}},data:()=>({parentData:{iconSize:null,labelDisabled:null,disabled:null,shape:null,activeColor:null,size:null,width:null,height:null,value:null,wrap:null}}),created(){this.parent=!1,this.updateParentData(),this.parent.children.push(this)},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:34},elIconSize(){return this.iconSize?this.iconSize:this.parentData.iconSize?this.parentData.iconSize:20},elActiveColor(){return this.activeColor?this.activeColor:this.parentData.activeColor?this.parentData.activeColor:"primary"},elShape(){return this.shape?this.shape:this.parentData.shape?this.parentData.shape:"circle"},iconStyle(){let e={};return this.elActiveColor&&this.parentData.value===this.name&&!this.elDisabled&&(e.borderColor=this.elActiveColor,e.backgroundColor=this.elActiveColor),e.width=this.$u.addUnit(this.elSize),e.height=this.$u.addUnit(this.elSize),e},iconColor(){return this.name===this.parentData.value?"#ffffff":"transparent"},iconClass(){let e=[];return e.push("u-radio__icon-wrap--"+this.elShape),this.name===this.parentData.value&&e.push("u-radio__icon-wrap--checked"),this.elDisabled&&e.push("u-radio__icon-wrap--disabled"),this.name===this.parentData.value&&this.elDisabled&&e.push("u-radio__icon-wrap--disabled--checked"),e.join(" ")},radioStyle(){let e={};return this.parentData.width&&(e.width=this.$u.addUnit(this.parentData.width),e.flex=`0 0 ${this.$u.addUnit(this.parentData.width)}`),this.parentData.wrap&&(e.width="100%",e.flex="0 0 100%"),e}},methods:{updateParentData(){this.getParentData("u-radio-group")},onClickLabel(){this.elLabelDisabled||this.elDisabled||this.setRadioCheckedStatus()},toggle(){this.elDisabled||this.setRadioCheckedStatus()},emitEvent(){this.parentData.value!=this.name&&this.$emit("change",this.name)},setRadioCheckedStatus(){this.emitEvent(),this.parent&&(this.parent.setValue(this.name),this.parentData.value=this.name)}}},[["render",function(e,a,i,u,d,c){const f=m(y("u-icon"),X),_=h;return t(),s(_,{class:"u-radio",style:o([c.radioStyle])},{default:l((()=>[r(_,{class:p(["u-radio__icon-wrap",[c.iconClass]]),onClick:c.toggle,style:o([c.iconStyle])},{default:l((()=>[r(f,{class:"u-radio__icon-wrap__icon",name:"checkbox-mark",size:c.elIconSize,color:c.iconColor},null,8,["size","color"])])),_:1},8,["onClick","class","style"]),r(_,{class:"u-radio__label",onClick:c.onClickLabel,style:o({fontSize:e.$u.addUnit(i.labelSize)})},{default:l((()=>[n(e.$slots,"default",{},void 0,!0)])),_:3},8,["onClick","style"])])),_:3},8,["style"])}],["__scopeId","data-v-1458021f"]]);var te=M({name:"u-radio-group",emits:["update:modelValue","input","change"],mixins:[Q],props:{value:{type:[String,Number],default:""},modelValue:{type:[String,Number],default:""},disabled:{type:Boolean,default:!1},activeColor:{type:String,default:"#2979ff"},size:{type:[String,Number],default:34},labelDisabled:{type:Boolean,default:!1},shape:{type:String,default:"circle"},iconSize:{type:[String,Number],default:20},width:{type:[String,Number],default:"auto"},wrap:{type:Boolean,default:!1}},data:()=>({uFromData:{inputAlign:"left"}}),created(){this.children=[]},mounted(){let e=this.$u.$parent.call(this,"u-form");e&&Object.keys(this.uFromData).map((a=>{this.uFromData[a]=e[a]}))},watch:{parentData(){this.children.length&&this.children.map((e=>{"function"==typeof e.updateParentData&&e.updateParentData()}))}},computed:{valueCom(){return this.modelValue},parentData(){return[this.valueCom,this.disabled,this.activeColor,this.size,this.labelDisabled,this.shape,this.iconSize,this.width,this.wrap]}},methods:{setValue(e){this.children.map((a=>{a.parentData.value!=e&&(a.parentData.value="")})),this.$emit("input",e),this.$emit("update:modelValue",e),this.$emit("change",e),setTimeout((()=>{this.dispatch("u-form-item","onFieldChange",e)}),60)}}},[["render",function(e,a,r,i,o,u){const d=h;return t(),s(d,{class:p(["u-radio-group u-clearfix","right"==o.uFromData.inputAlign?"flex-end":""])},{default:l((()=>[n(e.$slots,"default",{},void 0,!0)])),_:3},8,["class"])}],["__scopeId","data-v-b8b0ce5a"]]);var se=M(e({__name:"payment",props:{show:{type:Boolean,required:!0},showCheck:{type:Boolean},orderId:{type:Number,required:!0},from:{type:String,required:!0},redirect:{type:String}},emits:["update:showCheck","update:show","close","success","fail"],setup(e,{emit:i}){const o=e,n=_(),p=_(b.LOADING),f=_({order_amount:"",lists:[]}),A=a({get:()=>o.showCheck,set(e){i("update:showCheck",e)}}),F=a({get:()=>o.show,set(e){i("update:show",e)}}),U=()=>{F.value=!1,i("close")},L=x(),E=H((async()=>{if(0==L.userInfo.is_auth&&[z.OA_WEIXIN,z.MP_WEIXIN].includes(I)&&n.value==$.WECHAT)return(await N({title:"温馨提示",content:"当前账号未绑定微信,无法完成支付",confirmText:"去绑定"})).confirm&&V({url:"/pages/user_set/user_set"}),Promise.reject()}),(async()=>(P({title:"正在支付中"}),await q({order_id:o.orderId,from:o.from,pay_way:n.value,redirect:o.redirect}))),(async e=>{try{return await j.payment(e.pay_way,e.config)}catch(a){return Promise.reject(a)}})),{isLock:G,lockFn:M}=J((async()=>{try{const e=await E();Q(e),g()}catch(e){g(),console.log(e)}})),Q=e=>{switch(e){case w.SUCCESS:i("success");break;case w.FAIL:i("fail")}},K=async(e=!0)=>{0===(await T({order_id:o.orderId,from:o.from})).pay_status?(1==e&&uni.$u.toast("您的订单还未支付,请重新支付"),F.value=!0,Q(w.FAIL)):(0==e&&uni.$u.toast("您的订单已经支付,请勿重新支付"),Q(w.SUCCESS)),A.value=!1};return v((()=>o.show),(e=>{if(e){if(!o.orderId)return void(p.value=b.ERROR);(async()=>{p.value=b.LOADING;try{f.value=await W({order_id:o.orderId,from:o.from}),p.value=b.NORMAL;const e=f.value.lists.find((e=>e.is_default))||f.value.lists[0];n.value=null==e?void 0:e.pay_way}catch(e){p.value=b.ERROR}})()}}),{immediate:!0}),(e,a)=>{const i=m(y("u-empty"),B),o=m(y("price"),ee),_=h,b=m(y("u-icon"),X),x=m(y("u-radio"),ae),g=m(y("u-radio-group"),te),w=m(y("u-button"),R),v=m(y("page-status"),O),z=m(y("u-popup"),Z);return t(),S(C,null,[r(z,{modelValue:c(F),"onUpdate:modelValue":a[1]||(a[1]=e=>k(F)?F.value=e:null),mode:"bottom","safe-area-inset-bottom":"","mask-close-able":!1,"border-radius":"14",closeable:"",onClose:U},{default:l((()=>[r(_,{class:"h-[900rpx]"},{default:l((()=>[r(v,{status:p.value,fixed:!1},{error:l((()=>[r(i,{text:"订单信息错误,无法查询到订单信息",mode:"order"})])),default:l((()=>[r(_,{class:"payment h-full w-full flex flex-col"},{default:l((()=>[r(_,{class:"header py-[50rpx] flex flex-col items-center"},{default:l((()=>[r(o,{content:f.value.order_amount,mainSize:"44rpx",minorSize:"40rpx",fontWeight:"500",color:"#333"},null,8,["content"])])),_:1}),r(_,{class:"main flex-1 mx-[20rpx]"},{default:l((()=>[r(_,null,{default:l((()=>[r(_,{class:"payway-lists"},{default:l((()=>[r(g,{modelValue:n.value,"onUpdate:modelValue":a[0]||(a[0]=e=>n.value=e),class:"w-full"},{default:l((()=>[(t(!0),S(C,null,D(f.value.lists,((e,a)=>(t(),s(_,{class:"p-[20rpx] flex items-center w-full payway-item",key:a,onClick:a=>{return t=e.pay_way,void(n.value=t);var t}},{default:l((()=>[r(b,{class:"flex-none",size:48,name:e.icon},null,8,["name"]),r(_,{class:"mx-[16rpx] flex-1"},{default:l((()=>[r(_,{class:"payway-item--name flex-1"},{default:l((()=>[u(d(e.name),1)])),_:2},1024),r(_,{class:"text-muted text-xs"},{default:l((()=>[u(d(e.extra),1)])),_:2},1024)])),_:2},1024),r(x,{class:"mr-[-20rpx]",name:e.pay_way},null,8,["name"])])),_:2},1032,["onClick"])))),128))])),_:1},8,["modelValue"])])),_:1})])),_:1})])),_:1}),r(_,{class:"submit-btn p-[20rpx]"},{default:l((()=>[r(w,{onClick:c(M),shape:"circle",type:"primary",loading:c(G)},{default:l((()=>[u(" 立即支付 ")])),_:1},8,["onClick","loading"])])),_:1})])),_:1})])),_:1},8,["status"])])),_:1})])),_:1},8,["modelValue"]),r(z,{class:"pay-popup",modelValue:c(A),"onUpdate:modelValue":a[4]||(a[4]=e=>k(A)?A.value=e:null),round:"",mode:"center",borderRadius:"10",maskCloseAble:!1},{default:l((()=>[r(_,{class:"content bg-white w-[560rpx] p-[40rpx]"},{default:l((()=>[r(_,{class:"text-2xl font-medium text-center"},{default:l((()=>[u(" 支付确认 ")])),_:1}),r(_,{class:"pt-[30rpx] pb-[40rpx]"},{default:l((()=>[r(_,null,{default:l((()=>[u(" 请在微信内完成支付,如果您已支付成功,请点击`已完成支付`按钮 ")])),_:1})])),_:1}),r(_,{class:"flex"},{default:l((()=>[r(_,{class:"flex-1 mr-[20rpx]"},{default:l((()=>[r(w,{shape:"circle",type:"primary",plain:"",size:"medium","hover-class":"none",customStyle:{width:"100%"},onClick:a[2]||(a[2]=e=>K(!1))},{default:l((()=>[u(" 重新支付 ")])),_:1})])),_:1}),r(_,{class:"flex-1"},{default:l((()=>[r(w,{shape:"circle",type:"primary",size:"medium","hover-class":"none",customStyle:{width:"100%"},onClick:a[3]||(a[3]=e=>K())},{default:l((()=>[u(" 已完成支付 ")])),_:1})])),_:1})])),_:1})])),_:1})])),_:1},8,["modelValue"])],64)}}}),[["__scopeId","data-v-851e5f30"]]);const le=e({__name:"recharge",setup(e){const a=_(""),i=A({orderId:"",from:"",showPay:!1,showCheck:!1,redirect:"/packages/pages/recharge/recharge"}),o=A({user_money:"",min_amount:0}),{isLock:n,lockFn:p}=J((async()=>{const e=o.min_amount;if(!a.value)return uni.$u.toast("请输入充值金额");if(0==e&&Number(a.value)==e)return uni.$u.toast("充值金额必须大于0");if(Number(a.value)<e)return uni.$u.toast(`最低充值金额${e}`);const t=await Y({money:a.value});i.orderId=t.order_id,i.from=t.from,i.showPay=!0})),b=async()=>{i.showPay=!1,i.showCheck=!1,V({url:`/pages/payment_result/payment_result?id=${i.orderId}&from=${i.from}`})},x=async()=>{uni.$u.toast("支付失败")};return F((e=>{(null==e?void 0:e.checkPay)&&(i.orderId=e.id,i.from=e.from,i.showCheck=!0)})),U((()=>{(async()=>{const e=await K();Object.assign(o,e)})()})),(e,_)=>{const g=h,w=L,v=f,S=m(y("u-button"),R),C=E,D=m(y("payment"),se);return t(),s(g,{class:"recharge p-[20rpx]"},{default:l((()=>[r(g,{class:"bg-white rounded-[14rpx] p-[40rpx]"},{default:l((()=>[r(g,{class:"text-content"},{default:l((()=>[u("充值金额")])),_:1}),r(g,{class:"border-0 border-b border-solid border-light"},{default:l((()=>[r(w,{modelValue:a.value,"onUpdate:modelValue":_[0]||(_[0]=e=>a.value=e),class:"text-[60rpx] h-[60rpx] py-[24rpx]",placeholder:"0.00",type:"digit"},null,8,["modelValue"])])),_:1}),r(g,{class:"mt-[20rpx] text-xs text-muted"},{default:l((()=>[u(" 当前可用余额 "),r(v,{class:"text-primary"},{default:l((()=>[u(d(o.user_money),1)])),_:1})])),_:1})])),_:1}),r(g,{class:"mt-[40rpx]"},{default:l((()=>[r(S,{loading:c(n),type:"primary",shape:"circle",onClick:c(p)},{default:l((()=>[u(" 立即充值 ")])),_:1},8,["loading","onClick"])])),_:1}),r(g,{class:"flex justify-center m-[60rpx]"},{default:l((()=>[r(C,{url:"/packages/pages/recharge_record/recharge_record","hover-class":"none"},{default:l((()=>[r(v,{class:"text-content text-sm"},{default:l((()=>[u("充值记录")])),_:1})])),_:1})])),_:1}),r(D,{show:i.showPay,"onUpdate:show":_[1]||(_[1]=e=>i.showPay=e),"show-check":i.showCheck,"onUpdate:show-check":_[2]||(_[2]=e=>i.showCheck=e),"order-id":i.orderId,from:i.from,redirect:i.redirect,onSuccess:b,onFail:x},null,8,["show","show-check","order-id","from","redirect"])])),_:1})}}});export{le as default};
|