cashier-ERP/dist/assets/index-BcmmN2mF.js

2 lines
13 KiB
JavaScript
Raw Normal View History

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