Browse Source

11月14日 库存扣减更新

XMLWAN 3 years ago
parent
commit
ba7ded3649

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

@@ -66,6 +66,15 @@ export default {
66 66
       component: () => import('@/xt_pages/supply/goodOrderQuery'),
67 67
       name: 'goodOrderQuery',
68 68
       meta: { title: 'goodOrderQuery', noCache: true }
69
+    },
70
+    {
71
+      path: '/good/order/add',
72
+      component: () => import('@/xt_pages/supply/components/addGoodOrder'),
73
+      name: 'addGoodOrder',
74
+      meta: { title: 'addGoodOrder', noCache: true },
75
+      hidden: true,
76
+      is_menu: false,
77
+      isChild: true
69 78
     }
70 79
 
71 80
   ]

+ 34 - 49
src/xt_pages/stock/drugs/components/drugOutDetail.vue View File

@@ -71,46 +71,7 @@
71 71
       </div>
72 72
     </div>
73 73
 
74
-    
75
-
76
-    <!-- <div class="cell clearfix">
77
-      <label class="title"><span class="name">单据类型</span> : </label>
78
-      <el-select
79
-        size="small"
80
-        v-model="order_type"
81
-        clearable
82
-        placeholder="单据类型"
83
-        @change="changeType"
84
-      >
85
-        <el-option
86
-          v-for="item in orderTypeArr"
87
-          :key="item.value"
88
-          :label="item.label"
89
-          :value="item.value"
90
-        >
91
-        </el-option>
92
-      </el-select>
93
-    </div> -->
94
-
95
-    <!-- <div class="cell clearfix">
96
-      <label class="title"><span class="name">其它</span> : </label>
97
-      <el-select
98
-        size="small"
99
-        v-model="manufacturer_id"
100
-        clearable
101
-        placeholder="厂商"
102
-        @change="changeManufacturer"
103
-      >
104
-        <el-option
105
-          v-for="item in manufacturer"
106
-          :key="item.id"
107
-          :label="item.manufacturer_name"
108
-          :value="item.id"
109
-        >
110
-        </el-option>
111
-      </el-select>
112
-    </div> -->
113
-
74
+  
114 75
     <el-row :gutter="12" style="margin-top: 10px">
115 76
       <el-table
116 77
         :data="tableData"
@@ -166,8 +127,11 @@
166 127
         </el-table-column>
167 128
         <el-table-column label="出货价" align="center">
168 129
           <template slot-scope="scope">
169
-           <span v-if="org_id == 9919 || org_id == 9671">{{scope.row.last_price}} </span> 
170
-           <span v-else>{{scope.row.price}}</span>
130
+           <span v-if="org_id == 9919">{{scope.row.last_price}} </span> 
131
+           <span v-else>
132
+             <span v-if="scope.row.price >0"> {{scope.row.price}}</span>
133
+            <span v-if="scope.row.price  == 0"> {{getPrice(scope.row.drug_id)}}</span>
134
+           </span>
171 135
           </template>
172 136
         </el-table-column>
173 137
         <el-table-column label="数量" align="center">
@@ -177,8 +141,12 @@
177 141
         </el-table-column>
178 142
         <el-table-column label="总价" align="center">
179 143
           <template slot-scope="scope">
180
-            
181
-            {{scope.row.total_price}}
144
+           <span v-if="org_id == 9919">{{(scope.row.last_price * scope.row.count).toFixed(2)}} </span> 
145
+           <span v-else>
146
+             <span v-if="scope.row.price >0">{{(scope.row.last_price * scope.row.count).toFixed(2)}}</span>
147
+             <span v-if="scope.row.price  == 0">{{(getPrice(scope.row.drug_id)* scope.row.count).toFixed(2)}}</span>
148
+           </span>
149
+            <!-- {{scope.row.total_price}} -->
182 150
           </template>
183 151
         </el-table-column>
184 152
       </el-table>
@@ -424,12 +392,20 @@ export default {
424 392
           for(let i=0;i<order.length;i++){
425 393
              order[i].specification_name  = order[i].dose + order[i].dose_unit + "*" + order[i].min_number +  order[i].min_unit + "/" + order[i].max_unit
426 394
              order[i].is_total = 0
427
-             if(this.org_id == 9919 || this.org_id == 9671){
395
+             if(this.org_id == 9919){
428 396
                order[i].total_price = order[i].count * order[i].last_price
429 397
                total_price += order[i].count * order[i].last_price
430 398
              }else{
431
-                order[i].total_price = order[i].count * order[i].price
432
-                total_price += order[i].count * order[i].price
399
+               if(order[i].price > 0){
400
+                 order[i].total_price = order[i].count * order[i].price
401
+                 total_price += order[i].count * order[i].price
402
+               }
403
+               if(order[i].price ==0 ){
404
+                  order[i].total_price = order[i].count * this.getPrice(order[i].drug_id)
405
+                  total_price += order[i].count * this.getPrice(order[i].drug_id)
406
+                  order[i].price = this.getPrice(order[i].drug_id)
407
+               } 
408
+               
433 409
              }
434 410
             
435 411
           }
@@ -451,7 +427,7 @@ export default {
451 427
            let objInfo = {}
452 428
           order.forEach((item,index)=>{
453 429
              let { drug_id } = item
454
-             if(this.org_id == 9671 || this.org_id == 9919){
430
+             if( this.org_id == 9919){
455 431
               if(!objInfo[drug_id]){
456 432
                 objInfo[drug_id] = {
457 433
                   drug_id,
@@ -540,7 +516,7 @@ export default {
540 516
           this.tablePrint[i].index = i+1
541 517
         }
542 518
         for(let i=0;i<this.tablePrint.length;i++){
543
-           if(this.org_id == 9671 || this.org_id == 9919 ){
519
+           if(this.org_id == 9919 ){
544 520
            
545 521
              this.tablePrint[i].count = this.getCountSix(this.tablePrint[i].drug_id,this.tablePrint[i].child)
546 522
              this.tablePrint[i].total_price = this.getCountSenven(this.tablePrint.drug_id,this.tablePrint[i].child,this.tablePrint[i].price)
@@ -795,6 +771,15 @@ export default {
795 771
           }
796 772
         }
797 773
         return name
774
+      },
775
+      getPrice(drug_id){
776
+        var price = ""
777
+        for(let i=0;i<this.drugList.length;i++){
778
+          if(drug_id == this.drugList[i].id){
779
+             price = this.drugList[i].min_price
780
+          }
781
+        }
782
+        return price
798 783
       } 
799 784
   }
800 785
 };

+ 10 - 1
src/xt_pages/stock/drugs/drugStockFlow.vue View File

@@ -109,7 +109,8 @@
109 109
        
110 110
         <el-table-column prop="drug_name" label="单价" align="center">
111 111
            <template slot-scope="scope">
112
-              <span>{{scope.row.price}}</span>
112
+              <span v-if="scope.row.price >0">{{scope.row.price}}</span>
113
+              <span v-if="scope.row.price == 0">{{getPrice(scope.row.drug_id)}}</span>
113 114
            </template>
114 115
         </el-table-column>
115 116
          <el-table-column prop="drug_name" label="有效期" align="center">
@@ -268,6 +269,7 @@
268 269
             this.total = total
269 270
             var manufacturerList = response.data.data.manufacturerList
270 271
             this.manufacturerList = manufacturerList
272
+            this.drug =  response.data.data.drug
271 273
          
272 274
            }
273 275
          })  
@@ -518,6 +520,13 @@
518 520
            name = this.drug.drug_name
519 521
         }
520 522
         return name
523
+     },
524
+     getPrice(id){
525
+       var min_price = 0 
526
+       if(id == this.drug.id){
527
+         min_price = this.drug.min_price
528
+       }
529
+       return min_price
521 530
      }
522 531
     }
523 532
   }

+ 52 - 50
src/xt_pages/stock/drugs/drugStockInOrderEdit.vue View File

@@ -593,55 +593,55 @@ export default {
593 593
         return "";
594 594
       }
595 595
     },
