2 lines
11 KiB
JavaScript
2 lines
11 KiB
JavaScript
|
import{S as n,a as o,_ as P}from"./main-9b36f05f.js";import{h as w,r as V,a as m,o as f,s as b,e as s,d as u,u as r,B as h,b as i,w as l,A as C,_ as F,ab as v,t as d,aa as B}from"./vendor-adef9cb4.js";const $=w({name:"pays",created(){this.loadData()},mounted(){},data:()=>({currencyConfig:{masked:!1,prefix:"",suffix:"ریال",thousands:",",decimal:".",precision:0,disableNegative:!1,disabled:!1,min:0,max:null,allowBlank:!1,minimumNumberOfCharacters:0,shouldRound:!0,focusOnRight:!1},year:{},date:"",transfer:{content:"cashdesk",bank:void 0,cashdesk:void 0,salary:void 0,amount:0,reference:"",table:5,id:"",des:"پرداخت بابت منسوجات نقره"},banks:[],cashdesks:[],salarys:[],order:{doc:[]},orderPays:0,customer:[],searchValue:"",loading:V(!0),items:[],headers:[{text:"تاریخ",value:"date",sortable:!0},{text:"مبلغ(ریال)",value:"amount",sortable:!0},{text:"نوع پرداخت",value:"type",sortable:!0},{text:"مرجع پرداخت",value:"ref",sortable:!0},{text:"توضیحات",value:"des",sortable:!0},{text:"عملیات",value:"operation"}]}),watch:{"transfer.bank":function(){this.transfer.id=this.transfer.bank.id},"transfer.salary":function(){this.transfer.id=this.transfer.salary.id},"transfer.cashdesk":function(){this.transfer.id=this.transfer.cashdesk.id}},methods:{removePay(e){n.fire({text:"آیا برای حذف این سوابق پرداخت مطمئن هستید؟",showCancelButton:!0,confirmButtonText:"بله",cancelButtonText:"خیر",icon:"warning"}).then(t=>{t.isConfirmed&&o.post("/api/plugin/noghre/order/pays/remove/"+e).then(c=>{c.data.result==1&&(this.loadPays(),n.fire({text:"پرداخت با موفقیت حذف شد.",icon:"success",confirmButtonText:"قبول"}))})})},changeDes(e){this.transfer.content=e,e==" bank"?this.transfer.table=5:e==" salary"?this.transfer.table=122:e==" cashdesk"&&(this.transfer.table=121)},loadData(){o.post("/api/plugin/noghre/order/info/"+this.$route.params.id).then(e=>{this.order=e.data,this.customer=e.data.customer,this.loading=!1}),o.post("/api/bank/list").then(e=>{this.banks=e.data}),o.post("/api/cashdesk/list").then(e=>{this.cashdesks=e.data}),o.post("/api/salary/list").then(e=>{this.salarys=e.data}),o.post("/api/year/get").then(e=>{this.year=e.data,this.date=e.data.now}),this.loadPays()},loadPays(){this.loading=!0,o.post("/api/plugin/noghre/order/pays/list/"+this.$route.params.id).then(e=>{this.items=e.data,this.orderPays=0,this.items.forEach(t=>{this.orderPays+=parseInt(t.amount)}),this.loading=!1})},balace(){this.transfer.amount=this.order.doc.amount-this.orderPays},insertPay(){if(this.transfer.amount==0)n.fire({text:"مبلغ وارد نشده است.",icon:"error",confirmButtonText:"قبول"});else if(this.transfer.content=="bank"&&this.transfer.bank==null||this.transfer.content=="salary"&&this.transfer.salary==null||this.transfer.content=="cashdesk"&&this.transfer.cashdesk==null)n.fire({text:"حساب دریافت کننده انتخاب نشده است.",icon:"error",confirmButtonText:"قبول"});else{let e={date:this.date,des:this.transfer.des,type:"plugNoghrePay",refData:this.order.id,plugin:"plugNoghrePay",update:"",rows:[{bs:0,bd:this.transfer.amount,type:this.transfer.content,bank:this.transfer.bank,salary:this.transfer.salary,cashdesk:this.transfer.cashdesk,table:this.transfer.table,id:this.transfer.id,des:this.transfer.des,referral:this.transfer.reference,plugin:"plugNoghrePay",refData:this.order.doc.code},{bd:0,bs:this.transfer.amount,type:"person",table:3,id:this.customer.id,des:this.transfer.des,referral:this.transfer.reference}]};o.post("/api/accounting/insert",e).then(t=>{t.data.result=="1"?n.fire({text:" پرداخت با موفقیت ثبت شد.",icon:"success",confirmButtonText:"قبول"}).then(c=>{document.getElementById("modalCloseBtn").click(),this.loadPays()}):t.data.result=="4"&&n.fire({text:t.data.msg,icon:"error",confirmButtonText:"قبول"})})}}}}),E={class:"block block-content-full"},D={id:"fixed-header",class:"block-header block-header-default bg-gray-light pt-2 pb-1"},N={class:"block-title text-primary-dark"},T={
|