chunk-0d9cdf7c.e4c4bbd0.js 89.1 KB
(window["webpackJsonp"]=window["webpackJsonp"]||[]).push([["chunk-0d9cdf7c"],{"01e0":function(t,e,a){"use strict";a.r(e);var o=function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("el-dialog",{staticClass:"NCC-dialog NCC-dialog_center",attrs:{title:t.dataForm.id?"编辑产品":"新建产品","close-on-click-modal":!1,visible:t.visible,"lock-scroll":"",width:"800px"},on:{"update:visible":function(e){t.visible=e}}},[a("el-form",{ref:"elForm",attrs:{model:t.dataForm,size:"small","label-width":"120px","label-position":"right",rules:t.rules}},[a("el-row",{attrs:{gutter:15}},[a("el-col",{attrs:{span:12}},[a("el-form-item",{attrs:{label:"产品名称",prop:"productName"}},[a("el-input",{style:{width:"100%"},attrs:{placeholder:"请输入产品名称",clearable:""},model:{value:t.dataForm.productName,callback:function(e){t.$set(t.dataForm,"productName",e)},expression:"dataForm.productName"}})],1)],1),a("el-col",{attrs:{span:12}},[a("el-form-item",{attrs:{label:"产品类别",prop:"productCategory"}},[a("el-input",{style:{width:"100%"},attrs:{placeholder:"请输入产品类别",clearable:""},model:{value:t.dataForm.productCategory,callback:function(e){t.$set(t.dataForm,"productCategory",e)},expression:"dataForm.productCategory"}})],1)],1),a("el-col",{attrs:{span:12}},[a("el-form-item",{attrs:{label:"负责部门",prop:"departmentId"}},[a("el-select",{style:{width:"100%"},attrs:{placeholder:"请选择负责部门",clearable:"",filterable:""},model:{value:t.dataForm.departmentId,callback:function(e){t.$set(t.dataForm,"departmentId",e)},expression:"dataForm.departmentId"}},t._l(t.departmentList,(function(t){return a("el-option",{key:t.id,attrs:{label:t.name,value:t.id}})})),1)],1)],1),a("el-col",{attrs:{span:12}},[a("el-form-item",{attrs:{label:"标准单位",prop:"standardUnit"}},[a("el-input",{style:{width:"100%"},attrs:{placeholder:"请输入标准单位",clearable:""},model:{value:t.dataForm.standardUnit,callback:function(e){t.$set(t.dataForm,"standardUnit",e)},expression:"dataForm.standardUnit"}})],1)],1),a("el-col",{attrs:{span:12}},[a("el-form-item",{attrs:{label:"统计分类",prop:"statisticsCategory"}},[a("el-input",{style:{width:"100%"},attrs:{placeholder:"请输入统计分类",clearable:""},model:{value:t.dataForm.statisticsCategory,callback:function(e){t.$set(t.dataForm,"statisticsCategory",e)},expression:"dataForm.statisticsCategory"}})],1)],1),a("el-col",{attrs:{span:12}},[a("el-form-item",{attrs:{label:"归属仓库",prop:"warehouse"}},[a("el-input",{style:{width:"100%"},attrs:{placeholder:"请输入归属仓库",clearable:""},model:{value:t.dataForm.warehouse,callback:function(e){t.$set(t.dataForm,"warehouse",e)},expression:"dataForm.warehouse"}})],1)],1),a("el-col",{attrs:{span:12}},[a("el-form-item",{attrs:{label:"供应商名称",prop:"supplierName"}},[a("el-input",{style:{width:"100%"},attrs:{placeholder:"请输入供应商名称",clearable:""},model:{value:t.dataForm.supplierName,callback:function(e){t.$set(t.dataForm,"supplierName",e)},expression:"dataForm.supplierName"}})],1)],1),a("el-col",{attrs:{span:12}},[a("el-form-item",{attrs:{label:"合同签订日期",prop:"contractSignDate"}},[a("el-date-picker",{style:{width:"100%"},attrs:{type:"date",placeholder:"请选择合同签订日期","value-format":"yyyy-MM-dd",format:"yyyy-MM-dd"},model:{value:t.dataForm.contractSignDate,callback:function(e){t.$set(t.dataForm,"contractSignDate",e)},expression:"dataForm.contractSignDate"}})],1)],1),a("el-col",{attrs:{span:12}},[a("el-form-item",{attrs:{label:"合同结束日期",prop:"contractEndDate"}},[a("el-date-picker",{style:{width:"100%"},attrs:{type:"date",placeholder:"请选择合同结束日期","value-format":"yyyy-MM-dd",format:"yyyy-MM-dd"},model:{value:t.dataForm.contractEndDate,callback:function(e){t.$set(t.dataForm,"contractEndDate",e)},expression:"dataForm.contractEndDate"}})],1)],1),a("el-col",{attrs:{span:24}},[a("el-form-item",{attrs:{label:"备注",prop:"remark"}},[a("el-input",{style:{width:"100%"},attrs:{type:"textarea",rows:3,placeholder:"请输入备注信息",clearable:""},model:{value:t.dataForm.remark,callback:function(e){t.$set(t.dataForm,"remark",e)},expression:"dataForm.remark"}})],1)],1)],1)],1),a("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[a("el-button",{on:{click:function(e){t.visible=!1}}},[t._v("取 消")]),a("el-button",{attrs:{type:"primary",loading:t.btnLoading},on:{click:function(e){return t.dataFormSubmit()}}},[t._v("确 定")])],1)],1)},r=[],n=(a("6762"),a("2fdb"),a("f576"),a("b775")),i={data:function(){return{visible:!1,btnLoading:!1,departmentList:[],dataForm:{id:void 0,productName:"",productCategory:"",departmentId:"",standardUnit:"",onShelfStatus:1,statisticsCategory:"",warehouse:"",supplierName:"",contractSignDate:"",contractEndDate:"",remark:""},rules:{productName:[{required:!0,message:"请输入产品名称",trigger:"blur"}],onShelfStatus:[{required:!0,message:"请选择上架状态",trigger:"change"}]}}},methods:{init:function(t){this.visible=!0,this.dataForm={id:void 0,productName:"",productCategory:"",departmentId:"",standardUnit:"",onShelfStatus:1,statisticsCategory:"",warehouse:"",supplierName:"",contractSignDate:"",contractEndDate:"",remark:""},this.getDepartmentList(),t&&this.getProductDetail(t)},getDepartmentList:function(){var t=this;Object(n["a"])({url:"/api/permission/Organize/96240625-934F-490B-8AA6-0BC775B18468/Department",method:"GET"}).then((function(e){200==e.code&&e.data.list&&e.data.list.length>0?t.departmentList=e.data.list.map((function(t){return{id:t.id,name:t.fullName}})):t.departmentList=[]})).catch((function(){t.departmentList=[]}))},formatDateToYYYYMMDD:function(t){if(!t&&0!==t)return"";var e=null;if(t instanceof Date)e=t;else if("string"===typeof t){if(/^\d{4}-\d{2}-\d{2}$/.test(t))return t;e=new Date(t)}else e="number"===typeof t?new Date(t):new Date(String(t));if(e&&!isNaN(e.getTime())){var a=e.getFullYear(),o=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0");return"".concat(a,"-").concat(o,"-").concat(r)}return""},getProductDetail:function(t){var e=this;Object(n["a"])({url:"/api/Extend/LqProduct/GetInfo",method:"GET",data:{id:t}}).then((function(t){if(200==t.code&&t.data){var a=t.data;e.dataForm={id:a.id,productName:a.productName||"",productCategory:a.productCategory||"",departmentId:a.departmentId||"",standardUnit:a.standardUnit||"",onShelfStatus:void 0!==a.onShelfStatus?a.onShelfStatus:1,statisticsCategory:a.statisticsCategory||"",warehouse:a.warehouse||"",supplierName:a.supplierName||"",contractSignDate:e.formatDateToYYYYMMDD(a.contractSignDate),contractEndDate:e.formatDateToYYYYMMDD(a.contractEndDate),remark:a.remark||""}}else e.$message({type:"error",message:t.msg||"获取产品详情失败"})})).catch((function(t){console.error("获取产品详情失败:",t),e.$message({type:"error",message:"获取产品详情失败"})}))},dataFormSubmit:function(){var t=this;this.$refs.elForm.validate((function(e){if(!e)return!1;t.btnLoading=!0;var a=t.dataForm.id?"/api/Extend/LqProduct/Update":"/api/Extend/LqProduct/Create",o=t.dataForm.id?"PUT":"POST",r=t.dataForm.contractSignDate,i=t.dataForm.contractEndDate;if(r&&!r.includes("T")){var s=new Date(r);r=s.toISOString()}if(i&&!i.includes("T")){var l=new Date(i);i=l.toISOString()}Object(n["a"])({url:a,method:o,data:{id:t.dataForm.id,productName:t.dataForm.productName,productCategory:t.dataForm.productCategory,departmentId:t.dataForm.departmentId,standardUnit:t.dataForm.standardUnit,onShelfStatus:t.dataForm.onShelfStatus,statisticsCategory:t.dataForm.statisticsCategory,warehouse:t.dataForm.warehouse,supplierName:t.dataForm.supplierName,contractSignDate:r,contractEndDate:i,remark:t.dataForm.remark}}).then((function(e){t.btnLoading=!1,t.$message({type:"success",message:e.msg||(t.dataForm.id?"编辑成功":"创建成功"),onClose:function(){t.visible=!1,t.$emit("refresh")}})})).catch((function(){t.btnLoading=!1}))}))}}},s=i,l=a("2877"),c=Object(l["a"])(s,o,r,!1,null,"294b3262",null);e["default"]=c.exports},"08c2":function(t,e,a){"use strict";a("092b")},"092b":function(t,e,a){},"0954":function(t,e,a){},"1ebd":function(t,e,a){"use strict";a.r(e);var o=function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("el-dialog",{staticClass:"NCC-dialog NCC-dialog_center",attrs:{title:"编辑库存","close-on-click-modal":!1,visible:t.visible,"lock-scroll":"",width:"800px"},on:{"update:visible":function(e){t.visible=e}}},[a("el-form",{ref:"elForm",attrs:{model:t.dataForm,size:"small","label-width":"120px","label-position":"right",rules:t.rules}},[a("el-row",{attrs:{gutter:15}},[a("el-col",{attrs:{span:12}},[a("el-form-item",{attrs:{label:"产品"}},[a("el-input",{style:{width:"100%"},attrs:{placeholder:"产品名称",readonly:""},model:{value:t.productName,callback:function(e){t.productName=e},expression:"productName"}})],1)],1),a("el-col",{attrs:{span:12}},[a("el-form-item",{attrs:{label:"入库类型"}},[a("el-tag",{attrs:{type:2===t.dataForm.stockInType?"warning":"info",size:"small"}},[t._v("\n\t\t\t\t\t\t"+t._s(2===t.dataForm.stockInType?"采购入库":"普通入库")+"\n\t\t\t\t\t")])],1)],1),a("el-col",{attrs:{span:12}},[a("el-form-item",{attrs:{label:"数量",prop:"quantity"}},[a("el-input-number",{style:{width:"100%"},attrs:{placeholder:"请输入数量",min:1,precision:0},on:{change:t.calculateFinalAmount},model:{value:t.dataForm.quantity,callback:function(e){t.$set(t.dataForm,"quantity",e)},expression:"dataForm.quantity"}})],1)],1),2===t.dataForm.stockInType?a("el-col",{attrs:{span:12}},[a("el-form-item",{attrs:{label:"采购单价",prop:"purchaseUnitPrice"}},[a("el-input-number",{style:{width:"100%"},attrs:{placeholder:"请输入采购单价",min:0,precision:2},on:{change:t.calculateFinalAmount},model:{value:t.dataForm.purchaseUnitPrice,callback:function(e){t.$set(t.dataForm,"purchaseUnitPrice",e)},expression:"dataForm.purchaseUnitPrice"}})],1)],1):t._e(),2===t.dataForm.stockInType?a("el-col",{attrs:{span:12}},[a("el-form-item",{attrs:{label:"采购总金额"}},[a("el-input",{style:{width:"100%"},attrs:{placeholder:"系统自动计算",readonly:""},model:{value:t.purchaseAmountDisplay,callback:function(e){t.purchaseAmountDisplay=e},expression:"purchaseAmountDisplay"}})],1)],1):t._e(),1===t.dataForm.stockInType?a("el-col",{attrs:{span:12}},[a("el-form-item",{attrs:{label:"单价"}},[a("el-input-number",{style:{width:"100%"},attrs:{placeholder:t.productAveragePrice?"产品平均单价:¥"+t.formatMoney(t.productAveragePrice):"请输入单价",min:0,precision:2},on:{change:t.calculateFinalAmount},model:{value:t.dataForm.unitPrice,callback:function(e){t.$set(t.dataForm,"unitPrice",e)},expression:"dataForm.unitPrice"}}),t.productAveragePrice&&!t.dataForm.unitPrice?a("div",{staticStyle:{"font-size":"12px",color:"#909399","margin-top":"4px"}},[t._v("\n\t\t\t\t\t\t默认使用产品平均单价:¥"+t._s(t.formatMoney(t.productAveragePrice))+"\n\t\t\t\t\t")]):t._e()],1)],1):t._e(),a("el-col",{attrs:{span:12}},[a("el-form-item",{attrs:{label:"最终金额",prop:"finalAmount"}},[a("el-input-number",{style:{width:"100%"},attrs:{placeholder:"自动计算",min:0,precision:2},on:{change:t.onFinalAmountChange},model:{value:t.dataForm.finalAmount,callback:function(e){t.$set(t.dataForm,"finalAmount",e)},expression:"dataForm.finalAmount"}})],1)],1),a("el-col",{attrs:{span:12}},[a("el-form-item",{attrs:{label:"入库时间",prop:"stockInTime"}},[a("el-date-picker",{style:{width:"100%"},attrs:{type:"date",placeholder:"请选择入库时间","value-format":"yyyy-MM-dd",format:"yyyy-MM-dd"},model:{value:t.dataForm.stockInTime,callback:function(e){t.$set(t.dataForm,"stockInTime",e)},expression:"dataForm.stockInTime"}})],1)],1),a("el-col",{attrs:{span:12}},[a("el-form-item",{attrs:{label:"生产日期",prop:"productionDate"}},[a("el-date-picker",{style:{width:"100%"},attrs:{type:"date",placeholder:"请选择生产日期","value-format":"yyyy-MM-dd",format:"yyyy-MM-dd"},model:{value:t.dataForm.productionDate,callback:function(e){t.$set(t.dataForm,"productionDate",e)},expression:"dataForm.productionDate"}})],1)],1),a("el-col",{attrs:{span:12}},[a("el-form-item",{attrs:{label:"保质期(天)",prop:"shelfLife"}},[a("el-input-number",{style:{width:"100%"},attrs:{placeholder:"请输入保质期",min:1,precision:0},model:{value:t.dataForm.shelfLife,callback:function(e){t.$set(t.dataForm,"shelfLife",e)},expression:"dataForm.shelfLife"}})],1)],1),a("el-col",{attrs:{span:12}},[a("el-form-item",{attrs:{label:"批次号",prop:"batchNumber"}},[a("el-input",{style:{width:"100%"},attrs:{placeholder:"请输入批次号",clearable:""},model:{value:t.dataForm.batchNumber,callback:function(e){t.$set(t.dataForm,"batchNumber",e)},expression:"dataForm.batchNumber"}})],1)],1)],1)],1),a("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[a("el-button",{on:{click:function(e){t.visible=!1}}},[t._v("取 消")]),a("el-button",{attrs:{type:"primary",loading:t.btnLoading},on:{click:function(e){return t.dataFormSubmit()}}},[t._v("确 定")])],1)],1)},r=[],n=(a("f576"),a("c5f6"),a("b775")),i={data:function(){return{visible:!1,btnLoading:!1,productName:"",productAveragePrice:null,dataForm:{id:"",productId:"",stockInType:1,quantity:1,stockInTime:"",productionDate:"",shelfLife:null,batchNumber:"",purchaseUnitPrice:null,unitPrice:null,finalAmount:null},isManualEditFinalAmount:!1,rules:{quantity:[{required:!0,message:"请输入数量",trigger:"blur"}],purchaseUnitPrice:[{required:!1,message:"请输入采购单价",trigger:"blur"}],finalAmount:[{required:!1,message:"请输入最终金额",trigger:"blur"}]}}},computed:{purchaseAmountDisplay:function(){return 2===this.dataForm.stockInType&&this.dataForm.purchaseUnitPrice&&this.dataForm.quantity?"¥"+(this.dataForm.purchaseUnitPrice*this.dataForm.quantity).toFixed(2):"无"},currentUnitPrice:function(){return 2===this.dataForm.stockInType?this.dataForm.purchaseUnitPrice||0:this.dataForm.unitPrice||this.productAveragePrice||0}},methods:{init:function(t){var e=this;this.visible=!0,this.productName=t.productName||"",this.productAveragePrice=t.productAveragePrice||t.productPrice||null,this.isManualEditFinalAmount=!1;var a=null;1===t.stockInType&&t.finalAmount&&t.quantity&&t.quantity>0&&(a=Number((t.finalAmount/t.quantity).toFixed(2))),this.dataForm={id:t.id||"",productId:t.productId||"",stockInType:t.stockInType||1,quantity:t.quantity||1,stockInTime:t.stockInTime?this.formatDateForInput(t.stockInTime):"",productionDate:t.productionDate?this.formatDateForInput(t.productionDate):"",shelfLife:t.shelfLife||null,batchNumber:t.batchNumber||"",purchaseUnitPrice:t.purchaseUnitPrice||null,unitPrice:a,finalAmount:t.finalAmount||null},this.$nextTick((function(){!e.dataForm.finalAmount&&e.currentUnitPrice&&e.currentUnitPrice>0&&e.dataForm.quantity&&e.dataForm.quantity>0&&e.calculateFinalAmount()})),this.$nextTick((function(){e.$refs.elForm&&e.$refs.elForm.clearValidate()}))},formatDateForInput:function(t){if(!t)return"";try{var e=new Date(t);if(isNaN(e.getTime()))return"";var a=e.getFullYear(),o=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0");return"".concat(a,"-").concat(o,"-").concat(r)}catch(n){return""}},calculateFinalAmount:function(){if(!this.isManualEditFinalAmount){var t=this.currentUnitPrice,e=this.dataForm.quantity;if(t&&t>0&&e&&e>0){var a=t*e;this.dataForm.finalAmount=Number(a.toFixed(2))}else this.dataForm.finalAmount=null}},onFinalAmountChange:function(){this.isManualEditFinalAmount=!0},formatMoney:function(t){return t||0===t?Number(t).toFixed(2):"0.00"},dataFormSubmit:function(){var t=this;this.$refs.elForm.validate((function(e){if(!e)return!1;t.btnLoading=!0;var a={id:t.dataForm.id,productId:t.dataForm.productId,quantity:t.dataForm.quantity,stockInType:t.dataForm.stockInType,stockInTime:t.dataForm.stockInTime||null,productionDate:t.dataForm.productionDate||null,shelfLife:t.dataForm.shelfLife||null,batchNumber:t.dataForm.batchNumber||null,purchaseUnitPrice:t.dataForm.purchaseUnitPrice||null,finalAmount:t.dataForm.finalAmount||null};if(2===a.stockInType&&(!a.purchaseUnitPrice||a.purchaseUnitPrice<=0))return t.$message({type:"warning",message:"采购入库时,采购单价必须大于0",duration:1500}),void(t.btnLoading=!1);Object(n["a"])({url:"/api/Extend/LqInventory/Update",method:"PUT",data:a}).then((function(e){t.btnLoading=!1,200==e.code?t.$message({type:"success",message:e.msg||"更新成功",duration:1500,onClose:function(){t.visible=!1,t.$emit("refresh")}}):t.$message({type:"error",message:e.msg||"更新失败",duration:2e3})})).catch((function(e){t.btnLoading=!1,console.error("更新失败:",e),t.$message({type:"error",message:e.msg||"更新失败,请重试",duration:2e3})}))}))}}},s=i,l=(a("8d1c"),a("2877")),c=Object(l["a"])(s,o,r,!1,null,"125d3fb3",null);e["default"]=c.exports},"23c4":function(t,e,a){"use strict";a("0954")},"497f":function(t,e,a){"use strict";a.r(e);var o=function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("el-dialog",{staticClass:"NCC-dialog NCC-dialog_center",attrs:{title:"添加库存","close-on-click-modal":!1,visible:t.visible,"lock-scroll":"",width:"800px"},on:{"update:visible":function(e){t.visible=e}}},[a("el-form",{ref:"elForm",attrs:{model:t.dataForm,size:"small","label-width":"120px","label-position":"right",rules:t.rules}},[a("el-row",{attrs:{gutter:15}},[a("el-col",{attrs:{span:12}},[a("el-form-item",{attrs:{label:"产品",prop:"productId"}},[a("el-select",{style:{width:"100%"},attrs:{placeholder:"请选择产品",clearable:"",filterable:"",disabled:!!t.defaultProductId},on:{change:t.onProductChange},model:{value:t.dataForm.productId,callback:function(e){t.$set(t.dataForm,"productId",e)},expression:"dataForm.productId"}},t._l(t.productOptions,(function(t){return a("el-option",{key:t.id,attrs:{label:t.productName,value:t.id}})})),1)],1)],1),a("el-col",{directives:[{name:"show",rawName:"v-show",value:!1,expression:"false"}],attrs:{span:12}},[a("el-form-item",{attrs:{label:"入库类型",prop:"stockInType"}},[a("el-select",{style:{width:"100%"},attrs:{placeholder:"请选择入库类型",clearable:""},on:{change:t.onStockInTypeChange},model:{value:t.dataForm.stockInType,callback:function(e){t.$set(t.dataForm,"stockInType",e)},expression:"dataForm.stockInType"}},[a("el-option",{attrs:{label:"普通入库",value:1}}),a("el-option",{attrs:{label:"采购入库",value:2}})],1)],1)],1),a("el-col",{attrs:{span:12}},[a("el-form-item",{attrs:{label:"数量",prop:"quantity"}},[a("el-input-number",{style:{width:"100%"},attrs:{placeholder:"请输入数量",min:1,precision:0},on:{change:t.calculatePurchaseAmount},model:{value:t.dataForm.quantity,callback:function(e){t.$set(t.dataForm,"quantity",e)},expression:"dataForm.quantity"}})],1)],1),2===t.dataForm.stockInType?a("el-col",{attrs:{span:12}},[a("el-form-item",{attrs:{label:"采购单价",prop:"purchaseUnitPrice"}},[a("el-input-number",{style:{width:"100%"},attrs:{placeholder:"请输入采购单价",min:0,precision:2},on:{change:t.calculatePurchaseAmount},model:{value:t.dataForm.purchaseUnitPrice,callback:function(e){t.$set(t.dataForm,"purchaseUnitPrice",e)},expression:"dataForm.purchaseUnitPrice"}})],1)],1):t._e(),2===t.dataForm.stockInType?a("el-col",{attrs:{span:12}},[a("el-form-item",{attrs:{label:"采购总金额"}},[a("el-input",{style:{width:"100%"},attrs:{placeholder:"系统自动计算",readonly:""},model:{value:t.purchaseAmountDisplay,callback:function(e){t.purchaseAmountDisplay=e},expression:"purchaseAmountDisplay"}})],1)],1):t._e(),a("el-col",{attrs:{span:12}},[a("el-form-item",{attrs:{label:"入库时间",prop:"stockInTime"}},[a("el-date-picker",{style:{width:"100%"},attrs:{type:"date",placeholder:"请选择入库时间","value-format":"yyyy-MM-dd",format:"yyyy-MM-dd"},model:{value:t.dataForm.stockInTime,callback:function(e){t.$set(t.dataForm,"stockInTime",e)},expression:"dataForm.stockInTime"}})],1)],1),a("el-col",{attrs:{span:12}},[a("el-form-item",{attrs:{label:"生产日期",prop:"productionDate"}},[a("el-date-picker",{style:{width:"100%"},attrs:{type:"date",placeholder:"请选择生产日期","value-format":"yyyy-MM-dd",format:"yyyy-MM-dd"},model:{value:t.dataForm.productionDate,callback:function(e){t.$set(t.dataForm,"productionDate",e)},expression:"dataForm.productionDate"}})],1)],1),a("el-col",{attrs:{span:12}},[a("el-form-item",{attrs:{label:"保质期(天)",prop:"shelfLife"}},[a("el-input-number",{style:{width:"100%"},attrs:{placeholder:"请输入保质期",min:1,precision:0},model:{value:t.dataForm.shelfLife,callback:function(e){t.$set(t.dataForm,"shelfLife",e)},expression:"dataForm.shelfLife"}})],1)],1),a("el-col",{attrs:{span:12}},[a("el-form-item",{attrs:{label:"批次号",prop:"batchNumber"}},[a("el-input",{style:{width:"100%"},attrs:{placeholder:"请输入批次号",clearable:""},model:{value:t.dataForm.batchNumber,callback:function(e){t.$set(t.dataForm,"batchNumber",e)},expression:"dataForm.batchNumber"}})],1)],1)],1)],1),a("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[a("el-button",{on:{click:function(e){t.visible=!1}}},[t._v("取 消")]),a("el-button",{attrs:{type:"primary",loading:t.btnLoading},on:{click:function(e){return t.dataFormSubmit()}}},[t._v("确 定")])],1)],1)},r=[],n=a("b775"),i={data:function(){return{visible:!1,btnLoading:!1,defaultProductId:"",dataForm:{productId:"",stockInType:2,quantity:1,stockInTime:"",productionDate:"",shelfLife:365,batchNumber:"",purchaseUnitPrice:null},productOptions:[],rules:{productId:[{required:!0,message:"请选择产品",trigger:"change"}],quantity:[{required:!0,message:"请输入数量",trigger:"blur"}],stockInTime:[{required:!0,message:"请选择入库时间",trigger:"change"}]}}},computed:{purchaseAmountDisplay:function(){if(2===this.dataForm.stockInType&&this.dataForm.purchaseUnitPrice&&this.dataForm.quantity){var t=this.dataForm.purchaseUnitPrice*this.dataForm.quantity;return"¥"+t.toFixed(2)}return""}},methods:{init:function(t){this.visible=!0,this.defaultProductId=t||"",this.dataForm={productId:t||"",stockInType:2,quantity:1,stockInTime:"",productionDate:"",shelfLife:365,batchNumber:"",purchaseUnitPrice:null},this.initProductOptions()},initProductOptions:function(){var t=this,e={currentPage:1,pageSize:1e3};this.defaultProductId?e.id=this.defaultProductId:e.onShelfStatus=1,Object(n["a"])({url:"/api/Extend/LqProduct/GetList",method:"GET",data:e}).then((function(e){200==e.code&&e.data&&e.data.list&&(t.defaultProductId?t.productOptions=e.data.list:t.productOptions=e.data.list.filter((function(t){return 1===t.onShelfStatus})))})).catch((function(){t.productOptions=[]}))},onProductChange:function(){},onStockInTypeChange:function(){var t=this;2!==this.dataForm.stockInType&&(this.dataForm.purchaseUnitPrice=null),this.$nextTick((function(){t.$refs.elForm&&t.$refs.elForm.clearValidate("purchaseUnitPrice")}))},calculatePurchaseAmount:function(){},dataFormSubmit:function(){var t=this;this.$refs.elForm.validate((function(e){if(!e)return!1;t.btnLoading=!0;var a={productId:t.dataForm.productId,stockInType:t.dataForm.stockInType,quantity:t.dataForm.quantity,stockInTime:t.dataForm.stockInTime,productionDate:t.dataForm.productionDate,shelfLife:t.dataForm.shelfLife,batchNumber:t.dataForm.batchNumber};2===t.dataForm.stockInType&&(a.purchaseUnitPrice=t.dataForm.purchaseUnitPrice),Object(n["a"])({url:"/api/Extend/LqInventory/Create",method:"POST",data:a}).then((function(e){t.btnLoading=!1,t.$message({type:"success",message:e.msg||"添加成功",onClose:function(){t.visible=!1,t.$emit("refresh")}})})).catch((function(){t.btnLoading=!1}))}))}}},s=i,l=a("2877"),c=Object(l["a"])(s,o,r,!1,null,"3fcdb496",null);e["default"]=c.exports},5880:function(t,e,a){},"5aaf":function(t,e,a){"use strict";a.r(e);var o=function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("el-dialog",{attrs:{title:"仓库领用成本统计表",visible:t.visible,width:"90%","close-on-click-modal":!1},on:{"update:visible":function(e){t.visible=e},close:t.handleClose}},[a("div",{staticClass:"statistics-dialog-content"},[a("el-row",{staticClass:"search-box",attrs:{gutter:16}},[a("el-form",{attrs:{"label-width":"80px","label-position":"right"},nativeOn:{submit:function(t){t.preventDefault()}}},[a("el-col",{attrs:{span:6}},[a("el-form-item",{attrs:{label:"统计月份"}},[a("el-date-picker",{style:{width:"100%"},attrs:{type:"month","value-format":"yyyyMM",format:"yyyy年MM月",placeholder:"请选择月份"},model:{value:t.query.StatisticsMonth,callback:function(e){t.$set(t.query,"StatisticsMonth",e)},expression:"query.StatisticsMonth"}})],1)],1),a("el-col",{attrs:{span:6}},[a("el-form-item",{attrs:{label:"门店"}},[a("el-select",{style:{width:"100%"},attrs:{placeholder:"请选择门店(不选则统计所有门店)",multiple:"",filterable:"",clearable:"","collapse-tags":""},model:{value:t.query.StoreIds,callback:function(e){t.$set(t.query,"StoreIds",e)},expression:"query.StoreIds"}},t._l(t.storeOptions,(function(t){return a("el-option",{key:t.id,attrs:{label:t.dm,value:t.id}})})),1)],1)],1),a("el-col",{attrs:{span:6}},[a("el-form-item",[a("el-button",{attrs:{type:"primary",icon:"el-icon-search"},on:{click:function(e){return t.search()}}},[t._v("查询")]),a("el-button",{attrs:{icon:"el-icon-refresh-right"},on:{click:function(e){return t.reset()}}},[t._v("重置")])],1)],1)],1)],1),a("div",{staticClass:"table-container"},[a("el-table",{directives:[{name:"loading",rawName:"v-loading",value:t.listLoading,expression:"listLoading"}],attrs:{data:t.list,border:"",stripe:"","max-height":600}},[a("el-table-column",{attrs:{prop:"StatisticsMonth",label:"统计月份","min-width":"120",sortable:"custom"},scopedSlots:t._u([{key:"default",fn:function(e){return[a("i",{staticClass:"el-icon-date",staticStyle:{"margin-right":"4px",color:"#409EFF"}}),a("span",[t._v(t._s(t.formatMonth(e.row.StatisticsMonth)||"无"))])]}}])}),a("el-table-column",{attrs:{prop:"StoreName",label:"门店名称","min-width":"150",sortable:"custom"},scopedSlots:t._u([{key:"default",fn:function(e){return[a("i",{staticClass:"el-icon-shop",staticStyle:{"margin-right":"4px",color:"#409EFF"}}),a("span",[t._v(t._s(e.row.StoreName||"无"))])]}}])}),a("el-table-column",{attrs:{prop:"ReceiveCount",label:"领取数量","min-width":"120",sortable:"custom",align:"right"},scopedSlots:t._u([{key:"default",fn:function(e){return[a("i",{staticClass:"el-icon-s-data",staticStyle:{"margin-right":"4px",color:"#67C23A"}}),a("span",[t._v(t._s(null!==e.row.ReceiveCount&&void 0!==e.row.ReceiveCount?e.row.ReceiveCount:0))])]}}])}),a("el-table-column",{attrs:{prop:"ProductVarietyCount",label:"领取品种数量","min-width":"140",sortable:"custom",align:"right"},scopedSlots:t._u([{key:"default",fn:function(e){return[a("i",{staticClass:"el-icon-goods",staticStyle:{"margin-right":"4px",color:"#67C23A"}}),a("span",[t._v(t._s(null!==e.row.ProductVarietyCount&&void 0!==e.row.ProductVarietyCount?e.row.ProductVarietyCount:0))])]}}])}),a("el-table-column",{attrs:{prop:"TotalCostAmount",label:"总价","min-width":"130",sortable:"custom",align:"right"},scopedSlots:t._u([{key:"default",fn:function(e){return[a("i",{staticClass:"el-icon-money",staticStyle:{"margin-right":"4px",color:"#67C23A"}}),a("span",{staticClass:"amount-paid"},[t._v("¥"+t._s(t.formatMoney(e.row.TotalCostAmount)))])]}}])}),a("el-table-column",{attrs:{prop:"AvgUnitPrice",label:"平均单价","min-width":"120",sortable:"custom",align:"right"},scopedSlots:t._u([{key:"default",fn:function(e){return[a("i",{staticClass:"el-icon-coin",staticStyle:{"margin-right":"4px",color:"#909399"}}),a("span",[t._v("¥"+t._s(t.formatMoney(e.row.AvgUnitPrice)))])]}}])}),a("el-table-column",{attrs:{prop:"WarehouseCount",label:"涉及仓库数量","min-width":"140",sortable:"custom",align:"right"},scopedSlots:t._u([{key:"default",fn:function(e){return[a("i",{staticClass:"el-icon-office-building",staticStyle:{"margin-right":"4px",color:"#909399"}}),a("span",[t._v(t._s(null!==e.row.WarehouseCount&&void 0!==e.row.WarehouseCount?e.row.WarehouseCount:0))])]}}])}),a("el-table-column",{attrs:{prop:"UsageRecordCount",label:"领用记录数","min-width":"130",sortable:"custom",align:"right"},scopedSlots:t._u([{key:"default",fn:function(e){return[a("i",{staticClass:"el-icon-document",staticStyle:{"margin-right":"4px",color:"#909399"}}),a("span",[t._v(t._s(null!==e.row.UsageRecordCount&&void 0!==e.row.UsageRecordCount?e.row.UsageRecordCount:0))])]}}])}),a("el-table-column",{attrs:{prop:"AvgReceiveAmount",label:"平均领用金额","min-width":"140",sortable:"custom",align:"right"},scopedSlots:t._u([{key:"default",fn:function(e){return[a("i",{staticClass:"el-icon-coin",staticStyle:{"margin-right":"4px",color:"#67C23A"}}),a("span",[t._v("¥"+t._s(t.formatMoney(e.row.AvgReceiveAmount)))])]}}])}),a("el-table-column",{attrs:{prop:"AvgRecordAmount",label:"平均单笔金额","min-width":"140",sortable:"custom",align:"right"},scopedSlots:t._u([{key:"default",fn:function(e){return[a("i",{staticClass:"el-icon-coin",staticStyle:{"margin-right":"4px",color:"#67C23A"}}),a("span",[t._v("¥"+t._s(t.formatMoney(e.row.AvgRecordAmount)))])]}}])}),a("el-table-column",{attrs:{prop:"TotalUsageQuantity",label:"领用总数量","min-width":"130",sortable:"custom",align:"right"},scopedSlots:t._u([{key:"default",fn:function(e){return[a("i",{staticClass:"el-icon-s-data",staticStyle:{"margin-right":"4px",color:"#67C23A"}}),a("span",[t._v(t._s(null!==e.row.TotalUsageQuantity&&void 0!==e.row.TotalUsageQuantity?e.row.TotalUsageQuantity:0))])]}}])}),a("el-table-column",{attrs:{prop:"MaxRecordAmount",label:"最大单笔金额","min-width":"140",sortable:"custom",align:"right"},scopedSlots:t._u([{key:"default",fn:function(e){return[a("i",{staticClass:"el-icon-top",staticStyle:{"margin-right":"4px",color:"#F56C6C"}}),a("span",[t._v("¥"+t._s(t.formatMoney(e.row.MaxRecordAmount)))])]}}])}),a("el-table-column",{attrs:{prop:"MinRecordAmount",label:"最小单笔金额","min-width":"140",sortable:"custom",align:"right"},scopedSlots:t._u([{key:"default",fn:function(e){return[a("i",{staticClass:"el-icon-bottom",staticStyle:{"margin-right":"4px",color:"#409EFF"}}),a("span",[t._v("¥"+t._s(t.formatMoney(e.row.MinRecordAmount)))])]}}])})],1),a("pagination",{directives:[{name:"show",rawName:"v-show",value:t.total>0,expression:"total > 0"}],attrs:{total:t.total,page:t.listQuery.currentPage,limit:t.listQuery.pageSize},on:{"update:page":function(e){return t.$set(t.listQuery,"currentPage",e)},"update:limit":function(e){return t.$set(t.listQuery,"pageSize",e)},pagination:t.search}})],1)],1)])},r=[],n=(a("c5f6"),a("f576"),a("386d"),a("b775")),i=a("333d"),s={name:"StoreReceiveCostStatisticsDialog",components:{Pagination:i["a"]},props:{visible:{type:Boolean,default:!1},storeOptions:{type:Array,default:function(){return[]}}},data:function(){return{query:{StatisticsMonth:void 0,StoreIds:[]},list:[],listLoading:!1,total:0,listQuery:{currentPage:1,pageSize:20}}},watch:{visible:function(t){t&&(this.setDefaultMonth(),this.search())}},methods:{setDefaultMonth:function(){var t=new Date,e=t.getFullYear(),a=String(t.getMonth()+1).padStart(2,"0");this.query.StatisticsMonth="".concat(e).concat(a)},search:function(){var t=this;this.listLoading=!0;var e={currentPage:this.listQuery.currentPage,pageSize:this.listQuery.pageSize};this.query.StatisticsMonth&&(e.StatisticsMonth=this.query.StatisticsMonth),this.query.StoreIds&&this.query.StoreIds.length>0&&(e.StoreIds=this.query.StoreIds),Object(n["a"])({url:"/api/Extend/LqInventoryUsage/get-store-receive-cost-statistics",method:"POST",data:e}).then((function(e){e.data&&e.data.list?(t.list=e.data.list,t.total=e.data.pagination&&e.data.pagination.total||e.data.list.length||0):(t.list=[],t.total=0),t.listLoading=!1})).catch((function(e){console.error("查询失败:",e),t.$message({type:"error",message:"查询失败,请重试",duration:1500}),t.listLoading=!1,t.list=[],t.total=0}))},reset:function(){this.query={StatisticsMonth:void 0,StoreIds:[]},this.setDefaultMonth(),this.listQuery.currentPage=1,this.listQuery.pageSize=20,this.list=[],this.total=0,this.search()},formatMonth:function(t){if(!t||6!==t.length)return t;var e=t.substring(0,4),a=t.substring(4,6);return"".concat(e,"年").concat(a,"月")},formatMoney:function(t){return t||0===t?Number(t).toFixed(2):"0.00"},handleClose:function(){this.$emit("close")}}},l=s,c=(a("ccdd"),a("2877")),u=Object(c["a"])(l,o,r,!1,null,"4891e68f",null);e["default"]=u.exports},6018:function(t,e,a){},"851f":function(t,e,a){"use strict";a.r(e);var o=function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",{staticClass:"NCC-common-layout"},[a("div",{staticClass:"NCC-common-layout-center"},[a("el-row",{staticClass:"NCC-common-search-box",attrs:{gutter:16}},[a("el-form",{nativeOn:{submit:function(t){t.preventDefault()}}},[a("el-col",{attrs:{span:6}},[a("el-form-item",{attrs:{label:"产品名称"}},[a("el-input",{attrs:{placeholder:"产品名称",clearable:""},model:{value:t.productQuery.productName,callback:function(e){t.$set(t.productQuery,"productName",e)},expression:"productQuery.productName"}})],1)],1),a("el-col",{attrs:{span:6}},[a("el-form-item",{attrs:{label:"产品类别"}},[a("el-input",{attrs:{placeholder:"产品类别",clearable:""},model:{value:t.productQuery.productCategory,callback:function(e){t.$set(t.productQuery,"productCategory",e)},expression:"productQuery.productCategory"}})],1)],1),a("el-col",{attrs:{span:6}},[a("el-form-item",{attrs:{label:"上架状态"}},[a("el-select",{attrs:{placeholder:"上架状态",clearable:""},model:{value:t.productQuery.onShelfStatus,callback:function(e){t.$set(t.productQuery,"onShelfStatus",e)},expression:"productQuery.onShelfStatus"}},[a("el-option",{attrs:{label:"上架",value:1}}),a("el-option",{attrs:{label:"下架",value:0}})],1)],1)],1),a("el-col",{attrs:{span:6}},[a("el-form-item",[a("el-button",{attrs:{type:"primary",icon:"el-icon-search"},on:{click:function(e){return t.searchProduct()}}},[t._v("查询")]),a("el-button",{attrs:{icon:"el-icon-refresh-right"},on:{click:function(e){return t.resetProduct()}}},[t._v("重置")])],1)],1)],1)],1),a("div",{staticClass:"NCC-common-layout-main NCC-flex-main"},[a("div",{staticClass:"NCC-common-head"},[a("div",[a("el-button",{attrs:{type:"primary",icon:"el-icon-plus"},on:{click:function(e){return t.addProduct()}}},[t._v("新增产品")]),a("el-button",{attrs:{type:"primary",icon:"el-icon-plus"},on:{click:function(e){return t.addInventory()}}},[t._v("添加库存")]),a("el-button",{attrs:{type:"primary",icon:"el-icon-plus"},on:{click:function(e){return t.addUsage()}}},[t._v("添加使用记录")]),a("el-button",{attrs:{type:"success",icon:"el-icon-document"},on:{click:function(e){return t.viewApplicationList()}}},[t._v("申请列表")]),a("el-button",{attrs:{type:"info",icon:"el-icon-data-analysis"},on:{click:function(e){return t.viewStatistics()}}},[t._v("门店领取统计")]),a("el-button",{attrs:{type:"primary",icon:"el-icon-printer"},on:{click:function(e){return t.viewPendingDelivery()}}},[t._v("待领取统计")]),a("el-button",{attrs:{type:"warning",icon:"el-icon-download"},on:{click:function(e){return t.exportUsageRecords()}}},[t._v("导出使用记录")]),a("el-button",{attrs:{type:"danger",icon:"el-icon-s-data"},on:{click:function(e){return t.viewStoreReceiveCostStatistics()}}},[t._v("仓库领用成本统计表")])],1),a("div",{staticClass:"NCC-common-head-right"},[a("el-tooltip",{attrs:{effect:"dark",content:"刷新",placement:"top"}},[a("el-link",{attrs:{icon:"icon-ym icon-ym-Refresh NCC-common-head-icon",underline:!1},on:{click:function(e){return t.initProductData()}}})],1),a("screenfull",{attrs:{isContainer:""}})],1)]),a("NCC-table",{directives:[{name:"loading",rawName:"v-loading",value:t.productLoading,expression:"productLoading"}],attrs:{data:t.productList,"header-cell-style":{background:"#f5f7fa",color:"#606266"}}},[a("el-table-column",{attrs:{label:"产品名称",width:"180",align:"center",prop:"productName"}}),a("el-table-column",{attrs:{label:"价格",align:"center"},scopedSlots:t._u([{key:"default",fn:function(e){return[a("div",{staticClass:"price-info"},[a("i",{staticClass:"el-icon-coin price-icon"}),a("span",{staticClass:"text-nowrap"},[t._v("¥"+t._s(t.formatMoney(e.row.averagePrice)))])])]}}])}),a("el-table-column",{attrs:{label:"库存",align:"center",prop:"currentInventory"}}),a("el-table-column",{attrs:{label:"产品类别",align:"center",prop:"productCategory"}}),a("el-table-column",{attrs:{label:"归属部门",align:"center",prop:"departmentName"},scopedSlots:t._u([{key:"default",fn:function(e){return[a("div",{staticClass:"department-info"},[a("span",{staticClass:"text-nowrap"},[t._v(t._s(e.row.departmentName||"无"))])])]}}])}),a("el-table-column",{attrs:{label:"标准单位",align:"center",prop:"standardUnit"}}),a("el-table-column",{attrs:{label:"上架状态",align:"center",prop:"onShelfStatus"},scopedSlots:t._u([{key:"default",fn:function(e){return[a("div",{staticClass:"shelf-status-info"},[a("el-tag",{attrs:{type:1===e.row.onShelfStatus?"success":"info",size:"small"}},[t._v("\n\t\t\t\t\t\t\t\t"+t._s(1===e.row.onShelfStatus?"上架":"下架")+"\n\t\t\t\t\t\t\t")])],1)]}}])}),a("el-table-column",{attrs:{label:"统计分类",align:"center",prop:"statisticsCategory"}}),a("el-table-column",{attrs:{label:"归属仓库",align:"center",prop:"warehouse"},scopedSlots:t._u([{key:"default",fn:function(e){return[a("div",{staticClass:"warehouse-info"},[a("i",{staticClass:"el-icon-office-building warehouse-icon"}),a("span",{staticClass:"text-nowrap"},[t._v(t._s(e.row.warehouse||"无"))])])]}}])}),a("el-table-column",{attrs:{label:"供应商名称",align:"center",prop:"supplierName"}}),a("el-table-column",{attrs:{label:"操作",width:"280",align:"left",fixed:"right"},scopedSlots:t._u([{key:"default",fn:function(e){return[a("div",{staticClass:"action-buttons"},[1===e.row.onShelfStatus?a("el-button",{staticClass:"view-btn",attrs:{type:"text",icon:"el-icon-view"},on:{click:function(a){return t.viewDetail(e.row)}}},[t._v("\n\t\t\t\t\t\t\t\t查看详情\n\t\t\t\t\t\t\t")]):t._e(),a("el-button",{attrs:{type:"text"},on:{click:function(a){return t.toggleShelf(e.row)}}},[t._v("\n\t\t\t\t\t\t\t\t"+t._s(1===e.row.onShelfStatus?"下架":"上架")+"\n\t\t\t\t\t\t\t")]),1===e.row.onShelfStatus?a("el-button",{staticClass:"edit-btn",attrs:{type:"text",icon:"el-icon-edit"},on:{click:function(a){return t.editProduct(e.row)}}},[t._v("\n\t\t\t\t\t\t\t\t编辑\n\t\t\t\t\t\t\t")]):t._e()],1)]}}])})],1),a("pagination",{attrs:{total:t.productTotal,page:t.productQuery.currentPage,limit:t.productQuery.pageSize},on:{"update:page":function(e){return t.$set(t.productQuery,"currentPage",e)},"update:limit":function(e){return t.$set(t.productQuery,"pageSize",e)},pagination:t.initProductData}})],1)],1),t.productFormVisible?a("ProductForm",{ref:"ProductForm",on:{refresh:t.refreshProduct}}):t._e(),t.detailDialogVisible?a("ProductDetailDialog",{ref:"ProductDetailDialog",on:{refresh:t.refreshProduct}}):t._e(),t.usageMultiFormVisible?a("UsageMultiForm",{ref:"UsageMultiForm",on:{refresh:t.refreshProduct}}):t._e(),t.inventoryFormVisible?a("InventoryForm",{ref:"InventoryForm",on:{refresh:t.refreshProduct}}):t._e(),a("ExportUsageDialog",{ref:"ExportUsageDialog",attrs:{"store-options":t.storeOptions}}),a("StoreReceiveCostStatisticsDialog",{attrs:{visible:t.storeReceiveCostStatisticsVisible,"store-options":t.storeOptions},on:{close:t.handleStoreReceiveCostStatisticsClose}})],1)},r=[],n=(a("c5f6"),a("456d"),a("ac6a"),a("db72")),i=a("b775"),s=a("01e0"),l=a("e1b7"),c=a("8b14"),u=a("497f"),d=a("8a99"),p=a("5aaf"),m={components:{ProductForm:s["default"],ProductDetailDialog:l["default"],UsageMultiForm:c["default"],InventoryForm:u["default"],ExportUsageDialog:d["default"],StoreReceiveCostStatisticsDialog:p["default"]},data:function(){return{productList:[],productLoading:!1,productTotal:0,productQuery:{currentPage:1,pageSize:20,productName:void 0,productCategory:void 0,onShelfStatus:void 0},productFormVisible:!1,detailDialogVisible:!1,usageMultiFormVisible:!1,inventoryFormVisible:!1,storeOptions:[],storeReceiveCostStatisticsVisible:!1}},created:function(){this.initProductData(),this.initStoreOptions()},methods:{initProductData:function(){var t=this;this.productLoading=!0;var e=Object(n["a"])({},this.productQuery);Object.keys(e).forEach((function(t){void 0!==e[t]&&null!==e[t]&&""!==e[t]||delete e[t]})),Object(i["a"])({url:"/api/Extend/LqProduct/GetList",method:"GET",data:e}).then((function(e){200==e.code&&e.data?(t.productList=e.data.list||[],t.productTotal=e.data.pagination?e.data.pagination.total:0):(t.productList=[],t.productTotal=0),t.productLoading=!1})).catch((function(){t.productLoading=!1,t.productList=[],t.productTotal=0}))},searchProduct:function(){this.productQuery.currentPage=1,this.initProductData()},resetProduct:function(){this.productQuery={currentPage:1,pageSize:20,productName:void 0,productCategory:void 0,onShelfStatus:void 0},this.initProductData()},addProduct:function(){var t=this;this.productFormVisible=!0,this.$nextTick((function(){t.$refs.ProductForm.init()}))},editProduct:function(t){var e=this;this.productFormVisible=!0,this.$nextTick((function(){e.$refs.ProductForm.init(t.id)}))},viewDetail:function(t){var e=this;this.detailDialogVisible=!0,this.$nextTick((function(){e.$refs.ProductDetailDialog.init(t.id,t),e.$forceUpdate()}))},toggleShelf:function(t){var e=this,a=1===t.onShelfStatus?0:1,o=1===a?"上架":"下架";this.$confirm("确定要".concat(o,"该产品吗?"),"提示",{type:"warning"}).then((function(){Object(i["a"])({url:"/api/Extend/LqProduct/ToggleShelf",method:"PUT",data:{productId:t.id,onShelfStatus:a}}).then((function(t){e.$message({type:"success",message:t.msg||"".concat(o,"成功"),onClose:function(){e.initProductData()}})}))})).catch((function(){}))},refreshProduct:function(){this.productFormVisible=!1,this.usageMultiFormVisible=!1,this.inventoryFormVisible=!1,this.initProductData()},addInventory:function(){var t=this;this.inventoryFormVisible=!0,this.$nextTick((function(){t.$refs.InventoryForm.init()}))},addUsage:function(){var t=this;this.usageMultiFormVisible=!0,this.$nextTick((function(){t.$refs.UsageMultiForm.init()}))},viewApplicationList:function(){this.$router.push({path:"/lqInventory/application-list",query:{}})},viewStatistics:function(){this.$router.push({path:"/lqInventory/store-receive-statistics",query:{}})},viewPendingDelivery:function(){this.$router.push({path:"/lqInventory/warehouse-pending-delivery",query:{}})},exportUsageRecords:function(){var t=this;this.$nextTick((function(){t.$refs.ExportUsageDialog.init()}))},initStoreOptions:function(){var t=this;Object(i["a"])({url:"/api/Extend/LqMdxx",method:"GET",data:{currentPage:1,pageSize:1e3}}).then((function(e){e.data&&e.data.list?t.storeOptions=e.data.list:t.storeOptions=[]})).catch((function(){t.storeOptions=[]}))},viewStoreReceiveCostStatistics:function(){this.storeReceiveCostStatisticsVisible=!0},handleStoreReceiveCostStatisticsClose:function(){this.storeReceiveCostStatisticsVisible=!1},formatMoney:function(t){return t||0===t?Number(t).toFixed(2):"0.00"}}},f=m,g=(a("e788"),a("2877")),h=Object(g["a"])(f,o,r,!1,null,"26a682e0",null);e["default"]=h.exports},"8a99":function(t,e,a){"use strict";a.r(e);var o=function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("el-dialog",{staticClass:"NCC-dialog NCC-dialog_center",attrs:{title:"导出仓库使用记录","close-on-click-modal":!1,visible:t.visible,"lock-scroll":"",width:"700px"},on:{"update:visible":function(e){t.visible=e}}},[a("el-form",{attrs:{"label-position":"right","label-width":"120px"}},[a("el-form-item",{attrs:{label:"门店"}},[a("el-select",{staticStyle:{width:"100%"},attrs:{placeholder:"请选择门店(可选)",clearable:"",filterable:""},model:{value:t.exportQuery.storeId,callback:function(e){t.$set(t.exportQuery,"storeId",e)},expression:"exportQuery.storeId"}},t._l(t.storeOptions,(function(t){return a("el-option",{key:t.id,attrs:{label:t.dm,value:t.id}})})),1)],1),a("el-form-item",{attrs:{label:"产品"}},[a("el-select",{staticStyle:{width:"100%"},attrs:{placeholder:"请选择产品(可选)",clearable:"",filterable:""},model:{value:t.exportQuery.productId,callback:function(e){t.$set(t.exportQuery,"productId",e)},expression:"exportQuery.productId"}},t._l(t.productOptions,(function(t){return a("el-option",{key:t.id,attrs:{label:t.productName,value:t.id}})})),1)],1),a("el-form-item",{attrs:{label:"批次号"}},[a("el-input",{attrs:{placeholder:"请输入批次号(可选)",clearable:""},model:{value:t.exportQuery.usageBatchId,callback:function(e){t.$set(t.exportQuery,"usageBatchId",e)},expression:"exportQuery.usageBatchId"}})],1),a("el-form-item",{attrs:{label:"使用时间"}},[a("el-date-picker",{staticStyle:{width:"100%"},attrs:{type:"datetimerange","range-separator":"至","start-placeholder":"开始时间","end-placeholder":"结束时间","value-format":"yyyy-MM-dd HH:mm:ss",format:"yyyy-MM-dd HH:mm:ss"},model:{value:t.usageTimeRange,callback:function(e){t.usageTimeRange=e},expression:"usageTimeRange"}})],1),a("el-form-item",{attrs:{label:"审批状态"}},[a("el-select",{staticStyle:{width:"100%"},attrs:{placeholder:"请选择审批状态(可选)",clearable:""},model:{value:t.exportQuery.approvalStatus,callback:function(e){t.$set(t.exportQuery,"approvalStatus",e)},expression:"exportQuery.approvalStatus"}},[a("el-option",{attrs:{label:"全部",value:""}}),a("el-option",{attrs:{label:"待审批",value:"待审批"}}),a("el-option",{attrs:{label:"审批中",value:"审批中"}}),a("el-option",{attrs:{label:"已通过",value:"已通过"}}),a("el-option",{attrs:{label:"未通过",value:"未通过"}}),a("el-option",{attrs:{label:"已退回",value:"已退回"}})],1)],1),a("el-form-item",{attrs:{label:"是否已领取"}},[a("el-select",{staticStyle:{width:"100%"},attrs:{placeholder:"请选择(可选)",clearable:""},model:{value:t.exportQuery.isReceived,callback:function(e){t.$set(t.exportQuery,"isReceived",e)},expression:"exportQuery.isReceived"}},[a("el-option",{attrs:{label:"全部",value:null}}),a("el-option",{attrs:{label:"已领取",value:!0}}),a("el-option",{attrs:{label:"未领取",value:!1}})],1)],1),a("el-form-item",{attrs:{label:"是否有效"}},[a("el-select",{staticStyle:{width:"100%"},attrs:{placeholder:"请选择(可选)",clearable:""},model:{value:t.exportQuery.isEffective,callback:function(e){t.$set(t.exportQuery,"isEffective",e)},expression:"exportQuery.isEffective"}},[a("el-option",{attrs:{label:"全部",value:null}}),a("el-option",{attrs:{label:"有效",value:!0}}),a("el-option",{attrs:{label:"无效",value:!1}})],1)],1),a("el-form-item",{attrs:{label:"导出说明"}},[a("div",{staticClass:"export-info"},[a("p",[t._v("• 导出包含11个字段:批次号、产品名称、门店名称、使用数量、单价、总金额、使用时间、归属仓库、审批状态、是否已领取、是否有效")]),a("p",[t._v("• 所有字段都会显示中文名称,无需手动选择")]),a("p",[t._v("• 支持按门店、产品、批次号、使用时间、审批状态、是否已领取、是否有效进行筛选")])])])],1),a("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[a("el-button",{on:{click:function(e){t.visible=!1}}},[t._v("取 消")]),a("el-button",{attrs:{type:"primary",loading:t.btnLoading},on:{click:t.handleExport}},[t._v("导 出")])],1)],1)},r=[],n=(a("456d"),a("ac6a"),a("db72")),i=a("b775"),s={name:"ExportUsageDialog",props:{storeOptions:{type:Array,default:function(){return[]}}},data:function(){return{visible:!1,btnLoading:!1,exportQuery:{storeId:void 0,productId:void 0,usageBatchId:void 0,usageStartTime:void 0,usageEndTime:void 0,approvalStatus:void 0,isReceived:void 0,isEffective:void 0},usageTimeRange:null,productOptions:[]}},methods:{init:function(){this.visible=!0,this.exportQuery={storeId:void 0,productId:void 0,usageBatchId:void 0,usageStartTime:void 0,usageEndTime:void 0,approvalStatus:void 0,isReceived:void 0,isEffective:void 0},this.usageTimeRange=null,this.initProductOptions()},initProductOptions:function(){var t=this;Object(i["a"])({url:"/api/Extend/LqProduct/GetList",method:"GET",data:{currentPage:1,pageSize:1e3,onShelfStatus:1}}).then((function(e){200==e.code&&e.data&&e.data.list?t.productOptions=e.data.list.filter((function(t){return 1===t.onShelfStatus})):t.productOptions=[]})).catch((function(){t.productOptions=[]}))},handleExport:function(){var t=this;this.btnLoading=!0;var e=Object(n["a"])({},this.exportQuery);this.usageTimeRange&&2===this.usageTimeRange.length&&(e.usageStartTime=this.usageTimeRange[0],e.usageEndTime=this.usageTimeRange[1]),void 0!==e.isReceived&&null!==e.isReceived&&(e.isReceived=!0===e.isReceived||"true"===e.isReceived),void 0!==e.isEffective&&null!==e.isEffective&&(e.isEffective=!0===e.isEffective||"true"===e.isEffective),Object.keys(e).forEach((function(t){void 0!==e[t]&&null!==e[t]&&""!==e[t]||delete e[t]}));var a=Object.keys(e).map((function(t){var a=e[t];return"boolean"===typeof a?"".concat(t,"=").concat(a):"".concat(t,"=").concat(encodeURIComponent(a))})).join("&"),o="/api/Extend/LqInventoryUsage/ExportExcel".concat(a?"?"+a:"");Object(i["a"])({url:o,method:"GET"}).then((function(e){if(t.btnLoading=!1,200===e.code&&e.data)if(e.data.url){var a=window.location.origin,o=a+e.data.url;window.open(o,"_blank"),t.$message.success("导出成功"),t.visible=!1}else t.$message.error("导出失败:未返回下载链接");else t.$message.error(e.msg||"导出失败")})).catch((function(e){t.btnLoading=!1,console.error("导出失败:",e),t.$message.error("导出失败,请稍后重试")}))}}},l=s,c=(a("8c08"),a("2877")),u=Object(c["a"])(l,o,r,!1,null,"2f6f8dee",null);e["default"]=u.exports},"8b14":function(t,e,a){"use strict";a.r(e);var o=function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("el-dialog",{staticClass:"NCC-dialog NCC-dialog_center",attrs:{title:"添加使用记录","close-on-click-modal":!1,visible:t.visible,"lock-scroll":"",width:"900px"},on:{"update:visible":function(e){t.visible=e}}},[a("el-form",{ref:"elForm",attrs:{model:t.dataForm,size:"small","label-width":"120px","label-position":"right",rules:t.rules}},[a("el-row",{attrs:{gutter:15}},[a("el-col",{attrs:{span:12}},[a("el-form-item",{attrs:{label:"审批人",prop:"approverId"}},[a("el-select",{style:{width:"100%"},attrs:{placeholder:"请选择审批人(财务老师或库管)",clearable:"",filterable:""},on:{change:t.onApproverChange},model:{value:t.dataForm.approverId,callback:function(e){t.$set(t.dataForm,"approverId",e)},expression:"dataForm.approverId"}},t._l(t.approverOptions,(function(t){return a("el-option",{key:t.id,attrs:{label:t.label,value:t.id}})})),1)],1)],1),a("el-col",{attrs:{span:12}},[a("el-form-item",{attrs:{label:"申请门店",prop:"applicationStoreId"}},[a("el-select",{style:{width:"100%"},attrs:{placeholder:"请选择申请门店",clearable:"",filterable:""},model:{value:t.dataForm.applicationStoreId,callback:function(e){t.$set(t.dataForm,"applicationStoreId",e)},expression:"dataForm.applicationStoreId"}},t._l(t.storeOptions,(function(t){return a("el-option",{key:t.id,attrs:{label:t.dm,value:t.id}})})),1)],1)],1),a("el-col",{attrs:{span:24}},[a("el-form-item",{attrs:{label:"备注",prop:"remarks"}},[a("el-input",{style:{width:"100%"},attrs:{type:"textarea",rows:2,placeholder:"请输入备注(可选)",maxlength:"500","show-word-limit":""},model:{value:t.dataForm.remarks,callback:function(e){t.$set(t.dataForm,"remarks",e)},expression:"dataForm.remarks"}})],1)],1)],1),a("el-divider"),a("div",{staticClass:"usage-items-container"},t._l(t.dataForm.usageItems,(function(e,o){return a("div",{key:o,staticClass:"usage-item-row"},[a("el-row",{attrs:{gutter:15}},[a("el-col",{attrs:{span:12}},[a("el-form-item",{attrs:{label:"产品",prop:"usageItems."+o+".productId",rules:t.rules.productId}},[a("el-select",{style:{width:"100%"},attrs:{placeholder:"请选择产品",clearable:"",filterable:""},on:{change:function(a){return t.onProductChange(e,o)}},model:{value:e.productId,callback:function(a){t.$set(e,"productId",a)},expression:"item.productId"}},t._l(t.productOptions,(function(t){return a("el-option",{key:t.id,attrs:{label:t.productName,value:t.id}})})),1)],1)],1),a("el-col",{attrs:{span:12}},[a("el-form-item",{attrs:{label:"门店",prop:"usageItems."+o+".storeId",rules:t.rules.storeId}},[a("el-select",{style:{width:"100%"},attrs:{placeholder:"请选择门店",clearable:"",filterable:""},model:{value:e.storeId,callback:function(a){t.$set(e,"storeId",a)},expression:"item.storeId"}},t._l(t.storeOptions,(function(t){return a("el-option",{key:t.id,attrs:{label:t.dm,value:t.id}})})),1)],1)],1),a("el-col",{attrs:{span:12}},[a("el-form-item",{attrs:{label:"使用数量",prop:"usageItems."+o+".usageQuantity",rules:t.rules.usageQuantity}},[a("el-input-number",{style:{width:"100%"},attrs:{placeholder:"数量",min:1,precision:0},model:{value:e.usageQuantity,callback:function(a){t.$set(e,"usageQuantity",a)},expression:"item.usageQuantity"}})],1)],1),a("el-col",{attrs:{span:12}},[a("el-form-item",{attrs:{label:"使用时间",prop:"usageItems."+o+".usageTime",rules:t.rules.usageTime}},[a("el-date-picker",{style:{width:"100%"},attrs:{type:"datetime",placeholder:"使用时间","value-format":"yyyy-MM-dd HH:mm:ss",format:"yyyy-MM-dd HH:mm:ss"},model:{value:e.usageTime,callback:function(a){t.$set(e,"usageTime",a)},expression:"item.usageTime"}})],1)],1),t.dataForm.usageItems.length>1?a("el-col",{attrs:{span:24}},[a("div",{staticClass:"item-actions"},[a("el-button",{staticClass:"delete-btn",attrs:{type:"text",icon:"el-icon-delete"},on:{click:function(e){return t.removeItem(o)}}},[t._v("删除")])],1)]):t._e()],1),o<t.dataForm.usageItems.length-1?a("el-divider"):t._e()],1)})),0),a("div",{staticClass:"add-item-btn"},[a("el-button",{attrs:{type:"text",icon:"el-icon-plus"},on:{click:function(e){return t.addItem()}}},[t._v("添加一条记录")])],1)],1),a("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[a("el-button",{on:{click:function(e){t.visible=!1}}},[t._v("取 消")]),a("el-button",{attrs:{type:"primary",loading:t.btnLoading},on:{click:function(e){return t.dataFormSubmit()}}},[t._v("确 定")])],1)],1)},r=[],n=(a("6762"),a("2fdb"),a("7f7f"),a("768b")),i=(a("ac6a"),a("5df3"),a("b775")),s={data:function(){return{visible:!1,btnLoading:!1,dataForm:{approverId:"",applicationStoreId:"",remarks:"",usageItems:[{productId:"",storeId:"",usageTime:"",usageQuantity:1,relatedConsumeId:""}]},productOptions:[],storeOptions:[],approverOptions:[],rules:{approverId:[{required:!0,message:"请选择审批人",trigger:"change"}],applicationStoreId:[{required:!0,message:"请选择申请门店",trigger:"change"}],productId:[{required:!0,message:"请选择产品",trigger:"change"}],storeId:[{required:!0,message:"请选择门店",trigger:"change"}],usageQuantity:[{required:!0,message:"请输入使用数量",trigger:"blur"}],usageTime:[{required:!0,message:"请选择使用时间",trigger:"change"}]}}},methods:{init:function(){this.visible=!0,this.dataForm={approverId:"",applicationStoreId:"",remarks:"",usageItems:[{productId:"",storeId:"",usageTime:"",usageQuantity:1,relatedConsumeId:""}]},this.initProductOptions(),this.initStoreOptions(),this.initApproverOptions()},initProductOptions:function(){var t=this;Object(i["a"])({url:"/api/Extend/LqProduct/GetList",method:"GET",data:{currentPage:1,pageSize:1e3,onShelfStatus:1}}).then((function(e){200==e.code&&e.data&&e.data.list&&(t.productOptions=e.data.list.filter((function(t){return 1===t.onShelfStatus})))})).catch((function(){t.productOptions=[]}))},initStoreOptions:function(){var t=this;Object(i["a"])({url:"/api/Extend/LqMdxx",method:"GET",data:{currentPage:1,pageSize:1e3}}).then((function(e){e.data&&e.data.list&&(t.storeOptions=e.data.list)})).catch((function(){t.storeOptions=[]}))},initApproverOptions:function(){var t=this;Promise.all([Object(i["a"])({url:"/api/Extend/user",method:"GET",data:{page:1,pageSize:1e3,gw:"主管"}})]).then((function(e){var a=Object(n["a"])(e,2),o=a[0];a[1];t.approverOptions=[],200==o.code&&o.data&&o.data.list&&o.data.list.forEach((function(e){t.approverOptions.push({id:e.id,label:"".concat(e.realName||e.name||e.userName,"(主管)")})}))})).catch((function(){t.approverOptions=[]}))},onApproverChange:function(){},onProductChange:function(t,e){},addItem:function(){this.dataForm.usageItems.push({productId:"",storeId:"",usageTime:"",usageQuantity:1,relatedConsumeId:""})},removeItem:function(t){this.dataForm.usageItems.length>1?this.dataForm.usageItems.splice(t,1):this.$message({type:"warning",message:"至少保留一条记录"})},dataFormSubmit:function(){var t=this;if(!this.dataForm.approverId)return this.$message({type:"error",message:"请选择审批人"}),!1;if(!this.dataForm.applicationStoreId)return this.$message({type:"error",message:"请选择申请门店"}),!1;var e=!0;if(this.dataForm.usageItems.forEach((function(a,o){a.productId||(t.$message({type:"error",message:"第".concat(o+1,"条记录:请选择产品")}),e=!1),a.storeId||(t.$message({type:"error",message:"第".concat(o+1,"条记录:请选择门店")}),e=!1),(!a.usageQuantity||a.usageQuantity<=0)&&(t.$message({type:"error",message:"第".concat(o+1,"条记录:请输入使用数量")}),e=!1),a.usageTime||(t.$message({type:"error",message:"第".concat(o+1,"条记录:请选择使用时间")}),e=!1)})),!e)return!1;this.btnLoading=!0;var a=this.dataForm.usageItems.map((function(t){var e=t.usageTime;if(e&&!e.includes("T")){var a=new Date(e);e=a.toISOString()}return{productId:t.productId,storeId:t.storeId,usageTime:e,usageQuantity:t.usageQuantity,relatedConsumeId:t.relatedConsumeId||""}}));Object(i["a"])({url:"/api/Extend/LqInventoryUsage/BatchCreate",method:"POST",data:{approverId:this.dataForm.approverId,applicationStoreId:this.dataForm.applicationStoreId,remarks:this.dataForm.remarks||"",usageItems:a}}).then((function(e){t.btnLoading=!1,t.$message({type:"success",message:e.msg||"添加成功",onClose:function(){t.visible=!1,t.$emit("refresh")}})})).catch((function(){t.btnLoading=!1}))}}},l=s,c=(a("23c4"),a("2877")),u=Object(c["a"])(l,o,r,!1,null,"9bf686ae",null);e["default"]=u.exports},"8c08":function(t,e,a){"use strict";a("ff61")},"8d1c":function(t,e,a){"use strict";a("d1fe")},c74a:function(t,e,a){"use strict";a.r(e);var o=function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("el-dialog",{staticClass:"NCC-dialog NCC-dialog_center",attrs:{title:"添加使用记录","close-on-click-modal":!1,visible:t.visible,"lock-scroll":"",width:"900px"},on:{"update:visible":function(e){t.visible=e}}},[a("el-form",{ref:"elForm",attrs:{model:t.dataForm,size:"small","label-width":"120px","label-position":"right",rules:t.rules}},[a("el-row",{attrs:{gutter:15}},[a("el-col",{attrs:{span:12}},[a("el-form-item",{attrs:{label:"审批人",prop:"approverId"}},[a("el-select",{style:{width:"100%"},attrs:{placeholder:"请选择审批人(财务老师或库管)",clearable:"",filterable:""},on:{change:t.onApproverChange},model:{value:t.dataForm.approverId,callback:function(e){t.$set(t.dataForm,"approverId",e)},expression:"dataForm.approverId"}},t._l(t.approverOptions,(function(t){return a("el-option",{key:t.id,attrs:{label:t.label,value:t.id}})})),1)],1)],1),a("el-col",{attrs:{span:12}},[a("el-form-item",{attrs:{label:"申请门店",prop:"applicationStoreId"}},[a("el-select",{style:{width:"100%"},attrs:{placeholder:"请选择申请门店",clearable:"",filterable:""},model:{value:t.dataForm.applicationStoreId,callback:function(e){t.$set(t.dataForm,"applicationStoreId",e)},expression:"dataForm.applicationStoreId"}},t._l(t.storeOptions,(function(t){return a("el-option",{key:t.id,attrs:{label:t.dm,value:t.id}})})),1)],1)],1),a("el-col",{attrs:{span:24}},[a("el-form-item",{attrs:{label:"备注",prop:"remarks"}},[a("el-input",{style:{width:"100%"},attrs:{type:"textarea",rows:2,placeholder:"请输入备注(可选)",maxlength:"500","show-word-limit":""},model:{value:t.dataForm.remarks,callback:function(e){t.$set(t.dataForm,"remarks",e)},expression:"dataForm.remarks"}})],1)],1)],1),a("el-divider"),a("div",{staticClass:"usage-items-container"},t._l(t.dataForm.usageItems,(function(e,o){return a("div",{key:o,staticClass:"usage-item-row"},[a("el-row",{attrs:{gutter:15}},[a("el-col",{attrs:{span:12}},[a("el-form-item",{attrs:{label:"产品",prop:"usageItems."+o+".productId",rules:t.rules.productId}},[a("el-select",{style:{width:"100%"},attrs:{placeholder:"请选择产品",clearable:"",filterable:"",disabled:!!t.defaultProductId},model:{value:e.productId,callback:function(a){t.$set(e,"productId",a)},expression:"item.productId"}},t._l(t.productOptions,(function(t){return a("el-option",{key:t.id,attrs:{label:t.productName,value:t.id}})})),1)],1)],1),a("el-col",{attrs:{span:12}},[a("el-form-item",{attrs:{label:"门店",prop:"usageItems."+o+".storeId",rules:t.rules.storeId}},[a("el-select",{style:{width:"100%"},attrs:{placeholder:"请选择门店",clearable:"",filterable:""},model:{value:e.storeId,callback:function(a){t.$set(e,"storeId",a)},expression:"item.storeId"}},t._l(t.storeOptions,(function(t){return a("el-option",{key:t.id,attrs:{label:t.dm,value:t.id}})})),1)],1)],1),a("el-col",{attrs:{span:12}},[a("el-form-item",{attrs:{label:"使用数量",prop:"usageItems."+o+".usageQuantity",rules:t.rules.usageQuantity}},[a("el-input-number",{style:{width:"100%"},attrs:{placeholder:"数量",min:1,precision:0},model:{value:e.usageQuantity,callback:function(a){t.$set(e,"usageQuantity",a)},expression:"item.usageQuantity"}})],1)],1),a("el-col",{attrs:{span:12}},[a("el-form-item",{attrs:{label:"使用时间",prop:"usageItems."+o+".usageTime",rules:t.rules.usageTime}},[a("el-date-picker",{style:{width:"100%"},attrs:{type:"datetime",placeholder:"使用时间","value-format":"yyyy-MM-dd HH:mm:ss",format:"yyyy-MM-dd HH:mm:ss"},model:{value:e.usageTime,callback:function(a){t.$set(e,"usageTime",a)},expression:"item.usageTime"}})],1)],1),t.dataForm.usageItems.length>1?a("el-col",{attrs:{span:24}},[a("div",{staticClass:"item-actions"},[a("el-button",{staticClass:"delete-btn",attrs:{type:"text",icon:"el-icon-delete"},on:{click:function(e){return t.removeItem(o)}}},[t._v("删除")])],1)]):t._e()],1),o<t.dataForm.usageItems.length-1?a("el-divider"):t._e()],1)})),0),a("div",{staticClass:"add-item-btn"},[a("el-button",{attrs:{type:"text",icon:"el-icon-plus"},on:{click:function(e){return t.addItem()}}},[t._v("添加一条记录")])],1)],1),a("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[a("el-button",{on:{click:function(e){t.visible=!1}}},[t._v("取 消")]),a("el-button",{attrs:{type:"primary",loading:t.btnLoading},on:{click:function(e){return t.dataFormSubmit()}}},[t._v("确 定")])],1)],1)},r=[],n=(a("6762"),a("2fdb"),a("7f7f"),a("768b")),i=(a("ac6a"),a("5df3"),a("b775")),s={data:function(){return{visible:!1,btnLoading:!1,defaultProductId:"",dataForm:{approverId:"",applicationStoreId:"",remarks:"",usageItems:[{productId:"",storeId:"",usageTime:"",usageQuantity:1,relatedConsumeId:""}]},productOptions:[],storeOptions:[],approverOptions:[],rules:{approverId:[{required:!0,message:"请选择审批人",trigger:"change"}],applicationStoreId:[{required:!0,message:"请选择申请门店",trigger:"change"}],productId:[{required:!0,message:"请选择产品",trigger:"change"}],storeId:[{required:!0,message:"请选择门店",trigger:"change"}],usageQuantity:[{required:!0,message:"请输入使用数量",trigger:"blur"}],usageTime:[{required:!0,message:"请选择使用时间",trigger:"change"}]}}},methods:{init:function(t){this.visible=!0,this.defaultProductId=t||"",this.dataForm={approverId:"",applicationStoreId:"",remarks:"",usageItems:[{productId:t||"",storeId:"",usageTime:"",usageQuantity:1,relatedConsumeId:""}]},this.initProductOptions(),this.initStoreOptions(),this.initApproverOptions()},initProductOptions:function(){var t=this;Object(i["a"])({url:"/api/Extend/LqProduct/GetList",method:"GET",data:{currentPage:1,pageSize:1e3}}).then((function(e){200==e.code&&e.data&&e.data.list&&(t.productOptions=e.data.list)})).catch((function(){t.productOptions=[]}))},initStoreOptions:function(){var t=this;Object(i["a"])({url:"/api/Extend/LqMdxx",method:"GET",data:{currentPage:1,pageSize:1e3}}).then((function(e){e.data&&e.data.list&&(t.storeOptions=e.data.list)})).catch((function(){t.storeOptions=[]}))},initApproverOptions:function(){var t=this;Promise.all([Object(i["a"])({url:"/api/Extend/user",method:"GET",data:{page:1,pageSize:1e3,gw:"主管"}})]).then((function(e){var a=Object(n["a"])(e,2),o=a[0];a[1];t.approverOptions=[],200==o.code&&o.data&&o.data.list&&o.data.list.forEach((function(e){t.approverOptions.push({id:e.id,label:"".concat(e.realName||e.name||e.userName,"(主管)")})}))})).catch((function(){t.approverOptions=[]}))},onApproverChange:function(){},addItem:function(){this.dataForm.usageItems.push({productId:this.defaultProductId||"",storeId:"",usageTime:"",usageQuantity:1,relatedConsumeId:""})},removeItem:function(t){this.dataForm.usageItems.length>1?this.dataForm.usageItems.splice(t,1):this.$message({type:"warning",message:"至少保留一条记录"})},dataFormSubmit:function(){var t=this;if(!this.dataForm.approverId)return this.$message({type:"error",message:"请选择审批人"}),!1;if(!this.dataForm.applicationStoreId)return this.$message({type:"error",message:"请选择申请门店"}),!1;var e=!0;if(this.dataForm.usageItems.forEach((function(a,o){a.productId||(t.$message({type:"error",message:"第".concat(o+1,"条记录:请选择产品")}),e=!1),a.storeId||(t.$message({type:"error",message:"第".concat(o+1,"条记录:请选择门店")}),e=!1),(!a.usageQuantity||a.usageQuantity<=0)&&(t.$message({type:"error",message:"第".concat(o+1,"条记录:请输入使用数量")}),e=!1),a.usageTime||(t.$message({type:"error",message:"第".concat(o+1,"条记录:请选择使用时间")}),e=!1)})),!e)return!1;this.btnLoading=!0;var a=this.dataForm.usageItems.map((function(t){var e=t.usageTime;if(e&&!e.includes("T")){var a=new Date(e);e=a.toISOString()}return{productId:t.productId,storeId:t.storeId,usageTime:e,usageQuantity:t.usageQuantity,relatedConsumeId:t.relatedConsumeId||""}}));Object(i["a"])({url:"/api/Extend/LqInventoryUsage/BatchCreate",method:"POST",data:{approverId:this.dataForm.approverId,applicationStoreId:this.dataForm.applicationStoreId,remarks:this.dataForm.remarks||"",usageItems:a}}).then((function(e){t.btnLoading=!1,t.$message({type:"success",message:e.msg||"添加成功",onClose:function(){t.visible=!1,t.$emit("refresh")}})})).catch((function(){t.btnLoading=!1}))}}},l=s,c=(a("f110"),a("2877")),u=Object(c["a"])(l,o,r,!1,null,"0daa9192",null);e["default"]=u.exports},ccdd:function(t,e,a){"use strict";a("6018")},d1fe:function(t,e,a){},e1b7:function(t,e,a){"use strict";a.r(e);var o=function(){var t=this,e=t.$createElement,a=t._self._c||e;return a("div",[a("el-dialog",{staticClass:"NCC-dialog NCC-dialog_center",attrs:{title:"产品详情","close-on-click-modal":!1,visible:t.visible,"lock-scroll":"",width:"1200px"},on:{"update:visible":function(e){t.visible=e}}},[a("div",{staticClass:"detail-content"},[t.productInfo?a("el-card",{staticClass:"info-card",attrs:{shadow:"hover"}},[a("div",{staticClass:"card-header",attrs:{slot:"header"},slot:"header"},[a("i",{staticClass:"el-icon-goods"}),a("span",{staticClass:"card-title"},[t._v("产品信息")])]),a("el-row",{attrs:{gutter:20}},[a("el-col",{attrs:{span:8}},[a("div",{staticClass:"info-item"},[a("label",{staticClass:"info-label"},[t._v("产品名称:")]),a("span",{staticClass:"info-value"},[t._v(t._s(t.productInfo.productName||"无"))])])]),a("el-col",{attrs:{span:8}},[a("div",{staticClass:"info-item"},[a("label",{staticClass:"info-label"},[t._v("价格:")]),a("span",{staticClass:"info-value"},[t._v("¥"+t._s(t.formatMoney(t.productInfo.averagePrice)))])])]),a("el-col",{attrs:{span:8}},[a("div",{staticClass:"info-item"},[a("label",{staticClass:"info-label"},[t._v("库存:")]),a("span",{staticClass:"info-value"},[t._v(t._s(void 0!==t.productInfo.currentInventory?t.productInfo.currentInventory:"无"))])])])],1),a("el-row",{attrs:{gutter:20}},[a("el-col",{attrs:{span:8}},[a("div",{staticClass:"info-item"},[a("label",{staticClass:"info-label"},[t._v("产品类别:")]),a("span",{staticClass:"info-value"},[t._v(t._s(t.productInfo.productCategory||"无"))])])]),a("el-col",{attrs:{span:8}},[a("div",{staticClass:"info-item"},[a("label",{staticClass:"info-label"},[t._v("归属部门:")]),a("span",{staticClass:"info-value"},[t._v(t._s(t.productInfo.departmentName||"无"))])])]),a("el-col",{attrs:{span:8}},[a("div",{staticClass:"info-item"},[a("label",{staticClass:"info-label"},[t._v("标准单位:")]),a("span",{staticClass:"info-value"},[t._v(t._s(t.productInfo.standardUnit||"无"))])])])],1),a("el-row",{attrs:{gutter:20}},[a("el-col",{attrs:{span:8}},[a("div",{staticClass:"info-item"},[a("label",{staticClass:"info-label"},[t._v("上架状态:")]),a("el-tag",{attrs:{type:1===t.productInfo.onShelfStatus?"success":"info",size:"small"}},[t._v("\n                                    "+t._s(1===t.productInfo.onShelfStatus?"上架":"下架")+"\n                                ")])],1)]),a("el-col",{attrs:{span:8}},[a("div",{staticClass:"info-item"},[a("label",{staticClass:"info-label"},[t._v("统计分类:")]),a("span",{staticClass:"info-value"},[t._v(t._s(t.productInfo.statisticsCategory||"无"))])])]),a("el-col",{attrs:{span:8}},[a("div",{staticClass:"info-item"},[a("label",{staticClass:"info-label"},[t._v("归属仓库:")]),a("span",{staticClass:"info-value"},[t._v(t._s(t.productInfo.warehouse||"无"))])])])],1),a("el-row",{attrs:{gutter:20}},[a("el-col",{attrs:{span:8}},[a("div",{staticClass:"info-item"},[a("label",{staticClass:"info-label"},[t._v("供应商名称:")]),a("span",{staticClass:"info-value"},[t._v(t._s(t.productInfo.supplierName||"无"))])])]),a("el-col",{attrs:{span:8}},[a("div",{staticClass:"info-item"},[a("label",{staticClass:"info-label"},[t._v("合同签订日期:")]),a("span",{staticClass:"info-value"},[t._v(t._s(t.formatDate(t.productInfo.contractSignDate)||"无"))])])]),a("el-col",{attrs:{span:8}},[a("div",{staticClass:"info-item"},[a("label",{staticClass:"info-label"},[t._v("合同结束日期:")]),a("span",{staticClass:"info-value"},[t._v(t._s(t.formatDate(t.productInfo.contractEndDate)||"无"))])])])],1),a("el-row",{attrs:{gutter:20}},[a("el-col",{attrs:{span:24}},[a("div",{staticClass:"info-item"},[a("label",{staticClass:"info-label"},[t._v("备注:")]),a("span",{staticClass:"info-value"},[t._v(t._s(t.productInfo.remark||"无"))])])])],1)],1):t._e(),a("el-tabs",{staticClass:"detail-tabs",model:{value:t.activeTab,callback:function(e){t.activeTab=e},expression:"activeTab"}},[a("el-tab-pane",{attrs:{label:"库存管理",name:"inventory"}},[a("div",{staticClass:"tab-content"},[a("div",{staticClass:"tab-header"},[a("el-button",{attrs:{type:"primary",icon:"el-icon-plus",size:"small"},on:{click:function(e){return t.addInventory()}}},[t._v("添加库存")])],1),a("NCC-table",{directives:[{name:"loading",rawName:"v-loading",value:t.inventoryLoading,expression:"inventoryLoading"}],attrs:{data:t.inventoryList,"has-c":"","header-cell-style":{background:"#f5f7fa",color:"#606266"}}},[a("el-table-column",{attrs:{label:"库存ID",align:"center","show-overflow-tooltip":""},scopedSlots:t._u([{key:"default",fn:function(e){return[a("div",{staticClass:"inventory-id-info"},[a("span",{staticClass:"text-nowrap"},[t._v(t._s(e.row.id||"无"))])])]}}])}),a("el-table-column",{attrs:{label:"数量",align:"center"},scopedSlots:t._u([{key:"default",fn:function(e){return[a("div",{staticClass:"quantity-info"},[a("span",{staticClass:"text-nowrap"},[t._v(t._s(e.row.quantity||0))])])]}}])}),a("el-table-column",{attrs:{label:"入库时间",align:"center","show-overflow-tooltip":""},scopedSlots:t._u([{key:"default",fn:function(e){return[a("div",{staticClass:"stock-time-info"},[a("span",{staticClass:"text-nowrap"},[t._v(t._s(t.formatDate(e.row.stockInTime)||"无"))])])]}}])}),a("el-table-column",{attrs:{label:"生产日期",align:"center","show-overflow-tooltip":""},scopedSlots:t._u([{key:"default",fn:function(e){return[a("div",{staticClass:"production-date-info"},[a("span",{staticClass:"text-nowrap"},[t._v(t._s(t.formatDate(e.row.productionDate)||"无"))])])]}}])}),a("el-table-column",{attrs:{label:"保质期(天)",align:"center"},scopedSlots:t._u([{key:"default",fn:function(e){return[a("div",{staticClass:"shelf-life-info"},[a("span",{staticClass:"text-nowrap"},[t._v(t._s(e.row.shelfLife||"无"))])])]}}])}),a("el-table-column",{attrs:{label:"批次号",align:"center","show-overflow-tooltip":""},scopedSlots:t._u([{key:"default",fn:function(e){return[a("div",{staticClass:"batch-number-info"},[a("span",{staticClass:"text-nowrap"},[t._v(t._s(e.row.batchNumber||"无"))])])]}}])}),a("el-table-column",{attrs:{label:"入库类型",align:"center"},scopedSlots:t._u([{key:"default",fn:function(e){return[a("el-tag",{attrs:{type:2===e.row.stockInType?"warning":"info",size:"small"}},[t._v("\n\t\t\t\t\t\t\t\t\t\t\t"+t._s(2===e.row.stockInType?"采购入库":"普通入库")+"\n\t\t\t\t\t\t\t\t\t\t")])]}}])}),t.hasPurchaseInventory?a("el-table-column",{attrs:{label:"采购单价",align:"center"},scopedSlots:t._u([{key:"default",fn:function(e){return[a("div",{staticClass:"purchase-unit-price-info"},[a("span",{staticClass:"text-nowrap"},[t._v(t._s(e.row.purchaseUnitPrice?"¥"+t.formatMoney(e.row.purchaseUnitPrice):"无"))])])]}}],null,!1,1488494389)}):t._e(),t.hasPurchaseInventory?a("el-table-column",{attrs:{label:"采购总金额",align:"center"},scopedSlots:t._u([{key:"default",fn:function(e){return[a("div",{staticClass:"purchase-amount-info"},[a("span",{staticClass:"text-nowrap"},[t._v(t._s(e.row.purchaseAmount?"¥"+t.formatMoney(e.row.purchaseAmount):"无"))])])]}}],null,!1,2915480863)}):t._e(),a("el-table-column",{attrs:{label:"最终金额",align:"center"},scopedSlots:t._u([{key:"default",fn:function(e){return[a("div",{staticClass:"final-amount-info"},[a("span",{staticClass:"text-nowrap amount-paid"},[t._v(t._s(e.row.finalAmount?"¥"+t.formatMoney(e.row.finalAmount):"无"))])])]}}])}),a("el-table-column",{attrs:{label:"是否有效",align:"center"},scopedSlots:t._u([{key:"default",fn:function(e){return[a("el-tag",{attrs:{type:1===e.row.isEffective?"success":"info",size:"small"}},[t._v("\n\t\t\t\t\t\t\t\t\t\t\t"+t._s(1===e.row.isEffective?"有效":"无效")+"\n\t\t\t\t\t\t\t\t\t\t")])]}}])}),a("el-table-column",{attrs:{label:"操作",align:"left",width:"180"},scopedSlots:t._u([{key:"default",fn:function(e){return[1===e.row.isEffective?a("el-button",{staticClass:"edit-btn",attrs:{type:"text",icon:"el-icon-edit"},on:{click:function(a){return t.editInventory(e.row)}}},[t._v("编辑")]):t._e(),1===e.row.isEffective?a("el-button",{staticClass:"cancel-btn",attrs:{type:"text",icon:"el-icon-delete"},on:{click:function(a){return t.deleteInventory(e.row)}}},[t._v("作废")]):t._e()]}}])})],1),a("pagination",{attrs:{total:t.inventoryTotal,page:t.inventoryQuery.currentPage,limit:t.inventoryQuery.pageSize},on:{"update:page":function(e){return t.$set(t.inventoryQuery,"currentPage",e)},"update:limit":function(e){return t.$set(t.inventoryQuery,"pageSize",e)},pagination:t.initInventoryData}})],1)]),a("el-tab-pane",{attrs:{label:"使用记录",name:"usage"}},[a("div",{staticClass:"tab-content"},[a("div",{staticClass:"tab-header"},[a("el-button",{attrs:{type:"primary",icon:"el-icon-plus",size:"small"},on:{click:function(e){return t.addUsage()}}},[t._v("批量添加使用记录")])],1),a("NCC-table",{directives:[{name:"loading",rawName:"v-loading",value:t.usageLoading,expression:"usageLoading"}],attrs:{data:t.usageList,"has-c":"","header-cell-style":{background:"#f5f7fa",color:"#606266"}}},[a("el-table-column",{attrs:{label:"批次号",align:"center","show-overflow-tooltip":""},scopedSlots:t._u([{key:"default",fn:function(e){return[a("div",{staticClass:"usage-id-info"},[a("span",{staticClass:"text-nowrap"},[t._v(t._s(e.row.usageBatchId||"无"))])])]}}])}),a("el-table-column",{attrs:{label:"产品名称",align:"center"},scopedSlots:t._u([{key:"default",fn:function(e){return[a("div",{staticClass:"product-name-info"},[a("span",{staticClass:"text-nowrap"},[t._v(t._s(e.row.productName||"无"))])])]}}])}),a("el-table-column",{attrs:{label:"门店名称",align:"center"},scopedSlots:t._u([{key:"default",fn:function(e){return[a("div",{staticClass:"store-name-info"},[a("span",{staticClass:"text-nowrap"},[t._v(t._s(e.row.storeName||"无"))])])]}}])}),a("el-table-column",{attrs:{label:"使用数量",align:"center"},scopedSlots:t._u([{key:"default",fn:function(e){return[a("div",{staticClass:"usage-quantity-info"},[a("span",{staticClass:"text-nowrap"},[t._v(t._s(e.row.usageQuantity||0))])])]}}])}),a("el-table-column",{attrs:{label:"单价",align:"center"},scopedSlots:t._u([{key:"default",fn:function(e){return[a("div",{staticClass:"unit-price-info"},[a("span",{staticClass:"text-nowrap"},[t._v(t._s(e.row.unitPrice?"¥"+t.formatMoney(e.row.unitPrice):"无"))])])]}}])}),a("el-table-column",{attrs:{label:"总金额",align:"center"},scopedSlots:t._u([{key:"default",fn:function(e){return[a("div",{staticClass:"total-amount-info"},[a("span",{staticClass:"text-nowrap"},[t._v(t._s(e.row.totalAmount?"¥"+t.formatMoney(e.row.totalAmount):"无"))])])]}}])}),a("el-table-column",{attrs:{label:"使用时间",align:"center","show-overflow-tooltip":""},scopedSlots:t._u([{key:"default",fn:function(e){return[a("div",{staticClass:"usage-time-info"},[a("span",{staticClass:"text-nowrap"},[t._v(t._s(t.formatDateTime(e.row.usageTime)||"无"))])])]}}])}),a("el-table-column",{attrs:{label:"审批状态",align:"center"},scopedSlots:t._u([{key:"default",fn:function(e){return[e.row.approvalStatus?a("el-tag",{attrs:{type:t.getApprovalStatusType(e.row.approvalStatus),size:"small"}},[t._v("\n\t\t\t\t\t\t\t\t\t\t\t"+t._s(e.row.approvalStatus||"无")+"\n\t\t\t\t\t\t\t\t\t\t")]):a("span",{staticClass:"text-nowrap"},[t._v("无")])]}}])}),a("el-table-column",{attrs:{label:"是否已领取",align:"center"},scopedSlots:t._u([{key:"default",fn:function(e){return[void 0!==e.row.isReceived&&null!==e.row.isReceived?a("el-tag",{attrs:{type:1===e.row.isReceived?"success":"info",size:"small"}},[t._v("\n\t\t\t\t\t\t\t\t\t\t\t"+t._s(1===e.row.isReceived?"已领取":"未领取")+"\n\t\t\t\t\t\t\t\t\t\t")]):a("span",{staticClass:"text-nowrap"},[t._v("无")])]}}])}),a("el-table-column",{attrs:{label:"是否有效",align:"center"},scopedSlots:t._u([{key:"default",fn:function(e){return[a("el-tag",{attrs:{type:1===e.row.isEffective?"success":"info",size:"small"}},[t._v("\n\t\t\t\t\t\t\t\t\t\t\t"+t._s(1===e.row.isEffective?"有效":"无效")+"\n\t\t\t\t\t\t\t\t\t\t")])]}}])}),a("el-table-column",{attrs:{label:"操作",align:"left",width:"140"},scopedSlots:t._u([{key:"default",fn:function(e){return[1===e.row.isEffective?a("el-button",{staticClass:"edit-btn",attrs:{type:"text",icon:"el-icon-printer"},on:{click:function(a){return t.handlePrint(e.row)}}},[t._v("打印")]):t._e(),1===e.row.isEffective?a("el-button",{staticClass:"cancel-btn",attrs:{type:"text",icon:"el-icon-delete"},on:{click:function(a){return t.deleteUsage(e.row)}}},[t._v("作废")]):t._e()]}}])})],1),a("pagination",{attrs:{total:t.usageTotal,page:t.usageQuery.currentPage,limit:t.usageQuery.pageSize},on:{"update:page":function(e){return t.$set(t.usageQuery,"currentPage",e)},"update:limit":function(e){return t.$set(t.usageQuery,"pageSize",e)},pagination:t.initUsageData}})],1)])],1)],1)]),t.inventoryFormVisible?a("InventoryForm",{ref:"InventoryForm",on:{refresh:t.refreshInventory}}):t._e(),t.editInventoryFormVisible?a("EditInventoryDialog",{ref:"EditInventoryDialog",on:{refresh:t.refreshInventory}}):t._e(),t.usageFormVisible?a("UsageForm",{ref:"UsageForm",on:{refresh:t.refreshUsage}}):t._e()],1)},r=[],n=(a("c5f6"),a("f576"),a("456d"),a("ac6a"),a("db72")),i=a("b775"),s=a("497f"),l=a("1ebd"),c=a("c74a"),u={components:{InventoryForm:s["default"],EditInventoryDialog:l["default"],UsageForm:c["default"]},data:function(){return{visible:!1,activeTab:"inventory",productId:"",productInfo:null,inventoryList:[],inventoryLoading:!1,inventoryTotal:0,inventoryQuery:{currentPage:1,pageSize:20,ProductId:""},inventoryFormVisible:!1,editInventoryFormVisible:!1,usageList:[],usageLoading:!1,usageTotal:0,usageQuery:{currentPage:1,pageSize:20,ProductId:"",StoreId:void 0},usageFormVisible:!1,storeOptions:[]}},computed:{hasPurchaseInventory:function(){return this.inventoryList&&this.inventoryList.some((function(t){return 2===t.stockInType}))}},methods:{init:function(t,e){this.visible=!0,this.productId=t,this.productInfo=e,this.activeTab="inventory",this.inventoryQuery.ProductId=t,this.usageQuery.ProductId=t,this.initInventoryData(),this.initStoreOptions()},initStoreOptions:function(){var t=this;Object(i["a"])({url:"/api/Extend/LqMdxx",method:"GET",data:{currentPage:1,pageSize:1e3}}).then((function(e){e.data&&e.data.list&&(t.storeOptions=e.data.list)})).catch((function(){t.storeOptions=[]}))},initInventoryData:function(){var t=this;this.inventoryLoading=!0;var e=Object(n["a"])({},this.inventoryQuery);Object.keys(e).forEach((function(t){void 0!==e[t]&&null!==e[t]&&""!==e[t]||delete e[t]})),Object(i["a"])({url:"/api/Extend/LqInventory/GetList",method:"GET",data:e}).then((function(e){200==e.code&&e.data?(t.inventoryList=e.data.list||[],t.inventoryTotal=e.data.pagination?e.data.pagination.total:0):(t.inventoryList=[],t.inventoryTotal=0),t.inventoryLoading=!1})).catch((function(){t.inventoryLoading=!1,t.inventoryList=[],t.inventoryTotal=0}))},addInventory:function(){var t=this;this.inventoryFormVisible=!0,this.$nextTick((function(){t.$refs.InventoryForm.init(t.productId)}))},refreshInventory:function(){this.inventoryFormVisible=!1,this.editInventoryFormVisible=!1,this.initInventoryData()},editInventory:function(t){var e=this;this.editInventoryFormVisible=!0,this.$nextTick((function(){var a=Object(n["a"])(Object(n["a"])({},t),{},{productName:e.productInfo&&e.productInfo.productName||"",productAveragePrice:e.productInfo&&e.productInfo.averagePrice||null,productPrice:e.productInfo&&e.productInfo.price||null});e.$refs.EditInventoryDialog.init(a)}))},deleteInventory:function(t){var e=this;this.$confirm("确定要作废这条库存记录吗?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){var a=encodeURIComponent("作废");Object(i["a"])({url:"/api/Extend/LqInventory/Cancel/".concat(t.id,"?remarks=").concat(a),method:"PUT"}).then((function(t){e.$message({type:"success",message:t.msg||"作废成功",onClose:function(){e.initInventoryData()}})})).catch((function(){}))})).catch((function(){}))},initUsageData:function(){var t=this;this.usageLoading=!0;var e=Object(n["a"])({},this.usageQuery);Object.keys(e).forEach((function(t){void 0!==e[t]&&null!==e[t]&&""!==e[t]||delete e[t]})),console.error(e),Object(i["a"])({url:"/api/Extend/LqInventoryUsage/GetList",method:"GET",data:e}).then((function(e){200==e.code&&e.data?(t.usageList=e.data.list||[],t.usageTotal=e.data.pagination?e.data.pagination.total:0):(t.usageList=[],t.usageTotal=0),t.usageLoading=!1})).catch((function(){t.usageLoading=!1,t.usageList=[],t.usageTotal=0}))},addUsage:function(){var t=this;this.usageFormVisible=!0,this.$nextTick((function(){t.$refs.UsageForm.init(t.productId)}))},refreshUsage:function(){this.usageFormVisible=!1,this.initUsageData()},deleteUsage:function(t){var e=this;this.$confirm("确定要作废这条使用记录吗?","提示",{confirmButtonText:"确定",cancelButtonText:"取消",type:"warning"}).then((function(){Object(i["a"])({url:"/api/Extend/LqInventoryUsage/Cancel?id=".concat(t.id),method:"PUT"}).then((function(t){e.$message({type:"success",message:t.msg||"作废成功",onClose:function(){e.initUsageData()}})})).catch((function(){}))})).catch((function(){}))},handlePrint:function(t){var e=this;t.usageBatchId?Object(i["a"])({url:"/api/Extend/LqInventoryUsage/GetBatchInfo?batchId=".concat(t.usageBatchId),method:"GET"}).then((function(t){if(200===t.code&&t.data){var a=e.buildPrintContent(t.data),o=window.open("_blank");if(!o)return void e.$message.error("无法打开打印窗口,请检查浏览器弹窗设置");o.document.write(a),o.document.close(),setTimeout((function(){o.print()}),300)}else e.$message.error(t.msg||"获取批次信息失败")})).catch((function(t){e.$message.error("获取批次信息失败,请稍后重试")})):this.$message.warning("无法打印,批次ID不存在")},buildPrintContent:function(t){var e=function(t){if(!t)return"无";try{var e=new Date(t);if(isNaN(e.getTime()))return"无";var a=e.getFullYear(),o=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0"),n=String(e.getHours()).padStart(2,"0"),i=String(e.getMinutes()).padStart(2,"0"),s=String(e.getSeconds()).padStart(2,"0");return"".concat(a,"-").concat(o,"-").concat(r," ").concat(n,":").concat(i,":").concat(s)}catch(l){return"无"}},a=t.UsageRecords?t.UsageRecords.filter((function(t){return 1===t.isEffective})):[],o=a.length>0&&a[0].storeName||"无",r="";return a.length>0?a.forEach((function(t,e){r+='\n\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t<td style="text-align: center;">'.concat(e+1,"</td>\n\t\t\t\t\t\t\t<td>").concat(t.productName||"无",'</td>\n\t\t\t\t\t\t\t<td style="text-align: center;">').concat(t.usageQuantity||0,"</td>\n\t\t\t\t\t\t</tr>\n\t\t\t\t\t")})):r='<tr><td colspan="3" style="text-align: center;">暂无有效使用记录</td></tr>','\n\t\t\t\t<!DOCTYPE html>\n\t\t\t\t<html>\n\t\t\t\t<head>\n\t\t\t\t\t<meta charset="UTF-8">\n\t\t\t\t\t<title>产品使用批次详情</title>\n\t\t\t\t\t<style>\n\t\t\t\t\t\t* {\n\t\t\t\t\t\t\tmargin: 0;\n\t\t\t\t\t\t\tpadding: 0;\n\t\t\t\t\t\t\tbox-sizing: border-box;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tbody {\n\t\t\t\t\t\t\tfont-family: "Microsoft YaHei", Arial, sans-serif;\n\t\t\t\t\t\t\tfont-size: 13px;\n\t\t\t\t\t\t\tpadding: 15px;\n\t\t\t\t\t\t\tcolor: #333;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t.print-header {\n\t\t\t\t\t\t\ttext-align: center;\n\t\t\t\t\t\t\tmargin-bottom: 15px;\n\t\t\t\t\t\t\tborder-bottom: 2px solid #333;\n\t\t\t\t\t\t\tpadding-bottom: 10px;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t.print-header h1 {\n\t\t\t\t\t\t\tfont-size: 22px;\n\t\t\t\t\t\t\tfont-weight: bold;\n\t\t\t\t\t\t\tmargin-bottom: 5px;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t.print-info {\n\t\t\t\t\t\t\tmargin-bottom: 12px;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t.print-info table {\n\t\t\t\t\t\t\twidth: 100%;\n\t\t\t\t\t\t\tborder-collapse: collapse;\n\t\t\t\t\t\t\tmargin-bottom: 12px;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t.print-info table td {\n\t\t\t\t\t\t\tpadding: 6px 10px;\n\t\t\t\t\t\t\tborder: 1px solid #ddd;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t.print-info table td:first-child {\n\t\t\t\t\t\t\tbackground-color: #f5f5f5;\n\t\t\t\t\t\t\tfont-weight: bold;\n\t\t\t\t\t\t\twidth: 200px;\n\t\t\t\t\t\t\ttext-align: right;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t.print-table {\n\t\t\t\t\t\t\twidth: 100%;\n\t\t\t\t\t\t\tborder-collapse: collapse;\n\t\t\t\t\t\t\tmargin-bottom: 12px;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t.print-table thead {\n\t\t\t\t\t\t\tdisplay: table-header-group;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t.print-table tbody {\n\t\t\t\t\t\t\tdisplay: table-row-group;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t.print-table th,\n\t\t\t\t\t\t.print-table td {\n\t\t\t\t\t\t\tborder: 1px solid #ddd;\n\t\t\t\t\t\t\tpadding: 5px 6px;\n\t\t\t\t\t\t\ttext-align: left;\n\t\t\t\t\t\t\tfont-size: 12px;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t.print-table th {\n\t\t\t\t\t\t\tbackground-color: #f5f5f5;\n\t\t\t\t\t\t\tfont-weight: bold;\n\t\t\t\t\t\t\ttext-align: center;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t.print-table tbody tr {\n\t\t\t\t\t\t\tpage-break-inside: avoid;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t.print-footer {\n\t\t\t\t\t\t\tmargin-top: 15px;\n\t\t\t\t\t\t\tpadding-top: 10px;\n\t\t\t\t\t\t\tborder-top: 1px solid #ddd;\n\t\t\t\t\t\t\ttext-align: right;\n\t\t\t\t\t\t\tfont-size: 11px;\n\t\t\t\t\t\t\tcolor: #666;\n\t\t\t\t\t\t}\n\t\t\t\t\t\t@media print {\n\t\t\t\t\t\t\tbody {\n\t\t\t\t\t\t\t\tpadding: 8px;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t.print-header {\n\t\t\t\t\t\t\t\tpage-break-after: avoid;\n\t\t\t\t\t\t\t\tmargin-bottom: 12px;\n\t\t\t\t\t\t\t\tpadding-bottom: 8px;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t.print-info {\n\t\t\t\t\t\t\t\tpage-break-after: avoid;\n\t\t\t\t\t\t\t\tmargin-bottom: 10px;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t.print-table {\n\t\t\t\t\t\t\t\tpage-break-inside: auto;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t.print-table thead {\n\t\t\t\t\t\t\t\tdisplay: table-header-group;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t.print-table tbody tr {\n\t\t\t\t\t\t\t\tpage-break-inside: avoid;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t</style>\n\t\t\t\t</head>\n\t\t\t\t<body>\n\t\t\t\t\t<div class="print-header">\n\t\t\t\t\t\t<h1>产品使用批次详情</h1>\n\t\t\t\t\t</div>\n\t\t\t\t\t\n\t\t\t\t\t<div class="print-info">\n\t\t\t\t\t\t<table>\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<td>门店名称:</td>\n\t\t\t\t\t\t\t\t<td>'.concat(o,'</td>\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t</table>\n\t\t\t\t\t</div>\n\t\t\t\t\t\n\t\t\t\t\t<div class="print-info">\n\t\t\t\t\t\t<h3 style="margin-bottom: 8px; font-size: 14px;">使用记录明细</h3>\n\t\t\t\t\t\t<table class="print-table">\n\t\t\t\t\t\t\t<thead>\n\t\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t\t<th style="width: 50px;">序号</th>\n\t\t\t\t\t\t\t\t\t<th>产品名称</th>\n\t\t\t\t\t\t\t\t\t<th style="width: 100px;">数量</th>\n\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t</thead>\n\t\t\t\t\t\t\t<tbody>\n\t\t\t\t\t\t\t\t').concat(r,'\n\t\t\t\t\t\t\t</tbody>\n\t\t\t\t\t\t</table>\n\t\t\t\t\t</div>\n\t\t\t\t\t\n\t\t\t\t\t<div class="print-footer">\n\t\t\t\t\t\t<p>打印时间:').concat(e((new Date).getTime()),"</p>\n\t\t\t\t\t</div>\n\t\t\t\t</body>\n\t\t\t\t</html>\n\t\t\t")},formatMoney:function(t){return t||0===t?Number(t).toFixed(2):"0.00"},formatDate:function(t){if(!t)return"无";try{var e=new Date(t);if(isNaN(e.getTime()))return"无";var a=e.getFullYear(),o=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0");return"".concat(a,"-").concat(o,"-").concat(r)}catch(n){return t}},formatDateTime:function(t){if(!t)return"无";try{var e=new Date(t);if(isNaN(e.getTime()))return"无";var a=e.getFullYear(),o=String(e.getMonth()+1).padStart(2,"0"),r=String(e.getDate()).padStart(2,"0"),n=String(e.getHours()).padStart(2,"0"),i=String(e.getMinutes()).padStart(2,"0"),s=String(e.getSeconds()).padStart(2,"0");return"".concat(a,"-").concat(o,"-").concat(r," ").concat(n,":").concat(i,":").concat(s)}catch(l){return t}},getApprovalStatusType:function(t){if(!t)return"info";var e={"待审批":"warning","审批中":"primary","已通过":"success","未通过":"danger","已退回":"info"};return e[t]||"info"}},watch:{activeTab:function(t){console.error(t,"1111111111"),"usage"===t?(console.error("initUsageData"),this.initUsageData()):"inventory"===t&&(console.error("initInventoryData"),this.initInventoryData())}}},d=u,p=(a("08c2"),a("2877")),m=Object(p["a"])(d,o,r,!1,null,"f909c1c4",null);e["default"]=m.exports},e788:function(t,e,a){"use strict";a("e942")},e942:function(t,e,a){},f110:function(t,e,a){"use strict";a("5880")},ff61:function(t,e,a){}}]);