2.4c4d54cfa3dc113c2c5f.js 19 KB

1
  1. webpackJsonp([2],{"32al":function(e,t,o){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n=o("Xxa5"),a=o.n(n),s=o("exGp"),r=o.n(s),i=o("Dd8w"),d=o.n(i),c=o("NYxO"),u=(o("jQQ7"),o("dO7o")),l=o("hky6"),p=o("dClm"),_=o("CIZm"),h=o("Pfph"),m={name:"goodsExchangeAdd",data:function(){return{typeList:[],adminList:[],dialogVisible:!1,warehouseList:[],deptList:[],deptListAll:[],orderList:[],id:"",type:"",goodsExchangeAddForm:{order_list:[{order_id:"1752156400898293761",order_item_list:[{batch_list:[{batch_id:0,batch_sn:"",out_num:0,remain_num:0,warehouse_entry_sn:""}],num:0,order_item_id:0,product_id:0,product_name:"string",product_sn:"string",product_specification:"string",product_unit:"string"}],order_sn:""}],product_list:[],type:""},goodsExchangeAddFormRule:{warehouse_id:[{required:!0,message:"请选择出库仓库",trigger:"change"}],type:[{required:!0,message:"请选择出库类型",trigger:"change"}]},warehouseProduct:null,scanDialogVisible:!1,scanGoodsForm:{},routeName:"",sttorageType:"",goodsVisible:!1,goodsData:[],goodsList:[],product_list:[],snCodeVisible:!1,sn_code:"",sku:"",sn_code_list:[],index:""}},mounted:function(){this.routeName=this.$route.name,this.sttorageType=this.$route.params.type,this.GET_WarehouseList(),this.GET_DeptList(),this.outType()},watch:{$route:{immediate:!0,handler:function(e){"goodsExchangeEdit"===this.$route.name?this.type="edit":"goodsExchangeAudit"===this.$route.name?this.type="audit":"goodsExchangeReturn"===this.$route.name?this.type="return":"goodsExchangeAdd"===this.$route.name?(this.type="add",this.GET_WarehouseList({dept_id:this.user.dept_id}),this.$set(this.goodsExchangeAddForm,"change_time",(new Date).getTime())):"goodsExchangeDetail"===this.$route.name&&(this.type="detail"),this.$route.params.id&&(this.id=this.$route.params.id,this.GET_goodsExchangeAddDetail()),this.GET_AdministratorList()}}},computed:d()({},Object(c.b)(["user"])),methods:{toBack:function(){this.$router.push({name:"goodsExchange",params:{type:"first"}})},toSnCode:function(){var e=this;if(""==this.sku)return this.$message.error("请录入正确的sku");u.l("out",this.sku,this.sn_code.replace(/\s+/g,"")).then(function(t){e.sn_code="",e.goodsExchangeAddForm.product_list[e.index].sn_code_list.find(function(e){return e.sn_code===t.sn_code&&e.sku===t.sku})||e.goodsExchangeAddForm.product_list[e.index].sn_code_list.push(t),e.goodsExchangeAddForm.product_list[e.index].out_num=e.goodsExchangeAddForm.product_list[e.index].sn_code_list.length,e.scanGoodsForm.bar_code="",e.$nextTick(function(){e.$refs.input.focus()})})},addSnCode:function(e,t){this.sku=e.product_vo.sku,this.index=t,this.snCodeVisible=!0},outType:function(){var e=this;l.u({dictType:"out_warehouse_type"}).then(function(t){e.typeList=t.data})},printIng:function(){},toSearch:function(){var e=this;u.k(this.goodsExchangeAddForm.warehouse_id,this.scanGoodsForm.bar_code.replace(/\s+/g,"")).then(function(t){t.sn_code_list=[],e.sku=t.product_vo.sku;var o=e.goodsExchangeAddForm.product_list.findIndex(function(e){return console.log("Comparing with:",e),e.goods_id===t.goods_id&&e.product_id===t.product_id&&e.product_vo.sku===t.product_vo.sku});-1===o?(e.index=e.goodsExchangeAddForm.product_list.length,e.goodsExchangeAddForm.product_list.push(t)):e.index=o,t.product_vo.have_sn?e.$nextTick(function(){e.$refs.sn_input.focus()}):e.goodsExchangeAddForm.product_list[e.index].num=1})},scanCode:function(){var e=this;this.goodsExchangeAddForm.warehouse_id?(this.scanDialogVisible=!0,this.$nextTick(function(){e.$refs.input.focus()})):this.$message.error("请先选择仓库!")},GET_AdministratorList:function(){var e=this;h.i({page_no:1,page_size:9999,user_state:0}).then(function(t){e.adminList=t.data})},GET_WarehouseList:function(e){var t=this;p.G().then(function(e){t.warehouseList=e})},saveGoodsExchangeAddForm:function(){var e=this;this.$refs.goodsExchangeAddForm.validate(function(t){if(t){var o=e.goodsExchangeAddForm.id,n=e.MixinClone(e.goodsExchangeAddForm);if(n.save_or_submit="save",n.warehouse_consignee_id=e.deptListAll.id,n.out_time=Date.parse(new Date),n.staff_name=e.goodsExchangeAddForm.distribution_name,n.warehouse_id&&(n.warehouse_name=e.warehouseList.find(function(e){return e.id===n.warehouse_id}).name),n.handled_by_id&&(n.handled_by=e.adminList.find(function(e){return e.id===n.handled_by_id}).real_name),n.change_time=Math.floor(n.change_time/1e3),!e.goodsExchangeAddForm.product_list.length)return;if("OTHER_OUT"==n.type||"BORROW_OUT"==n.type)if(!n.product_list.map(function(t){return!(t.out_num<t.usable_stock)||(e.$message.error("该商品库存不足!"),!1)}))return;"goodsExchangeEdit"===e.$route.name?u.e(o,n).then(function(t){e.$message.success("修改成功!");var o=e.$route.params.callback;"function"==typeof o&&o(),e.$store.dispatch("delCurrentViews",{view:e.$route,$router:e.$router}),e.$router.push({name:"goodsExchange"})}):"goodsExchangeAdd"===e.$route.name&&(n.product_list.map(function(e){e.product_stock_id=e.id,e.id=""}),u.q(n).then(function(){e.$message.success("添加成功!");var t=e.$route.params.callback;"function"==typeof t&&t(),e.$store.dispatch("delCurrentViews",{view:e.$route,$router:e.$router}),e.$router.push({name:"goodsExchange"})}))}})},submitGoodsExchangeAddForm:function(){var e=this;this.$refs.goodsExchangeAddForm.validate(function(t){if(t){var o=e.goodsExchangeAddForm.id,n=e.MixinClone(e.goodsExchangeAddForm);if(n.save_or_submit="submit",n.warehouse_consignee_id=e.deptListAll.id,n.out_time=Date.parse(new Date),n.staff_name=e.goodsExchangeAddForm.distribution_name,n.warehouse_id&&(n.warehouse_name=e.warehouseList.find(function(e){return e.id===n.warehouse_id}).name),n.handled_by_id&&(n.handled_by=e.adminList.find(function(e){return e.id===n.handled_by_id}).real_name),n.change_time=Math.floor(n.change_time/1e3),!e.goodsExchangeAddForm.product_list.length)return void e.$message.error("请选择商品!");if("OTHER_OUT"==n.type||"BORROW_OUT"==n.type)if(!n.product_list.map(function(t){return!(t.out_num<t.usable_stock)||(e.$message.error("该商品库存不足!"),!1)}))return;"goodsExchangeEdit"===e.$route.name?u.e(o,n).then(function(t){e.$message.success("修改成功!");var o=e.$route.params.callback;"function"==typeof o&&o(),e.$store.dispatch("delCurrentViews",{view:e.$route,$router:e.$router}),e.$router.push({name:"goodsExchange"})}):"goodsExchangeAdd"===e.$route.name&&(n.product_list.map(function(e){e.product_stock_id=e.id,e.id=""}),u.q(n).then(function(){e.$message.success("添加成功!");var t=e.$route.params.callback;"function"==typeof t&&t(),e.$store.dispatch("delCurrentViews",{view:e.$route,$router:e.$router}),e.$router.push({name:"goodsExchange"})}))}})},handleSelectWarehouseEntryBatch:function(){var e=this;return r()(a.a.mark(function t(){var o;return a.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(e.goodsExchangeAddForm.warehouse_id){t.next=3;break}return e.$message.error("请先选择仓库!"),t.abrupt("return");case 3:return t.next=5,e.$EnwarehouseEntryBatch({goodsApi:"/admin/erp/warehouseOut/getGoodByWarehouse/"+e.goodsExchangeAddForm.warehouse_id,warehouseList:e.warehouseList,selectedIds:e.id?e.goodsExchangeAddForm.product_list&&e.goodsExchangeAddForm.product_list.map(function(e){return e.id}):e.goodsExchangeAddForm.product_list.map(function(e){return e.id}),purchasePlanApiParams:{warehouse_id:e.goodsExchangeAddForm.warehouse_id}});case 5:(o=t.sent).purchasePlans.map(function(e){e.sn_code_list=[]}),e.goodsExchangeAddForm.warehouse_id=o.warehouse_id,e.goodsExchangeAddForm.product_list=o.purchasePlans,console.log(e.goodsExchangeAddForm.product_list),e.goodsExchangeAddForm.change_amount=e.goodsExchangeAddForm.product_list.reduce(function(e,t){return e+t.entry_price},0);case 11:case"end":return t.stop()}},t,e)}))()},handleSelectOrderSn:function(){var e=this;return r()(a.a.mark(function t(){var o,n;return a.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e.$EnPickerOrder({orderApi:"admin/erp/order",selectedIds:[e.goodsExchangeAddForm.order_sn],limit:1});case 2:o=t.sent,e.$set(e.goodsExchangeAddForm,"distribution_name",o[0].distribution_name),n=o.map(function(e){return e.sn}),e.$set(e.goodsExchangeAddForm,"order_sn",n.join(",")),e.GET_WarehouseOutProduct();case 7:case"end":return t.stop()}},t,e)}))()},GET_WarehouseOutProduct:function(){var e=this;return r()(a.a.mark(function t(){var o;return a.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,_.a({order_sn:e.goodsExchangeAddForm.order_sn});case 2:o=t.sent,e.goodsExchangeAddForm.return_list=o.data.map(function(e){return e.amount=e.product_price,e.product_sn=e.product_sn,e.product_name=e.product_name,e.specification=e.product_specification,e.product_id=e.product_id,e.unit=e.product_unit,e.out_num=e.return_num,e.stock_sn=e.warehouse_entry_sn,e.cost_price=e.product_cost_price,e});case 4:case"end":return t.stop()}},t,e)}))()},GET_DeptList:function(){var e=this;u.i().then(function(t){e.deptListAll=t,e.deptListAll.password=""})},handleChangeWareHouse:function(e){},GET_goodsExchangeAddDetail:function(){var e=this;this.$nextTick(function(){u.h(e.id).then(function(t){e.goodsExchangeAddForm=t,e.GET_WarehouseList({dept_id:t.warehouse_id}),e.goodsExchangeAddForm.change_time=Math.floor(1e3*e.goodsExchangeAddForm.change_time),t.product_list.map(function(e){e.order_num=e.out_num,e.out_num=0,e.sn_code_list||(e.sn_code_list=[])}),e.goodsExchangeAddForm.distribution_name=t.staff_name,e.goodsExchangeAddForm.product_list=t.product_list})})}}},g=o("XyMi");var f=function(e){o("AGRu")},x=Object(g.a)(m,function(){var e=this,t=e.$createElement,o=e._self._c||t;return o("div",{staticClass:"bg-in-stock"},[o("el-form",{ref:"goodsExchangeAddForm",staticClass:"change-form",attrs:{model:e.goodsExchangeAddForm,rules:e.goodsExchangeAddFormRule,"label-width":"160px",inline:""}},[o("el-form-item",{staticClass:"change-form-item",attrs:{prop:"warehouse_id",label:"出库仓库"}},[o("el-select",{attrs:{disabled:"detail"===e.type||"audit"===e.type},model:{value:e.goodsExchangeAddForm.warehouse_id,callback:function(t){e.$set(e.goodsExchangeAddForm,"warehouse_id",t)},expression:"goodsExchangeAddForm.warehouse_id"}},e._l(e.warehouseList,function(e){return o("el-option",{key:e.id,attrs:{label:e.name,value:e.id}})}),1)],1),e._v(" "),o("el-form-item",{staticClass:"change-form-item",attrs:{label:"类型",prop:"type"}},[o("el-select",{attrs:{filterable:"","allow-create":"",clearable:"","default-first-option":"",disabled:"detail"===e.type||"audit"===e.type},model:{value:e.goodsExchangeAddForm.type,callback:function(t){e.$set(e.goodsExchangeAddForm,"type",t)},expression:"goodsExchangeAddForm.type"}},e._l(e.typeList,function(e){return o("el-option",{key:e.value,attrs:{label:e.label,value:e.value,disabled:"SALE_OUT"==e.value||"HAIL_OUT"==e.value||"DAMAGE_OUT"==e.value||"TRANSFER_OUT"==e.value}})}),1)],1),e._v(" "),o("el-form-item",{staticClass:"change-form-item",staticStyle:{width:"61%"},attrs:{label:"备注",prop:"notes"}},[o("el-input",{staticStyle:{flex:"1"},attrs:{type:"textarea",disabled:"detail"===e.type||"audit"===e.type,maxlength:"250",autosize:{minRows:3,maxRows:4},placeholder:"请输入"},model:{value:e.goodsExchangeAddForm.notes,callback:function(t){e.$set(e.goodsExchangeAddForm,"notes",t)},expression:"goodsExchangeAddForm.notes"}})],1),e._v(" "),o("div",{staticClass:"mx"},[o("h3",[e._v("商品明细")]),e._v(" "),"detail"!==e.type&&"audit"!==e.type?o("el-button",{staticClass:"button",attrs:{size:"mini",type:"primary"},on:{click:e.scanCode}},[e._v("扫码出库")]):e._e(),e._v(" "),"detail"!==e.type&&"audit"!==e.type?o("el-button",{staticClass:"button",attrs:{size:"mini",type:"primary"},on:{click:e.handleSelectWarehouseEntryBatch}},[e._v("选择")]):e._e()],1),e._v(" "),o("div",{staticStyle:{width:"100%",display:"block"}},[o("el-form-item",{staticStyle:{width:"100%"}},[o("el-table",{staticStyle:{width:"100%","margin-top":"20px"},attrs:{data:e.goodsExchangeAddForm.product_list,border:"","cell-style":{textAlign:"center"},"header-cell-style":{textAlign:"center"}}},[o("el-table-column",{attrs:{label:"商品编号"},scopedSlots:e._u([{key:"default",fn:function(t){return[(e.id,o("span",[e._v(e._s(t.row.goods_vo.sn))]))]}}])}),e._v(" "),o("el-table-column",{attrs:{label:"商品名称"},scopedSlots:e._u([{key:"default",fn:function(t){return[(e.id,o("span",[e._v(e._s(t.row.goods_vo.name))]))]}}])}),e._v(" "),o("el-table-column",{attrs:{label:"sku"},scopedSlots:e._u([{key:"default",fn:function(t){return[(e.id,o("span",[e._v(e._s(t.row.product_vo.sku))]))]}}])}),e._v(" "),e.sn_code_list?o("el-table-column",{attrs:{label:"序列号"},scopedSlots:e._u([{key:"default",fn:function(t){return[o("div",{staticClass:"sn-code-container"},e._l(t.row.sn_code_list,function(t){return o("span",{key:t.id},[o("p",[e._v(e._s(t.sn_code))])])}),0)]}}],null,!1,1818486804)}):e._e(),e._v(" "),(e.id,o("el-table-column",{attrs:{prop:"product_vo.spec_name",label:"规格型号"}})),e._v(" "),o("el-table-column",{attrs:{label:"单位"},scopedSlots:e._u([{key:"default",fn:function(t){return[(e.id,o("span",[e._v(e._s(t.row.product_vo.unit))]))]}}])}),e._v(" "),o("el-table-column",{attrs:{label:"出库数量"},scopedSlots:e._u([{key:"default",fn:function(t){return[o("el-input",{attrs:{type:"number",min:0,maxlength:20,disabled:"detail"===e.type||"audit"===e.type},model:{value:t.row.out_num,callback:function(o){e.$set(t.row,"out_num",o)},expression:"scope.row.out_num"}})]}}])}),e._v(" "),o("el-table-column",{attrs:{label:"订单数量"},scopedSlots:e._u([{key:"default",fn:function(t){return[e._v("\n "+e._s(t.row.order_num)+"\n ")]}}])}),e._v(" "),o("el-table-column",{attrs:{label:"可用库存"},scopedSlots:e._u([{key:"default",fn:function(t){return[e._v("\n "+e._s(t.row.usable_stock)+"\n ")]}}])}),e._v(" "),o("el-table-column",{attrs:{label:"实际库存"},scopedSlots:e._u([{key:"default",fn:function(t){return[e._v("\n "+e._s(t.row.actual_stock)+"\n ")]}}])}),e._v(" "),"detail"!==e.type&&"audit"!==e.type?o("el-table-column",{attrs:{width:"200",label:"操作"},scopedSlots:e._u([{key:"default",fn:function(t){return[o("el-button",{attrs:{size:"mini",type:"danger"},on:{click:function(o){return e.goodsExchangeAddForm.product_list.splice(t.$index,1)}}},[e._v("删除")])]}}],null,!1,1006518692)}):e._e()],1)],1)],1)],1),e._v(" "),o("div",{staticClass:"footer"},["audit"!==e.type&&"detail"!==e.type&&e.checkPermission(["warehouseOut2:add"])?o("el-button",{attrs:{type:"primary"},on:{click:e.saveGoodsExchangeAddForm}},[e._v("保存\n ")]):e._e(),e._v(" "),"audit"!==e.type&&"detail"!==e.type&&e.checkPermission(["warehouseOut:update"])?o("el-button",{attrs:{type:"primary"},on:{click:e.submitGoodsExchangeAddForm}},[e._v("出库\n ")]):e._e(),e._v(" "),"audit"==e.type?o("el-button",{on:{click:e.printIng}},[e._v("打印")]):e._e(),e._v(" "),o("el-button",{on:{click:function(t){return e.toBack()}}},[e._v("返回")])],1),e._v(" "),o("el-dialog",{attrs:{title:"提示",visible:e.dialogVisible,width:"30%"},on:{"update:visible":function(t){e.dialogVisible=t}}},[o("el-form",{ref:"goodsExchangeAddForm",staticStyle:{width:"900px"},attrs:{model:e.goodsExchangeAddForm,"label-width":"120px",inline:""}},[o("el-form-item",{attrs:{label:"驳回原因",prop:"reject_reason"}},[o("el-input",{attrs:{type:"textarea",minlength:0,maxlength:100},model:{value:e.goodsExchangeAddForm.reject_reason,callback:function(t){e.$set(e.goodsExchangeAddForm,"reject_reason",t)},expression:"goodsExchangeAddForm.reject_reason"}})],1)],1),e._v(" "),o("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"},[o("el-button",{on:{click:function(t){e.dialogVisible=!1}}},[e._v("取 消")]),e._v(" "),o("el-button",{attrs:{type:"primary"},on:{click:function(t){return e.handleRejectGoodsExchange()}}},[e._v("确 定")])],1)],1),e._v(" "),o("el-dialog",{attrs:{title:"扫码出库",visible:e.scanDialogVisible,width:"30%","close-on-click-modal":!1},on:{"update:visible":function(t){e.scanDialogVisible=t}}},[o("el-form",{ref:"scanGoodsForm",attrs:{model:e.scanGoodsForm,"label-width":"120px",inline:""}},[o("el-form-item",{attrs:{label:"sku",prop:"bar_code"}},[o("el-input",{ref:"input",attrs:{minlength:0,maxlength:100},nativeOn:{keyup:function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"enter",13,t.key,"Enter")?null:e.toSearch()}},model:{value:e.scanGoodsForm.bar_code,callback:function(t){e.$set(e.scanGoodsForm,"bar_code",t)},expression:"scanGoodsForm.bar_code"}})],1),e._v(" "),o("el-form-item",{attrs:{label:"序列号",prop:"sn_code"}},[o("el-input",{ref:"sn_input",attrs:{minlength:0,maxlength:100},nativeOn:{keyup:function(t){return!t.type.indexOf("key")&&e._k(t.keyCode,"enter",13,t.key,"Enter")?null:e.toSnCode()}},model:{value:e.sn_code,callback:function(t){e.sn_code=t},expression:"sn_code"}})],1)],1),e._v(" "),o("span",{staticClass:"dialog-footer",attrs:{slot:"footer"},slot:"footer"})],1)],1)},[],!1,f,"data-v-f317153a",null);t.default=x.exports},AGRu:function(e,t,o){var n=o("G28B");"string"==typeof n&&(n=[[e.i,n,""]]),n.locals&&(e.exports=n.locals);o("rjj0")("2860e3c6",n,!0)},G28B:function(e,t,o){(e.exports=o("FZ+f")(!1)).push([e.i,'\n@charset "UTF-8";\n/** 底部步骤 */\n.footer[data-v-f317153a] {\n width: 100%;\n padding: 10px;\n bottom: 0px;\n text-align: center;\n z-index: 999;\n}\n.mx[data-v-f317153a] {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-align: center;\n -ms-flex-align: center;\n align-items: center;\n width: 100%;\n}\n.mx .button[data-v-f317153a] {\n margin-left: 10px;\n}\n.change-form[data-v-f317153a] {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-pack: start;\n -ms-flex-pack: start;\n justify-content: flex-start;\n -webkit-box-align: start;\n -ms-flex-align: start;\n align-items: flex-start;\n -ms-flex-wrap: wrap;\n flex-wrap: wrap;\n min-width: 900px;\n}\n.change-form .change-form-item[data-v-f317153a] {\n width: 30%;\n margin: 0 10px 20px 0;\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n -webkit-box-orient: horizontal;\n -webkit-box-direction: normal;\n -ms-flex-direction: row;\n flex-direction: row;\n -ms-flex-wrap: nowrap;\n flex-wrap: nowrap;\n}\n.change-form[data-v-f317153a] .el-form-item__content {\n -webkit-box-flex: 1;\n -ms-flex: 1;\n flex: 1;\n width: 100%;\n}\n.change-form[data-v-f317153a] .el-date-editor,\n .change-form[data-v-f317153a] .el-cascader,\n .change-form[data-v-f317153a] .el-select {\n width: 100%;\n}\n.bg-in-stock[data-v-f317153a] {\n background-color: #fff;\n margin: 10px;\n padding: 25px;\n}\n.goods-info[data-v-f317153a] {\n display: -webkit-box;\n display: -ms-flexbox;\n display: flex;\n}\n.goods-info .goods-name-box[data-v-f317153a] {\n text-align: left;\n}\n.goods-info .goods-name-box .goods-name[data-v-f317153a] {\n text-overflow: ellipsis;\n display: -webkit-box;\n -webkit-line-clamp: 2;\n -webkit-box-orient: vertical;\n overflow: hidden;\n line-height: 16px;\n}\n.goods-info .goods-name-box .specs[data-v-f317153a] {\n color: #999999;\n}\n.sn-code-container[data-v-f317153a] {\n max-height: 100px;\n /* 设置最大高度,超过这个高度将显示滚动条 */\n overflow-y: auto;\n /* 垂直方向上溢出时显示滚动条 */\n}\n[data-v-f317153a] .el-input--suffix .el-input__inner {\n padding-right: 10px;\n}\n[data-v-f317153a] .error-input .el-input__inner {\n border: 1px solid red;\n}\n',""])}});