123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511 |
- <template>
- <div>
- <div style="margin-bottom:10px;">
- <el-select size="small" v-model="storehouse_id" filterable placeholder="请选择仓库" style="width:200px" @change="changehouseList">
- <el-option
- v-for="(option, index) in houseList"
- :key="index"
- :label="option.storehouse_name"
- :value="option.id">
- </el-option>
- </el-select>
- <el-input
- size="small"
- style="width: 200px;"
- class="filter-item"
- v-model.trim="searchKey"
- placeholder="请输入药品名称"
- />
- <el-button
- size="small"
- class="filter-item"
- type="primary"
- icon="el-icon-search"
- @click="search"
- >搜索</el-button
- >
- <el-date-picker
- size="small"
- v-model="start_time"
- type="date"
- style="margin-left:5px;width:140px;"
- placeholder="选择日期"
- @change="changeStartTime">
- </el-date-picker>
- <el-date-picker
- size="small"
- v-model="end_time"
- type="date"
- style="margin-left:5px;width:140px;"
- placeholder="选择日期"
- @change="changeEndTime">
- </el-date-picker>
- </div>
- <el-table :data="tableList" border :header-cell-style="{ backgroundColor: 'rgb(245, 247, 250)' }" >
- <el-table-column type="selection" width="55" align="center"> </el-table-column>
- <el-table-column prop="date" label="报损日期" align="center">
- <template slot-scope="scope">
- {{getTime(scope.row.start_time)}}
- </template>
- </el-table-column>
- <el-table-column prop="name" label="药品名称" align="center">
- <template slot-scope="scope">
- {{scope.row.drug_name}}
- </template>
- </el-table-column>
- <el-table-column prop="name" label="规格" align="center">
- <template slot-scope="scope">
- {{scope.row.specification_name}}
- </template>
- </el-table-column>
- <el-table-column prop="name" label="总报损数量" align="center">
- <template slot-scope="scope">
- {{getTotalCount(scope.row.drug_id,scope.row.max_unit,scope.row.min_unit,scope.row.min_number)}}
- </template>
- </el-table-column>
- <el-table-column prop="name" label="总报损金额" align="center">
- <template slot-scope="scope">
- {{getTotalPrice(scope.row.drug_id,scope.row.min_price)}}
- </template>
- </el-table-column>
- <el-table-column prop="name" label="仓库名称" align="center">
- <template slot-scope="scope">
- {{getHouseName(scope.row.storehouse_id)}}
- </template>
- </el-table-column>
- <el-table-column prop="name" label="操作人" align="center">
- <template slot-scope="scope">
- {{getDoctorName(scope.row.creater)}}
- </template>
- </el-table-column>
- <el-table-column label="操作" align="center" width="200">
- <template slot-scope="scope">
- <el-button type="primary" size="small" @click="clickDetai(scope.row.drug_id)">查看详情</el-button>
- </template>
- </el-table-column>
- </el-table>
- <el-pagination
- @size-change="handleSizeChange"
- @current-change="handleCurrentChange"
- :page-sizes="[10, 20, 40, 100]"
- :page-size="10"
- background
- style="margin-top:20px;text-align: right"
- layout="total, sizes, prev, pager, next, jumper"
- :total="total">
- </el-pagination>
-
- <el-dialog
- title="盘点批次详情"
- :visible.sync="dialogVisible"
- width="80%">
- <span>
- <el-form>
- <el-row>
- <el-col :span="8">
- <el-form-item label="入库单号:">
- <el-input v-model ="form.warehousing_order" style="width:200px"></el-input>
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-form-item label="原因:">
- <el-select v-model="form.type" placeholder="请选择" @change="changeReason">
- <el-option
- v-for="item in reasonList"
- :key="item.id"
- :label="item.name"
- :value="item.id">
- </el-option>
- </el-select>
- </el-form-item>
- </el-col>
- <el-col :span="8">
- <el-button type="primary" @click="toQuery">查询</el-button>
- </el-col>
- </el-row>
- <el-row style="margin-bottom:10px;">
- <div>{{drug_name}} 总损耗数量: {{getDamagedCount(total_count)}} 总报损金额:{{(total_count * min_price).toFixed(2)}}</div>
- </el-row>
- <el-row>
- <el-table
- :data="goodList"
- border
- style="width: 100%">
- <el-table-column prop="date" label="序号" width="180" align="center">
- <template slot-scope="scope">
- {{scope.$index + 1}}
- </template>
- </el-table-column>
- <el-table-column prop="name" label="入库单号" width="180" align="center">
- <template slot-scope="scope">
- {{scope.row.warehousing_order}}
- </template>
- </el-table-column>
- <el-table-column prop="address" label="损耗数量" align="center">
- <template slot-scope="scope">
- <span v-if="scope.row.count>0">{{scope.row.count}}{{scope.row.min_unit}}</span>
- </template>
- </el-table-column>
- <el-table-column prop="address" label="药损比" align="center">
- <template slot-scope="scope">
- {{getDrugDamageRadio(scope.row.count)}}%
- </template>
- </el-table-column>
- <el-table-column prop="address" label="报损金额" align="center">
- <template slot-scope="scope">
- <span v-if="scope.row.XtBaseDrug.min_price!=0">{{scope.row.XtBaseDrug.min_price}} </span>
- </template>
- </el-table-column>
-
- <el-table-column prop="address" label="盘点原因" align="center">
- <template slot-scope="scope">
- <span v-if="scope.row.type == 6">默认</span>
- <span v-if="scope.row.type == 1">到期退货</span>
- <span v-if="scope.row.type == 2">异常退货</span>
- <span v-if="scope.row.type == 3">退货</span>
- <span v-if="scope.row.type == 4">人为损坏</span>
- <span v-if="scope.row.type == 5">不计入报损分析</span>
- </template>
- </el-table-column>
- </el-table>
- </el-row>
- </el-form>
- </span>
- <span slot="footer" class="dialog-footer">
- <el-button @click="dialogVisible = false">取 消</el-button>
- <el-button type="primary" @click="dialogVisible = false">确 定</el-button>
- </span>
- </el-dialog>
- </div>
- </template>
-
- <script>
- import BreadCrumb from "../../components/bread-crumb";
- import { getDrugDamageList,getDamagedByDrugId } from "@/api/drug/drug"
- import { uParseTime } from '@/utils/tools'
- import { getDataConfig } from '@/utils/data'
- export default {
- name: "stockModifyPrice",
- components:{
- BreadCrumb
- },
- data() {
- return{
- crumbs: [
- { path: false, name: "库存管理" },
- { path: false, name: "药品管理" },
- { path: false, name: "药品报损" }
- ],
- searchKey:'',
- value1:'',
- value2:'',
- tableData: [],
- dialogVisible:false,
- form: {
- id:"",
- drug_name: '',
- retail_price :'',
- new_price:"",
- count:"",
- remark:"",
- warehousing_order:"",
- manufacturer:"",
- dealer:"",
- number:"",
- warehousing_unit:"",
- specification_name:"",
- buy_price:"",
- drug_id:"",
- packing_unit:"",
- drug_origin_place:"",
- report_count:"",
- total:"",
- dose:"",
- dose_unit:"",
- min_number:"",
- min_unit:"",
- max_unit:"",
- batch_number:"",
- last_price:"",
- warehouse_info_id:"",
- expiry_date:"",
- product_date:"",
- stock_max_number:"",
- stock_min_number:"",
- storehouse_id:"",
- },
- drugList:[],
- manufacturerList:[],
- dealerList:[],
- currentIndex: 0,
- limit:10,
- page:1,
- tableList:[],
- total: 0,
- start_time:"",
- end_time:"",
- doctorList:[],
- ids:"",
- checkDialogVisible:false,
- checker:this.$store.getters.xt_user.user.id,
- check_time:new Date(),
- editDialogVisible:false,
- modifyDialogVisible:false,
- id:"",
- numberList:[],
- index:0,
- unitList:[],
- datamageList:[],
- reasonList:[
- {id:6,name:"默认"},
- {id:1,name:"到期退货"},
- {id:2,name:"异常退货"},
- {id:3,name:"退货"},
- {id:4,name:"人为损坏"},
- {id:5,name:"不计入报损分析"},
- ],
- goodList:[],
- drug_name:"",
- total_count:0,
- min_number:0,
- max_unit:"",
- min_unit:"",
- min_price:0,
- drug_id:0,
- storehouse_id:0,
- houseList:[],
- }
- },
- methods:{
-
- search(){
- this.getlist()
- },
- handleSizeChange(val){
- this.limit = val
- this.getlist()
- },
- handleCurrentChange(val){
- this.page = val
- this.getlist()
- },
-
- getTime(val) {
- if(val < 0){
- return ""
- }
- if(val == ""){
- return ""
- }else {
- return uParseTime(val, '{y}-{m}-{d}')
- }
- },
- changeReason(val){
- this.form.type = val
- this.clickDetai(this.drug_id)
- },
- getlist(){
- var params = {
- limit:this.limit,
- page:this.page,
- start_time:this.start_time,
- end_time:this.end_time,
- keyword:this.searchKey,
- storehouse_id:this.storehouse_id,
- }
-
- getDrugDamageList(params).then(response=>{
- if(response.data.state == 1){
- this.tableList = response.data.data.list
- this.total = response.data.data.total
- this.doctorList = response.data.data.doctorList
- var datamagelist = response.data.data.damagelist
- this.datamageList = datamagelist
- var obj = {id:0,storehouse_name:"全部"}
- this.houseList = []
- this.houseList.push(obj)
- for(let i=0;i<response.data.data.houseList.length;i++){
- this.houseList.push(response.data.data.houseList[i])
- }
- }
- })
- },
- getDoctorName(id){
- var user_name = ""
- for(let i=0;i<this.doctorList.length;i++){
- if(id == this.doctorList[i].admin_user_id){
- user_name = this.doctorList[i].user_name
- }
- }
- return user_name
- },
- changeStartTime(){
- this.start_time = this.getTime(this.start_time)
- this.getlist()
- },
- changeEndTime(){
- this.end_time = this.getTime(this.end_time)
- this.getlist()
- },
- getTotalCount(drugid,max_unit,min_unit,min_number){
-
- var total = 0
- var str = ""
- var str_min = ""
- for(let i=0;i<this.datamageList.length;i++){
- if(drugid == this.datamageList[i].drug_id){
- total +=this.datamageList[i].count
- }
- }
- if(parseInt(total/min_number)!=0){
- str = parseInt(total/min_number) + max_unit
- }
- if((total%min_number)!=0){
- str_min = total%min_number + min_unit
- }
- return str+str_min
- },
- getTotalPrice(drugid,minprice){
- var total = 0
- for(let i=0;i<this.datamageList.length;i++){
- if(drugid == this.datamageList[i].drug_id){
- total+=this.datamageList[i].count
- }
- }
- return (total*minprice).toFixed(2)
- },
- clickDetai(drugid){
- this.drug_id = drugid
- var params = {
- drug_id:drugid,
- warehouseing_order:this.form.warehousing_order,
- type:this.form.type,
- }
-
- this.dialogVisible = true
- getDamagedByDrugId(params).then(response=>{
- if(response.data.state ==1){
- var list = response.data.data.list
- for(let i=0;i<list.length;i++){
- list[i].min_number = 0
- list[i].min_number == list[i].XtBaseDrug.min_number
- list[i].total = 0
- }
-
-
- for(let i=0;i<list.length;i++){
- this.drug_name = list[0].drug_name
- list[i].total = list[i].count
- }
- var total = 0
- for(let i=0;i<list.length;i++){
- total += list[i].total
- this.min_number = list[0].XtBaseDrug.min_number
- this.max_unit = list[0].XtBaseDrug.max_unit
- this.min_unit = list[0].XtBaseDrug.min_unit
- this.min_price = list[0].XtBaseDrug.min_price
- }
- this.total_count = total
- this.goodList = list
- }
- })
- },
- getDamagedCount(total){
-
- var str = ""
- var min_str = ""
- if(total< this.min_number){
- str = ""
- min_str = total + this.min_unit
- }
- if(total >= this.min_number){
- if(parseInt(total/this.min_number)!=0){
- str = parseInt(total/this.min_number)+ this.max_unit
- }
- if((total%this.min_number)!=0){
- min_str = total%this.min_number + this.min_unit
- }
- }
- return str + min_str
- },
- getDamagedCountOne(total){
-
- var str = ""
- var min_str = ""
- if(total< this.min_number){
- str = ""
- min_str = total
- }
- if(total >= this.min_number){
- if(parseInt(total/this.min_number)!=0){
- str = parseInt(total/this.min_number)
- }
- if((total%this.min_number)!=0){
- min_str = total%this.min_number
- }
- }
- return str + min_str
- },
- toQuery(){
- this.clickDetai(this.drug_id)
- },
- getDrugDamageRadio(count){
- var total_count = this.getDamagedCountOne(this.total_count)
- var all_count = 0
- all_count = total_count * this.min_number
-
- return (count / all_count).toFixed(2)*100
- },
- changehouseList(){
- this.houseList = []
- this.getlist()
- },
- getHouseName(id){
- var storehouse_name = ""
- for(let i=0;i<this.houseList.length;i++){
- if(id == this.houseList[i].id){
- storehouse_name = this.houseList[i].storehouse_name
- }
- }
- if(storehouse_name == "全部"){
- return ""
- }else{
- return storehouse_name
- }
- }
- },
- created(){
- this.getlist()
- },
- }
- </script>
-
- <style rel="stylesheet/scss" lang="scss">
- .app-container {
- // margin: 20px;
- font-size: 15px;
- }
- .modifyDialog{
- display: flex;
- flex-wrap: wrap;
- margin-bottom: 10px;
- .el-form-item{
- width: 33%;
- }
- }
- .el-table td,
- .el-table th.is-leaf,
- .el-table--border,
- .el-table--group {
- border-color: #d0d3da;
- }
- .el-table--border::after,
- .el-table--group::after,
- .el-table::before {
- background-color: #d0d3da;
- }
- ::-webkit-scrollbar{
- height: 20px !important;
- }
- </style>
|