596
-    showDialog(index, row) {
597
-      this.currentIndex = index;
598
-      const loading = this.$loading({
599
-        lock: true,
600
-        text: "Loading",
601
-        spinner: "el-icon-loading",
602
-        background: "rgba(0, 0, 0, 0.7)"
603
-      });
604
-
605
-      const params = {
606
-        manufacturer_id: this.form.manufacturer,
607
-        dealer_id: this.form.dealer
608
-      };
609
-      GetAllDrugInfoByID(params).then(response => {
610
-        if (response.data.state == 0) {
611
-          this.$message.error(response.data.msg);
612
-          return false;
613
-        } else {
614
-          if (response.data.data.drugs.length <= 0) {
615
-            this.$message.error("该厂商或经销商没有药品信息");
616
-            loading.close();
617
-
618
-            return;
619
-          }
620
-          this.$refs.dialog.show();
621
-          for (let i = 0; i < response.data.data.drugs.length; i++) {
622
-            this.propForm.goods.push(
623
-              response.data.data.drugs[i]
624
-            );
625
-          }
626
-          const obj = {};
627
-          this.propForm.goods = this.propForm.goods.reduce(
628
-            (cur, next) => {
629
-              obj[next.id] ? "" : (obj[next.id] = true && cur.push(next));
630
-              return cur;
631
-            },
632
-            []
633
-          ); // 设置cur默认类型为数组,并且初始值为空的数组
634
-        }
635
-
636
-        for (let i = 0; i < this.propForm.goods.length; i++) {
637
-          for (let a = 0; a < this.propForm.goods[i].drug_specs.length; a++) {
638
-            var respObj = this.propForm.goods[i].drug_specs[a];
639
-            respObj["isSelected"] = false;
640
-          }
641
-        }
642
-        loading.close();
643
-      });
644
-    },
596
+    // showDialog(index, row) {
597
+    //   this.currentIndex = index;
598
+    //   const loading = this.$loading({
599
+    //     lock: true,
600
+    //     text: "Loading",
601
+    //     spinner: "el-icon-loading",
602
+    //     background: "rgba(0, 0, 0, 0.7)"
603
+    //   });
604
+
605
+    //   const params = {
606
+    //     manufacturer_id: this.form.manufacturer,
607
+    //     dealer_id: this.form.dealer
608
+    //   };
609
+    //   GetAllDrugInfoByID(params).then(response => {
610
+    //     if (response.data.state == 0) {
611
+    //       this.$message.error(response.data.msg);
612
+    //       return false;
613
+    //     } else {
614
+    //       if (response.data.data.drugs.length <= 0) {
615
+    //         this.$message.error("该厂商或经销商没有药品信息");
616
+    //         loading.close();
617
+
618
+    //         return;
619
+    //       }
620
+    //       this.$refs.dialog.show();
621
+    //       for (let i = 0; i < response.data.data.drugs.length; i++) {
622
+    //         this.propForm.goods.push(
623
+    //           response.data.data.drugs[i]
624
+    //         );
625
+    //       }
626
+    //       const obj = {};
627
+    //       this.propForm.goods = this.propForm.goods.reduce(
628
+    //         (cur, next) => {
629
+    //           obj[next.id] ? "" : (obj[next.id] = true && cur.push(next));
630
+    //           return cur;
631
+    //         },
632
+    //         []
633
+    //       ); // 设置cur默认类型为数组,并且初始值为空的数组
634
+    //     }
635
+
636
+    //     for (let i = 0; i < this.propForm.goods.length; i++) {
637
+    //       for (let a = 0; a < this.propForm.goods[i].drug_specs.length; a++) {
638
+    //         var respObj = this.propForm.goods[i].drug_specs[a];
639
+    //         respObj["isSelected"] = false;
640
+    //       }
641
+    //     }
642
+    //     loading.close();
643
+    //   });
644
+    // },
645 645
     back() {
646 646
       this.$router.go(-1);
647 647
     },
@@ -712,6 +712,7 @@ export default {
712 712
       });
713 713
     },
714 714
     GetOrderDetail: function(order_id) {
715
+      this.listLoading = true
715 716
       const params = {
716 717
         id: order_id
717 718
       };
@@ -789,6 +790,7 @@ export default {
789 790
             this.warehouse.warehousing_time,
790 791
             "{y}-{m}-{d}"
791 792
           );
793
+          this.listLoading = false
792 794
         }
793 795
       });
794 796
     },
