stockModifyPrice.vue 35KB

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