purchaseDrugQuery.vue 44KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398
  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. console.log("arr----------------",arr)
  983. console.log("newArr----------------",arr2)
  984. var total = 0
  985. var totalone_price = 0
  986. var total_two_price = 0
  987. if(arr!=null && arr.length > 0){
  988. for(let i=0;i<arr.length;i++){
  989. totalone_price += arr[i].count * arr[i].price
  990. }
  991. }
  992. if(arr2!=null && arr2.length >0){
  993. for(let i=0;i<arr2.length;i++){
  994. total_two_price += arr2[i].count * arr[i].price
  995. }
  996. }
  997. total = totalone_price + total_two_price
  998. return total
  999. },
  1000. getdrugAddPrice(arr,min_number,min_unit,max_unit,arr2){
  1001. var total = 0
  1002. var totalone =0
  1003. var totaltwo = 0
  1004. var total_price = 0
  1005. if(arr!=null&&arr.length > 0){
  1006. for(let i=0;i<arr.length;i++){
  1007. totalone += arr[i].count * arr[i].xt_drug_warehouse_info.price/min_number
  1008. }
  1009. }
  1010. if(arr2!=null && arr2.length > 0){
  1011. for(let i=0;i<arr2.length;i++){
  1012. totaltwo +=arr2[i].count * arr2[i].xt_drug_warehouse_info.price/min_number
  1013. }
  1014. }
  1015. total = totalone + totaltwo
  1016. total_price =total.toFixed(2)
  1017. return total_price
  1018. },
  1019. drugAddSalePrice(arr,min_number,min_unit,max_unit,arr2){
  1020. var total = 0
  1021. var total_one = 0
  1022. var total_two = 0
  1023. var total_price = 0
  1024. if(arr!=null&&arr.length > 0){
  1025. for(let i=0;i<arr.length;i++){
  1026. total_one += arr[i].count * arr[i].xt_drug_warehouse_info.retail_price
  1027. }
  1028. }
  1029. if(arr2!=null&&arr2.length > 0){
  1030. for(let i=0;i<arr2.length;i++){
  1031. total_two +=arr2[i].count * arr2[i].xt_drug_warehouse_info.retail_price
  1032. }
  1033. }
  1034. total = total_one + total_two
  1035. total_price = total.toFixed(2)
  1036. return total_price
  1037. },
  1038. getDrugOut(arr,min_number,min_unit,max_unit,arr2,arr3){
  1039. var total = 0
  1040. var totalone = 0
  1041. var totaltwo = 0
  1042. var totalthree = 0
  1043. var min_str = ""
  1044. var max_str = ""
  1045. if(arr!=null&&arr.length > 0){
  1046. for(let i=0;i<arr.length;i++){
  1047. totalone +=arr[i].count
  1048. }
  1049. }
  1050. if(arr2!=null && arr2.length>0){
  1051. for(let i=0;i<arr2.length;i++){
  1052. totaltwo +=arr2[i].count
  1053. }
  1054. }
  1055. if(arr3!=null && arr3.length>0){
  1056. for(let i=0;i<arr3.length;i++){
  1057. totalthree +=arr3[i].count
  1058. }
  1059. }
  1060. total = totalone + totaltwo - totalthree
  1061. return total
  1062. },
  1063. getDrugOutOne(arr,min_number,min_unit,max_unit,arr2,arr3){
  1064. var total = 0
  1065. var totalone = 0
  1066. var totaltwo = 0
  1067. var totalthree = 0
  1068. var min_str = ""
  1069. var max_str = ""
  1070. if(arr!=null&&arr.length > 0){
  1071. for(let i=0;i<arr.length;i++){
  1072. totalone +=arr[i].count
  1073. }
  1074. }
  1075. if(arr2!=null && arr2.length>0){
  1076. for(let i=0;i<arr2.length;i++){
  1077. totaltwo +=arr2[i].count
  1078. }
  1079. }
  1080. if(arr3!=null && arr3.length>0){
  1081. for(let i=0;i<arr3.length;i++){
  1082. totalthree +=arr3[i].count
  1083. }
  1084. }
  1085. total = totalone + totaltwo - totalthree
  1086. return total
  1087. },
  1088. getDrugOutPrice(arr,min_number,min_unit,max_unit,arr2,arr3){
  1089. var total_price = 0
  1090. var total_one_price =0
  1091. var total_two_price = 0
  1092. var total_three_price = 0
  1093. var total = 0
  1094. var total_two = 0
  1095. var total_three = 0
  1096. if(arr!=null&&arr.length > 0){
  1097. for(let i=0;i<arr.length;i++){
  1098. total_one_price += arr[i].count * (arr[i].xt_drug_warehouse_info.price/min_number)
  1099. total += arr[i].count
  1100. }
  1101. }
  1102. if(arr2!=null && arr2.length>0){
  1103. for(let i=0;i<arr2.length;i++){
  1104. total_two_price +=arr2[i].count * arr2[i].xt_drug_warehouse_info.price/min_number
  1105. total_two +=arr2[i].count
  1106. }
  1107. }
  1108. if(arr3!=null && arr3.length>0){
  1109. for(let i=0;i<arr3.length;i++){
  1110. total_three_price +=arr3[i].count * arr3[i].xt_drug_warehouse_info.price/min_number
  1111. total_three +=arr3[i].count
  1112. }
  1113. }
  1114. total_price = total_one_price + total_two_price - total_three_price
  1115. if(total_price > 0){
  1116. return total_price.toFixed(2)
  1117. }else{
  1118. return "0.00"
  1119. }
  1120. },
  1121. getDrugOutSaleprice(arr,min_number,min_unit,max_unit,arr3,arr4){
  1122. var total_price = 0
  1123. var total_price_one = 0
  1124. var total_price_two = 0
  1125. var total_price_three = 0
  1126. if(arr!=null&&arr.length > 0){
  1127. for(let i=0;i<arr.length;i++){
  1128. total_price_one += arr[i].count * arr[i].xt_drug_warehouse_info.retail_price
  1129. }
  1130. }
  1131. if(arr3!=null && arr3.length >0){
  1132. for(let i=0;i<arr3.length;i++){
  1133. total_price_two +=arr3[i].count * arr3[i].xt_drug_warehouse_info.retail_price
  1134. }
  1135. }
  1136. if(arr4!=null && arr4.length >0){
  1137. for(let i=0;i<arr4.length;i++){
  1138. total_price_three +=arr4[i].count * arr4[i].xt_drug_warehouse_info.retail_price
  1139. }
  1140. }
  1141. total_price = total_price_one + total_price_two - total_price_three
  1142. if(total_price > 0){
  1143. return total_price.toFixed(2)
  1144. }else{
  1145. return "0.00"
  1146. }
  1147. },
  1148. toPrint(){
  1149. 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})
  1150. },
  1151. exportList: function() {
  1152. for(let i=0;i<this.tableList.length;i++){
  1153. this.tableList[i].index = i+1
  1154. this.tableList[i].query_date = this.start_time+"~"+this.end_time
  1155. this.tableList[i].good_type = this.getDrugTypeName(this.tableList[i].drug_type)
  1156. this.tableList[i].manufacturer_name = this.getManufacturName(this.tableList[i].manufacturer)
  1157. this.tableList[i].dealer_name = this.getDearName(this.tableList[i].dealer)
  1158. 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
  1159. // this.tableList[i].drugInMoney = this.tableList[i].last_price
  1160. }
  1161. import('@/vendor/Export2Excel').then(excel => {
  1162. const multiHeader = [['序号', '查询日期',' 药品类型','药品别名','药品名称','规格&单位','生产产商','经销商','单位', '期初结余' , '', '', '本期增加', '', '', '本期减少' , '', '', '期末结余' , '', '']]
  1163. const header = ['', '','','','','','','','', '数量', '进货金额', '销售金额', '数量', '进货金额', '销售金额', '数量', '进货金额', '销售金额', '数量', '进货金额', '销售金额']
  1164. 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']
  1165. 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']
  1166. const data = this.formatJson(filterVal, this.tableList)
  1167. const filename = '药品进销存查询'
  1168. excel.export_json_to_excel({
  1169. multiHeader,
  1170. header,
  1171. merges,
  1172. data,
  1173. filename
  1174. })
  1175. })
  1176. },
  1177. formatJson(filterVal, jsonData) {
  1178. return jsonData.map(v => filterVal.map(j => v[j]));
  1179. },
  1180. GetDrugStartFlow(total,min_number,min_unit,max_unit){
  1181. // var min_str = ""
  1182. // var max_str = ""
  1183. // if (total < min_number) {
  1184. // min_str = total + min_unit;
  1185. // }
  1186. // if (total == 0) {
  1187. // min_str = "";
  1188. // max_str = "";
  1189. // }
  1190. // if (total >= min_number) {
  1191. // if (parseInt(total / min_number) != 0) {
  1192. // max_str = parseInt(total / min_number) + max_unit;
  1193. // }
  1194. // if (total % min_number != 0) {
  1195. // min_str = (total % min_number) + min_unit;
  1196. // }
  1197. // }
  1198. // if(max_str == "" && min_str == ""){
  1199. // return "0"
  1200. // }else{
  1201. // return max_str + min_str;
  1202. // }
  1203. return total
  1204. },
  1205. GetDrugEndFlow(total,min_number,min_unit,max_unit){
  1206. var min_str = ""
  1207. var max_str = ""
  1208. if (total < min_number) {
  1209. min_str = total + min_unit;
  1210. }
  1211. if (total == 0) {
  1212. min_str = "";
  1213. max_str = "";
  1214. }
  1215. if (total >= min_number) {
  1216. if (parseInt(total / min_number) != 0) {
  1217. max_str = parseInt(total / min_number) + max_unit;
  1218. }
  1219. if (total % min_number != 0) {
  1220. min_str = (total % min_number) + min_unit;
  1221. }
  1222. }
  1223. if(max_str == "" && min_str == ""){
  1224. return "0"
  1225. }else{
  1226. return max_str + min_str;
  1227. }
  1228. },
  1229. toOverCount(){
  1230. getDrugOverCount().then(response=>{
  1231. if(response.data.state == 1){
  1232. var msg = response.data.data.msg
  1233. this.$message.success("调试成功")
  1234. }
  1235. })
  1236. },
  1237. getDearName(id){
  1238. var dear_name = ""
  1239. for(let i=0;i<this.dealerList.length;i++){
  1240. if(id == this.dealerList[i].id){
  1241. dear_name = this.dealerList[i].dealer_name
  1242. }
  1243. }
  1244. return dear_name
  1245. },
  1246. GetDrugOver(totalone,totaltwo,totalthree,min_number,min_unit,max_unit){
  1247. var total = 0
  1248. total = totalone + totaltwo - totalthree
  1249. return total
  1250. }
  1251. }
  1252. }
  1253. </script>