pages-notifications-notifications.CkgeW8oY.js 9.0 KB

1
  1. var w=(x,T,p)=>new Promise((r,d)=>{var k=l=>{try{u(p.next(l))}catch(E){d(E)}},I=l=>{try{u(p.throw(l))}catch(E){d(E)}},u=l=>l.done?r(l.value):Promise.resolve(l.value).then(k,I);u((p=p.apply(x,T)).next())});import{d as j,s as q,r as N,e as Z,f as C,g as o,z as J,ax as Q,R as a,B as y,_ as X,D as R,o as m,h as i,E as B,F as _,j as ee,G as b,H as M,I as Y,a4 as te,l as ne,P as oe,L as O,M as A,J as ie,n as ae,U as se,a_ as ce,a$ as re,K as F,b0 as le,b1 as de,Z as _e,q as ue}from"./index-BvrJT4vV.js";import{_ as fe}from"./wd-navbar.DmsSTXrj.js";import{_ as pe,a as ye}from"./wd-tabs.TmjdLZHs.js";import{_ as Re}from"./wd-swipe-action.C4IghGTX.js";import{_ as me}from"./z-paging.0LfmZNmx.js";import{u as Ee}from"./useZPaging.DPl6Aqd5.js";import"./useTouch.Bw2R-dGZ.js";const ge="/static/icons/cl.png",Se=j({name:"Notifications",__name:"notifications",setup(x){const p=q().safeAreaInsets,r=N(null);Ee(r);const d=N("ALL"),k=Z(()=>(Q.global.locale,[{title:a("notifications.tabs.all"),value:"ALL"},{title:a("notifications.tabs.orders"),value:"ORDER"},{title:a("notifications.tabs.revenue"),value:"REWARD"},{title:a("notifications.tabs.account"),value:"MONEY"},{title:a("notifications.tabs.promos"),value:"OTHER"}])),I={order:["ORDER_GROUP_BUY_PAYMENT_SUCCESS","ORDER_GROUP_BUY_SUCCESS_WIN","ORDER_GROUP_BUY_SUCCESS_LOSE","ORDER_PROVIDE_SHIPPING_ADDRESS","ORDER_GROUP_BUY_FAIL","ORDER_SHIPPED_SUCCESS"],income:["REWARD_REFER_FRIENDS","REWARD_GROUP_BUY","REWARD_OPEN_GROUP_BUY","REWARD_DIRECT_REFERRAL","REWARD_CHECKIN","REWARD_FIRST_COMMISSION","REWARD_SECONDARY_COMMISSION","ORDER_RECYCLE_REWARD"],wallet:["MONEY_RECHARGE_SUCCESS","MONEY_WITHDRAWAL_ACCOUNT_SUCCESS","MONEY_WITHDRAWAL_WALLET_SUCCESS","MONEY_WITHDRAWAL_FAIL"],other:["OTHER"]},u={ORDER_GROUP_BUY_PAYMENT_SUCCESS:{titleKey:"notifications.order.paymentSuccess.title",contentKey:"notifications.order.paymentSuccess.content",link:"/pages/myOrders/orderDetail"},ORDER_GROUP_BUY_SUCCESS_WIN:{titleKey:"notifications.order.groupBuyWin.title",contentKey:"notifications.order.groupBuyWin.content",link:"/pages/myOrders/orderDetail"},ORDER_GROUP_BUY_SUCCESS_LOSE:{titleKey:"notifications.order.groupBuyLose.title",contentKey:"notifications.order.groupBuyLose.content",link:"/pages/myOrders/orderDetail"},ORDER_PROVIDE_SHIPPING_ADDRESS:{titleKey:"notifications.order.provideAddress.title",contentKey:"notifications.order.provideAddress.content",link:"/pages/myOrders/orderDetail"},ORDER_GROUP_BUY_FAIL:{titleKey:"notifications.order.groupBuyFail.title",contentKey:"notifications.order.groupBuyFail.content",link:"/pages/myOrders/orderDetail"},ORDER_SHIPPED_SUCCESS:{titleKey:"notifications.order.shipped.title",contentKey:"notifications.order.shipped.content",link:"/pages/myOrders/orderDetail"},ORDER_RECYCLE_REWARD:{titleKey:"notifications.order.recycleReward.title",contentKey:"notifications.order.recycleReward.content",link:"/pages/income/income"},REWARD_REFER_FRIENDS:{titleKey:"notifications.reward.referFriends.title",contentKey:"notifications.reward.referFriends.content",link:"/pages/income/income"},REWARD_OPEN_GROUP_BUY:{titleKey:"notifications.reward.openGroupBuy.title",contentKey:"notifications.reward.openGroupBuy.content",link:"/pages/income/income"},REWARD_GROUP_BUY:{titleKey:"notifications.reward.groupBuy.title",contentKey:"notifications.reward.groupBuy.content",link:"/pages/income/income"},REWARD_DIRECT_REFERRAL:{titleKey:"notifications.reward.directReferral.title",contentKey:"notifications.reward.directReferral.content",link:"/pages/income/income"},REWARD_CHECKIN:{titleKey:"notifications.reward.checkin.title",contentKey:"notifications.reward.checkin.content",link:"/pages/income/income"},REWARD_FIRST_COMMISSION:{titleKey:"notifications.reward.firstCommission.title",contentKey:"notifications.reward.firstCommission.content",link:"/pages/income/income"},REWARD_SECONDARY_COMMISSION:{titleKey:"notifications.reward.secondaryCommission.title",contentKey:"notifications.reward.secondaryCommission.content",link:"/pages/income/income"},MONEY_RECHARGE_SUCCESS:{titleKey:"notifications.money.rechargeSuccess.title",contentKey:"notifications.money.rechargeSuccess.content",link:"/pages/wallet/myWallet"},MONEY_WITHDRAWAL_ACCOUNT_SUCCESS:{titleKey:"notifications.money.withdrawalAccountSuccess.title",contentKey:"notifications.money.withdrawalAccountSuccess.content",link:"/pages/wallet/withdrawRecord?params=%257B%2522type%2522%253A2%257D"},MONEY_WITHDRAWAL_WALLET_SUCCESS:{titleKey:"notifications.money.withdrawalWalletSuccess.title",contentKey:"notifications.money.withdrawalWalletSuccess.content",link:"/pages/wallet/withdrawRecord?params=%257B%2522type%2522%253A2%257D"},MONEY_WITHDRAWAL_FAIL:{titleKey:"notifications.money.withdrawalFail.title",contentKey:"notifications.money.withdrawalFail.content",link:"/pages/wallet/withdrawRecord?params=%257B%2522type%2522%253A2%257D"}};function l(t){if(t.noticeType==="OTHER")return t.noticeTitle;const e=u[t.noticeType];return e?a(e.titleKey):t.noticeTitle||""}function E(t){if(t.noticeType==="OTHER")return t.noticeMessage;const e=u[t.noticeType];if(e){const n=t.noticeMessage;return a(e.contentKey,{orderId:n})}return t.noticeMessage||""}function P(t){for(const[e,n]of Object.entries(I))if(n.includes(t))return`/static/icons/msg-${e}.png`;return"/static/icons/msg-other.png"}const g=N([]);function W(t,e){return w(this,null,function*(){try{const n=yield ce({page:t,size:e,type:d.value==="ALL"?null:d.value});n.code==="200"?r.value.complete(n.data.records):r.value.complete(!1)}catch(n){r.value.complete(!1)}})}function H(t){if(t.readFlag=!0,re(t.id),t.noticeType==="OTHER"){const e=t.pages;e&&F({url:e})}else{const e=u[t.noticeType],n=e==null?void 0:e.link;n&&F({url:n,params:n==="/pages/myOrders/orderDetail"?{orderNo:t.noticeMessage}:{}})}}function G(t,e){return w(this,null,function*(){(yield le(e.id)).code==="200"&&r.value.reload()})}function $(t){const e=new Date(t),n=new Date,S=new Date(n.getFullYear(),n.getMonth(),n.getDate()),U=new Date(n.getFullYear(),n.getMonth(),n.getDate()+1);if(e>=S&&e<U)return`${String(e.getHours()).padStart(2,"0")}:${String(e.getMinutes()).padStart(2,"0")}`;if((n.getTime()-e.getTime())/(1e3*60*60*24)<=7)return[a("notifications.time.sunday"),a("notifications.time.monday"),a("notifications.time.tuesday"),a("notifications.time.wednesday"),a("notifications.time.thursday"),a("notifications.time.friday"),a("notifications.time.saturday")][e.getDay()];const c=String(e.getFullYear()).slice(-2),D=String(e.getMonth()+1).padStart(2,"0"),K=String(e.getDate()).padStart(2,"0");return`${c}/${D}/${K}`}function V(){return w(this,null,function*(){try{(yield de()).code==="200"&&(g.value.forEach(e=>{e.readFlag=!0}),r.value.reload(),_e.success(a("common.operate.success")))}catch(t){}})}return(t,e)=>{const n=y(R("wd-icon"),X),S=ne,U=y(R("wd-navbar"),fe),h=y(R("wd-tab"),pe),v=y(R("wd-tabs"),ye),c=ee,D=oe,K=y(R("wd-swipe-action"),Re),L=y(R("z-paging"),me),z=J("layout-default-uni");return m(),C(z,null,{default:o(()=>[i(L,{ref_key:"paging",ref:r,modelValue:_(g),"onUpdate:modelValue":e[3]||(e[3]=s=>B(g)?g.value=s:null),"use-page-scroll":"",onQuery:W},{top:o(()=>{var s;return[i(c,{class:"bg-white",style:ae({paddingTop:`${(s=_(p))==null?void 0:s.top}px`})},{default:o(()=>[i(U,{bordered:!1,placeholder:"",title:_(a)("notifications.title")},{left:o(()=>[i(n,{name:"thin-arrow-left",size:"32rpx",onClick:e[0]||(e[0]=()=>_(se)())})]),right:o(()=>[i(S,{src:ge,class:"h-40rpx w-40rpx",onClick:V})]),_:1},8,["title"]),i(v,{modelValue:_(d),"onUpdate:modelValue":e[1]||(e[1]=f=>B(d)?d.value=f:null),"auto-line-width":!0,"custom-class":"bg-transparent!",slidable:"always",onClick:e[2]||(e[2]=()=>W(1,20))},{default:o(()=>[(m(!0),b(M,null,Y(_(k),f=>(m(),C(h,{key:f.value,name:f.value,title:f.title},null,8,["name","title"]))),128))]),_:1},8,["modelValue"])]),_:1},8,["style"])]}),default:o(()=>[i(c,{class:"py-14rpx"},{default:o(()=>[(m(!0),b(M,null,Y(_(g),s=>(m(),C(K,{key:s.id,class:"mb-20rpx"},{right:o(()=>[i(c,{class:"action"},{default:o(()=>[i(c,{class:"button",style:{background:"var(--wot-color-theme)"},onClick:f=>G("del",s)},{default:o(()=>[O(A(_(a)("addressBook.delete.button")),1)]),_:2},1032,["onClick"])]),_:2},1024)]),default:o(()=>[i(c,{class:te(["bg-white px-22rpx py-18rpx",{"notification-read":s.readFlag}]),onClick:f=>H(s)},{default:o(()=>[i(c,{class:"mb-8rpx flex items-center justify-between"},{default:o(()=>[i(c,{class:"flex items-center"},{default:o(()=>[i(S,{src:P(s.noticeType),class:"h-36rpx w-36rpx"},null,8,["src"]),i(D,{class:"ml-8rpx text-24rpx font-bold"},{default:o(()=>[O(A(l(s)),1)]),_:2},1024)]),_:2},1024),i(c,{class:"flex items-center"},{default:o(()=>[i(D,{class:"text-22rpx"},{default:o(()=>[O(A($(s.createTime)),1)]),_:2},1024)]),_:2},1024)]),_:2},1024),i(c,{class:"flex items-center justify-between text-22rpx"},{default:o(()=>[i(c,{class:"line-clamp-2 flex-1 break-all"},{default:o(()=>[O(A(E(s)),1)]),_:2},1024),s.readFlag?ie("",!0):(m(),C(c,{key:0,class:"ml-8rpx h-12rpx w-12rpx flex-shrink-0 rounded-full bg-#FF0000"}))]),_:2},1024)]),_:2},1032,["class","onClick"])]),_:2},1024))),128))]),_:1})]),_:1},8,["modelValue"])]),_:1})}}}),Ke=ue(Se,[["__scopeId","data-v-e9557e7f"]]);export{Ke as default};