2024-04-06 18:18:08 +08:00
|
|
|
import{c as W,a as X,b as B,d as Y,p as Z,o as ee}from"./pay-Dtaw6USS.js";import{_ as U,r as u,a as _,o as y,c as q,w as k,b as e,d as n,e as m,t as V,f as A,F as O,g as M,h as j,i as te,j as G,k as J,p as K,l as T,m as oe,n as se,u as ae}from"./index-DsIcmlxr.js";import{p as le}from"./padding-C6l3UcjB.js";import{g as ne,s as ce}from"./shop-Diq_tSJN.js";const ie={class:"price"},re={class:"flex"},ue={style:{margin:"10px","padding-bottom":"40px"}},de={style:{color:"#f5222d","font-weight":"bold","margin-left":"1rem"}},_e={class:"dialog-footer"},pe={__name:"price",emits:["submit"],setup(w,{expose:x,emit:b}){const s=u(!1),l=u(0),o=(g,v=0)=>{s.value=g,l.value=v},c=u({nowPrice:"",percentage:""}),p=g=>{c.value.percentage=(g/l.value*100).toFixed(2)},$=g=>{c.value.nowPrice=(l.value*g/100).toFixed(2)},f=b,L=()=>{f("submit",c.value.nowPrice),s.value=!1};return x({show:o}),(g,v)=>{const P=_("el-input"),h=_("el-button"),I=_("el-dialog");return y(),q(I,{modelValue:s.value,"onUpdate:modelValue":v[2]||(v[2]=r=>s.value=r),title:"订单改价",width:"650"},{footer:k(()=>[e("div",_e,[n(h,{class:"ok-btn",type:"primary",onClick:L},{default:k(()=>[m(" 确定 ")]),_:1})])]),default:k(()=>[e("div",ie,[e("div",re,[n(P,{style:{flex:"3",margin:"10px",height:"2.5rem"},modelValue:c.value.nowPrice,"onUpdate:modelValue":v[0]||(v[0]=r=>c.value.nowPrice=r),placeholder:"请输入改价后的价格",onInput:p},{suffix:k(()=>[m("元")]),_:1},8,["modelValue"]),n(P,{style:{flex:"2",margin:"10px",height:"2.5rem"},modelValue:c.value.percentage,"onUpdate:modelValue":v[1]||(v[1]=r=>c.value.percentage=r),placeholder:"请输入比例",onInput:$},{suffix:k(()=>[m("%")]),_:1},8,["modelValue"])]),e("div",ue,[m("改价后金额: "),e("span",de,"¥"+V(c.value.nowPrice||l.value||" - - "),1)])])]),_:1},8,["modelValue"])}}},ve=U(pe,[["__scopeId","data-v-518d9bc5"]]),me={class:"my-order"},he={class:"header-nav"},fe={class:"nav-item"},ge={class:"order-list"},ye={class:"order-item-info"},ke={class:"order-item-title"},be={class:"title"},$e=["onClick"],we={class:"order-item-sku"},xe=["onClick"],Ie={class:"order-item-price"},Ce={class:"order-footer"},Ve={class:"order-total"},Ae={class:"price"},Pe={class:"total-item"},Se={style:{"font-size":"1.4rem"}},Le={class:"total-item"},Fe={class:"update-price"},De={class:"order-btn"},Re={__name:"order",emits:["goPay","editAttr"],setup(w,{expose:x,emit:b}){const s=u([]),l=u(0),o=u(0),c=()=>{let a=[];s.value.map(t=>{a.push(t.cart_id)}),a.length!=0&&$(a)},p=a=>{s.value=s.value.filter(t=>t.cart_id!=a),$([a])},$=a=>{W({cart_id:a}).then(t=>{console.log(t),f()})},f=()=>{l.value=0,o.value=0,X({source:300}).then(a=>{var t,i;((i=(t=a.data)==null?void 0:t.list)==null?void 0:i.length)>0?(s.value=a.data.list[0].list,s.value.forEach(d=>{l.value+=d.productAttr.price*d.cart_num})):s.value=[]})};f();const L=b,g=()=>{L("goPay")},v=(a,t)=>{B(a.cart_id,{cart_num:a.cart_num}).then(i=>{l.value=0,s.value.forEach(d=>{l.value+=d.productAttr.price*d.cart_num})})},P=a=>{L("editPupop",a)},h=(a,t)=>{B(a,t).then(i=>{f()})},I=a=>{o.value=l.value-a,l.value=+a};u(0);const r=u(null),C=()=>{r.value.show(!0,l.value)};return x({getList:f,list:s,editItem:h,discounts:o,allPrice:l}),(a,t)=>{const i=_("Delete"),d=_("el-icon"),D=_("el-empty"),R=_("el-image"),F=_("ArrowDown"),E=_("el-input-number"),N=_("el-button");return y(),A("div",me,[e("div",he,[e("div",fe,[m(" 已选购 "),e("span",null,V(s.value.length),1),m(" 件 ")]),e("div",{class:"nav-item-clear",onClick:c},[n(d,null,{default:k(()=>[n(i)]),_:1}),m("清空 ")])]),e("div",ge,[s.value.length==0?(y(),q(D,{key:0,description:"请点击右侧添加商品"})):(y(!0),A(O,{key:1},M(s.value,(S,Q)=>(y(),A("div",{class:"order-item",key:Q},[n(R,{loading:"lazy",class:"order-item-img",src:S.productAttr&&S.productAttr.image||S.product.image},null,8,["src"]),e("div",ye,[e("div",ke,[e("div",be,V(S.spu.store_name),1),e("div",{class:"delete",onClick:z=>p(S.cart_id)},"删除",8,$e)]),e("div",we,[e("span",{style:{display:"flex","align-items":"center"},onClick:z=>P(S)},[m("商品规格: "+V(S.productAttr.sku||"默认规格"),1),n(d,{size:"16",st
|