Browse Source

11月14日 库存扣减更新

XMLWAN 3 years ago
parent
commit
de38471872

+ 56 - 0
src/api/supply.js View File

@@ -55,3 +55,59 @@ export function getPurchaseOrderDetail(id, params) {
55 55
     params: params
56 56
   })
57 57
 }
58
+
59
+export function addGoodOrder(data, supplier_name, start, arrearage, payment, warehousing_id, number, rate_of_concession, discount_amount) {
60
+  return request({
61
+    url: '/api/supply/addgoodorder?supplier_id=' + supplier_name + '&start=' + start + '&arrerage=' + arrearage + '&payment=' + payment + '&warehousing_id=' + warehousing_id + '&number=' + number + '&rate_of_concession=' + rate_of_concession + '&discount_amount=' + discount_amount,
62
+    method: 'post',
63
+    data: data
64
+  })
65
+}
66
+
67
+export function getAllGoodOrderList(params) {
68
+  return request({
69
+    url: '/api/supply/getallgoodorderlist',
70
+    method: 'get',
71
+    params: params
72
+  })
73
+}
74
+
75
+export function getGoodOrderDetail(id, params) {
76
+  return request({
77
+    url: '/api/supply/getgoodorderdetail?id=' + id,
78
+    method: 'get',
79
+    params: params
80
+  })
81
+}
82
+
83
+export function updateGoodOrder(data, supplier_name, start, arrearage, payment, warehose_out_id, number, rate_of_concession, discount_amount, good_number) {
84
+  return request({
85
+    url: '/api/supply/updategoodorder?supplier_id=' + supplier_name + '&start=' + start + '&arrerage=' + arrearage + '&payment=' + payment + '&warehose_out_id=' + warehose_out_id + '&number=' + number + '&rate_of_concession=' + rate_of_concession + '&discount_amount=' + discount_amount + '&good_number=' + good_number,
86
+    method: 'post',
87
+    data: data
88
+  })
89
+}
90
+
91
+export function deletePurchaseOrder(id, params) {
92
+  return request({
93
+    url: '/api/supply/deletepurchorder?id=' + id,
94
+    method: 'Get',
95
+    params: params
96
+  })
97
+}
98
+
99
+export function getAllOrderCountList(id, params) {
100
+  return request({
101
+    url: '/api/supply/getallordercountlist?id=' + id,
102
+    method: 'get',
103
+    params: params
104
+  })
105
+}
106
+
107
+export function getPurchaseOrderInfo(id, ids, params) {
108
+  return request({
109
+    url: '/api/supply/getpurchaseorderinfo?id=' + id + '&ids=' + ids,
110
+    method: 'get',
111
+    params: params
112
+  })
113
+}

+ 9 - 0
src/router/modules/supply.js View File

@@ -75,6 +75,15 @@ export default {
75 75
       hidden: true,
76 76
       is_menu: false,
77 77
       isChild: true
78
+    },
79
+    {
80
+      path: '/good/order/edit',
81
+      component: () => import('@/xt_pages/supply/components/editGoodOrder'),
82
+      name: 'editGoodOrder',
83
+      meta: { title: 'editGoodOrder', noCache: true },
84
+      hidden: true,
85
+      is_menu: false,
86
+      isChild: true
78 87
     }
79 88
 
80 89
   ]

+ 4 - 0
src/xt_pages/dialysis/details/assessmentAfter.vue View File

@@ -316,6 +316,10 @@
316 316
           <label>机器运行: </label>
317 317
           <span class="content" >{{ this.record.machine_run}}</span>
318 318
         </li>
319
+        <li v-if="isShow('透后尿素')">
320
+          <label>透后尿素(mmol/L): </label>
321
+          <span class="content" >{{ this.record.after_urea}}</span>
322
+        </li>
319 323
       </ul>
320 324
     </div>
321 325
     <!-- <div class="note">

+ 6 - 0
src/xt_pages/dialysis/details/assessmentBefore.vue View File

@@ -370,6 +370,12 @@
370 370
           <span class="content">{{this.record.blood_pressure_during_dialysis}}</span>
371 371
           <span class="unit"></span>
372 372
         </li>
373
+
374
+        <li v-if="isShow('透前尿素')">
375
+          <label>透前尿素(mmol/L): </label>
376
+          <span class="content">{{this.record.urea_befor}}</span>
377
+          <span class="unit"></span>
378
+        </li>
373 379
        
374 380
       </ul>
375 381
     </div>

+ 10 - 97
src/xt_pages/dialysis/details/dialog/AssessmentAfterDislysis.vue View File

@@ -440,73 +440,7 @@
440 440
           </el-form-item>
441 441
         </el-col>
442 442
 
443
-        <!-- </el-row>
444
-
445
-        <el-row :gutter="20"> -->
446
-
447
-        <!-- </el-row>
448
-
449
-        <el-row :gutter="20"> -->
450
-
451
-        <!--          <el-col :span="8" v-if="isShow('血管通路部位')">-->
452
-        <!--            <el-form-item label="血管通路部位: ">-->
453
-        <!--              <el-select v-model="form.blood_access_part_id">-->
454
-        <!--                <el-option :key="0" label="请选择" :value="0"></el-option>-->
455
-
456
-        <!--                <el-option-->
457
-        <!--                  v-for="item in vascularAccessOptions"-->
458
-        <!--                  :label="item.name"-->
459
-        <!--                  :value="item.id"-->
460
-        <!--                  :key="item.id"-->
461
-        <!--                ></el-option>-->
462
-        <!--              </el-select>-->
463
-        <!--            </el-form-item>-->
464
-        <!--          </el-col>-->
465
-        <!--          <el-col :span="8" v-if="isShow('血管通路')">-->
466
-        <!--            <el-form-item label="血管通路: ">-->
467
-        <!--              <el-select v-model="form.blood_access_part_opera_id">-->
468
-        <!--                <el-option :key="0" label="请选择" :value="0"></el-option>-->
469
-
470
-        <!--                <el-option-->
471
-        <!--                  v-for="item in vascularAccessDescOptions"-->
472
-        <!--                  :label="item.name"-->
473
-        <!--                  :value="item.id"-->
474
-        <!--                  :key="item.id"-->
475
-        <!--                ></el-option>-->
476
-        <!--              </el-select>-->
477
-        <!--            </el-form-item>-->
478
-        <!--          </el-col>-->
479
-        <!-- </el-row>
480
-
481
-        <el-row :gutter="20"> -->
482
-
483
-        <!-- </el-row>
484
-
485
-
486
-
487
-          <el-row :gutter="20" > -->
488
-
489
-        <!--
490
-                  </el-row>
491
-
492
-
493
-
494
-
495
-                  <el-row :gutter="20"> -->
496
-        <!--          <el-col :span="8" v-if="isShow('内瘘震颤和血管杂音')">-->
497
-        <!--            <el-form-item label="内瘘震颤和血管杂音: ">-->
498
-        <!--              <el-select v-model="form.tremor_noise">-->
499
-        <!--                <el-option :key="0" label="请选择" :value="0"></el-option>-->
500
-
501
-        <!--                <el-option-->
502
-        <!--                  v-for="item in this.$store.getters.tremor_noise"-->
503
-        <!--                  :label="item.name"-->
504
-        <!--                  :value="item.id"-->
505
-        <!--                  :key="item.id"-->
506
-        <!--                ></el-option>-->
507
-        <!--              </el-select>-->
508
-        <!--            </el-form-item>-->
509
-        <!--          </el-col>-->
443
+      
510 444
         <el-col :span="8" v-if="isShow('失衡综合症')">
511 445
           <el-form-item label="失衡综合症: ">
512 446
             <el-select v-model="form.disequilibrium_syndrome">
@@ -521,36 +455,7 @@
521 455
             </el-select>
522 456
           </el-form-item>
523 457
         </el-col>
524
-        <!--          <el-col :span="8" v-if="isShow('失衡综合症症状')">-->
525
-        <!--            <el-form-item label="失衡综合症症状: ">-->
526
-        <!--              <el-input-->
527
-        <!--                v-model="form.disequilibrium_syndrome_option"-->
528
-        <!--                readonly-->
529
-        <!--                @focus="showDialog('8')"-->
530
-        <!--              ></el-input>-->
531
-        <!--            </el-form-item>-->
532
-        <!--          </el-col>-->
533
-
534
-        <!-- </el-row>
535
-
536
-
537
-
538
-          <el-row :gutter="20"  > -->
539
-
540
-        <!--          <el-col :span="8" v-if="isShow('透析器')">-->
541
-        <!--            <el-form-item label="透析器凝血: ">-->
542
-        <!--              <el-select v-model="form.dialyzer">-->
543
-        <!--                <el-option :key="0" label="请选择" :value="0"></el-option>-->
544
-
545
-        <!--                <el-option-->
546
-        <!--                  v-for="item in this.$store.getters.dialyzer"-->
547
-        <!--                  :label="item.name"-->
548
-        <!--                  :value="item.id"-->
549
-        <!--                  :key="item.id"-->
550
-        <!--                ></el-option>-->
551
-        <!--              </el-select>-->
552
-        <!--            </el-form-item>-->
553
-        <!--          </el-col>-->
458
+      
554 459
         <el-col :span="8" v-if="isShow('透析期间进食')">
555 460
           <el-form-item label="透析期间进食: ">
556 461
             <el-radio-group v-model="form.is_eat">
@@ -693,6 +598,12 @@
693 598
               </el-select>
694 599
             </el-form-item>
695 600
        </el-col>
601
+
602
+       <el-col :span="8" v-if="isShow('透后尿素')">
603
+            <el-form-item label="透后尿素(mmol/L):" label-width="150px">
604
+              <el-input v-model="form.after_urea"></el-input>
605
+            </el-form-item>
606
+       </el-col>
696 607
         <el-col :span="24" v-if="isShow('KT/V')">
697 608
             <el-form-item label="KT/V:">
