2024-04-20 09:54:56 +08:00
|
|
|
import{c as ie,a as ue,b as ee,d as de,o as _e}from"./pay.vue_vue_type_style_index_0_scoped_7f298acd_lang-CKxahYPN.js";import{_ as j,r,o as T,m as S,a as G,b as y,c as h,d as Q,w as V,e,f as d,g as P,t as I,n as X,E as H,u as se,h as C,F as N,i as B,j as oe,k as ve,l as J,p as q,q as ae,s as W,v as le,x as ne,y as pe,z as fe}from"./index-CrZDS_S7.js";import{_ as me}from"./lodash-DHDP4Mfp.js";import{p as te}from"./padding-DQpQTC2Q.js";import{g as he,m as ge,a as ye}from"./shop-WpGkLDyn.js";import{p as ke}from"./pay-BRZ0vzgF.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(x,{expose:L,emit:w}){const o=r(!1),i=r(null),s=r(0),u=(n=!0,c=0)=>{l.value.nowPrice="",l.value.percentage="",o.value=n,s.value=c,X(()=>{setTimeout(()=>{var $;($=i.value)==null||$.focus()},150)})},l=r({nowPrice:"",percentage:""}),m=n=>{l.value.percentage=(n/s.value*100).toFixed(2)},k=n=>{l.value.nowPrice=(s.value*n/100).toFixed(2)},p=w,_=()=>{if(l.value.percentage>100)return l.value.nowPrice="",l.value.percentage="",H.error("改价金额不能大于当前订单金额");if(l.value.nowPrice<=0)return l.value.nowPrice="",l.value.percentage="",H.error("金额不能小于0");p("changeAllPrice",l.value.nowPrice)};L({show:u,dialogVisible:o});const b=()=>{o.value&&_()};return T(()=>{S.on("enter",b)}),G(()=>{S.off("enter",b)}),(n,c)=>{const $=y("el-input"),R=y("el-button"),f=y("el-dialog");return h(),Q(f,{modelValue:o.value,"onUpdate:modelValue":c[2]||(c[2]=g=>o.value=g),title:"订单改价",width:"650"},{footer:V(()=>[e("div",Pe,[d(R,{class:"ok-btn",type:"primary",onClick:_},{default:V(()=>[P(" 确定 (Enter) ")]),_:1})])]),default:V(()=>[e("div",$e,[e("div",be,[d($,{ref_key:"priceRef",ref:i,style:{flex:"3",margin:"0.625rem",height:"2.5rem"},modelValue:l.value.nowPrice,"onUpdate:modelValue":c[0]||(c[0]=g=>l.value.nowPrice=g),type:"number",placeholder:"请输入改价后的价格",onInput:m},{suffix:V(()=>[P("元")]),_:1},8,["modelValue"]),d($,{style:{flex:"2",margin:"0.625rem",height:"2.5rem"},modelValue:l.value.percentage,"onUpdate:modelValue":c[1]||(c[1]=g=>l.value.percentage=g),type:"number",placeholder:"请输入比例",onInput:k},{suffix:V(()=>[P("%")]),_:1},8,["modelValue"])]),e("div",we,[P(" 改价后金额: "),e("span",Ce,"¥"+I(l.value.nowPrice||s.value||" - - "),1)])])]),_:1},8,["modelValue"])}}},Ve=j(Ie,[["__scopeId","data-v-924edcc0"]]),Ae={class:"my-order"},Se={class:"header-nav"},Le={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"},Oe=["onClick"],Ue={class:"order-item-price"},ze={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(x,{expose:L,emit:w}){const o=r([]),i=r(0),s=r(0),u=r(0),l=se(),m=()=>{let t=[];o.value.map(v=>{t.push(v.cart_id)}),t.length!=0&&p(t)},k=t=>{o.value=o.value.filter(v=>v.cart_id!=t),p([t])},p=t=>{ie({cart_id:t}).then(v=>{console.log(v),_()})},_=()=>{i.value=0,s.value=0,u.value=0,ue({staff_id:l.userInfo.service.service_id,sale_type:2}).then(t=>{var v,F;((F=(v=t.data)==null?void 0:v.list)==null?void 0:F.length)>0?(o.value=t.data.list[0].list,o.value.forEach(E=>{i.value+=E.productAttr.price*E.cart_num}),s.value=i.value):o.value=[]})};_();const b=w,n=()=>{b("goPay")},c=(t,v)=>{ee(t.cart_id,{cart_num:t.cart_num}).then(F=>{i.value=0,o.value.forEach(E=>{i.value+=E.productAttr.price*E.cart_num}),s.value=i.value})},$=t=>{b("editPupop",t)},R=(t,v)=>{ee(t,v).then(F=>{_()})},f=t=>{u.value=s.value-t,i.value=+t,X(()=>{setTimeout(()=>{A(!1)},150)})};r(0);const g=r(null),A=(t=!0)=>{g.value.show(t,s.value)};L({getList:_,list:o,editItem:R,discounts:u,allPrice:i});const U=()=>{g.value.dialogVisible?g.value.dialogVisible=!1:A()},a=()=>{o.value.length>0&&m()};return T
|