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