智慧教务系统 PHP-NiuCloud框架开发
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

1 lines
4.3 KiB

import{d as j,l as v,r as S,h as _,c as b,e as c,w as i,a as l,i as x,t as r,u as a,k as e,m as y,z,B as C,J,P as g,C as Z,D as q,E as A,$ as F,a0 as H,V as K,L as Q,p as R,g as W}from"./index-775ec1fd.js";/* empty css *//* empty css *//* empty css *//* empty css *//* empty css */import"./el-tooltip-4ed993c7.js";/* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css *//* empty css */import{_ as N}from"./goods_default-664bb559.js";import{J as X,G as Y}from"./goods-4da3b515.js";import{_ as ee}from"./_plugin-vue_export-helper-c27b6911.js";const te=f=>(R("data-v-0c5ed56c"),f=f(),W(),f),oe={class:"flex items-center mb-[10px]"},se={class:"min-w-[70px] h-[70px] flex items-center justify-center"},ae=te(()=>l("div",{class:"image-slot"},[l("img",{class:"w-[70px] h-[70px]",src:N})],-1)),le={key:1,class:"w-[70px] h-[70px]",src:N,fit:"contain"},ie={class:"ml-2"},ne=["title"],ce={class:"text-primary text-[12px]"},de={key:0,class:"batch-operation-sku"},re={class:"dialog-footer"},pe=j({__name:"goods-stock-edit-popup",emits:["load"],setup(f,{expose:T,emit:$}){const n=v({}),w=S(0),p=S(!1),s=v({loading:!0,data:[]}),m=v({value:""}),B=()=>{if(m.value.length==0){g({type:"warning",message:`${e("stockPlaceholder")}`});return}if(!V.number.test(m.value)){g({type:"warning",message:`${e("stockTips")}`});return}if(m.value<0){g({type:"warning",message:`${e("stockNotZeroTips")}`});return}s.data.forEach(t=>{t.stock=m.value})},D=()=>{s.loading=!0,Y({goods_id:n.goods_id}).then(t=>{s.loading=!1,s.data=t.data}).catch(()=>{s.loading=!1})},I=t=>{Object.assign(n,t),D(),p.value=!0},V={number:/^\d{0,10}$/},P=()=>{let t=!0;for(let o=0;o<s.data.length;o++){let u=s.data[o];if(u.stock.length==0){t=!1,g({type:"warning",message:`${e("stockPlaceholder")}`});break}else if(isNaN(u.stock)||!V.number.test(u.stock)){t=!1,g({type:"warning",message:`${e("stockTips")}`});break}else if(u.stock<0){t=!1,g({type:"warning",message:`${e("stockNotZeroTips")}`});break}}return t},G=()=>{if(P()){const t=[];s.data.forEach(o=>{t.push({sku_id:o.sku_id,stock:o.stock})}),X({goods_id:n.goods_id,sku_list:t}).then(o=>{$("load"),p.value=!1})}};return T({showDialog:p,show:I}),(t,o)=>{const u=Z,E=q,h=A,k=F,L=H,U=K,M=Q;return _(),b("div",null,[c(U,{modelValue:p.value,"onUpdate:modelValue":o[2]||(o[2]=d=>p.value=d),title:a(e)("editStockPopupTitle"),width:"600px","close-on-press-escape":!1,"destroy-on-close":!0,"close-on-click-modal":!1},{footer:i(()=>[l("span",re,[c(h,{onClick:o[1]||(o[1]=d=>p.value=!1)},{default:i(()=>[x(r(a(e)("cancel")),1)]),_:1}),c(h,{type:"primary",onClick:G},{default:i(()=>[x(r(a(e)("confirm")),1)]),_:1})])]),default:i(()=>[l("div",oe,[l("div",se,[n.goods_cover_thumb_small?(_(),y(u,{key:0,class:"w-[70px] h-[70px]",src:a(z)(n.goods_cover_thumb_small),fit:"contain"},{error:i(()=>[ae]),_:1},8,["src"])):(_(),b("img",le))]),l("div",ie,[l("span",{title:n.goods_name,class:"multi-hidden"},r(n.goods_name),9,ne),l("span",ce,r(n.goods_type_name),1)])]),w.value==0&&s.data.length>1?(_(),b("div",de,[l("label",null,r(a(e)("batchOperationSku")),1),c(E,{modelValue:m.value,"onUpdate:modelValue":o[0]||(o[0]=d=>m.value=d),modelModifiers:{trim:!0},clearable:"",placeholder:a(e)("stock"),class:"set-input",maxlength:"8",autofocus:!0},null,8,["modelValue","placeholder"]),c(h,{type:"primary",onClick:B},{default:i(()=>[x(r(a(e)("confirm")),1)]),_:1})])):C("",!0),J((_(),y(L,{data:s.data,size:"large","max-height":"400"},{empty:i(()=>[l("span",null,r(s.loading?"":a(e)("emptyData")),1)]),default:i(()=>[s.data.length>1?(_(),y(k,{key:0,prop:"sku_name",label:a(e)("skuName"),"min-width":"120"},null,8,["label"])):C("",!0),c(k,{prop:"price",label:a(e)("price"),"min-width":"120"},null,8,["label"]),c(k,{prop:"stock",label:a(e)("stock"),"min-width":"120"},{default:i(({row:d})=>[c(E,{modelValue:d.stock,"onUpdate:modelValue":O=>d.stock=O,modelModifiers:{trim:!0},clearable:"",placeholder:"0",maxlength:"8",disabled:w.value>0},null,8,["modelValue","onUpdate:modelValue","disabled"])]),_:1},8,["label"])]),_:1},8,["data"])),[[M,s.loading]])]),_:1},8,["modelValue","title"])])}}});const $e=ee(pe,[["__scopeId","data-v-0c5ed56c"]]);export{$e as default};