1 |
- import{v as o,o as s,x as t,e as a,f as e,w as n,a2 as c,l as i,j as l,u,s as p,p as d,t as r,z as m,g,k as _,r as f,F as y,_ as b,a3 as k,q as w,i as S,C as x,D as h,m as j}from"./index-9880b451.js";import{_ as v,a as T}from"./uni-collapse.e41052e8.js";import{_ as C}from"./su-tabs.1ce39404.js";import{_ as I}from"./su-sticky.84aef901.js";import{_ as M}from"./s-goods-column.2324341a.js";import{_ as z}from"./uni-load-more.aac4524a.js";import{_ as F}from"./s-empty.74111684.js";import{_ as $}from"./s-layout.dfc5b0b5.js";import{f as N}from"./useGoods.bdd1c2ea.js";import{S as P}from"./spu.3137f763.js";import{C as B}from"./category.b10aec72.js";import{r as E}from"./index.df38848e.js";import{_ as L}from"./_plugin-vue_export-helper.1b428a4d.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){E(V.pagination),V.currentTab=o.index,V.categoryId=o.value,D()}async function D(){V.loadStatus="loading";const{code:o,data:s}=await P.getSpuPage({categoryId:V.categoryId,pageNo:V.pagination.pageNo,pageSize:V.pagination.pageSize});0===o&&(V.pagination.list=b.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 c.takeCoupon(V.id);0===o&&(k({title:"领取成功"}),setTimeout((()=>{Y()}),1e3))}async function Y(){const{code:o,data:s}=V.id>0?await c.getCouponTemplate(V.id):await c.getCoupon(V.couponId);0===o&&(V.coupon=s,2===V.coupon.productScope?await async function(){const{data:o,code:s}=await P.getSpuListByIds(V.coupon.productScopeValues.join(","));0===s&&(V.pagination.list=o)}():3===V.coupon.productScope&&await async function(){const{data:o,code:s}=await B.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 D()))}())}function Z(){"noMore"!==V.loadStatus&&(V.pagination.pageNo++,D())}return s((o=>{V.id=o.id,V.couponId=o.couponId,Y(V.id,V.couponId)})),t((()=>{Z()})),(o,s)=>{const t=w,c=S,b=x,k=h,P=i(j("uni-collapse-item"),v),B=i(j("uni-collapse"),T),E=i(j("su-tabs"),C),L=i(j("su-sticky"),I),D=i(j("s-goods-column"),M),Y=i(j("uni-load-more"),z),A=i(j("s-empty"),F),H=i(j("s-layout"),$);return a(),e(H,{title:"优惠券详情"},{default:n((()=>[l(c,{class:"bg-white"},{default:n((()=>[l(c,{class:"detail-wrap ss-p-20"},{default:n((()=>[l(c,{class:"detail-box"},{default:n((()=>[l(c,{class:"tag-box ss-flex ss-col-center ss-row-center"},{default:n((()=>[l(t,{class:"tag-image",src:u(p).$url.static("/static/img/shop/app/coupon_icon.png"),mode:"aspectFit"},null,8,["src"])])),_:1}),l(c,{class:"top ss-flex-col ss-col-center"},{default:n((()=>[l(c,{class:"title ss-m-t-50 ss-m-b-20 ss-m-x-20"},{default:n((()=>[d(r(V.coupon.name),1)])),_:1}),l(c,{class:"subtitle ss-m-b-50"},{default:n((()=>[d(" 满 "+r(u(N)(V.coupon.usePrice))+" 元, "+r(1===V.coupon.discountType?"减 "+u(N)(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(c,{key:0,class:"time ss-m-y-30"},{default:n((()=>[d(" 有效期:领取后 "+r(V.coupon.fixedEndTerm)+" 天内可用 ",1)])),_:1})):(a(),e(c,{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(c,{class:"coupon-line ss-m-t-14"})])),_:1}),l(c,{class:"bottom"},{default:n((()=>[l(c,{class:"type ss-flex ss-col-center ss-row-between ss-p-x-30"},{default:n((()=>[l(c,null,{default:n((()=>[d("优惠券类型")])),_:1}),l(c,null,{default:n((()=>[d(r(1===V.coupon.discountType?"满减券":"折扣券"),1)])),_:1})])),_:1}),l(B,null,{default:n((()=>[V.coupon.description?(a(),e(P,{key:0,title:"优惠券说明"},{default:n((()=>[l(c,{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(c,{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(c,{class:"goods-title ss-p-20"},{default:n((()=>[d(r(2===V.coupon.productScope?"指定商品可用":"指定分类可用"),1)])),_:1}),3===V.coupon.productScope?(a(),e(E,{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(c,{key:2},{default:n((()=>[(a(!0),_(y,null,f(V.pagination.list,((o,s)=>(a(),e(c,{key:s},{default:n((()=>[l(D,{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(c,{key:3},{default:n((()=>[(a(!0),_(y,null,f(V.pagination.list,((o,s)=>(a(),e(c,{key:s},{default:n((()=>[l(D,{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(Y,{key:4,status:V.loadStatus,"content-text":{contentdown:"上拉加载更多"},onClick:Z},null,8,["status"])):g("",!0),3===V.coupon.productScope&&0===V.pagination.total?(a(),e(A,{key:5,paddingTop:"0",icon:"/static/soldout-empty.png",text:"暂无商品"})):g("",!0)])),_:1})])),_:1})}}},[["__scopeId","data-v-ede3dc96"]]);export{V as default};
|