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

addPurchaseOrder.vue 32KB

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