pages-order-list.f9217b10.js 7.1 KB

1
  1. import{y as t,o as a,n as s,z as e,a as n,b as o,e as i,f as l,w as r,aa as u,_ as c,l as d,j as p,g,k as m,r as f,F as _,m as b,i as y,t as k,u as C,B as x,v,C as w,s as h,M as j,a1 as S,G as T}from"./index-b48a414d.js";import{_ as M}from"./su-tabs.a383f815.js";import{_ as $}from"./su-sticky.aabc6a00.js";import{_ as O}from"./s-empty.6d3471cc.js";import{_ as z}from"./s-goods-item.13120f93.js";import{_ as G}from"./uni-load-more.647920f4.js";import{j as I,_ as N,m as P,k as B,f as E}from"./s-layout.d6dcdc81.js";import{_ as A}from"./_plugin-vue_export-helper.1b428a4d.js";import"./uni-badge.78cdef34.js";/* empty css */import"./points.c381a8e1.js";/* empty css */import"./phone-international-input.feef99c7.js";const F=A({__name:"list",setup(A){const F={list:[],current_page:1,total:1,last_page:1},U=t({currentTab:0,pagination:{list:[],current_page:1,total:1,last_page:1},loadStatus:""}),W=t([{name:"全部",num:0,isShow:!1},{name:"待付款",value:0,num:0,isShow:!0},{name:"待发货",value:10,num:0,isShow:!0},{name:"待收货",value:20,num:0,isShow:!0},{name:"待评价",value:30,num:0,isShow:!0}]);function q(t){U.currentTab!==t.index&&(U.pagination.list=[],U.pagination.current_page=1,U.pagination.total=1,U.pagination.last_page=1,U.currentTab=t.index,H())}function D(t){h.$router.go("/pages/order/detail",{id:t})}async function H(t=1,a=5){U.loadStatus="loading";let{code:s,data:e}=await u.getOrderPage({pageNo:t,pageSize:a,status:W[U.currentTab].value,commentStatus:30!==W[U.currentTab].value&&null});if(async function(){let{data:t}=await u.getOrderCount();W[0].num=t.allCount,W[1].num=t.unpaidCount,W[2].num=t.undeliveredCount,W[3].num=t.deliveredCount,W[4].num=t.uncommentedCount}(),0!==s)return;let n=c.concat(U.pagination.list,e.list);e.list.forEach((t=>I(t))),U.pagination.list=n,U.pagination.total=e.total,U.pagination.last_page=Math.ceil(e.total/5),U.pagination.current_page<U.pagination.last_page?U.loadStatus="more":U.loadStatus="noMore"}return a((async t=>{console.log(t.type),t.type&&(U.currentTab=t.type),await H()})),s((async()=>{"loading"!=U.loadStatus&&(U.pagination.list=[],U.pagination.current_page=1,U.pagination.total=1,U.pagination.last_page=1,await H())})),e((()=>{"noMore"!==U.loadStatus&&(U.pagination.current_page+=1,H(U.pagination.current_page))})),n((()=>{U.pagination.list=[],U.pagination.current_page=1,U.pagination.total=1,U.pagination.last_page=1,H(),setTimeout((function(){o()}),800)})),(t,a)=>{const s=d(b("su-tabs"),M),e=d(b("su-sticky"),$),n=d(b("s-empty"),O),o=y,c=d(b("s-goods-item"),z),A=T,J=d(b("uni-load-more"),G),K=d(b("s-layout"),N);return i(),l(K,{title:"我的订单"},{default:r((()=>[p(e,{bgColor:"#fff"},{default:r((()=>[p(s,{list:W,scrollable:!1,onChange:q,current:U.currentTab,badge:!0},null,8,["list","current"])])),_:1}),0===U.pagination.total?(i(),l(n,{key:0,icon:"/static/order-empty.png",text:"暂无订单"})):g("",!0),U.pagination.total>0?(i(),l(o,{key:1},{default:r((()=>[(i(!0),m(_,null,f(U.pagination.list,((t,a)=>(i(),l(o,{class:"bg-white order-list-card-box ss-r-10 ss-m-t-14 ss-m-20",key:t.id,onClick:a=>D(t.id)},{default:r((()=>[p(o,{class:"order-card-header ss-flex ss-col-center ss-row-between ss-p-x-20"},{default:r((()=>[p(o,{class:"order-no"},{default:r((()=>[k("订单号:"+C(t.no),1)])),_:2},1024),p(o,{class:x(["order-state ss-font-26",v(P)(t)])},{default:r((()=>[k(C(v(B)(t)),1)])),_:2},1032,["class"])])),_:2},1024),(i(!0),m(_,null,f(t.items,(t=>(i(),l(o,{class:"border-bottom",key:t.id},{default:r((()=>[p(c,{img:t.picUrl,title:t.spuName,skuText:t.properties.map((t=>t.valueName)).join(" "),price:t.price,num:t.count},null,8,["img","title","skuText","price","num"])])),_:2},1024)))),128)),p(o,{class:"pay-box ss-m-t-30 ss-flex ss-row-right ss-p-r-20"},{default:r((()=>[p(o,{class:"ss-flex ss-col-center"},{default:r((()=>[p(o,{class:"discounts-title pay-color"},{default:r((()=>[k("共 "+C(t.productCount)+" 件商品,总金额:",1)])),_:2},1024),p(o,{class:"discounts-money pay-color"},{default:r((()=>[k(" ¥"+C(v(E)(t.payPrice)),1)])),_:2},1024)])),_:2},1024)])),_:2},1024),p(o,{class:x(["order-card-footer ss-flex ss-col-center ss-p-x-20",t.buttons.length>3?"ss-row-between":"ss-row-right"])},{default:r((()=>[p(o,{class:"ss-flex ss-col-center"},{default:r((()=>[t.buttons.includes("combination")?(i(),l(A,{key:0,class:"tool-btn ss-reset-button",onClick:w((a=>function(t){h.$router.go("/pages/activity/groupon/detail",{id:t.ext.groupon_id})}(t)),["stop"])},{default:r((()=>[k(" 拼团详情 ")])),_:2},1032,["onClick"])):g("",!0),0===t.buttons.length?(i(),l(A,{key:1,class:"tool-btn ss-reset-button",onClick:w((a=>D(t.id)),["stop"])},{default:r((()=>[k(" 查看详情 ")])),_:2},1032,["onClick"])):g("",!0),t.buttons.includes("express")?(i(),l(A,{key:2,class:"tool-btn ss-reset-button",onClick:w((a=>async function(t){h.$router.go("/pages/order/express/log",{id:t})}(t.id)),["stop"])},{default:r((()=>[k(" 查看物流 ")])),_:2},1032,["onClick"])):g("",!0),t.buttons.includes("confirm")?(i(),l(A,{key:3,class:"tool-btn ss-reset-button",onClick:w((a=>async function(t,a=!1){j({title:"提示",content:"确认收货?",success:async function(s){if(s.confirm){if("WechatMiniProgram"===h.$platform.name&&!S.isEmpty(t.wechat_extra_data)&&!a)return void mpConfirm(t);const{code:s}=await u.receiveOrder(t.id);0===s&&(U.pagination=F,await H())}}})}(t)),["stop"])},{default:r((()=>[k(" 确认收货 ")])),_:2},1032,["onClick"])):g("",!0),t.buttons.includes("cancel")?(i(),l(A,{key:4,class:"tool-btn ss-reset-button",onClick:w((a=>async function(t){j({title:"提示",content:"确定要取消订单吗?",success:async function(a){if(!a.confirm)return;const{code:s}=await u.cancelOrder(t);if(0===s){let a=U.pagination.list.findIndex((a=>a.id===t));const s=U.pagination.list[a];s.status=40,I(s),await H()}}})}(t.id)),["stop"])},{default:r((()=>[k(" 取消订单 ")])),_:2},1032,["onClick"])):g("",!0),t.buttons.includes("comment")?(i(),l(A,{key:5,class:"tool-btn ss-reset-button",onClick:w((a=>{return s=t.id,void h.$router.go("/pages/goods/comment/add",{id:s});var s}),["stop"])},{default:r((()=>[k(" 评价 ")])),_:2},1032,["onClick"])):g("",!0),t.buttons.includes("delete")?(i(),l(A,{key:6,class:"delete-btn ss-reset-button",onClick:w((a=>{return s=t.id,void j({title:"提示",content:"确定要删除订单吗?",success:async function(t){if(t.confirm){const{code:t}=await u.deleteOrder(s);if(0===t){let t=U.pagination.list.findIndex((t=>t.id===s));U.pagination.list.splice(t,1),await H()}}}});var s}),["stop"])},{default:r((()=>[k(" 删除订单 ")])),_:2},1032,["onClick"])):g("",!0),t.buttons.includes("pay")?(i(),l(A,{key:7,class:"tool-btn ss-reset-button ui-BG-Main-Gradient",onClick:w((a=>{return s=t.id,void h.$router.go("/pages/pay/index",{id:s,openType:2});var s}),["stop"])},{default:r((()=>[k(" 继续支付 ")])),_:2},1032,["onClick"])):g("",!0)])),_:2},1024)])),_:2},1032,["class"])])),_:2},1032,["onClick"])))),128))])),_:1})):g("",!0),U.pagination.total>0?(i(),l(J,{key:2,status:U.loadStatus,"content-text":{contentdown:"上拉加载更多"},onClick:t.loadmore},null,8,["status","onClick"])):g("",!0)])),_:1})}}},[["__scopeId","data-v-23921893"]]);export{F as default};