myOrder.js
4.0 KB
"use strict";const e=require("../../common/vendor.js"),_=require("../../api/index.js");require("../../utils/request.js");if(!Array){const g=e.resolveComponent("u-navbar"),n=e.resolveComponent("u-tabs"),a=e.resolveComponent("u-count-down");(g+n+a)()}const C=()=>"../../uni_modules/uview-plus/components/u-navbar/u-navbar.js",S=()=>"../../uni_modules/uview-plus/components/u-tabs/u-tabs.js",P=()=>"../../uni_modules/uview-plus/components/u-count-down/u-count-down.js";Math||(C+S+P+R+j+L)();const R=()=>"../../componets/orderShop.js",j=()=>"../../componets/checkPayMode.js",L=()=>"../../componets/tipPop.js",B={__name:"myOrder",setup(g){e.onLoad(t=>{n.value=t.status*1,d(n.value==5?21:n.value==4?5:n.value*1)}),e.onShow(()=>{console.log("订单状态",n.value)});let n=e.ref(0),a=e.ref([]);const h=e.reactive([{name:"全部"},{name:"待付款"},{name:"待发货"},{name:"待收货"},{name:"待评价"},{name:"售后"}]),l=(t,s)=>{c.value=t.id,s==0||s==2?(p.value=s==0?1:2,i.value=!0):s==1?u.value=!0:s==3?$():s==4?e.index.navigateTo({url:`/pages/mine/evaluate?id=${t.id}`}):s==5&&v(t.id)},x=t=>{console.log(t),i.value=!1,t==1&&(p.value==1?O():T())};let c=e.ref(""),w=e.ref(0),p=e.ref(1),u=e.ref(!1),i=e.ref(!1);const v=t=>{console.log("订单"),e.index.navigateTo({url:`/pages/mine/orderDetail?id=${t}`})},b=t=>{e.index.setClipboardData({data:t,success:()=>{e.index.showToast({title:"复制成功",icon:"none"})}})},y=t=>{console.log(t),d(t.index==5?21:t.index==4?5:t.index)},d=async t=>{try{const s=await _.getOrderList(t);a.value=s,console.log("getOrderList",s)}catch(s){e.index.showToast({title:s,icon:"none"}),console.log("getOrderList",s)}},O=async()=>{try{const t=await _.getCancleOrder(c.value);e.index.showToast({title:"订单已取消~",icon:"none"}),i.value=!1,n.value=0,d(0),console.log("getCancleOrder",t)}catch(t){e.index.showToast({title:t,icon:"none"}),console.log("getCancleOrder",t)}},T=async()=>{try{const t=await _.getRefund(c.value);e.index.showToast({title:"已申请,等待客服审核",icon:"none"}),d(2),console.log("getRefund",t)}catch(t){e.index.showToast({title:t,icon:"none"}),console.log("getRefund",t)}},$=async()=>{try{const t=await _.getReceipt(c.value);e.index.showToast({title:"已收货,期待下次下单~",icon:"none"}),d(3),console.log("getReceipt",t)}catch(t){e.index.showToast({title:t,icon:"none"}),console.log("getReceipt",t)}};return(t,s)=>e.e({a:e.p({placeholder:!0,title:"订单",bgColor:"#F8FAFB",autoBack:!0}),b:e.o(y),c:e.p({activeStyle:{color:"#000000",fontWeight:"bold",transform:"scale(1.05)"},inactiveStyle:{color:"#00000099",transform:"scale(1)"},itemStyle:"padding-left: 5px;padding-bottom:12rpx; padding-right: 5px; height: 34px;",list:h,current:e.unref(n),lineWidth:"15",lineColor:"#FB753C",scrollable:!1}),d:e.f(e.unref(a),(o,k,f)=>e.e({a:o.order_status==1},o.order_status==1?{b:"67be9ace-2-"+f,c:e.p({time:o.time*1e3,format:"mm:ss"})}:{},{d:[3,4,21].includes(o.order_status)},[3,4,21].includes(o.order_status)?{e:e.t(o.express_no),f:e.o(r=>b(o.express_no),o.id)}:{},{g:"67be9ace-3-"+f,h:e.p({shop:o}),i:o.order_status==1},o.order_status==1?e.e({j:e.t(o.goodstatus_text==3?"取消兑换":"取消付款"),k:e.o(r=>l(o,0),o.id),l:o.order_status==1},o.order_status==1?{m:e.t(o.goodstatus_text==3?"立即兑换":"立即支付"),n:e.o(r=>l(o,1),o.id)}:{}):{},{o:o.order_status==2},o.order_status==2?{p:e.o(r=>l(o,2),o.id)}:{},{q:o.order_status==3},o.order_status==3?e.e({r:o.order_status==3},o.order_status==3?{s:e.o(r=>!0,o.id)}:{},{t:e.o(r=>l(o,3),o.id)}):{},{v:o.order_status==5},o.order_status==5?{w:e.o(r=>l(o,4),o.id)}:{},{x:o.order_status==21},o.order_status==21?{y:e.o(r=>l(o,5),o.id)}:{},{z:o.id,A:e.o(r=>v(o.id),o.id)})),e:!e.unref(a).length},e.unref(a).length?{}:{},{f:e.o(o=>e.isRef(u)?u.value=!1:u=!1),g:e.p({orderId:e.unref(c),isOrderPay:!0,totalPrice:e.unref(a).total_price,modeShow:e.unref(u)}),h:e.o(x),i:e.p({integral:e.unref(w),tipType:e.unref(p),tipShow:e.unref(i)})})}},M=e._export_sfc(B,[["__file","D:/vue/大健康商城/healthMall/pages/mine/myOrder.vue"]]);wx.createPage(M);