Elizabeth's proactive approach involves introducing urinal toilet attachment , an ingenious concept that optimizes space and functionality.

purchaseNewStockQuery.vue 31KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030
  1. <template>
  2. <div class="main-contain">
  3. <div class="app-container "
  4. style="padding-left:0px;margin:0px;"
  5. v-loading="loading"
  6. element-loading-text="拼命加载中">
  7. <div style="justify-content: space-between;margin: 0px 0 12px 0;display: flex;align-items: center;">
  8. <div>
  9. <span style="font-size:14px;color:#606266">操作时间:</span>
  10. <el-date-picker
  11. size="small"
  12. v-model="start_time"
  13. prefix-icon="el-icon-date"
  14. :editable="false"
  15. style="width: 150px;"
  16. type="date"
  17. placeholder="选择日期时间"
  18. align="right"
  19. format="yyyy-MM-dd"
  20. value-format="yyyy-MM-dd"
  21. @change="startTimeChange"
  22. :picker-options="pickerOptions"
  23. :clearable="false"
  24. ></el-date-picker>
  25. <span>-</span>
  26. <el-date-picker
  27. size="small"
  28. v-model="end_time"
  29. prefix-icon="el-icon-date"
  30. :editable="false"
  31. style="width: 150px;"
  32. type="date"
  33. placeholder="选择日期时间"
  34. align="right"
  35. format="yyyy-MM-dd"
  36. value-format="yyyy-MM-dd"
  37. @change="endTimeChange"
  38. :picker-options="pickerOptions"
  39. :clearable="false"
  40. ></el-date-picker>
  41. <span style="font-size:14px;color:#606266">耗材类型:</span>
  42. <el-select v-model="good_type" style="width:200px;margin-right:10px;" placeholder="请选择"
  43. filterable
  44. @change="changeGoodTypeName">
  45. <el-option
  46. v-for="item in goodTypeList"
  47. :key="item.id"
  48. :label="item.type_name"
  49. :value="item.id">
  50. </el-option>
  51. </el-select>
  52. <el-input v-model="keyword" style="width:200px" placeholder="请输入耗材名称或生产厂商" ></el-input>
  53. <el-button type="primary" icon="el-icon-search" @click="seach">搜索</el-button>
  54. </div>
  55. <div>
  56. <el-button type="primary" size="small" @click="toOverCount">调试</el-button>
  57. <el-button type="primary" size="small" @click="toPrint">打印</el-button>
  58. <el-button type="primary" size="small" @click="exportList">导出</el-button>
  59. </div>
  60. </div>
  61. <el-table
  62. :row-style="{ color: '#303133' }"
  63. :header-cell-style="{
  64. backgroundColor: 'rgb(245, 247, 250)',
  65. color: '#606266'
  66. }"
  67. :data="tableList"
  68. :class="signAndWeighBoxPatients"
  69. border
  70. >
  71. <el-table-column label="耗材类型" align="center">
  72. <template slot-scope="scope">
  73. {{getGoodTypeName(scope.row.good_type_id)}}
  74. </template>
  75. </el-table-column>
  76. <el-table-column label="耗材名称" align="center">
  77. <template slot-scope="scope">
  78. {{scope.row.good_name}}
  79. </template>
  80. </el-table-column>
  81. <el-table-column label="规格&单位" align="center">
  82. <template slot-scope="scope">
  83. {{scope.row.specification_name}}/{{scope.row.packing_unit}}
  84. </template>
  85. </el-table-column>
  86. <el-table-column label="生产厂商" align="center">
  87. <template slot-scope="scope">
  88. {{getManufacturName(scope.row.manufacturer)}}
  89. </template>
  90. </el-table-column>
  91. <el-table-column label="期初结余" align="center">
  92. <el-table-column prop="stockIn" label="数量" width="100">
  93. </el-table-column>
  94. <el-table-column prop="stock_in_price" label="进货金额" width="100">
  95. </el-table-column>
  96. <el-table-column prop="stockMoney" label="销售金额" width="100">
  97. </el-table-column>
  98. </el-table-column>
  99. <el-table-column label="本期增加" align="center">
  100. <el-table-column prop="stockAdd" label="数量" width="100">
  101. </el-table-column>
  102. <el-table-column prop="addStockMoney" label="进货金额" width="100">
  103. </el-table-column>
  104. <el-table-column prop="saleStockMoney" label="销售金额" width="100">
  105. </el-table-column>
  106. </el-table-column>
  107. <el-table-column label="本期减少" align="center">
  108. <el-table-column prop="outStock" label="数量" width="100">
  109. </el-table-column>
  110. <el-table-column prop="stockOutprice" label="进货金额" width="100">
  111. </el-table-column>
  112. <el-table-column prop="saleOutMoney" label="销售金额" width="100">
  113. </el-table-column>
  114. </el-table-column>
  115. <el-table-column label="期末结余" align="center">
  116. <el-table-column prop="overStock" label="数量" width="100">
  117. </el-table-column>
  118. <el-table-column prop="overPrice" label="进货金额" width="100">
  119. </el-table-column>
  120. <el-table-column prop="overMoney" label="销售金额" width="100">
  121. </el-table-column>
  122. </el-table-column>
  123. </el-table>
  124. <el-pagination
  125. @size-change="handleSizeChange"
  126. @current-change="handleCurrentChange"
  127. :page-sizes="[10, 50, 100,200,500,1000]"
  128. :page-size="10"
  129. background
  130. align="right"
  131. style="margin-top:20px;"
  132. layout="total, sizes, prev, pager, next, jumper"
  133. :total="total"
  134. >
  135. </el-pagination>
  136. </div>
  137. </div>
  138. </template>
  139. <script>
  140. import { getStorehouseList,getNewPurchaseStockQuery,getGoodOverCount } from "@/api/drug/drug"
  141. import {
  142. getStockDrugCount
  143. } from "@/api/stock";
  144. import { uParseTime } from '@/utils/tools'
  145. const moment = require('moment')
  146. export default {
  147. data(){
  148. return{
  149. tableList:[],
  150. goodList:[
  151. {id:1,name:"全部耗材"},
  152. {id:2,name:"库存预警"},
  153. ],
  154. houseList:[],
  155. storehouse_id:0,
  156. good_type:0,
  157. multipleSelection: [],
  158. signAndWeighBoxPatients: "sign-and-weigh-box-patients",
  159. manufacturerList:[],
  160. limit:10,
  161. page:1,
  162. total:0,
  163. keyword:"",
  164. goodTypeList:[],
  165. start_time:"",
  166. end_time:"",
  167. countList:[],
  168. outCountList:[],
  169. autoCountList:[],
  170. cancelCountList:[],
  171. org_id:this.$store.getters.xt_user.org_id,
  172. dialogVisible:false,
  173. start_first_time:"",
  174. end_first_time:"",
  175. tableData:[],
  176. good_id:0,
  177. patientList:[],
  178. good_name:"",
  179. specification_name:"",
  180. loading:false,
  181. pickerOptions:{ //禁用当前日期之前的日期
  182. disabledDate(v) {
  183. return v.getTime() < 1667232000000
  184. },
  185. },
  186. }
  187. },
  188. methods:{
  189. changeStorehouseName(){
  190. },
  191. changeGoodTypeName(){
  192. this.getlist()
  193. },
  194. getStorehouseList(){
  195. getStorehouseList().then(response=>{
  196. if(response.data.state == 1){
  197. var houseList = response.data.data.list
  198. var obj = {id:0,storehouse_name:"全部"}
  199. this.houseList.push(obj)
  200. for(let i=0;i<houseList.length;i++){
  201. this.houseList.push(houseList[i])
  202. }
  203. this.manufacturerList = response.data.data.manufacturerList
  204. var obj = {id:0,type_name:"全部"}
  205. this.goodTypeList.push(obj)
  206. var goodTypeList = response.data.data.goodTypeList
  207. for(let i=0;i<goodTypeList.length;i++){
  208. this.goodTypeList.push(goodTypeList[i])
  209. }
  210. this.patientList = response.data.data.patientList
  211. }
  212. })
  213. },
  214. getlist(){
  215. this.loading = true
  216. var params = {
  217. good_type:this.good_type,
  218. keyword:this.keyword,
  219. page:this.page,
  220. limit:this.limit,
  221. start_time:this.start_time,
  222. end_time:this.end_time,
  223. }
  224. getNewPurchaseStockQuery(params).then(response=>{
  225. if(response.data.state == 1){
  226. var list = response.data.data.list
  227. this.loading = false
  228. for(let i=0;i<list.length;i++){
  229. list[i].stockIn = list[i].GoodStartFlowInfo.over_count
  230. list[i].stock_in_price = "/"
  231. list[i].stockMoney = "/"
  232. // list[i].stockIn = this.getWarehouseInfoStart(list[i].StartFlowInfo,list[i].StartOutFlowInfo,list[i].WareStartStockInventoryProfit,list[i].WareStartStockInventoryLosses,list[i].StartCancelFlowInfo) //期初结余
  233. // list[i].stock_in_price = this.getWarehouseInfoStartPrice(list[i].StartFlowInfo,list[i].StartOutFlowInfo,list[i].WareStartStockInventoryProfit,list[i].WareStartStockInventoryLosses,list[i].StartCancelFlowInfo)
  234. // list[i].stockMoney = this.getWarehouseInfoStartMoney(list[i].StartFlowInfo,list[i].StartOutFlowInfo,list[i].WareStartStockInventoryProfit,list[i].WareStartStockInventoryLosses,list[i].StartCancelFlowInfo)
  235. list[i].stockAdd = this.getWarehouseInfoOne(list[i].StartFlowWarehouseInfo,list[i].WareStartEndStockInventoryProfit)//期间增加
  236. // list[i].addStockMoney = this.getAddStockMony(list[i].StartFlowWarehouseInfo,list[i].WareStartEndStockInventoryProfit)
  237. // list[i].saleStockMoney = this.getSaleStockMony(list[i].StartFlowWarehouseInfo,list[i].WareStartEndStockInventoryProfit)
  238. list[i].addStockMoney = "/"
  239. list[i].saleStockMoney = "/"
  240. list[i].outStock = this.getWarehosueOutInfo(list[i].WarehouseOutInfoStart,list[i].WareStartEndStockInventoryLosses,list[i].StartEndCancelFLowInfo)//本期减少
  241. // list[i].stockOutprice = this.stockOutprice(list[i].WarehouseOutInfoStart,list[i].WareStartEndStockInventoryLosses,list[i].StartEndCancelFLowInfo)
  242. // list[i].saleOutMoney = this.getSaleStockMony(list[i].WarehouseOutInfoStart,list[i].WareStartEndStockInventoryLosses,list[i].StartEndCancelFLowInfo)
  243. list[i].stockOutprice = "/"
  244. list[i].saleOutprice = "/"
  245. // list[i].overStock= this.getEndWarehouseInfo(list[i].EndFlowInfo,list[i].EndFlowOutInfo,list[i].WareEndStockInventoryProfit,list[i].WareEndStockInventoryLosses,list[i].EndCancelFLowInfo)
  246. // list[i].overPrice= this.getEndOverPrice(list[i].EndFlowInfo,list[i].EndFlowOutInfo,list[i].WareEndStockInventoryProfit,list[i].WareEndStockInventoryLosses,list[i].EndCancelFLowInfo)
  247. // list[i].overMoney = this.getEndSalePrice(list[i].EndFlowInfo,list[i].EndFlowOutInfo,list[i].WareEndStockInventoryProfit,list[i].WareEndStockInventoryLosses,list[i].EndCancelFLowInfo)
  248. list[i].overStock = list[i].GoodEndFlowInfo.over_count
  249. list[i].overPrice = "/"
  250. list[i].overMoney = "/"
  251. }
  252. this.tableList = list
  253. this.total = response.data.data.total
  254. this.manufacturerList = response.data.data.manufacturerList
  255. }
  256. })
  257. },
  258. getManufacturName(id){
  259. var manufacturer_name = ""
  260. for(let i=0;i<this.manufacturerList.length;i++){
  261. if(id == this.manufacturerList[i].id){
  262. manufacturer_name = this.manufacturerList[i].manufacturer_name
  263. }
  264. }
  265. return manufacturer_name
  266. },
  267. handleSizeChange(val) {
  268. this.limit = val;
  269. this.getlist()
  270. },
  271. handleCurrentChange(val) {
  272. this.page = val;
  273. this.getlist()
  274. },
  275. handleSizeChangeOne(val) {
  276. this.limitone = val;
  277. this.toDialogClick(this.good_id,this.good_name,this.specification_name)
  278. },
  279. handleCurrentChangeOne(val) {
  280. this.pageone = val;
  281. this.toDialogClick(this.good_id,this.good_name,this.specification_name)
  282. },
  283. seach(){
  284. this.goodTypeList = []
  285. this.getStorehouseList()
  286. this.getlist()
  287. },
  288. getGoodTypeName(id){
  289. var type_name = ""
  290. for(let i=0;i<this.goodTypeList.length;i++){
  291. if(id == this.goodTypeList[i].id){
  292. type_name = this.goodTypeList[i].type_name
  293. }
  294. }
  295. return type_name
  296. },
  297. getHouseName(id){
  298. var storehouse_name = ""
  299. for(let i=0;i<this.houseList.length;i++){
  300. if(id == this.houseList[i].id){
  301. storehouse_name = this.houseList[i].storehouse_name
  302. }
  303. }
  304. return storehouse_name
  305. },
  306. getWareInfoCount(val,storehouse_id){
  307. var count = 0
  308. if(val.length > 0){
  309. for(let i=0;i<val.length;i++){
  310. if(val[i].storehouse_id == storehouse_id){
  311. count +=val[i].warehousing_count
  312. }
  313. }
  314. }
  315. if(count > 0){
  316. return count
  317. }else{
  318. return ""
  319. }
  320. },
  321. getStockDrugCount(){
  322. var params ={
  323. keywords: this.keywords,
  324. start_time:this.start_time,
  325. end_time:this.end_time,
  326. }
  327. getStockDrugCount(params).then(response=>{
  328. if(response.data.state == 1){
  329. var outlist = response.data.data.outList
  330. this.outCountList = outlist
  331. var autoCount = response.data.data.autoCount
  332. this.autoCountList = autoCount
  333. var totalCount = response.data.data.totalCount
  334. this.cancelCountList = totalCount
  335. }
  336. })
  337. },
  338. getWareInfoCountOne(val,storehouse_id){
  339. var count = 0
  340. if(val.length > 0){
  341. for(let i=0;i<val.length;i++){
  342. if(val[i].storehouse_id == storehouse_id){
  343. count +=val[i].stock_count
  344. }
  345. }
  346. }
  347. if(count > 0){
  348. return count
  349. }else{
  350. return ""
  351. }
  352. },
  353. getOutCount(id){
  354. var count = 0
  355. for(let i=0;i<this.outCountList.length;i++){
  356. if(id == this.outCountList[i].good_id){
  357. count = this.outCountList[i].count
  358. }
  359. }
  360. return count
  361. },
  362. getAutoCount(id){
  363. var count= 0
  364. for(let i=0;i<this.autoCountList.length;i++){
  365. if(id == this.autoCountList[i].good_id){
  366. count = this.autoCountList[i].count
  367. }
  368. }
  369. return count
  370. },
  371. getCancelCount(id){
  372. var count = 0
  373. for(let i=0;i<this.cancelCountList.length;i++){
  374. if(id == this.cancelCountList[i].good_id){
  375. count = this.cancelCountList[i].count
  376. }
  377. }
  378. return count
  379. },
  380. getCancelCountInfo(cancel_stock_info,storehouse_id){
  381. var count = 0
  382. if(cancel_stock_info.length >0){
  383. for(let i=0;i<cancel_stock_info.length;i++){
  384. if(storehouse_id == cancel_stock_info[i].storehouse_id){
  385. count += cancel_stock_info[i].count
  386. }
  387. }
  388. }
  389. return count
  390. },
  391. getWareOutInfoCount(warehouse_out_info,storehouse_id){
  392. var count = 0
  393. if(warehouse_out_info.length > 0){
  394. for(let i=0;i<warehouse_out_info.length;i++){
  395. if(storehouse_id == warehouse_out_info[i].storehouse_id){
  396. count +=warehouse_out_info[i].count
  397. }
  398. }
  399. }
  400. return count
  401. },
  402. getInCount(id){
  403. var count= 0
  404. for(let i=0;i<this.countList.length;i++){
  405. if(id == this.countList[i].good_id){
  406. count = this.countList[i].count
  407. }
  408. }
  409. return count
  410. },
  411. getOutCount(id){
  412. var count = 0
  413. for(let i=0;i<this.outCountList.length;i++){
  414. if(id == this.outCountList[i].good_id){
  415. count = this.outCountList[i].count
  416. }
  417. }
  418. return count
  419. },
  420. getAutoCount(id){
  421. var count= 0
  422. for(let i=0;i<this.autoCountList.length;i++){
  423. if(id == this.autoCountList[i].good_id){
  424. count = this.autoCountList[i].count
  425. }
  426. }
  427. return count
  428. },
  429. getCancelCount(id){
  430. var count = 0
  431. for(let i=0;i<this.cancelCountList.length;i++){
  432. if(id == this.cancelCountList[i].good_id){
  433. count = this.cancelCountList[i].count
  434. }
  435. }
  436. return count
  437. },
  438. getStockCount(id){
  439. var stock_count = 0
  440. for(let i=0;i<this.countList.length;i++){
  441. if(id == this.countList[i].good_id){
  442. stock_count = this.countList[i].stock_count
  443. }
  444. }
  445. return stock_count
  446. },
  447. getWareInfo(arr){
  448. var total = 0
  449. if(arr.length > 0){
  450. for(let i=0;i<arr.length;i++){
  451. total += parseInt(arr[i].warehousing_count)
  452. }
  453. }else{
  454. total = ""
  455. }
  456. return total
  457. },
  458. getOverplus(arr){
  459. var total = 0
  460. if(arr.length > 0){
  461. for(let i=0;i<arr.length;i++){
  462. total += arr[i].stock_count
  463. }
  464. }else{
  465. total = ""
  466. }
  467. return total
  468. },
  469. getCancelInfo(arr){
  470. var total = 0
  471. if(arr.length > 0){
  472. for(let i=0;i<arr.length;i++){
  473. total += arr[i].count
  474. }
  475. }else{
  476. total = ""
  477. }
  478. return total
  479. },
  480. getOverFlushInfo(arr){
  481. var total = 0
  482. if(arr.length >0){
  483. for(let i=0;i<arr.length;i++){
  484. total += arr[i].stock_count
  485. }
  486. }
  487. return total
  488. },
  489. startFirstTimeChange(){
  490. this.getlist()
  491. },
  492. endEndTimeChange(){
  493. this.getlist()
  494. },
  495. getTime(val) {
  496. if(val < 0){
  497. return ""
  498. }
  499. if(val == ""){
  500. return ""
  501. }else {
  502. return uParseTime(val, '{y}-{m}-{d}')
  503. }
  504. },
  505. getName(id){
  506. var name = ""
  507. for(let i=0;i<this.patientList.length;i++){
  508. if(id == this.patientList[i].id){
  509. name = this.patientList[i].name
  510. }
  511. }
  512. return name
  513. },
  514. endTimeChange(){
  515. this.getlist()
  516. },
  517. startTimeChange(){
  518. this.getlist()
  519. },
  520. getWarehouseInfoStart(arr1,arr2,arr3,arr4,arr5){
  521. var count =0
  522. var countOne =0
  523. var countTwo= 0
  524. var countthree = 0 //期初
  525. var countfour = 0
  526. var countfive = 0
  527. if(arr1!=null && arr1.length > 0){
  528. for(let i=0;i<arr1.length;i++){
  529. countOne +=arr1[i].count
  530. }
  531. }
  532. if(arr2!=null && arr2.length > 0){
  533. for(let i=0;i<arr2.length;i++){
  534. countTwo +=arr2[i].count
  535. }
  536. }
  537. if(arr3!=null && arr3.length > 0){
  538. for(let i=0;i<arr3.length;i++){
  539. countthree +=arr3[i].count
  540. }
  541. }
  542. if(arr4!=null && arr4.length > 0){
  543. for(let i=0;i<arr4.length;i++){
  544. countfour +=arr4[i].count
  545. }
  546. }
  547. if(arr5!=null && arr5.length > 0){
  548. for(let i=0;i<arr5.length;i++){
  549. countfive +=arr5[i].count
  550. }
  551. }
  552. console.log("countOne",countOne)
  553. console.log("countTwo",countTwo)
  554. console.log("countthree",countthree)
  555. console.log("countfour",countfour)
  556. console.log("*********************")
  557. count = countOne - countTwo + countthree - countfour + countfive
  558. if(count > 0 ){
  559. return count
  560. }else{
  561. return 0
  562. }
  563. },
  564. getWarehouseInfo(val){
  565. var count =0
  566. for(let i=0;i<val.length;i++){
  567. count +=val[i].stock_count
  568. }
  569. if(count > 0 ){
  570. return count
  571. }else{
  572. return 0
  573. }
  574. },
  575. getWarehouseInfoOne(val,val2){
  576. var count =0
  577. var countOne = 0
  578. var all_count = 0
  579. if(val!=null && val.length >0){
  580. for(let i=0;i<val.length;i++){
  581. count +=val[i].count
  582. }
  583. }
  584. if(val2!=null && val2.length > 0){
  585. for(let i=0;i<val2.length;i++){
  586. countOne +=val2[i].count
  587. }
  588. }
  589. all_count = count + countOne
  590. console.log("count2332323223232o2222222222wide",count)
  591. console.log("countONE23232322323323223",countOne)
  592. console.log("all_count9999999999999wode",all_count)
  593. console.log("-------------------------------------------")
  594. if(all_count > 0 ){
  595. return all_count
  596. }else{
  597. return 0
  598. }
  599. },
  600. getAddStockMony(val,val2){
  601. var total_price =0
  602. var total_price_one = 0
  603. var all_price = 0
  604. if(val!=null && val.length >0){
  605. for(let i=0;i<val.length;i++){
  606. total_price +=val[i].count * val[i].buy_price
  607. }
  608. }
  609. if(val2!=null && val2.length > 0){
  610. for(let i=0;i<val2.length;i++){
  611. total_price_one +=val2[i].count * val2[i].price
  612. }
  613. }
  614. all_price = total_price + total_price_one
  615. if(all_price >0 ){
  616. return total_price.toFixed(2)
  617. }else{
  618. return "0.00"
  619. }
  620. },
  621. getSaleStockMony(val,val2){
  622. var total_price =0
  623. var total_price_one = 0
  624. var all_price = 0
  625. if(val!=null && val.length >0){
  626. for(let i=0;i<val.length;i++){
  627. total_price +=val[i].count * val[i].price
  628. }
  629. }
  630. if(val2!=null && val2.length > 0){
  631. for(let i=0;i<val2.length;i++){
  632. total_price_one +=val2[i].count * val2[i].price
  633. }
  634. }
  635. all_price = total_price + total_price_one
  636. if(all_price >0 ){
  637. return all_price.toFixed(2)
  638. }else{
  639. return "0.00"
  640. }
  641. },
  642. getWarehouseOut(val){
  643. var count = 0
  644. for(let i=0;i<val.length;i++){
  645. count +=val[i].count
  646. }
  647. if(count >0){
  648. return count
  649. }else{
  650. return 0
  651. }
  652. },
  653. open(){
  654. this.start_time = moment().year(2022).month(10).date(1).format('YYYY-MM-DD')
  655. this.end_time = moment().year(2022).month(10).date(1).format('YYYY-MM-DD')
  656. this.houseList = []
  657. this.goodTypeList= []
  658. this.getStorehouseList()
  659. this.getlist()
  660. //this.getStockDrugCount()
  661. },
  662. getWarehouseInfoStartPrice(arr,arr1,arr2,arr3,arr4){
  663. var total_price = 0
  664. var total_price_one = 0
  665. var total_price_two = 0
  666. var total_price_three = 0
  667. var total_price_four = 0
  668. var total_price_all = 0
  669. if(arr!=null&&arr.length > 0){
  670. for(let i=0;i<arr.length;i++){
  671. total_price += arr[i].count * arr[i].buy_price
  672. }
  673. }
  674. if(arr1!=null && arr1.length > 0){
  675. for(let i=0;i<arr1.length;i++){
  676. total_price_one +=arr1[i].count * arr1[i].buy_price
  677. }
  678. }
  679. if(arr2!=null && arr2.length > 0){
  680. for(let i=0;i<arr2.length;i++){
  681. total_price_two +=arr2[i].count * arr2[i].buy_price
  682. }
  683. }
  684. if(arr3!=null && arr3.length > 0){
  685. for(let i=0;i<arr3.length;i++){
  686. total_price_three +=arr3[i].count * arr3[i].buy_price
  687. }
  688. }
  689. if(arr4!=null && arr4.length > 0){
  690. for(let i=0;i<arr4.length;i++){
  691. total_price_three +=arr4[i].count * arr4[i].buy_price
  692. }
  693. }
  694. total_price_all = total_price - total_price_one + total_price_two - total_price_three + total_price_four
  695. if (total_price_all > 0) {
  696. return total_price_all.toFixed(2)
  697. }else{
  698. return "0.00"
  699. }
  700. },
  701. getWarehouseInfoStartMoney(arr,arr1,arr2,arr3,arr4){
  702. var total_price = 0
  703. var total_price_one = 0
  704. var total_price_two = 0
  705. var total_price_three = 0
  706. var total_price_four = 0
  707. var total_price_all = 0
  708. if(arr!=null && arr.length >0){
  709. for(let i=0;i<arr.length;i++){
  710. total_price +=arr[i].count * arr[i].price
  711. }
  712. }
  713. if(arr1!=null && arr1.length > 0){
  714. for(let i=0;i<arr1.length;i++){
  715. total_price_one +=arr1[i].count * arr1[i].price
  716. }
  717. }
  718. if(arr2!=null && arr2.length > 0){
  719. for(let i=0;i<arr2.length;i++){
  720. total_price_two +=arr2[i].count * arr2[i].price
  721. }
  722. }
  723. if(arr3!=null && arr3.length > 0){
  724. for(let i=0;i<arr3.length;i++){
  725. total_price_three +=arr3[i].count * arr3[i].price
  726. }
  727. }
  728. if(arr4!=null && arr4.length > 0){
  729. for(let i=0;i<arr4.length;i++){
  730. total_price_four +=arr4[i].count * arr4[i].price
  731. }
  732. }
  733. total_price_all = total_price - total_price_one + total_price_two - total_price_three + total_price_four
  734. if (total_price_all > 0) {
  735. return total_price_all.toFixed(2)
  736. }else{
  737. return "0.00"
  738. }
  739. },
  740. getWarehosueOutInfo(val,val2,val3){
  741. var count = 0
  742. var count_one = 0
  743. var all_count = 0
  744. var count_two = 0
  745. if(val!=null && val.length >0){
  746. for(let i=0;i<val.length;i++){
  747. count +=val[i].count
  748. }
  749. }
  750. if(val2!=null && val2.length > 0){
  751. for(let i=0;i<val2.length;i++){
  752. count_one +=val2[i].count
  753. }
  754. }
  755. if(val3!=null && val3.length > 0){
  756. for(let i=0;i<val3.length;i++){
  757. count_two +=val3[i].count
  758. }
  759. }
  760. all_count = count +count_one - count_two
  761. if(all_count >0){
  762. return all_count
  763. }else{
  764. return 0
  765. }
  766. },
  767. stockOutprice(val,val2,val3){
  768. var total_price = 0
  769. var total_price_one = 0
  770. var total_price_two = 0
  771. var all_price = 0
  772. if(val!=null && val.length >0){
  773. for(let i=0;i<val.length;i++){
  774. total_price +=val[i].count * val[i].buy_price
  775. }
  776. }
  777. if(val2!=null && val2.length > 0){
  778. for(let i=0;i<val2.length;i++){
  779. total_price_one +=val2[i].count * val2[i].buy_price
  780. }
  781. }
  782. if(val3!=null && val3.length > 0){
  783. for(let i=0;i<val3.length;i++){
  784. total_price_two +=val3[i].count * val3[i].buy_price
  785. }
  786. }
  787. all_price = total_price + total_price_one - total_price_two
  788. if(all_price >0){
  789. return all_price.toFixed(2)
  790. }else{
  791. return "0.00"
  792. }
  793. },
  794. saleOutprice(val,val2,val3){
  795. var total_price = 0
  796. var total_price_one = 0
  797. var all_price = 0
  798. var total_price_two = 0
  799. if(val!=null && val.length >0){
  800. for(let i=0;i<val.length;i++){
  801. total_price +=val[i].count * val[i].xt_warehouse_info.packing_price
  802. }
  803. }
  804. if(val2!=null && val2.length > 0){
  805. for(let i=0;i<val2.length;i++){
  806. total_price_one +=val2[i].count * val2[i].price
  807. }
  808. }
  809. if(val3!=null && val3.length > 0){
  810. for(let i=0;i<val3.length;i++){
  811. total_price_two +=val3[i].count * val3[i].price
  812. }
  813. }
  814. all_price = total_price + total_price_one - total_price_two
  815. if(all_price >0){
  816. return all_price.toFixed(2)
  817. }else{
  818. return "0.00"
  819. }
  820. },
  821. getEndWarehouseInfo(val,val3,val1,val2,val4){
  822. var count = 0
  823. var count_one = 0
  824. var count_two = 0
  825. var count_three =0
  826. var count_four = 0
  827. var all_count = 0
  828. if(val!=null && val.length >0){
  829. for(let i=0;i<val.length;i++){
  830. count +=val[i].count
  831. }
  832. }
  833. if(val1!=null&&val1.length >0){
  834. for(let i=0;i<val1.length;i++){
  835. count_one +=val1[i].count
  836. }
  837. }
  838. if(val3!=null&& val3.length > 0){
  839. for(let i=0;i<val3.length;i++){
  840. count_three +=val3[i].count
  841. }
  842. }
  843. if(val2!=null&&val2.length >0){
  844. for(let i=0;i<val2.length;i++){
  845. count_two +=val2[i].count
  846. }
  847. }
  848. if(val4!=null&&val4.length >0){
  849. for(let i=0;i<val4.length;i++){
  850. count_four +=val4[i].count
  851. }
  852. }
  853. all_count = count- count_three + count_one - count_two + count_four
  854. if(all_count >0){
  855. return all_count
  856. }else{
  857. return 0
  858. }
  859. },
  860. getEndOverPrice(val,val3,val1,val2,val4){
  861. var total_price = 0
  862. var total_price_one = 0
  863. var total_price_two = 0
  864. var total_price_three = 0
  865. var total_price_four =0
  866. var all_price = 0
  867. if(val!=null && val.length >0){
  868. for(let i=0;i<val.length;i++){
  869. total_price +=val[i].count * val[i].buy_price
  870. }
  871. }
  872. if(val1!=null && val1.length > 0){
  873. for(let i=0;i<val1.length;i++){
  874. total_price_one +=val1[i].count * val1[i].buy_price
  875. }
  876. }
  877. if(val3!=null && val3.length > 0){
  878. for(let i=0;i<val3.length;i++){
  879. total_price_three +=val3[i].count * val3[i].buy_price
  880. }
  881. }
  882. if(val2!=null && val2.length > 0){
  883. for(let i=0;i<val2.length;i++){
  884. total_price_two +=val2[i].count * val2[i].buy_price
  885. }
  886. }
  887. if(val4!=null && val4.length > 0){
  888. for(let i=0;i<val4.length;i++){
  889. total_price_four +=val4[i].count * val4[i].buy_price
  890. }
  891. }
  892. console.log("total_price",total_price)
  893. console.log("total_price_three",total_price_three)
  894. console.log("total_price_two",total_price_two)
  895. console.log("total_price_one",total_price_one)
  896. console.log("total_price_four",total_price_four)
  897. all_price = total_price- total_price_three +total_price_one - total_price_two + total_price_four
  898. console.log("arrll_price",all_price)
  899. if(all_price >0){
  900. return all_price.toFixed(2)
  901. }else{
  902. return "0.00"
  903. }
  904. },
  905. getEndSalePrice(val,val3,val1,val2,val4){
  906. var total_price = 0
  907. var total_price_one = 0
  908. var total_price_two = 0
  909. var total_price_three = 0
  910. var total_price_four = 0
  911. var all_price= 0
  912. if(val!=null && val.length >0){
  913. for(let i=0;i<val.length;i++){
  914. total_price +=val[i].count * val[i].price
  915. }
  916. }
  917. if(val1!=null && val1.length >0){
  918. for(let i=0;i<val1.length;i++){
  919. total_price_one +=val1[i].count * val1[i].price
  920. }
  921. }
  922. if(val3!=null && val3.length >0){
  923. for(let i=0;i<val3.length;i++){
  924. total_price_three +=val3[i].count * val3[i].price
  925. }
  926. }
  927. if(val2!=null && val2.length >0){
  928. for(let i=0;i<val2.length;i++){
  929. total_price_two +=val2[i].count * val2[i].price
  930. }
  931. }
  932. if(val4!=null && val4.length >0){
  933. for(let i=0;i<val4.length;i++){
  934. total_price_four +=val4[i].count * val4[i].price
  935. }
  936. }
  937. var all_price = total_price-total_price_three + total_price_one - total_price_two + total_price_four
  938. if(all_price >0){
  939. return all_price.toFixed(2)
  940. }else{
  941. return "0.00"
  942. }
  943. },
  944. toPrint(){
  945. this.$router.push({path:"/purchase/new/stock/query/print?start_time="+this.start_time+"&end_time="+this.end_time+"&page="+this.page+"&limit="+this.limit+"&keyword="+this.keyword+"&good_type="+this.good_type})
  946. },
  947. exportList: function() {
  948. for(let i=0;i<this.tableList.length;i++){
  949. this.tableList[i].index = i+1
  950. this.tableList[i].query_date = this.start_time+"~"+this.end_time
  951. this.tableList[i].good_type = this.getGoodTypeName(this.tableList[i].good_type_id)
  952. this.tableList[i].manufacturer_name = this.getManufacturName(this.tableList[i].manufacturer)
  953. this.tableList[i].specification_name_one = this.tableList[i].specification_name + "/"+this.tableList[i].packing_unit
  954. }
  955. import('@/vendor/Export2Excel').then(excel => {
  956. const multiHeader = [['序号', '查询日期',' 耗材类型','耗材名称','规格&单位','生产产商', '期初结余' , '', '', '本期增加', '', '', '本期减少' , '', '', '期末结余' , '', '']]
  957. const header = ['', '','','','','', '数量', '进货金额', '销售金额', '数量', '进货金额', '销售金额', '数量', '进货金额', '销售金额', '数量', '进货金额', '销售金额']
  958. const merges = ['A1:A2', 'B1:B2','C1:C2','D1:D2','E1:E2','F1:F2','G1:I1', 'J1:L1', 'M1:O1', 'P1:R1']
  959. const filterVal = ['index', 'query_date', 'good_type','good_name','specification_name_one','manufacturer_name','stockIn','stock_in_price','stockMoney','stockAdd','addStockMoney','saleStockMoney','outStock','stockOutprice','saleOutMoney','overStock','overPrice','overMoney']
  960. const data = this.formatJson(filterVal, this.tableList)
  961. const filename = '进销存查询'
  962. excel.export_json_to_excel({
  963. multiHeader,
  964. header,
  965. merges,
  966. data,
  967. filename
  968. })
  969. })
  970. },
  971. formatJson(filterVal, jsonData) {
  972. return jsonData.map(v => filterVal.map(j => v[j]));
  973. },
  974. toOverCount(){
  975. getGoodOverCount().then(response=>{
  976. if(response.data.state == 1){
  977. var msg = response.data.data.msg
  978. this.$message.success("调试成功")
  979. }
  980. })
  981. }
  982. },
  983. }
  984. </script>