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

drugDamaged.vue 15KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466
  1. <template>
  2. <div class="main-contain">
  3. <div class="app-container">
  4. <div style="display: flex;align-items: center;justify-content: space-between;margin-bottom:10px;">
  5. <div>
  6. <el-input
  7. size="small"
  8. style="width: 200px;"
  9. class="filter-item"
  10. v-model.trim="searchKey"
  11. placeholder="请输入药品名称"
  12. />
  13. <el-button
  14. size="small"
  15. class="filter-item"
  16. type="primary"
  17. icon="el-icon-search"
  18. @click="search"
  19. >搜索</el-button
  20. >
  21. <el-date-picker
  22. size="small"
  23. v-model="start_time"
  24. type="date"
  25. style="margin-left:5px;width:140px;"
  26. placeholder="选择日期"
  27. @change="changeStartTime">
  28. </el-date-picker>
  29. <el-date-picker
  30. size="small"
  31. v-model="end_time"
  32. type="date"
  33. style="margin-left:5px;width:140px;"
  34. placeholder="选择日期"
  35. @change="changeEndTime">
  36. </el-date-picker>
  37. </div>
  38. </div>
  39. <el-table :data="tableList" border :header-cell-style="{ backgroundColor: 'rgb(245, 247, 250)' }" >
  40. <el-table-column type="selection" width="55" align="center"> </el-table-column>
  41. <el-table-column prop="date" label="报损日期" align="center">
  42. <template slot-scope="scope">
  43. {{getTime(scope.row.start_time)}}
  44. </template>
  45. </el-table-column>
  46. <el-table-column prop="name" label="药品名称" align="center">
  47. <template slot-scope="scope">
  48. {{scope.row.drug_name}}
  49. </template>
  50. </el-table-column>
  51. <el-table-column prop="name" label="规格" align="center">
  52. <template slot-scope="scope">
  53. {{scope.row.specification_name}}
  54. </template>
  55. </el-table-column>
  56. <el-table-column prop="name" label="总报损数量" align="center">
  57. <template slot-scope="scope">
  58. {{getTotalCount(scope.row.drug_id,scope.row.max_unit,scope.row.min_unit,scope.row.min_number)}}
  59. </template>
  60. </el-table-column>
  61. <el-table-column prop="name" label="总报损金额" align="center">
  62. <template slot-scope="scope">
  63. {{getTotalPrice(scope.row.drug_id,scope.row.min_price)}}
  64. </template>
  65. </el-table-column>
  66. <el-table-column prop="name" label="操作人" align="center">
  67. <template slot-scope="scope">
  68. {{getDoctorName(scope.row.creater)}}
  69. </template>
  70. </el-table-column>
  71. <el-table-column label="操作" align="center" width="200">
  72. <template slot-scope="scope">
  73. <el-button type="primary" size="small" @click="clickDetai(scope.row.drug_id)">查看详情</el-button>
  74. </template>
  75. </el-table-column>
  76. </el-table>
  77. <el-pagination
  78. @size-change="handleSizeChange"
  79. @current-change="handleCurrentChange"
  80. :page-sizes="[10, 20, 40, 100]"
  81. :page-size="10"
  82. background
  83. style="margin-top:20px;text-align: right"
  84. layout="total, sizes, prev, pager, next, jumper"
  85. :total="total">
  86. </el-pagination>
  87. </div>
  88. <el-dialog
  89. title="盘点批次详情"
  90. :visible.sync="dialogVisible"
  91. width="80%">
  92. <span>
  93. <el-form>
  94. <el-row>
  95. <el-col>
  96. <el-form-item label="入库单号:">
  97. <el-input v-model ="form.warehouseing_order" style="width:200px"></el-input>
  98. </el-form-item>
  99. <el-form-item label="原因:">
  100. <el-select v-model="form.type" placeholder="请选择">
  101. <el-option
  102. v-for="item in reasonList"
  103. :key="item.id"
  104. :label="item.name"
  105. :value="item.id">
  106. </el-option>
  107. </el-select>
  108. </el-form-item>
  109. <el-button type="primary" @click="toQuery">查询</el-button>
  110. </el-col>
  111. </el-row>
  112. <el-row>
  113. <div>&nbsp;&nbsp;{{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. getDrugDamageList(params).then(response=>{
  292. if(response.data.state == 1){
  293. this.tableList = response.data.data.list
  294. this.total = response.data.data.total
  295. this.doctorList = response.data.data.doctorList
  296. var datamagelist = response.data.data.damagelist
  297. console.log("hhh233223",datamagelist)
  298. this.datamageList = datamagelist
  299. }
  300. })
  301. },
  302. getDoctorName(id){
  303. var user_name = ""
  304. for(let i=0;i<this.doctorList.length;i++){
  305. if(id == this.doctorList[i].admin_user_id){
  306. user_name = this.doctorList[i].user_name
  307. }
  308. }
  309. return user_name
  310. },
  311. changeStartTime(){
  312. },
  313. changeEndTime(){
  314. },
  315. getTotalCount(drugid,max_unit,min_unit,min_number){
  316. var total = 0
  317. var str = ""
  318. var str_min = ""
  319. for(let i=0;i<this.datamageList.length;i++){
  320. if(drugid == this.datamageList[i].drug_id){
  321. total +=this.datamageList[i].count
  322. }
  323. }
  324. if(parseInt(total/min_number)!=0){
  325. str = parseInt(total/min_number) + max_unit
  326. }
  327. if((total%min_number)!=0){
  328. str_min = total%min_number + min_unit
  329. }
  330. return str+str_min
  331. },
  332. getTotalPrice(drugid,minprice){
  333. var total = 0
  334. for(let i=0;i<this.datamageList.length;i++){
  335. if(drugid == this.datamageList[i].drug_id){
  336. total+=this.datamageList[i].count
  337. }
  338. }
  339. return (total*minprice).toFixed(2)
  340. },
  341. clickDetai(drugid){
  342. this.drug_id = drugid
  343. var params = {
  344. drug_id:drugid,
  345. warehouseing_order:this.form.warehousing_order,
  346. type:this.form.type,
  347. }
  348. this.dialogVisible = true
  349. getDamagedByDrugId(params).then(response=>{
  350. if(response.data.state ==1){
  351. var list = response.data.data.list
  352. for(let i=0;i<list.length;i++){
  353. list[i].min_number = 0
  354. list[i].min_number == list[i].XtBaseDrug.min_number
  355. list[i].total = 0
  356. }
  357. console.log("list232232332",list)
  358. for(let i=0;i<list.length;i++){
  359. this.drug_name = list[0].drug_name
  360. list[i].total = list[i].count
  361. }
  362. var total = 0
  363. for(let i=0;i<list.length;i++){
  364. total += list[i].total
  365. this.min_number = list[0].XtBaseDrug.min_number
  366. this.max_unit = list[0].XtBaseDrug.max_unit
  367. this.min_unit = list[0].XtBaseDrug.min_unit
  368. this.min_price = list[0].XtBaseDrug.min_price
  369. }
  370. this.total_count = total
  371. this.goodList = list
  372. }
  373. })
  374. },
  375. getDamagedCount(total){
  376. var str = ""
  377. var min_str = ""
  378. if(total< this.min_number){
  379. str = ""
  380. min_str = total + this.min_unit
  381. }
  382. if(total >= this.min_number){
  383. if(parseInt(total/this.min_number)!=0){
  384. str = parseInt(total/this.min_number)+ this.max_unit
  385. }
  386. if((total%this.min_number)!=0){
  387. min_str = total%this.min_number + this.min_unit
  388. }
  389. }
  390. return str + min_str
  391. },
  392. getDamagedCountOne(total){
  393. var str = ""
  394. var min_str = ""
  395. if(total< this.min_number){
  396. str = ""
  397. min_str = total
  398. }
  399. if(total >= this.min_number){
  400. if(parseInt(total/this.min_number)!=0){
  401. str = parseInt(total/this.min_number)
  402. }
  403. if((total%this.min_number)!=0){
  404. min_str = total%this.min_number
  405. }
  406. }
  407. return str + min_str
  408. },
  409. toQuery(){
  410. this.clickDetai(this.drug_id)
  411. },
  412. getDrugDamageRadio(count){
  413. var total_count = this.getDamagedCountOne(this.total_count)
  414. var all_count = 0
  415. all_count = total_count * this.min_number
  416. return (count / all_count).toFixed(2)*100
  417. }
  418. },
  419. created(){
  420. this.getlist()
  421. },
  422. }
  423. </script>
  424. <style rel="stylesheet/scss" lang="scss">
  425. .app-container {
  426. // margin: 20px;
  427. font-size: 15px;
  428. }
  429. .modifyDialog{
  430. display: flex;
  431. flex-wrap: wrap;
  432. margin-bottom: 10px;
  433. .el-form-item{
  434. width: 33%;
  435. }
  436. }
  437. .el-table td,
  438. .el-table th.is-leaf,
  439. .el-table--border,
  440. .el-table--group {
  441. border-color: #d0d3da;
  442. }
  443. .el-table--border::after,
  444. .el-table--group::after,
  445. .el-table::before {
  446. background-color: #d0d3da;
  447. }
  448. ::-webkit-scrollbar{
  449. height: 20px !important;
  450. }
  451. </style>