purchaseNewStockQuery.vue 45KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404
  1. <template>
  2. <div class="main-contain">
  3. <div class="app-container "
  4. style="padding-left:0px;margin:0px;"
  5. v-loading="loading"
  6. element-loading-text="拼命加载中">
  7. <div style="justify-content: space-between;margin: 0px 0 12px 0;display: flex;align-items: center;">
  8. <div>
  9. <span style="font-size:14px;color:#606266">操作时间:</span>
  10. <el-date-picker
  11. size="small"
  12. v-model="start_time"
  13. prefix-icon="el-icon-date"
  14. :editable="false"
  15. style="width: 150px;"
  16. type="date"
  17. placeholder="选择日期时间"
  18. align="right"
  19. format="yyyy-MM-dd"
  20. value-format="yyyy-MM-dd"
  21. :picker-options="pickerOptions"
  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. :clearable="false"
  38. ></el-date-picker>
  39. <el-button type="primary" icon="el-icon-search" @click="getAllQuery">查询</el-button>
  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 goodTypeList"
  46. :key="item.id"
  47. :label="item.type_name"
  48. :value="item.id">
  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" size="small" @click="toOverCount">调试</el-button> -->
  56. <el-button type="primary" size="small" @click="toPrint">打印</el-button>
  57. <el-button type="primary" size="small" @click="exportList">导出</el-button>
  58. </div>
  59. </div>
  60. <el-table
  61. :row-style="{ color: '#303133' }"
  62. :header-cell-style="{
  63. backgroundColor: 'rgb(245, 247, 250)',
  64. color: '#606266'
  65. }"
  66. :data="tableList"
  67. :class="signAndWeighBoxPatients"
  68. border
  69. >
  70. <el-table-column label="耗材编码" align="center" v-if="org_id ==9956 || org_id == 0">
  71. <template slot-scope="scope">
  72. <span>{{ scope.row.good_number?scope.row.good_number:"" }}</span>
  73. </template>
  74. </el-table-column>
  75. <el-table-column label="国家编码" align="center">
  76. <template slot-scope="scope">
  77. <span>{{ scope.row.social_security_directory_code?scope.row.social_security_directory_code:"" }}</span>
  78. </template>
  79. </el-table-column>
  80. <el-table-column label="耗材类型" align="center">
  81. <template slot-scope="scope">
  82. {{getGoodTypeName(scope.row.good_type_id)}}
  83. </template>
  84. </el-table-column>
  85. <el-table-column label="耗材名称" align="center">
  86. <template slot-scope="scope">
  87. {{scope.row.good_name}}
  88. </template>
  89. </el-table-column>
  90. <el-table-column label="规格&单位" align="center">
  91. <template slot-scope="scope">
  92. {{scope.row.specification_name}}/{{scope.row.packing_unit}}
  93. </template>
  94. </el-table-column>
  95. <el-table-column label="生产厂商" align="center" v-if="org_id!=10679">
  96. <template slot-scope="scope">
  97. {{getManufacturName(scope.row.manufacturer)}}
  98. </template>
  99. </el-table-column>
  100. <el-table-column label="经销商" align="center">
  101. <template slot-scope="scope">
  102. {{getDearName(scope.row.dealer)}}
  103. </template>
  104. </el-table-column>
  105. <el-table-column label="期初结余" align="center">
  106. <el-table-column prop="stockIn" label="数量" width="100">
  107. </el-table-column>
  108. <el-table-column prop="stock_in_price" label="进货金额" width="100">
  109. </el-table-column>
  110. <el-table-column prop="stockMoney" label="销售金额" width="100">
  111. </el-table-column>
  112. </el-table-column>
  113. <el-table-column label="本期增加" align="center">
  114. <el-table-column prop="stockAdd" label="数量" width="100">
  115. </el-table-column>
  116. <el-table-column prop="addStockMoney" label="进货金额" width="100">
  117. </el-table-column>
  118. <el-table-column prop="saleStockMoney" label="销售金额" width="100">
  119. </el-table-column>
  120. </el-table-column>
  121. <el-table-column label="本期减少" align="center">
  122. <el-table-column prop="outStock" label="数量" width="100">
  123. </el-table-column>
  124. <el-table-column prop="stockOutprice" label="进货金额" width="100">
  125. </el-table-column>
  126. <el-table-column prop="saleOutMoney" label="销售金额" width="100">
  127. </el-table-column>
  128. </el-table-column>
  129. <el-table-column label="期末结余" align="center">
  130. <el-table-column prop="overStock" label="数量" width="100">
  131. </el-table-column>
  132. <el-table-column prop="overPrice" label="进货金额" width="100">
  133. </el-table-column>
  134. <el-table-column prop="overMoney" label="销售金额" width="100">
  135. </el-table-column>
  136. </el-table-column>
  137. </el-table>
  138. <el-pagination
  139. @size-change="handleSizeChange"
  140. @current-change="handleCurrentChange"
  141. :page-sizes="[10, 50, 100,200,300,400,500,1000]"
  142. :page-size="10"
  143. background
  144. align="right"
  145. style="margin-top:20px;"
  146. layout="total, sizes, prev, pager, next, jumper"
  147. :total="total"
  148. >
  149. </el-pagination>
  150. </div>
  151. </div>
  152. </template>
  153. <script>
  154. import { getStorehouseList,getNewPurchaseStockQuery,getGoodOverCount } from "@/api/drug/drug"
  155. import {
  156. getStockDrugCount
  157. } from "@/api/stock";
  158. import { uParseTime } from '@/utils/tools'
  159. const moment = require('moment')
  160. export default {
  161. data(){
  162. return{
  163. tableList:[],
  164. goodList:[
  165. {id:1,name:"全部耗材"},
  166. {id:2,name:"库存预警"},
  167. ],
  168. houseList:[],
  169. storehouse_id:0,
  170. good_type:0,
  171. multipleSelection: [],
  172. signAndWeighBoxPatients: "sign-and-weigh-box-patients",
  173. manufacturerList:[],
  174. limit:10,
  175. page:1,
  176. total:0,
  177. keyword:"",
  178. goodTypeList:[],
  179. start_time:"",
  180. end_time:"",
  181. countList:[],
  182. outCountList:[],
  183. autoCountList:[],
  184. cancelCountList:[],
  185. org_id:this.$store.getters.xt_user.org_id,
  186. dialogVisible:false,
  187. start_first_time:"",
  188. end_first_time:"",
  189. tableData:[],
  190. good_id:0,
  191. patientList:[],
  192. good_name:"",
  193. specification_name:"",
  194. loading:false,
  195. pickerOptions:{ //禁用当前日期之前的日期
  196. disabledDate(v) {
  197. return v.getTime() < 1667491200000
  198. },
  199. },
  200. dealerList:[],
  201. medicalInsuranceLevelList:[]
  202. }
  203. },
  204. methods:{
  205. changeStorehouseName(){
  206. },
  207. changeGoodTypeName(){
  208. this.getlist()
  209. },
  210. getStorehouseList(){
  211. getStorehouseList().then(response=>{
  212. if(response.data.state == 1){
  213. var houseList = response.data.data.list
  214. var obj = {id:0,storehouse_name:"全部"}
  215. this.houseList.push(obj)
  216. for(let i=0;i<houseList.length;i++){
  217. this.houseList.push(houseList[i])
  218. }
  219. this.manufacturerList = response.data.data.manufacturerList
  220. var obj = {id:0,type_name:"全部"}
  221. this.goodTypeList.push(obj)
  222. var goodTypeList = response.data.data.goodTypeList
  223. for(let i=0;i<goodTypeList.length;i++){
  224. this.goodTypeList.push(goodTypeList[i])
  225. }
  226. this.patientList = response.data.data.patientList
  227. this.dealerList = response.data.data.dealerList
  228. }
  229. })
  230. },
  231. getlist(){
  232. this.loading = true
  233. var params = {
  234. good_type:this.good_type,
  235. keyword:this.keyword,
  236. page:this.page,
  237. limit:this.limit,
  238. start_time:this.start_time,
  239. end_time:this.end_time,
  240. }
  241. getNewPurchaseStockQuery(params).then(response=>{
  242. if(response.data.state == 1){
  243. var list = response.data.data.list
  244. this.loading = false
  245. for(let i=0;i<list.length;i++){
  246. if(this.org_id ==10210 || this.org_id ==10215 || this.org_id == 10265){
  247. list[i].stockIn = list[i].GoodStartFlowInfo.over_count
  248. }else{
  249. console.log("HHAHHAHA",list[i].id)
  250. console.log("耗材id",list[i].specification_name)
  251. console.log("入库",this.getAllStockIn(list[i].StWarehousingInfoTwo))
  252. console.log("盘盈",this.getAllStockInFlow(list[i].WareStartInStockFlow))
  253. console.log("出库",this.getAllOutStockIn(list[i].WarehouseOutInfoTenty) )
  254. console.log("盘亏",this.getAllStockOutFlow(list[i].WareStartOutStockFlow))
  255. //针对武穴软水盐的问题
  256. if(list[i].id== 5052){
  257. list[i].stockIn = list[i].GoodStartFlowInfo.over_count
  258. }else{
  259. list[i].stockIn = this.getAllStockIn(list[i].StWarehousingInfoTwo) + this.getAllStockInFlow(list[i].WareStartInStockFlow) - this.getAllOutStockIn(list[i].WarehouseOutInfoTenty) - this.getAllStockOutFlow(list[i].WareStartOutStockFlow)
  260. if(list[i].stockIn <0){
  261. list[i].stockIn =0
  262. }
  263. }
  264. }
  265. if(this.org_id ==10697 || this.org_id == 0){
  266. list[i].stock_in_price = list[i].buy_price
  267. list[i].stockMoney = (list[i].buy_price * list[i].stockIn).toFixed(2)
  268. }else if(this.org_id ==9671){
  269. list[i].stock_in_price = list[i].buy_price
  270. list[i].stockMoney = (list[i].buy_price * list[i].stockIn).toFixed(2)
  271. }else if(this.org_id == 10644 || this.org_id == 10752){
  272. list[i].stock_in_price = "/"
  273. console.log("val1",this.getAllStockInPrice(list[i].StWarehousingInfoTwo))
  274. console.log("val2",this.getAllStockInFlowPrice(list[i].WareStartInStockFlow))
  275. console.log("val3",this.getAllOutStockInPrice(list[i].WarehouseOutInfoTenty) )
  276. console.log("val4",this.getAllStockOutFlowPrice(list[i].WareStartOutStockFlow))
  277. list[i].stockMoney = parseFloat(this.getAllStockInPrice(list[i].StWarehousingInfoTwo)) +parseFloat(this.getAllStockInFlowPrice(list[i].WareStartInStockFlow)) - parseFloat(this.getAllOutStockInPrice(list[i].WarehouseOutInfoTenty)) - parseFloat(this.getAllStockOutFlowPrice(list[i].WareStartOutStockFlow))
  278. console.log("剩余33333333 ",list[i].stockMoney)
  279. if(list[i].stockMoney>0){
  280. list[i].stockMoney = list[i].stockMoney.toFixed(2)
  281. }
  282. }else{
  283. list[i].stock_in_price = "/"
  284. list[i].stockMoney = "/"
  285. }
  286. list[i].stockAdd = this.getWarehouseInfoOne(list[i].StartFlowWarehouseInfo,list[i].WareStartEndStockInventoryProfit)//期间增加
  287. if(this.org_id ==10697){
  288. list[i].addStockMoney = list[i].buy_price
  289. list[i].saleStockMoney = (list[i].buy_price *list[i].stockAdd).toFixed(2)
  290. }else if(this.org_id == 0){
  291. list[i].addStockMoney = list[i].buy_price
  292. list[i].saleStockMoney = (list[i].buy_price *list[i].stockAdd).toFixed(2)
  293. } else if(this.org_id == 10644 || this.org_id == 10752){
  294. list[i].addStockMoney = "/"
  295. list[i].saleStockMoney = this.getWarehouseInfoOnePrice(list[i].StartFlowWarehouseInfo,list[i].WareStartEndStockInventoryProfit)
  296. } else{
  297. list[i].addStockMoney = "/"
  298. list[i].saleStockMoney = "/"
  299. }
  300. list[i].outStock = this.getWarehosueOutInfo(list[i].WarehouseOutInfoStart,list[i].WareStartEndStockInventoryLosses,list[i].StartEndCancelFLowInfo)//本期减少
  301. if(this.org_id == 10697){
  302. list[i].stockOutprice = list[i].packing_price
  303. list[i].saleOutMoney = (list[i].packing_price * list[i].outStock).toFixed(2)
  304. }else if(this.org_id == 0){
  305. list[i].stockOutprice = list[i].packing_price
  306. list[i].saleOutMoney = (list[i].packing_price * list[i].outStock).toFixed(2)
  307. }else if(this.org_id == 10644 || this.org_id == 10752){
  308. list[i].stockOutprice = "/"
  309. list[i].saleOutMoney = this.getWarehosueOutInfoPrice(list[i].WarehouseOutInfoStart,list[i].WareStartEndStockInventoryLosses,list[i].StartEndCancelFLowInfo)
  310. if(list[i].saleOutMoney == "NaN"){
  311. list[i].saleOutMoney = ""
  312. }
  313. console.log("list[i].saleOutMoney",list[i].saleOutMoney)
  314. }else{
  315. list[i].stockOutprice = "/"
  316. list[i].saleOutMoney = "/"
  317. }
  318. if(this.org_id == 10265 || this.org_id == 0){
  319. list[i].overStock = list[i].GoodEndFlowInfo.over_count
  320. }else{
  321. if((list[i].stockIn + list[i].stockAdd - list[i].outStock)>0 ){
  322. list[i].overStock = list[i].stockIn + list[i].stockAdd - list[i].outStock
  323. }else{
  324. list[i].overStock = 0
  325. }
  326. }
  327. if(this.org_id ==10697){
  328. list[i].overPrice = list[i].packing_price
  329. list[i].overMoney = (list[i].packing_price*list[i].overStock).toFixed(2)
  330. }else if(this.org_id == 0){
  331. list[i].overPrice = list[i].GoodEndFlowInfo.buy_price
  332. list[i].overMoney = (list[i].GoodEndFlowInfo.buy_price*list[i].overStock).toFixed(2)
  333. } else if(this.org_id ==10644 || this.org_id == 10752){
  334. list[i].overPrice = "/"
  335. list[i].overMoney = (parseFloat(list[i].stockMoney) + parseFloat(list[i].saleStockMoney) - parseFloat(list[i].saleOutMoney)).toFixed(2)
  336. }else{
  337. list[i].overPrice = "/"
  338. list[i].overMoney = "/"
  339. }
  340. }
  341. console.log("listwowowoowowowow",list)
  342. var obj = {good_number:"",medical_insurance_level:"",social_security_directory_code:"合计",good_type_id:"",good_name:"",specification_name:"",packing_unit:"",manufacturer:"",dealer:"",stockIn:"",stock_in_price:"",stockMoney:0,outStock:"",stockOutprice:"",saleStockMoney:0,saleOutMoney:0,overStock:"",overPrice:"",overMoney:0}
  343. if(this.org_id == 0 || this.org_id == 10697){
  344. if(list.length!=null){
  345. for(let i=0;i<list.length;i++){
  346. obj.stockMoney += parseFloat(list[i].stockMoney)
  347. obj.saleStockMoney += parseFloat(list[i].saleStockMoney)
  348. obj.saleOutMoney += parseFloat(list[i].saleOutMoney)
  349. obj.overMoney += parseFloat(list[i].overMoney)
  350. }
  351. obj.stockMoney = obj.stockMoney.toFixed(2)
  352. obj.saleStockMoney = obj.saleStockMoney.toFixed(2)
  353. obj.overMoney = obj.overMoney.toFixed(2)
  354. obj.saleOutMoney = obj.saleOutMoney.toFixed(2)
  355. list.push(obj)
  356. }
  357. }
  358. console.log("list233333333333333333333333333333333",list)
  359. this.tableList = list
  360. this.total = response.data.data.total
  361. this.manufacturerList = response.data.data.manufacturerList
  362. }
  363. })
  364. },
  365. getManufacturName(id){
  366. var manufacturer_name = ""
  367. for(let i=0;i<this.manufacturerList.length;i++){
  368. if(id == this.manufacturerList[i].id){
  369. manufacturer_name = this.manufacturerList[i].manufacturer_name
  370. }
  371. }
  372. return manufacturer_name
  373. },
  374. handleSizeChange(val) {
  375. this.limit = val;
  376. this.getlist()
  377. },
  378. handleCurrentChange(val) {
  379. this.page = val;
  380. this.getlist()
  381. },
  382. handleSizeChangeOne(val) {
  383. this.limitone = val;
  384. this.toDialogClick(this.good_id,this.good_name,this.specification_name)
  385. },
  386. handleCurrentChangeOne(val) {
  387. this.pageone = val;
  388. this.toDialogClick(this.good_id,this.good_name,this.specification_name)
  389. },
  390. seach(){
  391. this.goodTypeList = []
  392. this.getStorehouseList()
  393. this.getlist()
  394. },
  395. getGoodTypeName(id){
  396. var type_name = ""
  397. for(let i=0;i<this.goodTypeList.length;i++){
  398. if(id == this.goodTypeList[i].id){
  399. type_name = this.goodTypeList[i].type_name
  400. }
  401. }
  402. if(type_name !='全部'){
  403. return type_name
  404. }
  405. },
  406. getHouseName(id){
  407. var storehouse_name = ""
  408. for(let i=0;i<this.houseList.length;i++){
  409. if(id == this.houseList[i].id){
  410. storehouse_name = this.houseList[i].storehouse_name
  411. }
  412. }
  413. return storehouse_name
  414. },
  415. getWareInfoCount(val,storehouse_id){
  416. var count = 0
  417. if(val.length > 0){
  418. for(let i=0;i<val.length;i++){
  419. if(val[i].storehouse_id == storehouse_id){
  420. count +=val[i].warehousing_count
  421. }
  422. }
  423. }
  424. if(count > 0){
  425. return count
  426. }else{
  427. return ""
  428. }
  429. },
  430. getStockDrugCount(){
  431. var params ={
  432. keywords: this.keywords,
  433. start_time:this.start_time,
  434. end_time:this.end_time,
  435. }
  436. getStockDrugCount(params).then(response=>{
  437. if(response.data.state == 1){
  438. var outlist = response.data.data.outList
  439. this.outCountList = outlist
  440. var autoCount = response.data.data.autoCount
  441. this.autoCountList = autoCount
  442. var totalCount = response.data.data.totalCount
  443. this.cancelCountList = totalCount
  444. }
  445. })
  446. },
  447. getWareInfoCountOne(val,storehouse_id){
  448. var count = 0
  449. if(val.length > 0){
  450. for(let i=0;i<val.length;i++){
  451. if(val[i].storehouse_id == storehouse_id){
  452. count +=val[i].stock_count
  453. }
  454. }
  455. }
  456. if(count > 0){
  457. return count
  458. }else{
  459. return ""
  460. }
  461. },
  462. getOutCount(id){
  463. var count = 0
  464. for(let i=0;i<this.outCountList.length;i++){
  465. if(id == this.outCountList[i].good_id){
  466. count = this.outCountList[i].count
  467. }
  468. }
  469. return count
  470. },
  471. getAutoCount(id){
  472. var count= 0
  473. for(let i=0;i<this.autoCountList.length;i++){
  474. if(id == this.autoCountList[i].good_id){
  475. count = this.autoCountList[i].count
  476. }
  477. }
  478. return count
  479. },
  480. getCancelCount(id){
  481. var count = 0
  482. for(let i=0;i<this.cancelCountList.length;i++){
  483. if(id == this.cancelCountList[i].good_id){
  484. count = this.cancelCountList[i].count
  485. }
  486. }
  487. return count
  488. },
  489. getCancelCountInfo(cancel_stock_info,storehouse_id){
  490. var count = 0
  491. if(cancel_stock_info.length >0){
  492. for(let i=0;i<cancel_stock_info.length;i++){
  493. if(storehouse_id == cancel_stock_info[i].storehouse_id){
  494. count += cancel_stock_info[i].count
  495. }
  496. }
  497. }
  498. return count
  499. },
  500. getWareOutInfoCount(warehouse_out_info,storehouse_id){
  501. var count = 0
  502. if(warehouse_out_info.length > 0){
  503. for(let i=0;i<warehouse_out_info.length;i++){
  504. if(storehouse_id == warehouse_out_info[i].storehouse_id){
  505. count +=warehouse_out_info[i].count
  506. }
  507. }
  508. }
  509. return count
  510. },
  511. getInCount(id){
  512. var count= 0
  513. for(let i=0;i<this.countList.length;i++){
  514. if(id == this.countList[i].good_id){
  515. count = this.countList[i].count
  516. }
  517. }
  518. return count
  519. },
  520. getOutCount(id){
  521. var count = 0
  522. for(let i=0;i<this.outCountList.length;i++){
  523. if(id == this.outCountList[i].good_id){
  524. count = this.outCountList[i].count
  525. }
  526. }
  527. return count
  528. },
  529. getAutoCount(id){
  530. var count= 0
  531. for(let i=0;i<this.autoCountList.length;i++){
  532. if(id == this.autoCountList[i].good_id){
  533. count = this.autoCountList[i].count
  534. }
  535. }
  536. return count
  537. },
  538. getCancelCount(id){
  539. var count = 0
  540. for(let i=0;i<this.cancelCountList.length;i++){
  541. if(id == this.cancelCountList[i].good_id){
  542. count = this.cancelCountList[i].count
  543. }
  544. }
  545. return count
  546. },
  547. getStockCount(id){
  548. var stock_count = 0
  549. for(let i=0;i<this.countList.length;i++){
  550. if(id == this.countList[i].good_id){
  551. stock_count = this.countList[i].stock_count
  552. }
  553. }
  554. return stock_count
  555. },
  556. getWareInfo(arr){
  557. var total = 0
  558. if(arr.length > 0){
  559. for(let i=0;i<arr.length;i++){
  560. total += parseInt(arr[i].warehousing_count)
  561. }
  562. }else{
  563. total = ""
  564. }
  565. return total
  566. },
  567. getOverplus(arr){
  568. var total = 0
  569. if(arr.length > 0){
  570. for(let i=0;i<arr.length;i++){
  571. total += arr[i].stock_count
  572. }
  573. }else{
  574. total = ""
  575. }
  576. return total
  577. },
  578. getCancelInfo(arr){
  579. var total = 0
  580. if(arr.length > 0){
  581. for(let i=0;i<arr.length;i++){
  582. total += arr[i].count
  583. }
  584. }else{
  585. total = ""
  586. }
  587. return total
  588. },
  589. getOverFlushInfo(arr){
  590. var total = 0
  591. if(arr.length >0){
  592. for(let i=0;i<arr.length;i++){
  593. total += arr[i].stock_count
  594. }
  595. }
  596. return total
  597. },
  598. startFirstTimeChange(){
  599. this.getlist()
  600. },
  601. endEndTimeChange(){
  602. this.getlist()
  603. },
  604. getTime(val) {
  605. if(val < 0){
  606. return ""
  607. }
  608. if(val == ""){
  609. return ""
  610. }else {
  611. return uParseTime(val, '{y}-{m}-{d}')
  612. }
  613. },
  614. getName(id){
  615. var name = ""
  616. for(let i=0;i<this.patientList.length;i++){
  617. if(id == this.patientList[i].id){
  618. name = this.patientList[i].name
  619. }
  620. }
  621. return name
  622. },
  623. endTimeChange(){
  624. this.getlist()
  625. },
  626. startTimeChange(){
  627. this.getlist()
  628. },
  629. getWarehouseInfoStart(arr1,arr2,arr3,arr4,arr5){
  630. var count =0
  631. var countOne =0
  632. var countTwo= 0
  633. var countthree = 0 //期初
  634. var countfour = 0
  635. var countfive = 0
  636. if(arr1!=null && arr1.length > 0){
  637. for(let i=0;i<arr1.length;i++){
  638. countOne +=arr1[i].count
  639. }
  640. }
  641. if(arr2!=null && arr2.length > 0){
  642. for(let i=0;i<arr2.length;i++){
  643. countTwo +=arr2[i].count
  644. }
  645. }
  646. if(arr3!=null && arr3.length > 0){
  647. for(let i=0;i<arr3.length;i++){
  648. countthree +=arr3[i].count
  649. }
  650. }
  651. if(arr4!=null && arr4.length > 0){
  652. for(let i=0;i<arr4.length;i++){
  653. countfour +=arr4[i].count
  654. }
  655. }
  656. if(arr5!=null && arr5.length > 0){
  657. for(let i=0;i<arr5.length;i++){
  658. countfive +=arr5[i].count
  659. }
  660. }
  661. count = countOne - countTwo + countthree - countfour + countfive
  662. if(count > 0 ){
  663. return count
  664. }else{
  665. return 0
  666. }
  667. },
  668. getWarehouseInfo(val){
  669. var count =0
  670. for(let i=0;i<val.length;i++){
  671. count +=val[i].stock_count
  672. }
  673. if(count > 0 ){
  674. return count
  675. }else{
  676. return 0
  677. }
  678. },
  679. getWarehouseInfoOne(val,val2){
  680. var count =0
  681. var countOne = 0
  682. var all_count = 0
  683. if(val!=null && val.length >0){
  684. for(let i=0;i<val.length;i++){
  685. count +=val[i].count
  686. }
  687. }
  688. if(val2!=null && val2.length > 0){
  689. for(let i=0;i<val2.length;i++){
  690. countOne +=val2[i].count
  691. }
  692. }
  693. all_count = count + countOne
  694. if(all_count > 0 ){
  695. return all_count
  696. }else{
  697. return 0
  698. }
  699. },
  700. getWarehouseInfoOnePrice(val,val2){
  701. var count_price =0
  702. var count_one_price = 0
  703. var all_count_price = 0
  704. if(val!=null && val.length >0){
  705. for(let i=0;i<val.length;i++){
  706. count_price +=val[i].count * val[i].price
  707. }
  708. }
  709. if(val2!=null && val2.length > 0){
  710. for(let i=0;i<val2.length;i++){
  711. count_one_price +=val2[i].count * val2[i].price
  712. }
  713. }
  714. all_count_price = count_price + count_one_price
  715. if(all_count_price > 0 ){
  716. return all_count_price.toFixed(2)
  717. }else{
  718. return 0
  719. }
  720. },
  721. getAddStockMony(val,val2){
  722. var total_price =0
  723. var total_price_one = 0
  724. var all_price = 0
  725. if(val!=null && val.length >0){
  726. for(let i=0;i<val.length;i++){
  727. total_price +=val[i].count * val[i].buy_price
  728. }
  729. }
  730. if(val2!=null && val2.length > 0){
  731. for(let i=0;i<val2.length;i++){
  732. total_price_one +=val2[i].count * val2[i].price
  733. }
  734. }
  735. all_price = total_price + total_price_one
  736. if(all_price >0 ){
  737. return total_price.toFixed(2)
  738. }else{
  739. return "0.00"
  740. }
  741. },
  742. getSaleStockMony(val,val2){
  743. var total_price =0
  744. var total_price_one = 0
  745. var all_price = 0
  746. if(val!=null && val.length >0){
  747. for(let i=0;i<val.length;i++){
  748. total_price +=val[i].count * val[i].price
  749. }
  750. }
  751. if(val2!=null && val2.length > 0){
  752. for(let i=0;i<val2.length;i++){
  753. total_price_one +=val2[i].count * val2[i].price
  754. }
  755. }
  756. all_price = total_price + total_price_one
  757. if(all_price >0 ){
  758. return all_price.toFixed(2)
  759. }else{
  760. return ""
  761. }
  762. },
  763. getWarehouseOut(val){
  764. var count = 0
  765. for(let i=0;i<val.length;i++){
  766. count +=val[i].count
  767. }
  768. if(count >0){
  769. return count
  770. }else{
  771. return 0
  772. }
  773. },
  774. open(){
  775. // this.start_time = moment().year(2022).month(10).date(4).format('YYYY-MM-DD')
  776. this.start_time = moment().startOf('month').format('YYYY-MM-DD')
  777. this.end_time = moment(new Date()).add('year',0).format("YYYY-MM-DD")
  778. this.houseList = []
  779. this.goodTypeList= []
  780. this.getStorehouseList()
  781. this.getlist()
  782. //this.getStockDrugCount()
  783. },
  784. getWarehouseInfoStartPrice(arr,arr1,arr2,arr3,arr4){
  785. var total_price = 0
  786. var total_price_one = 0
  787. var total_price_two = 0
  788. var total_price_three = 0
  789. var total_price_four = 0
  790. var total_price_all = 0
  791. if(arr!=null&&arr.length > 0){
  792. for(let i=0;i<arr.length;i++){
  793. total_price += arr[i].count * arr[i].buy_price
  794. }
  795. }
  796. if(arr1!=null && arr1.length > 0){
  797. for(let i=0;i<arr1.length;i++){
  798. total_price_one +=arr1[i].count * arr1[i].buy_price
  799. }
  800. }
  801. if(arr2!=null && arr2.length > 0){
  802. for(let i=0;i<arr2.length;i++){
  803. total_price_two +=arr2[i].count * arr2[i].buy_price
  804. }
  805. }
  806. if(arr3!=null && arr3.length > 0){
  807. for(let i=0;i<arr3.length;i++){
  808. total_price_three +=arr3[i].count * arr3[i].buy_price
  809. }
  810. }
  811. if(arr4!=null && arr4.length > 0){
  812. for(let i=0;i<arr4.length;i++){
  813. total_price_three +=arr4[i].count * arr4[i].buy_price
  814. }
  815. }
  816. total_price_all = total_price - total_price_one + total_price_two - total_price_three + total_price_four
  817. if (total_price_all > 0) {
  818. return total_price_all.toFixed(2)
  819. }else{
  820. return "0.00"
  821. }
  822. },
  823. getWarehouseInfoStartMoney(arr,arr1,arr2,arr3,arr4){
  824. var total_price = 0
  825. var total_price_one = 0
  826. var total_price_two = 0
  827. var total_price_three = 0
  828. var total_price_four = 0
  829. var total_price_all = 0
  830. if(arr!=null && arr.length >0){
  831. for(let i=0;i<arr.length;i++){
  832. total_price +=arr[i].count * arr[i].price
  833. }
  834. }
  835. if(arr1!=null && arr1.length > 0){
  836. for(let i=0;i<arr1.length;i++){
  837. total_price_one +=arr1[i].count * arr1[i].price
  838. }
  839. }
  840. if(arr2!=null && arr2.length > 0){
  841. for(let i=0;i<arr2.length;i++){
  842. total_price_two +=arr2[i].count * arr2[i].price
  843. }
  844. }
  845. if(arr3!=null && arr3.length > 0){
  846. for(let i=0;i<arr3.length;i++){
  847. total_price_three +=arr3[i].count * arr3[i].price
  848. }
  849. }
  850. if(arr4!=null && arr4.length > 0){
  851. for(let i=0;i<arr4.length;i++){
  852. total_price_four +=arr4[i].count * arr4[i].price
  853. }
  854. }
  855. total_price_all = total_price - total_price_one + total_price_two - total_price_three + total_price_four
  856. if (total_price_all > 0) {
  857. return total_price_all.toFixed(2)
  858. }else{
  859. return ""
  860. }
  861. },
  862. getWarehosueOutInfo(val,val2,val3){
  863. var count = 0
  864. var count_one = 0
  865. var all_count = 0
  866. var count_two = 0
  867. if(val!=null && val.length >0){
  868. for(let i=0;i<val.length;i++){
  869. count +=val[i].count
  870. }
  871. }
  872. if(val2!=null && val2.length > 0){
  873. for(let i=0;i<val2.length;i++){
  874. count_one +=val2[i].count
  875. }
  876. }
  877. if(val3!=null && val3.length > 0){
  878. for(let i=0;i<val3.length;i++){
  879. count_two +=val3[i].count
  880. }
  881. }
  882. console.log("本期减少",count)
  883. console.log("盘亏",count_one)
  884. console.log("退库",count_two)
  885. all_count = count +count_one - count_two
  886. console.log("数据我哦我我",all_count)
  887. if(all_count >0){
  888. return all_count
  889. }else{
  890. return 0
  891. }
  892. },
  893. getWarehosueOutInfoPrice(val,val2,val3){
  894. var count_price = 0
  895. var count_one_price = 0
  896. var all_count_price = 0
  897. var count_two_price = 0
  898. if(val!=null && val.length >0){
  899. for(let i=0;i<val.length;i++){
  900. count_price += val[i].count * val[i].price
  901. }
  902. }
  903. if(val2!=null && val2.length > 0){
  904. for(let i=0;i<val2.length;i++){
  905. count_one_price +=val2[i].count * val2[i].price
  906. }
  907. }
  908. if(val3!=null && val3.length > 0){
  909. for(let i=0;i<val3.length;i++){
  910. count_two_price +=val3[i].count * val3[i].price
  911. }
  912. }
  913. console.log("本期减少",count_price)
  914. console.log("盘亏",count_one_price)
  915. console.log("退库",all_count_price)
  916. all_count_price = count_price +count_one_price - count_two_price
  917. console.log("数据我哦我我",all_count_price)
  918. if(all_count_price >0){
  919. return all_count_price.toFixed(2)
  920. }else{
  921. return "0.00"
  922. }
  923. },
  924. stockOutprice(val,val2,val3){
  925. var total_price = 0
  926. var total_price_one = 0
  927. var total_price_two = 0
  928. var all_price = 0
  929. if(val!=null && val.length >0){
  930. for(let i=0;i<val.length;i++){
  931. total_price +=val[i].count * val[i].buy_price
  932. }
  933. }
  934. if(val2!=null && val2.length > 0){
  935. for(let i=0;i<val2.length;i++){
  936. total_price_one +=val2[i].count * val2[i].buy_price
  937. }
  938. }
  939. if(val3!=null && val3.length > 0){
  940. for(let i=0;i<val3.length;i++){
  941. total_price_two +=val3[i].count * val3[i].buy_price
  942. }
  943. }
  944. all_price = total_price + total_price_one - total_price_two
  945. if(all_price >0){
  946. return all_price.toFixed(2)
  947. }else{
  948. return "0.00"
  949. }
  950. },
  951. saleOutprice(val,val2,val3){
  952. var total_price = 0
  953. var total_price_one = 0
  954. var all_price = 0
  955. var total_price_two = 0
  956. if(val!=null && val.length >0){
  957. for(let i=0;i<val.length;i++){
  958. total_price +=val[i].count * val[i].xt_warehouse_info.packing_price
  959. }
  960. }
  961. if(val2!=null && val2.length > 0){
  962. for(let i=0;i<val2.length;i++){
  963. total_price_one +=val2[i].count * val2[i].price
  964. }
  965. }
  966. if(val3!=null && val3.length > 0){
  967. for(let i=0;i<val3.length;i++){
  968. total_price_two +=val3[i].count * val3[i].price
  969. }
  970. }
  971. all_price = total_price + total_price_one - total_price_two
  972. if(all_price >0){
  973. return all_price.toFixed(2)
  974. }else{
  975. return "0.00"
  976. }
  977. },
  978. getEndWarehouseInfo(val,val3,val1,val2,val4){
  979. var count = 0
  980. var count_one = 0
  981. var count_two = 0
  982. var count_three =0
  983. var count_four = 0
  984. var all_count = 0
  985. if(val!=null && val.length >0){
  986. for(let i=0;i<val.length;i++){
  987. count +=val[i].count
  988. }
  989. }
  990. if(val1!=null&&val1.length >0){
  991. for(let i=0;i<val1.length;i++){
  992. count_one +=val1[i].count
  993. }
  994. }
  995. if(val3!=null&& val3.length > 0){
  996. for(let i=0;i<val3.length;i++){
  997. count_three +=val3[i].count
  998. }
  999. }
  1000. if(val2!=null&&val2.length >0){
  1001. for(let i=0;i<val2.length;i++){
  1002. count_two +=val2[i].count
  1003. }
  1004. }
  1005. if(val4!=null&&val4.length >0){
  1006. for(let i=0;i<val4.length;i++){
  1007. count_four +=val4[i].count
  1008. }
  1009. }
  1010. all_count = count- count_three + count_one - count_two + count_four
  1011. if(all_count >0){
  1012. return all_count
  1013. }else{
  1014. return 0
  1015. }
  1016. },
  1017. getEndOverPrice(val,val3,val1,val2,val4){
  1018. var total_price = 0
  1019. var total_price_one = 0
  1020. var total_price_two = 0
  1021. var total_price_three = 0
  1022. var total_price_four =0
  1023. var all_price = 0
  1024. if(val!=null && val.length >0){
  1025. for(let i=0;i<val.length;i++){
  1026. total_price +=val[i].count * val[i].buy_price
  1027. }
  1028. }
  1029. if(val1!=null && val1.length > 0){
  1030. for(let i=0;i<val1.length;i++){
  1031. total_price_one +=val1[i].count * val1[i].buy_price
  1032. }
  1033. }
  1034. if(val3!=null && val3.length > 0){
  1035. for(let i=0;i<val3.length;i++){
  1036. total_price_three +=val3[i].count * val3[i].buy_price
  1037. }
  1038. }
  1039. if(val2!=null && val2.length > 0){
  1040. for(let i=0;i<val2.length;i++){
  1041. total_price_two +=val2[i].count * val2[i].buy_price
  1042. }
  1043. }
  1044. if(val4!=null && val4.length > 0){
  1045. for(let i=0;i<val4.length;i++){
  1046. total_price_four +=val4[i].count * val4[i].buy_price
  1047. }
  1048. }
  1049. console.log("total_price",total_price)
  1050. console.log("total_price_three",total_price_three)
  1051. console.log("total_price_two",total_price_two)
  1052. console.log("total_price_one",total_price_one)
  1053. console.log("total_price_four",total_price_four)
  1054. all_price = total_price- total_price_three +total_price_one - total_price_two + total_price_four
  1055. console.log("arrll_price",all_price)
  1056. if(all_price >0){
  1057. return all_price.toFixed(2)
  1058. }else{
  1059. return "0.00"
  1060. }
  1061. },
  1062. getEndSalePrice(val,val3,val1,val2,val4){
  1063. var total_price = 0
  1064. var total_price_one = 0
  1065. var total_price_two = 0
  1066. var total_price_three = 0
  1067. var total_price_four = 0
  1068. var all_price= 0
  1069. if(val!=null && val.length >0){
  1070. for(let i=0;i<val.length;i++){
  1071. total_price +=val[i].count * val[i].price
  1072. }
  1073. }
  1074. if(val1!=null && val1.length >0){
  1075. for(let i=0;i<val1.length;i++){
  1076. total_price_one +=val1[i].count * val1[i].price
  1077. }
  1078. }
  1079. if(val3!=null && val3.length >0){
  1080. for(let i=0;i<val3.length;i++){
  1081. total_price_three +=val3[i].count * val3[i].price
  1082. }
  1083. }
  1084. if(val2!=null && val2.length >0){
  1085. for(let i=0;i<val2.length;i++){
  1086. total_price_two +=val2[i].count * val2[i].price
  1087. }
  1088. }
  1089. if(val4!=null && val4.length >0){
  1090. for(let i=0;i<val4.length;i++){
  1091. total_price_four +=val4[i].count * val4[i].price
  1092. }
  1093. }
  1094. var all_price = total_price-total_price_three + total_price_one - total_price_two + total_price_four
  1095. if(all_price >0){
  1096. return all_price.toFixed(2)
  1097. }else{
  1098. return "0.00"
  1099. }
  1100. },
  1101. toPrint(){
  1102. this.$router.push({path:"/purchase/new/stock/query/print?start_time="+this.start_time+"&end_time="+this.end_time+"&page="+this.page+"&limit="+this.limit+"&keyword="+this.keyword+"&good_type="+this.good_type})
  1103. },
  1104. exportList: function() {
  1105. if(this.org_id!=0&& this.org_id!=9956 && this.org_id!=10697 && this.org_id!=10375){
  1106. for(let i=0;i<this.tableList.length;i++){
  1107. this.tableList[i].index = i+1
  1108. this.tableList[i].query_date = this.start_time+"~"+this.end_time
  1109. this.tableList[i].good_type = this.getGoodTypeName(this.tableList[i].good_type_id)
  1110. this.tableList[i].manufacturer_name = this.getManufacturName(this.tableList[i].manufacturer)
  1111. this.tableList[i].dealer_name = this.getDearName(this.tableList[i].dealer)
  1112. this.tableList[i].specification_name_one = this.tableList[i].specification_name + "/"+this.tableList[i].packing_unit
  1113. }
  1114. import('@/vendor/Export2Excel').then(excel => {
  1115. const multiHeader = [['序号', '查询日期',' 耗材类型','耗材名称','规格&单位','生产产商','经销商', '期初结余' , '', '', '本期增加', '', '', '本期减少' , '', '', '期末结余' , '', '']]
  1116. const header = ['', '','','','','','', '数量', '进货金额', '销售金额', '数量', '进货金额', '销售金额', '数量', '进货金额', '销售金额', '数量', '进货金额', '销售金额']
  1117. const merges = ['A1:A2', 'B1:B2','C1:C2','D1:D2','E1:E2','F1:F2','G1:G2','H1:J1', 'K1:M1', 'N1:P1', 'Q1:S1']
  1118. const filterVal = ['index', 'query_date', 'good_type','good_name','specification_name_one','manufacturer_name','dealer_name','stockIn','stock_in_price','stockMoney','stockAdd','addStockMoney','saleStockMoney','outStock','stockOutprice','saleOutMoney','overStock','overPrice','overMoney']
  1119. const data = this.formatJson(filterVal, this.tableList)
  1120. const filename = '进销存查询'
  1121. excel.export_json_to_excel({
  1122. multiHeader,
  1123. header,
  1124. merges,
  1125. data,
  1126. filename
  1127. })
  1128. })
  1129. }
  1130. if(this.org_id == 9956){
  1131. for(let i=0;i<this.tableList.length;i++){
  1132. this.tableList[i].index = i+1
  1133. this.tableList[i].query_date = this.start_time+"~"+this.end_time
  1134. this.tableList[i].good_type = this.getGoodTypeName(this.tableList[i].good_type_id)
  1135. this.tableList[i].manufacturer_name = this.getManufacturName(this.tableList[i].manufacturer)
  1136. this.tableList[i].dealer_name = this.getDearName(this.tableList[i].dealer)
  1137. this.tableList[i].specification_name_one = this.tableList[i].specification_name + "/"+this.tableList[i].packing_unit
  1138. }
  1139. import('@/vendor/Export2Excel').then(excel => {
  1140. const multiHeader = [['序号','耗材编码', '查询日期',' 耗材类型','耗材名称','规格&单位','生产产商','经销商', '期初结余' , '', '', '本期增加', '', '', '本期减少' , '', '', '期末结余' , '', '']]
  1141. const header = ['','', '','','','','','', '数量', '进货金额', '销售金额', '数量', '进货金额', '销售金额', '数量', '进货金额', '销售金额', '数量', '进货金额', '销售金额']
  1142. const merges = ['A1:A2', 'B1:B2','C1:C2','D1:D2','E1:E2','F1:F2','G1:G2','H1:H2','I1:K1', 'L1:N1', 'O1:Q1', 'R1:T1']
  1143. const filterVal = ['index','good_number', 'query_date', 'good_type','good_name','specification_name_one','manufacturer_name','dealer_name','stockIn','stock_in_price','stockMoney','stockAdd','addStockMoney','saleStockMoney','outStock','stockOutprice','saleOutMoney','overStock','overPrice','overMoney']
  1144. const data = this.formatJson(filterVal, this.tableList)
  1145. const filename = '进销存查询'
  1146. excel.export_json_to_excel({
  1147. multiHeader,
  1148. header,
  1149. merges,
  1150. data,
  1151. filename
  1152. })
  1153. })
  1154. }
  1155. if(this.org_id == 10697 || this.org_id == 0 || this.org_id == 10375){
  1156. for(let i=0;i<this.tableList.length;i++){
  1157. this.tableList[i].index = i+1
  1158. this.tableList[i].query_date = this.start_time+"~"+this.end_time
  1159. this.tableList[i].good_type = this.getGoodTypeName(this.tableList[i].good_type_id)
  1160. this.tableList[i].manufacturer_name = this.getManufacturName(this.tableList[i].manufacturer)
  1161. this.tableList[i].dealer_name = this.getDearName(this.tableList[i].dealer)
  1162. this.tableList[i].specification_name_one = this.tableList[i].specification_name + "/"+this.tableList[i].packing_unit
  1163. }
  1164. import('@/vendor/Export2Excel').then(excel => {
  1165. const multiHeader = [['序号','国家编码', '查询日期',' 耗材类型','耗材名称','规格&单位','生产产商','经销商', '期初结余' , '', '', '本期增加', '', '', '本期减少' , '', '', '期末结余' , '', '']]
  1166. const header = ['','', '','','','','','', '数量', '进货金额', '销售金额', '数量', '进货金额', '销售金额', '数量', '进货金额', '销售金额', '数量', '进货金额', '销售金额']
  1167. const merges = ['A1:A2', 'B1:B2','C1:C2','D1:D2','E1:E2','F1:F2','G1:G2','H1:H2','I1:K1', 'L1:N1', 'O1:Q1', 'R1:T1']
  1168. const filterVal = ['index','social_security_directory_code', 'query_date', 'good_type','good_name','specification_name_one','manufacturer_name','dealer_name','stockIn','stock_in_price','stockMoney','stockAdd','addStockMoney','saleStockMoney','outStock','stockOutprice','saleOutMoney','overStock','overPrice','overMoney']
  1169. const data = this.formatJson(filterVal, this.tableList)
  1170. const filename = '进销存查询'
  1171. excel.export_json_to_excel({
  1172. multiHeader,
  1173. header,
  1174. merges,
  1175. data,
  1176. filename
  1177. })
  1178. })
  1179. }
  1180. },
  1181. formatJson(filterVal, jsonData) {
  1182. return jsonData.map(v => filterVal.map(j => v[j]));
  1183. },
  1184. toOverCount(){
  1185. getGoodOverCount().then(response=>{
  1186. if(response.data.state == 1){
  1187. var msg = response.data.data.msg
  1188. this.$message.success("调试成功")
  1189. }
  1190. })
  1191. },
  1192. getDearName(id){
  1193. var dear_name = ""
  1194. for(let i=0;i<this.dealerList.length;i++){
  1195. if(id == this.dealerList[i].id){
  1196. dear_name = this.dealerList[i].dealer_name
  1197. }
  1198. }
  1199. return dear_name
  1200. },
  1201. getAllStockIn(val){
  1202. var count = 0
  1203. if(val!=null && val.length>0){
  1204. for(let i=0;i<val.length;i++){
  1205. count+= val[i].warehousing_count
  1206. }
  1207. }
  1208. return count
  1209. },
  1210. getAllStockInPrice(val){
  1211. var total_price =0
  1212. if(val!=null && val.length>0){
  1213. for(let i=0;i<val.length;i++){
  1214. if(this.org_id == 10644){
  1215. total_price += val[i].warehousing_count * val[i].price
  1216. }
  1217. if(this.org_id != 10644){
  1218. total_price += val[i].warehousing_count * val[i].packing_price
  1219. }
  1220. }
  1221. }
  1222. if(total_price>0){
  1223. return total_price.toFixed(2)
  1224. }else{
  1225. return total_price
  1226. }
  1227. },
  1228. getAllOutStockIn(val){
  1229. var count = 0
  1230. if(val!=null && val.length>0){
  1231. for(let i=0;i<val.length;i++){
  1232. count +=val[i].count
  1233. }
  1234. }
  1235. return count
  1236. },
  1237. getAllOutStockInPrice(val){
  1238. var total_price = 0
  1239. if(val!=null && val.length>0){
  1240. for(let i=0;i<val.length;i++){
  1241. total_price += val[i].count * val[i].price
  1242. }
  1243. }
  1244. if(total_price>0){
  1245. return total_price.toFixed(2)
  1246. }else{
  1247. return total_price
  1248. }
  1249. },
  1250. getAllStockInFlow(val){
  1251. var count = 0
  1252. if(val!=null && val.length>0){
  1253. for(let i=0;i<val.length;i++){
  1254. count+= val[i].count
  1255. }
  1256. }
  1257. return count
  1258. },
  1259. getAllStockInFlowPrice(val){
  1260. var total_price = 0
  1261. if(val!=null && val.length>0){
  1262. for(let i=0;i<val.length;i++){
  1263. total_price+= val[i].count * val[i].price
  1264. }
  1265. }
  1266. if(total_price>0){
  1267. return total_price.toFixed(2)
  1268. }else{
  1269. return total_price
  1270. }
  1271. },
  1272. getAllStockOutFlow(val){
  1273. var count = 0
  1274. if(val!=null && val.length>0){
  1275. for(let i=0;i<val.length;i++){
  1276. count+= val[i].count
  1277. }
  1278. }
  1279. return count
  1280. },
  1281. getAllStockOutFlowPrice(val){
  1282. var total_price = 0
  1283. if(val!=null && val.length>0){
  1284. for(let i=0;i<val.length;i++){
  1285. total_price+= val[i].count * val[i].price
  1286. }
  1287. }
  1288. if(total_price>0){
  1289. return total_price.toFixed(2)
  1290. }else{
  1291. return total_price
  1292. }
  1293. },
  1294. getAllQuery(){
  1295. this.getlist()
  1296. }
  1297. },
  1298. created(){
  1299. }
  1300. }
  1301. </script>