698 609
               <el-input type="textarea" :rows="4" v-model="form.ktv"></el-input>
@@ -869,6 +780,7 @@ export default {
869 780
         consciousness:"",
870 781
         fallrisk:"",
871 782
         machine_run:"",
783
+        after_urea:"",
872 784
       },
873 785
       lapseList:[],
874 786
       leaveOfficeMethod:[],
@@ -1086,6 +998,7 @@ export default {
1086 998
       data["consciousness"] = this.form.consciousness
1087 999
       data["fallrisk"] = this.form.fallrisk
1088 1000
       data["machine_run"] = this.form.machine_run
1001
+      data["after_urea"] = this.form.after_urea
1089 1002
       console.log("Paramsquery",data)
1090 1003
      
1091 1004
       postAssessmentAfterDislysis(ParamsQuery, data)

+ 9 - 0
src/xt_pages/dialysis/details/dialog/assessmentBeforeDislysisDialog.vue View File

@@ -538,6 +538,14 @@
538 538
              <el-input v-model="assessmentBeforeDislysis.blood_pressure_during_dialysis"></el-input>
539 539
             </el-form-item>
540 540
           </el-col>
541
+
542
+     
543
+
544
+           <el-col :span="8" v-if="isShow('透前尿素')">
545
+            <el-form-item label="透前尿素(mmol/L):" label-width="150px">
546
+              <el-input v-model="assessmentBeforeDislysis.urea_befor"></el-input>
547
+            </el-form-item>
548
+          </el-col>
541 549
          
542 550
           <el-col :span="24">
543 551
             <el-form-item label="备注: ">
@@ -707,6 +715,7 @@
707 715
           period:"",
708 716
           estimated_food_intake:"",
709 717
           blood_pressure_during_dialysis:"",
718
+          urea_befor:"",
710 719
         },
711 720
 
712 721
         InnerDialogProps: {

+ 14 - 6
src/xt_pages/stock/detail/stockOutDetail.vue View File

@@ -126,8 +126,11 @@
126 126
         </el-table-column>
127 127
         <el-table-column label="出货价" align="center">
128 128
           <template slot-scope="scope">
129
-            <span v-if="scope.row.is_total == 0 && (orgId == 9919 || orgId == 9671)">{{scope.row.GoodInfo.buy_price}}</span>
130
-            <span v-else> {{ scope.row.price }} </span>
129
+            <span v-if="scope.row.is_total == 0 && (orgId == 9919)">{{scope.row.GoodInfo.buy_price}}</span>
130
+            <span v-else> 
131
+              <span v-if="scope.row.price > 0"> {{ scope.row.price }} </span> 
132
+               <span v-if="scope.row.price == 0"> {{ scope.row.GoodInfo.packing_price }} </span> 
133
+            </span>
131 134
           </template>
132 135
         </el-table-column>
133 136
         <el-table-column label="数量" align="center">
@@ -138,9 +141,8 @@
138 141
         </el-table-column>
139 142
         <el-table-column label="总价" align="center">
140 143
           <template slot-scope="scope">
141
-            <span v-if="scope.row.is_total == 0">{{
142
-              getTotal(scope.row.price, scope.row.count)
143
-            }}</span>
144
+            <span v-if="scope.row.is_total == 0 && scope.row.price > 0">{{getTotal(scope.row.price, scope.row.count)}}</span>
145
+             <span v-if="scope.row.is_total == 0 && scope.row.price == 0">{{getTotal(scope.row.GoodInfo.packing_price, scope.row.count)}}</span>
144 146
             <span v-else>{{ scope.row.total }}</span>
145 147
           </template>
146 148
         </el-table-column>
@@ -371,7 +373,13 @@ export default {
371 373
           for (let i = 0; i < response.data.data.list.length; i++) {
372 374
             this.tableData.push(response.data.data.list[i])
373 375
             var obj = response.data.data.list[i];
374
-            total += response.data.data.list[i].price * response.data.data.list[i].count
376
+            if(response.data.data.list[i].price > 0){
377
+               total += response.data.data.list[i].price * response.data.data.list[i].count
378
+            }
379
+            if(response.data.data.list[i].price == 0){
380
+               total += response.data.data.list[i].GoodInfo.packing_price * response.data.data.list[i].count
381
+            }
382
+           
375 383
             obj["is_total"] = 0;
376 384
             this.cancelStockDate.push(obj);
377 385
           }

+ 5 - 2
src/xt_pages/stock/drugs/drugStockInOrderAdd.vue View File

@@ -10,7 +10,7 @@
10 10
         <el-button size="small" type="primary" @click="submit()" class="filter-item">保 存</el-button>
11 11
       </div>
12 12
     </div>
13
-    <div class="app-container">
13
+    <div class="app-container" v-loading="loading">
14 14
 
15 15
     
16 16
       <drugs-stock-dialog
@@ -451,6 +451,7 @@
451 451
         drugTypeList:[],
452 452
         totalPrice:0,
453 453
         unitList:[],
454
+        loading:false,
454 455
       }
455 456
     },
