Browse Source

11月14日 库存扣减更新

XMLWAN 3 years ago
parent
commit
235f74a297

+ 2 - 2
config/index.js View File

@@ -29,8 +29,8 @@ module.exports = {
29 29
 
30 30
     // host: 'xt.test.sgjyun.com',
31 31
     //  host: 'xt.kuyicloud.com',
32
-  //  host: 'xt.test.sgjyun.com',
33
-    host: 'localhost',
32
+   host: 'xt.test.sgjyun.com',
33
+   // host: 'localhost',
34 34
     port: 9528, // can be overwritten by process.env.PORT, if port is in use, a free one will be determined
35 35
     autoOpenBrowser: true,
36 36
     errorOverlay: true,

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

@@ -143,3 +143,35 @@ export function ModefySupplyWarehousing(params) {
143 143
     params: params
144 144
   })
145 145
 }
146
+
147
+export function saveGoodReturnOrder(data, warehouse_out_id, start_time, rate_of_concession, discount_amount, arrearage, payment, supplier_id) {
148
+  return request({
149
+    url: '/api/supply/savegoodreturnOrder?warehouse_out_id=' + warehouse_out_id + '&start_time=' + start_time + '&rate_of_concession=' + rate_of_concession + '&discount_amount=' + discount_amount + '&arrearage=' + arrearage + '&payment=' + payment + '&supplier_id=' + supplier_id,
150
+    method: 'post',
151
+    data: data
152
+  })
153
+}
154
+
155
+export function getAllGoodReturnOrderList(params) {
156
+  return request({
157
+    url: '/api/supply/getallgoodreturnorderlist',
158
+    method: 'get',
159
+    params: params
160
+  })
161
+}
162
+
163
+export function getGoodReturnDetail(id, params) {
164
+  return request({
165
+    url: '/api/supply/getgoodreturndetail?id=' + id,
166
+    method: 'get',
167
+    params: params
168
+  })
169
+}
170
+
171
+export function updateGoodReturn(data, warehouse_out_id, start_time, rate_of_concession, discount_amount, arrearage, payment, supplier_id, return_number) {
172
+  return request({
173
+    url: '/api/supply/updategoodreturn?warehouse_out_id=' + warehouse_out_id + '&start=' + start_time + '&rate_of_concession=' + rate_of_concession + '&discount_amount=' + discount_amount + '&arrerage=' + arrearage + '&payment=' + payment + '&supplier_id=' + supplier_id + '&return_number=' + return_number,
174
+    method: 'post',
175
+    data: data
176
+  })
177
+}

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

@@ -100,6 +100,15 @@ export default {
100 100
       hidden: true,
101 101
       is_menu: false,
102 102
       isChild: true
103
+    },
104
+    {
105
+      path: '/good/return/edit',
106
+      component: () => import('@/xt_pages/supply/components/editGoodReturn'),
107
+      name: 'editGoodReturn',
108
+      meta: { title: 'editGoodReturn', noCache: true },
109
+      hidden: true,
110
+      is_menu: false,
111
+      isChild: true
103 112
     }
104 113
 
105 114
   ]

+ 2 - 2
src/views/layout/Layout.vue View File

@@ -16,10 +16,10 @@
16 16
           <i class="iconfont icon-computer_fill navIcon"></i>
17 17
           <p>透析管理</p>
18 18
         </div>
19
-        <!-- <div v-if="caigouShow" :class="index == 5 ? 'navOne navActive' : 'navOne'" @click="clickActive(5,'采购管理')">
19
+        <div v-if="caigouShow" :class="index == 5 ? 'navOne navActive' : 'navOne'" @click="clickActive(5,'采购管理')">
20 20
           <i class="iconfont icon-kccx navIcon"></i>
21 21
           <p>采购管理</p>
22
-        </div> -->
22
+        </div>
23 23
         <div v-if="kucunShow" :class="index == 3 ? 'navOne navActive' : 'navOne'" @click="clickActive(3,'库房管理')">
24 24
           <i class="iconfont icon-kccx navIcon"></i>
25 25
           <p>库房管理</p>

+ 7 - 15
src/xt_pages/supply/components/addGoodOrder.vue View File