@@ -877,7 +879,7 @@ export default {
877 879
   created() {
878 880
    
879 881
     this.drugTypeList = getDictionaryDataConfig('system','drug_type') 
880
-    this.GetConfigInfo();
882
+    //this.GetConfigInfo();
881 883
     this.propForm.goodUnit = this.$store.getters.good_unit;
882 884
     const order_id = this.$route.query.id;
883 885
     this.GetOrderDetail(order_id);

+ 688 - 0
src/xt_pages/supply/components/addGoodOrder.vue View File

@@ -0,0 +1,688 @@
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>单据编码:{{number}}</span>
48
+
49
+    </div>
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>
56
+       
57
+    </div>
58
+    </div>
59
+
60
+   <el-form :rules="tableRules" :model="recordInfo" ref="tableForm">
61
+    <el-table
62
+    :row-style="{ color: '#303133' }"
63
+    :header-cell-style="{
64
+        backgroundColor: 'rgb(245, 247, 250)',
65
+        color: '#606266'
66
+    }"
67
+    :data="recordInfo.tableList"
68
+    :class="signAndWeighBoxPatients"
69
+    border
70
+    style="width: 100%"
71
+    max-height="450"
72
+    >
73
+    <el-table-column align="center" width="200px">
74
+        <template slot="header" slot-scope="scope">
75
+            <span>商品<span style="color: red">*</span></span>
76
+        </template>
77
+        <template slot-scope="scope">
78
+           <el-form-item :prop="'tableList.' + scope.$index + '.name'" :rules='tableRules.name'>
79
+            <el-select v-model="scope.row.name" style="width:160px;" filterable placeholder="请选择" @change="changeName"   @input="changeGoodName(scope.$index)" :disabled="disabled">
80
+                <el-option
81
+                    v-for="(item,index) in tabList"
82
+                    :key="index"
83
+                    :label="item.supply_name"
84
+                    :value="item">
85
+                </el-option>
86
+             </el-select>
87
+           </el-form-item>
88
+        </template>
89
+    </el-table-column>
90
+    <el-table-column  align="center" width="150px">
91
+        <template slot="header" slot-scope="scope">
92
+            <span>商品类别</span>
93
+        </template>
94
+        <template slot-scope="scope">
95
+            <el-input v-model="scope.row.supply_type" style="width:120px" :disabled="true"></el-input>
96
+        </template>
97
+    </el-table-column>
98
+    <el-table-column label="规格&单位" align="center" width="200px">
99
+        <template slot-scope="scope">
100
+            <el-input v-model="scope.row.supply_specification_name" style="width:150px" :disabled="true"></el-input>
101
+        </template>
102
+    </el-table-column>
103
+     <el-table-column label="单位" align="center" width="120px">
104
+        <template slot="header" slot-scope="scope">
105
+            <span>单位<span style="color: red">*</span></span>
106
+        </template>
107
+        <template slot-scope="scope">
108
+          <el-form-item :prop="'tableList.' + scope.$index + '.supply_unit'" :rules='tableRules.supply_unit'>
109
+            <el-select v-model="scope.row.supply_unit" style="width:100px;" filterable placeholder="请选择"  :disabled="disabled">
110
+                    <el-option
111
+                        v-for="(item,index) in scope.row.unitList"
112
+                        :key="index"
113
+                        :label="item.name"
114
+                        :value="item.name">
115
+                    </el-option>
116
+             </el-select>
117
+          </el-form-item>  
118
+        </template>
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="120px">
126
+        <template slot="header" slot-scope="scope">
127
+            <span>数量<span style="color: red">*</span></span>
128
+        </template>
129
+        <template slot-scope="scope">
130
+          <el-form-item  :prop="'tableList.' + scope.$index + '.supply_count'" :rules='tableRules.supply_count'>
131
+             <el-input v-model="scope.row.supply_count" style="width:80px" :disabled="disabled"></el-input>
132
+          </el-form-item>
133
+        </template>
134
+    </el-table-column>
135
+
136
+    <el-table-column label="购货单价" align="center" width="120px">
137
+        <template slot-scope="scope">
138
+        <el-input v-model="scope.row.supply_price" style="width:80px" :disabled="disabled"></el-input>
139
+        </template>
140
+    </el-table-column>
141
+
142
+    <el-table-column label="购货金额" align="center" width="120px">
143
+        <template slot-scope="scope">
144
+          {{calculate(scope.row.supply_count * scope.row.supply_price)}}
145
+        </template>
146
+    </el-table-column>
147
+
148
+    <el-table-column label="生产厂商" align="center" width="200px">
149
+        <template slot-scope="scope">
150
+        <el-input v-model="scope.row.supply_manufacturer" style="width:160px" :disabled="true"></el-input>
151
+        </template>
152
+    </el-table-column>
153
+
154
+
155
+    <el-table-column label="批准文号" align="center" width="200px">
156
+        <template slot-scope="scope">
157
+        <el-input v-model="scope.row.supply_license_number" style="width:160px" :disabled="disabled"></el-input>
158
+        </template>
159
+    </el-table-column>
160
+
161
+    <el-table-column label="备注" align="center" width="200px">
162
+        <template slot-scope="scope">
163
+        <el-input v-model="scope.row.supply_remake" style="width:160px" :disabled="disabled"></el-input>
164
+        </template>
165
+    </el-table-column>
166
+
167
+    <el-table-column label="操作" align="center" width="150px" fixed="right" >
168
+        <template slot-scope="scope">
169
+        <el-tooltip class="item" effect="dark" content="新增" placement="top" >
170
+            <el-button
171
+                size="mini"
172
+                type="primary"
173
+                icon="el-icon-circle-plus-outline"
174
+                @click="handleEdit(scope.$index, scope.row)">
175
+            </el-button>
176
+       </el-tooltip>
177
+       <el-tooltip class="item" effect="dark" content="删除" placement="top">
178
+            <el-button
179
+                size="mini"
180
+                type="danger"
181
+                icon="el-icon-delete"
182
+                @click="handleDelete(scope.$index, scope.row)">
183
+            </el-button>
184
+        </el-tooltip>
185
+
186
+        </template>
187
+    </el-table-column>
188
+  </el-table>
189
+</el-form>
190
+   <div style="margin-top:10px">
191
+      合计:{{getAllPrice()}} 元
192
+   </div>
193
+   <div style="margin-top:10px">
194
+        <span>优惠率:<el-input style="width:100px" v-model="rate_of_concession"></el-input>%</span>
195
+
196
+        <span>优惠金额:<el-input style="width:100px" v-model="discount_amount"></el-input></span>
197
+
198
+    </div>
199
+</div>
200
+
201
+  <!-- <el-dialog
202
+  title="提示"
203
+  :visible.sync="dialogVisible"
204
+  width="30%"
205
+  :before-close="handleClose">
206
+  <span>这是一段信息</span>
207
+  <span slot="footer" class="dialog-footer">
208
+    <el-button @click="dialogVisible = false">取 消</el-button>
209
+    <el-button type="primary" @click="dialogVisible = false">确 定</el-button>
210
+  </span>
211
+  </el-dialog> -->
212
+</div>
213
+</template>
214
+
215
+<script>
216
+import BreadCrumb from "@/xt_pages/components/bread-crumb";
217
+import {uParseTime } from '@/utils/tools'
218
+import {getInitOrder,updatePurchaseOrder,checkPurchaseOrder,getPurchaseOrderDetail} from "@/api/supply"
219
+export default {
220
+name: "addPurchaseOrder",
221
+components: {
222
+BreadCrumb
223
+},
224
+data() {
225
+return {
226
+    crumbs: [
227
+       { path: false, name: "购货单" },
228
+       { path: "/spply/query", name: "新增购货单" }
229
+    ],
230
+    showTwo:true,
231
+    showOne:false,
232
+    recordInfo: {
233
+      tableList:[],
234
+    },
235
+    keywords: "",
236
+    total: 0,
237
+    multipleSelection: [],
238
+    signAndWeighBoxPatients: "sign-and-weigh-box-patients",
239
+    start_time: "",
240
+    end_time: "",
241
+    page: 1,
242
+    limit: 10,
243
+    goodType: [],
244
+    goodInfo: [],
245
+    org_id:0,
246
+    types:[],
247
+    tyep_name:"",
248
+    form:{
249
+    manufacturer_id:"",
250
+    },
251
+    tabList:[],
252
+    manufactuerList:[],
253
+    currentIndex: 0,
254
+    goodTypeList:[],
255
+    drugTypeList:[],
256
+    supplier_name:"",
257
+    supplyList:[],
258
+    rate_of_concession:"",
259
+    discount_amount:"",
260
+    start_time:new Date(),
261
+    end_time:new Date(),
262
+    tableRules: {
263
+     name: [{ required: true, message: '商品不能为空', trigger: 'blur' }],
264
+     supply_count: [{ required: true, message: '数量不能为空', trigger: 'blur' }],
265
+   },
266
+   warehousing_id:0,
267
+   number:"",
268
+   loading:false,
269
+   drugList:[],
270
+   goodList:[],
271
+   id:0,
272
+   disabled:false,
273
+   is_check:0,
274
+   dialogVisible:false,
275
+  };
276
+},
277
+methods:{
278
+
279
+getInitOrder(){
280
+    getInitOrder().then(response=>{
281
+    if(response.data.state == 1){
282
+        var drugList = response.data.data.drugList
283
+        this.manufactuerList = response.data.data.manufactuerList
284
+        this.goodTypeList = response.data.data.goodTypeList
285
+        this.drugTypeList = response.data.data.drugTypeList
286
+        this.supplyList = response.data.data.supplyList
287
+       for(let i=0;i<drugList.length;i++){
288
+          for(let z=0;z<drugList[i].drug_warehouse_info.length;z++){
289
+            drugList[i].drug_warehouse_info[z].stock_max_number = drugList[i].drug_warehouse_info[z].stock_max_number * drugList[i].min_number
290
+          }
291
+        for(let j=0;j<this.manufactuerList.length;j++){
292
+            if(drugList[i].manufacturer == this.manufactuerList[j].id){
293
+                drugList[i].manufacturer = this.manufactuerList[j].manufacturer_name
294
+            }
295
+        }
296
+        for(let y=0;y<this.drugTypeList.length;y++){
297
+            if(drugList[i].drug_type == this.drugTypeList[y].value){
298
+            drugList[i].drug_type = this.drugTypeList[y].name
299
+            }
300
+        }
301
+        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
302
+        drugList[i].supply_type = drugList[i].drug_type
303
+        drugList[i].supply_specification_name = drugList[i].dose +drugList[i].dose_unit+"*"+drugList[i].min_number+ drugList[i].min_unit+"/"+drugList[i].max_unit
304
+        drugList[i].supply_total = this.getWarehoseInfo(drugList[i].drug_warehouse_info,drugList[i].max_unit,drugList[i].min_unit,drugList[i].min_number)
305
+        drugList[i].supply_count = ""
306
+        drugList[i].supply_total_price = ""
307
+        drugList[i].supply_manufacturer=  drugList[i].manufacturer
308
+        drugList[i].supply_license_number= drugList[i].number
309
+        drugList[i].supply_remake = ""
310
+        drugList[i].type = 1
311
+        drugList[i].supply_price = drugList[i].last_price
312
+        drugList[i].name = drugList[i].drug_name
313
+        drugList[i].unitList = [{id:1,name:""},{id:2,name:""}]
314
+        drugList[i].supply_unit = drugList[i].max_unit 
315
+        for(let j=0;j<drugList[i].unitList.length;j++){
316
+           drugList[i].unitList[0].name = drugList[i].max_unit
317
+           drugList[i].unitList[1].name = drugList[i].min_unit
318
+        }
319
+        this.tabList.push(drugList[i])
320
+        }
321
+        this.drugList = drugList
322
+        var goodList =  response.data.data.goodList
323
+        for(let i=0;i<goodList.length;i++){
324
+        for(let j=0;j<this.manufactuerList.length;j++){
325
+            if(goodList[i].manufacturer == this.manufactuerList[j].id){
326
+                goodList[i].manufacturer = this.manufactuerList[j].manufacturer_name
327
+            }
328
+        }
329
+        for(let y=0;y<this.goodTypeList.length;y++){
330
+            if(goodList[i].good_type_id == this.goodTypeList[y].id){
331
+                goodList[i].good_type_id = this.goodTypeList[y].type_name
332
+            }
333
+        }
334
+        goodList[i].supply_name = goodList[i].good_name + " " + goodList[i].specification_name + " " +goodList[i].manufacturer
335
+        goodList[i].supply_type = goodList[i].good_type_id
336
+        goodList[i].supply_specification_name =goodList[i].specification_name
337
+        goodList[i].supply_price = goodList[i].buy_price
338
+        goodList[i].supply_total = this.getTotalStockCount(goodList[i].good_warehouse_info)
339
+        goodList[i].supply_count = ""
340
+        goodList[i].supply_total_price = ""
341
+        goodList[i].supply_manufacturer = goodList[i].manufacturer
342
+        goodList[i].supply_license_number = ""
343
+        goodList[i].supply_remake = ""
344
+        goodList[i].type = 2
345
+        goodList[i].name = goodList[i].good_name
346
+        goodList[i].unitList =  [{id:1,name:""},{id:2,name:""}]
347
+        goodList[i].supply_unit = goodList[i].packing_unit
348
+        for(let j=0;j<goodList[i].unitList.length;j++){
349
+           goodList[i].unitList[0].name = goodList[i].packing_unit 
350
+        }
351
+        this.tabList.push(goodList[i])
352
+        }
353
+        this.goodList = goodList
354
+    } 
355
+    })
356
+},
357
+changeGoodName(val){
358
+  this.currentIndex = val
359
+},
360
+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}
362
+   for(let i=0;i<this.recordInfo.tableList.length;i++){
363
+    if(this.currentIndex == i){
364
+        this.recordInfo.tableList[i].project_id = val.id
365
+        this.recordInfo.tableList[i].type = val.type
366
+        this.recordInfo.tableList[i].name = val.name
367
+        this.recordInfo.tableList[i].supply_name = val.supply_name
368
+        this.recordInfo.tableList[i].supply_type = val.supply_type
369
+        this.recordInfo.tableList[i].supply_specification_name = val.supply_specification_name
370
+        this.recordInfo.tableList[i].supply_total = val.supply_total
371
+        if(val.supply_count == NaN){
372
+           this.recordInfo.tableList[i].supply_count = ""
373
+        }else{
374
+          this.recordInfo.tableList[i].supply_count = val.supply_count?val.supply_count:""
375
+        }
376
+
377
+        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:""
379
+        this.recordInfo.tableList[i].supply_manufacturer = val.supply_manufacturer
380
+        this.recordInfo.tableList[i].supply_license_number = val.supply_license_number
381
+        this.recordInfo.tableList[i].supply_remake = val.supply_remake
382
+        this.recordInfo.tableList[i].is_total = val.is_total
383
+        this.recordInfo.tableList[i].supply_unit = val.supply_unit
384
+        this.recordInfo.tableList[i].unitList = val.unitList
385
+     }
386
+    }
387
+   
388
+
389
+},
390
+handleEdit(){
391
+    const tempObj = {}
392
+    tempObj["id"] = 0
393
+    tempObj["name"] = ""
394
+    tempObj['supply_name'] = ""
395
+    tempObj['supply_type'] = ""
396
+    tempObj['supply_specification_name'] = ''
397
+    tempObj['supply_total'] = ""
398
+    tempObj['supply_count'] = ""
399
+    tempObj['supply_price'] = ""
400
+    tempObj['supply_total_price'] = ""
401
+    tempObj['supply_manufacturer'] = ''
402
+    tempObj['supply_license_number'] = ''
403
+    tempObj['supply_remake'] = ''
404
+    tempObj['type'] = 0
405
+    tempObj['is_total'] = 1
406
+    tempObj["project_id"] = 0
407
+    tempObj["supply_unit"] = ""
408
+    this.recordInfo.tableList.push(tempObj)
409
+},
410
+handleDelete: function(index, row) {
411
+  if (this.recordInfo.tableList.length <= 1) {
412
+        this.$message.error('只有一条记录的时候无法删除')
413
+        return
414
+   } else {
415
+        this.recordInfo.tableList.splice(index, 1)
416
+   }
417
+},
418
+
419
+changeTypeName(){
420
+
421
+},
422
+startTimeChange(){
423
+
424
+},
425
+endTimeChange(){
426
+
427
+},
428
+search(){
429
+
430
+},
431
+
432
+getWarehoseInfo(arr,max_unit,min_unit,min_number){
433
+    var total = 0
434
+    var max_str=  ""
435
+    var min_str = ""
436
+    if (arr.length > 0) {
437
+      for(let i=0;i<arr.length;i++){
438
+        total += parseInt(arr[i].stock_max_number)
439
+      }
440
+    }
441
+    if (total < min_number){
442
+        min_str = total + min_unit
443
+    }
444
+    if (total == 0) {
445
+        min_str = ""
446
+        max_str = ""
447
+    }
448
+   if (total >=min_number) {
449
+    if(parseInt(total/min_number)!=0){
450
+        max_str = parseInt(total/min_number) + max_unit
451
+    }
452
+    if(total%min_number!=0){
453
+       min_str = total%min_number + min_unit
454
+    }
455
+  }
456
+ return max_str + min_str
457
+ },
458
+getTotalStockCount(arr){
459
+  var total_count = 0
460
+  for(let i=0;i<arr.length;i++){
461
+    total_count += arr[i].stock_count
462
+  }
463
+  return total_count
464
+},
465
+calculate: function(val) {
466
+    if (isNaN(val)) {
467
+        return "";
468
+    }
469
+    if (val == 0) {
470
+        return "";
471
+    }
472
+    return Math.round(parseFloat(val) * 100) / 100;
473
+  },
474
+getTimes(time) {
475
+    if (time === '') {
476
+    return ''
477
+    }
478
+    return uParseTime(time, '{y}-{m}-{d}')
479
+},
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
+ },
518
+ getAllPrice(){
519
+   var total_price = 0
520
+   for(let i=0;i<this.recordInfo.tableList.length;i++){
521
+      total_price += (this.recordInfo.tableList[i].supply_price * this.recordInfo.tableList[i].supply_count)
522
+   }  
523
+   return total_price.toFixed(2)
524
+ },
525
+ checkPurchaseOrder(id,index){
526
+   this.$confirm('是否审核?', {
527
+    confirmButtonText: '确 定',
528
+    cancelButtonText: '取 消',
529
+    type: 'warning'
530
+    }).then(() => { 
531
+    checkPurchaseOrder(this.id).then(response => {
532
+        if (response.data.state == 1) {
533
+          var info = response.data.data.info
534
+          this.disabled = true
535
+          this.$message.success("审核成功!")
536
+          this.getPurchaseOrderDetail()
537
+        } 
538
+     })
539
+    })
540
+    .catch(() => {
541
+    }) 
542
+  },
543
+  getPurchaseOrderDetail(){
544
+      console.log("处方233223232323322323232323")
545
+      var id = this.$route.query.id
546
+    getPurchaseOrderDetail(id).then(response=>{
547
+      if(response.data.state == 1){
548
+        var info = response.data.data.info
549
+        this.is_check = info.is_check
550
+        this.number = info.number
551
+        this.id = info.id
552
+        this.supplier_name = info.supplier_id
553
+        this.rate_of_concession = info.rate_of_concession
554
+        this.discount_amount = info.discount_amount
555
+        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
561
+        }
562
+        console.log("drugli323322332",this.drugList)
563
+        var drugList = response.data.data.baseList
564
+        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
572
+           if(orderInfo[i].is_source == 1){
573
+            for(let j=0;j<drugList.length;j++){
574
+                if(orderInfo[i].project_id == drugList[j].id){
575
+                  orderInfo[i].unitList = [{id:1,name:""},{id:2,name:""}]
576
+                  orderInfo[i].unitList[0].name = drugList[j].max_unit
577
+                  orderInfo[i].unitList[1].name = drugList[j].min_unit
578
+                }
579
+             }  
580
+            } 
581
+          if(orderInfo[i].is_source == 2){
582
+            for(let j=0;j<goodList.length;j++){
583
+                if(orderInfo[i].project_id == goodList[j].id){
584
+                    orderInfo[i].unitList = [{id:1,name:""}]
585
+                    orderInfo[i].unitList[0].name = goodList[j].packing_unit
586
+                }
587
+            }  
588
+          } 
589
+        }
590
+        console.log("orderINFO23323232",orderInfo)
591
+        this.recordInfo.tableList = orderInfo
592
+      }
593
+    })  
594
+  },
595
+  toPrint(){
596
+     var id = this.$route.query.id
597
+     this.$router.push({path:"/purchase/order/print?&id="+id})  
598
+  },
599
+  toAdd(){
600
+    var id = this.$route.query.id
601
+    if(this.is_check == 2){
602
+      this.$message.error("该采购订单未审核,不能生成采购数据!")
603
+      return false
604
+    }
605
+    this.$router.push({path:"/purchase/order/add?id="+id})
606
+  }
607
+},
608
+created(){
609
+    const tempObj = {}
610
+    tempObj["id"] = 0
611
+    tempObj["name"] = ""
612
+    tempObj['supply_name'] = ""
613
+    tempObj['supply_type'] = ""
614
+    tempObj['supply_specification_name'] = ''
615
+    tempObj['supply_total'] = ""
616
+    tempObj['supply_count'] = ""
617
+    tempObj['supply_price'] = ""
618
+    tempObj['supply_total_price'] = ""
619
+    tempObj['supply_manufacturer'] = ''
620
+    tempObj['supply_license_number'] = ''
621
+    tempObj['supply_remake'] = ''
622
+    tempObj['type'] = 0
623
+    tempObj['is_total'] = 1
624
+    tempObj["project_id"] = 0
625
+    tempObj["supply_unit"] = ""
626
+    this.recordInfo.tableList.push(tempObj)
627
+    this.getInitOrder()
628
+    this.getPurchaseOrderDetail()
629
+}
630
+};
631
+</script>
632
+
633
+<style rel="stylesheet/css" lang="scss" scoped>
634
+.information {
635
+border: 1px #dcdfe6 solid;
636
+padding: 30px 20px 30px 20px;
637
+
638
+.border {
639
+border-bottom: 1px #dcdfe6 solid;
640
+margin: 0px 0 20px 0;
641
+}
642
+}
643
+
644
+.title {
645
+background: #409eff;
646
+height: 44px;
647
+line-height: 44px;
648
+padding: 0 0 0 10px;
649
+color: #fff;
650
+margin: 0 0 10px 0;
651
+}
652
+
653
+.edit_separater {
654
+border-top: 1px solid rgb(233, 233, 233);
655
+margin-top: 15px;
656
+margin-bottom: 15px;
657
+}
658
+</style>
659
+
660
+<style>
661
+.sign-and-weigh-box .sign-and-weigh-box-patients .cell {
662
+font-size: 12px;
663
+}
664
+
665
+.sign-and-weigh-box .sign-and-weigh-box-patients .current-row > td {
666
+background: #6fb5fa;
667
+}
668
+
669
+.count {
670
+color: #bd2c00;
671
+}
672
+.el-table td,
673
+.el-table th.is-leaf,
674
+.el-table--border,
675
+.el-table--group {
676
+border-color: #d0d3da;
677
+}
678
+.el-table--border::after,
679
+.el-table--group::after,
680
+.el-table::before {
681
+background-color: #d0d3da;
682
+}
683
+.el-table__fixed-right{
684
+  width:150px;
685
+  bottom: 20px;
686
+  height: 100%;
687
+}
688
+</style>

