You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
2 lines
7.4 KiB
2 lines
7.4 KiB
11 months ago
|
import{_ as e}from"./u-tabs.f280784d.js";import{p as a,q as t,o as s,c as o,w as l,n,i,a as r,b as u,d,F as c,f as m,e as p,x as _,g as f,t as h,k as y}from"./index-ae8bbb19.js";import{r as g}from"./uni-app.es.ee1d5b08.js";import{M as v,_ as C}from"./mescroll-mixins.7cda1bf3.js";import{_ as E}from"./u-popup.d74d5514.js";import{a as T,D as k,b,P as R,R as S}from"./OrderType.fdcce3af.js";import{l as D,c as I,r as L,e as P}from"./order.76bebd87.js";import{_ as x}from"./_plugin-vue_export-helper.1b428a4d.js";import"./u-icon.b463ad8a.js";const w=[{name:"全部",value:"all"},{name:"待支付",value:"payment"},{name:"待发货",value:"delivery"},{name:"待收货",value:"received"},{name:"待评价",value:"comment"}];const O=x({mixins:[v],data:()=>({DeliveryStatusEnum:T,DeliveryTypeEnum:k,OrderStatusEnum:b,PayStatusEnum:R,ReceiptStatusEnum:S,options:{dataType:"all"},tabs:w,curTab:0,list:a(),upOption:{auto:!0,page:{size:15},noMoreSize:4,empty:{tip:"亲,暂无订单记录"}},canReset:!1,showQRCodePopup:!1,qrcodeImage:""}),onLoad(e){this.initCurTab(e),uni.$on("syncRefresh",(e=>{this.canReset=e}))},onShow(){this.canReset&&this.onRefreshList(),this.canReset=!1},onUnload(){uni.$off("syncRefresh")},methods:{initCurTab(e){const a=this;if(e.dataType){const t=a.tabs.findIndex((a=>a.value==e.dataType));a.curTab=t>-1?t:0}},upCallback(e){const a=this;a.getOrderList(e.num).then((e=>{const t=e.data.length,s=e.data.total;a.mescroll.endBySize(t,s)})).catch((()=>a.mescroll.endErr()))},getOrderList(e=1){const a=this;return new Promise(((s,o)=>{D({dataType:a.getTabValue(),page:e},{load:!1}).then((o=>{const l=a.initList(o.data.list);a.list.data=t(l,a.list,e),s(l)}))}))},initList:e=>(e.data.forEach((e=>{e.total_num=0,e.goods.forEach((a=>{e.total_num+=a.total_num}))})),e),getTabValue(){return this.tabs[this.curTab].value},onChangeTab(e){this.curTab=e,this.onRefreshList()},onRefreshList(){this.list=a(),setTimeout((()=>{this.mescroll.resetUpScroll()}),120)},onCancel(e){const a=this;uni.showModal({title:"友情提示",content:"确认要取消该订单吗?",success(t){t.confirm&&I(e).then((e=>{a.$toast(e.message),a.onRefreshList()}))}})},onReceipt(e){const a=this;uni.showModal({title:"友情提示",content:"确认收到商品了吗?",success(t){t.confirm&&L(e).then((e=>{a.$success(e.message),a.onRefreshList()}))}})},onExtractQRCode(e){const a=this;P(e,{channel:a.platform}).then((e=>{a.qrcodeImage=e.data.qrcode,a.showQRCodePopup=!0}))},onPay(e){this.$navTo("pages/checkout/cashier/index",{orderId:e})},handleTargetDetail(e){this.$navTo("pages/order/detail",{orderId:e})},handleTargetComment(e){this.$navTo("pages/order/comment/index",{orderId:e})}}},[["render",function(a,t,v,T,k,b){const R=g(_("u-tabs"),e),S=y,D=i,I=f,L=g(_("mescroll-body"),C),P=g(_("u-popup"),E);return s(),o(D,{class:"container",style:n(a.appThemeStyle)},{default:l((()=>[r(L,{ref:"mescrollRef",sticky:!0,onInit:a.mescrollInit,down:{native:!0},onDown:a.downCallback,up:k.upOption,onUp:b.upCallback},{default:l((()=>[r(R,{list:k.tabs,"is-scroll":!1,current:k.curTab,"active-color":a.appTheme.mainBg,duration:.2,onChange:b.onChangeTab},null,8,["list","current","active-color","duration","onChange"]),r(D,{class:"order-list"},{default:l((()=>[(s(!0),u(c,null,d(k.list.data,((e,a)=>(s(),o(D,{class:"order-item",key:a},{default:l((()=>[r(D,{class:"item-top"},{default:l((()=>[r(D,{class:"item-top-left"},{default:l((()=>[r(S,{class:"order-time"},{default:l((()=>[m(h(e.create_time),1)])),_:2},1024)])),_:2},1024),r(D,{class:"item-top-right"},{default:l((()=>[r(S,{class:"state-text"},{default:l((()=>[m(h(e.state_text),1)])),_:2},1024)])),_:2},1024)])),_:2},1024),r(D,{class:"goods-list",onClick:a=>b.handleTargetDetail(e.order_id)},{default:l((()=>[(s(!0),u(c,null,d(e.goods,((e,a)=>(s(),o(D,{class:"goods-item",key:a},{default:l((()=>[r(D,{class:"goods-image"},{default:l((()=>[r(I,{class:"image",src:e.goods_image,mode:"scaleToFill"},null,8,["src"])])),_:2},1024),r(D,{class:"goods-content"},{default:l((()=>[r(D,{class:"goods-title"},{default:l((()=>[r(S,{class:"twoline-hide"},{default:l((()=>[m(h(e.goods_name
|