"use strict";const r=require("../../common/vendor.js"),s=require("../../sheep/index.js"),o=require("../../sheep/hooks/useGoods.js"),h=require("../../sheep/api/pay/order.js"),q=require("../../sheep/api/pay/channel.js"),m=require("../../sheep/platform/pay.js");require("../../sheep/url/index.js");require("../../sheep/store/index.js");require("../../sheep/store/app.js");require("../../sheep/platform/index.js");require("../../sheep/platform/provider/wechat/index.js");require("../../sheep/platform/provider/wechat/miniProgram.js");require("../../sheep/api/member/auth.js");require("../../sheep/request/index.js");require("../../sheep/config/index.js");require("../../sheep/helper/index.js");require("../../sheep/helper/test.js");require("../../sheep/helper/digit.js");require("../../sheep/api/member/social.js");require("../../sheep/api/member/user.js");require("../../sheep/platform/provider/apple/index.js");require("../../sheep/platform/share.js");require("../../sheep/router/index.js");require("../../sheep/hooks/useModal.js");require("../../sheep/helper/throttle.js");require("../../sheep/store/user.js");require("../../sheep/store/cart.js");require("../../sheep/api/trade/cart.js");require("../../sheep/api/pay/wallet.js");require("../../sheep/api/trade/order.js");require("../../sheep/store/sys.js");require("../../sheep/store/modal.js");require("../../sheep/config/zIndex.js");Array||r.resolveComponent("s-layout")();const g=()=>"../../sheep/components/s-layout/s-layout.js";Math||g();const S={__name:"index",setup(c){const u=r.computed(()=>s.sheep.$store("user").userWallet),e=r.reactive({orderType:"goods",orderInfo:{},payStatus:0,payMethods:[],payment:""}),l=()=>{let t=u.value.balance,n=o.fen2yuan(e.orderInfo.price);if(e.payment===""){s.sheep.$helper.toast("请选择支付方式");return}e.payment==="wallet"?parseInt(n)>t?r.index.showModal({title:"提示",content:"余额不足,请先充值或选择其他支付方式",success:function(a){if(a.confirm)s.sheep.$router.go("/pages/home/wallet/index");else return}}):r.index.showModal({title:"提示",content:"确定要支付吗?",success:function(a){a.confirm&&(r.index.setStorageSync("un_type_info",p.value),s.sheep.$platform.pay(e.payment,e.orderType,e.orderInfo.id))}}):s.sheep.$platform.pay(e.payment,e.orderType,e.orderInfo.id)},d=r.computed(()=>{if(e.payStatus===2)return"该订单已支付";if(e.payStatus===1){const t=o.useDurationTime(e.orderInfo.expireTime);return t.ms<=0?(e.payStatus=-1,""):`剩余支付时间 ${t.h}:${t.m}:${t.s} `}return e.payStatus===-2?"未查询到支付单信息":""});function y(){if(e.orderInfo.status===10||e.orderInfo.status===20){e.payStatus=2;return}if(e.orderInfo.status===30){e.payStatus=-1;return}e.payStatus=1}function f(t){e.payment=t.detail.value}async function _(t){const{data:n,code:a}=await h.PayOrderApi.getOrder(t);if(a!==0||!n){e.payStatus=-2;return}e.orderInfo=n,await i(),y()}async function i(){const{data:t,code:n}=await q.PayChannelApi.getEnableChannelCodeList("9");n===0&&(e.payMethods=m.getPayMethods(t))}const p=r.ref("");return r.onLoad(t=>{if(s.sheep.$platform.name==="WechatOfficialAccount"&&s.sheep.$platform.os==="ios"&&!s.sheep.$platform.landingPage.includes("pages/pay/index")){location.reload();return}let n=t.id;p.value=t.type,t.orderType&&(e.orderType=t.orderType),_(n),s.sheep.$store("user").getWallet()}),r.onLoad(()=>{i()}),(t,n)=>r.e({a:r.t(r.unref(o.fen2yuan)(e.orderInfo.price)),b:r.t(d.value),c:r.f(e.payMethods,(a,x,$)=>r.e({a:a.disabled},a.disabled?{b:r.unref(s.sheep).$url.static("/static/img/shop/pay/cod_disabled.png")}:{c:r.unref(s.sheep).$url.static(a.icon)},{d:r.t(a.title),e:a.value==="wallet"},a.value==="wallet"?{f:r.t(r.unref(o.fen2yuan)(u.value.balance))}:{},{g:a.value,h:a.disabled,i:e.payment===a.value,j:a.disabled?1:"",k:a.title})),d:r.o(f),e:e.payStatus===0},e.payStatus===0?{}:e.payStatus===-1?{}:{g:r.o(l),h:e.payStatus!==1,i:e.payStatus!==1?1:""},{f:e.payStatus===-1,j:r.p({title:"收银台"})})}},v=r._export_sfc(S,[["__scopeId","data-v-d7fd7b38"],["__file","D:/xiangmu/佰安出行/app/s-applet/pages/pay/index.vue"]]);wx.createPage(v);