2024-04-10 10:28:50 +08:00
|
|
|
import{c as ne,a as ce,b as Q,p as ie,d as re,o as ue}from"./pay-BajYk3t1.js";import{_ as B,r as n,o as q,m as b,a as M,b as f,c as $,d as T,w as x,e,f as l,g as h,t as F,n as W,E as de,u as X,h as L,F as G,i as J,j as Y,k as _e,l as Z,p as ee,q as te,s as oe,v as se,x as pe,y as ve}from"./index-CDJP75me.js";import{p as fe}from"./padding-BXN6xH5X.js";import{g as me,s as he}from"./shop-u-jllX4w.js";const ge={class:"price"},ye={class:"flex"},ke={style:{margin:"10px","padding-bottom":"40px"}},be={style:{color:"#f5222d","font-weight":"bold","margin-left":"1rem"}},$e={class:"dialog-footer"},xe={__name:"price",emits:["submit"],setup(P,{expose:A,emit:g}){const a=n(!1),c=n(null),o=n(0),i=(u,v=0)=>{r.value.nowPrice="",r.value.percentage="",a.value=u,o.value=v,W(()=>{setTimeout(()=>{var V;(V=c.value)==null||V.focus()},150)})},r=n({nowPrice:"",percentage:""}),m=u=>{r.value.percentage=(u/o.value*100).toFixed(2)},w=u=>{r.value.nowPrice=(o.value*u/100).toFixed(2)},R=g,I=()=>{if(r.value.nowPrice<=0)return r.value.nowPrice="",r.value.percentage="",de.error("金额不能小于0");R("submit",r.value.nowPrice),a.value=!1};A({show:i,dialogVisible:a});const S=()=>{if(a.value)I();else return};return q(()=>{b.on("enter",S)}),M(()=>{b.off("enter",S)}),(u,v)=>{const V=f("el-input"),D=f("el-button"),_=f("el-dialog");return $(),T(_,{modelValue:a.value,"onUpdate:modelValue":v[2]||(v[2]=p=>a.value=p),title:"订单改价",width:"650"},{footer:x(()=>[e("div",$e,[l(D,{class:"ok-btn",type:"primary",onClick:I},{default:x(()=>[h(" 确定 (Enter) ")]),_:1})])]),default:x(()=>[e("div",ge,[e("div",ye,[l(V,{ref_key:"priceRef",ref:c,style:{flex:"3",margin:"10px",height:"2.5rem"},modelValue:r.value.nowPrice,"onUpdate:modelValue":v[0]||(v[0]=p=>r.value.nowPrice=p),type:"number",placeholder:"请输入改价后的价格",onInput:m},{suffix:x(()=>[h("元")]),_:1},8,["modelValue"]),l(V,{style:{flex:"2",margin:"10px",height:"2.5rem"},modelValue:r.value.percentage,"onUpdate:modelValue":v[1]||(v[1]=p=>r.value.percentage=p),type:"number",placeholder:"请输入比例",onInput:w},{suffix:x(()=>[h("%")]),_:1},8,["modelValue"])]),e("div",ke,[h("改价后金额: "),e("span",be,"¥"+F(r.value.nowPrice||o.value||" - - "),1)])])]),_:1},8,["modelValue"])}}},we=B(xe,[["__scopeId","data-v-5a0a6db4"]]),Ie={class:"my-order"},Ve={class:"header-nav"},Ce={class:"nav-item"},Pe={class:"order-list"},Ae={class:"order-item-info"},Se={class:"order-item-title"},Fe={class:"title"},Le=["onClick"],Re={class:"order-item-sku"},Ee=["onClick"],De={class:"order-item-price"},Ue={class:"order-footer"},ze={class:"order-total"},Oe={class:"price"},qe={class:"total-item"},Me={style:{"font-size":"1.4rem"}},Ne={class:"total-item"},Be={class:"update-price"},je={class:"order-btn"},Te={__name:"order",emits:["goPay","editAttr"],setup(P,{expose:A,emit:g}){const a=n([]),c=n(0),o=n(0),i=n(0),r=X(),m=()=>{let t=[];a.value.map(d=>{t.push(d.cart_id)}),t.length!=0&&R(t)},w=t=>{a.value=a.value.filter(d=>d.cart_id!=t),R([t])},R=t=>{ne({cart_id:t}).then(d=>{console.log(d),I()})},I=()=>{c.value=0,o.value=0,i.value=0,ce({staff_id:r.userInfo.service.service_id}).then(t=>{var d,k;((k=(d=t.data)==null?void 0:d.list)==null?void 0:k.length)>0?(a.value=t.data.list[0].list,a.value.forEach(C=>{c.value+=C.productAttr.price*C.cart_num}),o.value=c.value):a.value=[]})};I();const S=g,u=()=>{S("goPay")},v=(t,d)=>{Q(t.cart_id,{cart_num:t.cart_num}).then(k=>{c.value=0,a.value.forEach(C=>{c.value+=C.productAttr.price*C.cart_num}),o.value=c.value})},V=t=>{S("editPupop",t)},D=(t,d)=>{Q(t,d).then(k=>{I()})},_=t=>{i.value=o.value-t,c.value=+t};n(0);const p=n(null),y=()=>{p.value.show(!0,o.value)};A({getList:I,list:a,editItem:D,discounts:i,allPrice:c});const U=()=>{p.value.dialogVisible?p.value.dialogVisible=!1:y()},s=()=>{a.value.length>0&&m()};return q(()=>{b.on("insert",U),b.on("delete",s)}),M(()=>{b.off("insert",U),b.off("delete",s)}),(t,d)=>{const k=f("Delete"),C=f("el-icon"),z=f("el-empty"),O=f("el-image"),j=f("ArrowDown"),K=f("el-input-number"),H=f("el-button");return $(),L("div",Ie,[e("div",Ve,[e("div",Ce,[h(" 已选购 "),e("span",null
|