editGoodOrder.vue 50KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437
  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. :disabled="disabled"
  22. >
  23. <el-option
  24. v-for="item in supplyList"
  25. :key="item.id"
  26. :label="item.supplier_name"
  27. :value="item.id"
  28. >
  29. </el-option>
  30. </el-select>
  31. <span>单据日期:</span>
  32. <el-date-picker
  33. size="small"
  34. v-model="start_time"
  35. prefix-icon="el-icon-date"
  36. :editable="false"
  37. style="width: 196px"
  38. type="date"
  39. placeholder="选择日期时间"
  40. align="right"
  41. format="yyyy-MM-dd"
  42. value-format="yyyy-MM-dd"
  43. :disabled="disabled"
  44. ></el-date-picker>
  45. <!-- <span>交货日期:</span> -->
  46. <!-- <el-date-picker
  47. size="small"
  48. v-model="end_time"
  49. prefix-icon="el-icon-date"
  50. :editable="false"
  51. style="width: 196px;"
  52. type="date"
  53. placeholder="选择日期时间"
  54. align="right"
  55. format="yyyy-MM-dd"
  56. value-format="yyyy-MM-dd"
  57. @change="endTimeChange"
  58. ></el-date-picker> -->
  59. <span>单据编码:{{ good_number }}</span>
  60. </div>
  61. <div>
  62. <el-button size="small" type="primary" @click="updateGoodOrder">保存</el-button>
  63. <el-button
  64. size="small"
  65. type="primary"
  66. @click="toClick"
  67. v-show="showThree"
  68. >生成采购退货单</el-button
  69. >
  70. <el-button
  71. size="small"
  72. type="primary"
  73. v-show="showOne"
  74. @click="checkGoodOrder"
  75. >审核</el-button
  76. >
  77. <el-button
  78. size="small"
  79. type="primary"
  80. v-show="showTwo"
  81. @click="MofyGoodOrder"
  82. >反审核</el-button
  83. >
  84. </div>
  85. </div>
  86. <el-form :rules="tableRules" :model="recordInfo" ref="tableForm">
  87. <el-table
  88. :row-style="{ color: '#303133' }"
  89. :header-cell-style="{
  90. backgroundColor: 'rgb(245, 247, 250)',
  91. color: '#606266',
  92. }"
  93. :data="recordInfo.tableList"
  94. :class="signAndWeighBoxPatients"
  95. border
  96. style="width: 100%"
  97. max-height="450"
  98. >
  99. <el-table-column align="center" width="200px">
  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
  105. :prop="'tableList.' + scope.$index + '.name'"
  106. :rules="tableRules.name"
  107. >
  108. <el-select
  109. v-model="scope.row.name"
  110. style="width: 160px"
  111. filterable
  112. placeholder="请选择"
  113. @change="changeName"
  114. @input="changeGoodName(scope.$index)"
  115. :disabled="disabled"
  116. >
  117. <el-option
  118. v-for="(item, index) in tabList"
  119. :key="index"
  120. :label="item.supply_name"
  121. :value="item"
  122. >
  123. </el-option>
  124. </el-select>
  125. </el-form-item>
  126. </template>
  127. </el-table-column>
  128. <el-table-column align="center" width="150px">
  129. <template slot="header" slot-scope="scope">
  130. <span>商品类别</span>
  131. </template>
  132. <template slot-scope="scope">
  133. <el-input
  134. v-model="scope.row.supply_type"
  135. style="width: 120px"
  136. :disabled="true"
  137. placeholder="商品类别"
  138. ></el-input>
  139. <div style="visibility: hidden">/</div>
  140. </template>
  141. </el-table-column>
  142. <el-table-column label="规格&单位" align="center" width="150px">
  143. <template slot-scope="scope">
  144. <el-input
  145. v-model="scope.row.supply_specification_name"
  146. style="width: 120px"
  147. :disabled="true"
  148. placeholder="规格&单位"
  149. ></el-input>
  150. <div style="visibility: hidden">/</div>
  151. </template>
  152. </el-table-column>
  153. <el-table-column label="单位" align="center" width="120px">
  154. <template slot="header" slot-scope="scope">
  155. <span>单位<span style="color: red">*</span></span>
  156. </template>
  157. <template slot-scope="scope">
  158. <el-form-item
  159. :prop="'tableList.' + scope.$index + '.supply_unit'"
  160. :rules="tableRules.supply_unit"
  161. >
  162. <el-select
  163. v-model="scope.row.supply_unit"
  164. style="width: 100px"
  165. filterable
  166. placeholder="请选择"
  167. :disabled="disabled"
  168. >
  169. <el-option
  170. v-for="(item, index) in scope.row.unitList"
  171. :key="index"
  172. :label="item.name"
  173. :value="item.name"
  174. >
  175. </el-option>
  176. </el-select>
  177. </el-form-item>
  178. </template>
  179. </el-table-column>
  180. <el-table-column label="批号" align="center" width="200px">
  181. <template slot="header" slot-scope="scope">
  182. <span>批号<span style="color: red">*</span></span>
  183. </template>
  184. <template slot-scope="scope">
  185. <el-form-item
  186. :prop="'tableList.' + scope.$index + '.supply_batch_number'"
  187. :rules="tableRules.supply_batch_number"
  188. >
  189. <el-input
  190. v-model="scope.row.supply_batch_number"
  191. style="width: 180px"
  192. :disabled="disabled"
  193. placeholder="请输入批号"
  194. ></el-input>
  195. </el-form-item>
  196. </template>
  197. </el-table-column>
  198. <el-table-column label="有效日期" align="center" width="200px">
  199. <template slot="header" slot-scope="scope">
  200. <span>有效日期<span style="color: red">*</span></span>
  201. </template>
  202. <template slot-scope="scope">
  203. <el-form-item
  204. :prop="'tableList.' + scope.$index + '.supply_expiry_date'"
  205. :rules="tableRules.supply_expiry_date"
  206. >
  207. <el-date-picker
  208. prefix-icon="el-icon-date"
  209. style="width: 180px"
  210. v-model="scope.row.supply_expiry_date"
  211. type="date"
  212. placeholder="选择日期时间"
  213. format="yyyy-MM-dd"
  214. value-format="yyyy-MM-dd"
  215. :disabled="disabled"
  216. >
  217. </el-date-picker>
  218. </el-form-item>
  219. </template>
  220. </el-table-column>
  221. <el-table-column label="可用库存" align="center" width="150px">
  222. <template slot-scope="scope">
  223. <el-input
  224. v-model="scope.row.supply_total"
  225. style="width: 100px"
  226. :disabled="true"
  227. ></el-input>
  228. <div style="visibility: hidden">/</div>
  229. </template>
  230. </el-table-column>
  231. <el-table-column label="数量" align="center" width="120px">
  232. <template slot="header" slot-scope="scope">
  233. <span>数量<span style="color: red">*</span></span>
  234. </template>
  235. <template slot-scope="scope">
  236. <el-form-item
  237. :prop="'tableList.' + scope.$index + '.supply_count'"
  238. :rules="tableRules.supply_count"
  239. >
  240. <el-input
  241. v-model="scope.row.supply_count"
  242. style="width: 80px"
  243. :disabled="disabled"
  244. placeholder="请输入数量"
  245. ></el-input>
  246. </el-form-item>
  247. </template>
  248. </el-table-column>
  249. <el-table-column label="采购单价" align="center" width="180px">
  250. <template slot-scope="scope">
  251. <el-input
  252. v-model="scope.row.supply_price"
  253. style="width: 140px"
  254. :disabled="disabled"
  255. placeholder="请输入采购单价"
  256. ></el-input>
  257. <div style="visibility: hidden">/</div>
  258. </template>
  259. </el-table-column>
  260. <el-table-column label="采购金额" align="center" width="120px">
  261. <template slot-scope="scope">
  262. {{ calculate(scope.row.supply_count * scope.row.supply_price) }}
  263. </template>
  264. </el-table-column>
  265. <el-table-column label="生产日期" align="center" width="200px">
  266. <template slot="header" slot-scope="scope">
  267. <span>生产日期<span style="color: red">*</span></span>
  268. </template>
  269. <template slot-scope="scope">
  270. <el-form-item
  271. :prop="'tableList.' + scope.$index + '.supply_product_date'"
  272. :rules="tableRules.supply_product_date"
  273. >
  274. <el-date-picker
  275. prefix-icon="el-icon-date"
  276. style="width: 180px"
  277. v-model="scope.row.supply_product_date"
  278. type="date"
  279. placeholder="选择日期时间"
  280. format="yyyy-MM-dd"
  281. value-format="yyyy-MM-dd"
  282. :disabled="disabled"
  283. >
  284. </el-date-picker>
  285. </el-form-item>
  286. </template>
  287. </el-table-column>
  288. <el-table-column label="生产厂家" align="center" width="200px">
  289. <template slot-scope="scope">
  290. <el-select
  291. size="small"
  292. v-model="scope.row.supply_manufacturer"
  293. filterable
  294. :disabled="true"
  295. >
  296. <el-option
  297. v-for="(option, index) in manufactuerList"
  298. :key="index"
  299. :label="option.manufacturer_name"
  300. :value="option.id"
  301. >
  302. </el-option>
  303. </el-select>
  304. <div style="visibility: hidden">/</div>
  305. </template>
  306. </el-table-column>
  307. <el-table-column label="批准文号" align="center" width="200px">
  308. <template slot-scope="scope">
  309. <el-input
  310. v-model="scope.row.supply_license_number"
  311. style="width: 160px"
  312. :disabled="true"
  313. ></el-input>
  314. <div style="visibility: hidden">/</div>
  315. </template>
  316. </el-table-column>
  317. <el-table-column label="关联采购订单号" align="center" width="200px">
  318. <template slot-scope="scope">
  319. <el-input
  320. v-model="scope.row.order_number"
  321. style="width: 160px"
  322. :disabled="true"
  323. ></el-input>
  324. <div style="visibility: hidden">/</div>
  325. </template>
  326. </el-table-column>
  327. <el-table-column label="备注" align="center" width="200px">
  328. <template slot-scope="scope">
  329. <el-input
  330. v-model="scope.row.supply_remake"
  331. style="width: 160px"
  332. :disabled="disabled"
  333. placeholder="请输入备注"
  334. ></el-input>
  335. <div style="visibility: hidden">/</div>
  336. </template>
  337. </el-table-column>
  338. <el-table-column
  339. label="操作"
  340. align="center"
  341. width="150px"
  342. fixed="right"
  343. >
  344. <template slot-scope="scope">
  345. <el-tooltip
  346. class="item"
  347. effect="dark"
  348. content="新增"
  349. placement="top"
  350. >
  351. <el-button
  352. size="mini"
  353. type="primary"
  354. icon="el-icon-circle-plus-outline"
  355. @click="handleEdit(scope.$index, scope.row)"
  356. >
  357. </el-button>
  358. </el-tooltip>
  359. <el-tooltip
  360. class="item"
  361. effect="dark"
  362. content="删除"
  363. placement="top"
  364. >
  365. <el-button
  366. size="mini"
  367. type="danger"
  368. icon="el-icon-delete"
  369. @click="handleDelete(scope.$index, scope.row)"
  370. >
  371. </el-button>
  372. </el-tooltip>
  373. </template>
  374. </el-table-column>
  375. </el-table>
  376. <div style="margin-top: 10px">
  377. <el-input
  378. type="textarea"
  379. :rows="2"
  380. placeholder="备注信息"
  381. v-model="return_remark"
  382. :disabled="disabled"
  383. >
  384. </el-input>
  385. </div>
  386. </el-form>
  387. <div style="margin-top: 10px">合计:{{ getAllPrice() }} 元</div>
  388. <div style="margin-top: 10px">
  389. <span
  390. >优惠率:<el-input
  391. style="width: 150px"
  392. v-model="rate_of_concession"
  393. @input="addressChange"
  394. placeholder="请输入优惠率"
  395. :disabled="disabled"
  396. ></el-input
  397. >%</span
  398. >
  399. <span
  400. >优惠金额:<el-input
  401. style="width: 150px"
  402. v-model="discount_amount"
  403. @input="count_discount"
  404. placeholder="请输入优惠金额"
  405. :disabled="disabled"
  406. ></el-input
  407. ></span>
  408. <span
  409. >本次付款:<el-input
  410. style="width: 150px"
  411. v-model="payment"
  412. @input="count_payment"
  413. placeholder="请输入本次付款"
  414. :disabled="disabled"
  415. ></el-input
  416. ></span>
  417. <span
  418. >本次欠款:<el-input
  419. style="width: 150px"
  420. v-model="arrearage"
  421. @input="count_arrearage"
  422. placeholder="请输入本次欠款"
  423. :disabled="disabled"
  424. ></el-input
  425. ></span>
  426. </div>
  427. <!-- <Computed></Computed> -->
  428. </div>
  429. <popup ref="Popup" :content="content" :content_1="content_1" :content_2="content_2" :number="number" :orderList ="orderList" :type="type"></popup>
  430. </div>
  431. </template>
  432. <script>
  433. import popup from "./Popup"
  434. import Computed from "../../components/Computed/index_1.vue";
  435. import BreadCrumb from "@/xt_pages/components/bread-crumb";
  436. import { uParseTime } from "@/utils/tools";
  437. import {
  438. getInitOrder,
  439. checkPurchaseOrder,
  440. getGoodOrderDetail,
  441. updateGoodOrder,
  442. getGoodOrderCountList,
  443. ModefySupplyWarehousing,
  444. MofyGoodOrder,
  445. UpdateSupplyWahouseingInfo,
  446. getSupplyWarehouseOutById,
  447. deleteGoodOrderById
  448. } from "@/api/supply";
  449. export default {
  450. name: "addPurchaseOrder",
  451. components: {
  452. BreadCrumb,
  453. Computed,
  454. popup,
  455. },
  456. data() {
  457. return {
  458. crumbs: [
  459. { path: false, name: "采购单" },
  460. { path: "/supply/good/order/query", name: "编辑采购单" },
  461. ],
  462. content_2:"退库单",
  463. content:"采购单",
  464. content_1:"已有以下关联数据,不能反审核",
  465. type:2,
  466. orderList:[],
  467. showOne: true,
  468. showTwo: false,
  469. showThree: false,
  470. recordInfo: {
  471. tableList: [],
  472. },
  473. keywords: "",
  474. total: 0,
  475. multipleSelection: [],
  476. signAndWeighBoxPatients: "sign-and-weigh-box-patients",
  477. start_time: "",
  478. end_time: "",
  479. page: 1,
  480. limit: 10,
  481. goodType: [],
  482. goodInfo: [],
  483. org_id: 0,
  484. types: [],
  485. tyep_name: "",
  486. form: {
  487. manufacturer_id: "",
  488. },
  489. tabList: [],
  490. manufactuerList: [],
  491. currentIndex: 0,
  492. goodTypeList: [],
  493. drugTypeList: [],
  494. supplier_name: "",
  495. supplyList: [],
  496. rate_of_concession: "",
  497. discount_amount: "",
  498. start_time: "",
  499. end_time: "",
  500. tableRules: {
  501. name: [{ required: true, message: "商品不能为空", trigger: "blur" }],
  502. supply_count: [
  503. { required: true, message: "数量不能为空", trigger: "blur" },
  504. ],
  505. supply_batch_number: [
  506. { required: true, message: "批号不能为空", trigger: "blur" },
  507. ],
  508. supply_product_date: [
  509. { required: true, message: "生产日期不能为空", trigger: "blur" },
  510. ],
  511. supply_expiry_date: [
  512. { required: true, message: "有效日期不能为空", trigger: "blur" },
  513. ],
  514. },
  515. warehousing_id: 0,
  516. number: "",
  517. loading: false,
  518. drugList: [],
  519. goodList: [],
  520. id: 0,
  521. disabled: false,
  522. is_check: 0,
  523. dialogVisible: false,
  524. arrearage: "",
  525. payment: "",
  526. good_number: "",
  527. orderInfo: [],
  528. warese_out_id: 0,
  529. return_remark: "",
  530. tableDataList:[],
  531. };
  532. },
  533. methods: {
  534. getInitOrder() {
  535. getInitOrder().then((response) => {
  536. if (response.data.state == 1) {
  537. var drugList = response.data.data.drugList;
  538. this.manufactuerList = response.data.data.manufactuerList;
  539. this.goodTypeList = response.data.data.goodTypeList;
  540. this.drugTypeList = response.data.data.drugTypeList;
  541. this.supplyList = response.data.data.supplyList;
  542. for (let i = 0; i < drugList.length; i++) {
  543. for (let z = 0; z < drugList[i].drug_warehouse_info.length; z++) {
  544. if (
  545. drugList[i].max_unit ==
  546. drugList[i].drug_warehouse_info[z].max_unit
  547. ) {
  548. drugList[i].drug_warehouse_info[z].stock_max_number =
  549. drugList[i].drug_warehouse_info[z].stock_max_number *
  550. drugList[i].min_number;
  551. }
  552. }
  553. for (let j = 0; j < this.manufactuerList.length; j++) {
  554. if (drugList[i].manufacturer == this.manufactuerList[j].id) {
  555. drugList[i].manufacturer =
  556. this.manufactuerList[j].manufacturer_name;
  557. }
  558. }
  559. for (let y = 0; y < this.drugTypeList.length; y++) {
  560. if (drugList[i].drug_type == this.drugTypeList[y].value) {
  561. drugList[i].drug_type = this.drugTypeList[y].name;
  562. }
  563. }
  564. 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;
  565. drugList[i].supply_type = drugList[i].drug_type;
  566. drugList[i].supply_specification_name =drugList[i].dose + drugList[i].dose_unit +"*" +drugList[i].min_number +drugList[i].min_unit +"/" +drugList[i].max_unit;
  567. drugList[i].supply_total = this.getWarehoseInfo(drugList[i].drug_warehouse_info,drugList[i].max_unit,drugList[i].min_unit,drugList[i].min_number);
  568. drugList[i].supply_count = "";
  569. drugList[i].supply_total_price = "";
  570. drugList[i].supply_manufacturer = drugList[i].manufacturer;
  571. drugList[i].supply_license_number = drugList[i].number;
  572. drugList[i].supply_remake = "";
  573. drugList[i].type = 1;
  574. drugList[i].supply_price = drugList[i].last_price;
  575. drugList[i].name = drugList[i].drug_name;
  576. if (drugList[i].max_unit != drugList[i].min_unit) {
  577. drugList[i].unitList = [
  578. { id: 1, name: "" },
  579. { id: 2, name: "" },
  580. ];
  581. }
  582. if (drugList[i].max_unit == drugList[i].min_unit) {
  583. drugList[i].unitList = [{ id: 1, name: "" }];
  584. }
  585. drugList[i].warehouse_info_id = 0;
  586. drugList[i].warehousing_id = 0;
  587. drugList[i].supply_unit = drugList[i].max_unit;
  588. for (let j = 0; j < drugList[i].unitList.length; j++) {
  589. if (drugList[i].max_unit != drugList[i].min_unit) {
  590. drugList[i].unitList[0].name = drugList[i].max_unit;
  591. drugList[i].unitList[1].name = drugList[i].min_unit;
  592. }
  593. if (drugList[i].max_unit == drugList[i].min_unit) {
  594. drugList[i].unitList[0].name = drugList[i].max_unit;
  595. }
  596. }
  597. this.tabList.push(drugList[i]);
  598. }
  599. this.drugList = drugList;
  600. var goodList = response.data.data.goodList;
  601. for (let i = 0; i < goodList.length; i++) {
  602. for (let j = 0; j < this.manufactuerList.length; j++) {
  603. if (goodList[i].manufacturer == this.manufactuerList[j].id) {
  604. goodList[i].manufacturer =
  605. this.manufactuerList[j].manufacturer_name;
  606. }
  607. }
  608. for (let y = 0; y < this.goodTypeList.length; y++) {
  609. if (goodList[i].good_type_id == this.goodTypeList[y].id) {
  610. goodList[i].good_type_id = this.goodTypeList[y].type_name;
  611. }
  612. }
  613. goodList[i].supply_name =goodList[i].good_name +" " +goodList[i].specification_name +" " +goodList[i].manufacturer;
  614. goodList[i].supply_type = goodList[i].good_type_id;
  615. goodList[i].supply_specification_name =goodList[i].specification_name;
  616. goodList[i].supply_price = goodList[i].buy_price;
  617. goodList[i].supply_total = this.getTotalStockCount(goodList[i].good_warehouse_info);
  618. goodList[i].supply_count = "";
  619. goodList[i].supply_total_price = "";
  620. goodList[i].supply_manufacturer = goodList[i].manufacturer;
  621. goodList[i].supply_license_number = goodList[i].number;
  622. goodList[i].supply_remake = "";
  623. goodList[i].type = 2;
  624. goodList[i].name = goodList[i].good_name;
  625. goodList[i].unitList = [{ id: 1, name: "" }];
  626. goodList[i].supply_unit = goodList[i].packing_unit;
  627. goodList[i].warehouse_info_id = 0;
  628. goodList[i].warehousing_id = 0;
  629. for (let j = 0; j < goodList[i].unitList.length; j++) {
  630. goodList[i].unitList[0].name = goodList[i].packing_unit;
  631. }
  632. this.tabList.push(goodList[i]);
  633. }
  634. this.goodList = goodList;
  635. }
  636. });
  637. },
  638. changeGoodName(val) {
  639. this.currentIndex = val;
  640. },
  641. changeName(val) {
  642. for (let i = 0; i < this.recordInfo.tableList.length; i++) {
  643. if (this.currentIndex == i) {
  644. this.recordInfo.tableList[i].project_id = val.id;
  645. this.recordInfo.tableList[i].type = val.type;
  646. this.recordInfo.tableList[i].name = val.name;
  647. this.recordInfo.tableList[i].supply_name = val.supply_name;
  648. this.recordInfo.tableList[i].supply_type = val.supply_type;
  649. this.recordInfo.tableList[i].supply_specification_name =
  650. val.supply_specification_name;
  651. this.recordInfo.tableList[i].supply_total = val.supply_total;
  652. if (val.supply_count == NaN) {
  653. this.recordInfo.tableList[i].supply_count = "";
  654. } else {
  655. this.recordInfo.tableList[i].supply_count = val.supply_count
  656. ? val.supply_count
  657. : "";
  658. }
  659. this.recordInfo.tableList[i].supply_price = val.supply_price
  660. ? val.supply_price
  661. : "";
  662. this.recordInfo.tableList[i].supply_total_price = (
  663. val.supply_count * val.supply_price
  664. ).toFixed(2);
  665. this.recordInfo.tableList[i].supply_manufacturer =
  666. val.supply_manufacturer;
  667. this.recordInfo.tableList[i].supply_license_number =
  668. val.supply_license_number;
  669. this.recordInfo.tableList[i].supply_remake = val.supply_remake;
  670. this.recordInfo.tableList[i].is_total = val.is_total;
  671. this.recordInfo.tableList[i].supply_unit = val.supply_unit;
  672. this.recordInfo.tableList[i].unitList = val.unitList;
  673. this.recordInfo.tableList[i].warehouse_info_id =
  674. val.warehouse_info_id;
  675. this.recordInfo.tableList[i].warehousing_id = val.warehousing_id;
  676. }
  677. }
  678. },
  679. handleEdit() {
  680. const tempObj = {};
  681. tempObj["id"] = 0;
  682. tempObj["name"] = "";
  683. tempObj["supply_name"] = "";
  684. tempObj["supply_type"] = "";
  685. tempObj["supply_specification_name"] = "";
  686. tempObj["supply_total"] = "";
  687. tempObj["supply_count"] = "";
  688. tempObj["supply_price"] = "";
  689. tempObj["supply_total_price"] = "";
  690. tempObj["supply_manufacturer"] = "";
  691. tempObj["supply_license_number"] = "";
  692. tempObj["supply_remake"] = "";
  693. tempObj["type"] = 0;
  694. tempObj["is_total"] = 1;
  695. tempObj["project_id"] = 0;
  696. tempObj["supply_unit"] = "";
  697. tempObj["supply_batch_number"] = "";
  698. tempObj["supply_product_date"] = "";
  699. tempObj["order_number"] = "";
  700. tempObj["supply_expiry_date"] = "";
  701. tempObj["manufacturer_id"] = "";
  702. tempObj["warehouse_info_id"] = "";
  703. tempObj["warehousing_id"] = "";
  704. tempObj["number"] = "";
  705. tempObj["good_number"] = "";
  706. this.recordInfo.tableList.push(tempObj);
  707. },
  708. handleDelete: function (index, row) {
  709. if(this.is_check == 1){
  710. this.$message.error("已审核单据,不能删除!")
  711. return false
  712. }
  713. if(row.id == 0){
  714. if (this.recordInfo.tableList.length <= 1) {
  715. this.$message.error("只有一条记录的时候无法删除");
  716. return;
  717. } else {
  718. this.recordInfo.tableList.splice(index, 1);
  719. }
  720. }else{
  721. const params = {
  722. id: row.id
  723. }
  724. this.$confirm('确认删除吗?', {
  725. confirmButtonText: '确定',
  726. cancelButtonText: '取消',
  727. type: 'warning'
  728. }).then(() => {
  729. deleteGoodOrderById(params).then(response => {
  730. if (response.data.state == 0) {
  731. this.$message.error(response.data.msg)
  732. return false
  733. } else {
  734. this.$message.success('删除成功')
  735. this.recordInfo.tableList.splice(index, 1)
  736. }
  737. })
  738. }).catch(() => {
  739. })
  740. }
  741. },
  742. getWarehoseInfo(arr, max_unit, min_unit, min_number) {
  743. var total = 0;
  744. var max_str = "";
  745. var min_str = "";
  746. if (arr.length > 0) {
  747. for (let i = 0; i < arr.length; i++) {
  748. total += parseInt(arr[i].stock_max_number + arr[i].stock_min_number);
  749. }
  750. }
  751. if (total < min_number) {
  752. min_str = total + min_unit;
  753. }
  754. if (total == 0) {
  755. min_str = "";
  756. max_str = "";
  757. }
  758. if (total >= min_number) {
  759. if (parseInt(total / min_number) != 0) {
  760. max_str = parseInt(total / min_number) + max_unit;
  761. }
  762. if (total % min_number != 0) {
  763. min_str = (total % min_number) + min_unit;
  764. }
  765. }
  766. return max_str + min_str;
  767. },
  768. getTotalStockCount(arr) {
  769. var total_count = 0;
  770. for (let i = 0; i < arr.length; i++) {
  771. total_count += arr[i].stock_count;
  772. }
  773. return total_count;
  774. },
  775. calculate: function (val) {
  776. if (isNaN(val)) {
  777. return "";
  778. }
  779. if (val == 0) {
  780. return "";
  781. }
  782. return Math.round(parseFloat(val) * 100) / 100;
  783. },
  784. getTimes(time) {
  785. if (time === "") {
  786. return "";
  787. }
  788. return uParseTime(time, "{y}-{m}-{d}");
  789. },
  790. getAllPrice() {
  791. var total_price = 0;
  792. for (let i = 0; i < this.recordInfo.tableList.length; i++) {
  793. total_price +=
  794. this.recordInfo.tableList[i].supply_price *
  795. this.recordInfo.tableList[i].supply_count;
  796. }
  797. this.total_price = total_price;
  798. return total_price.toFixed(2);
  799. },
  800. addressChange() {
  801. var discount_amount = 0;
  802. if (this.rate_of_concession > 0) {
  803. discount_amount = (
  804. (this.rate_of_concession / 100) *
  805. this.total_price
  806. ).toFixed(2);
  807. }
  808. this.discount_amount = discount_amount;
  809. },
  810. count_discount() {
  811. this.rate_of_concession = (
  812. this.discount_amount /
  813. (this.total_price * 0.01)
  814. ).toFixed(2);
  815. },
  816. count_payment() {
  817. this.arrearage = this.total_price - this.payment;
  818. },
  819. count_arrearage() {
  820. this.payment = this.total_price - this.arrearage;
  821. },
  822. checkPurchaseOrder(id, index) {
  823. this.$confirm("是否审核?", {
  824. confirmButtonText: "确 定",
  825. cancelButtonText: "取 消",
  826. type: "warning",
  827. }).then(() => {
  828. checkPurchaseOrder(this.id).then((response) => {
  829. if (response.data.state == 1) {
  830. var info = response.data.data.info;
  831. this.disabled = true;
  832. this.$message.success("审核成功!");
  833. this.getPurchaseOrderDetail();
  834. }
  835. });
  836. })
  837. .catch(() => {});
  838. },
  839. getGoodOrderDetail() {
  840. var id = this.$route.query.id;
  841. getGoodOrderDetail(id).then((response) => {
  842. if (response.data.state == 1) {
  843. var out = response.data.data.out;
  844. this.is_check = out.is_check;
  845. if (out.is_check == 1) {
  846. this.showOne = false;
  847. this.showTwo = true;
  848. this.showThree = true;
  849. this.disabled = true
  850. }
  851. this.id = out.id;
  852. this.supplier_name = out.supplier_id;
  853. this.rate_of_concession = out.rate_of_concession;
  854. this.discount_amount = out.discount_amount;
  855. this.payment = out.payment;
  856. this.arrearage = out.arrearage;
  857. this.number = out.number;
  858. this.good_number = out.good_number;
  859. this.return_remark = out.return_remake;
  860. this.start_time = this.getTimes(out.document_date);
  861. var orderInfo = response.data.data.list;
  862. var drugList = response.data.data.drugList;
  863. var goodList = response.data.data.goodList;
  864. for (let i = 0; i < orderInfo.length; i++) {
  865. orderInfo[i].supply_count = orderInfo[i].count;
  866. orderInfo[i].supply_price = orderInfo[i].price;
  867. orderInfo[i].supply_remake = orderInfo[i].remark;
  868. orderInfo[i].type = orderInfo[i].is_source;
  869. orderInfo[i].project_id = orderInfo[i].project_id;
  870. orderInfo[i].supply_unit = orderInfo[i].supply_unit;
  871. orderInfo[i].order_number = orderInfo[i].order_number;
  872. orderInfo[i].supply_total_price = (
  873. orderInfo[i].count * orderInfo[i].price
  874. ).toFixed(2);
  875. orderInfo[i].supply_expiry_date = this.getTimes(
  876. orderInfo[i].supply_expiry_date
  877. );
  878. orderInfo[i].supply_product_date = this.getTimes(
  879. orderInfo[i].supply_product_date
  880. );
  881. if (orderInfo[i].is_source == 1) {
  882. for (let j = 0; j < drugList.length; j++) {
  883. if (orderInfo[i].project_id == drugList[j].id) {
  884. if (drugList[j].max_unit != drugList[j].min_unit) {
  885. orderInfo[i].unitList = [
  886. { id: 1, name: "" },
  887. { id: 2, name: "" },
  888. ];
  889. orderInfo[i].unitList[0].name = drugList[j].max_unit;
  890. orderInfo[i].unitList[1].name = drugList[j].min_unit;
  891. }
  892. if (drugList[j].max_unit == drugList[j].min_unit) {
  893. orderInfo[i].unitList = [{ id: 1, name: "" }];
  894. orderInfo[i].unitList[0].name = drugList[j].max_unit;
  895. }
  896. }
  897. }
  898. }
  899. if (orderInfo[i].is_source == 2) {
  900. for (let j = 0; j < goodList.length; j++) {
  901. if (orderInfo[i].project_id == goodList[j].id) {
  902. orderInfo[i].unitList = [{ id: 1, name: "" }];
  903. orderInfo[i].unitList[0].name = goodList[j].packing_unit;
  904. }
  905. }
  906. }
  907. }
  908. this.recordInfo.tableList = [];
  909. this.recordInfo.tableList = orderInfo;
  910. this.tableDataList = []
  911. this.tableDataList = orderInfo
  912. }
  913. });
  914. },
  915. toPrint() {
  916. var id = this.$route.query.id;
  917. this.$router.push({ path: "/purchase/order/print?&id=" + id });
  918. },
  919. updateGoodOrder() {
  920. if (this.supplier_name == 0 || this.supplier_name == "") {
  921. this.$message.error("供应商不能为空!");
  922. this.loading = false;
  923. return false;
  924. }
  925. for (let i = 0; i < this.recordInfo.tableList.length; i++) {
  926. this.recordInfo.tableList[i].supply_count = parseInt(
  927. this.recordInfo.tableList[i].supply_count
  928. );
  929. this.recordInfo.tableList[i].supply_price = this.recordInfo.tableList[i].supply_price.toString();
  930. this.recordInfo.tableList[i].supply_total_price = this.recordInfo.tableList[i].supply_total_price.toString();
  931. this.recordInfo.tableList[i].supply_total = this.recordInfo.tableList[i].supply_total.toString();
  932. for (let j = 0; j < this.manufactuerList.length; j++) {
  933. if ( this.recordInfo.tableList[i].supply_manufacturer == this.manufactuerList[j].manufacturer_name) {
  934. this.recordInfo.tableList[i].manufacturer_id = this.manufactuerList[j].id;
  935. }
  936. if ( this.recordInfo.tableList[i].supply_manufacturer == this.manufactuerList[j].id) {
  937. this.recordInfo.tableList[i].supply_manufacturer =this.manufactuerList[j].manufacturer_name;
  938. }
  939. }
  940. }
  941. var start = this.start_time;
  942. this.$refs["tableForm"].validate((valid) => {
  943. if (valid) {
  944. this.loading = true;
  945. var warehose_out_id = this.$route.query.id;
  946. var params = {
  947. stockIn: this.recordInfo.tableList,
  948. return_remake: this.return_remark,
  949. }
  950. //判断是否在采购订单数据中做了删除,如果长度相等则代表没有删除,如果不等则代表做了删除或者新增
  951. if(this.tableDataList.length != this.recordInfo.tableList){
  952. warehousing_id = 0
  953. for(let i=0;i<this.recordInfo.tableList.length;i++){
  954. this.recordInfo.tableList[i].id = 0
  955. this.recordInfo.tableDataList[i].order_number = ""
  956. this.number = ""
  957. }
  958. }
  959. console.log("param23322332323",params)
  960. return
  961. updateGoodOrder(params,this.supplier_name,start,this.arrearage,this.payment,warehose_out_id,this.number,this.rate_of_concession,this.discount_amount,this.good_number).then((response) => {
  962. if (response.data.state == 1) {
  963. this.loading = false;
  964. this.$message.success("保存成功!");
  965. }
  966. });
  967. }
  968. });
  969. },
  970. checkGoodOrder() {
  971. var id = this.$route.query.id;
  972. var warehousing_id = this.$route.query.warehousing_id;
  973. getGoodOrderCountList(id, warehousing_id).then((response) => {
  974. if (response.data.state == 1) {
  975. this.$message.success("审核成功!");
  976. this.is_check = 1
  977. this.showOne = false;
  978. this.showTwo = true;
  979. this.showThree = true;
  980. var purcaseOrder = response.data.data.purcaseOrder;
  981. console.log("采购订单", purcaseOrder);
  982. var goodOrder = response.data.data.goodOrder;
  983. console.log("采购单", goodOrder);
  984. var drugList = response.data.data.drugList;
  985. console.log("druglist23323223", drugList);
  986. var is_warehouse = 0;
  987. for (let i = 0; i < purcaseOrder.length; i++) {
  988. for (let j = 0; j < drugList.length; j++) {
  989. if (purcaseOrder[i].is_source == 1) {
  990. if (purcaseOrder[i].supply_unit == drugList[j].max_unit) {
  991. purcaseOrder[i].count =
  992. purcaseOrder[i].count * drugList[j].min_number;
  993. }
  994. }
  995. }
  996. }
  997. for (let i = 0; i < goodOrder.length; i++) {
  998. for (let j = 0; j < drugList.length; j++) {
  999. if (goodOrder[i].is_source == 1) {
  1000. if (goodOrder[i].supply_unit == drugList[j].max_unit) {
  1001. goodOrder[i].count = goodOrder[i].count * drugList[j].min_number;
  1002. }
  1003. }
  1004. }
  1005. }
  1006. let objInfo = {};
  1007. if (goodOrder.length > 0) {
  1008. goodOrder.forEach((item, index) => {
  1009. let { project_id } = item;
  1010. if (!objInfo[project_id]) {
  1011. objInfo[project_id] = {
  1012. project_id,
  1013. child: [],
  1014. count: 0,
  1015. };
  1016. }
  1017. });
  1018. let newArr = Object.values(objInfo);
  1019. for (let i = 0; i < goodOrder.length; i++) {
  1020. for (let j = 0; j < newArr.length; j++) {
  1021. if (goodOrder[i].project_id == newArr[j].project_id) {
  1022. newArr[j].child.push(goodOrder[i]);
  1023. }
  1024. }
  1025. }
  1026. console.log("newAr2332232323", newArr);
  1027. for (let i = 0; i < newArr.length; i++) {
  1028. for (let j = 0; j < newArr[i].child.length; j++) {
  1029. newArr[i].count += newArr[i].child[j].count;
  1030. }
  1031. }
  1032. var arr = [];
  1033. var total = 0;
  1034. var str = "";
  1035. //如果采购单有数据,则需要比较数量
  1036. if (newArr.length > 0) {
  1037. for (let i = 0; i < purcaseOrder.length; i++) {
  1038. for (let j = 0; j < newArr.length; j++) {
  1039. if (purcaseOrder[i].project_id == newArr[j].project_id) {
  1040. //根据商品ID比较数量大小,把数量不足的商品ID储存,表示采购单的数量未满足采购订单的数据,部分入库
  1041. if (purcaseOrder[i].count > newArr[j].count) {
  1042. arr.push(purcaseOrder[i].project_id);
  1043. }
  1044. }
  1045. }
  1046. }
  1047. //如果total的长度等于 采购单的长度,怎表示该采购订单已经全部生成,全部入库
  1048. console.log("审核23232323323",arr)
  1049. if (arr.length == 0) {
  1050. is_warehouse = 1;
  1051. this.ModefySupplyWarehousing(is_warehouse, warehousing_id);
  1052. }
  1053. //部分入库
  1054. if (arr.length >0) {
  1055. //修改订购单
  1056. is_warehouse = 3;
  1057. this.ModefySupplyWarehousing(is_warehouse, warehousing_id);
  1058. }
  1059. }
  1060. }
  1061. }
  1062. });
  1063. },
  1064. ModefySupplyWarehousing(is_warehouse, warehousing_id) {
  1065. var params = {
  1066. is_warehouse: is_warehouse,
  1067. warehousing_id: warehousing_id,
  1068. };
  1069. ModefySupplyWarehousing(params).then((response) => {
  1070. if (response.data.state == 1) {
  1071. var msg = response.data.data.msg;
  1072. }
  1073. });
  1074. },
  1075. toClick() {
  1076. //先判断采购单号有没有关联的采购退货单号,如果没有,则为首次生成采购退货单
  1077. if (this.is_check == 2) {
  1078. this.$message.error("该采购单未审核,不能生成退货单数据!");
  1079. return false;
  1080. }
  1081. var id = this.$route.query.id;
  1082. getSupplyWarehouseOutById(id).then((response) => {
  1083. if (response.data.state == 1) {
  1084. var cancelList = response.data.data.cancelList;
  1085. console.log("退库单", cancelList);
  1086. var drugList = response.data.data.drugList;
  1087. console.log("药品列表", drugList);
  1088. var cancelOrderList = response.data.data.cancelOrderList;
  1089. console.log("退库单详情", cancelOrderList);
  1090. var ids =""
  1091. if(cancelList.length == 0){
  1092. this.$router.push({ path: "/good/return/add?id=" + this.id+"&ids="+ids });
  1093. }
  1094. if (cancelList.length > 0) {
  1095. var outList = response.data.data.outList;
  1096. console.log("购货单2322323",outList)
  1097. for(let i=0;i<outList.length;i++){
  1098. if(outList[i].is_source == 1){
  1099. for(let j=0;j<drugList.length;j++){
  1100. if(outList[i].project_id == drugList[j].id){
  1101. if(outList[i].supply_unit == drugList[j].max_unit){
  1102. outList[i].count = outList[i].count * drugList[j].min_number
  1103. }
  1104. }
  1105. }
  1106. }
  1107. }
  1108. for(let i=0;i<cancelOrderList.length;i++){
  1109. if(cancelOrderList[i].is_source == 1){
  1110. for(let j=0;j<drugList.length;j++){
  1111. if(cancelOrderList[i].project_id == drugList[j].id){
  1112. if(cancelOrderList[i].supply_unit == drugList[j].max_unit){
  1113. cancelOrderList[i].count = cancelOrderList[i].count * drugList[j].min_number
  1114. }
  1115. }
  1116. }
  1117. }
  1118. }
  1119. console.log("数据变了后23323233",outList)
  1120. let objInfo = {};
  1121. if(cancelOrderList.length >0){
  1122. cancelOrderList.forEach((item, index) => {
  1123. let { project_id } = item;
  1124. if (!objInfo[project_id]) {
  1125. objInfo[project_id] = {
  1126. project_id,
  1127. child: [],
  1128. count: 0,
  1129. };
  1130. }
  1131. });
  1132. let newArr = Object.values(objInfo)
  1133. console.log("最好的输3233232323323223", newArr)
  1134. console.log("数据变了后23323233",cancelOrderList)
  1135. for (let i = 0; i < cancelOrderList.length; i++) {
  1136. for (let j = 0; j < newArr.length; j++) {
  1137. if (cancelOrderList[i].project_id == newArr[j].project_id) {
  1138. newArr[j].child.push(cancelOrderList[i])
  1139. }
  1140. }
  1141. }
  1142. for (let i = 0; i < newArr.length; i++) {
  1143. for (let j = 0; j < newArr[i].child.length; j++) {
  1144. newArr[i].count += newArr[i].child[j].count;
  1145. }
  1146. }
  1147. var arr = []
  1148. var total = 0;
  1149. var str = "";
  1150. //如果采购单有数据,则需要比较数量
  1151. if (newArr.length > 0) {
  1152. for (let i = 0; i < outList.length; i++) {
  1153. for (let j = 0; j < newArr.length; j++) {
  1154. if (outList[i].project_id == newArr[j].project_id) {
  1155. //根据商品ID比较数量大小,把数量不足的商品ID储存,表示退货单的数量未满足采购单的数据,可以继续生成退货单
  1156. if (outList[i].count > newArr[j].count) {
  1157. arr.push(outList[i].project_id);
  1158. }
  1159. }
  1160. }
  1161. }
  1162. //如果total的长度等于 采购单的长度,怎表示该采购订单已经全部生成
  1163. if (arr.length == 0) {
  1164. this.$message.error("该订单已全部生成退库单,请知悉!");
  1165. return
  1166. }
  1167. console.log("arr23323232232323",arr)
  1168. if (arr.length > 0) {
  1169. str = arr.join(",");
  1170. this.$router.push({ path: "/good/return/edit?id=" + id + "&ids=" + str});
  1171. }
  1172. }
  1173. }
  1174. }
  1175. }
  1176. });
  1177. },
  1178. //反审核
  1179. MofyGoodOrder() {
  1180. var id = this.$route.query.id;
  1181. var warehousing_id = this.$route.query.warehousing_id;
  1182. var params = {
  1183. id: id,
  1184. warehousing_id: warehousing_id,
  1185. };
  1186. MofyGoodOrder(params).then((response) => {
  1187. if (response.data.state == 1) {
  1188. var msg = response.data.data.msg;
  1189. if (msg == 1) {
  1190. this.$message.success("反审核成功!");
  1191. return
  1192. }
  1193. if (msg == 2) {
  1194. var cancelList = response.data.data.cancelList
  1195. console.log("cancelLIST2332322332232323",cancelList)
  1196. this.orderList = cancelList
  1197. this.$refs.Popup.dialogVisible = true
  1198. return
  1199. }
  1200. var purcaseOrder = response.data.data.purcaseOrder;
  1201. console.log("采购订单", purcaseOrder);
  1202. var goodOrder = response.data.data.goodOrder;
  1203. console.log("采购单", goodOrder);
  1204. var drugList = response.data.data.drugList;
  1205. console.log("druglist23323223", drugList);
  1206. var ids = "";
  1207. // 如果采购单没有数据,则代表改订单第一次生成采购订单数据
  1208. if (goodOrder.length == 0) {
  1209. this.$router.push({path: "/good/order/add?id=" + id + "&ids=" + ids});
  1210. }
  1211. for (let i = 0; i < purcaseOrder.length; i++) {
  1212. for (let j = 0; j < drugList.length; j++) {
  1213. if (purcaseOrder[i].is_source == 1) {
  1214. if (purcaseOrder[i].supply_unit == drugList[j].max_unit) {
  1215. purcaseOrder[i].count = purcaseOrder[i].count * drugList[j].min_number;
  1216. }
  1217. }
  1218. }
  1219. }
  1220. for (let i = 0; i < goodOrder.length; i++) {
  1221. for (let j = 0; j < drugList.length; j++) {
  1222. if (goodOrder[i].is_source == 1) {
  1223. if (goodOrder[i].supply_unit == drugList[j].max_unit) {
  1224. goodOrder[i].count = goodOrder[i].count * drugList[j].min_number;
  1225. }
  1226. }
  1227. }
  1228. }
  1229. let objInfo = {};
  1230. if (goodOrder.length > 0) {
  1231. goodOrder.forEach((item, index) => {
  1232. let { project_id } = item;
  1233. if (!objInfo[project_id]) {
  1234. objInfo[project_id] = {
  1235. project_id,
  1236. child: [],
  1237. count: 0,
  1238. };
  1239. }
  1240. });
  1241. let newArr = Object.values(objInfo);
  1242. for (let i = 0; i < goodOrder.length; i++) {
  1243. for (let j = 0; j < newArr.length; j++) {
  1244. if (goodOrder[i].project_id == newArr[j].project_id) {
  1245. newArr[j].child.push(goodOrder[i]);
  1246. }
  1247. }
  1248. }
  1249. console.log("newAr2332232323", newArr);
  1250. for (let i = 0; i < newArr.length; i++) {
  1251. for (let j = 0; j < newArr[i].child.length; j++) {
  1252. newArr[i].count += newArr[i].child[j].count;
  1253. }
  1254. }
  1255. var arr = [];
  1256. var total = 0;
  1257. var str = "";
  1258. //如果采购单有数据,则需要比较数量
  1259. if (newArr.length > 0) {
  1260. for (let i = 0; i < purcaseOrder.length; i++) {
  1261. for (let j = 0; j < newArr.length; j++) {
  1262. if (purcaseOrder[i].project_id == newArr[j].project_id) {
  1263. //根据商品ID比较数量大小,如果采购单的数量大于采购订单的数据
  1264. if (purcaseOrder[i].count < newArr[j].count) {
  1265. arr.push(purcaseOrder[i].project_id);
  1266. }
  1267. }
  1268. }
  1269. }
  1270. //如果total的长度等于0,怎修改该订单的状态为全部入库
  1271. if (arr.length > 0) {
  1272. //修改采购订单的状态为全部入库
  1273. this.UpdateSupplyWahouseingInfo();
  1274. }
  1275. }
  1276. }
  1277. }
  1278. });
  1279. },
  1280. UpdateSupplyWahouseingInfo() {
  1281. var params = {
  1282. warehousing_id: this.$route.query.warehousing_id,
  1283. };
  1284. UpdateSupplyWahouseingInfo(params).then((response) => {
  1285. if (response.data.state == 1) {
  1286. var msg = response.data.data.msg;
  1287. }
  1288. });
  1289. },
  1290. },
  1291. created() {
  1292. const tempObj = {};
  1293. tempObj["id"] = 0;
  1294. tempObj["name"] = "";
  1295. tempObj["supply_name"] = "";
  1296. tempObj["supply_type"] = "";
  1297. tempObj["supply_specification_name"] = "";
  1298. tempObj["supply_total"] = "";
  1299. tempObj["supply_count"] = "";
  1300. tempObj["supply_price"] = "";
  1301. tempObj["supply_total_price"] = "";
  1302. tempObj["supply_manufacturer"] = "";
  1303. tempObj["supply_license_number"] = "";
  1304. tempObj["supply_remake"] = "";
  1305. tempObj["type"] = 0;
  1306. tempObj["is_total"] = 1;
  1307. tempObj["project_id"] = 0;
  1308. tempObj["supply_unit"] = "";
  1309. tempObj["supply_batch_number"] = "";
  1310. tempObj["supply_product_date"] = "";
  1311. tempObj["order_number"] = "";
  1312. tempObj["supply_expiry_date"] = "";
  1313. tempObj["manufacturer_id"] = "";
  1314. tempObj["warehouse_info_id"] = "";
  1315. tempObj["warehousing_id"] = "";
  1316. tempObj["number"] = "";
  1317. tempObj["good_number"] = "";
  1318. this.recordInfo.tableList.push(tempObj);
  1319. this.getInitOrder();
  1320. if (parseInt(this.$route.query.id) > 0) {
  1321. this.getGoodOrderDetail();
  1322. }
  1323. this.start_time = this.getTimes(new Date());
  1324. this.end_time = this.getTimes(new Date());
  1325. },
  1326. };
  1327. </script>
  1328. <style rel="stylesheet/css" lang="scss" scoped>
  1329. .information {
  1330. border: 1px #dcdfe6 solid;
  1331. padding: 30px 20px 30px 20px;
  1332. .border {
  1333. border-bottom: 1px #dcdfe6 solid;
  1334. margin: 0px 0 20px 0;
  1335. }
  1336. }
  1337. .title {
  1338. background: #409eff;
  1339. height: 44px;
  1340. line-height: 44px;
  1341. padding: 0 0 0 10px;
  1342. color: #fff;
  1343. margin: 0 0 10px 0;
  1344. }
  1345. .edit_separater {
  1346. border-top: 1px solid rgb(233, 233, 233);
  1347. margin-top: 15px;
  1348. margin-bottom: 15px;
  1349. }
  1350. </style>
  1351. <style>
  1352. .sign-and-weigh-box .sign-and-weigh-box-patients .cell {
  1353. font-size: 12px;
  1354. }
  1355. .sign-and-weigh-box .sign-and-weigh-box-patients .current-row > td {
  1356. background: #6fb5fa;
  1357. }
  1358. .count {
  1359. color: #bd2c00;
  1360. }
  1361. .el-table td,
  1362. .el-table th.is-leaf,
  1363. .el-table--border,
  1364. .el-table--group {
  1365. border-color: #d0d3da;
  1366. }
  1367. .el-table--border::after,
  1368. .el-table--group::after,
  1369. .el-table::before {
  1370. background-color: #d0d3da;
  1371. }
  1372. .el-table__fixed-right {
  1373. width: 150px;
  1374. bottom: 20px;
  1375. height: 100%;
  1376. }
  1377. </style>