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

cancelStockOrderAdd.vue 29KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861
  1. <template>
  2. <div class="main-contain">
  3. <div class="position">
  4. <bread-crumb
  5. v-if="this.$route.query.type == 1"
  6. :crumbs="crumbs"
  7. ></bread-crumb>
  8. <bread-crumb
  9. v-if="this.$route.query.type == 2"
  10. :crumbs="crumbs2"
  11. ></bread-crumb>
  12. <div style="float:right;">
  13. <el-button size="small" @click="back()" class="filter-item"
  14. >取 消</el-button
  15. >
  16. <el-button
  17. size="small"
  18. type="primary"
  19. @click="submit()"
  20. v-loding="loading"
  21. class="filter-item"
  22. >保 存</el-button>
  23. <el-button
  24. size="small"
  25. type="primary"
  26. @click="toCheck()"
  27. class="filter-item"
  28. v-show="showCheck"
  29. >审核</el-button
  30. >
  31. </div>
  32. </div>
  33. <div class="app-container">
  34. <stock-in-dialog
  35. ref="dialog"
  36. :propForm="propForm"
  37. :visibility="isVisibility"
  38. v-on:dialog-comfirm="comfirm"
  39. v-on:dialog-cancle="cancle"
  40. ></stock-in-dialog>
  41. <div class="filter-container">
  42. <div class="cell clearfix">
  43. <label class="title"><span class="name"><span style="color:red">*</span>仓库</span> :</label>
  44. <el-select size="small" v-model="storehouse_id" filterable placeholder="请选择仓库" style="width:200px">
  45. <el-option
  46. v-for="(option, index) in list"
  47. :key="index"
  48. :label="option.storehouse_name"
  49. :value="option.id">
  50. </el-option>
  51. </el-select>
  52. <label class="title"><span class="name">退库时间</span> : </label>
  53. <el-date-picker
  54. size="small"
  55. v-model="return_time"
  56. prefix-icon="el-icon-date"
  57. :editable="false"
  58. style="width: 196px;"
  59. type="date"
  60. placeholder="选择日期时间"
  61. align="right"
  62. format="yyyy-MM-dd"
  63. value-format="yyyy-MM-dd"
  64. ></el-date-picker>
  65. </div>
  66. </div>
  67. <el-form :rules="tableRules" :model="recordInfo" ref="tableForm">
  68. <el-table
  69. :data="recordInfo.recordData"
  70. :class="signAndWeighBoxPatients"
  71. style="width: 100%"
  72. border
  73. max-height="450"
  74. :header-cell-style="{ backgroundColor: 'rgb(245, 247, 250)' }"
  75. >
  76. <el-table-column align="center" width="320" fixed="left">
  77. <template slot="header" slot-scope="scope">
  78. <span>耗材名称</span>
  79. </template>
  80. <template slot-scope="scope">
  81. <el-autocomplete
  82. class="checkSearch"
  83. popper-class="my-autocomplete"
  84. v-model="scope.row.good_name"
  85. :fetch-suggestions="querySearchAsync"
  86. :trigger-on-focus="true"
  87. placeholder="请输入耗材名称"
  88. @select="handleSelect"
  89. @input="changeGoodName(scope.$index)"
  90. style="width:280px;"
  91. >
  92. <i class="el-icon-search el-input__icon" slot="suffix"></i>
  93. <template slot-scope="{ item }">
  94. <div class="name">{{ item.good_name +" " +item.specification_name + " "+item.manufacturer }}</div>
  95. </template>
  96. </el-autocomplete>
  97. </template>
  98. </el-table-column>
  99. <el-table-column align="center" width="140">
  100. <template slot="header" slot-scope="scope">
  101. <span>规格&单位<span style="color: red">*</span></span>
  102. </template>
  103. <template slot-scope="scope">
  104. <el-form-item style="padding-top: 20px">
  105. <el-input placeholder="请输入规格名称" v-model="scope.row.name"></el-input>
  106. </el-form-item>
  107. </template>
  108. </el-table-column>
  109. <el-table-column width="120" align="center">
  110. <template slot="header" slot-scope="scope">
  111. <span>退库数量<span style="color: red">*</span></span>
  112. </template>
  113. <template slot-scope="scope">
  114. <el-form-item
  115. :prop="'recordData.' + scope.$index + '.return_count'"
  116. :rules="tableRules.return_count"
  117. style="padding-top: 17px"
  118. >
  119. <el-input
  120. oninput="value=value.replace(/\D|^0/g,'')"
  121. placeholder="请输入退库数量"
  122. type="number"
  123. v-model="scope.row.return_count"
  124. ></el-input>
  125. </el-form-item>
  126. </template>
  127. </el-table-column>
  128. <el-table-column width="120" align="center">
  129. <template slot="header" slot-scope="scope">
  130. <span>单价<span style="color: red">*</span></span>
  131. </template>
  132. <template slot-scope="scope">
  133. <el-form-item
  134. :prop="'recordData.' + scope.$index + '.price'"
  135. :rules="tableRules.price"
  136. style="padding-top: 17px"
  137. >
  138. <el-input
  139. placeholder="请输入单价"
  140. type="number"
  141. v-model="scope.row.price"
  142. ></el-input>
  143. </el-form-item>
  144. <!-- {{scope.row.packing_unit}} -->
  145. </template>
  146. </el-table-column>
  147. <el-table-column label="总价" align="center" width="150">
  148. <template slot-scope="scope">
  149. {{ calculate(scope.row.price * scope.row.return_count) }}
  150. </template>
  151. </el-table-column>
  152. <el-table-column width="200" align="center">
  153. <template slot="header" slot-scope="scope">
  154. <span>批次<span style="color: red">*</span></span>
  155. </template>
  156. <template slot-scope="scope">
  157. <el-form-item
  158. :prop="'recordData.' + scope.$index + '.number'"
  159. style="padding-top: 17px"
  160. :rules="tableRules.number"
  161. >
  162. <el-select v-model="scope.row.number" filterable placeholder="请选择">
  163. <el-option
  164. v-for="(item,index) in scope.row.xt_warehouse_info"
  165. :key="index"
  166. :label="item.number"
  167. :value="item.id">
  168. </el-option>
  169. </el-select>
  170. </el-form-item>
  171. </template>
  172. </el-table-column>
  173. <el-table-column width="200" align="center">
  174. <template slot="header" slot-scope="scope">
  175. <span>品名/注册证号(备案凭证号)<span style="color: red"></span></span>
  176. </template>
  177. <template slot-scope="scope">
  178. <el-form-item
  179. :prop="'recordData.' + scope.$index + '.return_count'"
  180. style="padding-top: 17px"
  181. >
  182. <el-input v-model="scope.row.register_account"></el-input>
  183. </el-form-item>
  184. </template>
  185. </el-table-column>
  186. <el-table-column label="生产厂家" width="160" align="center">
  187. <template slot-scope="scope">
  188. <el-select v-model="scope.row.manufacturer" filterable placeholder="请选择厂商">
  189. <el-option
  190. v-for="(option, index) in manufacturerList"
  191. :key="index"
  192. :label="option.manufacturer_name"
  193. :value="option.manufacturer_name">
  194. </el-option>
  195. </el-select>
  196. </template>
  197. </el-table-column>
  198. <el-table-column label="生产日期" width="180" align="center">
  199. <template slot-scope="scope">
  200. <el-date-picker
  201. prefix-icon="el-icon-date"
  202. style="width: 145px"
  203. v-model="scope.row.product_date"
  204. type="date"
  205. placeholder="选择日期时间"
  206. format="yyyy-MM-dd"
  207. value-format="yyyy-MM-dd"
  208. ></el-date-picker>
  209. </template>
  210. </el-table-column>
  211. <el-table-column label="有效日期" width="180" align="center">
  212. <template slot-scope="scope">
  213. <el-date-picker
  214. prefix-icon="el-icon-date"
  215. style="width: 145px"
  216. v-model="scope.row.expiry_date"
  217. type="date"
  218. placeholder="选择日期时间"
  219. format="yyyy-MM-dd"
  220. value-format="yyyy-MM-dd"
  221. ></el-date-picker>
  222. </template>
  223. </el-table-column>
  224. <el-table-column label="经销商" width="160" align="center">
  225. <template slot-scope="scope">
  226. <el-select v-model="scope.row.dealer" filterable placeholder="请选择厂商">
  227. <el-option
  228. v-for="(option, index) in dealerList"
  229. :key="index"
  230. :label="option.dealer_name"
  231. :value="option.dealer_name">
  232. </el-option>
  233. </el-select>
  234. </template>
  235. </el-table-column>
  236. <el-table-column width="200" align="center">
  237. <template slot="header" slot-scope="scope">
  238. <span>退库原因<span style="color: red"></span></span>
  239. </template>
  240. <template slot-scope="scope">
  241. <el-form-item
  242. :prop="'recordData.' + scope.$index + '.remark'"
  243. style="padding-top: 17px"
  244. >
  245. <el-input v-model="scope.row.remark"></el-input>
  246. </el-form-item>
  247. </template>
  248. </el-table-column>
  249. <el-table-column label="操作" align="center" width="200" fixed="right">
  250. <template slot-scope="scope">
  251. <el-tooltip
  252. class="item"
  253. effect="dark"
  254. content="新增"
  255. placement="top"
  256. >
  257. <el-button
  258. size="mini"
  259. type="primary"
  260. icon="el-icon-circle-plus-outline"
  261. @click="handleEdit(scope.$index, scope.row)"
  262. >
  263. </el-button>
  264. </el-tooltip>
  265. <el-tooltip
  266. class="item"
  267. effect="dark"
  268. content="删除"
  269. placement="top"
  270. >
  271. <el-button
  272. size="mini"
  273. type="danger"
  274. icon="el-icon-delete"
  275. @click="handleDelete(scope.$index, scope.row)"
  276. >
  277. </el-button>
  278. </el-tooltip>
  279. </template>
  280. </el-table-column>
  281. </el-table>
  282. </el-form>
  283. </div>
  284. </div>
  285. </template>
  286. <script>
  287. import { uParseTime } from "@/utils/tools";
  288. import { postCancelStock,GetAllConfig,GetAllGoodInfoByID,postSearchGoodList,getStockBatchNumber,checkStockWarehouseInfo } from "@/api/stock";
  289. import BreadCrumb from "../components/bread-crumb";
  290. import StockInDialog from './Dialog/stockInDialog'
  291. export default {
  292. components: { StockInDialog, BreadCrumb },
  293. name: "salesReturnOrderAdd",
  294. data() {
  295. return {
  296. crumbs: [
  297. { path: false, name: "库存管理" },
  298. { path: false, name: "耗材退库单" },
  299. { path: false, name: "新增退库单" }
  300. ],
  301. crumbs2: [
  302. { path: false, name: "库存管理" },
  303. { path: false, name: "其他退库单" },
  304. { path: false, name: "新增退库单" }
  305. ],
  306. type: this.$route.query.type,
  307. signAndWeighBoxPatients: "sign-and-weigh-box-patients",
  308. return_time: "",
  309. currentIndex: 0,
  310. recordInfo: {
  311. recordData: []
  312. },
  313. tableRules: {
  314. return_count: [
  315. { required: true, message: "数量不能为空", trigger: "blur" }
  316. ],
  317. price: [
  318. { required: true, message: "单价不能为空", trigger: "blur" }
  319. ],
  320. number: [
  321. { required: true, message: "批次不能为空", trigger: "blur" }
  322. ]
  323. },
  324. ruleForm: {
  325. manufacturer: [
  326. { required: true, message: "请选择厂商", trigger: "change" }
  327. ]
  328. },
  329. // prop
  330. isVisibility: false,
  331. propForm: {
  332. goods: [],
  333. goodType: [],
  334. goodInfo: [],
  335. goodUnit: [],
  336. manufacturer: 0,
  337. dealer: 0
  338. },
  339. form: {
  340. manufacturer: 0,
  341. dealer: 0
  342. },
  343. warehouseOutInfoList: [],
  344. manufacturer: [],
  345. dealer: [],
  346. goodType: [],
  347. goodInfo:[],
  348. numberList:[],
  349. dealerList:[],
  350. manufacturerList:[],
  351. list:[],
  352. storehouse_id:"",
  353. cancel_stock_id:0,
  354. showCheck:false,
  355. loading:false,
  356. };
  357. },
  358. methods: {
  359. comfirm: function(val) {
  360. this.propForm.goodType = []
  361. this.propForm.goods = []
  362. this.$refs.dialog.hide()
  363. if (val.selectedGoodInfo.length > 0) {
  364. for (let i = val.selectedGoodInfo.length - 1; i >= 0; i--) {
  365. if (i == 0) {
  366. this.recordInfo.recordData[this.currentIndex].good_type_id = val.selectedGoodInfo[i].good_type_id
  367. this.recordInfo.recordData[this.currentIndex].good_id = val.selectedGoodInfo[i].id
  368. } else {
  369. const tempForm = {}
  370. tempForm['good_type_id'] =val.selectedGoodInfo[i].good_type_id
  371. tempForm['good_id'] = val.selectedGoodInfo[i].id
  372. tempForm["return_count"] = "";
  373. this.recordInfo.recordData.splice(this.currentIndex + 1, 0, tempForm)
  374. }
  375. }
  376. }
  377. this.currentIndex = -1
  378. },
  379. cancle: function() {
  380. this.$refs.dialog.hide();
  381. this.propForm.goodType = [];
  382. },
  383. GetConfigInfo: function() {
  384. const loading = this.$loading({
  385. lock: true,
  386. text: 'Loading',
  387. spinner: 'el-icon-loading',
  388. background: 'rgba(0, 0, 0, 0.7)'
  389. })
  390. GetAllConfig().then(response => {
  391. if (response.data.state == 0) {
  392. this.$message.error(response.data.msg)
  393. return false
  394. } else {
  395. this.manufacturer = response.data.data.manufacturer
  396. this.dealer = response.data.data.dealer
  397. this.goodType = response.data.data.goodType
  398. this.goodInfo = response.data.data.goodInfo
  399. this.manufacturer.splice(0, 0, { id: 0, manufacturer_name: '全部' })
  400. this.dealer.splice(0, 0, { id: 0, dealer_name: '全部' })
  401. this.manufacturer.splice(0, 0, { id: -1, manufacturer_name: '其他' })
  402. this.dealer.splice(0, 0, { id: -1, dealer_name: '其他' })
  403. this.form.manufacturer = 0
  404. this.form.dealer = 0
  405. this.list = response.data.data.list
  406. this.storehouse_id = response.data.data.configlist.storehouse_out_info
  407. }
  408. loading.close()
  409. })
  410. },
  411. typeName: function(good_type_id) {
  412. let name = "";
  413. for (let i = 0; i < this.goodType.length; i++) {
  414. if (this.goodType[i].id == good_type_id) {
  415. name = this.goodType[i].type_name;
  416. }
  417. }
  418. return name;
  419. },
  420. specificationName: function(good_info_id) {
  421. let name = ''
  422. for (let i = 0; i < this.goodInfo.length; i++) {
  423. if (this.goodInfo[i].id == good_info_id) {
  424. name = this.goodInfo[i].specification_name
  425. }
  426. }
  427. return name
  428. },
  429. handleEdit: function(index, row) {
  430. const tempObj = {};
  431. tempObj["good_type_id"] = 0;
  432. tempObj["good_id"] = 0;
  433. tempObj["return_count"] = "";
  434. tempObj["number"] = ""
  435. tempObj["dealer"] = ""
  436. tempObj["manufacturer"]= ""
  437. tempObj["register_account"] = ""
  438. tempObj["remark"] = ""
  439. tempObj["price"] = ""
  440. tempObj["total"] = ""
  441. tempObj["warehouse_info_id"] = 0
  442. tempObj["xt_warehouse_info"] = []
  443. tempObj["id"] = 0
  444. this.recordInfo.recordData.push(tempObj);
  445. },
  446. handleDelete: function(index, row) {
  447. if (this.recordInfo.recordData.length <= 1) {
  448. this.$message.error("只有一条记录的时候无法删除");
  449. return;
  450. } else {
  451. this.recordInfo.recordData.splice(index, 1);
  452. if(row.id > 0){
  453. const params = {
  454. id: row.id
  455. }
  456. this.$confirm('确认删除该退库信息记录?', '删除退库信息记录', {
  457. confirmButtonText: '确定',
  458. cancelButtonText: '取消',
  459. type: 'warning'
  460. }).then(() => {
  461. deleteCancelStockInfo(params).then(response => {
  462. if (response.data.state == 0) {
  463. this.$message.error(response.data.msg)
  464. return false
  465. } else {
  466. this.$message.success('删除成功')
  467. this.recordInfo.recordData.splice(index, 1)
  468. }
  469. })
  470. }).catch(() => {
  471. })
  472. }
  473. }
  474. },
  475. calculate: function(val) {
  476. if (val == 0) {
  477. return "";
  478. }
  479. return Math.round(parseFloat(val) * 100) / 100;
  480. },
  481. getTime(val, temp) {
  482. if (val != 0) {
  483. return uParseTime(val, temp);
  484. } else {
  485. return "";
  486. }
  487. },
  488. showDialog(index, row) {
  489. const loading = this.$loading({
  490. lock: true,
  491. text: 'Loading',
  492. spinner: 'el-icon-loading',
  493. background: 'rgba(0, 0, 0, 0.7)'
  494. })
  495. this.currentIndex = index
  496. this.isVisibility = true
  497. const params = {
  498. manufacturer_id: this.form.manufacturer,
  499. dealer_id: this.form.dealer
  500. }
  501. this.propForm.goods = []
  502. GetAllGoodInfoByID(params).then(response => {
  503. if (response.data.state == 0) {
  504. this.$message.error(response.data.msg)
  505. return false
  506. loading.close()
  507. } else {
  508. loading.close()
  509. if (response.data.data.goodInfo.length <= 0) {
  510. this.$message.error('该厂商或经销商没有物品信息')
  511. return
  512. }
  513. this.$refs.dialog.show()
  514. for (let i = 0; i < response.data.data.goodInfo.length; i++) {
  515. this.propForm.goodType.push(response.data.data.goodInfo[i].type)
  516. }
  517. const obj = {}
  518. this.propForm.goodType = this.propForm.goodType.reduce((cur, next) => {
  519. obj[next.id] ? '' : obj[next.id] = true && cur.push(next)
  520. return cur
  521. }, []) // 设置cur默认类型为数组,并且初始值为空的数组
  522. }
  523. for (let i = 0; i < this.propForm.goodType.length; i++) {
  524. let goodInfo = []
  525. let goodObj = {}
  526. for (let a = 0; a < response.data.data.goodInfo.length; a++) {
  527. var respObj = response.data.data.goodInfo[a]
  528. respObj['isSelected'] = false
  529. if (respObj.type.id == this.propForm.goodType[i].id) {
  530. goodInfo.push(respObj)
  531. }
  532. }
  533. const obj = {}
  534. goodInfo = goodInfo.reduce((cur, next) => {
  535. obj[next.id] ? '' : obj[next.id] = true && cur.push(next)
  536. return cur
  537. }, []) // 设置cur默认类型为数组,并且初始值为空的数组
  538. this.$set(goodObj, this.propForm.goodType[i].id, goodInfo)
  539. this.propForm.goods.push(goodObj)
  540. }
  541. }
  542. )
  543. },
  544. back() {
  545. this.$router.go(-1);
  546. },
  547. submit() {
  548. this.loading = true
  549. this.$refs["tableForm"].validate(valid => {
  550. if (valid) {
  551. const array = this.recordInfo.recordData;
  552. let total = 0;
  553. for (let i = 0; i < array.length; i++) {
  554. array[i].price = (array[i].price).toString()
  555. total = total + array[i].price * array[i].return_count;
  556. if(array[i].number == undefined){
  557. array[i].number = ""
  558. }
  559. }
  560. if (this.recordInfo.recordData.length <= 0) {
  561. this.$message.success("请添加退库商品");
  562. return;
  563. }
  564. for(let i=0;i<this.recordInfo.recordData.length;i++){
  565. if(this.recordInfo.recordData[i].good_id == 0){
  566. this.$message.error("耗材规格不能为空")
  567. return
  568. }
  569. for(let j=0;j<this.recordInfo.recordData[i].xt_warehouse_info.length;j++){
  570. if(this.recordInfo.recordData[i].number == this.recordInfo.recordData[i].xt_warehouse_info[j].id){
  571. this.recordInfo.recordData[i].number = this.recordInfo.recordData[i].xt_warehouse_info[j].number
  572. this.recordInfo.recordData[i].warehouse_info_id = this.recordInfo.recordData[i].xt_warehouse_info[j].id
  573. }
  574. this.recordInfo.recordData[i].return_count = this.recordInfo.recordData[i].return_count.toString()
  575. }
  576. }
  577. const loading = this.$loading({
  578. lock: true,
  579. text: 'Loading',
  580. spinner: 'el-icon-loading',
  581. background: 'rgba(0, 0, 0, 0.7)'
  582. })
  583. const params = {
  584. cancelStock: this.recordInfo.recordData
  585. };
  586. postCancelStock(
  587. params,
  588. this.return_time,
  589. this.form.manufacturer,
  590. this.form.dealer,
  591. this.type,
  592. this.storehouse_id,
  593. this.cancel_stock_id
  594. ).then(response => {
  595. if (response.data.state == 0) {
  596. this.$message.error(response.data.msg);
  597. loading.close()
  598. return false;
  599. } else {
  600. this.loading = false
  601. this.$message.success("保存成功!")
  602. var cancelStock = response.data.data.cancelStock
  603. this.cancel_stock_id = cancelStock.id
  604. var list = response.data.data.list
  605. var manufacturerList = response.data.data.manufacturerList
  606. var dealerList = response.data.data.dealerList
  607. for(let i=0;i<list.length;i++){
  608. for(let j=0;j<dealerList.length;j++){
  609. if(list[i].dealer == dealerList[i].id){
  610. list[i].dealer = dealerList[i].dealer_name
  611. }
  612. }
  613. for(let s=0;s<manufacturerList.length;s++){
  614. if(list[i].manufacturer == manufacturerList[s].id){
  615. list[i].manufacturer = manufacturerList[s].manufacturer_name
  616. }
  617. }
  618. list[i].expiry_date = this.getTimeOne(list[i].expiry_date)
  619. list[i].product_date = this.getTimeOne(list[i].product_date)
  620. list[i].good_name = list[i].GoodInfo.good_name
  621. list[i].name = list[i].GoodInfo.specification_name
  622. list[i].return_count = list[i].count
  623. }
  624. this.recordInfo.recordData = [];
  625. this.recordInfo.recordData = list
  626. this.showCheck = true
  627. // this.$router.back(-1);
  628. loading.close()
  629. }
  630. });
  631. } else {
  632. return false;
  633. }
  634. });
  635. },
  636. changeManufacturer(val) {
  637. this.propForm.manufacturer = val;
  638. },
  639. changeDealer(val) {
  640. this.propForm.dealer = val;
  641. },
  642. querySearchAsync(keyword, cb) {
  643. let key = '';
  644. if (keyword != undefined) {
  645. key = keyword
  646. }
  647. postSearchGoodList(key,this.storehouse_id).then(response => {
  648. if (response.data.state == 1) {
  649. var list = response.data.data.list
  650. this.goodList = list
  651. var manufacturerList = response.data.data.manufacturerList
  652. this.manufacturerList = manufacturerList
  653. var dealer = response.data.data.dealerList
  654. this.dealerList = dealer
  655. for(let i=0;i<this.goodList.length;i++){
  656. for(let j=0;j<this.manufacturerList.length;j++){
  657. if(this.goodList[i].manufacturer == this.manufacturerList[j].id){
  658. this.goodList[i].manufacturer = this.manufacturerList[j].manufacturer_name
  659. }
  660. }
  661. }
  662. for(let i=0;i<this.goodList.length;i++){
  663. for(let j=0;j<this.dealerList.length;j++){
  664. if(this.goodList[i].dealer == this.dealerList[j].id){
  665. this.goodList[i].dealer = this.dealerList[j].dealer_name
  666. }
  667. }
  668. }
  669. cb(this.goodList)
  670. } else {
  671. cb([])
  672. }
  673. })
  674. },
  675. changeGoodName(val){
  676. this.currentIndex = val
  677. },
  678. handleSelect(val){
  679. console.log("val23233232",val)
  680. for(let i=0;i<this.recordInfo.recordData.length;i++){
  681. if(this.currentIndex == i){
  682. this.recordInfo.recordData[i].register_account = val.number
  683. this.recordInfo.recordData[i].good_name = val.good_name
  684. this.recordInfo.recordData[i].good_type_id = val.good_type_id
  685. this.recordInfo.recordData[i].name = val.specification_name +"/"+val.packing_unit
  686. this.recordInfo.recordData[i].number = ""
  687. this.recordInfo.recordData[i].manufacturer = val.manufacturer
  688. this.recordInfo.recordData[i].remark = val.remark
  689. this.recordInfo.recordData[i].xt_warehouse_info = val.xt_warehouse_info
  690. if(val.buy_price == 0){
  691. this.recordInfo.recordData[i].price = ""
  692. }else{
  693. this.recordInfo.recordData[i].price = val.buy_price
  694. }
  695. this.recordInfo.recordData[i].specification_name = val.specification_name
  696. this.recordInfo.recordData[i].good_id = val.id
  697. this.recordInfo.recordData[i].packing_unit = val.packing_unit
  698. if(val.dealer == 0){
  699. this.recordInfo.recordData[i].dealer = ""
  700. }else{
  701. this.recordInfo.recordData[i].dealer = val.dealer
  702. }
  703. }
  704. }
  705. },
  706. getStockBatchNumber(id){
  707. var params = {
  708. id:id
  709. }
  710. getStockBatchNumber(params).then(response=>{
  711. if(response.data.state == 1){
  712. var list = response.data.data.list
  713. this.numberList = []
  714. this.numberList = list
  715. }
  716. })
  717. },
  718. getTimeOne(val) {
  719. if(val < 0){
  720. return ""
  721. }
  722. if(val == ""){
  723. return ""
  724. }else {
  725. return uParseTime(val, '{y}-{m}-{d}')
  726. }
  727. },
  728. toCheck(){
  729. const loading = this.$loading({
  730. lock: true,
  731. text: 'Loading',
  732. spinner: 'el-icon-loading',
  733. background: 'rgba(0, 0, 0, 0.7)'
  734. })
  735. var params = {
  736. cancel_stock_id:this.cancel_stock_id,
  737. }
  738. checkStockWarehouseInfo(params).then(response=>{
  739. if(response.data.state == 1){
  740. if(response.data.data.msg == 1){
  741. this.$message.success("审核成功!")
  742. loading.close()
  743. this.$router.back(-1);
  744. }
  745. if(response.data.data.msg == 2){
  746. var good_name = response.data.data.good_name
  747. var specification_name = response.data.data.specification_name
  748. var str = good_name + specification_name +"退库数量大于出库数量,审核失败!"
  749. this.$message.error(str)
  750. loading.close()
  751. }
  752. }
  753. })
  754. }
  755. },
  756. created() {
  757. var nowDate = new Date();
  758. var nowYear = nowDate.getFullYear();
  759. var nowMonth = nowDate.getMonth() + 1;
  760. var nowDay = nowDate.getDate();
  761. this.return_time =
  762. nowYear +
  763. "-" +
  764. (nowMonth < 10 ? "0" + nowMonth : nowMonth) +
  765. "-" +
  766. (nowDay < 10 ? "0" + nowDay : nowDay);
  767. const tempObj = {};
  768. tempObj["good_type_id"] = 0;
  769. tempObj["good_id"] = 0;
  770. tempObj["return_count"] = "";
  771. tempObj["number"] = ""
  772. tempObj["dealer"] = ""
  773. tempObj["manufacturer"]= ""
  774. tempObj["register_account"] = ""
  775. tempObj["remark"] = ""
  776. tempObj["price"] = ""
  777. tempObj["total"] = ""
  778. tempObj["warehouse_info_id"] = 0
  779. tempObj["xt_warehouse_info"] = []
  780. tempObj["id"] = 0
  781. this.recordInfo.recordData.push(tempObj);
  782. this.GetConfigInfo();
  783. this.propForm.goodUnit = this.$store.getters.good_unit;
  784. }
  785. };
  786. </script>
  787. <style rel="stylesheet/css" lang="scss" scoped>
  788. .information {
  789. border: 1px #dcdfe6 solid;
  790. padding: 30px 20px 30px 20px;
  791. .border {
  792. border-bottom: 1px #dcdfe6 solid;
  793. margin: 0px 0 20px 0;
  794. }
  795. }
  796. .edit_separater {
  797. border-top: 1px solid rgb(233, 233, 233);
  798. margin-top: 15px;
  799. margin-bottom: 15px;
  800. }
  801. </style>
  802. <style>
  803. .sign-and-weigh-box .sign-and-weigh-box-patients .cell {
  804. font-size: 12px;
  805. }
  806. .sign-and-weigh-box .sign-and-weigh-box-patients .current-row > td {
  807. background: #6fb5fa;
  808. }
  809. </style>