1 |
- import{v as e,c as s,l as o,m as t,e as a,f as l,w as d,j as r,p as c,k as n,F as i,r as u,A as f,i as m,E as p,G as _,S as y,D as I,t as b,g as w,u as x,s as h,q as g,o as k,aj as v,a2 as P,z as C,ak as j,a8 as V,C as A}from"./index-9880b451.js";import{_ as B}from"./s-address-item.6ee3b96c.js";import{_ as S}from"./s-goods-item.f5d79fd7.js";import{d as $,g as D,a as E,_ as O}from"./s-layout.dfc5b0b5.js";import{_ as G}from"./s-coupon-list.39460476.js";import{_ as T}from"./_plugin-vue_export-helper.1b428a4d.js";import{f as H}from"./useGoods.bdd1c2ea.js";/* empty css */import"./index.df38848e.js";const L=T({__name:"s-coupon-select",props:{modelValue:{type:Object,default(){}},show:{type:Boolean,default:!1}},emits:["confirm","close"],setup(b,{emit:w}){const x=b,h=e({couponInfo:s((()=>x.modelValue)),couponId:0});function g(e){h.couponId===e?h.couponId=0:h.couponId=e}const k=()=>{w("confirm",h.couponId)};return(e,s)=>{const x=m,v=p,P=_,C=o(t("s-coupon-list"),G),j=y,V=I,A=o(t("su-popup"),$);return a(),l(A,{show:b.show,type:"bottom",round:"20",onClose:s[0]||(s[0]=e=>w("close")),showClose:"",backgroundColor:"#f2f2f2"},{default:d((()=>[r(x,{class:"model-box"},{default:d((()=>[r(x,{class:"title ss-m-t-16 ss-m-l-20 ss-flex"},{default:d((()=>[c("优惠券")])),_:1}),r(j,{class:"model-content","scroll-y":"","scroll-with-animation":!1,"enable-back-to-top":!0},{default:d((()=>[r(x,{class:"subtitle ss-m-l-20"},{default:d((()=>[c("可使用优惠券")])),_:1}),(a(!0),n(i,null,u(h.couponInfo,((e,s)=>(a(),l(x,{key:s},{default:d((()=>[r(C,{data:e,type:"user",disabled:!1},{default:d((()=>[r(P,{class:"ss-flex ss-col-center",onClick:s=>g(e.id)},{default:d((()=>[r(v,{color:"var(--ui-BG-Main)",style:{transform:"scale(0.8)"},checked:h.couponId===e.id,onClick:f((s=>g(e.id)),["stop"])},null,8,["checked","onClick"])])),_:2},1032,["onClick"])])),_:2},1032,["data"])])),_:2},1024)))),128))])),_:1})])),_:1}),r(x,{class:"modal-footer ss-flex"},{default:d((()=>[r(V,{class:"confirm-btn ss-reset-button",onClick:k},{default:d((()=>[c("确认")])),_:1})])),_:1})])),_:1},8,["show"])}}},[["__scopeId","data-v-abe43c08"]]),M=T({__name:"s-discount-list",props:{promoInfo:{type:Array,default:()=>[]},goodsList:{type:Array,default:()=>[]},modelValue:{type:Object,default(){}},show:{type:Boolean,default:!1}},emits:["close"],setup(f,{emit:p}){const _=f,k=e({orderInfo:s((()=>_.modelValue))}),v=e=>{let s="";return k.orderInfo.goods_list.forEach((o=>{e==o.goods_id&&(s=o.goods.image)})),s};return(e,s)=>{const _=m,P=g,C=y,j=I,V=o(t("su-popup"),$);return a(),l(V,{show:f.show,type:"bottom",round:"20",onClose:s[1]||(s[1]=e=>p("close")),showClose:"",backgroundColor:"#f2f2f2"},{default:d((()=>[r(_,{class:"model-box"},{default:d((()=>[r(_,{class:"title ss-m-t-38 ss-m-l-20 ss-m-b-40"},{default:d((()=>[c("活动优惠")])),_:1}),r(C,{class:"model-content ss-m-l-20","scroll-y":"","scroll-with-animation":!1,"enable-back-to-top":!0},{default:d((()=>[(a(!0),n(i,null,u(k.orderInfo.promo_infos,((e,s)=>(a(),l(_,{key:s},{default:d((()=>[r(_,{class:"ss-flex ss-m-b-40 subtitle"},{default:d((()=>[r(_,null,{default:d((()=>[c("共"+b(e.goods_ids.length)+"件,",1)])),_:2},1024),"full_discount"===e.activity_type?(a(),l(_,{key:0},{default:d((()=>[c(" 满"+b(e.discount_rule.full)+"打"+b(e.discount_rule.discount)+"折,已减 ",1)])),_:2},1024)):w("",!0),"full_gift"===e.activity_type?(a(),l(_,{key:1},{default:d((()=>[c("满赠")])),_:1})):w("",!0),"full_reduce"===e.activity_type?(a(),l(_,{key:2},{default:d((()=>[c(" 满"+b(e.discount_rule.full)+"减"+b(e.discount_rule.discount)+",已减 ",1)])),_:2},1024)):w("",!0),r(_,{class:"price-text"},{default:d((()=>[c("¥"+b(e.promo_discount_money||"0.00"),1)])),_:2},1024)])),_:2},1024),r(C,{class:"scroll-box","scroll-x":"","scroll-anchoring":""},{default:d((()=>[r(_,{class:"ss-flex"},{default:d((()=>[(a(!0),n(i,null,u(e.goods_ids,(e=>(a(),l(_,{key:e},{default:d((()=>[r(P,{class:"content-img",src:x(h).$url.cdn(v(e))},null,8,["src"])])),_:2},1024)))),128))])),_:2},1024)])),_:2},1024)])),_:2},1024)))),128))])),_:1})])),_:1}),r(_,{class:"modal-footer ss-flex"},{default:d((()=>[r(j,{class:"confirm-btn ss-reset-button",onClick:s[0]||(s[0]=e=>p("close"))},{default:d((()=>[c("确认")])),_:1})])),_:1})])),_:1},8,["show"])}}},[["__scopeId","data-v-0a5d15ea"]]),U=T({__name:"confirm",setup(s){const f=e({orderPayload:{},orderInfo:{items:[],price:{}},addressInfo:{},showCoupon:!1,couponInfo:[],showDiscount:!1});function p(){j("SELECT_ADDRESS",(e=>{!async function(e={}){V.isEmpty(e)||(f.addressInfo=e);await $()}(e.addressInfo)})),h.$router.go("/pages/user/address/list")}async function _(e){f.orderPayload.couponId=e||0,await $(),f.showCoupon=!1}function y(){f.addressInfo.id?async function(){const{code:e,data:s}=await v.createOrder({items:f.orderPayload.items,couponId:f.orderPayload.couponId,addressId:f.addressInfo.id,deliveryType:1,pointStatus:!1,combinationActivityId:f.orderPayload.combinationActivityId,combinationHeadId:f.orderPayload.combinationHeadId,seckillActivityId:f.orderPayload.seckillActivityId});if(0!==e)return;f.orderPayload.items[0].cartId>0&&h.$store("cart").getList();h.$router.redirect("/pages/pay/index",{id:s.payOrderId})}():h.$helper.toast("请选择收货地址")}async function $(){const{data:e,code:s}=await v.settlementOrder({items:f.orderPayload.items,couponId:f.orderPayload.couponId,addressId:f.addressInfo.id,deliveryType:1,pointStatus:!1,combinationActivityId:f.orderPayload.combinationActivityId,combinationHeadId:f.orderPayload.combinationHeadId,seckillActivityId:f.orderPayload.seckillActivityId});0===s&&(f.orderInfo=e,f.orderInfo.address&&(f.addressInfo=f.orderInfo.address))}return k((async e=>{e.data?(f.orderPayload=JSON.parse(e.data),await $(),await async function(){const{code:e,data:s}=await P.getMatchCouponList(f.orderInfo.price.payPrice,f.orderInfo.items.map((e=>e.spuId)),f.orderPayload.items.map((e=>e.skuId)),f.orderPayload.items.map((e=>e.categoryId)));0===e&&(f.couponInfo=s)}()):h.$helper.toast("参数不正确,请检查!")})),(e,s)=>{const k=A,v=m,P=o(t("s-address-item"),B),j=o(t("s-goods-item"),S),V=o(t("uni-easyinput"),D),$=g,G=o(t("s-coupon-select"),L),T=o(t("s-discount-list"),M),U=I,N=o(t("su-fixed"),E),F=o(t("s-layout"),O);return a(),l(F,{title:"确认订单"},{default:d((()=>[r(v,{class:"bg-white address-box ss-m-b-14 ss-r-b-10",onClick:p},{default:d((()=>[r(P,{item:f.addressInfo,hasBorderBottom:!1},{default:d((()=>[r(v,{class:"ss-rest-button"},{default:d((()=>[r(k,{class:"_icon-forward"})])),_:1})])),_:1},8,["item"])])),_:1}),r(v,{class:"order-card-box ss-m-b-14"},{default:d((()=>[(a(!0),n(i,null,u(f.orderInfo.items,(e=>(a(),l(j,{key:e.skuId,img:e.picUrl,title:e.spuName,skuText:e.properties.map((e=>e.valueName)).join(" "),price:e.price,num:e.count,marginBottom:"10"},null,8,["img","title","skuText","price","num"])))),128)),r(v,{class:"order-item ss-flex ss-col-center ss-row-between ss-p-x-20 bg-white ss-r-10"},{default:d((()=>[r(v,{class:"item-title"},{default:d((()=>[c("订单备注")])),_:1}),r(v,{class:"ss-flex ss-col-center"},{default:d((()=>[r(V,{maxlength:"20",placeholder:"建议留言前先与商家沟通",modelValue:f.orderPayload.remark,"onUpdate:modelValue":s[0]||(s[0]=e=>f.orderPayload.remark=e),inputBorder:!1,clearable:!1},null,8,["modelValue"])])),_:1})])),_:1})])),_:1}),r(v,{class:"bg-white total-card-box ss-p-20 ss-m-b-14 ss-r-10"},{default:d((()=>[r(v,{class:"total-box-content border-bottom"},{default:d((()=>[r(v,{class:"order-item ss-flex ss-col-center ss-row-between"},{default:d((()=>[r(v,{class:"item-title"},{default:d((()=>[c("商品金额")])),_:1}),r(v,{class:"ss-flex ss-col-center"},{default:d((()=>[r(k,{class:"item-value ss-m-r-24"},{default:d((()=>[c(" ¥"+b(x(H)(f.orderInfo.price.totalPrice)),1)])),_:1})])),_:1})])),_:1}),"score"===f.orderPayload.order_type?(a(),l(v,{key:0,class:"order-item ss-flex ss-col-center ss-row-between"},{default:d((()=>[r(v,{class:"item-title"},{default:d((()=>[c("扣除积分")])),_:1}),r(v,{class:"ss-flex ss-col-center"},{default:d((()=>[r($,{src:x(h).$url.static("/static/img/shop/goods/score1.svg"),class:"score-img"},null,8,["src"]),r(k,{class:"item-value ss-m-r-24"},{default:d((()=>[c(b(f.orderInfo.score_amount),1)])),_:1})])),_:1})])),_:1})):w("",!0),r(v,{class:"order-item ss-flex ss-col-center ss-row-between"},{default:d((()=>[r(v,{class:"item-title"},{default:d((()=>[c("运费")])),_:1}),r(v,{class:"ss-flex ss-col-center"},{default:d((()=>[r(k,{class:"item-value ss-m-r-24"},{default:d((()=>[c(" +¥"+b(x(H)(f.orderInfo.price.deliveryPrice)),1)])),_:1})])),_:1})])),_:1}),0===f.orderInfo.type?(a(),l(v,{key:1,class:"order-item ss-flex ss-col-center ss-row-between"},{default:d((()=>[r(v,{class:"item-title"},{default:d((()=>[c("优惠券")])),_:1}),r(v,{class:"ss-flex ss-col-center",onClick:s[1]||(s[1]=e=>f.showCoupon=!0)},{default:d((()=>[f.orderPayload.couponId>0?(a(),l(k,{key:0,class:"item-value text-red"},{default:d((()=>[c(" -¥"+b(x(H)(f.orderInfo.price.couponPrice)),1)])),_:1})):(a(),l(k,{key:1,class:C(["item-value",f.couponInfo.length>0?"text-red":"text-disabled"])},{default:d((()=>[c(b(f.couponInfo.length>0?f.couponInfo.length+" 张可用":"暂无可用优惠券"),1)])),_:1},8,["class"])),r(k,{class:"_icon-forward item-icon"})])),_:1})])),_:1})):w("",!0),f.orderInfo.price.discountPrice>0?(a(),l(v,{key:2,class:"order-item ss-flex ss-col-center ss-row-between"},{default:d((()=>[r(v,{class:"item-title"},{default:d((()=>[c("活动优惠")])),_:1}),r(v,{class:"ss-flex ss-col-center"},{default:d((()=>[r(k,{class:"item-value text-red"},{default:d((()=>[c(" -¥"+b(x(H)(f.orderInfo.price.discountPrice)),1)])),_:1}),r(k,{class:"_icon-forward item-icon"})])),_:1})])),_:1})):w("",!0)])),_:1}),r(v,{class:"total-box-footer ss-font-28 ss-flex ss-row-right ss-col-center ss-m-r-28"},{default:d((()=>[r(v,{class:"total-num ss-m-r-20"},{default:d((()=>[c(" 共"+b(f.orderInfo.items.reduce(((e,s)=>e+s.count),0))+"件 ",1)])),_:1}),r(v,null,{default:d((()=>[c("合计:")])),_:1}),r(v,{class:"total-num text-red"},{default:d((()=>[c(" ¥"+b(x(H)(f.orderInfo.price.payPrice)),1)])),_:1})])),_:1})])),_:1}),r(G,{modelValue:f.couponInfo,"onUpdate:modelValue":s[2]||(s[2]=e=>f.couponInfo=e),show:f.showCoupon,onConfirm:_,onClose:s[3]||(s[3]=e=>f.showCoupon=!1)},null,8,["modelValue","show"]),r(T,{modelValue:f.orderInfo,"onUpdate:modelValue":s[4]||(s[4]=e=>f.orderInfo=e),show:f.showDiscount,onClose:s[5]||(s[5]=e=>f.showDiscount=!1)},null,8,["modelValue","show"]),r(N,{bottom:"",opacity:!1,bg:"bg-white",placeholder:"",noFixed:!1,index:200},{default:d((()=>[r(v,{class:"footer-box border-top ss-flex ss-row-between ss-p-x-20 ss-col-center"},{default:d((()=>[r(v,{class:"total-box-footer ss-flex ss-col-center"},{default:d((()=>[r(v,{class:"total-num ss-font-30 text-red"},{default:d((()=>[c(" ¥"+b(x(H)(f.orderInfo.price.payPrice)),1)])),_:1})])),_:1}),r(U,{class:"ss-reset-button ui-BG-Main-Gradient ss-r-40 submit-btn ui-Shadow-Main",onClick:y},{default:d((()=>[c(" 提交订单 ")])),_:1})])),_:1})])),_:1})])),_:1})}}},[["__scopeId","data-v-269361c0"]]);export{U as default};
|