@@ -597,7 +597,7 @@ getTimes(time) {
597 597
         this.discount_amount = info.discount_amount
598 598
         this.number = info.number
599 599
         var orderInfo = response.data.data.orderInfo
600
-       
600
+        
601 601
         for(let i=0;i<orderInfo.length;i++){
602 602
           orderInfo[i].supply_batch_number = ""
603 603
           orderInfo[i].supply_product_date = ""
@@ -665,12 +665,7 @@ getTimes(time) {
665 665
         this.recordInfo.tableList[i].supply_price = this.recordInfo.tableList[i].supply_price.toString()
666 666
         this.recordInfo.tableList[i].supply_total_price= this.recordInfo.tableList[i].supply_total_price.toString()
667 667
         this.recordInfo.tableList[i].supply_total = this.recordInfo.tableList[i].supply_total.toString()
668
-        if(this.recordInfo.tableList[i].id > 0){
669
-          this.recordInfo.tableList[i].type = 1
670
-        }
671
-        if(this.recordInfo.tableList[i].id == 0){
672
-          this.recordInfo.tableList[i].type = 2
673
-        }
668
+       
674 669
         for(let j=0;j<this.manufactuerList.length;j++){
675 670
             if(this.recordInfo.tableList[i].supply_manufacturer == this.manufactuerList[j].manufacturer_name){
676 671
               this.recordInfo.tableList[i].manufacturer_id = this.manufactuerList[j].id
@@ -681,14 +676,16 @@ getTimes(time) {
681 676
 
682 677
         }
683 678
     }
684
-    var start = this.getTimes(this.start_time)
679
+    var start = this.start_time
685 680
     this.$refs["tableForm"].validate((valid)=>{
686 681
         if(valid){
687 682
            this.loading = true
688 683
            var warehousing_id = this.$route.query.id
689 684
            var params = {
690 685
              "stockIn":this.recordInfo.tableList,
691
-           } 
686
+           }
687
+        console.log("stockIN2323322332322323",params)  
688
+       
692 689
         addGoodOrder(params,this.supplier_name,start,this.arrearage,this.payment,warehousing_id,this.number,this.rate_of_concession,this.discount_amount).then(response=>{
693 690
           if(response.data.state == 1){
694 691
              this.loading = false
@@ -761,12 +758,7 @@ getTimes(time) {
761 758
         this.recordInfo.tableList[i].supply_price = this.recordInfo.tableList[i].supply_price.toString()
762 759
         this.recordInfo.tableList[i].supply_total_price= this.recordInfo.tableList[i].supply_total_price.toString()
763 760
         this.recordInfo.tableList[i].supply_total = this.recordInfo.tableList[i].supply_total.toString()
764
-        if(this.recordInfo.tableList[i].id > 0){
765
-          this.recordInfo.tableList[i].type = 1
766
-        }
767
-        if(this.recordInfo.tableList[i].id == 0){
768
-          this.recordInfo.tableList[i].type = 2
769
-        }
761
+        
770 762
         for(let j=0;j<this.manufactuerList.length;j++){
771 763
             if(this.recordInfo.tableList[i].supply_manufacturer == this.manufactuerList[j].manufacturer_name){
772 764
               this.recordInfo.tableList[i].manufacturer_id = this.manufactuerList[j].id

+ 201 - 143
src/xt_pages/supply/components/addGoodReturn.vue View File

@@ -59,7 +59,8 @@
59 59
           <span>单据编码:{{ number }}</span>
60 60
         </div>
61 61
         <div>
62
-          <el-button size="small" type="primary" @click="toAdd">保存</el-button>
62
+          <el-button size="small" type="primary" @click="saveGoodReturn" v-show="showOne">保存</el-button>
63
+          <el-button size="small" type="primary" @click="saveGoodReturn" v-show="showTwo">修改</el-button>
63 64
           <el-button size="small" type="primary" @click="updatePurchaseOrder"
64 65
             >审核</el-button
65 66
           >
@@ -73,8 +74,8 @@
73 74
         <el-table
74 75
           :row-style="{ color: '#303133' }"
75 76
           :header-cell-style="{
76
-            backgroundColor: 'rgb(245, 247, 250)',
77
-            color: '#606266',
77
+              backgroundColor: 'rgb(245, 247, 250)',
78
+              color: '#606266'
78 79
           }"
79 80
           :data="recordInfo.tableList"
80 81
           :class="signAndWeighBoxPatients"
@@ -133,23 +134,23 @@
133 134
             </template>
134 135
           </el-table-column>
135 136
 
136
-          <!-- <el-table-column label="单位" align="center" width="120px">
137
-        <template slot="header" slot-scope="scope">
138
-            <span>单位<span style="color: red">*</span></span>
139
-        </template>
140
-        <template slot-scope="scope">
141
-          <el-form-item :prop="'tableList.' + scope.$index + '.supply_unit'" :rules='tableRules.supply_unit'>
142
-            <el-select v-model="scope.row.supply_unit" style="width:100px;" filterable placeholder="请选择"  :disabled="disabled">
143
-                    <el-option
144
-                        v-for="(item,index) in scope.row.unitList"
145
-                        :key="index"
146
-                        :label="item.name"
147
-                        :value="item.name">
148
-                    </el-option>
149
-             </el-select>
150
-          </el-form-item>  
151
-        </template>
152
-    </el-table-column> -->
137
+        <el-table-column label="单位" align="center" width="120px">
138
+            <template slot="header" slot-scope="scope">
139
+                <span>单位<span style="color: red">*</span></span>
140
+            </template>
141
+            <template slot-scope="scope">
142
+              <el-form-item :prop="'tableList.' + scope.$index + '.supply_unit'" :rules='tableRules.supply_unit'>
143
+                <el-select v-model="scope.row.supply_unit" style="width:100px;" filterable placeholder="请选择"  :disabled="disabled">
144
+                        <!-- <el-option
145
+                            v-for="(item,index) in scope.row.unitList"
146
+                            :key="index"
147
+                            :label="item.name"
148
+                            :value="item.name">
149
+                        </el-option> -->
150
+                </el-select>
151
+              </el-form-item>  
152
+            </template>
153
+          </el-table-column>
153 154
           <el-table-column label="可用库存" align="center" width="130px">
154 155
             <template slot-scope="scope">
155 156
               <el-input
@@ -226,9 +227,9 @@
226 227
           <el-table-column label="关联采购订单号" align="center" width="200px">
227 228
             <template slot-scope="scope">
228 229
               <el-input
229
-                v-model="scope.row.supply_license_number"
230
+                v-model="scope.row.order_number"
230 231
                 style="width: 160px"
231
-                :disabled="disabled"
232
+                :disabled="true"
232 233
               ></el-input>
233 234
             </template>
234 235
           </el-table-column>
@@ -236,9 +237,9 @@
236 237
           <el-table-column label="源购货订单号" align="center" width="200px">
237 238
             <template slot-scope="scope">
238 239
               <el-input
239
-                v-model="scope.row.supply_license_number"
240
+                v-model="scope.row.good_number"
240 241
                 style="width: 160px"
241
-                :disabled="disabled"
242
+                :disabled="true"
242 243
               ></el-input>
243 244
             </template>
244 245
           </el-table-column>
@@ -253,52 +254,34 @@
253 254
             </template>
254 255
           </el-table-column>
255 256
 
256
-          <el-table-column
257
-            label="操作"
258
-            align="center"
259
-            width="150px"
260
-            fixed="right"
261
-          >
257
+          <el-table-column label="操作" align="center" width="150px" fixed="right">
262 258
             <template slot-scope="scope">
263
-              <el-tooltip
264
-                class="item"
265
-                effect="dark"
266
-                content="新增"
267
-                placement="top"
268
-              >
269
-                <el-button
270
-                  size="mini"
271
-                  type="primary"
272
-                  icon="el-icon-circle-plus-outline"
273
-                  @click="handleEdit(scope.$index, scope.row)"
274
-                >
275
-                </el-button>
276
-              </el-tooltip>
277
-              <el-tooltip
278
-                class="item"
279
-                effect="dark"
280
-                content="删除"
281
-                placement="top"
282
-              >
283
-                <el-button
284
-                  size="mini"
285
-                  type="danger"
286
-                  icon="el-icon-delete"
287
-                  @click="handleDelete(scope.$index, scope.row)"
288
-                >
289
-                </el-button>
259
+              <el-tooltip class="item" effect="dark" content="新增" placement="top" >
260
+                  <el-button
261
+                      size="mini"
262
+                      type="primary"
263
+                      icon="el-icon-circle-plus-outline"
264
+                      @click="handleEdit(scope.$index, scope.row)">
265
+                  </el-button>
266
+            </el-tooltip>
267
+            <el-tooltip class="item" effect="dark" content="删除" placement="top">
268
+                  <el-button
269
+                      size="mini"
270
+                      type="danger"
271
+                      icon="el-icon-delete"
272
+                      @click="handleDelete(scope.$index, scope.row)">
273
+                  </el-button>
290 274
               </el-tooltip>
291 275
             </template>
292
-          </el-table-column>
276
+         </el-table-column>
293 277
         </el-table>
294 278
       </el-form>
295 279
       <div style="margin-top: 10px">
296
-        <!-- 合计:{{getAllPrice()}} 元 -->
297 280
         <el-input
298 281
           type="textarea"
299 282
           :rows="2"
300
-          placeholder="备注信息"
301
-          v-model="tipsInfo"
283
+          placeholder="备注信息"
284
+          v-model="return_remark"
302 285
         >
303 286
         </el-input>
304 287
       </div>
@@ -321,30 +304,19 @@
321 304
         <span
322 305
           >本次付款:<el-input
323 306
             style="width: 100px"
324
-            v-model="discount_amount"
307
+            v-model="payment"
325 308
           ></el-input
326 309
         ></span>
327 310
 
328 311
         <span
329 312
           >本次欠款:<el-input
330 313
             style="width: 100px"
331
-            v-model="discount_amount"
314
+            v-model="arrearage"
332 315
           ></el-input
333 316
         ></span>
334 317
       </div>
335 318
     </div>
336 319
 
337
-    <!-- <el-dialog
338
-  title="提示"
339
-  :visible.sync="dialogVisible"
340
-  width="30%"
341
-  :before-close="handleClose">
342
-  <span>这是一段信息</span>
343
-  <span slot="footer" class="dialog-footer">
344
-    <el-button @click="dialogVisible = false">取 消</el-button>
345
-    <el-button type="primary" @click="dialogVisible = false">确 定</el-button>
346
-  </span>
347
-  </el-dialog> -->
348 320
   </div>
349 321
 </template>
350 322
 
@@ -353,9 +325,8 @@ import BreadCrumb from "@/xt_pages/components/bread-crumb";
353 325
 import { uParseTime } from "@/utils/tools";
354 326
 import {
355 327
   getInitOrder,
356
-  updatePurchaseOrder,
357
-  checkPurchaseOrder,
358
-  getPurchaseOrderDetail,
328
+  getGoodOrderDetail,
329
+  saveGoodReturnOrder
359 330
 } from "@/api/supply";
360 331
 export default {
361 332
   name: "addPurchaseOrder",
@@ -369,8 +340,8 @@ export default {
369 340
         { path: false, name: "购货单" },
370 341
         { path: "/good/return/add", name: "新增退货单" },
371 342
       ],
372
-      showTwo: true,
373
-      showOne: false,
343
+      showTwo: false,
344
+      showOne: true,
374 345
       recordInfo: {
375 346
         tableList: [1],
376 347
       },
@@ -398,9 +369,9 @@ export default {
398 369
       supplier_name: "",
399 370
       supplyList: [],
400 371
       rate_of_concession: "",
372
+      arrearage:"",
373
+      payment:"",
401 374
       discount_amount: "",
402
-      start_time: new Date(),
403
-      end_time: new Date(),
404 375
       tableRules: {
405 376
         name: [{ required: true, message: "商品不能为空", trigger: "blur" }],
406 377
         supply_count: [
@@ -416,6 +387,7 @@ export default {
416 387
       disabled: false,
417 388
       is_check: 0,
418 389
       dialogVisible: false,
390
+      return_remark:"",
419 391
     };
420 392
   },
421 393
   methods: {
@@ -542,7 +514,6 @@ export default {
542 514
       this.currentIndex = val;
543 515
     },
544 516
     changeName(val) {
545
-      //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}
546 517
       for (let i = 0; i < this.recordInfo.tableList.length; i++) {
547 518
         if (this.currentIndex == i) {
548 519
           this.recordInfo.tableList[i].project_id = val.id;
@@ -745,73 +716,159 @@ export default {
745 716
         })
746 717
         .catch(() => {});
747 718
     },
748
-    getPurchaseOrderDetail() {
749
-      console.log("处方233223232323322323232323");
750
-      var id = this.$route.query.id;
751
-      getPurchaseOrderDetail(id).then((response) => {
752
-        if (response.data.state == 1) {
753
-          var info = response.data.data.info;
754
-          this.is_check = info.is_check;
755
-          this.number = info.number;
756
-          this.id = info.id;
757
-          this.supplier_name = info.supplier_id;
758
-          this.rate_of_concession = info.rate_of_concession;
759
-          this.discount_amount = info.discount_amount;
760
-          var orderInfo = response.data.data.orderInfo;
761
-          if (info.is_check == 2) {
762
-            this.disabled = false;
719
+    getGoodOrderDetail(){
720
+      
721
+        var id = this.$route.query.id
722
+      getGoodOrderDetail(id).then(response=>{
723
+        if(response.data.state == 1){
724
+          var out = response.data.data.out
725
+          this.is_check = out.is_check
726
+          this.id = out.id
727
+          this.supplier_name = out.supplier_id
728
+          this.rate_of_concession = out.rate_of_concession
729
+          this.discount_amount = out.discount_amount
730
+          this.payment = out.payment
731
+          this.arrearage = out.arrearage
732
+          this.start_time = this.getTimes(out.document_date)
733
+          var orderInfo = response.data.data.list
734
+          console.log("orderINFO233232232332",orderInfo)
735
+          var drugList = response.data.data.drugList
736
+          var goodList = response.data.data.goodList
737
+          for(let i=0;i< orderInfo.length;i++){
738
+              
739
+              orderInfo[i].supply_count =  orderInfo[i].count
740
+              orderInfo[i].supply_price =  orderInfo[i].price
741
+              orderInfo[i].supply_remake =  orderInfo[i].remark
742
+              orderInfo[i].type =  orderInfo[i].is_source
743
+              orderInfo[i].project_id =  orderInfo[i].project_id
744
+              orderInfo[i].supply_unit =  orderInfo[i].supply_unit
745
+              orderInfo[i].order_number =  orderInfo[i].order_number
746
+              orderInfo[i].good_number = orderInfo[i].good_number
747
+              orderInfo[i].supply_total_price = (orderInfo[i].count * orderInfo[i].price).toFixed(2)
748
+              orderInfo[i].supply_expiry_date = this.getTimes(orderInfo[i].supply_expiry_date)
749
+              orderInfo[i].supply_product_date = this.getTimes(orderInfo[i].supply_product_date)
750
+            if(orderInfo[i].is_source == 1){
751
+              for(let j=0;j<drugList.length;j++){
752
+                  if( orderInfo[i].project_id == drugList[j].id){
753
+                    if(drugList[j].max_unit!=drugList[j].min_unit){
754
+                      orderInfo[i].unitList = [{id:1,name:""},{id:2,name:""}]
755
+                      orderInfo[i].unitList[0].name = drugList[j].max_unit
756
+                      orderInfo[i].unitList[1].name = drugList[j].min_unit
757
+                    }
758
+                    if(drugList[j].max_unit ==drugList[j].min_unit){
759
+                      orderInfo[i].unitList = [{id:1,name:""}]
760
+                      orderInfo[i].unitList[0].name = drugList[j].max_unit
761
+                    }
762
+                  
763
+                  }
764
+              }  
765
+              } 
766
+            if(orderInfo[i].is_source == 2){
767
+              for(let j=0;j<goodList.length;j++){
768
+                  if(orderInfo[i].project_id == goodList[j].id){
769
+                      orderInfo[i].unitList = [{id:1,name:""}]
770
+                      orderInfo[i].unitList[0].name = goodList[j].packing_unit
771
+                  }
772
+              }  
773
+            } 
763 774
           }
764
-          if (info.is_check == 1) {
765
-            this.disabled = true;
766
-          }
767
-          console.log("drugli323322332", this.drugList);
768
-          var drugList = response.data.data.baseList;
769
-          var goodList = response.data.data.goodList;
770
-          for (let i = 0; i < orderInfo.length; i++) {
771
-            orderInfo[i].supply_count = orderInfo[i].count;
772
-            orderInfo[i].supply_price = orderInfo[i].price;
773
-            orderInfo[i].supply_remake = orderInfo[i].remark;
774
-            orderInfo[i].type = orderInfo[i].is_source;
775
-            orderInfo[i].project_id = orderInfo[i].project_id;
776
-            orderInfo[i].supply_unit = orderInfo[i].supply_unit;
777
-            if (orderInfo[i].is_source == 1) {
778
-              for (let j = 0; j < drugList.length; j++) {
779
-                if (orderInfo[i].project_id == drugList[j].id) {
780
-                  orderInfo[i].unitList = [
781
-                    { id: 1, name: "" },
782
-                    { id: 2, name: "" },
783
-                  ];
784
-                  orderInfo[i].unitList[0].name = drugList[j].max_unit;
785
-                  orderInfo[i].unitList[1].name = drugList[j].min_unit;
786
-                }
787
-              }
788
-            }
789
-            if (orderInfo[i].is_source == 2) {
790
-              for (let j = 0; j < goodList.length; j++) {
791
-                if (orderInfo[i].project_id == goodList[j].id) {
792
-                  orderInfo[i].unitList = [{ id: 1, name: "" }];
793
-                  orderInfo[i].unitList[0].name = goodList[j].packing_unit;
794
-                }
795
-              }
796
-            }
797
-          }
798
-          console.log("orderINFO23323232", orderInfo);
799
-          this.recordInfo.tableList = orderInfo;
775
+        
776
+          this.recordInfo.tableList= []
777
+          this.recordInfo.tableList = orderInfo
778
+        
800 779
         }
801
-      });
780
+      })  
802 781
     },
803 782
     toPrint() {
804 783
       var id = this.$route.query.id;
805 784
       this.$router.push({ path: "/purchase/order/print?&id=" + id });
806 785
     },
807
-    toAdd() {
808
-      var id = this.$route.query.id;
809
-      if (this.is_check == 2) {
810
-        this.$message.error("该采购订单未审核,不能生成采购数据!");
811
-        return false;
812
-      }
813
-      this.$router.push({ path: "/purchase/order/add?id=" + id });
814
-    },
786
+    saveGoodReturn(){
787
+      var warehouse_out_id = this.$route.query.id;
788
+      this.$refs["tableForm"].validate((valid)=>{
789
+        if(valid){
790
+          this.loading = true
791
+          for(let i=0;i<this.recordInfo.tableList.length;i++){
792
+            this.recordInfo.tableList[i].supply_count = parseInt(this.recordInfo.tableList[i].supply_count)
793
+            this.recordInfo.tableList[i].supply_price = this.recordInfo.tableList[i].supply_price.toString()
794
+            this.recordInfo.tableList[i].supply_total = this.recordInfo.tableList[i].supply_total.toString()
795
+       
796
+            for(let j=0;j<this.manufactuerList.length;j++){
797
+                if(this.recordInfo.tableList[i].supply_manufacturer == this.manufactuerList[j].manufacturer_name){
798
+                  this.recordInfo.tableList[i].manufacturer_id = this.manufactuerList[j].id
799
+                }
800
+                if(this.recordInfo.tableList[i].supply_manufacturer == this.manufactuerList[j].id){
801
+                  this.recordInfo.tableList[i].supply_manufacturer = this.manufactuerList[j].manufacturer_name
802
+                }
803
+
804
+            }
805
+          }
806
+          var params = {
807
+            "stockIn":this.recordInfo.tableList,
808
+            "return_marke":this.return_remark,
809
+          }
810
+          console.log("start_time232233232",this.start_time)
811
+          
812
+          saveGoodReturnOrder(params,warehouse_out_id,this.start_time,this.rate_of_concession,this.discount_amount,this.arrearage,this.payment,this.supplier_name).then(response=>{
813
+            if(response.data.state == 1){
814
+               this.loading = false
815
+               this.showOne = false
816
+               this.showTwo = true
817
+               this.$message.success("保存成功!")
818
+               var warehouseCancel = response.data.data.warehouseCancel
819
+               var out = response.data.data.cancelOrder
820
+               this.id = out.id
821
+               this.supplier_name = out.supplier_id
822
+               this.rate_of_concession = out.rate_of_concession
823
+               this.discount_amount = out.discount_amount
824
+               this.payment = out.payment
825
+               this.arrearage = out.arrearage
826
+               this.start_time = this.getTimes(out.document_date)
827
+               var orderInfo = response.data.data.list
828
+               for(let i=0;i< orderInfo.length;i++){
829
+                orderInfo[i].supply_count =  orderInfo[i].count
830
+                orderInfo[i].supply_price =  orderInfo[i].price
831
+                orderInfo[i].supply_remake =  orderInfo[i].remark
832
+                orderInfo[i].type =  orderInfo[i].is_source
833
+                orderInfo[i].project_id =  orderInfo[i].project_id
834
+                orderInfo[i].supply_unit =  orderInfo[i].supply_unit
835
+                orderInfo[i].order_number =  orderInfo[i].order_number
836
+                orderInfo[i].good_number = orderInfo[i].good_number
837
+                orderInfo[i].supply_total_price = (orderInfo[i].count * orderInfo[i].price).toFixed(2)
838
+                orderInfo[i].supply_expiry_date = this.getTimes(orderInfo[i].supply_expiry_date)
839
+                orderInfo[i].supply_product_date = this.getTimes(orderInfo[i].supply_product_date)
840
+                if(orderInfo[i].is_source == 1){
841
+                  for(let j=0;j<this.drugList.length;j++){
842
+                      if( orderInfo[i].project_id == this.drugList[j].id){
843
+                        if(this.drugList[j].max_unit!=this.drugList[j].min_unit){
844
+                          orderInfo[i].unitList = [{id:1,name:""},{id:2,name:""}]
845
+                          orderInfo[i].unitList[0].name = this.drugList[j].max_unit
846
+                          orderInfo[i].unitList[1].name = this.drugList[j].min_unit
847
+                        }
848
+                        if(this.drugList[j].max_unit ==this.drugList[j].min_unit){
849
+                          orderInfo[i].unitList = [{id:1,name:""}]
850
+                          orderInfo[i].unitList[0].name = this.drugList[j].max_unit
851
+                        }
852
+                      
853
+                      }
854
+                  }  
855
+                  } 
856
+                if(orderInfo[i].is_source == 2){
857
+                  for(let j=0;j<this.goodList.length;j++){
858
+                      if(orderInfo[i].project_id == this.goodList[j].id){
859
+                          orderInfo[i].unitList = [{id:1,name:""}]
860
+                          orderInfo[i].unitList[0].name = this.goodList[j].packing_unit
861
+                      }
862
+                  }  
863
+                } 
864
+              }
865
+              this.recordInfo.tableList= []
866
+              this.recordInfo.tableList = orderInfo
867
+            }
868
+          })
869
+        }
870
+      })
871
+    }
815 872
   },
816 873
   created() {
817 874
     const tempObj = {};
@@ -833,7 +890,8 @@ export default {
833 890
     tempObj["supply_unit"] = "";
834 891
     this.recordInfo.tableList.push(tempObj);
835 892
     this.getInitOrder();
836
-    this.getPurchaseOrderDetail();
893
+    //获取购货单列表
894
+    this.getGoodOrderDetail();
837 895
   },
838 896
 };
839 897
 </script>

+ 26 - 31
src/xt_pages/supply/components/editGoodOrder.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"
@@ -49,7 +48,9 @@
49 48
     </div>
50 49
     <div>
51 50
         <el-button size="small" type="primary" @click="updateGoodOrder">修改</el-button>
52
-        <el-button size="small" type="primary"  @click="checkGoodOrder">审核</el-button>
51
+        <el-button size="small" type="primary"  @click="toClick" v-show="showThree">生成采购退货单</el-button>
52
+        <el-button size="small" type="primary"  v-show="showOne">审核</el-button>
53
+        <el-button size="small" type="primary"  v-show="showTwo">反审核</el-button>
53 54
 
54 55
        
55 56
     </div>
@@ -278,8 +279,9 @@ return {
278 279
        { path: false, name: "采购单" },
279 280
        { path: "/supply/good/order/query", name: "编辑采购单" }
280 281
     ],
281
-    showTwo:true,
282
-    showOne:false,
282
+    showOne:true,
283
+    showTwo:false,
284
+    showThree:false,
283 285
     recordInfo: {
284 286
       tableList:[],
285 287
     },
@@ -330,9 +332,8 @@ return {
330 332
    payment:"",
331 333
    good_number:"",
332 334
    orderInfo:[],
333
-   showOne:true,
334
-   showTwo:false,
335 335
    warese_out_id:0,
336
+   
336 337
   };
337 338
 },
338 339
 methods:{
@@ -493,6 +494,8 @@ handleEdit(){
493 494
     tempObj["manufacturer_id"] = ""
494 495
     tempObj["warehouse_info_id"] = ""
495 496
     tempObj["warehousing_id"]= ""
497
+    tempObj["number"] = ""
498
+    tempObj["good_number"] = ""
496 499
     this.recordInfo.tableList.push(tempObj)
497 500
 },
498 501
 handleDelete: function(index, row) {
@@ -504,19 +507,6 @@ handleDelete: function(index, row) {
504 507
    }
505 508
 },
506 509
 
507
-changeTypeName(){
508
-
509
-},
510
-startTimeChange(){
511
-
512
-},
513
-endTimeChange(){
514
-
515
-},
516
-search(){
517
-
518
-},
519
-
520 510
 getWarehoseInfo(arr,max_unit,min_unit,min_number){
521 511
     var total = 0
522 512
     var max_str=  ""
@@ -598,6 +588,12 @@ getTimes(time) {
598 588
       if(response.data.state == 1){
599 589
         var out = response.data.data.out
600 590
         this.is_check = out.is_check
591
+        if(out.is_check == 1){
592
+          this.showOne = false
593
+          this.showTwo = true
594
+          this.showThree = true
595
+        }
596
+
601 597
         this.id = out.id
602 598
         this.supplier_name = out.supplier_id
603 599
         this.rate_of_concession = out.rate_of_concession
@@ -651,8 +647,7 @@ getTimes(time) {
651 647
       
652 648
         this.recordInfo.tableList= []
653 649
         this.recordInfo.tableList = orderInfo
654
-       
655
-          console.log("orderINFO23323232",this.recordInfo.tableList)
650
+      
656 651
       }
657 652
     })  
658 653
   },
@@ -667,19 +662,13 @@ getTimes(time) {
667 662
        this.loading = false
668 663
        return false
669 664
     } 
670
-    console.log("表哥2323233232",this.recordInfo.tableList)
671 665
     for(let i=0;i<this.recordInfo.tableList.length;i++){
672 666
 
673 667
         this.recordInfo.tableList[i].supply_count = parseInt(this.recordInfo.tableList[i].supply_count)
674 668
         this.recordInfo.tableList[i].supply_price = this.recordInfo.tableList[i].supply_price.toString()
675 669
         this.recordInfo.tableList[i].supply_total_price= this.recordInfo.tableList[i].supply_total_price.toString()
676 670
         this.recordInfo.tableList[i].supply_total = this.recordInfo.tableList[i].supply_total.toString()
677
-        if(this.recordInfo.tableList[i].id > 0){
678
-          this.recordInfo.tableList[i].type = 1
679
-        }
680
-        if(this.recordInfo.tableList[i].id == 0){
681
-          this.recordInfo.tableList[i].type = 2
682
-        }
671
+       
683 672
         for(let j=0;j<this.manufactuerList.length;j++){
684 673
             if(this.recordInfo.tableList[i].supply_manufacturer == this.manufactuerList[j].manufacturer_name){
685 674
               this.recordInfo.tableList[i].manufacturer_id = this.manufactuerList[j].id
@@ -698,8 +687,6 @@ getTimes(time) {
698 687
            var params = {
699 688
              "stockIn":this.recordInfo.tableList,
700 689
            } 
701
-           console.log("sotckind23232232323232323232",params)
702
-           
703 690
            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=>{
704 691
            if(response.data.state == 1){
705 692
              this.loading = false
@@ -716,6 +703,9 @@ getTimes(time) {
716 703
     getGoodOrderCountList(id,warehousing_id).then(response=>{
717 704
       if(response.data.state == 1){
718 705
         this.$message.success("审核成功!")
706
+        this.showOne = false
707
+        this.showTwo = true
708
+        this.showThree = true
719 709
         var purcaseOrder = response.data.data.purcaseOrder
720 710
         console.log("采购订单",purcaseOrder)
721 711
         
@@ -817,6 +807,9 @@ getTimes(time) {
817 807
         var msg = response.data.data.msg
818 808
       }
819 809
     })
810
+  },
811
+  toClick(){
812
+    this.$router.push({path:"/good/return/add?id="+this.id})
820 813
   }
821 814
 },
822 815
 created(){
@@ -844,6 +837,8 @@ created(){
844 837
     tempObj["manufacturer_id"] = ""
845 838
     tempObj["warehouse_info_id"] = ""
846 839
     tempObj["warehousing_id"]= ""
840
+    tempObj["number"] = ""
841
+    tempObj["good_number"] = ""
847 842
     this.recordInfo.tableList.push(tempObj)
848 843
     this.getInitOrder()
849 844
     if(parseInt(this.$route.query.id) > 0){

+ 3 - 0
src/xt_pages/supply/components/editPurchaseOrder.vue View File

@@ -535,6 +535,9 @@ getTimes(time) {
535 535
               if(this.recordInfo.tableList[i].supply_manufacturer == this.manufactuerList[j].id){
536 536
                  this.recordInfo.tableList[i].supply_manufacturer = this.manufactuerList[j].manufacturer_name
537 537
               }
538
+              if(this.recordInfo.tableList[i].supply_manufacturer == this.manufactuerList[j].manufacturer_name){
539
+                this.recordInfo.tableList[i].manufacturer_id = this.manufactuerList[j].id
540
+              }
538 541
            }
539 542
         }
540 543
         var start = this.start_time

+ 34 - 14
src/xt_pages/supply/goodOrderQuery.vue View File

@@ -102,12 +102,12 @@
102 102
         </el-table-column>
103 103
         <el-table-column label="优惠后金额" align="center">
104 104
          <template slot-scope="scope">
105
-           {{getAllCount(scope.row.orderOut)}}
105
+           {{getAllMoney(scope.row.discount_amount,scope.row.orderOut)}}
106 106
          </template>
107 107
        </el-table-column>
108 108
         <el-table-column label="已付款" align="center">
109 109
          <template slot-scope="scope">
110
-           {{getAllCount(scope.row.orderInfo)}}
110
+           {{scope.row.payment}}
111 111
          </template>
112 112
        </el-table-column>
113 113
        <el-table-column label="数量" align="center">
@@ -221,16 +221,16 @@ export default {
221 221
        this.$router.push({path:"/good/order/add?id="+id})
222 222
      },
223 223
      changeTypeName(){
224
-
224
+       this.getlist()
225 225
      },
226 226
      startTimeChange(){
227
-
227
+      this.getlist()
228 228
      },
229 229
      endTimeChange(){
230
-
230
+      this.getlist()
231 231
      },
232 232
      search(){
233
-
233
+       this.getlist()
234 234
      },
235 235
      handleSizeChange(val){
236 236
        this.limit = val
@@ -251,9 +251,7 @@ export default {
251 251
          }
252 252
        })
253 253
      },
254
-     changeTypeName(){
255 254
 
256
-     },
257 255
      getTimes(time) {
258 256
       if (time === '') {
259 257
       return ''
@@ -263,12 +261,13 @@ export default {
263 261
      getlist(){
264 262
         var params = {
265 263
           check_id:this.check_id,
266
-          start_time:this.getTimes(this.start_time),
267
-          end_time:this.getTimes(this.end_time),
264
+          start_time:this.start_time,
265
+          end_time:this.end_time,
268 266
           keyword:this.keywords,
269 267
           page:this.page,
270 268
           limit:this.limit,
271 269
         }
270
+       console.log("param2323322332",params)
272 271
        getAllGoodOrderList(params).then(response=>{
273 272
           if(response.data.state == 1){
274 273
             var list = response.data.data.list 
@@ -307,16 +306,37 @@ export default {
307 306
        return buy_price.toFixed(2)
308 307
      },
309 308
      getAllCount(arr){
310
-       var count = ""
309
+       var count = 0
311 310
         if(arr!=undefined && arr.length > 0){
312 311
           for(let i=0;i<arr.length;i++){
313
-            count += arr[i].count
312
+            count += parseInt(arr[i].count)
314 313
           }
315 314
        }
316
-       return count
315
+       if(count == 0){
316
+         return ""
317
+       }
318
+       if(count >0){
319
+        return count
320
+       }
321
+     
322
+     },
323
+     getAllMoney(paycount,arr){
324
+       var all_price= 0
325
+       if(arr!=undefined && arr.length > 0){
326
+         for(let i=0;i<arr.length;i++){
327
+          all_price += arr[i].count * arr[i].price
328
+         }
329
+       }
330
+       if(all_price == 0){
331
+         return ""
332
+       }
333
+       if(all_price >0){
334
+
335
+         return (all_price - all_price * (paycount/100)).toFixed(2)
336
+       }
337
+      
317 338
      },
318 339
      toClick(val){
319
-       console.log("val3232232323",val)
320 340
        this.$router.push({path:"/good/order/edit?id="+val.id+"&warehousing_id="+val.warehousing_id})
321 341
      }
322 342
   },

+ 40 - 31
src/xt_pages/supply/goodreturn.vue View File

@@ -66,62 +66,65 @@
66 66
 
67 67
 
68 68
        <el-table
69
-        :row-style="{ color: '#303133' }"
70
-        :header-cell-style="{
71
-          backgroundColor: 'rgb(245, 247, 250)',
72
-          color: '#606266'
73
-        }"
74
-        :data="tableList"
75
-        :class="signAndWeighBoxPatients"
76
-        border
69
+          :row-style="{ color: '#303133' }"
70
+          :header-cell-style="{
71
+              backgroundColor: 'rgb(245, 247, 250)',
72
+              color: '#606266'
73
+          }"
74
+          :data="tableList"
75
+          :class="signAndWeighBoxPatients"
76
+          border
77
+          style="width: 100%"
78
+          max-height="450"
79
+         
77 80
       >
78
-        <el-table-column label="单据日期" align="center">
81
+        <el-table-column label="单据日期" align="center" width="200">
79 82
           <template slot-scope="scope">
80 83
             <span>{{getTimes(scope.row.document_date)}}</span>
81 84
          </template>
82 85
         </el-table-column>
83
-        <el-table-column label="单据编号" align="center">
86
+        <el-table-column label="单据编号" align="center" width="200">
84 87
           <template slot-scope="scope">
85 88
             <span>{{scope.row.number}}</span>
86 89
           </template>
87 90
         </el-table-column>
88
-        <el-table-column label="供应商" align="center">
91
+        <el-table-column label="供应商" align="center" width="200">
89 92
             <template slot-scope="scope">
90 93
               <span>{{getName(scope.row.supplier_id)}}</span>
91 94
             </template>
92 95
          </el-table-column>
93 96
         <el-table-column label="关联购货订单号" align="center" width="200">
94 97
           <template slot-scope="scope">
95
-            
98
+            <span v-if="scope.row.cancelOrder.length >0">{{scope.row.cancelOrder[0].order_number}}</span>
96 99
           </template>
97 100
         </el-table-column>
98 101
            <el-table-column label="源采购单号" align="center" width="200">
99 102
           <template slot-scope="scope">
100
-            
103
+             <span v-if="scope.row.cancelOrder.length >0">{{scope.row.cancelOrder[0].good_number}}</span>
101 104
           </template>
102 105
         </el-table-column>
103
-        <el-table-column label="购货金额" align="center">
106
+        <el-table-column label="购货金额" align="center" width="200">
104 107
           <template slot-scope="scope">
105
-             <span v-if="getAllBuyPrice(scope.row.orderInfo)>0">{{getAllBuyPrice(scope.row.orderInfo)}}</span> 
108
+             <!-- <span v-if="getAllBuyPrice(scope.row.orderInfo)>0">{{getAllBuyPrice(scope.row.orderInfo)}}</span>  -->
106 109
           </template>
107 110
         </el-table-column>
108
-        <el-table-column label="优惠后金额" align="center">
111
+        <el-table-column label="优惠后金额" align="center" width="200">
109 112
          <template slot-scope="scope">
110
-           {{getAllCount(scope.row.orderInfo)}}
113
+           <!-- {{getAllCount(scope.row.orderInfo)}} -->
111 114
          </template>
112 115
        </el-table-column>
113
-        <el-table-column label="已退款" align="center">
116
+        <el-table-column label="已退款" align="center" width="200">
114 117
          <template slot-scope="scope">
115
-           {{getAllCount(scope.row.orderInfo)}}
118
+           <!-- {{getAllCount(scope.row.orderInfo)}} -->
116 119
          </template>
117 120
        </el-table-column>
118
-       <el-table-column label="源数量" align="center">
121
+       <el-table-column label="源数量" align="center" width="200">
119 122
          <template slot-scope="scope">
120
-           {{getAllCount(scope.row.orderInfo)}}
123
+           <!-- {{getAllCount(scope.row.orderInfo)}} -->
121 124
          </template>
122 125
        </el-table-column>
123 126
 
124
-       <el-table-column label="退款状态" align="center">
127
+       <el-table-column label="退款状态" align="center" width="200">
125 128
          <template slot-scope="scope">
126 129
            <span v-if="scope.row.is_check == 2">未审核</span>
127 130
            <span v-if="scope.row.is_check == 1">已审核</span>
@@ -129,25 +132,25 @@
129 132
        </el-table-column>
130 133
       
131 134
           
132
-      <el-table-column label="制单人" align="center">
135
+      <el-table-column label="制单人" align="center" width="200">
133 136
          <template slot-scope="scope">
134 137
           {{getDocName(scope.row.creater)}}
135 138
          </template>
136 139
        </el-table-column>
137 140
 
138
-      <el-table-column label="审核人" align="center">
141
+      <el-table-column label="审核人" align="center" width="200">
139 142
          <template slot-scope="scope">
140 143
           {{getDocName(scope.row.checker)}}
141 144
          </template>
142 145
        </el-table-column>
143 146
 
144
-       <el-table-column label="操作" align="center" width="260px">
147
+       <el-table-column label="操作" align="center" width="260"  fixed="right">
145 148
           <template slot-scope="scope">
146 149
               <el-button
147 150
                 icon="el-icon-edit-outline"
148 151
                 size="small"
149 152
                 type="primary"
150
-                @click="toClick(scope.row.id)"
153
+                @click="editGoodReturn(scope.row.id)"
151 154
               >编辑
152 155
               </el-button>
153 156
               <el-button
@@ -180,7 +183,7 @@
180 183
 <script>
181 184
 import BreadCrumb from "@/xt_pages/components/bread-crumb";
182 185
 
183
-import {getAllSupply,getAllPurchaseOrderList} from "@/api/supply"
186
+import {getAllSupply,getAllGoodReturnOrderList} from "@/api/supply"
184 187
 import {uParseTime } from '@/utils/tools'
185 188
 export default {
186 189
   name: "stockIn",
@@ -273,7 +276,7 @@ export default {
273 276
           page:this.page,
274 277
           limit:this.limit,
275 278
         }
276
-       getAllPurchaseOrderList(params).then(response=>{
279
+       getAllGoodReturnOrderList(params).then(response=>{
277 280
           if(response.data.state == 1){
278 281
             var list = response.data.data.list 
279 282
             console.log("list2332232323232",list)
@@ -319,8 +322,8 @@ export default {
319 322
        }
320 323
        return count
321 324
      },
322
-     toClick(id){
323
-       this.$router.push({path:"/purchase/order/edit?id="+id})
325
+     editGoodReturn(id){
326
+       this.$router.push({path:"/good/return/edit?id="+id})
324 327
      }
325 328
   },
326 329
   created() {
@@ -332,7 +335,7 @@ export default {
332 335
     this.start_time = monthStartDate
333 336
     this.org_id =  this.$store.getters.xt_user.org_id
334 337
     this.getAllSupply()
335
-    // this.getlist()
338
+    this.getlist()
336 339
   },
337 340
  
338 341
 };
@@ -389,4 +392,10 @@ export default {
389 392
   background-color: #d0d3da;
390 393
 }
391 394
 
395
+.el-table__fixed-right {
396
+  width: 150px;
397
+  bottom: 20px;
398
+  height: 100%;
399
+}
400
+
392 401
 </style>