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

addGoodOrder.vue 57KB

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