pages-coupon-detail.a37501cf.js 6.4 KB

1
  1. import{z as o,o as s,A as t,f as a,g as e,w as n,aM as i,m as c,k as l,x as u,s as p,u as d,v as r,E as m,i as g,l as _,r as f,F as y,S as b,_ as k,C as w,an as S,y as x,j as h,I as j,J as v,n as T}from"./index-ba48620e.js";import{_ as I,a as C}from"./uni-collapse.5a6c1212.js";import{_ as M}from"./su-tabs.40b9ec30.js";import{_ as z}from"./su-sticky.f4f657b5.js";import{_ as F}from"./s-goods-column.8dd4e061.js";import{_ as $}from"./uni-load-more.966faf1b.js";import{_ as E}from"./s-empty.a75760f9.js";import{_ as N}from"./s-layout.04b95866.js";import{f as P,r as B}from"./useGoods.edb8879f.js";import{_ as L}from"./_plugin-vue_export-helper.1b428a4d.js";import"./phone-international-input.dd3ca29e.js";import"./uni-badge.539e0aa6.js";import"./points.c381a8e1.js";/* empty css *//* empty css *//* empty css */const V=L({__name:"detail",setup(L){const V=o({id:0,couponId:0,coupon:{},pagination:{list:[],total:0,pageNo:1,pageSize:1},categoryId:0,tabMaps:[],currentTab:0,loadStatus:""});function q(o){B(V.pagination),V.currentTab=o.index,V.categoryId=o.value,A()}async function A(){V.loadStatus="loading";const{code:o,data:s}=await b.getSpuPage({categoryId:V.categoryId,pageNo:V.pagination.pageNo,pageSize:V.pagination.pageSize});0===o&&(V.pagination.list=k.concat(V.pagination.list,s.list),V.pagination.total=s.total,V.loadStatus=V.pagination.list.length<V.pagination.total?"more":"noMore")}async function G(){const{code:o}=await i.takeCoupon(V.id);0===o&&(S({title:"领取成功"}),setTimeout((()=>{J()}),1e3))}async function J(){const{code:o,data:s}=V.id>0?await i.getCouponTemplate(V.id):await i.getCoupon(V.couponId);0===o&&(V.coupon=s,2===V.coupon.productScope?await async function(){const{data:o,code:s}=await b.getSpuListByIds(V.coupon.productScopeValues.join(","));0===s&&(V.pagination.list=o)}():3===V.coupon.productScope&&await async function(){const{data:o,code:s}=await w.getCategoryListByIds(V.coupon.productScopeValues.join(","));0===s&&(V.tabMaps=o.map((o=>({name:o.name,value:o.id}))),V.tabMaps.length>0&&(V.categoryId=V.tabMaps[0].value,await A()))}())}function D(){"noMore"!==V.loadStatus&&(V.pagination.pageNo++,A())}return s((o=>{V.id=o.id,V.couponId=o.couponId,J(V.id,V.couponId)})),t((()=>{D()})),(o,s)=>{const t=x,i=h,b=j,k=v,w=c(T("uni-collapse-item"),I),S=c(T("uni-collapse"),C),B=c(T("su-tabs"),M),L=c(T("su-sticky"),z),A=c(T("s-goods-column"),F),J=c(T("uni-load-more"),$),H=c(T("s-empty"),E),K=c(T("s-layout"),N);return a(),e(K,{title:"优惠券详情"},{default:n((()=>[l(i,{class:"bg-white"},{default:n((()=>[l(i,{class:"detail-wrap ss-p-20"},{default:n((()=>[l(i,{class:"detail-box"},{default:n((()=>[l(i,{class:"tag-box ss-flex ss-col-center ss-row-center"},{default:n((()=>[l(t,{class:"tag-image",src:u(p).$url.static("/static/images/coupon_icon.png"),mode:"aspectFit"},null,8,["src"])])),_:1}),l(i,{class:"top ss-flex-col ss-col-center"},{default:n((()=>[l(i,{class:"title ss-m-t-50 ss-m-b-20 ss-m-x-20"},{default:n((()=>[d(r(V.coupon.name),1)])),_:1}),l(i,{class:"subtitle ss-m-b-50"},{default:n((()=>[d(" 满 "+r(u(P)(V.coupon.usePrice))+" 元, "+r(1===V.coupon.discountType?"减 "+u(P)(V.coupon.discountPrice)+" 元":"打 "+V.coupon.discountPercent/10+" 折"),1)])),_:1}),l(k,{class:m(["ss-reset-button ss-m-b-30",V.coupon.canTake||1===V.coupon.status?"use-btn":"disable-btn"]),disabled:!V.coupon.canTake,onClick:G},{default:n((()=>[V.id>0?(a(),e(b,{key:0},{default:n((()=>[d(r(V.coupon.canTake?"立即领取":"已领取"),1)])),_:1})):(a(),e(b,{key:1},{default:n((()=>[d(r(1===V.coupon.status?"立即使用":2===V.coupon.status?"已使用":"已过期"),1)])),_:1}))])),_:1},8,["class","disabled"]),2===V.coupon.validityType?(a(),e(i,{key:0,class:"time ss-m-y-30"},{default:n((()=>[d(" 有效期:领取后 "+r(V.coupon.fixedEndTerm)+" 天内可用 ",1)])),_:1})):(a(),e(i,{key:1,class:"time ss-m-y-30"},{default:n((()=>[d(" 有效期: "+r(u(p).$helper.timeFormat(V.coupon.validStartTime,"yyyy-mm-dd"))+" 至 "+r(u(p).$helper.timeFormat(V.coupon.validEndTime,"yyyy-mm-dd")),1)])),_:1})),l(i,{class:"coupon-line ss-m-t-14"})])),_:1}),l(i,{class:"bottom"},{default:n((()=>[l(i,{class:"type ss-flex ss-col-center ss-row-between ss-p-x-30"},{default:n((()=>[l(i,null,{default:n((()=>[d("优惠券类型")])),_:1}),l(i,null,{default:n((()=>[d(r(1===V.coupon.discountType?"满减券":"折扣券"),1)])),_:1})])),_:1}),l(S,null,{default:n((()=>[V.coupon.description?(a(),e(w,{key:0,title:"优惠券说明"},{default:n((()=>[l(i,{class:"content ss-p-b-20"},{default:n((()=>[l(b,{class:"des ss-p-l-30"},{default:n((()=>[d(r(V.coupon.description),1)])),_:1})])),_:1})])),_:1})):g("",!0)])),_:1})])),_:1})])),_:1})])),_:1}),1===V.coupon.productScope?(a(),e(i,{key:0,class:"all-user ss-flex ss-row-center ss-col-center"},{default:n((()=>[d(" 全场通用 ")])),_:1})):(a(),e(L,{key:1,bgColor:"#fff"},{default:n((()=>[l(i,{class:"goods-title ss-p-20"},{default:n((()=>[d(r(2===V.coupon.productScope?"指定商品可用":"指定分类可用"),1)])),_:1}),3===V.coupon.productScope?(a(),e(B,{key:0,scrollable:!0,list:V.tabMaps,onChange:q,current:V.currentTab},null,8,["list","current"])):g("",!0)])),_:1})),2===V.coupon.productScope?(a(),e(i,{key:2},{default:n((()=>[(a(!0),_(y,null,f(V.pagination.list,((o,s)=>(a(),e(i,{key:s},{default:n((()=>[l(A,{class:"ss-m-20",size:"lg",data:o,onClick:s=>u(p).$router.go("/pages/goods/index",{id:o.id}),goodsFields:{title:{show:!0},subtitle:{show:!0},price:{show:!0},original_price:{show:!0},sales:{show:!0},stock:{show:!1}}},null,8,["data","onClick"])])),_:2},1024)))),128))])),_:1})):g("",!0),3===V.coupon.productScope?(a(),e(i,{key:3},{default:n((()=>[(a(!0),_(y,null,f(V.pagination.list,((o,s)=>(a(),e(i,{key:s},{default:n((()=>[l(A,{class:"ss-m-20",size:"lg",data:o,onClick:s=>u(p).$router.go("/pages/goods/index",{id:o.id}),goodsFields:{title:{show:!0},subtitle:{show:!0},price:{show:!0},original_price:{show:!0},sales:{show:!0},stock:{show:!1}}},null,8,["data","onClick"])])),_:2},1024)))),128))])),_:1})):g("",!0),V.pagination.total>0&&3===V.coupon.productScope?(a(),e(J,{key:4,status:V.loadStatus,"content-text":{contentdown:"上拉加载更多"},onClick:D},null,8,["status"])):g("",!0),3===V.coupon.productScope&&0===V.pagination.total?(a(),e(H,{key:5,paddingTop:"0",icon:"/static/soldout-empty.png",text:"暂无商品"})):g("",!0)])),_:1})])),_:1})}}},[["__scopeId","data-v-2d467455"]]);export{V as default};