2 lines
13 KiB
JavaScript
2 lines
13 KiB
JavaScript
![]() |
import{c as re,a as ie,b as ee,d as ue,o as de}from"./pay.vue_vue_type_style_index_0_scoped_80c4a58e_lang-DtwGRKii.js";import{_ as K,r,o as M,m as b,a as N,b as h,c as y,d as J,w as $,e,f as c,g as m,t as E,n as H,E as T,u as te,h as A,F as Q,i as W,j as se,k as _e,l as j,p as oe,q as ae,s as G,v as le,x as ne,y as pe,z as ve}from"./index-DKxgp1Q5.js";import{_ as fe}from"./lodash-DvPdQFb2.js";import{p as he}from"./padding-ChZ2-3BS.js";import{g as me,a as ge}from"./shop-DnNzqnUi.js";import{p as ye}from"./pay-DtFDX3hL.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"},Ce={__name:"price",emits:["changeAllPrice"],setup(S,{expose:F,emit:k}){const a=r(!1),u=r(null),s=r(0),d=(n=!0,p=0)=>{l.value.nowPrice="",l.value.percentage="",a.value=n,s.value=p,H(()=>{setTimeout(()=>{var I;(I=u.value)==null||I.focus()},150)})},l=r({nowPrice:"",percentage:""}),v=n=>{l.value.percentage=(n/s.value*100).toFixed(2)},w=n=>{l.value.nowPrice=(s.value*n/100).toFixed(2)},L=k,C=()=>{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&&C()};return M(()=>{b.on("enter",R)}),N(()=>{b.off("enter",R)}),(n,p)=>{const I=h("el-input"),O=h("el-button"),_=h("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(O,{class:"ok-btn",type:"primary",onClick:C},{default:$(()=>[m(" 确定 (Enter) ")]),_:1})])]),default:$(()=>[e("div",ke,[e("div",be,[c(I,{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:$(()=>[m("元")]),_:1},8,["modelValue"]),c(I,{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:$(()=>[m("%")]),_:1},8,["modelValue"])]),e("div",$e,[m(" 改价后金额: "),e("span",we,"¥"+E(l.value.nowPrice||s.value||" - - "),1)])])]),_:1},8,["modelValue"])}}},Ie=K(Ce,[["__scopeId","data-v-428f0e3b"]]),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"],Oe={class:"order-item-price"},Ue={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:"update-price"},Ke={class:"order-btn"},Ge={__name:"order",emits:["goPay","editAttr"],setup(S,{expose:F,emit:k}){const a=r([]),u=r(0),s=r(0),d=r(0),l=te(),v=()=>{let t=[];a.value.map(i=>{t.push(i.cart_id)}),t.length!=0&&L(t)},w=t=>{a.value=a.value.filter(i=>i.cart_id!=t),L([t])},L=t=>{re({cart_id:t}).then(i=>{console.log(i),C()})},C=()=>{u.value=0,s.value=0,d.value=0,ie({staff_id:l.userInfo.service.service_id,sale_type:2}).then(t=>{var i,x;((x=(i=t.data)==null?void 0:i.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}),s.value=u.value):a.value=[]})};C();const R=k,n=()=>{R("goPay")},p=(t,i)=>{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}),s.value=u.value})},I=t=>{R("editPupop",t)},O=(t,i)=>{ee(t,i).then(x=>{C()})},_=t=>{d.value=s.value-t,u.value=+t,H(()=>{setTimeout(()=>{g(!1)},150)})};r(0);const f=r(null),g=(t=!0)=>{f.value.show(t,s.value)};F({getList:C,list:a,editItem:O,discounts:d,allPrice:u});const U=()=>{f.value.dialogVisible?f.value.dialogVisible=!1:g()},o=()=>{a.value.length>0&&v()};r
|