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

purchaseNewStockQuery.vue 35KB

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