+ 69 - 22
src/xt_pages/supply/components/addPurchaseOrder.vue View File

@@ -97,7 +97,24 @@
97 97
         <template slot-scope="scope">
98 98
             <el-input v-model="scope.row.supply_specification_name" style="width:150px" :disabled="true"></el-input>
99 99
         </template>
100
-        </el-table-column>
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>
101 118
     <el-table-column label="可用库存" align="center" width="130px">
102 119
         <template slot-scope="scope">
103 120
             <el-input v-model="scope.row.supply_total" style="width:100px" :disabled="true"></el-input>
@@ -114,21 +131,7 @@
114 131
         </template>
115 132
     </el-table-column>
116 133
 
117
-    <el-table-column label="单位" align="center" width="120px">
118
-        <template slot="header" slot-scope="scope">
119
-            <span>单位<span style="color: red">*</span></span>
120
-        </template>
121
-        <template slot-scope="scope">
122
-          <el-select v-model="scope.row.supply_unit" style="width:160px;" filterable placeholder="请选择"  :disabled="disabled">
123
-                <el-option
124
-                    v-for="(item,index) in unitList"
125
-                    :key="index"
126
-                    :label="item.name"
127
-                    :value="item.name">
128
-                </el-option>
129
-            </el-select>
130
-        </template>
131
-    </el-table-column>
134
+   
132 135
 
