1 |
- import{d as h,x as T,a as e,A as l,C as D,R as O,N as y,U as R,K as S,w as B,y as x,an as P,e as j,a2 as L,F as k,a3 as U,V}from"./index-869d77fb.js";import{t as Y,a as M,b as W,c as $,d as G,e as z,f as H}from"./api-6e0b0638.js";import{C as N}from"./index-cff93552.js";import{C as d}from"./index-1c6c2ec0.js";import{R as J,a as E}from"./index-62365511.js";import{F as K}from"./index-0153d173.js";import{M as Z}from"./index-7af89263.js";import{S as q,a as A,b as Q,c as X}from"./index-bb269343.js";import{L as ee}from"./index-f12c44b8.js";import{D as te}from"./index-da1851f9.js";import{T as ae,a as C}from"./index-973b4cec.js";import"./Checker-4ac02e10.js";import"./use-tab-status-0ed30c24.js";import"./index-6f985828.js";import"./index-d45dfe1a.js";const ne="_container_rm6ob_1",oe="_content_rm6ob_10",ue="_wrap_rm6ob_40",f={container:ne,content:oe,wrap:ue},re="_item_2pjty_1",se="_time_2pjty_15",le="_state_2pjty_19",ie="_WAIT_PAY_2pjty_22",de="_PAID_2pjty_25",ce="_REFUNDED_2pjty_28",me="_CLOSED_2pjty_31",fe="_icon_2pjty_34",pe="_name_2pjty_39",De="_price_2pjty_43",_e="_btns_2pjty_47",ge="_cancelBtn_2pjty_62",ye="_cancelBox_2pjty_68",Ee="_boxContent_2pjty_74",Ce="_titleTag_2pjty_77",we="_title_2pjty_77",Te="_des_2pjty_93",he="_radioTitle_2pjty_100",ve="_radioDes_2pjty_106",Fe="_radioBtns_2pjty_126",s={item:re,time:se,state:le,WAIT_PAY:ie,PAID:de,REFUNDED:ce,CLOSED:me,icon:fe,name:pe,price:De,btns:_e,cancelBtn:ge,cancelBox:ye,boxContent:Ee,titleTag:Ce,title:we,des:Te,radioTitle:he,radioDes:ve,radioBtns:Fe},Ae=""+new URL("icon_order-99d10233.svg",import.meta.url).href,Ie=h({name:"collection-record-item",props:{item:{type:Object,default:()=>({})}},emits:["refund","close"],setup(n,{emit:c}){const u=T({open:!1,order:{},confirmLoading:!1,cancelOrderLoading:!1}),t=T({refundReason:"",refundReasonDes:""}),v=()=>{var o,a;if((o=n.item)!=null&&o.orderNo){const r=`${location.origin}${location.pathname}#/collection-record-detail?orderNo=${(a=n.item)==null?void 0:a.orderNo}${n.item.isRefund?"&userRefundOrderId="+n.item.userRefundOrderId:""}`;console.log("🚀 ~ url:",r),R({api:"openWebView",content:{url:r,orientation:1,isHideTitle:!1}})}},_=async o=>{if(!o.orderNo)return;const a=await M(o.orderNo);(a==null?void 0:a.code)===200&&(u.order=a.data)},F=async()=>{var o,a;await W({merOrderNo:u.order.orderNo,serviceCharge:!0,paymentClient:"STUDENT",userId:(a=(o=S.user)==null?void 0:o.data)==null?void 0:a.id,refundReason:t.refundReason==="其他原因"?t.refundReasonDes:t.refundReason,userPaymentOrderId:u.order.id,userRefundOrderDetails:u.order.goodsInfos?u.order.goodsInfos.filter(r=>r.goodsType!=="VIP").map(r=>({userPaymentOrderDetailId:r.id,num:r.goodsNum})):[]}),y("申请退回成功"),u.open=!1,c("close"),c("refund")},g=async()=>{console.log(n.item),u.confirmLoading=!0;const o=await $({orderNo:n.item.orderNo,paymentType:n.item.orderType});if(u.confirmLoading=!1,(o==null?void 0:o.code)===200){const a=o.data.paymentConfig,r=location.origin+location.pathname+"#/order-detail?orderNo="+a.orderNo+"&config="+encodeURIComponent(JSON.stringify(a.paymentConfig));console.log("🚀 ~ url:",r),R({api:"openWebView",content:{url:r,orientation:1,isHideTitle:!1}})}},m=async()=>{u.cancelOrderLoading=!0;try{await G(n.item.orderNo),setTimeout(()=>{y("取消成功"),c("close")},100)}catch(o){}u.cancelOrderLoading=!1};return()=>e("div",{class:s.item},[e(N,{inset:!0},{default:()=>[e(d,{center:!0},{title:()=>e("div",{class:s.time},[n.item.createTime]),value:()=>e("div",{class:[s.state],style:{color:n.item.statusColor}},[n.item.statusName])}),e(d,{center:!0,isLink:!0,onClick:()=>v()},{icon:()=>e("img",{class:s.icon,src:Ae},null),title:()=>e("div",{class:s.name},[Y[n.item.orderType]]),value:()=>e("div",{class:s.price},[l("¥"),e("span",{style:{fontSize:"0.42667rem"}},[n.item.paymentCashAmount])])}),["WAIT_PAY","PAYING"].includes(n.item.status)&&n.item.orderType!=="SCHOOL_REGISTER"&&e("div",{class:s.btns},[e(D,{style:{margin:"0 11px 0 auto"},round:!0,size:"small",loading:u.cancelOrderLoading,onClick:()=>m()},{default:()=>[l("取消领取")]}),e(D,{round:!0,size:"small",loading:u.confirmLoading,onClick:()=>g()},{default:()=>[l("继续领取")]})]),n.item.refundable&&e("div",{class:[s.btns,s.cancelBtn],onClick:()=>{u.open=!0,_(n.item)}},[l("申请退回")])]}),e(O,{teleport:"body",show:u.open,"onUpdate:show":o=>u.open=o,class:["popup-custom","van-scale"],transition:"van-scale"},{default:()=>[e("div",{class:s.cancelBox},[e("div",{class:s.boxContent},[e("div",{class:s.title},[e("div",{class:s.titleTag},null),l(" 申请退回")]),e("div",{class:s.des},[l("您将要发起退回,退回需承担千分之六的手续费,确认退回后款项将原路返还到您的付款账户中。")]),e("div",{class:s.radioTitle},[e("span",{style:{color:"rgba(244, 69, 65, 1)"}},[l("*")]),l("请选择您的退回原因")]),e(J,{modelValue:t.refundReason,"onUpdate:modelValue":o=>t.refundReason=o},{default:()=>[e(d,null,{title:()=>e("div",null,[e(E,{name:"价格太贵了"},{default:()=>[l("价格太贵了")]})])}),e(d,null,{title:()=>e("div",null,[e(E,{name:"不喜欢/不想要"},{default:()=>[l("不喜欢/不想要")]})])}),e(d,null,{title:()=>e("div",null,[e(E,{name:"七天无理由退货"},{default:()=>[l("七天无理由退货")]})])}),e(d,null,{title:()=>e("div",null,[e(E,{name:"其他原因"},{default:()=>[l("其他原因")]})])})]}),e("div",{class:s.radioDes,style:{display:t.refundReason==="其他原因"?"":"none"}},[e(K,{modelValue:t.refundReasonDes,"onUpdate:modelValue":o=>t.refundReasonDes=o,rows:"2",autosize:!0,label:"",type:"textarea",maxlength:"50",placeholder:"在这里填写退回原因"},null)])]),e("div",{class:s.radioBtns},[e(D,{block:!0,onClick:()=>{if(!t.refundReason){y("请选择退回原因");return}if(t.refundReason==="其他原因"&&!t.refundReasonDes){y("请输入退回原因");return}F()}},{default:()=>[l("确认退回")]}),e(D,{block:!0,type:"primary",plain:!0,onClick:()=>u.open=!1},{default:()=>[l("取消")]})])])]})])}}),be=h({name:"collection-record-item-skelete",setup(n){return()=>e("div",{class:s.item},[e(q,{animate:!0},{template:()=>e("div",{style:{width:"100%"}},[e(N,{inset:!0},{default:()=>[e(d,{center:!0},{title:()=>e(A,{rowWidth:"52%"},null),value:()=>e(A,null,null)}),e(d,{center:!0},{icon:()=>e(Q,null,null),title:()=>e("div",{class:s.name},[e(X,null,null)]),value:()=>e("div",{class:s.price},[e(A,null,null)])})]})])})])}}),Re="_downBtn_1dvap_1",Oe="_downIcon_1dvap_16",Ne="_upIcon_1dvap_22",I={downBtn:Re,downIcon:Oe,upIcon:Ne};function Se(n){return typeof n=="function"||Object.prototype.toString.call(n)==="[object Object]"&&!U(n)}const w=h({name:"collection-record-list",props:{orderStatus:{type:String,default:""},refundIndex:{type:Number,default:0}},emits:["refund"],setup(n,{emit:c}){const u=new Date,t=T({page:1,dateTime:[u.getFullYear().toString(),(u.getMonth()+1).toString().padStart(2,"0")],minDate:new Date(u.getFullYear(),0,1),maxDate:new Date(u.getFullYear()+10,5,1),list:[],skelete:!0,refreshing:!1,finished:!1,loading:!1,dataOpen:!1}),v={WAIT_PAY:"待领取",PAYING:"待领取",PAID:"领取成功",CLOSED:"已关闭",REFUNDED:"退回成功"},_={WAIT_PAY:"rgba(64, 196, 203, 1)",PAYING:"rgba(64, 196, 203, 1)",PAID:"rgba(28, 172, 241, 1)",CLOSED:"rgba(170, 170, 170, 1)",ING:"rgba(153, 153, 153, 1)",REJECT:"rgba(255, 90, 86, 1)",PASS:"rgba(255, 162, 68, 1)",REFUNDED:"rgba(255, 162, 68, 1)"},F={ING:"退回申请中",REJECT:"退回失败",PASS:"退回成功",CLOSED:"退回关闭"},g=async()=>{var r,b;t.loading=!0;let a={};if(n.orderStatus==="REFUNDED")a=await z({page:t.page,rows:10,refundMonth:t.dateTime.join("-")}),(a==null?void 0:a.code)===200&&Array.isArray((r=a==null?void 0:a.data)==null?void 0:r.rows)&&(t.list=a.data.rows.map(i=>{var p;return{...i,paymentCashAmount:((p=i.paymentCashAmount)==null?void 0:p.toFixed(2))||"0.00",createTime:i.refundTime,statusName:F[i.refundAudit],statusColor:_[i.refundAudit],isRefund:!0}}),t.finished=!a.data.next,t.page=t.page+1);else{try{a=await H({page:t.page,rows:10,orderStatus:n.orderStatus,payMonth:t.dateTime.join("-")})}catch(i){}(a==null?void 0:a.code)===200&&Array.isArray((b=a==null?void 0:a.data)==null?void 0:b.rows)&&(t.list=a.data.rows.map(i=>{var p;return{...i,paymentCashAmount:((p=i.paymentCashAmount)==null?void 0:p.toFixed(2))||"0.00",createTime:i.payTime,statusName:v[i.status],statusColor:_[i.status]}}),t.finished=!a.data.next,t.page=t.page+1)}setTimeout(()=>{t.refreshing=!1},500),t.loading=!1,t.skelete=!1};B(()=>n.refundIndex,()=>m()),x(()=>{g(),P("webViewOnResume",()=>m())});const m=()=>{t.finished=!1,t.page=1,g()},o=j(()=>`${t.dateTime[0]}年${t.dateTime[1]}月`);return()=>{let a;return e(k,null,[e(Z,{modelValue:t.refreshing,onRefresh:()=>{t.refreshing=!0,console.log("下拉"),m()}},{default:()=>[e(D,{class:I.downBtn,size:"small",round:!0,onClick:()=>t.dataOpen=!0},{default:()=>[e("div",null,[o.value]),e("svg",{class:[I.downIcon,t.dataOpen?I.upIcon:""],width:"9px",height:"5px",viewBox:"0 0 9 5",version:"1.1",xmlns:"http://www.w3.org/2000/svg"},[e("title",null,[l("三角形")]),e("g",{id:"页面-1",stroke:"currentColor","stroke-width":"1",fill:"currentColor","fill-rule":"evenodd"},[e("g",{id:"领取记录-待领取",transform:"translate(-99.000000, -155.000000)",fill:"currentColor"},[e("g",{id:"编组-2",transform:"translate(13.000000, 144.000000)"},[e("g",{id:"筛选目录备份",transform:"translate(12.000000, 3.000000)"},[e("path",{d:"M78.8716471,8.41294119 L82.2489659,12.1655176 C82.4336954,12.3707726 82.4170562,12.6869176 82.2118012,12.8716471 C82.1199888,12.9542782 82.0008397,13 81.8773188,13 L75.1226812,13 C74.8465388,13 74.6226812,12.7761424 74.6226812,12.5 C74.6226812,12.3764791 74.668403,12.25733 74.7510341,12.1655176 L78.1283529,8.41294119 C78.3130824,8.20768618 78.6292274,8.19104698 78.8344824,8.37577649 C78.8475136,8.38750459 78.859919,8.39990996 78.8716471,8.41294119 Z",id:"三角形",transform:"translate(78.500000, 10.500000) rotate(-180.000000) translate(-78.500000, -10.500000) "},null)])])])])])]}),t.skelete&&new Array(5).fill(1).map(r=>e(be,null,null)),t.list.length!==0&&e(ee,{loading:t.loading,finished:t.finished,finishedText:" "},Se(a=t.list.map(r=>e(Ie,{item:r,onClose:()=>m(),onRefund:()=>c("refund")},null)))?a:{default:()=>[a]}),!t.skelete&&t.list.length===0&&e(L,{description:"暂无记录"},null)]}),e(O,{teleport:"body",show:t.dataOpen,"onUpdate:show":r=>t.dataOpen=r,position:"bottom",round:!0},{default:()=>[e(te,{modelValue:t.dateTime,"onUpdate:modelValue":r=>t.dateTime=r,columnsType:["year","month"],minDate:t.minDate,maxDate:t.maxDate,onConfirm:()=>{t.dataOpen=!1,console.log(t.dateTime),m()},onCancel:()=>t.dataOpen=!1},null)]})])}}}),Je=h({name:"collection-record",setup(){const n=T({tab:"1",refundIndex:0});return()=>e("div",{class:f.container},[e(V,null,null),e("div",{class:f.content},[e(ae,{active:n.tab,"onUpdate:active":c=>n.tab=c,animated:!0,swipeable:!0},{default:()=>[e(C,{name:"1",title:"待领取"},{default:()=>[e("div",{class:f.wrap},[e(w,{orderStatus:"WAIT_PAY,PAYING"},null)])]}),e(C,{name:"2",title:"已领取"},{default:()=>[e("div",{class:f.wrap},[e(w,{orderStatus:"PAID,REFUNDED",onRefund:()=>n.refundIndex=n.refundIndex+1},null)])]}),e(C,{name:"3",title:"已关闭"},{default:()=>[e("div",{class:f.wrap},[e(w,{orderStatus:"CLOSED"},null)])]}),e(C,{name:"4",title:"退回"},{default:()=>[e("div",{class:f.wrap},[e(w,{refundIndex:n.refundIndex,orderStatus:"REFUNDED"},null)])]})]})])])}});export{Je as default};
|