2 lines
13 KiB
JavaScript
2 lines
13 KiB
JavaScript
|
import{c as re,a as ie,b as Z,d as ue,o as de}from"./pay.vue_vue_type_style_index_0_scoped_43f405bf_lang-UtIhw1Q5.js";import{_ as K,r as c,o as M,m as b,a as N,b as m,c as g,d as J,w as x,e,f as i,g as h,t as E,n as H,E as T,u as ee,h as A,F as Q,i as W,j as te,k as _e,l as j,p as oe,q as se,s as G,v as ae,x as le,y as pe,z as ve}from"./index-BK45VPeO.js";import{_ as fe}from"./lodash-BI5zS7wc.js";import{p as me}from"./padding-C_XosNLD.js";import{g as he,a as ge}from"./shop-DFQI72f9.js";import{p as ye}from"./pay-jKmmbq3P.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"},Pe={__name:"price",emits:["changeAllPrice"],setup(S,{expose:F,emit:y}){const a=c(!1),u=c(null),o=c(0),d=(n=!0,p=0)=>{l.value.nowPrice="",l.value.percentage="",a.value=n,o.value=p,H(()=>{setTimeout(()=>{var V;(V=u.value)==null||V.focus()},150)})},l=c({nowPrice:"",percentage:""}),v=n=>{l.value.percentage=(n/o.value*100).toFixed(2)},$=n=>{l.value.nowPrice=(o.value*n/100).toFixed(2)},L=y,P=()=>{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");L("changeAllPrice",l.value.nowPrice)};F({show:d,dialogVisible:a});const R=()=>{a.value&&P()};return M(()=>{b.on("enter",R)}),N(()=>{b.off("enter",R)}),(n,p)=>{const V=m("el-input"),U=m("el-button"),_=m("el-dialog");return g(),J(_,{modelValue:a.value,"onUpdate:modelValue":p[2]||(p[2]=f=>a.value=f),title:"订单改价",width:"650"},{footer:x(()=>[e("div",xe,[i(U,{class:"ok-btn",type:"primary",onClick:P},{default:x(()=>[h(" 确定 (Enter) ")]),_:1})])]),default:x(()=>[e("div",ke,[e("div",be,[i(V,{ref_key:"priceRef",ref:u,style:{flex:"3",margin:"0.625rem",height:"2.5rem"},modelValue:l.value.nowPrice,"onUpdate:modelValue":p[0]||(p[0]=f=>l.value.nowPrice=f),type:"number",placeholder:"请输入改价后的价格",onInput:v},{suffix:x(()=>[h("元")]),_:1},8,["modelValue"]),i(V,{style:{flex:"2",margin:"0.625rem",height:"2.5rem"},modelValue:l.value.percentage,"onUpdate:modelValue":p[1]||(p[1]=f=>l.value.percentage=f),type:"number",placeholder:"请输入比例",onInput:$},{suffix:x(()=>[h("%")]),_:1},8,["modelValue"])]),e("div",$e,[h(" 改价后金额: "),e("span",we,"¥"+E(l.value.nowPrice||o.value||" - - "),1)])])]),_:1},8,["modelValue"])}}},Ve=K(Pe,[["__scopeId","data-v-924edcc0"]]),Ce={class:"my-order"},Ie={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"},Oe=["onClick"],Ue={class:"order-item-price"},ze={class:"order-footer"},qe={class:"order-total"},Me={class:"price"},Ne={class:"total-item"},Be={style:{"font-size":"1.4rem"}},je={class:"total-item"},Te={class:"order-btn"},Ke={__name:"order",emits:["goPay","editAttr"],setup(S,{expose:F,emit:y}){const a=c([]),u=c(0),o=c(0),d=c(0),l=ee(),v=()=>{let t=[];a.value.map(r=>{t.push(r.cart_id)}),t.length!=0&&L(t)},$=t=>{a.value=a.value.filter(r=>r.cart_id!=t),L([t])},L=t=>{re({cart_id:t}).then(r=>{console.log(r),P()})},P=()=>{u.value=0,o.value=0,d.value=0,ie({staff_id:l.userInfo.service.service_id,sale_type:2}).then(t=>{var r,w;((w=(r=t.data)==null?void 0:r.list)==null?void 0:w.length)>0?(a.value=t.data.list[0].list,a.value.forEach(C=>{u.value+=C.productAttr.price*C.cart_num}),o.value=u.value):a.value=[]})};P();const R=y,n=()=>{R("goPay")},p=(t,r)=>{Z(t.cart_id,{cart_num:t.cart_num}).then(w=>{u.value=0,a.value.forEach(C=>{u.value+=C.productAttr.price*C.cart_num}),o.value=u.value})},V=t=>{R("editPupop",t)},U=(t,r)=>{Z(t,r).then(w=>{P()})},_=t=>{d.value=o.value-t,u.value=+t,H(()=>{setTimeout(()=>{k(!1)},150)})};c(0);const f=c(null),k=(t=!0)=>{f.value.show(t,o.value)};F({getList:P,list:a,editItem:U,discounts:d,allPrice:u});const z=()=>{f.value.dialogVisible?f.value.dialogVisible=!1:k()},s=()=>{a.value.length>0&&v()};return M(()=>
|