cashier-ERP/dist/assets/index-Do69Dp-3.js

2 lines
14 KiB
JavaScript
Raw Normal View History

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