133 136
     <el-table-column label="购货单价" align="center" width="120px">
134 137
         <template slot-scope="scope">
@@ -201,6 +204,7 @@
201 204
 import BreadCrumb from "@/xt_pages/components/bread-crumb";
202 205
 import {uParseTime } from '@/utils/tools'
203 206
 import {getInitOrder,savePurchaseOrder,updatePurchaseOrder,checkPurchaseOrder} from "@/api/supply"
207
+import {getDataConfig } from '@/utils/data'
204 208
 export default {
205 209
 name: "addPurchaseOrder",
206 210
 created() {
@@ -262,6 +266,7 @@ return {
262 266
     tableRules: {
263 267
      name: [{ required: true, message: '商品不能为空', trigger: 'blur' }],
264 268
      supply_count: [{ required: true, message: '数量不能为空', trigger: 'blur' }],
269
+     supply_unit:[{required:true,message: '单位不能为空', trigger: 'blur'}]
265 270
    },
266 271
    warehousing_id:0,
267 272
    number:"",
@@ -274,6 +279,9 @@ return {
274 279
      {id:1,name:""},
275 280
      {id:2,name:""}
276 281
    ],
282
+   goodList:[
283
+     {id:1,name:""},
284
+   ],
277 285
   };
278 286
 },
279 287
 methods:{
@@ -312,14 +320,21 @@ getInitOrder(){
312 320
         drugList[i].supply_license_number= drugList[i].number
313 321
         drugList[i].supply_remake = ""
314 322
         drugList[i].type = 1
315
-        drugList[i].supply_price = ""
323
+        drugList[i].supply_price = drugList[i].last_price
316 324
         drugList[i].name = drugList[i].drug_name
317
-
325
+        drugList[i].supply_unit = drugList[i].max_unit
326
+        drugList[i].unitList = [{id:1,name:""},{id:2,name:""}]
327
+        for(let j=0;j<drugList[i].unitList.length;j++){
328
+           drugList[i].unitList[0].name = drugList[i].max_unit
329
+           drugList[i].unitList[1].name = drugList[i].min_unit
330
+        }
318 331
         this.tabList.push(drugList[i])
319 332
         }
320 333
         this.drugList = drugList
321 334
         var goodList =  response.data.data.goodList
335
+       
322 336
         for(let i=0;i<goodList.length;i++){
337
+       
323 338
         for(let j=0;j<this.manufactuerList.length;j++){
324 339
             if(goodList[i].manufacturer == this.manufactuerList[j].id){
325 340
                 goodList[i].manufacturer = this.manufactuerList[j].manufacturer_name
@@ -333,7 +348,7 @@ getInitOrder(){
333 348
         goodList[i].supply_name = goodList[i].good_name + " " + goodList[i].specification_name + " " +goodList[i].manufacturer
334 349
         goodList[i].supply_type = goodList[i].good_type_id
335 350
         goodList[i].supply_specification_name =goodList[i].specification_name
336
-        goodList[i].supply_price = ""
351
+        goodList[i].supply_price = goodList[i].buy_price
337 352
         goodList[i].supply_total = this.getTotalStockCount(goodList[i].good_warehouse_info)
338 353
         goodList[i].supply_count = ""
339 354
         goodList[i].supply_total_price = ""
@@ -342,7 +357,11 @@ getInitOrder(){
342 357
         goodList[i].supply_remake = ""
343 358
         goodList[i].type = 2
344 359
         goodList[i].name = goodList[i].good_name
345
-
360
+        goodList[i].supply_unit = goodList[i].packing_unit
361
+        goodList[i].unitList =  [{id:1,name:""},{id:2,name:""}]
362
+        for(let j=0;j<goodList[i].unitList.length;j++){
363
+           goodList[i].unitList[0].name = goodList[i].packing_unit 
364
+        }
346 365
         this.tabList.push(goodList[i])
347 366
         }
348 367
         this.goodList = goodList
@@ -363,7 +382,7 @@ changeName(val){
363 382
         this.recordInfo.tableList[i].supply_type = val.supply_type
364 383
         this.recordInfo.tableList[i].supply_specification_name = val.supply_specification_name
365 384
         this.recordInfo.tableList[i].supply_total = val.supply_total
366
-        this.recordInfo.tableList[i].supply_unit = val.max_unit
385
+        
367 386
         if(val.supply_count == NaN){
368 387
            this.recordInfo.tableList[i].supply_count = ""
369 388
         }else{
@@ -377,6 +396,7 @@ changeName(val){
377 396
         this.recordInfo.tableList[i].supply_remake = val.supply_remake
378 397
         this.recordInfo.tableList[i].is_total = val.is_total
379 398
         this.recordInfo.tableList[i].supply_unit = val.supply_unit
399
+        this.recordInfo.tableList[i].unitList = val.unitList
380 400
      }
381 401
     }
382 402
    
@@ -416,6 +436,7 @@ savePurchaseOrder(){
416 436
     this.loading = true
417 437
     if(this.supplier_name == 0 || this.supplier_name == ""){
418 438
        this.$message.error("供应商不能为空!")
439
+       this.loading = false
419 440
        return false
420 441
     }
421 442
     this.$refs["tableForm"].validate((valid)=>{
@@ -450,11 +471,29 @@ savePurchaseOrder(){
450 471
                 this.recordInfo.tableList = []
451 472
                 var orderInfo = response.data.data.orderInfo
452 473
                 for(let i=0;i<orderInfo.length;i++){
474
+                   if(orderInfo[i].is_source == 1){
475
+                    for(let j=0;j<this.drugList.length;j++){
476
+                       if(orderInfo[i].project_id == this.drugList[j].id){
477
+                          orderInfo[i].unitList = [{id:1,name:""},{id:2,name:""}]
478
+                          orderInfo[i].unitList[0].name = this.drugList[j].max_unit
479
+                          orderInfo[i].unitList[1].name = this.drugList[j].min_unit
480
+                       }
481
+                    }  
482
+                   } 
483
+                  if(orderInfo[i].is_source == 2){
484
+                    for(let j=0;j<this.goodList.length;j++){
485
+                       if(orderInfo[i].project_id == this.goodList[j].id){
486
+                          orderInfo[i].unitList = [{id:1,name:""}]
487
+                          orderInfo[i].unitList[0].name = this.goodList[j].packing_unit
488
+                       }
489
+                    }  
490
+                   } 
453 491
                   orderInfo[i].supply_count = orderInfo[i].count
454 492
                   orderInfo[i].supply_price = orderInfo[i].price
455 493
                   orderInfo[i].supply_remake = orderInfo[i].remark
456 494
                   orderInfo[i].type = orderInfo[i].is_source
457 495
                   orderInfo[i].project_id = orderInfo[i].project_id
496
+                  orderInfo[i].supply_unit = orderInfo[i].supply_unit
458 497
                 }
459 498
                 console.log("orderINFO23323232",orderInfo)
460 499
                 this.recordInfo.tableList = orderInfo
@@ -551,6 +590,11 @@ getTimes(time) {
551 590
 },
552 591
  updatePurchaseOrder(){
553 592
    this.loading = true 
593
+    if(this.supplier_name == 0 || this.supplier_name == ""){
594
+        this.$message.error("供应商不能为空!")
595
+        this.loading = false
596
+        return false
597
+    }
554 598
    this.$refs["tableForm"].validate((valid)=>{
555 599
       if(valid){
556 600
         for(let i=0;i<this.recordInfo.tableList.length;i++){
@@ -610,7 +654,10 @@ getTimes(time) {
610 654
   toPrint(){
611 655
      var id = this.id
612 656
      this.$router.push({path:"/purchase/order/print?&id="+id})  
613
-  }
657
+  },
658
+  getDataConfig(module, filed_name){
659
+    return getDataConfig(module, filed_name)
660
+  },
614 661
 },
615 662
 created(){
616 663
     const tempObj = {}

+ 111 - 24
src/xt_pages/supply/components/editPurchaseOrder.vue View File

@@ -48,7 +48,7 @@
48 48
 
49 49
     </div>
50 50
     <div>
51
-        <el-button size="small" type="primary" @click="checkPurchaseOrder">生成购货单</el-button>
51
+        <el-button size="small" type="primary" @click="toAdd">生成购货单</el-button>
52 52
         <el-button size="small" type="primary" @click="updatePurchaseOrder">修改</el-button>
53 53
         <el-button size="small" type="primary" @click="toPrint">打印</el-button>
54 54
         <el-button size="small" type="primary" v-if="is_check == 2" @click="checkPurchaseOrder">审核</el-button>
@@ -99,7 +99,34 @@
99 99
         <template slot-scope="scope">
100 100
             <el-input v-model="scope.row.supply_specification_name" style="width:150px" :disabled="true"></el-input>
101 101
         </template>
102
-        </el-table-column>
102
+    </el-table-column>
103
+     <el-table-column label="单位" align="center" width="120px">
104
+        <template slot="header" slot-scope="scope">
105
+            <span>单位<span style="color: red">*</span></span>
106
+        </template>
107
+        <template slot-scope="scope">
108
+          <el-form-item :prop="'tableList.' + scope.$index + '.supply_unit'" :rules='tableRules.supply_unit'>
109
+            <el-select v-model="scope.row.supply_unit" style="width:100px;" filterable placeholder="请选择"  :disabled="disabled">
110
+                    <el-option
111
+                        v-for="(item,index) in scope.row.unitList"
112
+                        :key="index"
113
+                        :label="item.name"
114
+                        :value="item.name">
115
+                    </el-option>
116
+             </el-select>
117
+          </el-form-item>  
118
+        </template>
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>
103 130
     <el-table-column label="可用库存" align="center" width="130px">
104 131
         <template slot-scope="scope">
105 132
             <el-input v-model="scope.row.supply_total" style="width:100px" :disabled="true"></el-input>
@@ -128,7 +155,12 @@
128 155
         </template>
129 156
     </el-table-column>
130 157
 
131
-    <el-table-column label="生产厂商" align="center" width="200px">
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
+    <el-table-column label="生产厂家" align="center" width="200px">
132 164
         <template slot-scope="scope">
133 165
         <el-input v-model="scope.row.supply_manufacturer" style="width:160px" :disabled="true"></el-input>
134 166
         </template>
@@ -140,7 +172,11 @@
140 172
         <el-input v-model="scope.row.supply_license_number" style="width:160px" :disabled="disabled"></el-input>
141 173
         </template>
142 174
     </el-table-column>
143
-
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>
144 180
     <el-table-column label="备注" align="center" width="200px">
145 181
         <template slot-scope="scope">
146 182
         <el-input v-model="scope.row.supply_remake" style="width:160px" :disabled="disabled"></el-input>
@@ -178,8 +214,24 @@
178 214
 
179 215
         <span>优惠金额:<el-input style="width:100px" v-model="discount_amount"></el-input></span>
180 216
 
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>
220
+
181 221
     </div>
182 222
 </div>
223
+
224
+  <!-- <el-dialog
225
+  title="提示"
226
+  :visible.sync="dialogVisible"
227
+  width="30%"
228
+  :before-close="handleClose">
229
+  <span>这是一段信息</span>
230
+  <span slot="footer" class="dialog-footer">
231
+    <el-button @click="dialogVisible = false">取 消</el-button>
232
+    <el-button type="primary" @click="dialogVisible = false">确 定</el-button>
233
+  </span>
234
+  </el-dialog> -->
183 235
 </div>
184 236
 </template>
185 237
 
@@ -189,21 +241,6 @@ import {uParseTime } from '@/utils/tools'
189 241
 import {getInitOrder,updatePurchaseOrder,checkPurchaseOrder,getPurchaseOrderDetail} from "@/api/supply"
190 242
 export default {
191 243
 name: "addPurchaseOrder",
192
-created() {
193
-this.org_id =  this.$store.getters.xt_user.org_id
194
-
195
-var start_time =  window.sessionStorage.getItem('start_time')
196
-var end_time =  window.sessionStorage.getItem('end_time')
197
-
198
-if(start_time !=null){
199
-    this.start_time = start_time
200
-}
201
-if(end_time!=null){
202
-    this.end_time = end_time
203
-}
204
-window.sessionStorage.removeItem('start_time')
205
-window.sessionStorage.removeItem('end_time')
206
-},
207 244
 components: {
208 245
 BreadCrumb
209 246
 },
@@ -257,6 +294,7 @@ return {
257 294
    id:0,
258 295
    disabled:false,
259 296
    is_check:0,
297
+   dialogVisible:false,
260 298
   };
261 299
 },
262 300
 methods:{
@@ -293,9 +331,14 @@ getInitOrder(){
293 331
         drugList[i].supply_license_number= drugList[i].number
294 332
         drugList[i].supply_remake = ""
295 333
         drugList[i].type = 1
296
-        drugList[i].supply_price = ""
334
+        drugList[i].supply_price = drugList[i].last_price
297 335
         drugList[i].name = drugList[i].drug_name
298
-
336
+        drugList[i].unitList = [{id:1,name:""},{id:2,name:""}]
337
+        drugList[i].supply_unit = drugList[i].max_unit 
338
+        for(let j=0;j<drugList[i].unitList.length;j++){
339
+           drugList[i].unitList[0].name = drugList[i].max_unit
340
+           drugList[i].unitList[1].name = drugList[i].min_unit
341
+        }
299 342
         this.tabList.push(drugList[i])
300 343
         }
301 344
         this.drugList = drugList
@@ -314,7 +357,7 @@ getInitOrder(){
314 357
         goodList[i].supply_name = goodList[i].good_name + " " + goodList[i].specification_name + " " +goodList[i].manufacturer
315 358
         goodList[i].supply_type = goodList[i].good_type_id
316 359
         goodList[i].supply_specification_name =goodList[i].specification_name
317
-        goodList[i].supply_price = ""
360
+        goodList[i].supply_price = goodList[i].buy_price
318 361
         goodList[i].supply_total = this.getTotalStockCount(goodList[i].good_warehouse_info)
319 362
         goodList[i].supply_count = ""
320 363
         goodList[i].supply_total_price = ""
@@ -323,7 +366,11 @@ getInitOrder(){
323 366
         goodList[i].supply_remake = ""
324 367
         goodList[i].type = 2
325 368
         goodList[i].name = goodList[i].good_name
326
-
369
+        goodList[i].unitList =  [{id:1,name:""},{id:2,name:""}]
370
+        goodList[i].supply_unit = goodList[i].packing_unit
371
+        for(let j=0;j<goodList[i].unitList.length;j++){
372
+           goodList[i].unitList[0].name = goodList[i].packing_unit 
373
+        }
327 374
         this.tabList.push(goodList[i])
328 375
         }
329 376
         this.goodList = goodList
@@ -356,6 +403,8 @@ changeName(val){
356 403
         this.recordInfo.tableList[i].supply_license_number = val.supply_license_number
357 404
         this.recordInfo.tableList[i].supply_remake = val.supply_remake
358 405
         this.recordInfo.tableList[i].is_total = val.is_total
406
+        this.recordInfo.tableList[i].supply_unit = val.supply_unit
407
+        this.recordInfo.tableList[i].unitList = val.unitList
359 408
      }
360 409
     }
361 410
    
@@ -378,6 +427,7 @@ handleEdit(){
378 427
     tempObj['type'] = 0
379 428
     tempObj['is_total'] = 1
380 429
     tempObj["project_id"] = 0
430
+    tempObj["supply_unit"] = ""
381 431
     this.recordInfo.tableList.push(tempObj)
382 432
 },
383 433
 handleDelete: function(index, row) {
@@ -452,6 +502,11 @@ getTimes(time) {
452 502
 },
453 503
  updatePurchaseOrder(){
454 504
    this.loading = true 
505
+    if(this.supplier_name == 0 || this.supplier_name == ""){
506
+        this.$message.error("供应商不能为空!")
507
+        this.loading = false
508
+        return false
509
+    }
455 510
    this.$refs["tableForm"].validate((valid)=>{
456 511
       if(valid){
457 512
         for(let i=0;i<this.recordInfo.tableList.length;i++){
@@ -471,7 +526,8 @@ getTimes(time) {
471 526
         const params = {
472 527
         'stockIn': this.recordInfo.tableList
473 528
         }
474
-           
529
+        console.log("param23232332",params)  
530
+       
475 531
         updatePurchaseOrder(params,this.supplier_name,start,end,this.rate_of_concession,this.discount_amount,this.id,this.number).then(response=>{
476 532
            if(response.data.state == 1){
477 533
             this.loading = false
@@ -500,6 +556,7 @@ getTimes(time) {
500 556
           var info = response.data.data.info
501 557
           this.disabled = true
502 558
           this.$message.success("审核成功!")
559
+          this.getPurchaseOrderDetail()
503 560
         } 
504 561
      })
505 562
     })
@@ -524,12 +581,33 @@ getTimes(time) {
524 581
         if(info.is_check == 1){
525 582
            this.disabled = true
526 583
         }
584
+        console.log("drugli323322332",this.drugList)
585
+        var drugList = response.data.data.baseList
586
+        var goodList = response.data.data.goodList
527 587
         for(let i=0;i<orderInfo.length;i++){
528 588
             orderInfo[i].supply_count = orderInfo[i].count
529 589
             orderInfo[i].supply_price = orderInfo[i].price
530 590
             orderInfo[i].supply_remake = orderInfo[i].remark
531 591
             orderInfo[i].type = orderInfo[i].is_source
532 592
             orderInfo[i].project_id = orderInfo[i].project_id
593
+            orderInfo[i].supply_unit = orderInfo[i].supply_unit
594
+           if(orderInfo[i].is_source == 1){
595
+            for(let j=0;j<drugList.length;j++){
596
+                if(orderInfo[i].project_id == drugList[j].id){
597
+                  orderInfo[i].unitList = [{id:1,name:""},{id:2,name:""}]
598
+                  orderInfo[i].unitList[0].name = drugList[j].max_unit
599
+                  orderInfo[i].unitList[1].name = drugList[j].min_unit
600
+                }
601
+             }  
602
+            } 
603
+          if(orderInfo[i].is_source == 2){
604
+            for(let j=0;j<goodList.length;j++){
605
+                if(orderInfo[i].project_id == goodList[j].id){
606
+                    orderInfo[i].unitList = [{id:1,name:""}]
607
+                    orderInfo[i].unitList[0].name = goodList[j].packing_unit
608
+                }
609
+            }  
610
+          } 
533 611
         }
534 612
         console.log("orderINFO23323232",orderInfo)
535 613
         this.recordInfo.tableList = orderInfo
@@ -539,6 +617,14 @@ getTimes(time) {
539 617
   toPrint(){
540 618
      var id = this.$route.query.id
541 619
      this.$router.push({path:"/purchase/order/print?&id="+id})  
620
+  },
621
+  toAdd(){
622
+    var id = this.$route.query.id
623
+    if(this.is_check == 2){
624
+      this.$message.error("该采购订单未审核,不能生成采购数据!")
625
+      return false
626
+    }
627
+    this.$router.push({path:"/good/order/add?id="+id})
542 628
   }
543 629
 },
544 630
 created(){
@@ -558,6 +644,7 @@ created(){
558 644
     tempObj['type'] = 0
559 645
     tempObj['is_total'] = 1
560 646
     tempObj["project_id"] = 0
647
+    tempObj["supply_unit"] = ""
561 648
     this.recordInfo.tableList.push(tempObj)
562 649
     this.getInitOrder()
563 650
     this.getPurchaseOrderDetail()

+ 5 - 5
src/xt_pages/supply/components/purchaseOrderPrint.vue View File

@@ -48,13 +48,13 @@
48 48
                             <tbody>
49 49
                                 <tr v-for='(item,index) in tableList' :key="index">
50 50
                                     <td style="line-height:18px;"><span>{{index+ 1}}</span></td>
51
-                                    <td style="line-height:18px;"><span>{{item.supply_name}}</span></td>
52
-                                    <td style="line-height:18px;"><span></span></td>
51
+                                    <td style="line-height:18px;"><span>{{item.name}}</span></td>
52
+                                    <td style="line-height:18px;"><span>{{item.supply_unit}}</span></td>
53 53
                                     <td style="line-height:18px;"><span>{{item.count}}</span></td>
54 54
                                     <td style="line-height:18px;"><span>{{item.price}}</span></td>
55
-                                    <td style="line-height:18px;"><span></span></td>
56
-                                    <td style="line-height:18px;"><span></span></td>
57
-                                    <td style="line-height:18px;"><span></span></td>
55
+                                    <td style="line-height:18px;"><span>{{rate_of_concession}}</span></td>
56
+                                    <td style="line-height:18px;"><span>{{discount_amount}}</span></td>
57
+                                    <td style="line-height:18px;"><span>{{(item.count * item.price).toFixed(2)}}</span></td>
58 58
                                     <td style="line-height:18px;"><span></span></td>
59 59
                                 </tr>
60 60
                                 <tr>

+ 15 - 12
src/xt_pages/supply/goodOrderQuery.vue View File

@@ -75,12 +75,12 @@
75 75
         :class="signAndWeighBoxPatients"
76 76
         border
77 77
       >
78
-        <el-table-column label="单日期" align="center">
78
+        <el-table-column label="单日期" align="center">
79 79
           <template slot-scope="scope">
80 80
             <span>{{getTimes(scope.row.document_date)}}</span>
81 81
          </template>
82 82
         </el-table-column>
83
-        <el-table-column label="单编号" align="center">
83
+        <el-table-column label="单编号" align="center">
84 84
           <template slot-scope="scope">
85 85
             <span>{{scope.row.number}}</span>
86 86
           </template>
@@ -90,17 +90,26 @@
90 90
               <span>{{getName(scope.row.supplier_id)}}</span>
91 91
             </template>
92 92
          </el-table-column>
93
-        <el-table-column label="关联购货订单" align="center">
93
+        <el-table-column label="关联购货订单" align="center" width="200">
94 94
           <template slot-scope="scope">
95 95
             
96 96
           </template>
97 97
         </el-table-column>
98
-        <el-table-column label="购金额" align="center">
98
+        <el-table-column label="购金额" align="center">
99 99
           <template slot-scope="scope">
100 100
              <span v-if="getAllBuyPrice(scope.row.orderInfo)>0">{{getAllBuyPrice(scope.row.orderInfo)}}</span> 
101 101
           </template>
102 102
         </el-table-column>
103
-
103
+        <el-table-column label="优惠后金额" align="center">
104
+         <template slot-scope="scope">
105
+           {{getAllCount(scope.row.orderInfo)}}
106
+         </template>
107
+       </el-table-column>
108
+        <el-table-column label="已付款" align="center">
109
+         <template slot-scope="scope">
110
+           {{getAllCount(scope.row.orderInfo)}}
111
+         </template>
112
+       </el-table-column>
104 113
        <el-table-column label="数量" align="center">
105 114
          <template slot-scope="scope">
106 115
            {{getAllCount(scope.row.orderInfo)}}
@@ -114,13 +123,7 @@
114 123
          </template>
115 124
        </el-table-column>
116 125
       
117
-        <el-table-column label="交货日期" align="center">
118
-         <template slot-scope="scope">
119
-           {{getTimes(scope.row.delivery_date)}}
120
-         </template>
121
-       </el-table-column>
122
-        
123
-    
126
+          
124 127
       <el-table-column label="制单人" align="center">
125 128
          <template slot-scope="scope">
126 129
           {{getDocName(scope.row.creater)}}