pages-myOrders-myOrders.CJmOyGMX.js 12 KB

1
  1. var we=Object.defineProperty,ke=Object.defineProperties;var Oe=Object.getOwnPropertyDescriptors;var ne=Object.getOwnPropertySymbols;var Ce=Object.prototype.hasOwnProperty,Ve=Object.prototype.propertyIsEnumerable;var ue=(v,c,d)=>c in v?we(v,c,{enumerable:!0,configurable:!0,writable:!0,value:d}):v[c]=d,K=(v,c)=>{for(var d in c||(c={}))Ce.call(c,d)&&ue(v,d,c[d]);if(ne)for(var d of ne(c))Ve.call(c,d)&&ue(v,d,c[d]);return v},ee=(v,c)=>ke(v,Oe(c));var D=(v,c,d)=>new Promise((n,h)=>{var i=u=>{try{_(d.next(u))}catch(I){h(I)}},C=u=>{try{_(d.throw(u))}catch(I){h(I)}},_=u=>u.done?n(u.value):Promise.resolve(u.value).then(i,C);_((d=d.apply(v,c)).next())});import{b as pe,m as ce,d as fe,ag as $e,e as O,an as Se,ad as Ie,w as de,aV as E,as as Ne,f as V,o as g,g as e,J as j,h as l,j as me,n as T,a4 as te,_ as ie,k as Le,q as _e,r as k,s as Be,u as Pe,aC as ze,z as De,B as L,D as B,Y as Re,E as ae,F as o,G as W,H as Q,I as le,L as x,M as f,R as S,K as qe,l as Ee,Q as se,a7 as Te,P as je,Z as re,$ as Ae,a1 as Fe}from"./index-C2C--_0G.js";import{_ as Ue,a as Ge}from"./wd-tabs.DsJmnOXl.js";import{_ as Me}from"./wd-skeleton.CwefQvse.js";import{_ as He}from"./wd-card.CCukFEJU.js";import{_ as Ke}from"./wd-text.kM1ff_Ui.js";import{_ as We}from"./z-paging.CAp4nDA0.js";import{u as Qe}from"./useZPaging.DVknNCkP.js";import{u as Ye,o as Ze,r as Je,a as Xe}from"./order.DLzFa84U.js";import{D as et}from"./DialogBox.C5HwoQqJ.js";import"./useTouch.THbm70v3.js";const tt=Symbol("wd-checkbox-group");K({},pe);const at=ee(K({},pe),{customLabelClass:ce(""),customShapeClass:ce(""),modelValue:{type:[String,Number,Boolean],required:!0,default:!1},shape:{type:String},checkedColor:String,disabled:{type:[Boolean,null],default:null},trueValue:{type:[String,Number,Boolean],default:!0},falseValue:{type:[String,Number,Boolean],default:!1},size:String,maxWidth:String}),lt={name:"wd-checkbox",options:{addGlobalClass:!0,virtualHost:!0,styleIsolation:"shared"}},st=fe(ee(K({},lt),{props:at,emits:["change","update:modelValue"],setup(v,{expose:c,emit:d}){const n=v,h=d;c({toggle:G});const{parent:i,index:C}=$e(tt),_=O(()=>i?i.props.modelValue.indexOf(n.modelValue)>-1:n.modelValue===n.trueValue),u=O(()=>C.value===0),I=O(()=>{const p=Se(i)?i.children:[];return C.value===p.length-1}),{proxy:A}=Ie();de(()=>n.modelValue,()=>{i&&Z()}),de(()=>n.shape,p=>{});const N=O(()=>n.shape||E(i,"props.shape")||"circle"),$=O(()=>n.checkedColor||E(i,"props.checkedColor")),P=O(()=>{if(!i)return n.disabled;const{max:p,min:z,modelValue:b,disabled:J}=i.props;return p&&b.length>=p&&!_.value||z&&b.length<=z&&_.value||n.disabled===!0||J&&n.disabled===null?!0:n.disabled}),Y=O(()=>E(i,"props.inline")||!1),F=O(()=>E(i,"props.cell")||!1),U=O(()=>n.size||E(i,"props.size"));Ne(()=>{n.modelValue});function Z(){i&&i.children&&i.children.forEach(p=>{p.$.uid!==A.$.uid&&(p.modelValue,n.modelValue)})}function G(){if(!P.value)if(i)h("change",{value:!_.value}),i.changeSelectState(n.modelValue);else{const p=n.modelValue===n.trueValue?n.falseValue:n.trueValue;h("update:modelValue",p),h("change",{value:p})}}return(p,z)=>{const b=me;return g(),V(b,{class:te(`wd-checkbox ${F.value?"is-cell-box":""} ${N.value==="button"?"is-button-box":""} ${_.value?"is-checked":""} ${u.value?"is-first-child":""} ${I.value?"is-last-child":""} ${Y.value?"is-inline":""} ${N.value==="button"?"is-button":""} ${P.value?"is-disabled":""} ${U.value?"is-"+U.value:""} ${p.customClass}`),style:T(p.customStyle),onClick:G},{default:e(()=>[N.value!=="button"?(g(),V(b,{key:0,class:te(`wd-checkbox__shape ${N.value==="square"?"is-square":""} ${p.customShapeClass}`),style:T(_.value&&!P.value&&$.value?"color :"+$.value:"")},{default:e(()=>[l(ie,{"custom-class":"wd-checkbox__check",name:"check-bold"})]),_:1},8,["class","style"])):j("",!0),l(b,{class:te(`wd-checkbox__label ${p.customLabelClass}`),style:T(_.value&&N.value==="button"&&!P.value&&$.value?"color:"+$.value:"")},{default:e(()=>[N.value==="button"&&_.value?(g(),V(ie,{key:0,"custom-class":"wd-checkbox__btn-check",name:"check-bold"})):j("",!0),l(b,{class:"wd-checkbox__txt",style:T(p.maxWidth?"max-width:"+p.maxWidth:"")},{default:e(()=>[Le(p.$slots,"default",{},void 0,!0)]),_:3},8,["style"])]),_:3},8,["class","style"])]),_:3},8,["class","style"])}}})),rt=_e(st,[["__scopeId","data-v-92af0321"]]),ot=fe({name:"MyOrders",__name:"myOrders",setup(v){const c=k(null);Qe(c);const d=k(!0),n=k(Be()),h=k(0),i=k([{label:"myOrders.tab.all",value:0},{label:"myOrders.tab.toPay",value:1},{label:"myOrders.tab.success",value:2},{label:"myOrders.tab.failed",value:3},{label:"myOrders.tab.reward",value:4}]),C=k([]),_=k(0),u=k([]),I=k(""),A=k(0);function N(){return D(this,null,function*(){var t;try{const s=yield ze({code:"recycle_proportion"});if(s.code==="200"&&((t=s.data)!=null&&t.valueInfo)){let w=Number(s.data.valueInfo)||0;w>1&&(w=w/100),A.value=w,I.value=String(w*100)}}catch(s){}})}function $(){return D(this,null,function*(){try{const t=yield Ye();t.code==="200"&&(_.value=Number(t.data)||0)}catch(t){}})}const P=k([]);function Y(){return D(this,null,function*(){try{const t=yield Ze({id:1});t.code==="200"&&(P.value=t.data)}catch(t){}})}function F(t){return u.value.includes(t)}function U(t){return F(t)||u.value.length<_.value}function Z(t){const s=u.value.indexOf(t);s>-1?u.value.splice(s,1):u.value.length<_.value&&u.value.push(t)}function G(){u.value=[],$(),oe(1,20)}const p=O(()=>u.value.length===0?0:C.value.filter(t=>u.value.includes(t.orderId)).reduce((t,s)=>{var R,q,r,M;const w=Number((q=(R=s==null?void 0:s.orderInfoVO)==null?void 0:R[0])==null?void 0:q.price)||0,X=Number((M=(r=s==null?void 0:s.orderInfoVO)==null?void 0:r[0])==null?void 0:M.payNum)||0;return t+w*X},0)),z=O(()=>p.value*A.value),b=k(!1);function J(){b.value=!0}function ye(){return D(this,null,function*(){var t;try{if(u.value.length===0){re.info(S("myOrders.selectTip",[_.value]));return}Ae({title:S("common.loading"),mask:!0}),(yield Je({orderNos:u.value})).code==="200"&&re.success(S("myOrders.recycleSuccess")),u.value=[],(t=c.value)==null||t.reload(),$()}catch(s){re.error(S("myOrders.recycleFailed"))}finally{Fe()}})}function oe(t,s){return D(this,null,function*(){try{t===1&&(d.value=!0);const w=yield Xe({page:t,size:s,type:h.value});c.value.complete(w.data.list),t===1&&$()}catch(w){c.value.complete(!1)}finally{t===1&&(d.value=!1)}})}return Pe(t=>{if(Y(),$(),N(),t&&t.type!==void 0){const s=Number(t.type);s>=0&&s<=4&&(h.value=s)}}),(t,s)=>{const w=L(B("wd-tab"),Ue),X=L(B("wd-tabs"),Ge),R=L(B("wd-skeleton"),Me),q=L(B("wd-card"),He),r=me,M=L(B("wd-checkbox"),rt),xe=L(B("wd-text"),Ke),he=Ee,H=je,ve=L(B("wd-button"),Re),ge=L(B("z-paging"),We),be=De("layout-default-uni");return g(),V(be,null,{default:e(()=>[l(ge,{ref_key:"paging",ref:c,modelValue:o(C),"onUpdate:modelValue":s[1]||(s[1]=a=>ae(C)?C.value=a:null),"use-page-scroll":"",onQuery:oe},{top:e(()=>[l(X,{modelValue:o(h),"onUpdate:modelValue":s[0]||(s[0]=a=>ae(h)?h.value=a:null),"auto-line-width":!0,"custom-class":"bg-transparent!",slidable:"always",onClick:G},{default:e(()=>[(g(!0),W(Q,null,le(o(i),a=>(g(),V(w,{key:a.value,title:o(S)(a.label),name:a.value},null,8,["title","name"]))),128))]),_:1},8,["modelValue"])]),bottom:e(()=>{var a;return[o(h)===2&&o(u).length>0?(g(),V(r,{key:0,class:"flex items-center justify-end bg-white px-24rpx pt-30rpx shadow-[0_-2rpx_8rpx_0_rgba(0,0,0,0.1)]",style:T({paddingBottom:`${((a=o(n).safeAreaInsets)==null?void 0:a.bottom)+30||30}rpx`})},{default:e(()=>[l(r,null,{default:e(()=>[l(H,null,{default:e(()=>[x(f(t.$t("myOrders.total"))+": ",1)]),_:1}),l(H,{class:"text-[var(--wot-color-theme)]"},{default:e(()=>[x(" ৳"+f(o(se)(o(z))),1)]),_:1})]),_:1}),l(ve,{"custom-class":"ml-16rpx! min-w-260rpx! bg-[var(--wot-color-theme)]",onClick:J},{default:e(()=>[x(f(t.$t("myOrders.recycleOrder")),1)]),_:1})]),_:1},8,["style"])):j("",!0)]}),default:e(()=>[o(d)?(g(),V(r,{key:0,class:"pt-24rpx"},{default:e(()=>[(g(),W(Q,null,le(3,a=>l(q,{key:a,type:"rectangle","custom-class":"px-24rpx! py-6rpx!","custom-content-class":"py-18rpx!","custom-title-class":"py-18rpx!"},{title:e(()=>[l(R,{"row-col":[[{width:"250rpx",height:"28rpx"},{width:"60rpx",height:"26rpx",marginLeft:"auto"}]],animation:"gradient"})]),default:e(()=>[l(R,{"row-col":[[{width:"140rpx",height:"140rpx",type:"rect"},[{width:"100%",height:"40rpx"},{width:"80%",height:"40rpx",marginTop:"8rpx"},{width:"120rpx",height:"24rpx",marginTop:"4rpx"},[{width:"100rpx",height:"24rpx"},{width:"80rpx",height:"24rpx",marginLeft:"auto"}]]]],animation:"gradient"})]),_:2},1024)),64))]),_:1})):(g(),W(Q,{key:1},[o(h)===2?(g(),V(r,{key:0,class:"pt-24rpx text-center font-bold"},{default:e(()=>[x(f(o(S)("myOrders.selectTip",[o(_)])),1)]),_:1})):j("",!0),l(r,{class:"pt-24rpx"},{default:e(()=>[(g(!0),W(Q,null,le(o(C),a=>(g(),V(q,{key:a.orderId,type:"rectangle","custom-class":"px-24rpx! py-6rpx!","custom-content-class":"py-18rpx!","custom-title-class":"py-18rpx!",onClick:m=>o(qe)({url:"/pages/myOrders/orderDetail",params:{orderNo:a==null?void 0:a.orderId}})},{title:e(()=>[l(r,{class:"flex items-center justify-between"},{default:e(()=>{var m;return[l(r,{class:"flex items-center text-28rpx text-#000"},{default:e(()=>[o(h)===2?(g(),V(M,{key:0,"model-value":F(a.orderId),disabled:!U(a.orderId),"custom-class":"mr-16rpx",onClick:Te(y=>Z(a.orderId),["stop"])},null,8,["model-value","disabled","onClick"])):j("",!0),l(r,null,{default:e(()=>[x(f(o(S)("myOrders.order.id"))+":"+f(a.orderId),1)]),_:2},1024)]),_:2},1024),l(xe,{size:"26rpx",type:"primary",text:(m=o(P).find(y=>y.code===a.status))==null?void 0:m.name},null,8,["text"])]}),_:2},1024)]),default:e(()=>[l(r,{class:"flex items-center justify-center gap-24rpx"},{default:e(()=>[l(r,{class:"h-140rpx w-140rpx shrink-0 text-center"},{default:e(()=>{var m,y;return[l(he,{src:(y=(m=a==null?void 0:a.orderInfoVO)==null?void 0:m[0])==null?void 0:y.image,class:"h-full w-full",mode:"aspectFit"},null,8,["src"])]}),_:2},1024),l(r,{class:"flex-1"},{default:e(()=>[l(r,{class:"line-clamp-2 h-80rpx break-all text-28rpx text-#000"},{default:e(()=>{var m,y;return[x(f((y=(m=a==null?void 0:a.orderInfoVO)==null?void 0:m[0])==null?void 0:y.productName),1)]}),_:2},1024),l(r,null,{default:e(()=>[l(r,{class:"py-4rpx text-24rpx text-#3A444C"},{default:e(()=>{var m,y;return[x(f(o(S)("myOrders.order.color"))+": "+f((y=(m=a==null?void 0:a.orderInfoVO)==null?void 0:m[0])==null?void 0:y.sku),1)]}),_:2},1024),l(r,{class:"flex items-center justify-between text-24rpx text-#3A444C"},{default:e(()=>[l(r,null,{default:e(()=>{var m,y;return[x(" ৳ "+f(o(se)((y=(m=a==null?void 0:a.orderInfoVO)==null?void 0:m[0])==null?void 0:y.price)),1)]}),_:2},1024),l(r,null,{default:e(()=>{var m,y;return[x(f(o(S)("myOrders.order.quantity"))+":"+f((y=(m=a==null?void 0:a.orderInfoVO)==null?void 0:m[0])==null?void 0:y.payNum),1)]}),_:2},1024)]),_:2},1024)]),_:2},1024)]),_:2},1024)]),_:2},1024)]),_:2},1032,["onClick"]))),128))]),_:1})],64))]),_:1},8,["modelValue"]),l(o(et),{show:o(b),"onUpdate:show":s[2]||(s[2]=a=>ae(b)?b.value=a:null),"show-cancel":!1,"confirm-text":t.$t("myOrders.dialog.confirm"),onConfirm:ye},{default:e(()=>[l(r,{class:"text-left"},{default:e(()=>[l(r,{class:"pb-24rpx text-center text-32rpx font-bold"},{default:e(()=>[x(f(t.$t("myOrders.dialog.title")),1)]),_:1}),l(r,{class:"pb-24rpx text-24rpx font-bold"},{default:e(()=>[x(f(t.$t("myOrders.dialog.notesTitle")),1)]),_:1}),l(r,{class:"pb-32rpx text-24rpx text-#666"},{default:e(()=>[l(r,{class:"space-y-16rpx"},{default:e(()=>[l(r,null,{default:e(()=>[x(f(t.$t("myOrders.dialog.note1")),1)]),_:1}),l(r,null,{default:e(()=>[x(f(t.$t("myOrders.dialog.note2",[o(I)])),1)]),_:1}),l(r,null,{default:e(()=>[x(f(t.$t("myOrders.dialog.note3")),1)]),_:1})]),_:1})]),_:1}),l(r,{class:"mb-44rpx text-center"},{default:e(()=>[l(H,null,{default:e(()=>[x(f(t.$t("myOrders.dialog.priceLabel"))+": ",1)]),_:1}),l(H,{class:"text-[var(--wot-color-theme)]"},{default:e(()=>[x(" ৳"+f(o(se)(o(z))),1)]),_:1})]),_:1})]),_:1})]),_:1},8,["show","confirm-text"])]),_:1})}}}),ht=_e(ot,[["__scopeId","data-v-da3da252"]]);export{ht as default};