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

drugDamaged.vue 16KB

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