import{a as e,x as a,i as s,u as t,T as l,o,j as n,w as c,h as u,e as i,k as r,F as p,m as d,I as f,B as y,l as m,z as _,p as v,f as w,ax as h}from"./index-90c12cc1.js";import{h as x,i as b,f as C}from"./order.190c4706.js";import{u as P}from"./useInterface.bd4f041a.js";import{P as j}from"./index.188c29d6.js";import{G as k,H as I,I as g}from"./images.cf3befb9.js";import{P as L,d as R}from"./paymentUtils.6e4e6391.js";import{_ as E,a as O}from"./uv-radio.b22c472e.js";import{_ as T}from"./_plugin-vue_export-helper.1b428a4d.js";import{P as G}from"./Popup.4e72ea57.js";import{u as M}from"./useShearPlate.4a901d40.js";const{toast:S}=P();function A(l=(()=>{})){const o=e(),n=e(),c=e(0),{push:u}=t(),i=a((()=>["确认删除订单吗？","确认取消订单吗？","确认要确认收货吗？","确认取消订单吗?"][c.value]));return{MODAL_TYPE:{DELETE:0,CANCEL:1,CONFIRM:2,CANCEL_CHECK:3},modalRef:n,checkOffCodeRef:o,modalType:c,modalTitle:i,showModal:function(e){c.value=e,s(n).show()},cancelOrder:async function(e){return new Promise(((a,s)=>{x({id:e.orderId}).then((e=>{S({title:"已取消"}),a()}))}))},deleteOrder:function(e){return new Promise(((a,s)=>{b({uni:e.orderId}).then((e=>{S({title:"删除成功"}),a()}))}))},toEvaluate:(e,a,s)=>{let t={data:{unique:e,orderId:a}};s&&(t.type="redirectTo"),u({url:"/pages/evaluate/evaluate"},t)},toSelectRefundGood:e=>{u({url:"/pages/selectRefundGood/selectRefundGood"},{data:{id:e}})},showWsReceipt:e=>new Promise(((e,a)=>{e("success")})),checkOffCode:e=>{o.value.open(e)}}}const D=[{label:"微信支付",eLabel:"Wechat Pay",icon:k,type:L[0],disabled:!1},{label:"余额支付",eLabel:"Balance Pay",icon:I,type:L[1],disabled:!1},{label:"支付宝支付",eLabel:"ALi Pay",icon:g,type:L[2],disabled:!0}],H=T({__name:"index",emits:["confirm","close"],setup(a,{expose:w,emit:h}){const{toast:x}=P(),{push:b}=t(),k=l(),I=e();function g(){h("close")}w({show:async function(e){await async function(e){G.value=await C({key:e}),G.value.totalPrice<=0?(T.value=L[1],M.value=!0,x({title:"支付金额为0.00，自动选择余额支付",icon:"none",duration:3e3})):M.value=!1}(e),s(I).show()}});const T=e(L[0]),G=e({}),M=e(!1);const S=e(!1);async function A(){try{S.value=!0,await R({type:T.value,payInfo:G.value,isGroup:1===G.value.campaignType}),S.value=!1,h("confirm"),g()}catch(e){console.error(e),b({url:"/pages/payStatus/index"},{data:{type:2}}),x({title:"支付失败了"}),g()}}return(e,a)=>{const t=v,l=y;return o(),n(j,{ref_key:"popupRef",ref:I,title:"支付",onClose:g},{default:c((()=>[u(l,{class:"pay-container"},{default:c((()=>[u(E,{placement:"column",iconPlacement:"right",modelValue:T.value,"onUpdate:modelValue":a[0]||(a[0]=e=>T.value=e),class:"pay-box__inner flex flex-ai__center flex-jc__center flex-wrap",shape:"circle",activeColor:"#ec6e47"},{default:c((()=>[(o(!0),i(p,null,r(s(D),(e=>(o(),n(O,{key:e.type,name:e.type,disabled:e.disabled||e.type===s(L)[0]&&M.value||0===s(k).user.nowMoney&&!M.value&&e.type===s(L)[1]},{default:c((()=>[u(l,{class:"pay-row flex flex-ai__center"},{default:c((()=>[u(t,{class:"icon",src:e.icon},null,8,["src"]),u(l,{class:"info"},{default:c((()=>[u(l,{class:"label flex flex-nowrap flex-ai__end",style:{"white-space":"nowrap"}},{default:c((()=>[f(m(e.label)+" ",1),e.type===s(L)[1]?(o(),i("span",{key:0,style:{"font-size":"16rpx","white-space":"nowrap"}}," （"+m(s(k).user.nowMoney)+"元） ",1)):_("",!0)])),_:2},1024),u(l,null,{default:c((()=>[f(m(e.eLabel),1)])),_:2},1024)])),_:2},1024)])),_:2},1024)])),_:2},1032,["name","disabled"])))),128))])),_:1},8,["modelValue"]),u(l,{class:d(["animation-button sub-button",{active:S.value}]),onClick:A},{default:c((()=>[f(" 立即支付 ")])),_:1},8,["class"])])),_:1})])),_:1},512)}}},[["__scopeId","data-v-3dc7861c"]]);function N(){const a=e(),{push:l}=t();return{payPopupRef:a,openPay:function(e){s(a).show(e)},paySuccess:function(){l({url:"/pages/payStatus/index?type=1"})}}}const V=T({__name:"CheckOffCode",setup(a,{expose:s}){const{setData:t}=M(),{toast:l,loading:i,hideLoading:r}=P();e(null);const p=e(null),d=e("");async function _(){await t(p.value),l({title:"复制成功",icon:"success"})}const x=e();function b(){p.value=null,d.value=""}return s({open:async function(e){x.value.show(),p.value=e,await async function(){try{i(),d.value=await h({content:p.value})}finally{r()}}()}}),(e,a)=>{const s=y,t=v;return o(),n(G,{ref_key:"popupRef",ref:x,mode:"center",onClose:b},{title:c((()=>[u(s,{class:"title"},{default:c((()=>[f(" 核销码 ")])),_:1})])),default:c((()=>[u(s,{class:"check-off-code"},{default:c((()=>[u(s,{class:"code-row"},{default:c((()=>[f(m(p.value)+" ",1),u(s,{class:"copy",onClick:_},{default:c((()=>[f("复制 ")])),_:1})])),_:1}),u(s,{class:"qr-code"},{default:c((()=>[u(t,{src:d.value},null,8,["src"])])),_:1}),u(s,{class:"tips-row"},{default:c((()=>[w("p",{class:"tip"},"为保障您的权益"),w("p",{class:"tip"}," 未到店前请不要将核销码提供给商家")])),_:1})])),_:1})])),_:1},512)}}},[["__scopeId","data-v-e876625e"]]);export{V as C,H as P,N as a,A as u};
