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

drugDamaged.vue 15KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471
  1. <template>
  2. <div>
  3. <div style="margin-bottom:10px;">
  4. <el-input
  5. size="small"
  6. style="width: 200px;"
  7. class="filter-item"
  8. v-model.trim="searchKey"
  9. placeholder="请输入药品名称"
  10. />
  11. <el-button
  12. size="small"
  13. class="filter-item"
  14. type="primary"
  15. icon="el-icon-search"
  16. @click="search"
  17. >搜索</el-button
  18. >
  19. <el-date-picker
  20. size="small"
  21. v-model="start_time"
  22. type="date"
  23. style="margin-left:5px;width:140px;"
  24. placeholder="选择日期"
  25. @change="changeStartTime">
  26. </el-date-picker>
  27. <el-date-picker
  28. size="small"
  29. v-model="end_time"
  30. type="date"
  31. style="margin-left:5px;width:140px;"
  32. placeholder="选择日期"
  33. @change="changeEndTime">
  34. </el-date-picker>
  35. </div>
  36. <el-table :data="tableList" border :header-cell-style="{ backgroundColor: 'rgb(245, 247, 250)' }" >
  37. <el-table-column type="selection" width="55" align="center"> </el-table-column>
  38. <el-table-column prop="date" label="报损日期" align="center">
  39. <template slot-scope="scope">
  40. {{getTime(scope.row.start_time)}}
  41. </template>
  42. </el-table-column>
  43. <el-table-column prop="name" label="药品名称" align="center">
  44. <template slot-scope="scope">
  45. {{scope.row.drug_name}}
  46. </template>
  47. </el-table-column>
  48. <el-table-column prop="name" label="规格" align="center">
  49. <template slot-scope="scope">
  50. {{scope.row.specification_name}}
  51. </template>
  52. </el-table-column>
  53. <el-table-column prop="name" label="总报损数量" align="center">
  54. <template slot-scope="scope">
  55. {{getTotalCount(scope.row.drug_id,scope.row.max_unit,scope.row.min_unit,scope.row.min_number)}}
  56. </template>
  57. </el-table-column>
  58. <el-table-column prop="name" label="总报损金额" align="center">
  59. <template slot-scope="scope">
  60. {{getTotalPrice(scope.row.drug_id,scope.row.min_price)}}
  61. </template>
  62. </el-table-column>
  63. <el-table-column prop="name" label="操作人" align="center">
  64. <template slot-scope="scope">
  65. {{getDoctorName(scope.row.creater)}}
  66. </template>
  67. </el-table-column>
  68. <el-table-column label="操作" align="center" width="200">
  69. <template slot-scope="scope">
  70. <el-button type="primary" size="small" @click="clickDetai(scope.row.drug_id)">查看详情</el-button>
  71. </template>
  72. </el-table-column>
  73. </el-table>
  74. <el-pagination
  75. @size-change="handleSizeChange"
  76. @current-change="handleCurrentChange"
  77. :page-sizes="[10, 20, 40, 100]"
  78. :page-size="10"
  79. background
  80. style="margin-top:20px;text-align: right"
  81. layout="total, sizes, prev, pager, next, jumper"
  82. :total="total">
  83. </el-pagination>
  84. <el-dialog
  85. title="盘点批次详情"
  86. :visible.sync="dialogVisible"
  87. width="80%">
  88. <span>
  89. <el-form>
  90. <el-row>
  91. <el-col :span="8">
  92. <el-form-item label="入库单号:">
  93. <el-input v-model ="form.warehouseing_order" style="width:200px"></el-input>
  94. </el-form-item>
  95. </el-col>
  96. <el-col :span="8">
  97. <el-form-item label="原因:">
  98. <el-select v-model="form.type" placeholder="请选择">
  99. <el-option
  100. v-for="item in reasonList"
  101. :key="item.id"
  102. :label="item.name"
  103. :value="item.id">
  104. </el-option>
  105. </el-select>
  106. </el-form-item>
  107. </el-col>
  108. <el-col :span="8">
  109. <el-button type="primary" @click="toQuery">查询</el-button>
  110. </el-col>
  111. </el-row>
  112. <el-row style="margin-bottom:10px;">
  113. <div>{{drug_name}} &nbsp;&nbsp;总损耗数量: {{getDamagedCount(total_count)}} &nbsp;&nbsp;总报损金额:{{(total_count * min_price).toFixed(2)}}</div>
  114. </el-row>
  115. <el-row>
  116. <el-table
  117. :data="goodList"
  118. border
  119. style="width: 100%">
  120. <el-table-column prop="date" label="序号" width="180" align="center">
  121. <template slot-scope="scope">
  122. {{scope.$index + 1}}
  123. </template>
  124. </el-table-column>
  125. <el-table-column prop="name" label="入库单号" width="180" align="center">
  126. <template slot-scope="scope">
  127. {{scope.row.warehousing_order}}
  128. </template>
  129. </el-table-column>
  130. <el-table-column prop="address" label="损耗数量" align="center">
  131. <template slot-scope="scope">
  132. <span v-if="scope.row.last_stock_max_number>0">{{scope.row.last_stock_max_number}}{{scope.row.warehousing_unit}}</span>
  133. <span v-if="scope.row.last_stock_min_number>0">{{scope.row.last_stock_min_number}}{{scope.row.min_unit}}</span>
  134. </template>
  135. </el-table-column>
  136. <el-table-column prop="address" label="药损比" align="center">
  137. <template slot-scope="scope">
  138. {{getDrugDamageRadio(scope.row.count)}}%
  139. </template>
  140. </el-table-column>
  141. <el-table-column prop="address" label="报损金额" align="center">
  142. <template slot-scope="scope">
  143. <span v-if="scope.row.XtBaseDrug.min_price!=0">{{scope.row.XtBaseDrug.min_price}} </span>
  144. </template>
  145. </el-table-column>
  146. <el-table-column prop="address" label="盘点原因" align="center">
  147. <template slot-scope="scope">
  148. <span v-if="scope.row.type == 0">默认</span>
  149. <span v-if="scope.row.type == 1">到期退货</span>
  150. <span v-if="scope.row.type == 2">异常退货</span>
  151. <span v-if="scope.row.type == 3">退货</span>
  152. <span v-if="scope.row.type == 4">人为损坏</span>
  153. <span v-if="scope.row.type == 5">不计入报损分析</span>
  154. </template>
  155. </el-table-column>
  156. </el-table>
  157. </el-row>
  158. </el-form>
  159. </span>
  160. <span slot="footer" class="dialog-footer">
  161. <el-button @click="dialogVisible = false">取 消</el-button>
  162. <el-button type="primary" @click="dialogVisible = false">确 定</el-button>
  163. </span>
  164. </el-dialog>
  165. </div>
  166. </template>
  167. <script>
  168. import BreadCrumb from "../../components/bread-crumb";
  169. import { getDrugDamageList,getDamagedByDrugId } from "@/api/drug/drug"
  170. import { uParseTime } from '@/utils/tools'
  171. import { getDataConfig } from '@/utils/data'
  172. export default {
  173. name: "stockModifyPrice",
  174. components:{
  175. BreadCrumb
  176. },
  177. data() {
  178. return{
  179. crumbs: [
  180. { path: false, name: "库存管理" },
  181. { path: false, name: "药品管理" },
  182. { path: false, name: "药品报损" }
  183. ],
  184. searchKey:'',
  185. value1:'',
  186. value2:'',
  187. tableData: [],
  188. dialogVisible:false,
  189. form: {
  190. id:"",
  191. drug_name: '',
  192. retail_price :'',
  193. new_price:"",
  194. count:"",
  195. remark:"",
  196. warehousing_order:"",
  197. manufacturer:"",
  198. dealer:"",
  199. number:"",
  200. warehousing_unit:"",
  201. specification_name:"",
  202. buy_price:"",
  203. drug_id:"",
  204. packing_unit:"",
  205. drug_origin_place:"",
  206. report_count:"",
  207. total:"",
  208. dose:"",
  209. dose_unit:"",
  210. min_number:"",
  211. min_unit:"",
  212. max_unit:"",
  213. batch_number:"",
  214. last_price:"",
  215. warehouse_info_id:"",
  216. expiry_date:"",
  217. product_date:"",
  218. stock_max_number:"",
  219. stock_min_number:"",
  220. },
  221. drugList:[],
  222. manufacturerList:[],
  223. dealerList:[],
  224. currentIndex: 0,
  225. limit:10,
  226. page:1,
  227. tableList:[],
  228. total: 0,
  229. start_time:"",
  230. end_time:"",
  231. doctorList:[],
  232. ids:"",
  233. checkDialogVisible:false,
  234. checker:this.$store.getters.xt_user.user.id,
  235. check_time:new Date(),
  236. editDialogVisible:false,
  237. modifyDialogVisible:false,
  238. id:"",
  239. numberList:[],
  240. index:0,
  241. unitList:[],
  242. datamageList:[],
  243. reasonList:[
  244. {id:0,name:"默认"},
  245. {id:1,name:"到期退货"},
  246. {id:2,name:"异常退货"},
  247. {id:3,name:"退货"},
  248. {id:4,name:"人为损坏"},
  249. {id:5,name:"不计入报损分析"},
  250. ],
  251. goodList:[],
  252. drug_name:"",
  253. total_count:0,
  254. min_number:0,
  255. max_unit:"",
  256. min_unit:"",
  257. min_price:0,
  258. drug_id:0,
  259. }
  260. },
  261. methods:{
  262. search(){
  263. this.getlist()
  264. },
  265. handleSizeChange(val){
  266. this.limit = val
  267. this.getlist()
  268. },
  269. handleCurrentChange(val){
  270. this.page = val
  271. this.getlist()
  272. },
  273. getTime(val) {
  274. if(val < 0){
  275. return ""
  276. }
  277. if(val == ""){
  278. return ""
  279. }else {
  280. return uParseTime(val, '{y}-{m}-{d}')
  281. }
  282. },
  283. getlist(){
  284. var params = {
  285. limit:this.limit,
  286. page:this.page,
  287. start_time:this.start_time,
  288. end_time:this.end_time,
  289. keyword:this.searchKey,
  290. }
  291. console.log("博阿孙param232332232323",params)
  292. getDrugDamageList(params).then(response=>{
  293. if(response.data.state == 1){
  294. this.tableList = response.data.data.list
  295. this.total = response.data.data.total
  296. this.doctorList = response.data.data.doctorList
  297. var datamagelist = response.data.data.damagelist
  298. console.log("hhh233223",datamagelist)
  299. this.datamageList = datamagelist
  300. }
  301. })
  302. },
  303. getDoctorName(id){
  304. var user_name = ""
  305. for(let i=0;i<this.doctorList.length;i++){
  306. if(id == this.doctorList[i].admin_user_id){
  307. user_name = this.doctorList[i].user_name
  308. }
  309. }
  310. return user_name
  311. },
  312. changeStartTime(){
  313. this.start_time = this.getTime(this.start_time)
  314. this.getlist()
  315. },
  316. changeEndTime(){
  317. this.end_time = this.getTime(this.end_time)
  318. this.getlist()
  319. },
  320. getTotalCount(drugid,max_unit,min_unit,min_number){
  321. var total = 0
  322. var str = ""
  323. var str_min = ""
  324. for(let i=0;i<this.datamageList.length;i++){
  325. if(drugid == this.datamageList[i].drug_id){
  326. total +=this.datamageList[i].count
  327. }
  328. }
  329. if(parseInt(total/min_number)!=0){
  330. str = parseInt(total/min_number) + max_unit
  331. }
  332. if((total%min_number)!=0){
  333. str_min = total%min_number + min_unit
  334. }
  335. return str+str_min
  336. },
  337. getTotalPrice(drugid,minprice){
  338. var total = 0
  339. for(let i=0;i<this.datamageList.length;i++){
  340. if(drugid == this.datamageList[i].drug_id){
  341. total+=this.datamageList[i].count
  342. }
  343. }
  344. return (total*minprice).toFixed(2)
  345. },
  346. clickDetai(drugid){
  347. this.drug_id = drugid
  348. var params = {
  349. drug_id:drugid,
  350. warehouseing_order:this.form.warehousing_order,
  351. type:this.form.type,
  352. }
  353. this.dialogVisible = true
  354. getDamagedByDrugId(params).then(response=>{
  355. if(response.data.state ==1){
  356. var list = response.data.data.list
  357. for(let i=0;i<list.length;i++){
  358. list[i].min_number = 0
  359. list[i].min_number == list[i].XtBaseDrug.min_number
  360. list[i].total = 0
  361. }
  362. console.log("list232232332",list)
  363. for(let i=0;i<list.length;i++){
  364. this.drug_name = list[0].drug_name
  365. list[i].total = list[i].count
  366. }
  367. var total = 0
  368. for(let i=0;i<list.length;i++){
  369. total += list[i].total
  370. this.min_number = list[0].XtBaseDrug.min_number
  371. this.max_unit = list[0].XtBaseDrug.max_unit
  372. this.min_unit = list[0].XtBaseDrug.min_unit
  373. this.min_price = list[0].XtBaseDrug.min_price
  374. }
  375. this.total_count = total
  376. this.goodList = list
  377. }
  378. })
  379. },
  380. getDamagedCount(total){
  381. var str = ""
  382. var min_str = ""
  383. if(total< this.min_number){
  384. str = ""
  385. min_str = total + this.min_unit
  386. }
  387. if(total >= this.min_number){
  388. if(parseInt(total/this.min_number)!=0){
  389. str = parseInt(total/this.min_number)+ this.max_unit
  390. }
  391. if((total%this.min_number)!=0){
  392. min_str = total%this.min_number + this.min_unit
  393. }
  394. }
  395. return str + min_str
  396. },
  397. getDamagedCountOne(total){
  398. var str = ""
  399. var min_str = ""
  400. if(total< this.min_number){
  401. str = ""
  402. min_str = total
  403. }
  404. if(total >= this.min_number){
  405. if(parseInt(total/this.min_number)!=0){
  406. str = parseInt(total/this.min_number)
  407. }
  408. if((total%this.min_number)!=0){
  409. min_str = total%this.min_number
  410. }
  411. }
  412. return str + min_str
  413. },
  414. toQuery(){
  415. this.clickDetai(this.drug_id)
  416. },
  417. getDrugDamageRadio(count){
  418. var total_count = this.getDamagedCountOne(this.total_count)
  419. console.log("count888888888888",count)
  420. console.log("hh23232数据列表23322323",total_count)
  421. var all_count = 0
  422. all_count = total_count * this.min_number
  423. return (count / all_count).toFixed(2)*100
  424. }
  425. },
  426. created(){
  427. this.getlist()
  428. },
  429. }
  430. </script>
  431. <style rel="stylesheet/scss" lang="scss">
  432. .app-container {
  433. // margin: 20px;
  434. font-size: 15px;
  435. }
  436. .modifyDialog{
  437. display: flex;
  438. flex-wrap: wrap;
  439. margin-bottom: 10px;
  440. .el-form-item{
  441. width: 33%;
  442. }
  443. }
  444. .el-table td,
  445. .el-table th.is-leaf,
  446. .el-table--border,
  447. .el-table--group {
  448. border-color: #d0d3da;
  449. }
  450. .el-table--border::after,
  451. .el-table--group::after,
  452. .el-table::before {
  453. background-color: #d0d3da;
  454. }
  455. ::-webkit-scrollbar{
  456. height: 20px !important;
  457. }
  458. </style>