|
@@ -71,7 +71,9 @@
|
71
|
71
|
v-show="showTwo"
|
72
|
72
|
>保存</el-button
|
73
|
73
|
>
|
74
|
|
- <el-button size="small" type="primary" @click="checkGoodOrder" >审核</el-button>
|
|
74
|
+ <el-button size="small" type="primary" @click="checkGoodOrder" v-if="is_check == 2" >审核</el-button>
|
|
75
|
+ <el-button size="small" type="primary" @click="MofyGoodOrder" v-if="is_check == 1">反审核</el-button>
|
|
76
|
+ <el-button size="small" type="primary" @click="" v-if="is_check == 1" >生成采购退货单</el-button>
|
75
|
77
|
</div>
|
76
|
78
|
</div>
|
77
|
79
|
|
|
@@ -238,6 +240,18 @@
|
238
|
240
|
</template>
|
239
|
241
|
</el-table-column>
|
240
|
242
|
|
|
243
|
+ <el-table-column label="拆零零售价" align="center" width="180px">
|
|
244
|
+ <template slot-scope="scope">
|
|
245
|
+ <el-input
|
|
246
|
+ v-model="scope.row.min_price"
|
|
247
|
+ style="width: 140px"
|
|
248
|
+ :disabled="disabled"
|
|
249
|
+ placeholder="请输入拆零零售价"
|
|
250
|
+ ></el-input>
|
|
251
|
+ <div style="visibility: hidden">/</div>
|
|
252
|
+ </template>
|
|
253
|
+ </el-table-column>
|
|
254
|
+
|
241
|
255
|
<el-table-column label="采购单价" align="center" width="180px">
|
242
|
256
|
<template slot-scope="scope">
|
243
|
257
|
<el-input
|
|
@@ -449,7 +463,8 @@ import {
|
449
|
463
|
updateGoodOrder,
|
450
|
464
|
checkGoodOrderById,
|
451
|
465
|
getGoodOrderCountList,
|
452
|
|
- ModefySupplyWarehousing
|
|
466
|
+ ModefySupplyWarehousing,
|
|
467
|
+ MofyGoodOrder
|
453
|
468
|
} from "@/api/supply";
|
454
|
469
|
export default {
|
455
|
470
|
name: "addPurchaseOrder",
|
|
@@ -518,7 +533,7 @@ export default {
|
518
|
533
|
goodList: [],
|
519
|
534
|
id: 0,
|
520
|
535
|
disabled: false,
|
521
|
|
- is_check: 0,
|
|
536
|
+ is_check: 2,
|
522
|
537
|
dialogVisible: false,
|
523
|
538
|
arrearage: "",
|
524
|
539
|
payment: "",
|
|
@@ -597,6 +612,7 @@ export default {
|
597
|
612
|
drugList[i].supply_remake = "";
|
598
|
613
|
drugList[i].type = 1;
|
599
|
614
|
drugList[i].supply_price = drugList[i].last_price;
|
|
615
|
+ drugList[i].min_price = drugList[i].min_price
|
600
|
616
|
drugList[i].name = drugList[i].drug_name;
|
601
|
617
|
if (drugList[i].max_unit != drugList[i].min_unit) {
|
602
|
618
|
drugList[i].unitList = [
|
|
@@ -652,6 +668,7 @@ export default {
|
652
|
668
|
goodList[i].name = goodList[i].good_name;
|
653
|
669
|
goodList[i].unitList = [{ id: 1, name: "" }];
|
654
|
670
|
goodList[i].supply_unit = goodList[i].packing_unit;
|
|
671
|
+ goodList[i].min_price = goodList[i].retail_price
|
655
|
672
|
for (let j = 0; j < goodList[i].unitList.length; j++) {
|
656
|
673
|
goodList[i].unitList[0].name = goodList[i].packing_unit;
|
657
|
674
|
}
|
|
@@ -672,9 +689,9 @@ export default {
|
672
|
689
|
this.recordInfo.tableList[i].name = val.name;
|
673
|
690
|
this.recordInfo.tableList[i].supply_name = val.supply_name;
|
674
|
691
|
this.recordInfo.tableList[i].supply_type = val.supply_type;
|
675
|
|
- this.recordInfo.tableList[i].supply_specification_name =
|
676
|
|
- val.supply_specification_name;
|
|
692
|
+ this.recordInfo.tableList[i].supply_specification_name = val.supply_specification_name;
|
677
|
693
|
this.recordInfo.tableList[i].supply_total = val.supply_total;
|
|
694
|
+ this.recordInfo.tableList[i].min_price = val.min_price
|
678
|
695
|
if (val.supply_count == NaN) {
|
679
|
696
|
this.recordInfo.tableList[i].supply_count = "";
|
680
|
697
|
} else {
|
|
@@ -723,6 +740,7 @@ export default {
|
723
|
740
|
tempObj["order_number"] = "";
|
724
|
741
|
tempObj["supply_expiry_date"] = "";
|
725
|
742
|
tempObj["manufacturer_id"] = "";
|
|
743
|
+ tempObj["min_price"] = ""
|
726
|
744
|
this.recordInfo.tableList.push(tempObj);
|
727
|
745
|
},
|
728
|
746
|
handleDelete: function (index, row) {
|
|
@@ -839,7 +857,9 @@ export default {
|
839
|
857
|
getPurchaseOrderInfo(id, ids).then((response) => {
|
840
|
858
|
if (response.data.state == 1) {
|
841
|
859
|
var info = response.data.data.info;
|
842
|
|
- this.is_check = info.is_check;
|
|
860
|
+
|
|
861
|
+
|
|
862
|
+
|
843
|
863
|
this.id = info.id;
|
844
|
864
|
this.supplier_name = info.supplier_id;
|
845
|
865
|
this.rate_of_concession = info.rate_of_concession;
|
|
@@ -862,6 +882,7 @@ export default {
|
862
|
882
|
orderInfo[i].project_id = orderInfo[i].project_id;
|
863
|
883
|
orderInfo[i].supply_unit = orderInfo[i].supply_unit;
|
864
|
884
|
orderInfo[i].order_number = orderInfo[i].order_number;
|
|
885
|
+ orderInfo[i].min_price = ""
|
865
|
886
|
orderInfo[i].supply_total_price = (orderInfo[i].count * orderInfo[i].price).toFixed(2);
|
866
|
887
|
if (orderInfo[i].is_source == 1) {
|
867
|
888
|
for (let j = 0; j < drugList.length; j++) {
|
|
@@ -919,6 +940,7 @@ export default {
|
919
|
940
|
this.recordInfo.tableList[i].supply_total_price.toString();
|
920
|
941
|
this.recordInfo.tableList[i].supply_total =
|
921
|
942
|
this.recordInfo.tableList[i].supply_total.toString();
|
|
943
|
+ this.recordInfo.tableList[i].min_price = this.recordInfo.tableList[i].min_price.toString()
|
922
|
944
|
|
923
|
945
|
for (let j = 0; j < this.manufactuerList.length; j++) {
|
924
|
946
|
if (
|
|
@@ -944,7 +966,7 @@ export default {
|
944
|
966
|
var warehousing_id = this.$route.query.id;
|
945
|
967
|
//判断是否在采购订单数据中做了删除,如果长度相等则代表没有删除,如果不等则代表做了删除或者新增
|
946
|
968
|
console.log("长度2332233232",this.tableDataList.length)
|
947
|
|
- console.log("产股2333223232323",this.recordInfo.tableList)
|
|
969
|
+ console.log("产股2333223232323",this.recordInfo.tableList.length)
|
948
|
970
|
if(this.tableDataList.length != this.recordInfo.tableList.length){
|
949
|
971
|
warehousing_id = 0
|
950
|
972
|
for(let i=0;i<this.recordInfo.tableList.length;i++){
|
|
@@ -964,6 +986,7 @@ export default {
|
964
|
986
|
this.showTwo = true;
|
965
|
987
|
var orderInfo = response.data.data.list;
|
966
|
988
|
var warehouseOut = response.data.data.warehouseOut;
|
|
989
|
+ console.log("采购单323322323",warehouseOut)
|
967
|
990
|
this.warese_out_id = warehouseOut.id;
|
968
|
991
|
this.good_number = warehouseOut.good_number;
|
969
|
992
|
this.rate_of_concession = warehouseOut.rate_of_concession;
|
|
@@ -994,23 +1017,13 @@ export default {
|
994
|
1017
|
if (orderInfo[i].is_source == 1) {
|
995
|
1018
|
for (let j = 0; j < this.drugList.length; j++) {
|
996
|
1019
|
if (orderInfo[i].project_id == this.drugList[j].id) {
|
997
|
|
- if (
|
998
|
|
- this.drugList[j].max_unit != this.drugList[j].min_unit
|
999
|
|
- ) {
|
1000
|
|
- orderInfo[i].unitList = [
|
1001
|
|
- { id: 1, name: "" },
|
1002
|
|
- { id: 2, name: "" },
|
1003
|
|
- ];
|
1004
|
|
- orderInfo[i].unitList[0].name =
|
1005
|
|
- this.drugList[j].max_unit;
|
1006
|
|
- orderInfo[i].unitList[1].name =
|
1007
|
|
- this.drugList[j].min_unit;
|
|
1020
|
+ if (this.drugList[j].max_unit != this.drugList[j].min_unit) {
|
|
1021
|
+ orderInfo[i].unitList = [{ id: 1, name: "" },{ id: 2, name: "" }];
|
|
1022
|
+ orderInfo[i].unitList[0].name = this.drugList[j].max_unit;
|
|
1023
|
+ orderInfo[i].unitList[1].name = this.drugList[j].min_unit;
|
1008
|
1024
|
}
|
1009
|
|
- if (
|
1010
|
|
- this.drugList[j].max_unit == this.drugList[j].min_unit
|
1011
|
|
- ) {
|
1012
|
|
- orderInfo[i].unitList[0].name =
|
1013
|
|
- this.drugList[j].max_unit;
|
|
1025
|
+ if (this.drugList[j].max_unit == this.drugList[j].min_unit) {
|
|
1026
|
+ orderInfo[i].unitList[0].name = this.drugList[j].max_unit;
|
1014
|
1027
|
}
|
1015
|
1028
|
}
|
1016
|
1029
|
}
|
|
@@ -1019,8 +1032,7 @@ export default {
|
1019
|
1032
|
for (let j = 0; j < this.goodList.length; j++) {
|
1020
|
1033
|
if (orderInfo[i].project_id == this.goodList[j].id) {
|
1021
|
1034
|
orderInfo[i].unitList = [{ id: 1, name: "" }];
|
1022
|
|
- orderInfo[i].unitList[0].name =
|
1023
|
|
- this.goodList[j].packing_unit;
|
|
1035
|
+ orderInfo[i].unitList[0].name = this.goodList[j].packing_unit;
|
1024
|
1036
|
}
|
1025
|
1037
|
}
|
1026
|
1038
|
}
|
|
@@ -1048,7 +1060,7 @@ export default {
|
1048
|
1060
|
this.recordInfo.tableList[i].supply_total_price.toString();
|
1049
|
1061
|
this.recordInfo.tableList[i].supply_total =
|
1050
|
1062
|
this.recordInfo.tableList[i].supply_total.toString();
|
1051
|
|
-
|
|
1063
|
+ this.recordInfo.tableList[i].min_price = this.recordInfo.tableList[i].min_price.toString()
|
1052
|
1064
|
for (let j = 0; j < this.manufactuerList.length; j++) {
|
1053
|
1065
|
if (
|
1054
|
1066
|
this.recordInfo.tableList[i].supply_manufacturer ==
|
|
@@ -1099,12 +1111,13 @@ export default {
|
1099
|
1111
|
checkGoodOrder() {
|
1100
|
1112
|
var id = this.warese_out_id;
|
1101
|
1113
|
var warehousing_id = this.id;
|
1102
|
|
- console.log("id23322332233223",id)
|
1103
|
|
- console.log("checkGoodOrder23323",warehousing_id)
|
|
1114
|
+ console.log("采购单ID",id)
|
|
1115
|
+ console.log("采购订单ID",warehousing_id)
|
1104
|
1116
|
|
1105
|
1117
|
getGoodOrderCountList(id, warehousing_id).then((response) => {
|
1106
|
1118
|
if (response.data.state == 1) {
|
1107
|
1119
|
this.$message.success("审核成功!");
|
|
1120
|
+
|
1108
|
1121
|
this.is_check = 1
|
1109
|
1122
|
this.showOne = false;
|
1110
|
1123
|
this.showTwo = true;
|
|
@@ -1210,6 +1223,128 @@ export default {
|
1210
|
1223
|
}
|
1211
|
1224
|
});
|
1212
|
1225
|
},
|
|
1226
|
+ MofyGoodOrder() {
|
|
1227
|
+ var id = this.warese_out_id;
|
|
1228
|
+ console.log("采购单ID",id)
|
|
1229
|
+ var params = {
|
|
1230
|
+ id: id,
|
|
1231
|
+ };
|
|
1232
|
+ MofyGoodOrder(params).then((response) => {
|
|
1233
|
+ if (response.data.state == 1) {
|
|
1234
|
+ var msg = response.data.data.msg;
|
|
1235
|
+ if (msg == 1) {
|
|
1236
|
+ this.$message.success("反审核成功!");
|
|
1237
|
+ this.is_check = 2
|
|
1238
|
+ this.disabled = false
|
|
1239
|
+ this.Reviewed = false
|
|
1240
|
+ return
|
|
1241
|
+ }
|
|
1242
|
+ if (msg == 2) {
|
|
1243
|
+ var cancelList = response.data.data.cancelList
|
|
1244
|
+ console.log("cancelLIST2332322332232323",cancelList)
|
|
1245
|
+ this.orderList = cancelList
|
|
1246
|
+ this.$refs.Popup.dialogVisible = true
|
|
1247
|
+ return
|
|
1248
|
+ }
|
|
1249
|
+
|
|
1250
|
+ var purcaseOrder = response.data.data.purcaseOrder;
|
|
1251
|
+ console.log("采购订单", purcaseOrder);
|
|
1252
|
+ var goodOrder = response.data.data.goodOrder;
|
|
1253
|
+ console.log("采购单", goodOrder);
|
|
1254
|
+ var drugList = response.data.data.drugList;
|
|
1255
|
+ console.log("druglist23323223", drugList);
|
|
1256
|
+ var ids = "";
|
|
1257
|
+ // 如果采购单没有数据,则代表改订单第一次生成采购订单数据
|
|
1258
|
+ if (goodOrder.length == 0) {
|
|
1259
|
+ this.$router.push({path: "/good/order/add?id=" + id + "&ids=" + ids});
|
|
1260
|
+ }
|
|
1261
|
+ for (let i = 0; i < purcaseOrder.length; i++) {
|
|
1262
|
+ for (let j = 0; j < drugList.length; j++) {
|
|
1263
|
+ if (purcaseOrder[i].is_source == 1) {
|
|
1264
|
+ if (purcaseOrder[i].supply_unit == drugList[j].max_unit) {
|
|
1265
|
+ purcaseOrder[i].count = purcaseOrder[i].count * drugList[j].min_number;
|
|
1266
|
+ }
|
|
1267
|
+ }
|
|
1268
|
+ }
|
|
1269
|
+ }
|
|
1270
|
+
|
|
1271
|
+ for (let i = 0; i < goodOrder.length; i++) {
|
|
1272
|
+ for (let j = 0; j < drugList.length; j++) {
|
|
1273
|
+ if (goodOrder[i].is_source == 1) {
|
|
1274
|
+ if (goodOrder[i].supply_unit == drugList[j].max_unit) {
|
|
1275
|
+ goodOrder[i].count = goodOrder[i].count * drugList[j].min_number;
|
|
1276
|
+ }
|
|
1277
|
+ }
|
|
1278
|
+ }
|
|
1279
|
+ }
|
|
1280
|
+
|
|
1281
|
+ let objInfo = {};
|
|
1282
|
+ if (goodOrder.length > 0) {
|
|
1283
|
+ goodOrder.forEach((item, index) => {
|
|
1284
|
+ let { project_id } = item;
|
|
1285
|
+ if (!objInfo[project_id]) {
|
|
1286
|
+ objInfo[project_id] = {
|
|
1287
|
+ project_id,
|
|
1288
|
+ child: [],
|
|
1289
|
+ count: 0,
|
|
1290
|
+ };
|
|
1291
|
+ }
|
|
1292
|
+ });
|
|
1293
|
+ let newArr = Object.values(objInfo);
|
|
1294
|
+
|
|
1295
|
+ for (let i = 0; i < goodOrder.length; i++) {
|
|
1296
|
+ for (let j = 0; j < newArr.length; j++) {
|
|
1297
|
+ if (goodOrder[i].project_id == newArr[j].project_id) {
|
|
1298
|
+ newArr[j].child.push(goodOrder[i]);
|
|
1299
|
+ }
|
|
1300
|
+ }
|
|
1301
|
+ }
|
|
1302
|
+ console.log("newAr2332232323", newArr);
|
|
1303
|
+
|
|
1304
|
+ for (let i = 0; i < newArr.length; i++) {
|
|
1305
|
+ for (let j = 0; j < newArr[i].child.length; j++) {
|
|
1306
|
+ newArr[i].count += newArr[i].child[j].count;
|
|
1307
|
+ }
|
|
1308
|
+ }
|
|
1309
|
+
|
|
1310
|
+ var arr = [];
|
|
1311
|
+ var total = 0;
|
|
1312
|
+ var str = "";
|
|
1313
|
+
|
|
1314
|
+ //如果采购单有数据,则需要比较数量
|
|
1315
|
+ if (newArr.length > 0) {
|
|
1316
|
+ for (let i = 0; i < purcaseOrder.length; i++) {
|
|
1317
|
+ for (let j = 0; j < newArr.length; j++) {
|
|
1318
|
+ if (purcaseOrder[i].project_id == newArr[j].project_id) {
|
|
1319
|
+ //根据商品ID比较数量大小,如果采购单的数量大于采购订单的数据
|
|
1320
|
+ if (purcaseOrder[i].count < newArr[j].count) {
|
|
1321
|
+ arr.push(purcaseOrder[i].project_id);
|
|
1322
|
+ }
|
|
1323
|
+ }
|
|
1324
|
+ }
|
|
1325
|
+ }
|
|
1326
|
+ //如果total的长度等于0,怎修改该订单的状态为全部入库
|
|
1327
|
+
|
|
1328
|
+ if (arr.length > 0) {
|
|
1329
|
+ //修改采购订单的状态为全部入库
|
|
1330
|
+ this.UpdateSupplyWahouseingInfo();
|
|
1331
|
+ }
|
|
1332
|
+ }
|
|
1333
|
+ }
|
|
1334
|
+ }
|
|
1335
|
+ });
|
|
1336
|
+ },
|
|
1337
|
+ UpdateSupplyWahouseingInfo() {
|
|
1338
|
+ var params = {
|
|
1339
|
+ warehousing_id: this.$route.query.warehousing_id,
|
|
1340
|
+ };
|
|
1341
|
+ console.log("采购单ID",params)
|
|
1342
|
+ UpdateSupplyWahouseingInfo(params).then((response) => {
|
|
1343
|
+ if (response.data.state == 1) {
|
|
1344
|
+ var msg = response.data.data.msg;
|
|
1345
|
+ }
|
|
1346
|
+ });
|
|
1347
|
+ },
|
1213
|
1348
|
},
|
1214
|
1349
|
created() {
|
1215
|
1350
|
const tempObj = {};
|
|
@@ -1234,6 +1369,7 @@ export default {
|
1234
|
1369
|
tempObj["order_number"] = "";
|
1235
|
1370
|
tempObj["supply_expiry_date"] = "";
|
1236
|
1371
|
tempObj["manufacturer_id"] = "";
|
|
1372
|
+ tempObj["min_price"] = ""
|
1237
|
1373
|
this.recordInfo.tableList.push(tempObj);
|
1238
|
1374
|
this.getInitOrder();
|
1239
|
1375
|
if (parseInt(this.$route.query.id) > 0) {
|