mirror of
https://gitee.com/niucloud-team/niucloud-admin.git
synced 2026-01-24 20:18:10 +00:00
2 lines
5.2 KiB
JavaScript
2 lines
5.2 KiB
JavaScript
/* empty css *//* empty css */import{E as G}from"./el-overlay-08181e74.js";/* empty css *//* empty css *//* empty css */import"./el-tooltip-4ed993c7.js";/* empty css */import"./index-7eafba5f.js";/* empty css *//* empty css *//* empty css *//* empty css */import{_ as S}from"./goods_default-3802d665.js";import{t}from"./index-0ca94763.js";import{c as j}from"./common-c3be41fd.js";import{r as A,q as M}from"./goods-6a4de1f3.js";import{a as _}from"./index-d469ae66.js";import{E as Z}from"./index-888853cf.js";import{E as q}from"./index-e27c3bb0.js";import{E as z}from"./index-c5914bde.js";import{a as H,E as F}from"./index-fe3867fe.js";import{v as J}from"./directive-64fb15dc.js";import{d as K,O as v,r as Q,e as g,f as b,y as n,x as i,g as l,A as x,B as m,u as e,v as y,H as V,M as R,aA as W,aB as X}from"./plugin-vue_export-helper-85a4d40b.js";import{_ as Y}from"./_plugin-vue_export-helper-c27b6911.js";import"./event-f85d77b0.js";import"./index-313cd2ce.js";import"./index-cf9a2dd7.js";import"./focus-trap-64c402c5.js";import"./index-1ad115d7.js";import"./index-de1d3b53.js";import"./vue-router-48fdc1e3.js";import"./index-bcd7a424.js";import"./index-e513479b.js";import"./el-main-86eb724f.js";import"./index-b9e5f5cb.js";import"./el-form-item-1b16c9fc.js";import"./_baseClone-3dbf39d6.js";import"./index-4d8f36c6.js";import"./index-ebc73046.js";import"./index-344f0086.js";import"./debounce-6c3123a6.js";import"./position-37364850.js";import"./index-95b00894.js";import"./isEqual-0b9509fd.js";import"./flatten-749195f8.js";import"./_isIterateeCall-47526406.js";import"./index-bd04154b.js";const tt=f=>(W("data-v-7410ea10"),f=f(),X(),f),et={class:"flex items-center mb-[10px]"},ot={class:"min-w-[70px] h-[70px] flex items-center justify-center"},at=tt(()=>l("div",{class:"image-slot"},[l("img",{class:"w-[70px] h-[70px]",src:S})],-1)),st={key:1,class:"w-[70px] h-[70px]",src:S,fit:"contain"},lt={class:"ml-2"},it=["title"],rt={class:"text-primary text-[12px]"},nt={key:0,class:"batch-operation-sku"},pt={class:"dialog-footer"},mt=K({__name:"goods-stock-edit-popup",emits:["load"],setup(f,{expose:N,emit:T}){const r=v({}),c=Q(!1);let s=v({loading:!0,data:[]});const d=v({value:""}),B=()=>{if(d.value.length==0){_({type:"warning",message:`${t("stockPlaceholder")}`});return}if(!w.number.test(d.value)){_({type:"warning",message:`${t("stockTips")}`});return}if(d.value<0){_({type:"warning",message:`${t("stockNotZeroTips")}`});return}s.data.forEach(o=>{o.stock=d.value})},$=()=>{s.loading=!0,M({goods_id:r.goods_id}).then(o=>{s.loading=!1,s.data=o.data}).catch(()=>{s.loading=!1})},C=o=>{Object.assign(r,o),$(),c.value=!0},w={number:/^\d{0,10}$/},I=()=>{let o=!0;for(let a=0;a<s.data.length;a++){let u=s.data[a];if(u.stock.length==0){o=!1,_({type:"warning",message:`${t("stockPlaceholder")}`});break}else if(isNaN(u.stock)||!w.number.test(u.stock)){o=!1,_({type:"warning",message:`${t("stockTips")}`});break}else if(u.stock<0){o=!1,_({type:"warning",message:`${t("stockNotZeroTips")}`});break}}return o},D=()=>{if(I()){let o=[];s.data.forEach(a=>{o.push({sku_id:a.sku_id,stock:a.stock})}),A({goods_id:r.goods_id,sku_list:o}).then(a=>{T("load"),c.value=!1})}};return N({showDialog:c,show:C}),(o,a)=>{const u=Z,E=q,h=z,k=H,P=F,L=G,O=J;return g(),b("div",null,[n(L,{modelValue:c.value,"onUpdate:modelValue":a[2]||(a[2]=p=>c.value=p),title:e(t)("editStockPopupTitle"),width:"600px","close-on-press-escape":!1,"destroy-on-close":!0,"close-on-click-modal":!1},{footer:i(()=>[l("span",pt,[n(h,{onClick:a[1]||(a[1]=p=>c.value=!1)},{default:i(()=>[x(m(e(t)("cancel")),1)]),_:1}),n(h,{type:"primary",onClick:D},{default:i(()=>[x(m(e(t)("confirm")),1)]),_:1})])]),default:i(()=>[l("div",et,[l("div",ot,[r.goods_cover_thumb_small?(g(),y(u,{key:0,class:"w-[70px] h-[70px]",src:e(j)(r.goods_cover_thumb_small),fit:"contain"},{error:i(()=>[at]),_:1},8,["src"])):(g(),b("img",st))]),l("div",lt,[l("span",{title:r.goods_name,class:"multi-hidden"},m(r.goods_name),9,it),l("span",rt,m(r.goods_type_name),1)])]),e(s).data.length>1?(g(),b("div",nt,[l("label",null,m(e(t)("batchOperationSku")),1),n(E,{modelValue:d.value,"onUpdate:modelValue":a[0]||(a[0]=p=>d.value=p),clearable:"",placeholder:e(t)("stock"),class:"set-input",maxlength:"20",autofocus:!0},null,8,["modelValue","placeholder"]),n(h,{type:"primary",onClick:B},{default:i(()=>[x(m(e(t)("confirm")),1)]),_:1})])):V("",!0),R((g(),y(P,{data:e(s).data,size:"large","max-height":"400"},{empty:i(()=>[l("span",null,m(e(s).loading?"":e(t)("emptyData")),1)]),default:i(()=>[e(s).data.length>1?(g(),y(k,{key:0,prop:"sku_name",label:e(t)("skuName"),"min-width":"120"},null,8,["label"])):V("",!0),n(k,{prop:"price",label:e(t)("price"),"min-width":"120"},null,8,["label"]),n(k,{prop:"stock",label:e(t)("stock"),"min-width":"120"},{default:i(({row:p})=>[n(E,{modelValue:p.stock,"onUpdate:modelValue":U=>p.stock=U,clearable:"",placeholder:"0",maxlength:"10",type:"number"},null,8,["modelValue","onUpdate:modelValue"])]),_:1},8,["label"])]),_:1},8,["data"])),[[O,e(s).loading]])]),_:1},8,["modelValue","title"])])}}});const le=Y(mt,[["__scopeId","data-v-7410ea10"]]);export{le as default};
|