purchaseDrugQuery.vue 44KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396
  1. <template>
  2. <div class="main-contain">
  3. <div class="app-container "
  4. style="padding-left:0px;margin:0px;" v-loading="loading"
  5. element-loading-text="拼命加载中">
  6. <div style="justify-content: space-between;margin: 0px 0 12px 0;display: flex;align-items: center;">
  7. <div>
  8. <span style="font-size:14px;color:#606266">操作时间:</span>
  9. <el-date-picker
  10. size="small"
  11. v-model="start_time"
  12. prefix-icon="el-icon-date"
  13. :editable="false"
  14. style="width: 150px;"
  15. type="date"
  16. placeholder="选择日期时间"
  17. align="right"
  18. format="yyyy-MM-dd"
  19. value-format="yyyy-MM-dd"
  20. :picker-options="pickerOptions"
  21. @change="startTimeChange"
  22. :clearable="false"
  23. ></el-date-picker>
  24. <span>-</span>
  25. <el-date-picker
  26. size="small"
  27. v-model="end_time"
  28. prefix-icon="el-icon-date"
  29. :editable="false"
  30. style="width: 150px;"
  31. type="date"
  32. placeholder="选择日期时间"
  33. align="right"
  34. format="yyyy-MM-dd"
  35. value-format="yyyy-MM-dd"
  36. :picker-options="pickerOptions"
  37. @change="endTimeChange"
  38. :clearable="false"
  39. ></el-date-picker>
  40. <span style="font-size:14px;color:#606266">药品类型:</span>
  41. <el-select v-model="good_type" style="width:200px;margin-right:10px;" placeholder="请选择"
  42. filterable
  43. @change="changeGoodTypeName">
  44. <el-option
  45. v-for="item in drugTypeList"
  46. :key="item.value"
  47. :label="item.name"
  48. :value="item.value">
  49. </el-option>
  50. </el-select>
  51. <el-input v-model="keyword" style="width:200px" placeholder="请输入药品名称或生产厂商" ></el-input>
  52. <el-button type="primary" icon="el-icon-search" @click="seach">搜索</el-button>
  53. </div>
  54. <div>
  55. <el-button type="primary" @click="toPrint">打印</el-button>
  56. <el-button type="primary" @click="exportList">导出</el-button>
  57. </div>
  58. </div>
  59. <el-table
  60. :row-style="{ color: '#303133' }"
  61. :header-cell-style="{
  62. backgroundColor: 'rgb(245, 247, 250)',
  63. color: '#606266'
  64. }"
  65. :data="tableList"
  66. :class="signAndWeighBoxPatients"
  67. border
  68. >
  69. <el-table-column label="药品类型" align="center">
  70. <template slot-scope="scope">
  71. {{getDrugTypeName(scope.row.drug_type)}}
  72. </template>
  73. </el-table-column>
  74. <el-table-column label="药品别名" align="center">
  75. <template slot-scope="scope">
  76. {{scope.row.drug_alias}}
  77. </template>
  78. </el-table-column>
  79. <el-table-column label="药品名称" align="center">
  80. <template slot-scope="scope">
  81. {{scope.row.drug_name}}
  82. </template>
  83. </el-table-column>
  84. <el-table-column label="规格&单位" align="center">
  85. <template slot-scope="scope">
  86. {{scope.row.dose}}{{scope.row.dose_unit}}*{{scope.row.min_number}}{{scope.row.min_unit}}/{{scope.row.max_unit}}
  87. </template>
  88. </el-table-column>
  89. <el-table-column label="生产厂商" align="center">
  90. <template slot-scope="scope">
  91. {{getManufacturName(scope.row.manufacturer)}}
  92. </template>
  93. </el-table-column>
  94. <el-table-column label="经销商" align="center">
  95. <template slot-scope="scope">
  96. {{getDearName(scope.row.dealer)}}
  97. </template>
  98. </el-table-column>
  99. <el-table-column label="单位" align="center">
  100. <template slot-scope="scope">
  101. {{ scope.row.min_unit }}
  102. </template>
  103. </el-table-column>
  104. <el-table-column label="期初结余" align="center">
  105. <el-table-column prop="drugIn" label="数量" width="100" align="center">
  106. </el-table-column>
  107. <el-table-column prop="drugInMoney" label="进货金额" width="100" align="center">
  108. </el-table-column>
  109. <el-table-column prop="drugSaleMoney" label="销售金额" width="100" align="center">
  110. </el-table-column>
  111. </el-table-column>
  112. <el-table-column label="本期增加" align="center">
  113. <el-table-column prop="drugAdd" label="数量" width="100" align="center">
  114. </el-table-column>
  115. <el-table-column prop="drugAddPrice" label="进货金额" width="100" align="center">
  116. </el-table-column>
  117. <el-table-column prop="drugAddSalePrice" label="销售金额" width="100" align="center">
  118. </el-table-column>
  119. </el-table-column>
  120. <el-table-column label="本期减少" align="center">
  121. <el-table-column prop="drugOut" label="数量" width="100" align="center">
  122. </el-table-column>
  123. <el-table-column prop="drugOutPrice" label="进货金额" width="100" align="center">
  124. </el-table-column>
  125. <el-table-column prop="drugOutSalePrice" label="销售金额" width="100" align="center">
  126. </el-table-column>
  127. </el-table-column>
  128. <el-table-column label="期末结余" align="center">
  129. <el-table-column prop="overDrug" label="数量" width="100" align="center">
  130. </el-table-column>
  131. <el-table-column prop="overDrugPrice" label="进货金额" width="100" align="center">
  132. </el-table-column>
  133. <el-table-column prop="oveDrugSaleMoney" label="销售金额" width="100" align="center">
  134. </el-table-column>
  135. </el-table-column>
  136. </el-table>
  137. <el-pagination
  138. @size-change="handleSizeChange"
  139. @current-change="handleCurrentChange"
  140. :page-sizes="[10, 50, 100,200,500,1000]"
  141. :page-size="10"
  142. background
  143. align="right"
  144. style="margin-top:20px;"
  145. layout="total, sizes, prev, pager, next, jumper"
  146. :total="total"
  147. >
  148. </el-pagination>
  149. </div>
  150. </div>
  151. </template>
  152. <script>
  153. import { getStorehouseList,getPurchaseDrugQueryList,getDrugOverCount } from "@/api/drug/drug"
  154. const moment = require('moment')
  155. import { uParseTime } from '@/utils/tools'
  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. drugTypeList:[],
  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.drugTypeList = []
  204. this.getlist()
  205. },
  206. getStorehouseList(){
  207. getStorehouseList().then(response=>{
  208. if(response.data.state == 1){
  209. var houseList = response.data.data.list
  210. var obj = {id:0,storehouse_name:"全部"}
  211. this.houseList.push(obj)
  212. for(let i=0;i<houseList.length;i++){
  213. this.houseList.push(houseList[i])
  214. }
  215. this.manufacturerList = response.data.data.manufacturerList
  216. this.patientList = response.data.data.patientList
  217. this.dealerList = response.data.data.dealerList
  218. }
  219. })
  220. },
  221. getlist(){
  222. this.loading = true
  223. var params = {
  224. good_type:this.good_type,
  225. keyword:this.keyword,
  226. page:this.page,
  227. limit:this.limit,
  228. start_time:this.start_time,
  229. end_time:this.end_time,
  230. }
  231. getPurchaseDrugQueryList(params).then(response=>{
  232. if(response.data.state == 1){
  233. this.loading = false
  234. var list = response.data.data.list
  235. for (let i = 0; i < list.length; i++) {
  236. //期初结余入库
  237. if(list[i].DrugWarehouseInfoStart!=null && list[i].DrugWarehouseInfoStart.length > 0){
  238. for(let j=0;j<list[i].DrugWarehouseInfoStart.length;j++){
  239. if(list[i].max_unit == list[i].DrugWarehouseInfoStart[j].max_unit){
  240. list[i].DrugWarehouseInfoStart[j].count =list[i].min_number * list[i].DrugWarehouseInfoStart[j].count
  241. }
  242. }
  243. }
  244. //期初结余出库
  245. if(list[i].DrugWarehouseOutInfoStart!=null && list[i].DrugWarehouseOutInfoStart.length>0){
  246. for(let j=0;j<list[i].DrugWarehouseOutInfoStart.length;j++){
  247. if(list[i].max_unit == list[i].DrugWarehouseOutInfoStart[j].max_unit){
  248. list[i].DrugWarehouseOutInfoStart[j].count = list[i].DrugWarehouseOutInfoStart[j].count*list[i].min_number
  249. }
  250. }
  251. }
  252. //期初结余退库
  253. if(list[i].WareStartStockCancelInfo!=null && list[i].WareStartStockCancelInfo.length>0){
  254. for(let j=0;j<list[i].WareStartStockCancelInfo.length;j++){
  255. if(list[i].max_unit == list[i].WareStartStockCancelInfo[j].max_unit){
  256. list[i].WareStartStockCancelInfo[j].count = list[i].WareStartStockCancelInfo[j].count*list[i].min_number
  257. }
  258. }
  259. }
  260. //期末结余入库
  261. if(list[i].DrugWarehouseInfoEnd!=null && list[i].DrugWarehouseInfoEnd.length > 0){
  262. for(let j=0;j<list[i].DrugWarehouseInfoEnd.length;j++){
  263. if(list[i].max_unit == list[i].DrugWarehouseInfoEnd[j].max_unit){
  264. list[i].DrugWarehouseInfoEnd[j].count = list[i].min_number * list[i].DrugWarehouseInfoEnd[j].count
  265. }
  266. }
  267. }
  268. //期末结余出库
  269. if(list[i].DrugWarehouseOutInfoEnd!=null && list[i].DrugWarehouseOutInfoEnd.length>0){
  270. for(let j=0;j<list[i].DrugWarehouseOutInfoEnd.length;j++){
  271. if(list[i].max_unit == list[i].DrugWarehouseOutInfoEnd[j].max_unit){
  272. list[i].DrugWarehouseOutInfoEnd[j].count = list[i].DrugWarehouseOutInfoEnd[j].count*list[i].min_number
  273. }
  274. }
  275. }
  276. //期末结余退库
  277. if(list[i].WareEndStockCancelInfo!=null && list[i].WareEndStockCancelInfo.length>0){
  278. for(let j=0;j<list[i].WareEndStockCancelInfo.length;j++){
  279. if(list[i].max_unit == list[i].WareEndStockCancelInfo[j].max_unit){
  280. list[i].WareEndStockCancelInfo[j].count = list[i].WareEndStockCancelInfo[j].count*list[i].min_number
  281. }
  282. }
  283. }
  284. //期中增加
  285. if(list[i].DrugWarehouseInfoStartEnd!=null && list[i].DrugWarehouseInfoStartEnd.length > 0){
  286. for(let j=0;j<list[i].DrugWarehouseInfoStartEnd.length;j++){
  287. if(list[i].max_unit == list[i].DrugWarehouseInfoStartEnd[j].max_unit){
  288. list[i].DrugWarehouseInfoStartEnd[j].count =list[i].min_number * list[i].DrugWarehouseInfoStartEnd[j].count
  289. }
  290. }
  291. }
  292. //期中减少
  293. if(list[i].DrugWarehouseOutInfoStartEnd!=null && list[i].DrugWarehouseOutInfoStartEnd.length > 0){
  294. for(let j=0;j<list[i].DrugWarehouseOutInfoStartEnd.length;j++){
  295. if(list[i].max_unit == list[i].DrugWarehouseOutInfoStartEnd[j].max_unit){
  296. list[i].DrugWarehouseOutInfoStartEnd[j].count =list[i].min_number * list[i].DrugWarehouseOutInfoStartEnd[j].count
  297. }
  298. }
  299. }
  300. //期中退库
  301. if(list[i].WareStartEndStockCancelInfo!=null && list[i].WareStartEndStockCancelInfo.length > 0){
  302. for(let j=0;j<list[i].WareStartEndStockCancelInfo.length;j++){
  303. if(list[i].max_unit == list[i].WareStartEndStockCancelInfo[j].max_unit){
  304. list[i].WareStartEndStockCancelInfo[j].count =list[i].min_number * list[i].WareStartEndStockCancelInfo[j].count
  305. }
  306. }
  307. }
  308. //期初盘盈
  309. if(list[i].WareStartStockInventoryProfit!=null && list[i].WareStartStockInventoryProfit.length > 0){
  310. for(let j=0;j<list[i].WareStartStockInventoryProfit.length;j++){
  311. if(list[i].max_unit == list[i].WareStartStockInventoryProfit[j].max_unit){
  312. list[i].WareStartStockInventoryProfit[j].count = list[i].WareStartStockInventoryProfit[j].count * list[i].min_number
  313. }
  314. }
  315. }
  316. //期初盘亏
  317. if(list[i].WareStartStockInventoryLosses!=null && list[i].WareStartStockInventoryLosses.length > 0){
  318. for(let j=0;j<list[i].WareStartStockInventoryLosses.length;j++){
  319. if(list[i].max_unit == list[i].WareStartStockInventoryLosses[j].max_unit){
  320. list[i].WareStartStockInventoryLosses.count = list[i].WareStartStockInventoryLosses[j].count * list[i].min_number
  321. }
  322. }
  323. }
  324. //期中盘盈
  325. if(list[i].WareStartEndStockInventoryProfit!=null && list[i].WareStartEndStockInventoryProfit.length > 0){
  326. for(let j=0;j<list[i].WareStartEndStockInventoryProfit.length;j++){
  327. if(list[i].max_unit == list[i].WareStartEndStockInventoryProfit[j].max_unit){
  328. list[i].WareStartEndStockInventoryProfit[j].count = list[i].WareStartEndStockInventoryProfit[j].count * list[i].min_number
  329. }
  330. }
  331. }
  332. //期中盘亏
  333. if(list[i].WareStartEndStockInventoryLosses!=null && list[i].WareStartEndStockInventoryLosses.length > 0){
  334. for(let j=0;j<list[i].WareStartEndStockInventoryLosses.length;j++){
  335. if(list[i].max_unit == list[i].WareStartEndStockInventoryLosses[j].max_unit){
  336. list[i].WareStartEndStockInventoryLosses[j].count = list[i].WareStartEndStockInventoryLosses[j].count * list[i].min_number
  337. }
  338. }
  339. }
  340. //期末盘盈
  341. if(list[i].WareEndStockInventoryProfit!=null && list[i].WareEndStockInventoryProfit.length >0){
  342. for(let j=0;j<list[i].WareEndStockInventoryProfit.length;j++){
  343. if(list[i].max_unit == list[i].WareEndStockInventoryProfit[j].max_unit){
  344. list[i].WareEndStockInventoryProfit[j].count = list[i].WareEndStockInventoryProfit[j].count * list[i].min_number
  345. }
  346. }
  347. }
  348. //期末盘亏
  349. if(list[i].WareEndStockInventoryLosses!=null && list[i].WareEndStockInventoryLosses.length > 0){
  350. for(let j=0;j<list[i].WareEndStockInventoryLosses.length;j++){
  351. if(list[i].max_unit == list[i].WareEndStockInventoryLosses[j].max_unit){
  352. list[i].WareEndStockInventoryLosses[j].count = list[i].WareEndStockInventoryLosses[j].count * list[i].min_number
  353. }
  354. }
  355. }
  356. }
  357. console.log("list23323223322332232323322323wode",list)
  358. for(let i=0;i<list.length;i++){
  359. list[i].last_price_in = 0
  360. list[i].drugAddOne= 0
  361. list[i].drugOutOne =0
  362. list[i].drugIn = this.GetDrugStartFlow(list[i].DrugStatFlow.over_count,list[i].min_number,list[i].min_unit,list[i].max_unit)
  363. list[i].drugInMoney = list[i].last_price
  364. list[i].drugSaleMoney = (list[i].drugIn * list[i].drugInMoney).toFixed(2)
  365. list[i].drugAdd = this.drugAddInfo(list[i].DrugWarehouseInfoStartEnd,list[i].min_number,list[i].min_unit,list[i].max_unit,list[i].WareStartEndStockInventoryProfit)
  366. list[i].drugAddOne = this.drugAddInfoOne(list[i].DrugWarehouseInfoStartEnd,list[i].min_number,list[i].min_unit,list[i].max_unit,list[i].WareStartEndStockInventoryProfit)
  367. if(this.org_id == 0 || this.org_id == 10644){
  368. list[i].drugAddPrice = ""
  369. list[i].drugAddSalePrice = this.drugAddInfoOnePirce(list[i].DrugWarehouseInfoStartEnd,list[i].min_number,list[i].min_unit,list[i].max_unit,list[i].WareStartEndStockInventoryProfit)
  370. }else{
  371. list[i].drugAddPrice = list[i].last_price
  372. list[i].drugAddSalePrice = (list[i].drugAdd * list[i].drugAddPrice).toFixed(2)
  373. }
  374. list[i].drugOut= this.getDrugOut(list[i].DrugWarehouseOutInfoStartEnd,list[i].min_number,list[i].min_unit,list[i].max_unit,list[i].WareStartEndStockInventoryLosses,list[i].WareStartEndStockCancelInfo)
  375. list[i].drugOutOne =this.getDrugOutOne(list[i].DrugWarehouseOutInfoStartEnd,list[i].min_number,list[i].min_unit,list[i].max_unit,list[i].WareStartEndStockInventoryLosses,list[i].WareStartEndStockCancelInfo)
  376. list[i].drugOutPrice = list[i].min_price
  377. list[i].drugOutSalePrice = (list[i].drugOut*list[i].drugOutPrice).toFixed(2)
  378. list[i].overDrug = this.GetDrugOver(list[i].DrugStatFlow.over_count,list[i].drugAddOne,list[i].drugOutOne,list[i].min_number,list[i].min_unit,list[i].max_unit)
  379. list[i].overDrugPrice = list[i].last_price
  380. list[i].oveDrugSaleMoney = (list[i].overDrug * list[i].overDrugPrice).toFixed(2)
  381. }
  382. this.tableList = list;
  383. this.total = response.data.data.total
  384. this.manufacturerList = response.data.data.manufacturerList
  385. var drugTypeList = response.data.data.drugTypeList
  386. var obj = {value:0,name:"全部"}
  387. this.drugTypeList.push(obj)
  388. for(let i=0;i<drugTypeList.length;i++){
  389. this.drugTypeList.push(drugTypeList[i])
  390. }
  391. }
  392. })
  393. },
  394. getManufacturName(id){
  395. var manufacturer_name = ""
  396. for(let i=0;i<this.manufacturerList.length;i++){
  397. if(id == this.manufacturerList[i].id){
  398. manufacturer_name = this.manufacturerList[i].manufacturer_name
  399. }
  400. }
  401. return manufacturer_name
  402. },
  403. handleSizeChange(val) {
  404. this.drugTypeList = []
  405. this.limit = val;
  406. this.getlist()
  407. },
  408. handleCurrentChange(val) {
  409. this.page = val;
  410. this.drugTypeList = []
  411. this.getlist()
  412. },
  413. seach(){
  414. this.drugTypeList = []
  415. this.houseList= []
  416. this.getlist()
  417. },
  418. getDrugTypeName(id){
  419. var type_name = ""
  420. for(let i=0;i<this.drugTypeList.length;i++){
  421. if(id == this.drugTypeList[i].value){
  422. type_name = this.drugTypeList[i].name
  423. }
  424. }
  425. return type_name
  426. },
  427. getHouseName(id){
  428. var storehouse_name = ""
  429. for(let i=0;i<this.houseList.length;i++){
  430. if(id == this.houseList[i].id){
  431. storehouse_name = this.houseList[i].storehouse_name
  432. }
  433. }
  434. return storehouse_name
  435. },
  436. getTime(val) {
  437. if(val < 0){
  438. return ""
  439. }
  440. if(val == ""){
  441. return ""
  442. }else {
  443. return uParseTime(val, '{y}-{m}-{d}')
  444. }
  445. },
  446. getName(id){
  447. var name = ""
  448. for(let i=0;i<this.patientList.length;i++){
  449. if(id == this.patientList[i].id){
  450. name = this.patientList[i].name
  451. }
  452. }
  453. return name
  454. },
  455. endTimeChange(){
  456. this.drugTypeList = []
  457. this.getlist()
  458. },
  459. startTimeChange(){
  460. this.drugTypeList = []
  461. this.getlist()
  462. },
  463. getDrugWarehouseInfoOne(arr,min_number,min_unit,max_unit,arr2,arr3,arr4,arr5){
  464. var total = 0
  465. var totalOne =0
  466. var totalTwo = 0
  467. var totalthree= 0
  468. var totalfour = 0
  469. var totalfive = 0
  470. var max_str = "";
  471. var min_str = "";
  472. if(arr!=null && arr.length > 0){
  473. for(let i=0;i<arr.length;i++){
  474. totalOne += arr[i].count
  475. }
  476. }
  477. if(arr2!=null && arr2.length > 0){
  478. for(let i=0;i<arr2.length;i++){
  479. totalTwo += arr2[i].count
  480. }
  481. }
  482. if(arr3!=null && arr3.length > 0){
  483. for(let i=0;i<arr3.length;i++){
  484. totalthree += arr3[i].count
  485. }
  486. }
  487. if(arr4!=null && arr4.length > 0){
  488. for(let i=0;i<arr4.length;i++){
  489. totalfour += arr4[i].count
  490. }
  491. }
  492. if(arr5!=null && arr5.length > 0){
  493. for(let i=0;i<arr5.length;i++){
  494. totalfive += arr5[i].count
  495. }
  496. }
  497. // console.log("totalONE223323232323232",totalOne)
  498. // console.log("totalTwo2oo2o32o3o32o23",totalTwo)
  499. // console.log("totalfive",totalfive)
  500. // console.log("00-------------------------")
  501. total = totalOne - totalTwo + totalthree - totalfour + totalfive
  502. if (total < min_number) {
  503. min_str = total + min_unit;
  504. }
  505. if (total == 0) {
  506. min_str = "";
  507. max_str = "";
  508. }
  509. if (total >= min_number) {
  510. if (parseInt(total / min_number) != 0) {
  511. max_str = parseInt(total / min_number) + max_unit;
  512. }
  513. if (total % min_number != 0) {
  514. min_str = (total % min_number) + min_unit;
  515. }
  516. }
  517. console.log("max_str",max_str)
  518. console.log("min_str",min_str)
  519. if(max_str == "" && min_str == ""){
  520. return "0"
  521. }else{
  522. return max_str + min_str
  523. }
  524. },
  525. getDrugWarehouseInfo(arr,arr4,min_number,min_unit,max_unit,arr2,arr3,arr5){
  526. var total = 0
  527. var total_one= 0
  528. var total_two = 0
  529. var total_three = 0
  530. var total_four = 0
  531. var total_five = 0
  532. var max_str = "";
  533. var min_str = "";
  534. if(arr!=null && arr.length > 0){
  535. for(let i=0;i<arr.length;i++){
  536. total_one += arr[i].count
  537. }
  538. }
  539. if(arr4!=null && arr4.length > 0){
  540. for(let i=0;i<arr4.length;i++){
  541. total_four += arr4[i].count
  542. }
  543. }
  544. if(arr2!=null && arr2.length > 0){
  545. for(let i=0;i<arr2.length;i++){
  546. total_two+= arr2[i].count
  547. }
  548. }
  549. if(arr3!=null && arr3.length >0){
  550. for(let i=0;i<arr3.length;i++){
  551. total_three +=arr3[i].count
  552. }
  553. }
  554. if(arr5!=null && arr5.length >0){
  555. for(let i=0;i<arr5.length;i++){
  556. total_five +=arr5[i].count
  557. }
  558. }
  559. total = total_one - total_four +total_two - total_three + total_five
  560. if(total < 0){
  561. total = 0
  562. }
  563. if (total < min_number) {
  564. min_str = total + min_unit;
  565. }
  566. if (total == 0) {
  567. min_str = "";
  568. max_str = "";
  569. }
  570. if (total >= min_number) {
  571. if (parseInt(total / min_number) != 0) {
  572. max_str = parseInt(total / min_number) + max_unit;
  573. }
  574. if (total % min_number != 0) {
  575. min_str = (total % min_number) + min_unit;
  576. }
  577. }
  578. if(max_str == "" && min_str == ""){
  579. return "0"
  580. }else{
  581. return max_str + min_str;
  582. }
  583. },
  584. getDrugWarehouseInfoStart(arr,min_number,min_unit,max_unit,outArr){
  585. var total = 0
  586. var add_total = 0
  587. var out_total = 0
  588. var max_str = "";
  589. var min_str = "";
  590. if(arr!=null &&arr.length > 0){
  591. for(let i=0;i<arr.length;i++){
  592. add_total += arr[i].warehousing_count
  593. }
  594. }
  595. if(outArr.length > 0){
  596. for(let i=0;i<outArr.length;i++){
  597. out_total+= outArr[i].count
  598. }
  599. }
  600. total = add_total - out_total
  601. if (total < min_number) {
  602. min_str = total + min_unit;
  603. }
  604. if (total == 0) {
  605. min_str = "";
  606. max_str = "";
  607. }
  608. if (total >= min_number) {
  609. if (parseInt(total / min_number) != 0) {
  610. max_str = parseInt(total / min_number) + max_unit;
  611. }
  612. if (total % min_number != 0) {
  613. min_str = (total % min_number) + min_unit;
  614. }
  615. }
  616. return max_str + min_str;
  617. },
  618. getDrugWarehouseInfoMoneyStart(arr,min_number,min_unit,max_unit,last_price,outArr){
  619. var total = 0
  620. var min_str = 0
  621. var max_str = 0
  622. var addTotal = 0
  623. var outTotal = 0
  624. var total_price = 0
  625. if(arr.length > 0){
  626. for(let i=0;i<arr.length;i++){
  627. addTotal += arr[i].warehousing_count
  628. }
  629. }
  630. if(outArr.length > 0){
  631. for(let i=0;i<outArr.length;i++){
  632. outTotal += outArr[i].count
  633. }
  634. }
  635. total = addTotal - outTotal
  636. if (total < min_number) {
  637. min_str = total
  638. }
  639. if (total >= min_number) {
  640. if (parseInt(total / min_number) != 0) {
  641. max_str = parseInt(total / min_number);
  642. }
  643. if (total % min_number != 0) {
  644. min_str = (total % min_number);
  645. }
  646. }
  647. total_price = (max_str * last_price + min_str*(last_price/min_number)).toFixed(2)
  648. return total_price
  649. },
  650. getDrugWarehouseInfoMoney(arr,min_number,min_unit,max_unit,last_price){
  651. var total = 0
  652. var min_str = 0
  653. var max_str = 0
  654. var total_price = 0
  655. if(arr.length > 0){
  656. for(let i=0;i<arr.length;i++){
  657. total += arr[i].stock_max_number + arr[i].stock_min_number
  658. }
  659. }
  660. if (total < min_number) {
  661. min_str = total
  662. }
  663. if (total >= min_number) {
  664. if (parseInt(total / min_number) != 0) {
  665. max_str = parseInt(total / min_number);
  666. }
  667. if (total % min_number != 0) {
  668. min_str = (total % min_number);
  669. }
  670. }
  671. total_price = (max_str * last_price + min_str*(last_price/min_number)).toFixed(2)
  672. return total_price
  673. },
  674. getDrugWarehouseInfoStockAdd(arr,min_number,min_unit,max_unit){
  675. var total = 0
  676. var max_str = "";
  677. var min_str = "";
  678. if(arr.length > 0){
  679. for(let i=0;i<arr.length;i++){
  680. total += arr[i].warehousing_count
  681. }
  682. }
  683. if (total < min_number) {
  684. min_str = total + min_unit;
  685. }
  686. if (total == 0) {
  687. min_str = "";
  688. max_str = "";
  689. }
  690. if (total >= min_number) {
  691. if (parseInt(total / min_number) != 0) {
  692. max_str = parseInt(total / min_number) + max_unit;
  693. }
  694. if (total % min_number != 0) {
  695. min_str = (total % min_number) + min_unit;
  696. }
  697. }
  698. return max_str + min_str;
  699. },
  700. getDrugWarehouseInfoaddMoney(arr,min_number,min_unit,max_unit,last_price){
  701. var total = 0
  702. var min_str = 0
  703. var max_str = 0
  704. var total_price = 0
  705. if(arr.length > 0){
  706. for(let i=0;i<arr.length;i++){
  707. total += arr[i].warehousing_count
  708. }
  709. }
  710. if (total < min_number) {
  711. min_str = total
  712. }
  713. if (total >= min_number) {
  714. if (parseInt(total / min_number) != 0) {
  715. max_str = parseInt(total / min_number);
  716. }
  717. if (total % min_number != 0) {
  718. min_str = (total % min_number);
  719. }
  720. }
  721. total_price = (max_str * last_price + min_str*(last_price/min_number)).toFixed(2)
  722. return total_price
  723. },
  724. getDrugInMoneyOne(arr,min_number,min_unit,max_unit,arr2,arr3,arr4,arr5){
  725. var totalOne = 0
  726. var totalTwo =0
  727. var total_three = 0
  728. var total_four = 0
  729. var totalFive = 0
  730. var total_price = 0
  731. if(arr!=null&&arr.length > 0){
  732. for(let i=0;i<arr.length;i++){
  733. totalOne += (arr[i].count/min_number*arr[i].price) + arr[i].count*(arr[i].price%min_number)
  734. }
  735. }
  736. if(arr2!=null&&arr2.length > 0){
  737. for(let i=0;i<arr2.length;i++){
  738. totalTwo += ((arr2[i].count/min_number) * arr2[i].price) + ((arr2[i].count%min_number)*(arr2[i].price/min_number))
  739. }
  740. }
  741. if(arr3!=null&&arr3.length > 0){
  742. for(let i=0;i<arr3.length;i++){
  743. total_three+=arr3[i].count* arr3[i].xt_drug_warehouse_info.retail_price
  744. }
  745. }
  746. if(arr4!=null&&arr4.length > 0){
  747. for(let i=0;i<arr4.length;i++){
  748. total_four+=arr4[i].count * arr4[i].xt_drug_warehouse_info.retail_price
  749. }
  750. }
  751. if(arr5!=null&&arr5.length > 0){
  752. for(let i=0;i<arr5.length;i++){
  753. totalFive += ((arr5[i].count/min_number) * arr5[i].price) + ((arr5[i].count%min_number)*(arr5[i].price/min_number))
  754. }
  755. }
  756. total_price =(totalOne - totalTwo + total_three - total_four + totalFive).toFixed(2)
  757. if(total_price >0){
  758. return total_price
  759. }else{
  760. return "0.00"
  761. }
  762. },
  763. getDrugInMoney(arr,arr4,min_number,min_unit,max_unit,arr2,arr3,arr5){
  764. var total_price = 0
  765. var total_one_price = 0
  766. var total_two_price = 0
  767. var total_four_price =0
  768. var total_three_price = 0
  769. var total_five_price = 0
  770. if(arr!=null&&arr.length > 0){
  771. for(let i=0;i<arr.length;i++){
  772. total_one_price += arr[i].count * (arr[i].price/min_number) + arr[i].count * (arr[i].price%min_number)
  773. }
  774. }
  775. if(arr4!=null && arr4.length > 0){
  776. for(let i=0;i<arr4.length;i++){
  777. // total_four_price +=arr4[i].count * arr4[i].xt_drug_warehouse_info.price/min_number
  778. total_four_price+= ((arr4[i].count/min_number) * arr4[i].price) + ((arr4[i].count%min_number)*(arr4[i].price/min_number))
  779. }
  780. }
  781. if(arr2!=null && arr2.length > 0){
  782. for(let i=0;i<arr2.length;i++){
  783. total_two_price += arr2[i].count * arr2[i].xt_drug_warehouse_info.price/min_number
  784. }
  785. }
  786. if(arr3!=null && arr3.length > 0){
  787. for(let i=0;i<arr3.length;i++){
  788. total_three_price += arr3[i].count * arr3[i].xt_drug_warehouse_info.price/min_number
  789. }
  790. }
  791. if(arr5!=null && arr5.length > 0){
  792. for(let i=0;i<arr5.length;i++){
  793. total_five_price += arr5[i].count * arr5[i].xt_drug_warehouse_info.price/min_number
  794. }
  795. }
  796. total_price = total_one_price - total_four_price + total_two_price - total_three_price + total_five_price
  797. if(total_price > 0){
  798. return total_price.toFixed(2)
  799. }else{
  800. return "0.00"
  801. }
  802. },
  803. getSaleMoney(arr,arr4,min_number,min_unit,max_unit,arr2,arr3,arr5){
  804. var total_price = 0
  805. var total_price_one = 0
  806. var total_price_two = 0
  807. var total_price_four = 0
  808. var total_price_three =0
  809. var total_price_five = 0
  810. if(arr!=null&&arr.length > 0){
  811. for(let i=0;i<arr.length;i++){
  812. total_price_one += arr[i].count * arr[i].xt_drug_warehouse_info.retail_price
  813. }
  814. }
  815. if(arr4!=null && arr4.length>0){
  816. for(let i=0;i<arr4.length > 0;i++){
  817. total_price_four += arr4[i].count * arr4[i].xt_drug_warehouse_info.retail_price
  818. }
  819. }
  820. if(arr2!=null && arr2.length > 0){
  821. for(let i=0;i<arr2.length;i++){
  822. total_price_two += arr2[i].count * arr2[i].xt_drug_warehouse_info.retail_price
  823. }
  824. }
  825. if(arr3!=null && arr3.length > 0){
  826. for(let i=0;i<arr3.length;i++){
  827. total_price_three += arr3[i].count * arr3[i].xt_drug_warehouse_info.retail_price
  828. }
  829. }
  830. if(arr5!=null && arr5.length > 0){
  831. for(let i=0;i<arr5.length;i++){
  832. total_price_five += arr5[i].count * arr5[i].xt_drug_warehouse_info.retail_price
  833. }
  834. }
  835. total_price = total_price_one - total_price_four + total_price_two - total_price_three + total_price_five
  836. if(total_price >0){
  837. return total_price.toFixed(2)
  838. }else{
  839. return "0.00"
  840. }
  841. },
  842. getSaleMoneyOne(arr,min_number,min_unit,max_unit,arr2,arr3,arr4,arr5){
  843. var totalOne = 0
  844. var totalTwo =0
  845. var total_price = 0
  846. var total_three= 0
  847. var total_four = 0
  848. var total_five = 0
  849. if(arr!=null&&arr.length > 0){
  850. for(let i=0;i<arr.length;i++){
  851. totalOne += arr[i].count*arr[i].xt_drug_warehouse_info.retail_price
  852. }
  853. }
  854. if(arr2!=null&&arr2.length > 0){
  855. for(let i=0;i<arr2.length;i++){
  856. totalTwo += arr2[i].count * arr2[i].xt_drug_warehouse_info.retail_price
  857. }
  858. }
  859. if(arr3!=null&&arr3.length > 0){
  860. for(let i=0;i<arr3.length;i++){
  861. total_three+=arr3[i].count* arr3[i].xt_drug_warehouse_info.retail_price
  862. }
  863. }
  864. if(arr4!=null&&arr4.length > 0){
  865. for(let i=0;i<arr4.length;i++){
  866. total_four+=arr4[i].count * arr4[i].xt_drug_warehouse_info.retail_price
  867. }
  868. }
  869. if(arr5!=null&&arr5.length > 0){
  870. for(let i=0;i<arr5.length;i++){
  871. total_five+=arr5[i].count * arr5[i].xt_drug_warehouse_info.retail_price
  872. }
  873. }
  874. // console.log("total_one",totalOne)
  875. // console.log("totalTwo",totalTwo)
  876. // console.log("total_three",total_three)
  877. // console.log("total_four",total_four)
  878. // console.log("total_pricewode",(totalOne - totalTwo+total_three - total_four).toFixed(2))
  879. total_price =(totalOne - totalTwo+total_three - total_four + total_five).toFixed(2)
  880. if(total_price > 0){
  881. return total_price
  882. }else{
  883. return "0.00"
  884. }
  885. },
  886. getDrugWarehouseOutInfo(arr,min_number,min_unit,max_unit){
  887. var total = 0
  888. var max_str = "";
  889. var min_str = "";
  890. if(arr.length > 0){
  891. for(let i=0;i<arr.length;i++){
  892. total += arr[i].count
  893. }
  894. }
  895. if (total < min_number) {
  896. min_str = total + min_unit;
  897. }
  898. if (total == 0) {
  899. min_str = "";
  900. max_str = "";
  901. }
  902. if (total >= min_number) {
  903. if (parseInt(total / min_number) != 0) {
  904. max_str = parseInt(total / min_number) + max_unit;
  905. }
  906. if (total % min_number != 0) {
  907. min_str = (total % min_number) + min_unit;
  908. }
  909. }
  910. return max_str + min_str;
  911. },
  912. getDrugWarehouseOutMoney(arr,min_number,min_unit,max_unit,last_price){
  913. var total = 0
  914. var min_str = 0
  915. var max_str = 0
  916. var total_price = 0
  917. if(arr.length > 0){
  918. for(let i=0;i<arr.length;i++){
  919. total += arr[i].count
  920. }
  921. }
  922. if (total < min_number) {
  923. min_str = total
  924. }
  925. if (total >= min_number) {
  926. if (parseInt(total / min_number) != 0) {
  927. max_str = parseInt(total / min_number);
  928. }
  929. if (total % min_number != 0) {
  930. min_str = (total % min_number);
  931. }
  932. total_price = (max_str * last_price + min_str*(last_price/min_number)).toFixed(2)
  933. return total_price
  934. }
  935. },
  936. open(){
  937. // this.start_time = moment().year(2022).month(10).date(4).format('YYYY-MM-DD')
  938. this.start_time = moment().startOf('month').format('YYYY-MM-DD')
  939. this.end_time = moment(new Date()).add('year',0).format("YYYY-MM-DD")
  940. this.houseList= []
  941. this.drugTypeList = []
  942. this.getStorehouseList()
  943. this.getlist()
  944. },
  945. drugAddInfo(arr,min_number,min_unit,max_unit,arr2){
  946. var total = 0
  947. var totalone = 0
  948. var totaltwo = 0
  949. var max_str = "";
  950. var min_str = "";
  951. if(arr!=null && arr.length > 0){
  952. for(let i=0;i<arr.length;i++){
  953. totalone += arr[i].count
  954. }
  955. }
  956. if(arr2!=null && arr2.length >0){
  957. for(let i=0;i<arr2.length;i++){
  958. totaltwo += arr2[i].count
  959. }
  960. }
  961. total = totalone + totaltwo
  962. return total
  963. },
  964. drugAddInfoOne(arr,min_number,min_unit,max_unit,arr2){
  965. var total = 0
  966. var totalone = 0
  967. var totaltwo = 0
  968. if(arr!=null && arr.length > 0){
  969. for(let i=0;i<arr.length;i++){
  970. totalone += arr[i].count
  971. }
  972. }
  973. if(arr2!=null && arr2.length >0){
  974. for(let i=0;i<arr2.length;i++){
  975. totaltwo += arr2[i].count
  976. }
  977. }
  978. total = totalone + totaltwo
  979. return total
  980. },
  981. drugAddInfoOnePirce(arr,min_number,min_unit,max_unit,arr2){
  982. var total = 0
  983. var totalone_price = 0
  984. var total_two_price = 0
  985. if(arr!=null && arr.length > 0){
  986. for(let i=0;i<arr.length;i++){
  987. totalone_price += arr[i].count * arr[i].price
  988. }
  989. }
  990. if(arr2!=null && arr2.length >0){
  991. for(let i=0;i<arr2.length;i++){
  992. total_two_price += arr2[i].count * arr[i].price
  993. }
  994. }
  995. total = totalone_price + total_two_price
  996. return total
  997. },
  998. getdrugAddPrice(arr,min_number,min_unit,max_unit,arr2){
  999. var total = 0
  1000. var totalone =0
  1001. var totaltwo = 0
  1002. var total_price = 0
  1003. if(arr!=null&&arr.length > 0){
  1004. for(let i=0;i<arr.length;i++){
  1005. totalone += arr[i].count * arr[i].xt_drug_warehouse_info.price/min_number
  1006. }
  1007. }
  1008. if(arr2!=null && arr2.length > 0){
  1009. for(let i=0;i<arr2.length;i++){
  1010. totaltwo +=arr2[i].count * arr2[i].xt_drug_warehouse_info.price/min_number
  1011. }
  1012. }
  1013. total = totalone + totaltwo
  1014. total_price =total.toFixed(2)
  1015. return total_price
  1016. },
  1017. drugAddSalePrice(arr,min_number,min_unit,max_unit,arr2){
  1018. var total = 0
  1019. var total_one = 0
  1020. var total_two = 0
  1021. var total_price = 0
  1022. if(arr!=null&&arr.length > 0){
  1023. for(let i=0;i<arr.length;i++){
  1024. total_one += arr[i].count * arr[i].xt_drug_warehouse_info.retail_price
  1025. }
  1026. }
  1027. if(arr2!=null&&arr2.length > 0){
  1028. for(let i=0;i<arr2.length;i++){
  1029. total_two +=arr2[i].count * arr2[i].xt_drug_warehouse_info.retail_price
  1030. }
  1031. }
  1032. total = total_one + total_two
  1033. total_price = total.toFixed(2)
  1034. return total_price
  1035. },
  1036. getDrugOut(arr,min_number,min_unit,max_unit,arr2,arr3){
  1037. var total = 0
  1038. var totalone = 0
  1039. var totaltwo = 0
  1040. var totalthree = 0
  1041. var min_str = ""
  1042. var max_str = ""
  1043. if(arr!=null&&arr.length > 0){
  1044. for(let i=0;i<arr.length;i++){
  1045. totalone +=arr[i].count
  1046. }
  1047. }
  1048. if(arr2!=null && arr2.length>0){
  1049. for(let i=0;i<arr2.length;i++){
  1050. totaltwo +=arr2[i].count
  1051. }
  1052. }
  1053. if(arr3!=null && arr3.length>0){
  1054. for(let i=0;i<arr3.length;i++){
  1055. totalthree +=arr3[i].count
  1056. }
  1057. }
  1058. total = totalone + totaltwo - totalthree
  1059. return total
  1060. },
  1061. getDrugOutOne(arr,min_number,min_unit,max_unit,arr2,arr3){
  1062. var total = 0
  1063. var totalone = 0
  1064. var totaltwo = 0
  1065. var totalthree = 0
  1066. var min_str = ""
  1067. var max_str = ""
  1068. if(arr!=null&&arr.length > 0){
  1069. for(let i=0;i<arr.length;i++){
  1070. totalone +=arr[i].count
  1071. }
  1072. }
  1073. if(arr2!=null && arr2.length>0){
  1074. for(let i=0;i<arr2.length;i++){
  1075. totaltwo +=arr2[i].count
  1076. }
  1077. }
  1078. if(arr3!=null && arr3.length>0){
  1079. for(let i=0;i<arr3.length;i++){
  1080. totalthree +=arr3[i].count
  1081. }
  1082. }
  1083. total = totalone + totaltwo - totalthree
  1084. return total
  1085. },
  1086. getDrugOutPrice(arr,min_number,min_unit,max_unit,arr2,arr3){
  1087. var total_price = 0
  1088. var total_one_price =0
  1089. var total_two_price = 0
  1090. var total_three_price = 0
  1091. var total = 0
  1092. var total_two = 0
  1093. var total_three = 0
  1094. if(arr!=null&&arr.length > 0){
  1095. for(let i=0;i<arr.length;i++){
  1096. total_one_price += arr[i].count * (arr[i].xt_drug_warehouse_info.price/min_number)
  1097. total += arr[i].count
  1098. }
  1099. }
  1100. if(arr2!=null && arr2.length>0){
  1101. for(let i=0;i<arr2.length;i++){
  1102. total_two_price +=arr2[i].count * arr2[i].xt_drug_warehouse_info.price/min_number
  1103. total_two +=arr2[i].count
  1104. }
  1105. }
  1106. if(arr3!=null && arr3.length>0){
  1107. for(let i=0;i<arr3.length;i++){
  1108. total_three_price +=arr3[i].count * arr3[i].xt_drug_warehouse_info.price/min_number
  1109. total_three +=arr3[i].count
  1110. }
  1111. }
  1112. total_price = total_one_price + total_two_price - total_three_price
  1113. if(total_price > 0){
  1114. return total_price.toFixed(2)
  1115. }else{
  1116. return "0.00"
  1117. }
  1118. },
  1119. getDrugOutSaleprice(arr,min_number,min_unit,max_unit,arr3,arr4){
  1120. var total_price = 0
  1121. var total_price_one = 0
  1122. var total_price_two = 0
  1123. var total_price_three = 0
  1124. if(arr!=null&&arr.length > 0){
  1125. for(let i=0;i<arr.length;i++){
  1126. total_price_one += arr[i].count * arr[i].xt_drug_warehouse_info.retail_price
  1127. }
  1128. }
  1129. if(arr3!=null && arr3.length >0){
  1130. for(let i=0;i<arr3.length;i++){
  1131. total_price_two +=arr3[i].count * arr3[i].xt_drug_warehouse_info.retail_price
  1132. }
  1133. }
  1134. if(arr4!=null && arr4.length >0){
  1135. for(let i=0;i<arr4.length;i++){
  1136. total_price_three +=arr4[i].count * arr4[i].xt_drug_warehouse_info.retail_price
  1137. }
  1138. }
  1139. total_price = total_price_one + total_price_two - total_price_three
  1140. if(total_price > 0){
  1141. return total_price.toFixed(2)
  1142. }else{
  1143. return "0.00"
  1144. }
  1145. },
  1146. toPrint(){
  1147. this.$router.push({path:"/drugs/purchase/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})
  1148. },
  1149. exportList: function() {
  1150. for(let i=0;i<this.tableList.length;i++){
  1151. this.tableList[i].index = i+1
  1152. this.tableList[i].query_date = this.start_time+"~"+this.end_time
  1153. this.tableList[i].good_type = this.getDrugTypeName(this.tableList[i].drug_type)
  1154. this.tableList[i].manufacturer_name = this.getManufacturName(this.tableList[i].manufacturer)
  1155. this.tableList[i].dealer_name = this.getDearName(this.tableList[i].dealer)
  1156. this.tableList[i].specification_name = this.tableList[i].dose + this.tableList[i].dose_unit +"*"+this.tableList[i].min_number + this.tableList[i].min_unit+"/"+this.tableList[i].max_unit
  1157. // this.tableList[i].drugInMoney = this.tableList[i].last_price
  1158. }
  1159. import('@/vendor/Export2Excel').then(excel => {
  1160. const multiHeader = [['序号', '查询日期',' 药品类型','药品别名','药品名称','规格&单位','生产产商','经销商','单位', '期初结余' , '', '', '本期增加', '', '', '本期减少' , '', '', '期末结余' , '', '']]
  1161. const header = ['', '','','','','','','','', '数量', '进货金额', '销售金额', '数量', '进货金额', '销售金额', '数量', '进货金额', '销售金额', '数量', '进货金额', '销售金额']
  1162. 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']
  1163. const filterVal = ['index', 'query_date', 'good_type','drug_alias','drug_name','specification_name','manufacturer_name','dealer_name','min_unit','drugIn','drugInMoney','drugSaleMoney','drugAdd','drugAddPrice','drugAddSalePrice','drugOut','drugOutPrice','drugOutSalePrice','overDrug','overDrugPrice','oveDrugSaleMoney']
  1164. const data = this.formatJson(filterVal, this.tableList)
  1165. const filename = '药品进销存查询'
  1166. excel.export_json_to_excel({
  1167. multiHeader,
  1168. header,
  1169. merges,
  1170. data,
  1171. filename
  1172. })
  1173. })
  1174. },
  1175. formatJson(filterVal, jsonData) {
  1176. return jsonData.map(v => filterVal.map(j => v[j]));
  1177. },
  1178. GetDrugStartFlow(total,min_number,min_unit,max_unit){
  1179. // var min_str = ""
  1180. // var max_str = ""
  1181. // if (total < min_number) {
  1182. // min_str = total + min_unit;
  1183. // }
  1184. // if (total == 0) {
  1185. // min_str = "";
  1186. // max_str = "";
  1187. // }
  1188. // if (total >= min_number) {
  1189. // if (parseInt(total / min_number) != 0) {
  1190. // max_str = parseInt(total / min_number) + max_unit;
  1191. // }
  1192. // if (total % min_number != 0) {
  1193. // min_str = (total % min_number) + min_unit;
  1194. // }
  1195. // }
  1196. // if(max_str == "" && min_str == ""){
  1197. // return "0"
  1198. // }else{
  1199. // return max_str + min_str;
  1200. // }
  1201. return total
  1202. },
  1203. GetDrugEndFlow(total,min_number,min_unit,max_unit){
  1204. var min_str = ""
  1205. var max_str = ""
  1206. if (total < min_number) {
  1207. min_str = total + min_unit;
  1208. }
  1209. if (total == 0) {
  1210. min_str = "";
  1211. max_str = "";
  1212. }
  1213. if (total >= min_number) {
  1214. if (parseInt(total / min_number) != 0) {
  1215. max_str = parseInt(total / min_number) + max_unit;
  1216. }
  1217. if (total % min_number != 0) {
  1218. min_str = (total % min_number) + min_unit;
  1219. }
  1220. }
  1221. if(max_str == "" && min_str == ""){
  1222. return "0"
  1223. }else{
  1224. return max_str + min_str;
  1225. }
  1226. },
  1227. toOverCount(){
  1228. getDrugOverCount().then(response=>{
  1229. if(response.data.state == 1){
  1230. var msg = response.data.data.msg
  1231. this.$message.success("调试成功")
  1232. }
  1233. })
  1234. },
  1235. getDearName(id){
  1236. var dear_name = ""
  1237. for(let i=0;i<this.dealerList.length;i++){
  1238. if(id == this.dealerList[i].id){
  1239. dear_name = this.dealerList[i].dealer_name
  1240. }
  1241. }
  1242. return dear_name
  1243. },
  1244. GetDrugOver(totalone,totaltwo,totalthree,min_number,min_unit,max_unit){
  1245. var total = 0
  1246. total = totalone + totaltwo - totalthree
  1247. return total
  1248. }
  1249. }
  1250. }
  1251. </script>