456 457
     methods: {
@@ -705,7 +706,7 @@
705 706
       submit() {
706 707
         this.$refs['tableForm'].validate((valid) => {
707 708
           if (valid) {
708
-            
709
+            this.loading = true
709 710
             const array = this.recordInfo.recordData
710 711
           
711 712
             for (let i = 0; i < array.length; i++) {
@@ -748,9 +749,11 @@
748 749
            
749 750
             postDrugWarehouse(params, this.warehousing_time, this.form.manufacturer, this.form.dealer, this.type).then(response => {
750 751
               if (response.data.state == 0) {
752
+                this.loading = false
751 753
                 this.$message.error(response.data.msg)
752 754
                 return false
753 755
               } else {
756
+                this.loading = false
754 757
                 this.$message.success('入库成功')
755 758
                 this.listLoading = false
756 759
                 this.$router.back(-1)

+ 5 - 1
src/xt_pages/stock/drugs/drugStockInOrderEdit.vue View File

@@ -24,7 +24,7 @@
24 24
       </div>
25 25
     </div>
26 26
 
27
-    <div class="app-container">
27
+    <div class="app-container" v-loading="loading">
28 28
     
29 29
       <drugs-stock-dialog
30 30
         ref="dialog"
@@ -438,6 +438,7 @@ export default {
438 438
       listLoading:false,
439 439
       unitList:[],
440 440
       drug_show:false,
441
+      loading:false,
441 442
     };
442 443
   },
443 444
   methods: {
@@ -648,6 +649,7 @@ export default {
648 649
     submit() {
649 650
       this.$refs["tableForm"].validate(valid => {
650 651
         if (valid) {
652
+          this.loading = true
651 653
           const array = this.recordInfo.recordData;
652 654
         
653 655
           for (let i = 0; i < array.length; i++) {
@@ -699,8 +701,10 @@ export default {
699 701
             if (response.data.state == 0) {
700 702
               this.$message.error(response.data.msg);
701 703
               this.listLoading = false
704
+              this.loading = false
702 705
               return false;
703 706
             } else {
707
+              this.loading = false
704 708
               this.$message.success("入库成功");
705 709
               this.listLoading = false
706 710
               this.$router.back(-1);

+ 5 - 2
src/xt_pages/stock/stockFlow.vue View File

@@ -107,7 +107,8 @@
107 107
     
108 108
         <el-table-column prop="drug_name" label="单价"  align="center">
109 109
            <template slot-scope="scope">
110
-             <span>{{scope.row.price}}</span>
110
+             <span v-if="scope.row.price >0">{{scope.row.price}}</span>
111
+             <span v-if="scope.row.price == 0">{{good.packing_price}}</span>
111 112
            </template>
112 113
         </el-table-column>
113 114
          <el-table-column prop="drug_name" label="有效期" align="center">
@@ -226,7 +227,8 @@
226 227
         keywords:"",
227 228
         obj:{},
228 229
         packing_unit:"",
229
-        cancelCountList:[]
230
+        cancelCountList:[],
231
+        good:{}
230 232
       }
231 233
     },
232 234
     methods:{
@@ -432,6 +434,7 @@
432 434
             console.log("total",total)
433 435
             this.tableList = list
434 436
             this.total = total
437
+            this.good = response.data.data.good
435 438
            var manufacturerList = response.data.data.manufacturerList
436 439
            this.manufacturerList = manufacturerList
437 440
           }

+ 5 - 2
src/xt_pages/stock/stockInOrderAdd.vue View File

@@ -10,7 +10,7 @@
10 10
         <el-button size="small" type="primary" @click="submit()" class="filter-item">保 存</el-button>
11 11
       </div>
12 12
     </div>
13
-    <div class="app-container">
13
+    <div class="app-container" v-loading="loading">
14 14
 
15 15
       <stock-in-dialog ref="dialog" :propForm="propForm"
16 16
                        :visibility="isVisibility"
@@ -377,7 +377,7 @@
377 377
         goodType: [],
378 378
         manufacturerList:[],
379 379
         goodList:[],
380
-       
380
+        loading:false,
381 381
       }
382 382
     },
383 383
     methods: {
@@ -663,6 +663,7 @@
663 663
         console.log("res23322332",this.$refs)
664 664
         this.$refs['tableForm'].validate((valid) => {
665 665
           if (valid) {
666
+            this.loading = true
666 667
             const array = this.recordInfo.recordData
667 668
             console.log("array9999999",array)
668 669
             for (let i = 0; i < array.length; i++) {
@@ -710,11 +711,13 @@
710 711
             
711 712
             postWarehouse(params, this.warehousing_time, this.form.manufacturer, this.form.dealer, this.type).then(response => {
712 713
               if (response.data.state == 0) {
714
+                this.loading = false
713 715
                 this.$message.error(response.data.msg)
714 716
                 loading.close()
715 717
                 return false
716 718
               } else {
717 719
                 loading.close()
720
+                this.loading = false
718 721
                 this.$message.success('入库成功')
719 722
                 this.$router.back(-1)
720 723
               }

+ 6 - 2
src/xt_pages/stock/stockInOrderEdit.vue View File

@@ -24,7 +24,7 @@
24 24
       </div>
25 25
     </div>
26 26
 
27
-    <div class="app-container">
27
+    <div class="app-container" v-loading="loading">
28 28
       <stock-in-dialog
29 29
         ref="dialog"
30 30
         :propForm="propForm"
@@ -393,7 +393,8 @@ export default {
393 393
       dealerList: [],
394 394
       goodType: [],
395 395
       manufacturerList:[],
396
-      numberList:[]
396
+      numberList:[],
397
+      loading:false,
397 398
     };
398 399
   },
399 400
   methods: {
@@ -611,6 +612,7 @@ export default {
611 612
      
612 613
       this.$refs["tableForm"].validate(valid => {
613 614
         if (valid) {
615
+          this.loading = true
614 616
           const array = this.recordInfo.recordData;
615 617
           for (let i = 0; i < array.length; i++) {
616 618
             if (array[i].good_type_id == 0) {
@@ -660,11 +662,13 @@ export default {
660 662
             this.form.dealer
661 663
           ).then(response => {
662 664
             if (response.data.state == 0) {
665
+              this.loading =false
663 666
               this.$message.error(response.data.msg);
664 667
               loading.close()
665 668
               return false;
666 669
             } else {
667 670
               loading.close()
671
+              this.loading = false
668 672
               this.$message.success("入库成功");
669 673
               this.$router.back(-1);
670 674
             }

+ 11 - 4
src/xt_pages/stock/stockOutOrder.vue View File

@@ -206,13 +206,20 @@
206 206
           </el-table-column>
207 207
           <el-table-column label="出货价" align="center">
208 208
             <template slot-scope="scope">
209
-              {{ scope.row.price}}
209
+              <span v-if="scope.row.price >0">{{ scope.row.price}}</span> 
210
+              <span v-if="scope.row.price == 0">{{ scope.row.packing_price}}</span> 
210 211
             </template>
211 212
           </el-table-column>
212 213
           <el-table-column label="总价" align="center">
213 214
             <template slot-scope="scope">
214
-             <span v-if="scope.row.is_sys == 0">{{ (scope.row.count * scope.row.price).toFixed(2)}}</span> 
215
-             <span v-if="scope.row.is_sys == 1">{{(getOutStockCount(scope.row.good_id)*scope.row.price).toFixed(2)}}</span>
215
+             <span v-if="scope.row.is_sys == 0">
216
+               <span v-if="scope.row.price>0"> {{ (scope.row.count * scope.row.price).toFixed(2)}}</span>
217
+               <span v-if="scope.row.price == 0"> {{ (scope.row.count * scope.row.packing_price).toFixed(2)}}</span>
218
+              </span> 
219
+             <span v-if="scope.row.is_sys == 1">
220
+                <span v-if="scope.row.price >0 "> {{(getOutStockCount(scope.row.good_id)*scope.row.price).toFixed(2)}}</span>
221
+                <span v-if="scope.row.price ==0"> {{(getOutStockCount(scope.row.good_id)*scope.row.packing_price).toFixed(2)}}</span>
222
+             </span>
216 223
             </template>
217 224
           </el-table-column>
218 225
           <el-table-column label="生产厂家" align="center">
@@ -1486,7 +1493,7 @@ export default {
1486 1493
       }, 
1487 1494
      
1488 1495
       GetOrderDetailById(val){
1489
-        console.log("val",val)
1496
+       
1490 1497
          this.userList =[]
1491 1498
          var params = {
1492 1499
            id:val.warehouse_out_id,

+ 2 - 2
src/xt_pages/stock/stockOutOrderDetail.vue View File

@@ -224,11 +224,11 @@
224 224
         }
225 225
         getWarehouseOutInfo(params).then(response => {
226 226
           if (response.data.state == 0) {
227
-
227
+ 
228 228
             this.$message.error(response.data.msg)
229 229
             return false
230 230
           } else {
231
-           
231
+            console.log("list2332323232323223",response.data.data.list)
232 232
             for (let i = 0; i < response.data.data.list.length; i++) {
233 233
               this.warehousingOutInfo.warehousingOutData.push(response.data.data.list[i])
234 234
             }

+ 260 - 82
src/xt_pages/supply/components/addGoodOrder.vue View File

@@ -30,8 +30,8 @@
30 30
         value-format="yyyy-MM-dd"
31 31
         @change="startTimeChange"
32 32
         ></el-date-picker>
33
-        <span>交货日期:</span>
34
-        <el-date-picker
33
+        <!-- <span>交货日期:</span> -->
34
+        <!-- <el-date-picker
35 35
             size="small"
36 36
             v-model="end_time"
37 37
             prefix-icon="el-icon-date"
@@ -43,16 +43,15 @@
43 43
             format="yyyy-MM-dd"
44 44
             value-format="yyyy-MM-dd"
45 45
             @change="endTimeChange"
46
-        ></el-date-picker>
47
-        <span>单据编码:{{number}}</span>
46
+        ></el-date-picker> -->
47
+        <span>单据编码:{{good_number}}</span>
48 48
 
49 49
     </div>
50 50
     <div>
51
-        <el-button size="small" type="primary" @click="toAdd">生成购货单</el-button>
52
-        <el-button size="small" type="primary" @click="updatePurchaseOrder">修改</el-button>
53
-        <el-button size="small" type="primary" @click="toPrint">打印</el-button>
54
-        <el-button size="small" type="primary" v-if="is_check == 2" @click="checkPurchaseOrder">审核</el-button>
55
-        <el-button size="small" type="primary" v-if="is_check == 1" @click="checkPurchaseOrder">反审核</el-button>
51
+        <el-button size="small" type="primary" @click="saveGoodOrder" v-show="showOne">保存</el-button>
52
+         <el-button size="small" type="primary" @click="updateGoodOrder" v-show="showTwo">修改</el-button>
53
+        <el-button size="small" type="primary"  @click="checkPurchaseOrder">审核</el-button>
54
+
56 55
        
57 56
     </div>
58 57
     </div>
@@ -95,9 +94,9 @@
95 94
             <el-input v-model="scope.row.supply_type" style="width:120px" :disabled="true"></el-input>
96 95
         </template>
97 96
     </el-table-column>
98
-    <el-table-column label="规格&单位" align="center" width="200px">
97
+    <el-table-column label="规格&单位" align="center" width="120px">
99 98
         <template slot-scope="scope">
100
-            <el-input v-model="scope.row.supply_specification_name" style="width:150px" :disabled="true"></el-input>
99
+            <el-input v-model="scope.row.supply_specification_name" style="width:100px" :disabled="true"></el-input>
101 100
         </template>
102 101
     </el-table-column>
103 102
      <el-table-column label="单位" align="center" width="120px">
@@ -117,9 +116,33 @@
117 116
           </el-form-item>  
118 117
         </template>
119 118
     </el-table-column>
120
-    <el-table-column label="可用库存" align="center" width="130px">
119
+    <el-table-column label="批号" align="center" width="130px">
120
+         <template slot="header" slot-scope="scope">
121
+            <span>批号<span style="color: red">*</span></span>
122
+        </template>
123
+        <template slot-scope="scope">
124
+           <el-form-item  :prop="'tableList.' + scope.$index + '.supply_batch_number'" :rules='tableRules.supply_batch_number'>
125
+             <el-input v-model="scope.row.supply_batch_number" style="width:80px" :disabled="disabled"></el-input>
126
+          </el-form-item>
127
+        </template>
128
+    </el-table-column>
129
+     <el-table-column label="有效日期" align="center" width="200px">
130
+        <template slot="header" slot-scope="scope">
131
+              <span>有效日期<span style="color: red">*</span></span>
132
+            </template>
133
+            <template slot-scope="scope">
134
+              <el-form-item  :prop="'tableList.' + scope.$index + '.supply_expiry_date'"
135
+                :rules="tableRules.supply_expiry_date">
136
+                <el-date-picker prefix-icon="el-icon-date" style="width:180px" v-model="scope.row.supply_expiry_date"
137
+                                type="date" placeholder="选择日期时间" format="yyyy-MM-dd"
138
+                                value-format="yyyy-MM-dd">
139
+                </el-date-picker>
140
+             </el-form-item>
141
+       </template>
142
+    </el-table-column>
143
+    <el-table-column label="可用库存" align="center" width="100px">
121 144
         <template slot-scope="scope">
122
-            <el-input v-model="scope.row.supply_total" style="width:100px" :disabled="true"></el-input>
145
+            <el-input v-model="scope.row.supply_total" style="width:80px" :disabled="true"></el-input>
123 146
         </template>
124 147
     </el-table-column>
125 148
     <el-table-column label="数量" align="center" width="120px">
@@ -144,10 +167,31 @@
144 167
           {{calculate(scope.row.supply_count * scope.row.supply_price)}}
145 168
         </template>
146 169
     </el-table-column>
147
-
148
-    <el-table-column label="生产厂商" align="center" width="200px">
170
+    <el-table-column label="生产日期" align="center" width="200px">
171
+         <template slot="header" slot-scope="scope">
172
+            <span>生产日期<span style="color: red">*</span></span>
173
+        </template>
149 174
         <template slot-scope="scope">
150
-        <el-input v-model="scope.row.supply_manufacturer" style="width:160px" :disabled="true"></el-input>
175
+          <el-form-item  :prop="'tableList.' + scope.$index + '.supply_product_date'"
176
+                :rules="tableRules.supply_product_date">
177
+                <el-date-picker prefix-icon="el-icon-date" style="width: 180px" v-model="scope.row.supply_product_date"
178
+                                type="date" placeholder="选择日期时间" format="yyyy-MM-dd"
179
+                                value-format="yyyy-MM-dd">
180
+                </el-date-picker>
181
+          </el-form-item>
182
+        </template>
183
+    </el-table-column>
184
+    <el-table-column label="生产厂家" align="center" width="200px">
185
+        <template slot-scope="scope">
186
+        <!-- <el-input v-model="scope.row.supply_manufacturer" style="width:160px" :disabled="true"></el-input> -->
187
+         <el-select size="small" v-model="scope.row.supply_manufacturer" filterable placeholder="请选择厂商" :disabled="disabled">
188
+                <el-option
189
+                  v-for="(option, index) in manufactuerList"
190
+                  :key="index"
191
+                  :label="option.manufacturer_name"
192
+                  :value="option.id">
193
+                </el-option>
194
+          </el-select>
151 195
         </template>
152 196
     </el-table-column>
153 197
 
@@ -158,6 +202,12 @@
158 202
         </template>
159 203
     </el-table-column>
160 204
 
205
+     <el-table-column label="关联采购订单号" align="center" width="200px">
206
+        <template slot-scope="scope">
207
+        <el-input v-model="scope.row.order_number" style="width:160px" :disabled="disabled"></el-input>
208
+        </template>
209
+    </el-table-column>
210
+
161 211
     <el-table-column label="备注" align="center" width="200px">
162 212
         <template slot-scope="scope">
163 213
         <el-input v-model="scope.row.supply_remake" style="width:160px" :disabled="disabled"></el-input>
@@ -194,7 +244,10 @@
194 244
         <span>优惠率:<el-input style="width:100px" v-model="rate_of_concession"></el-input>%</span>
195 245
 
196 246
         <span>优惠金额:<el-input style="width:100px" v-model="discount_amount"></el-input></span>
247
+      
248
+        <span>本次付款:<el-input style="width:100px" v-model="payment"></el-input></span>
197 249
 
250
+        <span>本次欠款:<el-input style="width:100px" v-model="arrearage"></el-input></span>
198 251
     </div>
199 252
 </div>
200 253
 
@@ -215,7 +268,7 @@
215 268
 <script>
216 269
 import BreadCrumb from "@/xt_pages/components/bread-crumb";
217 270
 import {uParseTime } from '@/utils/tools'
218
-import {getInitOrder,updatePurchaseOrder,checkPurchaseOrder,getPurchaseOrderDetail} from "@/api/supply"
271
+import {getInitOrder,checkPurchaseOrder,getPurchaseOrderInfo,addGoodOrder,updateGoodOrder} from "@/api/supply"
219 272
 export default {
220 273
 name: "addPurchaseOrder",
221 274
 components: {
@@ -262,6 +315,9 @@ return {
262 315
     tableRules: {
263 316
      name: [{ required: true, message: '商品不能为空', trigger: 'blur' }],
264 317
      supply_count: [{ required: true, message: '数量不能为空', trigger: 'blur' }],
318
+     supply_batch_number:[{required:true,message:"批号不能为空", trigger: 'blur'}],
319
+     supply_product_date:[{required:true,message:"生产日期不能为空", trigger: 'blur'}],
320
+     supply_expiry_date:[{required:true,message:"有效日期不能为空",trigger: 'blur'}]
265 321
    },
266 322
    warehousing_id:0,
267 323
    number:"",
@@ -272,6 +328,13 @@ return {
272 328
    disabled:false,
273 329
    is_check:0,
274 330
    dialogVisible:false,
331
+   arrearage:"",
332
+   payment:"",
333
+   good_number:"",
334
+   orderInfo:[],
335
+   showOne:true,
336
+   showTwo:false,
337
+   warese_out_id:0,
275 338
   };
276 339
 },
277 340
 methods:{
@@ -358,7 +421,7 @@ changeGoodName(val){
358 421
   this.currentIndex = val
359 422
 },
360 423
 changeName(val){
361
-    //var obj = {"id":0,"name":"合计","supply_name":"","supply_type":"","supply_specification_name":"","supply_total":"","supply_count":"","supply_price":"","supply_total_price":"","supply_manufacturer":"","supply_license_number":"","supply_remake":"","is_total":2}
424
+  
362 425
    for(let i=0;i<this.recordInfo.tableList.length;i++){
363 426
     if(this.currentIndex == i){
364 427
         this.recordInfo.tableList[i].project_id = val.id
@@ -375,7 +438,7 @@ changeName(val){
375 438
         }
376 439
 
377 440
         this.recordInfo.tableList[i].supply_price = val.supply_price?val.supply_price:""
378
-        this.recordInfo.tableList[i].supply_total_price = val.supply_total_price?val.supply_total_price:""
441
+        this.recordInfo.tableList[i].supply_total_price = (val.supply_count * val.supply_price).toFixed(2)
379 442
         this.recordInfo.tableList[i].supply_manufacturer = val.supply_manufacturer
380 443
         this.recordInfo.tableList[i].supply_license_number = val.supply_license_number
381 444
         this.recordInfo.tableList[i].supply_remake = val.supply_remake
@@ -405,6 +468,11 @@ handleEdit(){
405 468
     tempObj['is_total'] = 1
406 469
     tempObj["project_id"] = 0
407 470
     tempObj["supply_unit"] = ""
471
+    tempObj["supply_batch_number"] = ""
472
+    tempObj["supply_product_date"] = ""
473
+    tempObj["order_number"] = ""
474
+    tempObj["supply_expiry_date"] = ""
475
+    tempObj["manufacturer_id"] = ""
408 476
     this.recordInfo.tableList.push(tempObj)
409 477
 },
410 478
 handleDelete: function(index, row) {
@@ -477,44 +545,7 @@ getTimes(time) {
477 545
     }
478 546
     return uParseTime(time, '{y}-{m}-{d}')
479 547
 },
480
- updatePurchaseOrder(){
481
-   this.loading = true 
482
-    if(this.supplier_name == 0 || this.supplier_name == ""){
483
-        this.$message.error("供应商不能为空!")
484
-        this.loading = false
485
-        return false
486
-    }
487
-   this.$refs["tableForm"].validate((valid)=>{
488
-      if(valid){
489
-        for(let i=0;i<this.recordInfo.tableList.length;i++){
490
-           this.recordInfo.tableList[i].supply_count = parseInt(this.recordInfo.tableList[i].supply_count)
491
-           this.recordInfo.tableList[i].supply_license_number = this.recordInfo.tableList[i].supply_license_number.toString()
492
-           this.recordInfo.tableList[i].supply_total_price = (this.recordInfo.tableList[i].supply_count * this.recordInfo.tableList[i].supply_price).toString()
493
-           this.recordInfo.tableList[i].supply_total = this.recordInfo.tableList[i].supply_total.toString()
494
-            this.recordInfo.tableList[i].supply_price = this.recordInfo.tableList[i].supply_price.toString()
495
-           for(let j=0;j<this.manufactuerList.length;j++){
496
-              if(this.recordInfo.tableList[i].supply_manufacturer == this.manufactuerList[j].manufacturer_name){
497
-                this.recordInfo.tableList[i].manufacturer_id = this.manufactuerList[j].id
498
-              }
499
-           }
500
-        }
501
-        var start = this.getTimes(this.start_time)
502
-        var end = this.getTimes(this.end_time)
503
-        const params = {
504
-        'stockIn': this.recordInfo.tableList
505
-        }
506
-        console.log("param23232332",params)  
507
-       
508
-        updatePurchaseOrder(params,this.supplier_name,start,end,this.rate_of_concession,this.discount_amount,this.id,this.number).then(response=>{
509
-           if(response.data.state == 1){
510
-            this.loading = false
511
-             var warehousingInfo =  response.data.data.warehousingInfo
512
-             this.$message.success("修改成功!")
513
-           }
514
-        })
515
-      } 
516
-   })
517
- },
548
+
518 549
  getAllPrice(){
519 550
    var total_price = 0
520 551
    for(let i=0;i<this.recordInfo.tableList.length;i++){
@@ -541,37 +572,40 @@ getTimes(time) {
541 572
     }) 
542 573
   },
543 574
   getPurchaseOrderDetail(){
544
-      console.log("处方233223232323322323232323")
575
+     
545 576
       var id = this.$route.query.id
546
-    getPurchaseOrderDetail(id).then(response=>{
577
+      var ids = this.$route.query.ids
578
+    getPurchaseOrderInfo(id,ids).then(response=>{
547 579
       if(response.data.state == 1){
548 580
         var info = response.data.data.info
549 581
         this.is_check = info.is_check
550
-        this.number = info.number
551 582
         this.id = info.id
552 583
         this.supplier_name = info.supplier_id
553 584
         this.rate_of_concession = info.rate_of_concession
554 585
         this.discount_amount = info.discount_amount
586
+        this.number = info.number
555 587
         var orderInfo = response.data.data.orderInfo
556
-        if(info.is_check == 2){
557
-           this.disabled = false
558
-        }
559
-        if(info.is_check == 1){
560
-           this.disabled = true
588
+       
589
+        for(let i=0;i<orderInfo.length;i++){
590
+          orderInfo[i].supply_batch_number = ""
591
+          orderInfo[i].supply_product_date = ""
592
+          orderInfo[i].supply_expiry_date = ""
561 593
         }
562
-        console.log("drugli323322332",this.drugList)
594
+        console.log("drugli323322332", orderInfo)
563 595
         var drugList = response.data.data.baseList
564 596
         var goodList = response.data.data.goodList
565
-        for(let i=0;i<orderInfo.length;i++){
566
-            orderInfo[i].supply_count = orderInfo[i].count
567
-            orderInfo[i].supply_price = orderInfo[i].price
568
-            orderInfo[i].supply_remake = orderInfo[i].remark
569
-            orderInfo[i].type = orderInfo[i].is_source
570
-            orderInfo[i].project_id = orderInfo[i].project_id
571
-            orderInfo[i].supply_unit = orderInfo[i].supply_unit
597
+        for(let i=0;i< orderInfo.length;i++){
598
+             orderInfo[i].supply_count =  orderInfo[i].count
599
+             orderInfo[i].supply_price =  orderInfo[i].price
600
+             orderInfo[i].supply_remake =  orderInfo[i].remark
601
+             orderInfo[i].type =  orderInfo[i].is_source
602
+             orderInfo[i].project_id =  orderInfo[i].project_id
603
+             orderInfo[i].supply_unit =  orderInfo[i].supply_unit
604
+             orderInfo[i].order_number =  orderInfo[i].order_number
605
+             orderInfo[i].supply_total_price = (orderInfo[i].count * orderInfo[i].price).toFixed(2)
572 606
            if(orderInfo[i].is_source == 1){
573 607
             for(let j=0;j<drugList.length;j++){
574
-                if(orderInfo[i].project_id == drugList[j].id){
608
+                if( orderInfo[i].project_id == drugList[j].id){
575 609
                   orderInfo[i].unitList = [{id:1,name:""},{id:2,name:""}]
576 610
                   orderInfo[i].unitList[0].name = drugList[j].max_unit
577 611
                   orderInfo[i].unitList[1].name = drugList[j].min_unit
@@ -587,8 +621,11 @@ getTimes(time) {
587 621
             }  
588 622
           } 
589 623
         }
590
-        console.log("orderINFO23323232",orderInfo)
624
+      
625
+        this.recordInfo.tableList= []
591 626
         this.recordInfo.tableList = orderInfo
627
+       
628
+          console.log("orderINFO23323232",this.recordInfo.tableList)
592 629
       }
593 630
     })  
594 631
   },
@@ -596,13 +633,146 @@ getTimes(time) {
596 633
      var id = this.$route.query.id
597 634
      this.$router.push({path:"/purchase/order/print?&id="+id})  
598 635
   },
599
-  toAdd(){
600
-    var id = this.$route.query.id
601
-    if(this.is_check == 2){
602
-      this.$message.error("该采购订单未审核,不能生成采购数据!")
603
-      return false
636
+  saveGoodOrder(){ 
637
+   
638
+    if(this.supplier_name == 0 || this.supplier_name == ""){
639
+       this.$message.error("供应商不能为空!")
640
+       this.loading = false
641
+       return false
642
+    } 
643
+
644
+    for(let i=0;i<this.recordInfo.tableList.length;i++){
645
+
646
+        this.recordInfo.tableList[i].supply_count = parseInt(this.recordInfo.tableList[i].supply_count)
647
+        this.recordInfo.tableList[i].supply_price = this.recordInfo.tableList[i].supply_price.toString()
648
+        this.recordInfo.tableList[i].supply_total_price= this.recordInfo.tableList[i].supply_total_price.toString()
649
+        this.recordInfo.tableList[i].supply_total = this.recordInfo.tableList[i].supply_total.toString()
650
+        if(this.recordInfo.tableList[i].id > 0){
651
+          this.recordInfo.tableList[i].type = 1
652
+        }
653
+        if(this.recordInfo.tableList[i].id == 0){
654
+          this.recordInfo.tableList[i].type = 2
655
+        }
656
+        for(let j=0;j<this.manufactuerList.length;j++){
657
+            if(this.recordInfo.tableList[i].supply_manufacturer == this.manufactuerList[j].manufacturer_name){
658
+              this.recordInfo.tableList[i].manufacturer_id = this.manufactuerList[j].id
659
+            }
660
+            if(this.recordInfo.tableList[i].supply_manufacturer == this.manufactuerList[j].id){
661
+              this.recordInfo.tableList[i].supply_manufacturer = this.manufactuerList[j].manufacturer_name
662
+            }
663
+
664
+        }
665
+    }
666
+    var start = this.getTimes(this.start_time)
667
+    this.$refs["tableForm"].validate((valid)=>{
668
+        if(valid){
669
+           this.loading = true
670
+           var warehousing_id = this.$route.query.id
671
+           var params = {
672
+             "stockIn":this.recordInfo.tableList,
673
+           } 
674
+        addGoodOrder(params,this.supplier_name,start,this.arrearage,this.payment,warehousing_id,this.number,this.rate_of_concession,this.discount_amount).then(response=>{
675
+          if(response.data.state == 1){
676
+             this.loading = false
677
+             this.$message.success("保存成功!")
678
+             this.showOne = false
679
+             this.showTwo = true
680
+             var orderInfo =  response.data.data.list
681
+             var warehouseOut = response.data.data.warehouseOut
682
+             this.warese_out_id = warehouseOut.id
683
+             this.good_number = warehouseOut.good_number
684
+             this.rate_of_concession = warehouseOut.rate_of_concession
685
+             this.discount_amount= warehouseOut.discount_amount
686
+             this.payment =warehouseOut.payment
687
+             this.arrearage =warehouseOut.arrearage
688
+             this.supplier_name = warehouseOut.supplier_id
689
+            
690
+            for(let i=0;i< orderInfo.length;i++){
691
+              orderInfo[i].supply_count =  orderInfo[i].count
692
+              orderInfo[i].supply_price =  orderInfo[i].price
693
+              orderInfo[i].supply_remake =  orderInfo[i].remark
694
+              orderInfo[i].type =  orderInfo[i].is_source
695
+              orderInfo[i].project_id =  orderInfo[i].project_id
696
+              orderInfo[i].supply_unit =  orderInfo[i].supply_unit
697
+              orderInfo[i].order_number =  orderInfo[i].order_number
698
+              orderInfo[i].supply_total_price = (orderInfo[i].count * orderInfo[i].price).toFixed(2)
699
+              orderInfo[i].supply_expiry_date = this.getTimes(orderInfo[i].supply_expiry_date)
700
+              orderInfo[i].supply_product_date = this.getTimes(orderInfo[i].supply_product_date)
701
+            if(orderInfo[i].is_source == 1){
702
+              for(let j=0;j<this.drugList.length;j++){
703
+                  if( orderInfo[i].project_id == this.drugList[j].id){
704
+                    orderInfo[i].unitList = [{id:1,name:""},{id:2,name:""}]
705
+                    orderInfo[i].unitList[0].name = this.drugList[j].max_unit
706
+                    orderInfo[i].unitList[1].name = this.drugList[j].min_unit
707
+                  }
708
+              }  
709
+              } 
710
+            if(orderInfo[i].is_source == 2){
711
+              for(let j=0;j<this.goodList.length;j++){
712
+                  if(orderInfo[i].project_id == this.goodList[j].id){
713
+                      orderInfo[i].unitList = [{id:1,name:""}]
714
+                      orderInfo[i].unitList[0].name = this.goodList[j].packing_unit
715
+                  }
716
+              }  
717
+            } 
718
+          }
719
+          this.recordInfo.tableList= []
720
+          this.recordInfo.tableList = orderInfo
721
+            
722
+           }
723
+         })
724
+        }
725
+    })
726
+  },
727
+  updateGoodOrder(){ 
728
+   
729
+    if(this.supplier_name == 0 || this.supplier_name == ""){
730
+       this.$message.error("供应商不能为空!")
731
+       this.loading = false
732
+       return false
733
+    } 
734
+    console.log("表哥2323233232",this.recordInfo.tableList)
735
+    for(let i=0;i<this.recordInfo.tableList.length;i++){
736
+
737
+        this.recordInfo.tableList[i].supply_count = parseInt(this.recordInfo.tableList[i].supply_count)
738
+        this.recordInfo.tableList[i].supply_price = this.recordInfo.tableList[i].supply_price.toString()
739
+        this.recordInfo.tableList[i].supply_total_price= this.recordInfo.tableList[i].supply_total_price.toString()
740
+        this.recordInfo.tableList[i].supply_total = this.recordInfo.tableList[i].supply_total.toString()
741
+        if(this.recordInfo.tableList[i].id > 0){
742
+          this.recordInfo.tableList[i].type = 1
743
+        }
744
+        if(this.recordInfo.tableList[i].id == 0){
745
+          this.recordInfo.tableList[i].type = 2
746
+        }
747
+        for(let j=0;j<this.manufactuerList.length;j++){
748
+            if(this.recordInfo.tableList[i].supply_manufacturer == this.manufactuerList[j].manufacturer_name){
749
+              this.recordInfo.tableList[i].manufacturer_id = this.manufactuerList[j].id
750
+            }
751
+            if(this.recordInfo.tableList[i].supply_manufacturer == this.manufactuerList[j].id){
752
+              this.recordInfo.tableList[i].supply_manufacturer = this.manufactuerList[j].manufacturer_name
753
+            }
754
+
755
+        }
604 756
     }
605
-    this.$router.push({path:"/purchase/order/add?id="+id})
757
+    var start = this.getTimes(this.start_time)
758
+    this.$refs["tableForm"].validate((valid)=>{
759
+        if(valid){
760
+           this.loading = true
761
+           var warehose_out_id = this.$route.query.id
762
+           var params = {
763
+             "stockIn":this.recordInfo.tableList,
764
+           } 
765
+           console.log("sotckind23232232323232323232",params)
766
+           
767
+           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=>{
768
+           if(response.data.state == 1){
769
+             this.loading = false
770
+             this.$message.success("修改成功!")
771
+             
772
+           }
773
+         })
774
+        }
775
+    })
606 776
   }
607 777
 },
608 778
 created(){
@@ -623,9 +793,17 @@ created(){
623 793
     tempObj['is_total'] = 1
624 794
     tempObj["project_id"] = 0
625 795
     tempObj["supply_unit"] = ""
796
+    tempObj["supply_batch_number"] = ""
797
+    tempObj["supply_product_date"] = ""
798
+    tempObj["order_number"] = ""
799
+    tempObj["supply_expiry_date"] = ""
800
+    tempObj["manufacturer_id"] = ""
626 801
     this.recordInfo.tableList.push(tempObj)
627 802
     this.getInitOrder()
628
-    this.getPurchaseOrderDetail()
803
+    if(parseInt(this.$route.query.id) > 0){
804
+      this.getPurchaseOrderDetail()
805
+    }
806
+  
629 807
 }
630 808
 };
631 809
 </script>

+ 42 - 35
src/xt_pages/supply/components/addPurchaseOrder.vue View File

@@ -7,8 +7,7 @@
7 7
     <div style="justify-content: space-between;margin: 0px 0 12px 0;display: flex;align-items: center;">
8 8
     <div>
9 9
         <span style="color:red">*</span><span>供应商:</span>
10
-        <el-select v-model="supplier_name" style="width:140px;margin-right:10px;" placeholder="请选择"
11
-        @change="changeTypeName">
10
+        <el-select v-model="supplier_name" style="width:140px;margin-right:10px;" placeholder="请选择">
12 11
         <el-option
13 12
             v-for="item in supplyList"
14 13
             :key="item.id"
@@ -28,7 +27,6 @@
28 27
         align="right"
29 28
         format="yyyy-MM-dd"
30 29
         value-format="yyyy-MM-dd"
31
-        @change="startTimeChange"
32 30
         ></el-date-picker>
33 31
         <span>交货日期:</span>
34 32
         <el-date-picker
@@ -42,7 +40,6 @@
42 40
             align="right"
43 41
             format="yyyy-MM-dd"
44 42
             value-format="yyyy-MM-dd"
45
-            @change="endTimeChange"
46 43
         ></el-date-picker>
47 44
         <span>单据编码:{{number}}</span>
48 45
 
@@ -145,16 +142,24 @@
145 142
         </template>
146 143
     </el-table-column>
147 144
 
148
-    <el-table-column label="生产厂" align="center" width="200px">
145
+    <el-table-column label="生产厂" align="center" width="200px">
149 146
         <template slot-scope="scope">
150
-        <el-input v-model="scope.row.supply_manufacturer" style="width:160px" :disabled="true"></el-input>
147
+        
148
+         <el-select size="small" v-model="scope.row.supply_manufacturer" filterable placeholder="请选择生产厂家" :disabled="true">
149
+                <el-option
150
+                  v-for="(option, index) in manufactuerList"
151
+                  :key="index"
152
+                  :label="option.manufacturer_name"
153
+                  :value="option.id">
154
+                </el-option>
155
+          </el-select>
151 156
         </template>
152 157
     </el-table-column>
153 158
 
154 159
 
155 160
     <el-table-column label="批准文号" align="center" width="200px">
156 161
         <template slot-scope="scope">
157
-        <el-input v-model="scope.row.supply_license_number" style="width:160px" :disabled="disabled"></el-input>
162
+        <el-input v-model="scope.row.supply_license_number" style="width:160px" :disabled="true"></el-input>
158 163
         </template>
159 164
     </el-table-column>
160 165
 
@@ -191,7 +196,7 @@
191 196
       合计:{{getAllPrice()}} 元
192 197
    </div>
193 198
    <div style="margin-top:10px">
194
-        <span>优惠率:<el-input style="width:100px" v-model="rate_of_concession"></el-input>%</span>
199
+        <span>优惠率:<el-input style="width:100px" v-model="rate_of_concession" @input='addressChange'></el-input>%</span>
195 200
 
196 201
         <span>优惠金额:<el-input style="width:100px" v-model="discount_amount"></el-input></span>
197 202
 
@@ -282,6 +287,7 @@ return {
282 287
    goodList:[
283 288
      {id:1,name:""},
284 289
    ],
290
+   total_price:0,
285 291
   };
286 292
 },
287 293
 methods:{
@@ -372,7 +378,6 @@ changeGoodName(val){
372 378
   this.currentIndex = val
373 379
 },
374 380
 changeName(val){
375
-   console.log("val3233232322332",val)
376 381
    for(let i=0;i<this.recordInfo.tableList.length;i++){
377 382
     if(this.currentIndex == i){
378 383
         this.recordInfo.tableList[i].project_id = val.id
@@ -433,14 +438,16 @@ handleDelete: function(index, row) {
433 438
 
434 439
 
435 440
 savePurchaseOrder(){
436
-    this.loading = true
441
+   
437 442
     if(this.supplier_name == 0 || this.supplier_name == ""){
438 443
        this.$message.error("供应商不能为空!")
439 444
        this.loading = false
440 445
        return false
441 446
     }
442 447
     this.$refs["tableForm"].validate((valid)=>{
448
+     
443 449
       if(valid){
450
+         this.loading = true
444 451
         for(let i=0;i<this.recordInfo.tableList.length;i++){
445 452
             this.recordInfo.tableList[i].supply_count = parseInt(this.recordInfo.tableList[i].supply_count)
446 453
             this.recordInfo.tableList[i].supply_license_number = this.recordInfo.tableList[i].supply_license_number.toString()
@@ -449,17 +456,18 @@ savePurchaseOrder(){
449 456
             this.recordInfo.tableList[i].supply_price = this.recordInfo.tableList[i].supply_price.toString()
450 457
             for(let j=0;j<this.manufactuerList.length;j++){
451 458
                 if(this.recordInfo.tableList[i].supply_manufacturer == this.manufactuerList[j].manufacturer_name){
452
-                this.recordInfo.tableList[i].manufacturer_id = this.manufactuerList[j].id
459
+                  this.recordInfo.tableList[i].manufacturer_id = this.manufactuerList[j].id
453 460
                 }
454 461
 
455 462
             }
456 463
         }
457 464
         var start = this.getTimes(this.start_time)
458 465
         var end = this.getTimes(this.end_time)
459
-         const params = {
466
+        const params = {
460 467
             'stockIn': this.recordInfo.tableList
461
-         }
462
-       
468
+        }
469
+        
470
+        console.log("params23322323",params)
463 471
         savePurchaseOrder(params,this.supplier_name,start,end,this.rate_of_concession,this.discount_amount).then(response=>{
464 472
             if(response.data.state == 1){
465 473
                 var order =  response.data.data.order
@@ -525,21 +533,6 @@ savePurchaseOrder(){
525 533
    })
526 534
 
527 535
 },
528
-
529
-
530
-changeTypeName(){
531
-
532
-},
533
-startTimeChange(){
534
-
535
-},
536
-endTimeChange(){
537
-
538
-},
539
-search(){
540
-
541
-},
542
-
543 536
 getWarehoseInfo(arr,max_unit,min_unit,min_number){
544 537
     var total = 0
545 538
     var max_str=  ""
@@ -589,7 +582,7 @@ getTimes(time) {
589 582
     return uParseTime(time, '{y}-{m}-{d}')
590 583
 },
591 584
  updatePurchaseOrder(){
592
-   this.loading = true 
585
+   
593 586
     if(this.supplier_name == 0 || this.supplier_name == ""){
594 587
         this.$message.error("供应商不能为空!")
595 588
         this.loading = false
@@ -597,6 +590,7 @@ getTimes(time) {
597 590
     }
598 591
    this.$refs["tableForm"].validate((valid)=>{
599 592
       if(valid){
593
+        this.loading = true 
600 594
         for(let i=0;i<this.recordInfo.tableList.length;i++){
601 595
            this.recordInfo.tableList[i].supply_count = parseInt(this.recordInfo.tableList[i].supply_count)
602 596
            this.recordInfo.tableList[i].supply_license_number = this.recordInfo.tableList[i].supply_license_number.toString()
@@ -604,8 +598,8 @@ getTimes(time) {
604 598
            this.recordInfo.tableList[i].supply_total = this.recordInfo.tableList[i].supply_total.toString()
605 599
             this.recordInfo.tableList[i].supply_price = this.recordInfo.tableList[i].supply_price.toString()
606 600
            for(let j=0;j<this.manufactuerList.length;j++){
607
-              if(this.recordInfo.tableList[i].supply_manufacturer == this.manufactuerList[j].manufacturer_name){
608
-                this.recordInfo.tableList[i].manufacturer_id = this.manufactuerList[j].id
601
+              if(this.recordInfo.tableList[i].supply_manufacturer == this.manufactuerList[j].id){
602
+                this.recordInfo.tableList[i].supply_manufacturer = this.manufactuerList[j].manufacturer_name
609 603
               }
610 604
            }
611 605
         }
@@ -615,7 +609,7 @@ getTimes(time) {
615 609
         'stockIn': this.recordInfo.tableList
616 610
         }
617 611
         console.log("params23232233223",params)
618
-        
612
+       
619 613
         updatePurchaseOrder(params,this.supplier_name,start,end,this.rate_of_concession,this.discount_amount,this.id,this.number).then(response=>{
620 614
            if(response.data.state == 1){
621 615
             this.loading = false
@@ -631,6 +625,12 @@ getTimes(time) {
631 625
    for(let i=0;i<this.recordInfo.tableList.length;i++){
632 626
       total_price += (this.recordInfo.tableList[i].supply_price * this.recordInfo.tableList[i].supply_count)
633 627
    }  
628
+   this.total_price = total_price
629
+  //   var discount_amount = 0
630
+  //   if(this.rate_of_concession >0){
631
+  //      discount_amount = (this.rate_of_concession/100*total_price)
632
+  //   } 
633
+  //  this.discount_amount = discount_amount.toFixed(2)
634 634
    return total_price.toFixed(2)
635 635
  },
636 636
  checkPurchaseOrder(id,index){
@@ -638,8 +638,7 @@ getTimes(time) {
638 638
     confirmButtonText: '确 定',
639 639
     cancelButtonText: '取 消',
640 640
     type: 'warning'
641
-    }).then(() => {
642
-    console.log("id232233232323223",this.id)    
641
+    }).then(() => {  
643 642
     checkPurchaseOrder(this.id).then(response => {
644 643
         if (response.data.state == 1) {
645 644
           var info = response.data.data.info
@@ -658,7 +657,15 @@ getTimes(time) {
658 657
   getDataConfig(module, filed_name){
659 658
     return getDataConfig(module, filed_name)
660 659
   },
660
+  addressChange(){
661
+    var discount_amount = 0
662
+    if(this.rate_of_concession >0){
663
+       discount_amount = (this.rate_of_concession/100*this.total_price).toFixed(2)
664
+    } 
665
+    this.discount_amount = discount_amount
666
+ }
661 667
 },
668
+
662 669
 created(){
663 670
     const tempObj = {}
664 671
     tempObj["id"] = 0

+ 784 - 0
src/xt_pages/supply/components/editGoodOrder.vue View File

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

+ 77 - 30
src/xt_pages/supply/components/editPurchaseOrder.vue View File

@@ -117,16 +117,8 @@
117 117
           </el-form-item>  
118 118
         </template>
119 119
     </el-table-column>
120
-    <el-table-column label="批号" align="center" width="130px">
121
-        <template slot-scope="scope">
122
-            <el-input v-model="scope.row.supply_total" style="width:100px" :disabled="true"></el-input>
123
-        </template>
124
-    </el-table-column>
125
-    <el-table-column label="有效日期" align="center" width="130px">
126
-        <template slot-scope="scope">
127
-            <el-input v-model="scope.row.supply_total" style="width:100px" :disabled="true"></el-input>
128
-        </template>
129
-    </el-table-column>
120
+   
121
+  
130 122
     <el-table-column label="可用库存" align="center" width="130px">
131 123
         <template slot-scope="scope">
132 124
             <el-input v-model="scope.row.supply_total" style="width:100px" :disabled="true"></el-input>
@@ -155,14 +147,16 @@
155 147
         </template>
156 148
     </el-table-column>
157 149
 
158
-    <el-table-column label="生产日期" align="center" width="200px">
159
-        <template slot-scope="scope">
160
-        <el-input v-model="scope.row.supply_manufacturer" style="width:160px" :disabled="true"></el-input>
161
-        </template>
162
-    </el-table-column>
163 150
     <el-table-column label="生产厂家" align="center" width="200px">
164 151
         <template slot-scope="scope">
165
-        <el-input v-model="scope.row.supply_manufacturer" style="width:160px" :disabled="true"></el-input>
152
+           <el-select size="small" v-model="scope.row.supply_manufacturer" filterable placeholder="请选择厂商" :disabled="disabled">
153
+                <el-option
154
+                  v-for="(option, index) in manufactuerList"
155
+                  :key="index"
156
+                  :label="option.manufacturer_name"
157
+                  :value="option.id">
158
+                </el-option>
159
+          </el-select>
166 160
         </template>
167 161
     </el-table-column>
168 162
 
@@ -172,11 +166,7 @@
172 166
         <el-input v-model="scope.row.supply_license_number" style="width:160px" :disabled="disabled"></el-input>
173 167
         </template>
174 168
     </el-table-column>
175
-    <el-table-column label="关联采购订单号" align="center" width="200px">
176
-        <template slot-scope="scope">
177
-        <el-input v-model="scope.row.supply_remake" style="width:160px" :disabled="disabled"></el-input>
178
-        </template>
179
-    </el-table-column>
169
+ 
180 170
     <el-table-column label="备注" align="center" width="200px">
181 171
         <template slot-scope="scope">
182 172
         <el-input v-model="scope.row.supply_remake" style="width:160px" :disabled="disabled"></el-input>
@@ -210,13 +200,11 @@
210 200
       合计:{{getAllPrice()}} 元
211 201
    </div>
212 202
    <div style="margin-top:10px">
213
-        <span>优惠率:<el-input style="width:100px" v-model="rate_of_concession"></el-input>%</span>
203
+        <span>优惠率:<el-input style="width:100px" v-model="rate_of_concession" @input='addressChange'></el-input>%</span>
214 204
 
215 205
         <span>优惠金额:<el-input style="width:100px" v-model="discount_amount"></el-input></span>
216 206
 
217
-        <span>本次付款:<el-input style="width:100px" v-model="discount_amount"></el-input></span>
218
-
219
-        <span>本次欠款:<el-input style="width:100px" v-model="discount_amount"></el-input></span>
207
+      
220 208
 
221 209
     </div>
222 210
 </div>
@@ -238,7 +226,7 @@
238 226
 <script>
239 227
 import BreadCrumb from "@/xt_pages/components/bread-crumb";
240 228
 import {uParseTime } from '@/utils/tools'
241
-import {getInitOrder,updatePurchaseOrder,checkPurchaseOrder,getPurchaseOrderDetail} from "@/api/supply"
229
+import {getInitOrder,updatePurchaseOrder,checkPurchaseOrder,getPurchaseOrderDetail,getAllOrderCountList} from "@/api/supply"
242 230
 export default {
243 231
 name: "addPurchaseOrder",
244 232
 components: {
@@ -295,6 +283,7 @@ return {
295 283
    disabled:false,
296 284
    is_check:0,
297 285
    dialogVisible:false,
286
+   total_price:0,
298 287
   };
299 288
 },
300 289
 methods:{
@@ -411,6 +400,10 @@ changeName(val){
411 400
 
412 401
 },
413 402
 handleEdit(){
403
+    if(this.is_check == 1){
404
+      this.$message.error("已审核的不能新增!")
405
+      return false
406
+    }
414 407
     const tempObj = {}
415 408
     tempObj["id"] = 0
416 409
     tempObj["name"] = ""
@@ -428,6 +421,7 @@ handleEdit(){
428 421
     tempObj['is_total'] = 1
429 422
     tempObj["project_id"] = 0
430 423
     tempObj["supply_unit"] = ""
424
+    tempObj["manufacturer_id"] = ""
431 425
     this.recordInfo.tableList.push(tempObj)
432 426
 },
433 427
 handleDelete: function(index, row) {
@@ -501,7 +495,7 @@ getTimes(time) {
501 495
     return uParseTime(time, '{y}-{m}-{d}')
502 496
 },
503 497
  updatePurchaseOrder(){
504
-   this.loading = true 
498
+   
505 499
     if(this.supplier_name == 0 || this.supplier_name == ""){
506 500
         this.$message.error("供应商不能为空!")
507 501
         this.loading = false
@@ -509,6 +503,9 @@ getTimes(time) {
509 503
     }
510 504
    this.$refs["tableForm"].validate((valid)=>{
511 505
       if(valid){
506
+        this.loading = true 
507
+        console.log("生产厂商",this.recordInfo.tableList)
508
+        console.log("生产上次",this.manufactuerList)
512 509
         for(let i=0;i<this.recordInfo.tableList.length;i++){
513 510
            this.recordInfo.tableList[i].supply_count = parseInt(this.recordInfo.tableList[i].supply_count)
514 511
            this.recordInfo.tableList[i].supply_license_number = this.recordInfo.tableList[i].supply_license_number.toString()
@@ -516,8 +513,8 @@ getTimes(time) {
516 513
            this.recordInfo.tableList[i].supply_total = this.recordInfo.tableList[i].supply_total.toString()
517 514
             this.recordInfo.tableList[i].supply_price = this.recordInfo.tableList[i].supply_price.toString()
518 515
            for(let j=0;j<this.manufactuerList.length;j++){
519
-              if(this.recordInfo.tableList[i].supply_manufacturer == this.manufactuerList[j].manufacturer_name){
520
-                this.recordInfo.tableList[i].manufacturer_id = this.manufactuerList[j].id
516
+              if(this.recordInfo.tableList[i].supply_manufacturer == this.manufactuerList[j].id){
517
+                 this.recordInfo.tableList[i].supply_manufacturer = this.manufactuerList[j].manufacturer_name
521 518
               }
522 519
            }
523 520
         }
@@ -543,6 +540,7 @@ getTimes(time) {
543 540
    for(let i=0;i<this.recordInfo.tableList.length;i++){
544 541
       total_price += (this.recordInfo.tableList[i].supply_price * this.recordInfo.tableList[i].supply_count)
545 542
    }  
543
+   this.total_price = total_price
546 544
    return total_price.toFixed(2)
547 545
  },
548 546
  checkPurchaseOrder(id,index){
@@ -624,7 +622,55 @@ getTimes(time) {
624 622
       this.$message.error("该采购订单未审核,不能生成采购数据!")
625 623
       return false
626 624
     }
627
-    this.$router.push({path:"/good/order/add?id="+id})
625
+    //获取商品购货订单 和 购货单的总数量
626
+    getAllOrderCountList(id).then(response=>{
627
+      if(response.data.state == 1){
628
+        var purcaseOrder = response.data.data.purcaseOrder
629
+        console.log("采购订单",purcaseOrder)
630
+        var goodOrder = response.data.data.goodOrder
631
+        console.log("采购单",goodOrder)
632
+        var arr = []
633
+        var total = 0
634
+        var str = ""
635
+        // 如果采购单没有数据,则代表改订单第一次生成采购订单数据
636
+        if(goodOrder.length == 0){
637
+          this.$router.push({path:"/good/order/add?id="+id+"&ids="+str})
638
+        }
639
+        //如果采购单有数据,则需要比较数量
640
+        if(goodOrder.length > 0){
641
+          for(let i=0;i<purcaseOrder.length;i++){
642
+            for(let j=0;j<goodOrder.length;j++){
643
+              if(purcaseOrder[i].project_id == goodOrder[j].project_id){
644
+                  //根据商品ID比较数量大小,把数量不足的商品ID储存,表示采购单的数量未满足采购订单的数据,可以继续生成采购单
645
+                  if(purcaseOrder[i].count > goodOrder[j].count){
646
+                     arr.push(purcaseOrder[i].project_id)
647
+                  }
648
+
649
+              }
650
+            }
651
+          }
652
+          //如果total的长度等于 采购单的长度,怎表示该采购订单已经全部生成
653
+         
654
+          if(arr.length == 0){
655
+            this.$message.error("该订单已全部生成采购单,请知悉!")
656
+          }
657
+          
658
+
659
+          if(total!=goodOrder.length){
660
+             str = arr.join(",")
661
+            this.$router.push({path:"/good/order/add?id="+id+"&ids="+str})
662
+          }
663
+        }
664
+       
665
+       
666
+      }
667
+    })
668
+    
669
+  },
670
+  addressChange(){
671
+    if(this.rate_of_concession >0){
672
+     this.discount_amount = (this.rate_of_concession/100*this.total_price).toFixed(2)
673
+    } 
628 674
   }
629 675
 },
630 676
 created(){
@@ -645,6 +691,7 @@ created(){
645 691
     tempObj['is_total'] = 1
646 692
     tempObj["project_id"] = 0
647 693
     tempObj["supply_unit"] = ""
694
+    tempObj["manufacturer_id"] = ""
648 695
     this.recordInfo.tableList.push(tempObj)
649 696
     this.getInitOrder()
650 697
     this.getPurchaseOrderDetail()

+ 11 - 10
src/xt_pages/supply/goodOrderQuery.vue View File

@@ -82,7 +82,7 @@
82 82
         </el-table-column>
83 83
         <el-table-column label="单据编号" align="center">
84 84
           <template slot-scope="scope">
85
-            <span>{{scope.row.number}}</span>
85
+            <span>{{scope.row.good_number}}</span>
86 86
           </template>
87 87
         </el-table-column>
88 88
         <el-table-column label="供应商" align="center">
@@ -92,17 +92,17 @@
92 92
          </el-table-column>
93 93
         <el-table-column label="关联购货订单号" align="center" width="200">
94 94
           <template slot-scope="scope">
95
-            
95
+            <span>{{scope.row.number}}</span>
96 96
           </template>
97 97
         </el-table-column>
98 98
         <el-table-column label="购货金额" align="center">
99 99
           <template slot-scope="scope">
100
-             <span v-if="getAllBuyPrice(scope.row.orderInfo)>0">{{getAllBuyPrice(scope.row.orderInfo)}}</span> 
100
+             <span v-if="getAllBuyPrice(scope.row.orderOut)>0">{{getAllBuyPrice(scope.row.orderOut)}}</span> 
101 101
           </template>
102 102
         </el-table-column>
103 103
         <el-table-column label="优惠后金额" align="center">
104 104
          <template slot-scope="scope">
105
-           {{getAllCount(scope.row.orderInfo)}}
105
+           {{getAllCount(scope.row.orderOut)}}
106 106
          </template>
107 107
        </el-table-column>
108 108
         <el-table-column label="已付款" align="center">
@@ -112,7 +112,7 @@
112 112
        </el-table-column>
113 113
        <el-table-column label="数量" align="center">
114 114
          <template slot-scope="scope">
115
-           {{getAllCount(scope.row.orderInfo)}}
115
+           {{getAllCount(scope.row.orderOut)}}
116 116
          </template>
117 117
        </el-table-column>
118 118
 
@@ -175,7 +175,7 @@
175 175
 <script>
176 176
 import BreadCrumb from "@/xt_pages/components/bread-crumb";
177 177
 
178
-import {getAllSupply,getAllPurchaseOrderList} from "@/api/supply"
178
+import {getAllSupply,getAllGoodOrderList} from "@/api/supply"
179 179
 import {uParseTime } from '@/utils/tools'
180 180
 export default {
181 181
   name: "stockIn",
@@ -217,7 +217,8 @@ export default {
217 217
   },
218 218
   methods:{
219 219
      toAdd(){
220
-       this.$router.push({path:"/purchase/order/add"})
220
+       var id = 0
221
+       this.$router.push({path:"/good/order/add?id="+id})
221 222
      },
222 223
      changeTypeName(){
223 224
 
@@ -268,10 +269,10 @@ export default {
268 269
           page:this.page,
269 270
           limit:this.limit,
270 271
         }
271
-       getAllPurchaseOrderList(params).then(response=>{
272
+       getAllGoodOrderList(params).then(response=>{
272 273
           if(response.data.state == 1){
273 274
             var list = response.data.data.list 
274
-            console.log("list2332232323232",list)
275
+            console.log("购货单列表",list)
275 276
             this.tableList = list
276 277
             var total = response.data.data.total
277 278
             this.total = total
@@ -315,7 +316,7 @@ export default {
315 316
        return count
316 317
      },
317 318
      toClick(id){
318
-       this.$router.push({path:"/purchase/order/edit?id="+id})
319
+       this.$router.push({path:"/good/order/edit?id="+id})
319 320
      }
320 321
   },
321 322
   created() {

+ 67 - 17
src/xt_pages/supply/purchaseOrderQuery.vue View File

@@ -92,7 +92,11 @@
92 92
          </el-table-column>
93 93
         <el-table-column label="关联购货订单" align="center">
94 94
           <template slot-scope="scope">
95
-            
95
+            <div style="width:100%;height:100%">
96
+              <tr class="annotation-rs cluster-rs" v-for="(item,index) in scope.row.orderOut" :key="index">
97
+                 <td>{{item.good_number}}</td>
98
+              </tr>
99
+            </div>
96 100
           </template>
97 101
         </el-table-column>
98 102
         <el-table-column label="购物金额" align="center">
@@ -106,14 +110,14 @@
106 110
            {{getAllCount(scope.row.orderInfo)}}
107 111
          </template>
108 112
        </el-table-column>
109
-
110 113
        <el-table-column label="订单状态" align="center">
111 114
          <template slot-scope="scope">
112
-           <span v-if="scope.row.is_check == 2">未审核</span>
113
-           <span v-if="scope.row.is_check == 1">已审核</span>
115
+           <span v-if="scope.row.is_warehouse == 1">全部入库</span>
116
+           <span v-if="scope.row.is_warehouse == 2">未入库</span>
117
+           <span v-if="scope.row.is_warehouse == 3">部分入库</span>
114 118
          </template>
115 119
        </el-table-column>
116
-      
120
+     
117 121
         <el-table-column label="交货日期" align="center">
118 122
          <template slot-scope="scope">
119 123
            {{getTimes(scope.row.delivery_date)}}
@@ -133,7 +137,7 @@
133 137
          </template>
134 138
        </el-table-column>
135 139
 
136
-       <el-table-column label="操作" align="center" width="260px">
140
+       <el-table-column label="操作" align="center" width="200px">
137 141
           <template slot-scope="scope">
138 142
               <el-button
139 143
                 icon="el-icon-edit-outline"
@@ -146,7 +150,7 @@
146 150
                 icon="el-icon-delete"
147 151
                 size="small"
148 152
                 type="danger"
149
-                @click="toClickOne(scope.row)"
153
+                @click="toDelete(scope.row,scope.$index)"
150 154
               >删除
151 155
               </el-button>
152 156
           </template>
@@ -172,7 +176,7 @@
172 176
 <script>
173 177
 import BreadCrumb from "@/xt_pages/components/bread-crumb";
174 178
 
175
-import {getAllSupply,getAllPurchaseOrderList} from "@/api/supply"
179
+import {getAllSupply,getAllPurchaseOrderList,deletePurchaseOrder} from "@/api/supply"
176 180
 import {uParseTime } from '@/utils/tools'
177 181
 export default {
178 182
   name: "stockIn",
@@ -217,16 +221,16 @@ export default {
217 221
        this.$router.push({path:"/purchase/order/add"})
218 222
      },
219 223
      changeTypeName(){
220
-
224
+       this.getlist()
221 225
      },
222 226
      startTimeChange(){
223
-
227
+      this.getlist()
224 228
      },
225 229
      endTimeChange(){
226
-
230
+      this.getlist()
227 231
      },
228 232
      search(){
229
-
233
+      this.getlist()
230 234
      },
231 235
      handleSizeChange(val){
232 236
        this.limit = val
@@ -246,9 +250,6 @@ export default {
246 250
             }
247 251
          }
248 252
        })
249
-     },
250
-     changeTypeName(){
251
-
252 253
      },
253 254
      getTimes(time) {
254 255
       if (time === '') {
@@ -268,7 +269,6 @@ export default {
268 269
        getAllPurchaseOrderList(params).then(response=>{
269 270
           if(response.data.state == 1){
270 271
             var list = response.data.data.list 
271
-            console.log("list2332232323232",list)
272 272
             this.tableList = list
273 273
             var total = response.data.data.total
274 274
             this.total = total
@@ -313,7 +313,35 @@ export default {
313 313
      },
314 314
      toClick(id){
315 315
        this.$router.push({path:"/purchase/order/edit?id="+id})
316
-     }
316
+     },
317
+     toDelete(val,index){
318
+       if(val.is_check == 1){
319
+         this.$message.error("已审核单据,不能删除!")
320
+         return false
321
+       }
322
+       if(val.orderOut.length >0 ){
323
+         this.$message.error("已关联单据,不能删除!")
324
+         return false
325
+       }
326
+       this.$confirm('确认删除吗?', '删除', {
327
+          confirmButtonText: '确 定',
328
+          cancelButtonText: '取 消',
329
+          type: 'warning'
330
+        }).then(() => {
331
+            
332
+          deletePurchaseOrder(val.id).then(response => {
333
+            if (response.data.state == 1) {
334
+                var msg = response.data.data.msg
335
+                this.tableList.splice(index, 1);
336
+                this.$message.success("删除成功")
337
+            } else {
338
+                this.$message.error("删除失败")
339
+            }
340
+          })
341
+        })
342
+        .catch(() => {
343
+        }) 
344
+      }
317 345
   },
318 346
   created() {
319 347
     var now = new Date(); //当前日期 
@@ -329,6 +357,28 @@ export default {
329 357
  
330 358
 };
331 359
 </script>
360
+<style lang="scss">
361
+  .cluster-rs {
362
+    text-align: center;
363
+  }
364
+  .annotation-rs{
365
+    width: 100%;
366
+    height: 100%;
367
+    border: none;
368
+    td{
369
+      width: 155px;
370
+      padding: 5px;
371
+      border-right: none;
372
+      text-align: center;
373
+      vertical-align: middle;
374
+    }
375
+  }
376
+  tr:last-child{
377
+    td{
378
+      border-bottom: none;
379
+    }
380
+  }
381
+</style>
332 382
 
333 383
 <style rel="stylesheet/css" lang="scss" scoped>
334 384
 .information {