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

purchaseStockQuery.vue 31KB

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