"use strict";const e=require("../../common/vendor.js"),r=require("../../sheep/index.js"),s=require("../../sheep/hooks/useGoods.js"),a=require("../../sheep/api/pay/order.js"),t=require("../../sheep/api/pay/channel.js"),p=require("../../sheep/platform/pay.js");if(require("../../sheep/url/index.js"),require("../../sheep/store/index.js"),require("../../sheep/store/app.js"),require("../../sheep/api/promotion/diy.js"),require("../../sheep/request/index.js"),require("../../sheep/config/index.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/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/index.js"),require("../../sheep/helper/test.js"),require("../../sheep/helper/digit.js"),require("../../sheep/api/member/signin.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/api/promotion/coupon.js"),require("../../sheep/store/sys.js"),require("../../sheep/store/modal.js"),require("../../sheep/config/zIndex.js"),require("../../sheep/util/index.js"),!Array){e.resolveComponent("s-layout")()}Math;const o={__name:"index",setup(o){const i=e.computed((()=>r.sheep.$store("user").userWallet)),n=e.reactive({orderType:"goods",orderInfo:{},payStatus:0,payMethods:[],payment:""}),u=()=>{""!==n.payment?"wallet"===n.payment?e.index.showModal({title:"提示",content:"确定要支付吗?",success:function(e){e.confirm&&r.sheep.$platform.pay(n.payment,n.orderType,n.orderInfo.id)}}):r.sheep.$platform.pay(n.payment,n.orderType,n.orderInfo.id):r.sheep.$helper.toast("请选择支付方式")},d=e.computed((()=>{if(2===n.payStatus)return"该订单已支付";if(1===n.payStatus){const e=s.useDurationTime(n.orderInfo.expireTime);return e.ms<=0?(n.payStatus=-1,""):`剩余支付时间 ${e.h}:${e.m}:${e.s} `}return-2===n.payStatus?"未查询到支付单信息":""}));function h(){10!==n.orderInfo.status&&20!==n.orderInfo.status?30!==n.orderInfo.status?n.payStatus=1:n.payStatus=-1:n.payStatus=2}function l(e){n.payment=e.detail.value}async function c(){const{data:e,code:r}=await t.PayChannelApi.getEnableChannelCodeList(n.orderInfo.appId);0===r&&(n.payMethods=p.getPayMethods(e))}return e.onLoad((e=>{if("WechatOfficialAccount"===r.sheep.$platform.name&&"ios"===r.sheep.$platform.os&&!r.sheep.$platform.landingPage.includes("pages/pay/index"))return void location.reload();console.log(e);let s=e.id;e.orderType&&(n.orderType=e.orderType),2==e.openType?async function(e){const{data:r,code:s}=await a.PayOrderApi.getPayOrder(e);0===s&&r?(n.orderInfo=r,await c(),h()):n.payStatus=-2}(s):(console.log(123),async function(e){const{data:r,code:s}=await a.PayOrderApi.getOrder(e);0===s&&r?(n.orderInfo=r,await c(),h()):n.payStatus=-2}(s)),r.sheep.$store("user").getWallet()})),(a,t)=>e.e({a:e.t(e.unref(s.fen2yuan)(n.orderInfo.price)),b:e.t(d.value),c:e.f(n.payMethods,((a,t,p)=>e.e({a:a.disabled},a.disabled?{b:e.unref(r.sheep).$url.static("/static/img/shop/pay/cod_disabled.png")}:{c:e.unref(r.sheep).$url.static(a.icon)},{d:e.t(a.title),e:"wallet"===a.value},"wallet"===a.value?{f:e.t(e.unref(s.fen2yuan)(i.value.balance))}:{},{g:a.value,h:a.disabled,i:n.payment===a.value,j:a.disabled?1:"",k:a.title}))),d:e.o(l),e:0===n.payStatus},0===n.payStatus||-1===n.payStatus?{}:{g:e.o(u),h:1!==n.payStatus,i:1!==n.payStatus?1:""},{f:-1===n.payStatus,j:e.p({title:"收银台"})})}},i=e._export_sfc(o,[["__scopeId","data-v-7b71f260"]]);wx.createPage(i);
