pages-pay-index.9743df44.js 5.9 KB

1
  1. import{c as e,z as s,N as a,o as t,s as l,f as o,g as d,w as r,b$ as u,c0 as n,c1 as i,m as c,k as p,u as m,v as f,x as y,l as b,r as _,F as h,b5 as g,b6 as x,E as S,I as T,j as k,ap as v,J as C,n as I,y as $,K as O,L as U}from"./index-a116b7fa.js";import{a as q,b as w,d as R}from"./phone-international-input.b9f6c8e6.js";import{_ as D}from"./s-layout.4ae51839.js";import{u as j,f as V}from"./useGoods.6b315a78.js";import"./md5.09e73eca.js";import{_ as B}from"./_plugin-vue_export-helper.1b428a4d.js";const F=B({__name:"index",setup(B){e((()=>l.$store("user").userWallet));const F=e((()=>l.$store("user").userInfo)),M=s({orderType:"goods",orderInfo:{},payStatus:0,payMethods:[],payment:"",model:{id:"",smsCodeUseReqDTO:{mobile:"",code:"",scene:12},orderType:0},rules:{"smsCodeUseReqDTO.code":{rules:[{required:!0,errorMessage:"验证码不能为空"}]}}}),W=()=>{""!==M.payment?l.$platform.pay(M.payment,M.orderType,M.orderInfo.id,M.model.type):l.$helper.toast("请选择支付方式")},z=a(null),N=async()=>{if(!(await y(z).validate().catch((e=>{console.log("error: ",e)}))))return;const{code:e,data:s}=await u.ZeroPurchaseSubmit(M.model);s&&l.$router.redirect("/pages/pay/resultYuan",{id:M.model.id,orderType:M.orderType,payState:"success",payRes:JSON.stringify(s)})},P=e((()=>{if(2===M.payStatus)return"该订单已支付";if(1===M.payStatus){const e=j(M.orderInfo.expireTime);return e.ms<=0?(M.payStatus=-1,""):`剩余支付时间 ${e.h}:${e.m}:${e.s} `}return-2===M.payStatus?"未查询到支付单信息":""}));function E(e){M.payment=e.detail.value}async function G(e){const{data:s,code:a}=await u.getOrder(e);0===a&&s?(M.orderInfo=s,await async function(){const{data:e,code:s}=await n.getEnableChannelCodeList(M.orderInfo.appId);if(0!==s)return;M.payMethods=i(e)}(),10!==M.orderInfo.status&&20!==M.orderInfo.status?30!==M.orderInfo.status?M.payStatus=1:M.payStatus=-1:M.payStatus=2):M.payStatus=-2}return t((e=>{if("WechatOfficialAccount"===l.$platform.name&&"ios"===l.$platform.os&&!l.$platform.landingPage.includes("pages/pay/index"))return void location.reload();let s=e.id;e.type,M.model.id=e.id,M.model.type=e.type,e.orderType&&(M.orderType=e.orderType),G(s),l.$store("user").getWallet(),M.model.smsCodeUseReqDTO.mobile=F.value.mobile})),(e,s)=>{const a=T,t=k,u=$,n=O,i=U,j=v,B=C,F=c(I("uni-easyinput"),q),G=c(I("uni-forms-item"),w),J=c(I("uni-forms"),R),L=c(I("s-layout"),D);return o(),d(L,{title:"收银台"},{default:r((()=>[p(t,{class:"bg-white ss-modal-box ss-flex-col"},{default:r((()=>[p(t,{class:"modal-header ss-flex-col ss-col-center ss-row-center"},{default:r((()=>[p(t,{class:"money-box ss-m-b-20"},{default:r((()=>[p(a,{class:"money-text"},{default:r((()=>[m(f(y(V)(M.orderInfo.price)),1)])),_:1})])),_:1}),p(t,{class:"time-text"},{default:r((()=>[p(a,null,{default:r((()=>[m(f(P.value),1)])),_:1})])),_:1})])),_:1}),M.orderInfo.price?(o(),d(t,{key:0,class:"modal-content ss-flex-1"},{default:r((()=>[p(t,{class:"pay-title ss-p-l-30 ss-m-y-30"},{default:r((()=>[m("选择支付方式")])),_:1}),p(j,{onChange:E},{default:r((()=>[(o(!0),b(h,null,_(M.payMethods,(e=>(o(),d(i,{class:"pay-type-item",key:e.title},{default:r((()=>[p(t,{class:S(["pay-item ss-flex ss-col-center ss-row-between ss-p-x-30 border-bottom",{"disabled-pay-item":e.disabled}])},{default:r((()=>[p(t,{class:"ss-flex ss-col-center"},{default:r((()=>[e.disabled?(o(),d(u,{key:0,class:"pay-icon",src:y(l).$url.static("/static/img/shop/pay/cod_disabled.png"),mode:"aspectFit"},null,8,["src"])):(o(),d(u,{key:1,class:"pay-icon",src:e.icon,mode:"aspectFit"},null,8,["src"])),p(a,{class:"pay-title"},{default:r((()=>[m(f(e.title),1)])),_:2},1024)])),_:2},1024),p(t,{class:"check-box ss-flex ss-col-center ss-p-l-10"},{default:r((()=>[p(n,{value:e.value,color:"var(--ui-BG-Main)",style:{transform:"scale(0.8)"},disabled:e.disabled,checked:M.payment===e.value},null,8,["value","disabled","checked"])])),_:2},1024)])),_:2},1032,["class"])])),_:2},1024)))),128))])),_:1})])),_:1})):(o(),d(t,{key:1,class:""},{default:r((()=>[p(J,{model:M.model,rules:M.rules,validateTrigger:"bind",labelPosition:"left",border:"",class:"form-box",labelWidth:"200",ref_key:"FormRef",ref:z},{default:r((()=>[p(t,{class:"bg-white ss-p-x-30"},{default:r((()=>[p(G,{name:"mobile",label:"手机号",class:"mobile loginUniFormItem ss-p-t-10"},{default:r((()=>[p(F,{modelValue:M.model.smsCodeUseReqDTO.mobile,"onUpdate:modelValue":s[1]||(s[1]=e=>M.model.smsCodeUseReqDTO.mobile=e),type:"smsCodeUseReqDTO",placeholder:"请输入手机号",inputBorder:!1,clearable:!1,disabled:!0},{right:r((()=>[p(B,{class:"ss-reset-button code-btn code-btn-start",disabled:1!==M.payStatus,onClick:s[0]||(s[0]=e=>y(g)("zeroBuy",M.model.smsCodeUseReqDTO.mobile))},{default:r((()=>[m(f(y(x)("zeroBuy")),1)])),_:1},8,["disabled"])])),_:1},8,["modelValue"])])),_:1}),p(G,{name:"smsCodeUseReqDTO.code",label:"验证码",required:!0},{default:r((()=>[p(F,{modelValue:M.model.smsCodeUseReqDTO.code,"onUpdate:modelValue":s[2]||(s[2]=e=>M.model.smsCodeUseReqDTO.code=e),type:"number",placeholder:"请输入验证码",inputBorder:!1,clearable:!1},null,8,["modelValue"])])),_:1})])),_:1})])),_:1},8,["model","rules"])])),_:1})),p(t,{class:"modal-footer ss-flex ss-row-center ss-col-center ss-m-t-80 ss-m-b-40"},{default:r((()=>[0===M.payStatus?(o(),d(B,{key:0,class:"ss-reset-button past-due-btn"},{default:r((()=>[m(" 检测支付环境中 ")])),_:1})):-1===M.payStatus?(o(),d(B,{key:1,class:"ss-reset-button past-due-btn",disabled:""},{default:r((()=>[m(" 支付已过期 ")])),_:1})):1===M.payStatus&&M.orderInfo.price?(o(),d(B,{key:2,class:S(["ss-reset-button save-btn",{"disabled-btn":1!==M.payStatus}]),onClick:W,disabled:1!==M.payStatus},{default:r((()=>[m(" 立即支付 ")])),_:1},8,["disabled","class"])):(o(),d(B,{key:3,class:S(["ss-reset-button save-btn",{"disabled-btn":1!==M.payStatus}]),onClick:N,disabled:1!==M.payStatus},{default:r((()=>[m(" 立即支付 ")])),_:1},8,["disabled","class"]))])),_:1})])),_:1})])),_:1})}}},[["__scopeId","data-v-f324c017"]]);export{F as default};