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

addPurchaseOrder.vue 32KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982
  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" v-loading="loading">
  7. <div
  8. style="
  9. justify-content: space-between;
  10. margin: 0px 0 12px 0;
  11. display: flex;
  12. align-items: center;
  13. "
  14. >
  15. <div>
  16. <span style="color: red">*</span><span>供应商:</span>
  17. <el-select cxpib`*+9.`
  18. v-model="supplier_name"
  19. style="width: 140px; margin-right: 10px"
  20. placeholder="请选择"
  21. >
  22. <el-option
  23. v-for="item in supplyList"
  24. :key="item.id"
  25. :label="item.supplier_name"
  26. :value="item.id"
  27. >
  28. </el-option>
  29. </el-select>
  30. <span>单据日期:</span>
  31. <el-date-picker
  32. size="small"
  33. v-model="start_time"
  34. prefix-icon="el-icon-date"
  35. :editable="false"
  36. style="width: 196px"
  37. type="date"
  38. placeholder="选择日期时间"
  39. align="right"
  40. format="yyyy-MM-dd"
  41. value-format="yyyy-MM-dd"
  42. ></el-date-picker>
  43. <span>交货日期:</span>
  44. <el-date-picker
  45. size="small"
  46. v-model="end_time"
  47. prefix-icon="el-icon-date"
  48. :editable="false"
  49. style="width: 196px"
  50. type="date"
  51. placeholder="选择日期时间"
  52. align="right"
  53. format="yyyy-MM-dd"
  54. value-format="yyyy-MM-dd"
  55. ></el-date-picker>
  56. <span>单据编码:{{ number }}</span>
  57. </div>
  58. <div>
  59. <el-button
  60. size="small"
  61. type="primary"
  62. @click="savePurchaseOrder"
  63. v-show="showTwo"
  64. >保存</el-button
  65. >
  66. <el-button
  67. size="small"
  68. type="primary"
  69. @click="toPrint()"
  70. v-show="showOne"
  71. >打印</el-button
  72. >
  73. <el-button
  74. size="small"
  75. type="primary"
  76. @click="checkPurchaseOrder"
  77. v-show="showOne"
  78. >审核</el-button
  79. >
  80. <el-button
  81. size="small"
  82. type="primary"
  83. @click="updatePurchaseOrder"
  84. v-show="showOne"
  85. >保存</el-button
  86. >
  87. </div>
  88. </div>
  89. <el-form :rules="tableRules" :model="recordInfo" ref="tableForm">
  90. <el-table
  91. :row-style="{ color: '#303133' }"
  92. :header-cell-style="{
  93. backgroundColor: 'rgb(245, 247, 250)',
  94. color: '#606266',
  95. }"
  96. :data="recordInfo.tableList"
  97. :class="signAndWeighBoxPatients"
  98. border
  99. style="width: 100%"
  100. max-height="450"
  101. >
  102. <el-table-column align="center" width="200px">
  103. <template slot="header" slot-scope="scope">
  104. <span>商品<span style="color: red">*</span></span>
  105. </template>
  106. <template slot-scope="scope">
  107. <el-form-item
  108. :prop="'tableList.' + scope.$index + '.name'"
  109. :rules="tableRules.name"
  110. >
  111. <el-select
  112. v-model="scope.row.name"
  113. style="width: 160px"
  114. filterable
  115. placeholder="请选择商品"
  116. @change="changeName"
  117. @input="changeGoodName(scope.$index)"
  118. :disabled="disabled"
  119. >
  120. <el-option
  121. v-for="(item, index) in tabList"
  122. :key="index"
  123. :label="item.supply_name"
  124. :value="item"
  125. >
  126. </el-option>
  127. </el-select>
  128. </el-form-item>
  129. </template>
  130. </el-table-column>
  131. <el-table-column align="center" width="150px">
  132. <template slot="header" slot-scope="scope">
  133. <span>商品类别</span>
  134. </template>
  135. <template slot-scope="scope">
  136. <el-input
  137. v-model="scope.row.supply_type"
  138. style="width: 120px"
  139. :disabled="true"
  140. placeholder="商品类别"
  141. ></el-input>
  142. <div style="visibility: hidden">/</div>
  143. </template>
  144. </el-table-column>
  145. <el-table-column label="规格&单位" align="center" width="200px">
  146. <template slot-scope="scope">
  147. <el-input
  148. placeholder="规格&单位"
  149. v-model="scope.row.supply_specification_name"
  150. style="width: 150px"
  151. :disabled="true"
  152. ></el-input>
  153. <div style="visibility: hidden">/</div>
  154. </template>
  155. </el-table-column>
  156. <el-table-column label="单位" align="center" width="120px">
  157. <template slot="header" slot-scope="scope">
  158. <span>单位<span style="color: red">*</span></span>
  159. </template>
  160. <template slot-scope="scope">
  161. <el-form-item
  162. :prop="'tableList.' + scope.$index + '.supply_unit'"
  163. :rules="tableRules.supply_unit"
  164. >
  165. <el-select
  166. v-model="scope.row.supply_unit"
  167. style="width: 100px"
  168. filterable
  169. placeholder="请选择"
  170. :disabled="disabled"
  171. >
  172. <el-option
  173. v-for="(item, index) in scope.row.unitList"
  174. :key="index"
  175. :label="item.name"
  176. :value="item.name"
  177. >
  178. </el-option>
  179. </el-select>
  180. </el-form-item>
  181. </template>
  182. </el-table-column>
  183. <el-table-column label="可用库存" align="center" width="130px">
  184. <template slot-scope="scope">
  185. <el-input
  186. v-model="scope.row.supply_total"
  187. style="width: 100px"
  188. :disabled="true"
  189. ></el-input>
  190. <div style="visibility: hidden">/</div>
  191. </template>
  192. </el-table-column>
  193. <el-table-column label="数量" align="center" width="140px">
  194. <template slot="header" slot-scope="scope">
  195. <span>数量<span style="color: red">*</span></span>
  196. </template>
  197. <template slot-scope="scope">
  198. <el-form-item
  199. :prop="'tableList.' + scope.$index + '.supply_count'"
  200. :rules="tableRules.supply_count"
  201. >
  202. <el-input
  203. v-model="scope.row.supply_count"
  204. style="width: 100px"
  205. :disabled="disabled"
  206. placeholder="请输入数量"
  207. ></el-input>
  208. </el-form-item>
  209. </template>
  210. </el-table-column>
  211. <el-table-column label="采购单价" align="center" width="180px">
  212. <template slot-scope="scope">
  213. <el-input
  214. v-model="scope.row.supply_price"
  215. style="width: 140px"
  216. :disabled="disabled"
  217. placeholder="请输入购货单价"
  218. ></el-input>
  219. <div style="visibility: hidden">/</div>
  220. </template>
  221. </el-table-column>
  222. <el-table-column label="购货金额" align="center" width="120px">
  223. <template slot-scope="scope">
  224. {{ calculate(scope.row.supply_count * scope.row.supply_price) }}
  225. </template>
  226. </el-table-column>
  227. <el-table-column label="生产厂家" align="center" width="200px">
  228. <template slot-scope="scope">
  229. <el-select
  230. size="small"
  231. v-model="scope.row.supply_manufacturer"
  232. filterable
  233. :disabled="true"
  234. >
  235. <el-option
  236. v-for="(option, index) in manufactuerList"
  237. :key="index"
  238. :label="option.manufacturer_name"
  239. :value="option.id"
  240. >
  241. </el-option>
  242. </el-select>
  243. <div style="visibility: hidden">/</div>
  244. </template>
  245. </el-table-column>
  246. <el-table-column label="批准文号" align="center" width="200px">
  247. <template slot-scope="scope">
  248. <el-input
  249. v-model="scope.row.supply_license_number"
  250. style="width: 160px"
  251. :disabled="true"
  252. ></el-input>
  253. <div style="visibility: hidden">/</div>
  254. </template>
  255. </el-table-column>
  256. <el-table-column label="备注" align="center" width="200px">
  257. <template slot-scope="scope">
  258. <el-input
  259. v-model="scope.row.supply_remake"
  260. style="width: 160px"
  261. :disabled="disabled"
  262. placeholder="请输入备注"
  263. ></el-input>
  264. <div style="visibility: hidden">/</div>
  265. </template>
  266. </el-table-column>
  267. <el-table-column
  268. label="操作"
  269. align="center"
  270. width="150px"
  271. fixed="right"
  272. >
  273. <template slot-scope="scope">
  274. <el-tooltip
  275. class="item"
  276. effect="dark"
  277. content="新增"
  278. placement="top"
  279. >
  280. <el-button
  281. size="mini"
  282. type="primary"
  283. icon="el-icon-circle-plus-outline"
  284. @click="handleEdit(scope.$index, scope.row)"
  285. >
  286. </el-button>
  287. </el-tooltip>
  288. <el-tooltip
  289. class="item"
  290. effect="dark"
  291. content="删除"
  292. placement="top"
  293. >
  294. <el-button
  295. size="mini"
  296. type="danger"
  297. icon="el-icon-delete"
  298. @click="handleDelete(scope.$index, scope.row)"
  299. >
  300. </el-button>
  301. </el-tooltip>
  302. </template>
  303. </el-table-column>
  304. </el-table>
  305. <div style="margin-top: 10px">
  306. <el-input
  307. type="textarea"
  308. :rows="2"
  309. placeholder="备注信息"
  310. v-model="return_remark"
  311. >
  312. </el-input>
  313. </div>
  314. <!-- 审核水印 -->
  315. <img src="@/assets/purchase/Reviewed.png" alt="正在加载..." class="reviewImg" v-show="Reviewed == true" />
  316. </el-form>
  317. <div style="margin-top: 10px">合计:{{ getAllPrice() }} 元</div>
  318. <div style="margin-top: 10px">
  319. <span
  320. >优惠率:<el-input
  321. style="width: 150px"
  322. v-model="rate_of_concession"
  323. @input="addressChange"
  324. placeholder="请输入优惠率"
  325. ></el-input
  326. >%</span
  327. >
  328. <span
  329. >优惠金额:<el-input
  330. style="width: 150px"
  331. v-model="discount_amount"
  332. placeholder="请输入优惠金额"
  333. ></el-input
  334. ></span>
  335. </div>
  336. </div>
  337. </div>
  338. </template>
  339. <script>
  340. import BreadCrumb from "@/xt_pages/components/bread-crumb";
  341. import { uParseTime } from "@/utils/tools";
  342. import {
  343. getInitOrder,
  344. savePurchaseOrder,
  345. updatePurchaseOrder,
  346. checkPurchaseOrder,
  347. } from "@/api/supply";
  348. import { getDataConfig } from "@/utils/data";
  349. export default {
  350. name: "addPurchaseOrder",
  351. components: {
  352. BreadCrumb,
  353. },
  354. data() {
  355. return {
  356. Reviewed:false,
  357. crumbs: [
  358. { path: false, name: "购货订单" },
  359. { path: "/spply/query", name: "新增购货订单" },
  360. ],
  361. showTwo: true,
  362. showOne: false,
  363. recordInfo: {
  364. tableList: [],
  365. },
  366. keywords: "",
  367. total: 0,
  368. multipleSelection: [],
  369. signAndWeighBoxPatients: "sign-and-weigh-box-patients",
  370. start_time: "",
  371. end_time: "",
  372. page: 1,
  373. limit: 10,
  374. goodType: [],
  375. goodInfo: [],
  376. org_id: 0,
  377. types: [],
  378. tyep_name: "",
  379. form: {
  380. manufacturer_id: "",
  381. },
  382. tabList: [],
  383. manufactuerList: [],
  384. currentIndex: 0,
  385. goodTypeList: [],
  386. drugTypeList: [],
  387. supplier_name: "",
  388. supplyList: [],
  389. rate_of_concession: "",
  390. discount_amount: "",
  391. start_time: new Date(),
  392. end_time: new Date(),
  393. tableRules: {
  394. name: [{ required: true, message: "商品不能为空", trigger: "blur" }],
  395. supply_count: [
  396. { required: true, message: "数量不能为空", trigger: "blur" },
  397. ],
  398. supply_unit: [
  399. { required: true, message: "单位不能为空", trigger: "blur" },
  400. ],
  401. },
  402. warehousing_id: 0,
  403. number: "",
  404. loading: false,
  405. drugList: [],
  406. goodList: [],
  407. id: 0,
  408. disabled: false,
  409. unitList: [
  410. { id: 1, name: "" },
  411. { id: 2, name: "" },
  412. ],
  413. goodList: [{ id: 1, name: "" }],
  414. total_price: 0,
  415. return_remark:"",
  416. };
  417. },
  418. methods: {
  419. getInitOrder() {
  420. getInitOrder().then((response) => {
  421. if (response.data.state == 1) {
  422. var drugList = response.data.data.drugList;
  423. this.manufactuerList = response.data.data.manufactuerList;
  424. this.goodTypeList = response.data.data.goodTypeList;
  425. this.drugTypeList = response.data.data.drugTypeList;
  426. this.supplyList = response.data.data.supplyList;
  427. for (let i = 0; i < drugList.length; i++) {
  428. for (let z = 0; z < drugList[i].drug_warehouse_info.length; z++) {
  429. drugList[i].drug_warehouse_info[z].stock_max_number =
  430. drugList[i].drug_warehouse_info[z].stock_max_number *
  431. drugList[i].min_number;
  432. }
  433. for (let j = 0; j < this.manufactuerList.length; j++) {
  434. if (drugList[i].manufacturer == this.manufactuerList[j].id) {
  435. drugList[i].manufacturer =
  436. this.manufactuerList[j].manufacturer_name;
  437. }
  438. }
  439. for (let y = 0; y < this.drugTypeList.length; y++) {
  440. if (drugList[i].drug_type == this.drugTypeList[y].value) {
  441. drugList[i].drug_type = this.drugTypeList[y].name;
  442. }
  443. }
  444. drugList[i].supply_name =
  445. drugList[i].drug_name +
  446. " " +
  447. drugList[i].dose +
  448. drugList[i].dose_unit +
  449. "*" +
  450. drugList[i].min_number +
  451. drugList[i].min_unit +
  452. "/" +
  453. drugList[i].max_unit +
  454. " " +
  455. drugList[i].manufacturer;
  456. drugList[i].supply_type = drugList[i].drug_type;
  457. drugList[i].supply_specification_name =
  458. drugList[i].dose +
  459. drugList[i].dose_unit +
  460. "*" +
  461. drugList[i].min_number +
  462. drugList[i].min_unit +
  463. "/" +
  464. drugList[i].max_unit;
  465. drugList[i].supply_total = this.getWarehoseInfo(
  466. drugList[i].drug_warehouse_info,
  467. drugList[i].max_unit,
  468. drugList[i].min_unit,
  469. drugList[i].min_number
  470. );
  471. drugList[i].supply_count = "";
  472. drugList[i].supply_total_price = "";
  473. drugList[i].supply_manufacturer = drugList[i].manufacturer;
  474. drugList[i].supply_license_number = drugList[i].number;
  475. drugList[i].supply_remake = "";
  476. drugList[i].type = 1;
  477. drugList[i].supply_price = drugList[i].last_price;
  478. drugList[i].name = drugList[i].drug_name;
  479. drugList[i].supply_unit = drugList[i].max_unit;
  480. drugList[i].unitList = [
  481. { id: 1, name: "" },
  482. { id: 2, name: "" },
  483. ];
  484. for (let j = 0; j < drugList[i].unitList.length; j++) {
  485. drugList[i].unitList[0].name = drugList[i].max_unit;
  486. drugList[i].unitList[1].name = drugList[i].min_unit;
  487. }
  488. this.tabList.push(drugList[i]);
  489. }
  490. this.drugList = drugList;
  491. var goodList = response.data.data.goodList;
  492. for (let i = 0; i < goodList.length; i++) {
  493. for (let j = 0; j < this.manufactuerList.length; j++) {
  494. if (goodList[i].manufacturer == this.manufactuerList[j].id) {
  495. goodList[i].manufacturer =
  496. this.manufactuerList[j].manufacturer_name;
  497. }
  498. }
  499. for (let y = 0; y < this.goodTypeList.length; y++) {
  500. if (goodList[i].good_type_id == this.goodTypeList[y].id) {
  501. goodList[i].good_type_id = this.goodTypeList[y].type_name;
  502. }
  503. }
  504. goodList[i].supply_name =
  505. goodList[i].good_name +
  506. " " +
  507. goodList[i].specification_name +
  508. " " +
  509. goodList[i].manufacturer;
  510. goodList[i].supply_type = goodList[i].good_type_id;
  511. goodList[i].supply_specification_name =
  512. goodList[i].specification_name;
  513. goodList[i].supply_price = goodList[i].buy_price;
  514. goodList[i].supply_total = this.getTotalStockCount(
  515. goodList[i].good_warehouse_info
  516. );
  517. goodList[i].supply_count = "";
  518. goodList[i].supply_total_price = "";
  519. goodList[i].supply_manufacturer = goodList[i].manufacturer;
  520. goodList[i].supply_license_number = "";
  521. goodList[i].supply_remake = "";
  522. goodList[i].type = 2;
  523. goodList[i].name = goodList[i].good_name;
  524. goodList[i].supply_unit = goodList[i].packing_unit;
  525. goodList[i].unitList = [
  526. { id: 1, name: "" },
  527. { id: 2, name: "" },
  528. ];
  529. for (let j = 0; j < goodList[i].unitList.length; j++) {
  530. goodList[i].unitList[0].name = goodList[i].packing_unit;
  531. }
  532. this.tabList.push(goodList[i]);
  533. }
  534. this.goodList = goodList;
  535. }
  536. });
  537. },
  538. changeGoodName(val) {
  539. this.currentIndex = val;
  540. },
  541. changeName(val) {
  542. for (let i = 0; i < this.recordInfo.tableList.length; i++) {
  543. if (this.currentIndex == i) {
  544. this.recordInfo.tableList[i].project_id = val.id;
  545. this.recordInfo.tableList[i].type = val.type;
  546. this.recordInfo.tableList[i].name = val.name;
  547. this.recordInfo.tableList[i].supply_name = val.supply_name;
  548. this.recordInfo.tableList[i].supply_type = val.supply_type;
  549. this.recordInfo.tableList[i].supply_specification_name =
  550. val.supply_specification_name;
  551. this.recordInfo.tableList[i].supply_total = val.supply_total;
  552. if (val.supply_count == NaN) {
  553. this.recordInfo.tableList[i].supply_count = "";
  554. } else {
  555. this.recordInfo.tableList[i].supply_count = val.supply_count
  556. ? val.supply_count
  557. : "";
  558. }
  559. this.recordInfo.tableList[i].supply_price = val.supply_price
  560. ? val.supply_price
  561. : "";
  562. this.recordInfo.tableList[i].supply_total_price =
  563. val.supply_total_price ? val.supply_total_price : "";
  564. this.recordInfo.tableList[i].supply_manufacturer =
  565. val.supply_manufacturer;
  566. this.recordInfo.tableList[i].supply_license_number =
  567. val.supply_license_number;
  568. this.recordInfo.tableList[i].supply_remake = val.supply_remake;
  569. this.recordInfo.tableList[i].is_total = val.is_total;
  570. this.recordInfo.tableList[i].supply_unit = val.supply_unit;
  571. this.recordInfo.tableList[i].unitList = val.unitList;
  572. }
  573. }
  574. },
  575. handleEdit() {
  576. const tempObj = {};
  577. tempObj["id"] = 0;
  578. tempObj["name"] = "";
  579. tempObj["supply_name"] = "";
  580. tempObj["supply_type"] = "";
  581. tempObj["supply_specification_name"] = "";
  582. tempObj["supply_total"] = "";
  583. tempObj["supply_count"] = "";
  584. tempObj["supply_price"] = "";
  585. tempObj["supply_total_price"] = "";
  586. tempObj["supply_manufacturer"] = "";
  587. tempObj["supply_license_number"] = "";
  588. tempObj["supply_remake"] = "";
  589. tempObj["type"] = 0;
  590. tempObj["is_total"] = 1;
  591. tempObj["project_id"] = 0;
  592. tempObj["supply_unit"] = "";
  593. this.recordInfo.tableList.push(tempObj);
  594. },
  595. handleDelete: function (index, row) {
  596. if (this.recordInfo.tableList.length <= 1) {
  597. this.$message.error("只有一条记录的时候无法删除");
  598. return;
  599. } else {
  600. this.recordInfo.tableList.splice(index, 1);
  601. }
  602. },
  603. savePurchaseOrder() {
  604. if (this.supplier_name == 0 || this.supplier_name == "") {
  605. this.$message.error("供应商不能为空!");
  606. this.loading = false;
  607. return false;
  608. }
  609. this.$refs["tableForm"].validate((valid) => {
  610. if (valid) {
  611. this.loading = true;
  612. for (let i = 0; i < this.recordInfo.tableList.length; i++) {
  613. this.recordInfo.tableList[i].supply_count = parseInt(
  614. this.recordInfo.tableList[i].supply_count
  615. );
  616. this.recordInfo.tableList[i].supply_license_number =
  617. this.recordInfo.tableList[i].supply_license_number.toString();
  618. this.recordInfo.tableList[i].supply_total_price = (
  619. this.recordInfo.tableList[i].supply_count *
  620. this.recordInfo.tableList[i].supply_price
  621. ).toString();
  622. this.recordInfo.tableList[i].supply_total =
  623. this.recordInfo.tableList[i].supply_total.toString();
  624. this.recordInfo.tableList[i].supply_price =
  625. this.recordInfo.tableList[i].supply_price.toString();
  626. for (let j = 0; j < this.manufactuerList.length; j++) {
  627. if (
  628. this.recordInfo.tableList[i].supply_manufacturer ==
  629. this.manufactuerList[j].manufacturer_name
  630. ) {
  631. this.recordInfo.tableList[i].manufacturer_id =
  632. this.manufactuerList[j].id;
  633. }
  634. }
  635. }
  636. var start = this.getTimes(this.start_time);
  637. var end = this.getTimes(this.end_time);
  638. const params = {
  639. stockIn: this.recordInfo.tableList,
  640. return_remake:this.return_remark,
  641. };
  642. console.log("params23322323", params);
  643. savePurchaseOrder(
  644. params,
  645. this.supplier_name,
  646. start,
  647. end,
  648. this.rate_of_concession,
  649. this.discount_amount
  650. ).then((response) => {
  651. if (response.data.state == 1) {
  652. var order = response.data.data.order;
  653. this.loading = false;
  654. this.$message.success("保存成功!");
  655. var warehouseInfo = response.data.data.warehouseInfo;
  656. if(warehouseInfo.is_check == 1){
  657. this.Reviewed = true
  658. }
  659. this.number = warehouseInfo.number;
  660. this.return_remark = warehouseInfo.return_remake
  661. this.id = warehouseInfo.id;
  662. this.recordInfo.tableList = [];
  663. var orderInfo = response.data.data.orderInfo;
  664. for (let i = 0; i < orderInfo.length; i++) {
  665. if (orderInfo[i].is_source == 1) {
  666. for (let j = 0; j < this.drugList.length; j++) {
  667. if (orderInfo[i].project_id == this.drugList[j].id) {
  668. orderInfo[i].unitList = [
  669. { id: 1, name: "" },
  670. { id: 2, name: "" },
  671. ];
  672. orderInfo[i].unitList[0].name = this.drugList[j].max_unit;
  673. orderInfo[i].unitList[1].name = this.drugList[j].min_unit;
  674. }
  675. }
  676. }
  677. if (orderInfo[i].is_source == 2) {
  678. for (let j = 0; j < this.goodList.length; j++) {
  679. if (orderInfo[i].project_id == this.goodList[j].id) {
  680. orderInfo[i].unitList = [{ id: 1, name: "" }];
  681. orderInfo[i].unitList[0].name =
  682. this.goodList[j].packing_unit;
  683. }
  684. }
  685. }
  686. orderInfo[i].supply_count = orderInfo[i].count;
  687. orderInfo[i].supply_price = orderInfo[i].price;
  688. orderInfo[i].supply_remake = orderInfo[i].remark;
  689. orderInfo[i].type = orderInfo[i].is_source;
  690. orderInfo[i].project_id = orderInfo[i].project_id;
  691. orderInfo[i].supply_unit = orderInfo[i].supply_unit;
  692. }
  693. console.log("orderINFO23323232", orderInfo);
  694. this.recordInfo.tableList = orderInfo;
  695. for(let i=0;i<orderInfo.length;i++){
  696. orderInfo[i].name = ""
  697. orderInfo[i].supply_name = ""
  698. orderInfo[i].supply_specification_name = ""
  699. if(orderInfo[i].is_source == 1){
  700. for(let j=0;j<this.drugList.length;j++){
  701. if(orderInfo[i].project_id == this.drugList[j].id){
  702. orderInfo[i].name = this.drugList[j].drug_name
  703. }
  704. }
  705. }
  706. if(orderInfo[i].is_source == 2){
  707. for(let y=0;y<this.goodList.length;y++){
  708. if(orderInfo[i].project_id = this.goodList[y].id){
  709. orderInfo[i].name = this.goodList[y].good_name
  710. }
  711. }
  712. }
  713. }
  714. this.showTwo = false;
  715. this.showOne = true;
  716. }
  717. });
  718. }
  719. });
  720. },
  721. getWarehoseInfo(arr, max_unit, min_unit, min_number) {
  722. var total = 0;
  723. var max_str = "";
  724. var min_str = "";
  725. if (arr.length > 0) {
  726. for (let i = 0; i < arr.length; i++) {
  727. total += parseInt(arr[i].stock_max_number);
  728. }
  729. }
  730. if (total < min_number) {
  731. min_str = total + min_unit;
  732. }
  733. if (total == 0) {
  734. min_str = "";
  735. max_str = "";
  736. }
  737. if (total >= min_number) {
  738. if (parseInt(total / min_number) != 0) {
  739. max_str = parseInt(total / min_number) + max_unit;
  740. }
  741. if (total % min_number != 0) {
  742. min_str = (total % min_number) + min_unit;
  743. }
  744. }
  745. return max_str + min_str;
  746. },
  747. getTotalStockCount(arr) {
  748. var total_count = 0;
  749. for (let i = 0; i < arr.length; i++) {
  750. total_count += arr[i].stock_count;
  751. }
  752. return total_count;
  753. },
  754. calculate: function (val) {
  755. if (isNaN(val)) {
  756. return "";
  757. }
  758. if (val == 0) {
  759. return "";
  760. }
  761. return Math.round(parseFloat(val) * 100) / 100;
  762. },
  763. getTimes(time) {
  764. if (time === "") {
  765. return "";
  766. }
  767. return uParseTime(time, "{y}-{m}-{d}");
  768. },
  769. updatePurchaseOrder() {
  770. if (this.supplier_name == 0 || this.supplier_name == "") {
  771. this.$message.error("供应商不能为空!");
  772. this.loading = false;
  773. return false;
  774. }
  775. this.$refs["tableForm"].validate((valid) => {
  776. if (valid) {
  777. this.loading = true;
  778. for (let i = 0; i < this.recordInfo.tableList.length; i++) {
  779. this.recordInfo.tableList[i].supply_count = parseInt(
  780. this.recordInfo.tableList[i].supply_count
  781. );
  782. this.recordInfo.tableList[i].supply_license_number =
  783. this.recordInfo.tableList[i].supply_license_number.toString();
  784. this.recordInfo.tableList[i].supply_total_price = (
  785. this.recordInfo.tableList[i].supply_count *
  786. this.recordInfo.tableList[i].supply_price
  787. ).toString();
  788. this.recordInfo.tableList[i].supply_total =
  789. this.recordInfo.tableList[i].supply_total.toString();
  790. this.recordInfo.tableList[i].supply_price =
  791. this.recordInfo.tableList[i].supply_price.toString();
  792. for (let j = 0; j < this.manufactuerList.length; j++) {
  793. if (
  794. this.recordInfo.tableList[i].supply_manufacturer ==
  795. this.manufactuerList[j].id
  796. ) {
  797. this.recordInfo.tableList[i].supply_manufacturer =
  798. this.manufactuerList[j].manufacturer_name;
  799. }
  800. }
  801. }
  802. var start = this.getTimes(this.start_time);
  803. var end = this.getTimes(this.end_time);
  804. const params = {
  805. stockIn: this.recordInfo.tableList,
  806. return_remake:this.return_remake,
  807. };
  808. console.log("params23232233223", params);
  809. updatePurchaseOrder(
  810. params,
  811. this.supplier_name,
  812. start,
  813. end,
  814. this.rate_of_concession,
  815. this.discount_amount,
  816. this.id,
  817. this.number
  818. ).then((response) => {
  819. if (response.data.state == 1) {
  820. this.loading = false;
  821. var warehousingInfo = response.data.data.warehousingInfo;
  822. this.$message.success("保存成功!");
  823. }
  824. });
  825. }
  826. });
  827. },
  828. getAllPrice() {
  829. var total_price = 0;
  830. for (let i = 0; i < this.recordInfo.tableList.length; i++) {
  831. total_price +=
  832. this.recordInfo.tableList[i].supply_price *
  833. this.recordInfo.tableList[i].supply_count;
  834. }
  835. this.total_price = total_price;
  836. return total_price.toFixed(2);
  837. },
  838. checkPurchaseOrder(id, index) {
  839. this.$confirm("是否审核?", {
  840. confirmButtonText: "确 定",
  841. cancelButtonText: "取 消",
  842. type: "warning",
  843. })
  844. .then(() => {
  845. checkPurchaseOrder(this.id).then((response) => {
  846. if (response.data.state == 1) {
  847. var info = response.data.data.info;
  848. this.disabled = true;
  849. this.$message.success("审核成功!");
  850. this.Reviewed = true
  851. }
  852. });
  853. })
  854. .catch(() => {});
  855. },
  856. toPrint() {
  857. var id = this.id;
  858. this.$router.push({ path: "/purchase/order/print?&id=" + id });
  859. },
  860. getDataConfig(module, filed_name) {
  861. return getDataConfig(module, filed_name);
  862. },
  863. addressChange() {
  864. var discount_amount = 0;
  865. if (this.rate_of_concession > 0) {
  866. discount_amount = (
  867. (this.rate_of_concession / 100) *
  868. this.total_price
  869. ).toFixed(2);
  870. }
  871. this.discount_amount = discount_amount;
  872. },
  873. },
  874. created() {
  875. const tempObj = {};
  876. tempObj["id"] = 0;
  877. tempObj["name"] = "";
  878. tempObj["supply_name"] = "";
  879. tempObj["supply_type"] = "";
  880. tempObj["supply_specification_name"] = "";
  881. tempObj["supply_total"] = "";
  882. tempObj["supply_count"] = "";
  883. tempObj["supply_price"] = "";
  884. tempObj["supply_total_price"] = "";
  885. tempObj["supply_manufacturer"] = "";
  886. tempObj["supply_license_number"] = "";
  887. tempObj["supply_remake"] = "";
  888. tempObj["type"] = 0;
  889. tempObj["is_total"] = 1;
  890. tempObj["project_id"] = 0;
  891. tempObj["supply_unit"] = "";
  892. this.recordInfo.tableList.push(tempObj);
  893. this.getInitOrder();
  894. },
  895. };
  896. </script>
  897. <style rel="stylesheet/css" lang="scss" scoped>
  898. .information {
  899. border: 1px #dcdfe6 solid;
  900. padding: 30px 20px 30px 20px;
  901. .border {
  902. border-bottom: 1px #dcdfe6 solid;
  903. margin: 0px 0 20px 0;
  904. }
  905. }
  906. .title {
  907. background: #409eff;
  908. height: 44px;
  909. line-height: 44px;
  910. padding: 0 0 0 10px;
  911. color: #fff;
  912. margin: 0 0 10px 0;
  913. }
  914. .edit_separater {
  915. border-top: 1px solid rgb(233, 233, 233);
  916. margin-top: 15px;
  917. margin-bottom: 15px;
  918. }
  919. .reviewImg{
  920. position: fixed;
  921. left: 50%;
  922. transform: translateX(-50%);
  923. top: 30%;
  924. }
  925. </style>
  926. <style>
  927. .sign-and-weigh-box .sign-and-weigh-box-patients .cell {
  928. font-size: 12px;
  929. }
  930. .sign-and-weigh-box .sign-and-weigh-box-patients .current-row > td {
  931. background: #6fb5fa;
  932. }
  933. .count {
  934. color: #bd2c00;
  935. }
  936. .el-table td,
  937. .el-table th.is-leaf,
  938. .el-table--border,
  939. .el-table--group {
  940. border-color: #d0d3da;
  941. }
  942. .el-table--border::after,
  943. .el-table--group::after,
  944. .el-table::before {
  945. background-color: #d0d3da;
  946. }
  947. .el-table__fixed-right {
  948. width: 150px;
  949. bottom: 20px;
  950. height: 100%;
  951. }
  952. </style>