|
@@ -174,12 +174,12 @@
|
174
|
174
|
placeholder="请选择"
|
175
|
175
|
:disabled="disabled"
|
176
|
176
|
>
|
177
|
|
- <!-- <el-option
|
178
|
|
- v-for="(item,index) in scope.row.unitList"
|
179
|
|
- :key="index"
|
180
|
|
- :label="item.name"
|
181
|
|
- :value="item.name">
|
182
|
|
- </el-option> -->
|
|
177
|
+ <el-option
|
|
178
|
+ v-for="(item,index) in scope.row.unitList"
|
|
179
|
+ :key="index"
|
|
180
|
+ :label="item.name"
|
|
181
|
+ :value="item.name">
|
|
182
|
+ </el-option>
|
183
|
183
|
</el-select>
|
184
|
184
|
</el-form-item>
|
185
|
185
|
</template>
|
|
@@ -214,6 +214,7 @@
|
214
|
214
|
:rules="tableRules.supply_count"
|
215
|
215
|
>
|
216
|
216
|
<el-input
|
|
217
|
+ @input="getSupplyCount(scope.row.supply_count,scope.row.sum_count,scope.row.supply_unit,scope.row.type,scope.row.min_number,scope.row.max_unit,scope.row.min_unit,scope.$index)"
|
217
|
218
|
v-model="scope.row.supply_count"
|
218
|
219
|
style="width: 80px"
|
219
|
220
|
:disabled="disabled"
|
|
@@ -554,6 +555,7 @@ export default {
|
554
|
555
|
drugList[i].min_unit,
|
555
|
556
|
drugList[i].min_number
|
556
|
557
|
);
|
|
558
|
+
|
557
|
559
|
drugList[i].supply_count = "";
|
558
|
560
|
drugList[i].supply_total_price = "";
|
559
|
561
|
drugList[i].supply_manufacturer = drugList[i].manufacturer;
|
|
@@ -562,7 +564,6 @@ export default {
|
562
|
564
|
drugList[i].type = 1;
|
563
|
565
|
drugList[i].supply_price = drugList[i].last_price;
|
564
|
566
|
drugList[i].name = drugList[i].drug_name;
|
565
|
|
- drugList[i].count = ""
|
566
|
567
|
drugList[i].unitList = [
|
567
|
568
|
{ id: 1, name: "" },
|
568
|
569
|
{ id: 2, name: "" },
|
|
@@ -572,6 +573,12 @@ export default {
|
572
|
573
|
drugList[i].unitList[0].name = drugList[i].max_unit;
|
573
|
574
|
drugList[i].unitList[1].name = drugList[i].min_unit;
|
574
|
575
|
}
|
|
576
|
+ drugList[i].sum_count = this.getWarehoseInfoTwo(
|
|
577
|
+ drugList[i].drug_warehouse_info,
|
|
578
|
+ drugList[i].max_unit,
|
|
579
|
+ drugList[i].min_unit,
|
|
580
|
+ drugList[i].min_number
|
|
581
|
+ );
|
575
|
582
|
this.tabList.push(drugList[i]);
|
576
|
583
|
}
|
577
|
584
|
this.drugList = drugList;
|
|
@@ -617,10 +624,13 @@ export default {
|
617
|
624
|
];
|
618
|
625
|
|
619
|
626
|
goodList[i].supply_unit = goodList[i].packing_unit;
|
620
|
|
- goodList[i].count = ""
|
|
627
|
+
|
621
|
628
|
for (let j = 0; j < goodList[i].unitList.length; j++) {
|
622
|
629
|
goodList[i].unitList[0].name = goodList[i].packing_unit;
|
623
|
630
|
}
|
|
631
|
+ goodList[i].sum_count = this.getTotalStockCountTwo(
|
|
632
|
+ goodList[i].good_warehouse_info
|
|
633
|
+ );
|
624
|
634
|
this.tabList.push(goodList[i]);
|
625
|
635
|
}
|
626
|
636
|
this.goodList = goodList;
|
|
@@ -631,6 +641,7 @@ export default {
|
631
|
641
|
this.currentIndex = val;
|
632
|
642
|
},
|
633
|
643
|
changeName(val) {
|
|
644
|
+
|
634
|
645
|
for (let i = 0; i < this.recordInfo.tableList.length; i++) {
|
635
|
646
|
if (this.currentIndex == i) {
|
636
|
647
|
this.recordInfo.tableList[i].project_id = val.id;
|
|
@@ -638,8 +649,7 @@ export default {
|
638
|
649
|
this.recordInfo.tableList[i].name = val.name;
|
639
|
650
|
this.recordInfo.tableList[i].supply_name = val.supply_name;
|
640
|
651
|
this.recordInfo.tableList[i].supply_type = val.supply_type;
|
641
|
|
- this.recordInfo.tableList[i].supply_specification_name =
|
642
|
|
- val.supply_specification_name;
|
|
652
|
+ this.recordInfo.tableList[i].supply_specification_name = val.supply_specification_name;
|
643
|
653
|
this.recordInfo.tableList[i].supply_total = val.supply_total;
|
644
|
654
|
if (val.supply_count == NaN) {
|
645
|
655
|
this.recordInfo.tableList[i].supply_count = "";
|
|
@@ -663,6 +673,19 @@ export default {
|
663
|
673
|
this.recordInfo.tableList[i].supply_unit = val.supply_unit;
|
664
|
674
|
this.recordInfo.tableList[i].unitList = val.unitList;
|
665
|
675
|
this.recordInfo.tableList[i].count = val.count
|
|
676
|
+ this.recordInfo.tableList[i].sum_count = val.sum_count
|
|
677
|
+
|
|
678
|
+ if(val.type == 1){
|
|
679
|
+ this.recordInfo.tableList[i].min_number = val.min_number
|
|
680
|
+ this.recordInfo.tableList[i].max_unit = val.max_unit
|
|
681
|
+ this.recordInfo.tableList[i].min_unit = val.min_unit
|
|
682
|
+ }else{
|
|
683
|
+ this.recordInfo.tableList[i].max_unit = ""
|
|
684
|
+ this.recordInfo.tableList[i].min_unit = ""
|
|
685
|
+ this.recordInfo.tableList[i].min_number = ""
|
|
686
|
+ }
|
|
687
|
+
|
|
688
|
+
|
666
|
689
|
}
|
667
|
690
|
}
|
668
|
691
|
},
|
|
@@ -698,6 +721,10 @@ export default {
|
698
|
721
|
tempObj["good_number"] = ""
|
699
|
722
|
tempObj["deposit_rate"] = ""
|
700
|
723
|
tempObj["order_number"] = ""
|
|
724
|
+ tempObj["sum_count"] =0
|
|
725
|
+ tempObj["min_number"] = 0
|
|
726
|
+ tempObj["max_unit"] = ""
|
|
727
|
+ tempObj["min_unit"] = ""
|
701
|
728
|
this.recordInfo.tableList.push(tempObj);
|
702
|
729
|
},
|
703
|
730
|
handleDelete: function (index, row) {
|
|
@@ -744,6 +771,7 @@ export default {
|
744
|
771
|
var min_str = "";
|
745
|
772
|
if (arr.length > 0) {
|
746
|
773
|
for (let i = 0; i < arr.length; i++) {
|
|
774
|
+
|
747
|
775
|
total += parseInt(arr[i].stock_max_number+ arr[i].stock_min_number);
|
748
|
776
|
}
|
749
|
777
|
}
|
|
@@ -764,6 +792,15 @@ export default {
|
764
|
792
|
}
|
765
|
793
|
return max_str + min_str;
|
766
|
794
|
},
|
|
795
|
+ getWarehoseInfoTwo(arr, max_unit, min_unit, min_number){
|
|
796
|
+ var total = 0;
|
|
797
|
+ if (arr.length > 0) {
|
|
798
|
+ for (let i = 0; i < arr.length; i++) {
|
|
799
|
+ total += parseInt(arr[i].stock_max_number+ arr[i].stock_min_number);
|
|
800
|
+ }
|
|
801
|
+ }
|
|
802
|
+ return total
|
|
803
|
+ },
|
767
|
804
|
getTotalStockCount(arr) {
|
768
|
805
|
var total_count = 0;
|
769
|
806
|
for (let i = 0; i < arr.length; i++) {
|
|
@@ -775,6 +812,14 @@ export default {
|
775
|
812
|
return ""
|
776
|
813
|
}
|
777
|
814
|
|
|
815
|
+ },
|
|
816
|
+ getTotalStockCountTwo(arr) {
|
|
817
|
+ var total_count = 0;
|
|
818
|
+ for (let i = 0; i < arr.length; i++) {
|
|
819
|
+ total_count += arr[i].stock_count;
|
|
820
|
+ }
|
|
821
|
+ return total_count
|
|
822
|
+
|
778
|
823
|
},
|
779
|
824
|
calculate: function (val) {
|
780
|
825
|
if (isNaN(val)) {
|
|
@@ -893,6 +938,53 @@ export default {
|
893
|
938
|
count_arrearage() {
|
894
|
939
|
this.payment = this.total_price - this.arrearage;
|
895
|
940
|
},
|
|
941
|
+ getSupplyCount(supply_count,sum_count,supply_unit,type,min_number,max_unit,min_unit,index){
|
|
942
|
+ console.log("val23322323",supply_count,sum_count,supply_unit,type,min_number,max_unit,min_unit)
|
|
943
|
+ var total_count = 0
|
|
944
|
+
|
|
945
|
+ if(type == 1){
|
|
946
|
+ if(supply_unit == max_unit){
|
|
947
|
+ total_count = supply_count * min_number
|
|
948
|
+ }
|
|
949
|
+ if(supply_unit == min_unit){
|
|
950
|
+ total_count = supply_count
|
|
951
|
+ }
|
|
952
|
+ console.log("sum_counts",sum_count)
|
|
953
|
+ console.log("count232232332",total_count)
|
|
954
|
+ if(total_count > sum_count){
|
|
955
|
+ this.$message.error("数量不能大于可退数量!")
|
|
956
|
+ for(let i=0;i<this.recordInfo.tableList.length;i++){
|
|
957
|
+ if(index == i){
|
|
958
|
+ this.recordInfo.tableList[i].supply_count = ""
|
|
959
|
+ }
|
|
960
|
+ }
|
|
961
|
+ }else{
|
|
962
|
+ for(let i=0;i<this.recordInfo.tableList.length;i++){
|
|
963
|
+ if(index == i){
|
|
964
|
+ this.recordInfo.tableList[i].supply_count = supply_count
|
|
965
|
+ }
|
|
966
|
+ }
|
|
967
|
+ }
|
|
968
|
+ }
|
|
969
|
+
|
|
970
|
+ if(type == 2){
|
|
971
|
+ if(supply_count > sum_count){
|
|
972
|
+ this.$message.error("数量不能大于可退数量!")
|
|
973
|
+ for(let i=0;i<this.recordInfo.tableList.length;i++){
|
|
974
|
+ if(index == i){
|
|
975
|
+ this.recordInfo.tableList[i].supply_count = ""
|
|
976
|
+ }
|
|
977
|
+ }
|
|
978
|
+ }else{
|
|
979
|
+ for(let i=0;i<this.recordInfo.tableList.length;i++){
|
|
980
|
+ if(index == i){
|
|
981
|
+ this.recordInfo.tableList[i].supply_count = supply_count
|
|
982
|
+ }
|
|
983
|
+ }
|
|
984
|
+ }
|
|
985
|
+ }
|
|
986
|
+
|
|
987
|
+ },
|
896
|
988
|
getGoodReturnDetail() {
|
897
|
989
|
var id = this.$route.query.id;
|
898
|
990
|
getGoodReturnDetail(id).then((response) => {
|
|
@@ -921,7 +1013,6 @@ export default {
|
921
|
1013
|
for (let i = 0; i < orderInfo.length; i++) {
|
922
|
1014
|
orderInfo[i].id = orderInfo[i].id;
|
923
|
1015
|
orderInfo[i].supply_count = orderInfo[i].supply_count;
|
924
|
|
- orderInfo[i].count = orderInfo[i].count;
|
925
|
1016
|
orderInfo[i].supply_price = orderInfo[i].price;
|
926
|
1017
|
orderInfo[i].supply_remake = orderInfo[i].remark;
|
927
|
1018
|
orderInfo[i].type = orderInfo[i].is_source;
|
|
@@ -937,11 +1028,9 @@ export default {
|
937
|
1028
|
if (orderInfo[i].is_source == 1) {
|
938
|
1029
|
for (let j = 0; j < drugList.length; j++) {
|
939
|
1030
|
if (orderInfo[i].project_id == drugList[j].id) {
|
|
1031
|
+
|
940
|
1032
|
if (drugList[j].max_unit != drugList[j].min_unit) {
|
941
|
|
- orderInfo[i].unitList = [
|
942
|
|
- { id: 1, name: "" },
|
943
|
|
- { id: 2, name: "" },
|
944
|
|
- ];
|
|
1033
|
+ orderInfo[i].unitList = [{ id: 1, name: "" },{ id: 2, name: "" }];
|
945
|
1034
|
orderInfo[i].unitList[0].name = drugList[j].max_unit;
|
946
|
1035
|
orderInfo[i].unitList[1].name = drugList[j].min_unit;
|
947
|
1036
|
}
|
|
@@ -949,8 +1038,19 @@ export default {
|
949
|
1038
|
orderInfo[i].unitList = [{ id: 1, name: "" }];
|
950
|
1039
|
orderInfo[i].unitList[0].name = drugList[j].max_unit;
|
951
|
1040
|
}
|
|
1041
|
+ //用来统计数量比大小
|
|
1042
|
+ if(orderInfo[i].supply_unit == drugList[j].max_unit){
|
|
1043
|
+ orderInfo[i].sum_count = orderInfo[i].count*drugList[j].min_number
|
|
1044
|
+ }
|
|
1045
|
+ if(orderInfo[i].supply_unit == drugList[j].min_unit){
|
|
1046
|
+ orderInfo[i].sum_count = orderInfo[i].count
|
|
1047
|
+ }
|
|
1048
|
+ orderInfo[i].min_number = drugList[j].min_number
|
|
1049
|
+ orderInfo[i].max_unit =drugList[j].max_unit
|
|
1050
|
+ orderInfo[i].min_unit =drugList[j].min_unit
|
952
|
1051
|
}
|
953
|
1052
|
}
|
|
1053
|
+ orderInfo[i].count = orderInfo[i].count + orderInfo[i].supply_unit
|
954
|
1054
|
}
|
955
|
1055
|
if (orderInfo[i].is_source == 2) {
|
956
|
1056
|
for (let j = 0; j < goodList.length; j++) {
|
|
@@ -959,10 +1059,16 @@ export default {
|
959
|
1059
|
orderInfo[i].unitList[0].name = goodList[j].packing_unit;
|
960
|
1060
|
}
|
961
|
1061
|
}
|
|
1062
|
+ orderInfo[i].sum_count = orderInfo[i].count
|
|
1063
|
+ orderInfo[i].min_number = 0
|
|
1064
|
+ orderInfo[i].count = orderInfo[i].count;
|
|
1065
|
+ orderInfo[i].max_unit =""
|
|
1066
|
+ orderInfo[i].min_unit =""
|
962
|
1067
|
}
|
963
|
1068
|
}
|
964
|
1069
|
|
965
|
1070
|
this.recordInfo.tableList = [];
|
|
1071
|
+ console.log("or233232332233223233223",orderInfo)
|
966
|
1072
|
this.recordInfo.tableList = orderInfo;
|
967
|
1073
|
}
|
968
|
1074
|
});
|
|
@@ -977,6 +1083,11 @@ export default {
|
977
|
1083
|
if (valid) {
|
978
|
1084
|
this.loading = true;
|
979
|
1085
|
for (let i = 0; i < this.recordInfo.tableList.length; i++) {
|
|
1086
|
+ if(this.recordInfo.tableList[i].count == ""){
|
|
1087
|
+ this.$message.error(this.recordInfo.tableList[i].name+"无可退库数量,保存失败!")
|
|
1088
|
+ this.loading = false
|
|
1089
|
+ return false
|
|
1090
|
+ }
|
980
|
1091
|
this.recordInfo.tableList[i].supply_count = parseInt(
|
981
|
1092
|
this.recordInfo.tableList[i].supply_count
|
982
|
1093
|
);
|
|
@@ -1008,7 +1119,7 @@ export default {
|
1008
|
1119
|
return_marke: this.return_remark,
|
1009
|
1120
|
};
|
1010
|
1121
|
console.log("parms32322332",params)
|
1011
|
|
-
|
|
1122
|
+
|
1012
|
1123
|
updateGoodReturn(
|
1013
|
1124
|
params,
|
1014
|
1125
|
warehouse_out_id,
|
|
@@ -1114,6 +1225,10 @@ export default {
|
1114
|
1225
|
tempObj["good_number"] = ""
|
1115
|
1226
|
tempObj["deposit_rate"] = ""
|
1116
|
1227
|
tempObj["order_number"] = ""
|
|
1228
|
+ tempObj["sum_count"] = 0
|
|
1229
|
+ tempObj["min_number"] = 0
|
|
1230
|
+ tempObj["max_unit"] = ""
|
|
1231
|
+ tempObj["min_unit"] = ""
|
1117
|
1232
|
this.recordInfo.tableList.push(tempObj);
|
1118
|
1233
|
this.getInitOrder();
|
1119
|
1234
|
|