cashier-mer/dist/assets/index-CuerRZGK.js

2 lines
13 KiB
JavaScript
Raw Normal View History

2024-04-17 15:47:07 +08:00
import{c as ie,a as re,b as ee,d as ue,o as de}from"./pay.vue_vue_type_style_index_0_scoped_80c4a58e_lang-B369kKjL.js";import{_ as j,r as i,o as q,m as b,a as M,b as m,c as y,d as J,w as $,e,f as c,g as h,t as R,n as H,E as T,u as te,h as V,F as Q,i as W,j as oe,k as _e,l as B,p as se,q as ae,s as G,v as le,x as ne,y as pe,z as ve}from"./index-Detor8ok.js";import{_ as fe}from"./lodash-O5zHdYL8.js";import{p as me}from"./padding-C2vugETl.js";import{g as he,s as ge}from"./shop-DnIStVfm.js";import{p as ye}from"./pay-YTQcUTqZ.js";const ke={class:"price"},be={class:"flex"},$e={style:{margin:"10px","padding-bottom":"40px"}},we={style:{color:"#f5222d","font-weight":"bold","margin-left":"1rem"}},xe={class:"dialog-footer"},Ie={__name:"price",emits:["changeAllPrice"],setup(A,{expose:S,emit:k}){const a=i(!1),u=i(null),o=i(0),d=(n=!0,p=0)=>{l.value.nowPrice="",l.value.percentage="",a.value=n,o.value=p,H(()=>{setTimeout(()=>{var C;(C=u.value)==null||C.focus()},150)})},l=i({nowPrice:"",percentage:""}),v=n=>{l.value.percentage=(n/o.value*100).toFixed(2)},w=n=>{l.value.nowPrice=(o.value*n/100).toFixed(2)},F=k,I=()=>{if(l.value.percentage>100)return l.value.nowPrice="",l.value.percentage="",T.error("改价金额不能大于当前订单金额");if(l.value.nowPrice<=0)return l.value.nowPrice="",l.value.percentage="",T.error("金额不能小于0");F("changeAllPrice",l.value.nowPrice)};S({show:d,dialogVisible:a});const L=()=>{a.value&&I()};return q(()=>{b.on("enter",L)}),M(()=>{b.off("enter",L)}),(n,p)=>{const C=m("el-input"),D=m("el-button"),_=m("el-dialog");return y(),J(_,{modelValue:a.value,"onUpdate:modelValue":p[2]||(p[2]=f=>a.value=f),title:"订单改价",width:"650"},{footer:$(()=>[e("div",xe,[c(D,{class:"ok-btn",type:"primary",onClick:I},{default:$(()=>[h(" 确定 (Enter) ")]),_:1})])]),default:$(()=>[e("div",ke,[e("div",be,[c(C,{ref_key:"priceRef",ref:u,style:{flex:"3",margin:"10px",height:"2.5rem"},modelValue:l.value.nowPrice,"onUpdate:modelValue":p[0]||(p[0]=f=>l.value.nowPrice=f),type:"number",placeholder:"请输入改价后的价格",onInput:v},{suffix:$(()=>[h("元")]),_:1},8,["modelValue"]),c(C,{style:{flex:"2",margin:"10px",height:"2.5rem"},modelValue:l.value.percentage,"onUpdate:modelValue":p[1]||(p[1]=f=>l.value.percentage=f),type:"number",placeholder:"请输入比例",onInput:w},{suffix:$(()=>[h("%")]),_:1},8,["modelValue"])]),e("div",$e,[h(" 改价后金额: "),e("span",we,"¥"+R(l.value.nowPrice||o.value||" - - "),1)])])]),_:1},8,["modelValue"])}}},Ce=j(Ie,[["__scopeId","data-v-5c8bcd20"]]),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"],De={class:"order-item-sku"},ze=["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(A,{expose:S,emit:k}){const a=i([]),u=i(0),o=i(0),d=i(0),l=te(),v=()=>{let t=[];a.value.map(r=>{t.push(r.cart_id)}),t.length!=0&&F(t)},w=t=>{a.value=a.value.filter(r=>r.cart_id!=t),F([t])},F=t=>{ie({cart_id:t}).then(r=>{console.log(r),I()})},I=()=>{u.value=0,o.value=0,d.value=0,re({staff_id:l.userInfo.service.service_id}).then(t=>{var r,x;((x=(r=t.data)==null?void 0:r.list)==null?void 0:x.length)>0?(a.value=t.data.list[0].list,a.value.forEach(P=>{u.value+=P.productAttr.price*P.cart_num}),o.value=u.value):a.value=[]})};I();const L=k,n=()=>{L("goPay")},p=(t,r)=>{ee(t.cart_id,{cart_num:t.cart_num}).then(x=>{u.value=0,a.value.forEach(P=>{u.value+=P.productAttr.price*P.cart_num}),o.value=u.value})},C=t=>{L("editPupop",t)},D=(t,r)=>{ee(t,r).then(x=>{I()})},_=t=>{d.value=o.value-t,u.value=+t,H(()=>{setTimeout(()=>{g(!1)},150)})};i(0);const f=i(null),g=(t=!0)=>{f.value.show(t,o.value)};S({getList:I,list:a,editItem:D,discounts:d,allPrice:u});const z=()=>{f.value.dialogVisible?f.value.dialogVisible=!1:g()},s=()=>{a.value.length>0&&v()};return q