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

drugModifyPrice.vue 33KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890
  1. <template>
  2. <div class="main-contain">
  3. <div class="position">
  4. <bread-crumb :crumbs="crumbs"></bread-crumb>
  5. </div>
  6. <div class="app-container">
  7. <div style="display: flex;align-items: center;justify-content: space-between;">
  8. <div>
  9. <el-input
  10. size="small"
  11. style="width: 200px;"
  12. class="filter-item"
  13. v-model.trim="searchKey"
  14. placeholder="请输入单据编号或操作人姓名"
  15. />
  16. <el-button
  17. size="small"
  18. class="filter-item"
  19. type="primary"
  20. icon="el-icon-search"
  21. @click="search"
  22. >搜索</el-button
  23. >
  24. <el-date-picker
  25. size="small"
  26. v-model="start_time"
  27. type="date"
  28. style="margin-left:5px;width:140px;"
  29. placeholder="选择日期"
  30. @change="changeStartime"
  31. >
  32. </el-date-picker>
  33. <el-date-picker
  34. size="small"
  35. v-model="end_time"
  36. type="date"
  37. style="margin-left:5px;width:140px;"
  38. placeholder="选择日期"
  39. @change="changeEndTime">
  40. </el-date-picker>
  41. </div>
  42. <div>
  43. <el-button size="small" type="primary" @click="dialogVisible = true">新增</el-button>
  44. <el-button size="small" type="primary" @click="toCheck">核对</el-button>
  45. <!-- <el-button size="small" type="primary" @click="print">打印</el-button>
  46. <el-button size="small" type="primary" @click="toExport">导出</el-button> -->
  47. </div>
  48. </div>
  49. <div style="margin-top:10px">
  50. <el-table :data="tableList" border :height="tableHeight" :header-cell-style="{ backgroundColor: 'rgb(245, 247, 250)' }" @selection-change="changePrice">
  51. <el-table-column type="selection" width="55" align="center"> </el-table-column>
  52. <el-table-column prop="date" label="单据编码" width="200px" align="center">
  53. <template slot-scope="scope">
  54. {{scope.row.warehousing_order}}
  55. </template>
  56. </el-table-column>
  57. <el-table-column prop="date" label="调价日期" width="150px" align="center">
  58. <template slot-scope="scope">
  59. {{getTime(scope.row.start_time)}}
  60. </template>
  61. </el-table-column>
  62. <el-table-column prop="date" label="药品名称" width="200px" align="center">
  63. <template slot-scope="scope">
  64. {{scope.row.drug_name}}
  65. </template>
  66. </el-table-column>
  67. <el-table-column prop="date" label="药品规格" width="100px" align="center">
  68. <template slot-scope="scope">
  69. {{scope.row.specification_name}}
  70. </template>
  71. </el-table-column>
  72. <el-table-column prop="date" label="原价格" width="100px" align="center">
  73. <template slot-scope="scope">
  74. {{scope.row.retail_price}}
  75. </template>
  76. </el-table-column>
  77. <el-table-column prop="date" label="现价格" width="100px" align="center">
  78. <template slot-scope="scope">
  79. {{scope.row.new_price}}
  80. </template>
  81. </el-table-column>
  82. <el-table-column prop="name" label="操作人" width="100px" align="center">
  83. <template slot-scope="scope">
  84. {{getDoctorName(scope.row.creater)}}
  85. </template>
  86. </el-table-column>
  87. <el-table-column prop="name" label="状态" align="center" width="100px">
  88. <template slot-scope="scope">
  89. <span v-if="scope.row.checker_status == 1">已核对</span>
  90. <span v-if="scope.row.checker_status == 2">未核对</span>
  91. </template>
  92. </el-table-column>
  93. <el-table-column prop="name" label="核对人" align="center" width="100px">
  94. <template slot-scope="scope">
  95. {{getDoctorName(scope.row.checker)}}
  96. </template>
  97. </el-table-column>
  98. <el-table-column label="操作" align="center" width="200px">
  99. <template slot-scope="scope">
  100. <el-button type="primary" size="small" @click="modifty(scope.row.id,scope.row.checker_status)">编辑</el-button>
  101. <el-button type="danger" size="small" @click="deleteDrugPrice(scope.row.id,scope.row.checker_status,scope.$index)">删除</el-button>
  102. </template>
  103. </el-table-column>
  104. </el-table>
  105. <el-pagination
  106. @size-change="handleSizeChange"
  107. @current-change="handleCurrentChange"
  108. :page-sizes="[10, 20, 40, 100]"
  109. :page-size="10"
  110. background
  111. style="margin-top:20px;text-align: right"
  112. layout="total, sizes, prev, pager, next, jumper"
  113. :total="total">
  114. </el-pagination>
  115. </div>
  116. </div>
  117. <el-dialog
  118. title="药品调价"
  119. :visible.sync="dialogVisible"
  120. width="1200px">
  121. <el-form :model="form" class="modifyDialog" label-width="120px">
  122. <el-form-item label="药品名称">
  123. <el-autocomplete
  124. class="checkSearch"
  125. popper-class="my-autocomplete"
  126. v-model="form.drug_name"
  127. :fetch-suggestions="querySearchAsync"
  128. :trigger-on-focus="true"
  129. placeholder="请输入药品名称"
  130. @select="handleSelect"
  131. @input="changeGoodName(scope.$index)"
  132. style="width:300px;"
  133. >
  134. <i class="el-icon-search el-input__icon" slot="suffix"></i>
  135. <template slot-scope="{ item }">
  136. <div class="name">{{ item.drug_name + item.dose + item.dose_unit + "*" +item.min_number + item.min_unit +"/" + item.max_unit + " "+item.manufacturer}}</div>
  137. </template>
  138. </el-autocomplete>
  139. </el-form-item>
  140. <el-form-item label="原价格">
  141. <el-input v-model="form.retail_price" :disabled="true"></el-input>
  142. </el-form-item>
  143. <el-form-item label="现价格">
  144. <el-input v-model="form.new_price"></el-input>
  145. </el-form-item>
  146. <!-- <el-form-item label="调价数量">
  147. <el-input v-model="form.count"></el-input>
  148. </el-form-item> -->
  149. <el-form-item label="备注" style="width:66%;">
  150. <div style="display:flex;">
  151. <el-input v-model="form.remark"></el-input>
  152. <el-button style="margin-left:5px;" type="primary" @click="addPrice">添加</el-button>
  153. </div>
  154. </el-form-item>
  155. </el-form>
  156. <el-table :data="tableData" border :header-cell-style="{ backgroundColor: 'rgb(245, 247, 250)' }">
  157. <el-table-column prop="date" label="单据编号" width="100" align="center">
  158. <template slot-scope="scope">
  159. {{scope.row.warehousing_order}}
  160. </template>
  161. </el-table-column>
  162. <el-table-column prop="date"label="药品名称" width="100" align="center">
  163. <template slot-scope="scope">
  164. {{scope.row.drug_name}}
  165. </template>
  166. </el-table-column>
  167. <el-table-column prop="name"label="规格" width="100" align="center">
  168. <template slot-scope="scope">
  169. {{scope.row.specification_name}}
  170. </template>
  171. </el-table-column>
  172. <el-table-column prop="name" label="单位" width="100" align="center">
  173. <template slot-scope="scope">
  174. {{scope.row.warehousing_unit}}
  175. </template>
  176. </el-table-column>
  177. <!-- <el-table-column prop="name" label="调价数量" width="100">
  178. <template slot-scope="scope">
  179. {{scope.row.count}}
  180. </template>
  181. </el-table-column> -->
  182. <el-table-column prop="name" label="原进货价" width="100" align="center">
  183. <template slot-scope="scope">
  184. {{scope.row.retail_price}}
  185. </template>
  186. </el-table-column>
  187. <el-table-column prop="name" label="原零售价" width="100" align="center">
  188. <template slot-scope="scope">
  189. {{scope.row.retail_price}}
  190. </template>
  191. </el-table-column>
  192. <el-table-column prop="name" label="新零售价" width="100" align="center">
  193. <template slot-scope="scope">
  194. {{scope.row.new_price}}
  195. </template>
  196. </el-table-column>
  197. <el-table-column prop="name" label="生产厂商" width="100" align="center">
  198. <template slot-scope="scope">
  199. {{scope.row.manufacturer}}
  200. </template>
  201. </el-table-column>
  202. <el-table-column prop="name" label="批准文号" width="100" align="center">
  203. <template slot-scope="scope">
  204. {{scope.row.number}}
  205. </template>
  206. </el-table-column>
  207. <el-table-column prop="name" label="经销商" width="100" align="center">
  208. <template slot-scope="scope">
  209. {{scope.row.dealer}}
  210. </template>
  211. </el-table-column>
  212. <el-table-column prop="name" label="备注" width="100" align="center">
  213. <template slot-scope="scope">
  214. {{scope.row.remark}}
  215. </template>
  216. </el-table-column>
  217. <el-table-column
  218. fixed="right"
  219. width="100"
  220. label="操作">
  221. <template slot-scope="scope">
  222. <el-button type="text" size="small" @click="toDel(scope.$index)">删除</el-button>
  223. <el-button type="text" size="small" @click="toEdit(scope.row)">编辑</el-button>
  224. </template>
  225. </el-table-column>
  226. </el-table>
  227. <span slot="footer" class="dialog-footer">
  228. <el-button @click="dialogVisible = false">取 消</el-button>
  229. <el-button type="primary" @click="saveDrugPrice">确 定</el-button>
  230. </span>
  231. </el-dialog>
  232. <el-dialog
  233. title="药品盘点核对"
  234. :visible.sync="checkDialogVisible"
  235. width="30%"
  236. >
  237. <span>
  238. <el-form :model="form">
  239. <el-row>
  240. <el-col>
  241. <el-form-item label="核对时间">
  242. <el-date-picker
  243. size="small"
  244. v-model="check_time"
  245. type="date"
  246. style="margin-left:5px;width:140px;"
  247. placeholder="选择日期">
  248. </el-date-picker>
  249. </el-form-item>
  250. </el-col>
  251. </el-row>
  252. <el-row>
  253. <el-col>
  254. <el-form-item label="核对人">
  255. <el-select v-model="checker" placeholder="请选择">
  256. <el-option
  257. v-for="item in doctorList"
  258. :key="item.admin_user_id"
  259. :label="item.user_name"
  260. :value="item.admin_user_id">
  261. </el-option>
  262. </el-select>
  263. </el-form-item>
  264. </el-col>
  265. </el-row>
  266. </el-form>
  267. </span>
  268. <span slot="footer" class="dialog-footer">
  269. <el-button @click="checkDialogVisible = false">取 消</el-button>
  270. <el-button type="primary" @click="SaveCheckedDrugPrice">保 存</el-button>
  271. </span>
  272. </el-dialog>
  273. <!-- 编辑调价 -->
  274. <el-dialog
  275. title="编辑"
  276. :visible.sync="editPriceDialogVisible"
  277. width="50%">
  278. <span>
  279. <el-form :model="form">
  280. <el-row>
  281. <el-col>
  282. <el-form-item label="药品名称">
  283. <el-autocomplete
  284. class="checkSearch"
  285. popper-class="my-autocomplete"
  286. v-model="form.drug_name"
  287. :fetch-suggestions="querySearchAsync"
  288. :trigger-on-focus="true"
  289. placeholder="请输入药品名称"
  290. @select="handleSelect"
  291. @input="changeGoodName(scope.$index)"
  292. style="width:300px;"
  293. >
  294. <i class="el-icon-search el-input__icon" slot="suffix"></i>
  295. <template slot-scope="{ item }">
  296. <div class="name">{{ item.drug_name + item.dose + item.dose_unit + "*" +item.min_number + item.min_unit +"/" + item.max_unit + " "+item.manufacturer}}</div>
  297. </template>
  298. </el-autocomplete>
  299. </el-form-item>
  300. <el-form-item label="规格:">
  301. <el-input v-model="form.specification_name" style="width:200px" :disabled="true"></el-input>
  302. </el-form-item>
  303. <el-form-item label="原价格:">
  304. <el-input v-model="form.retail_price" style="width:200px" :disabled="true"></el-input>
  305. </el-form-item>
  306. <el-form-item label="现价格:">
  307. <el-input v-model="form.new_price" style="width:200px"></el-input>
  308. </el-form-item>
  309. <el-form-item label="生产厂商:">
  310. <el-input v-model="form.manufacturer" style="width:200px" :disabled="true"></el-input>
  311. </el-form-item>
  312. <el-form-item label="经销商:">
  313. <el-input v-model="form.dealer" style="width:200px" :disabled="true"></el-input>
  314. </el-form-item>
  315. </el-col>
  316. </el-row>
  317. <el-row>
  318. <el-col>
  319. <el-form-item label="备注:">
  320. <div style="display:flex;">
  321. <el-input v-model="form.remark" style="width:200px"></el-input>
  322. </div>
  323. </el-form-item>
  324. </el-col>
  325. </el-row>
  326. </el-form>
  327. </span>
  328. <span slot="footer" class="dialog-footer">
  329. <el-button @click="editPriceDialogVisible = false">取 消</el-button>
  330. <el-button type="primary" @click="upatePrice">保存</el-button>
  331. </span>
  332. </el-dialog>
  333. <el-dialog
  334. title="编辑"
  335. :visible.sync="modifyPriceDialogVisible"
  336. width="50%">
  337. <span>
  338. <el-form :model="form">
  339. <el-row>
  340. <el-col>
  341. <el-form-item label="药品名称">
  342. <el-autocomplete
  343. class="checkSearch"
  344. popper-class="my-autocomplete"
  345. v-model="form.drug_name"
  346. :fetch-suggestions="querySearchAsync"
  347. :trigger-on-focus="true"
  348. placeholder="请输入药品名称"
  349. @select="handleSelect"
  350. @input="changeGoodName(scope.$index)"
  351. style="width:200px;"
  352. >
  353. <i class="el-icon-search el-input__icon" slot="suffix"></i>
  354. <template slot-scope="{ item }">
  355. <div class="name">{{ item.drug_name + item.dose + item.dose_unit + "*" +item.min_number + item.min_unit +"/" + item.max_unit + " "+item.manufacturer}}</div>
  356. </template>
  357. </el-autocomplete>
  358. </el-form-item>
  359. <el-form-item label="规格:">
  360. <el-input v-model="form.specification_name" style="width:200px" :disabled="true"></el-input>
  361. </el-form-item>
  362. <el-form-item label="单位:">
  363. <el-input v-model="form.warehousing_unit" style="width:200px" :disabled="true"></el-input>
  364. </el-form-item>
  365. <el-form-item label="原价格:">
  366. <el-input v-model="form.retail_price" style="width:200px" :disabled="true"></el-input>
  367. </el-form-item>
  368. <el-form-item label="现价格:">
  369. <el-input v-model="form.new_price" style="width:200px"></el-input>
  370. </el-form-item>
  371. <el-form-item label="生产厂商:">
  372. <el-input v-model="form.manufacturer" style="width:200px" :disabled="true"></el-input>
  373. </el-form-item>
  374. <el-form-item label="批准文号:">
  375. <el-input v-model="form.number" style="width:200px" :disabled="true"></el-input>
  376. </el-form-item>
  377. <el-form-item label="经销商:">
  378. <el-input v-model="form.number" style="width:200px" :disabled="true"></el-input>
  379. </el-form-item>
  380. </el-col>
  381. </el-row>
  382. <el-row>
  383. <el-col>
  384. <el-form-item label="备注:">
  385. <div style="display:flex;">
  386. <el-input v-model="form.remark" style="width:200px"></el-input>
  387. </div>
  388. </el-form-item>
  389. </el-col>
  390. </el-row>
  391. </el-form>
  392. </span>
  393. <span slot="footer" class="dialog-footer">
  394. <el-button @click="modifyPriceDialogVisible = false">取 消</el-button>
  395. <el-button type="primary" @click="modifyDrugPrice">保存</el-button>
  396. </span>
  397. </el-dialog>
  398. </div>
  399. </template>
  400. <script>
  401. import { uParseTime } from '@/utils/tools'
  402. import BreadCrumb from "../../components/bread-crumb";
  403. import {postSearchDrugWarehouseList,saveDrugPrice,getDrugPriceList,SaveCheckedDrugPrice,getDrugModiftyPrice,modifyDrugPrice,deleteDrugPrice} from "@/api/drug/drug"
  404. export default {
  405. name: "stockModifyPrice",
  406. components:{
  407. BreadCrumb
  408. },
  409. data() {
  410. return{
  411. crumbs: [
  412. { path: false, name: "库存管理" },
  413. { path: false, name: "药品管理" },
  414. { path: false, name: "药品调价" }
  415. ],
  416. tableHeight: '',
  417. fullHeight: document.documentElement.clientHeight,
  418. searchKey:'',
  419. value1:'',
  420. value2:'',
  421. tableData: [],
  422. dialogVisible:false,
  423. form: {
  424. id:"",
  425. drug_name: '',
  426. retail_price :'',
  427. new_price:"",
  428. count:"",
  429. remark:"",
  430. warehousing_order:"",
  431. manufacturer:"",
  432. dealer:"",
  433. license_number:"",
  434. warehousing_unit:"",
  435. specification_name:"",
  436. buy_price:"",
  437. drug_id:"",
  438. packing_unit:"",
  439. drug_origin_place:"",
  440. report_count:"",
  441. total:"",
  442. dose:"",
  443. dose_unit:"",
  444. min_number:"",
  445. min_unit:"",
  446. max_unit:"",
  447. batch_number:"",
  448. last_price:"",
  449. },
  450. drugList:[],
  451. manufacturerList:[],
  452. dealerList:[],
  453. currentIndex: 0,
  454. limit:10,
  455. page:1,
  456. tableList:[],
  457. ids:"",
  458. checkDialogVisible:false,
  459. checker:this.$store.getters.xt_user.user.id,
  460. check_time:new Date(),
  461. doctorList:[],
  462. editPriceDialogVisible:false,
  463. modifyPriceDialogVisible:false,
  464. id:0,
  465. start_time:"",
  466. end_time:"",
  467. }
  468. },
  469. methods:{
  470. search(){
  471. this.getlist()
  472. },
  473. print(){
  474. if(this.ids == ""){
  475. this.$message.error("请勾选打印数据")
  476. return false
  477. }else{
  478. this.$router.push({path:'/stock/drugs/drugModifyPricePrint?ids='+this.ids})
  479. }
  480. },
  481. addPrice(){
  482. if(this.form.drug_name == ""){
  483. this.$message.error("请输入药品名称")
  484. return
  485. }
  486. if(this.form.new_price == ""){
  487. this.$message.error("请输入现价格")
  488. return
  489. }
  490. var obj = {
  491. id:this.form.id,
  492. drug_id:this.form.drug_id,
  493. drug_name:this.form.drug_name,
  494. warehousing_unit:this.form.warehousing_unit,
  495. count:parseInt(this.form.count),
  496. retail_price:this.form.retail_price.toString(),
  497. manufacturer:this.form.manufacturer,
  498. drug_origin_place:this.form.drug_origin_place,
  499. number:this.form.number,
  500. remark:this.form.remark,
  501. new_price:this.form.new_price.toString(),
  502. warehousing_order:this.form.warehousing_order,
  503. dealer:this.form.dealer,
  504. last_price:this.form.last_price,
  505. start_time:this.getTime(new Date()),
  506. specification_name:this.form.specification_name,
  507. }
  508. this.tableData.push(obj)
  509. },
  510. querySearchAsync(keyword, cb) {
  511. let key = '';
  512. if (keyword != undefined) {
  513. key = keyword
  514. }
  515. postSearchDrugWarehouseList(key).then(response => {
  516. if (response.data.state == 1) {
  517. var list = response.data.data.list
  518. console.log("列表数据",list)
  519. this.drugList = list
  520. var manufacturerList = response.data.data.manufacturerList
  521. this.manufacturerList = manufacturerList
  522. var dealer = response.data.data.dealerList
  523. this.dealerList = dealer
  524. for(let i=0;i<this.drugList.length;i++){
  525. for(let j=0;j<this.manufacturerList.length;j++){
  526. if(this.drugList[i].manufacturer == this.manufacturerList[j].id){
  527. this.drugList[i].manufacturer = this.manufacturerList[j].manufacturer_name
  528. }
  529. }
  530. }
  531. for(let i=0;i<this.drugList.length;i++){
  532. for(let j=0;j<this.dealerList.length;j++){
  533. if(this.drugList[i].dealer == this.dealerList[j].id){
  534. this.drugList[i].dealer = this.dealerList[j].dealer_name
  535. }
  536. }
  537. }
  538. cb(this.drugList)
  539. } else {
  540. cb([])
  541. }
  542. })
  543. },
  544. changeGoodName(val){
  545. this.currentIndex = val
  546. },
  547. handleSelect(val){
  548. console.log("val232323223",val)
  549. this.form.id = val.id
  550. this.form.drug_id = val.drug_id,
  551. this.form.drug_name = val.drug_name
  552. this.form.retail_price = val.retail_price
  553. this.form.warehousing_order = val.warehousing_order
  554. this.form.number = val.number
  555. if(val.dealer == 0){
  556. this.form.dealer = ""
  557. }else{
  558. this.form.dealer = val.dealer
  559. }
  560. this.form.manufacturer = val.manufacturer
  561. this.form.remark = val.remark
  562. this.form.warehousing_unit = val.max_unit
  563. this.form.total = val.total
  564. this.form.batch_number = val.batch_number
  565. this.form.last_price = val.last_price
  566. this.form.specification_name = val.dose + val.dose_unit +"*"+val.min_number+val.min_unit+"/"+val.max_unit
  567. this.form.new_price = ""
  568. },
  569. getTime(val) {
  570. if(val < 0){
  571. return ""
  572. }
  573. if(val == ""){
  574. return ""
  575. }else {
  576. return uParseTime(val, '{y}-{m}-{d}')
  577. }
  578. },
  579. saveDrugPrice(){
  580. for(let i=0;i<this.tableData.length;i++){
  581. this.tableData[i].retail_price = this.tableData[i].retail_price.toString()
  582. this.tableData[i].last_price = this.tableData[i].last_price.toString()
  583. this.tableData[i].new_price = this.tableData[i].new_price.toString()
  584. // this.tableData[i].count = parseInt(this.tableData[i].count)
  585. if(this.tableData[i].dealer == 0){
  586. this.tableData[i].dealer = ""
  587. }
  588. if(this.tableData[i].manufacturer == 0){
  589. this.tableData[i].manufacturer = ""
  590. }
  591. }
  592. var params= {
  593. tableData:this.tableData,
  594. }
  595. console.log("parasm222",params)
  596. saveDrugPrice(params).then(response=>{
  597. if(response.data.state == 1){
  598. var msg = response.data.data.msg
  599. console.log("msg",msg)
  600. this.$message.success("保存成功!")
  601. this.dialogVisible = false
  602. this.getlist()
  603. }
  604. })
  605. },
  606. getlist(){
  607. var params = {
  608. keyword:this.searchKey,
  609. start_time:this.start_time,
  610. end_time:this.end_time,
  611. limit:this.limit,
  612. page:this.page,
  613. }
  614. console.log("params",params)
  615. getDrugPriceList(params).then(response=>{
  616. if(response.data.state == 1){
  617. var list = response.data.data.list
  618. this.total = response.data.data.total
  619. this.tableList = list
  620. this.doctorList = response.data.data.doctorList
  621. }
  622. })
  623. },
  624. getDoctorName(id){
  625. var user_name = ""
  626. for(let i=0;i<this.doctorList.length;i++){
  627. if(id == this.doctorList[i].admin_user_id){
  628. user_name = this.doctorList[i].user_name
  629. }
  630. }
  631. return user_name
  632. },
  633. changePrice(val){
  634. var arr = []
  635. for(let i=0;i<val.length;i++){
  636. arr.push(val[i].id)
  637. }
  638. var str = arr.join(",")
  639. console.log("str",str)
  640. this.ids = str
  641. },
  642. toCheck(){
  643. if(this.ids.length <=0){
  644. this.$message.error("请勾选核对数据")
  645. return
  646. }else{
  647. this.checkDialogVisible = true
  648. }
  649. },
  650. SaveCheckedDrugPrice(){
  651. var params = {
  652. ids:this.ids,
  653. check_time:this.getTime(this.check_time),
  654. checker:this.checker,
  655. }
  656. console.log("params",params)
  657. SaveCheckedDrugPrice(params).then(response=>{
  658. if(response.data.state == 1){
  659. this.$message.success("保存成功")
  660. var adjustPrice = response.data.data.adjustPrice
  661. this.checkDialogVisible = false
  662. this.getlist()
  663. }
  664. })
  665. },
  666. toDel(index){
  667. this.tableData.splice(index,1)
  668. },
  669. toEdit(row){
  670. console.log("row2222",row)
  671. this.form.drug_name = row.drug_name
  672. this.form.retail_price = row.retail_price
  673. this.form.new_price = row.new_price
  674. this.form.remark = row.remark
  675. this.form.id = row.id
  676. this.form.specification_name = row.specification_name
  677. this.form.last_price = row.last_price
  678. this.form.number = row.number
  679. this.form.manufacturer = row.manufacturer
  680. this.form.dealer = row.dealer
  681. this.editPriceDialogVisible = true
  682. },
  683. upatePrice(){
  684. for(let i=0;i<this.tableData.length;i++){
  685. if(this.form.id == this.tableData[i].id){
  686. this.tableData[i].drug_name = this.form.drug_name
  687. this.tableData[i].retail_price = this.form.retail_price
  688. this.tableData[i].new_price = this.form.new_price
  689. this.tableData[i].count = this.form.count
  690. this.tableData[i].remark = this.form.remark
  691. }else{
  692. this.tableData[i].drug_name = this.form.drug_name
  693. this.tableData[i].retail_price = this.form.retail_price
  694. this.tableData[i].new_price - this.form.new_price
  695. this.tableData[i].count = this.form.count
  696. this.tableData[i].remark = this.form.remark
  697. }
  698. }
  699. this.editPriceDialogVisible = false
  700. this.form.drug_name = ""
  701. this.form.retail_price = ""
  702. this.form.new_price = ""
  703. this.form.count = ""
  704. this.form.remark = ""
  705. },
  706. modifty(id,checker_status){
  707. if(checker_status == 1){
  708. this.$message.error("已核对,无法编辑")
  709. return false
  710. }
  711. getDrugModiftyPrice(id).then(response=>{
  712. if(response.data.state == 1){
  713. var detail = response.data.data.detail
  714. console.log("detail",detail)
  715. this.form.drug_name = detail.drug_name
  716. this.form.specification_name = detail.specification_name
  717. this.form.last_price = detail.last_price
  718. this.form.dealer = detail.dealer
  719. this.form.manufacturer = detail.manufacturer
  720. this.form.retail_price = detail.retail_price
  721. this.form.new_price = detail.new_price
  722. this.form.count = detail.count
  723. this.form.remark = detail.remark
  724. this.id = detail.id
  725. this.form.warehousing_unit = detail.warehousing_unit
  726. this.form.number = detail.number
  727. this.form.drug_id = detail.drug_id
  728. this.modifyPriceDialogVisible = true
  729. }
  730. })
  731. },
  732. modifyDrugPrice(){
  733. var params = {
  734. drug_name:this.form.drug_name,
  735. specification_name:this.form.specification_name,
  736. warehousing_unit:this.form.warehousing_unit,
  737. retail_price:this.form.retail_price.toString(),
  738. new_price:this.form.new_price.toString(),
  739. manufacturer:this.form.manufacturer,
  740. number:this.form.number,
  741. count:parseInt(this.form.count),
  742. remark:this.form.remark,
  743. id:this.id,
  744. drug_id:this.form.drug_id,
  745. }
  746. modifyDrugPrice(params).then(response=>{
  747. if(response.data.state == 1){
  748. var adjustPrice = response.data.data.adjustPrice
  749. this.$message.success("保存成功")
  750. this.modifyPriceDialogVisible = false
  751. }
  752. })
  753. },
  754. deleteDrugPrice(id,checker_status,index){
  755. if(checker_status == 1){
  756. this.$message.error("已核对,无法编辑")
  757. return false
  758. }
  759. this.$confirm('是否删除所选内容?', '提示', {
  760. confirmButtonText: '确定',
  761. cancelButtonText: '取消',
  762. type: 'warning'
  763. }).then(() => {
  764. let params = {
  765. id:id,
  766. }
  767. deleteDrugPrice(params).then(response => {
  768. if (response.data.state == 1) {
  769. var msg = response.data.data.msg
  770. this.$message.success("保存成功")
  771. this.tableList.splice(index,1)
  772. }
  773. })
  774. }).catch(() => {
  775. this.loading = false
  776. });
  777. },
  778. handleSizeChange(val){
  779. this.limit = val
  780. this.getlist()
  781. },
  782. handleCurrentChange(val){
  783. this.page = val
  784. this.getlist()
  785. },
  786. toExport(){
  787. import('@/vendor/Export2Excel').then(excel => {
  788. const tHeader = ['药品名称','规格','单位','批次','原进货价','新进货价','进货差价','原零售价','新零售价','零售差价',]
  789. const filterVal = ['drug_name', '','warehousing_unit','number','retail_price','new_price','','new_price','']
  790. console.log("table",this.tableList)
  791. const data = this.formatJson(filterVal, this.tableList)
  792. excel.export_json_to_excel({
  793. header: tHeader,
  794. data,
  795. filename: '药品调价'
  796. })
  797. this.downloadLoading = false
  798. })
  799. },
  800. formatJson(filterVal, jsonData) {
  801. return jsonData.map(v => filterVal.map(j => v[j]));
  802. },
  803. changeStartime(val){
  804. this.start_time = this.getTime(val)
  805. this.getlist()
  806. },
  807. changeEndTime(val){
  808. this.end_time = this.getTime(val)
  809. this.getlist()
  810. }
  811. },
  812. created(){
  813. let tableHeight = document.body.clientHeight - 200;
  814. this.tableHeight = tableHeight
  815. this.getlist()
  816. },
  817. mounted() {
  818. const that = this;
  819. window.onresize = () => {
  820. return (() => {
  821. window.fullHeight = document.documentElement.clientHeight;
  822. that.fullHeight = window.fullHeight
  823. })()
  824. }
  825. },
  826. watch: {
  827. fullHeight(val) {
  828. if (!this.timer) {
  829. this.fullHeight = val
  830. let tableHeight = val - 200
  831. this.tableHeight = tableHeight
  832. this.timer = true
  833. let that = this
  834. setTimeout(function() {
  835. that.timer = false
  836. }, 400)
  837. }
  838. }
  839. }
  840. };
  841. </script>
  842. <style rel="stylesheet/scss" lang="scss">
  843. .app-container {
  844. // margin: 20px;
  845. font-size: 15px;
  846. }
  847. .modifyDialog{
  848. display: flex;
  849. flex-wrap: wrap;
  850. margin-bottom: 10px;
  851. .el-form-item{
  852. width: 33%;
  853. }
  854. }
  855. .el-table td,
  856. .el-table th.is-leaf,
  857. .el-table--border,
  858. .el-table--group {
  859. border-color: #d0d3da;
  860. }
  861. .el-table--border::after,
  862. .el-table--group::after,
  863. .el-table::before {
  864. background-color: #d0d3da;
  865. }
  866. ::-webkit-scrollbar{
  867. height: 20px !important;
  868. }
  869. </style>