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

editGoodOrder.vue 37KB

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