|
@@ -114,7 +114,7 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-import { getWarehouseList, getDeliverList, getPickupManList, getPickupCarList, getCompanyList, addPickupBook, editPickupBook, getDetail } from "@/api/supply/pickup";
|
|
|
+import { getWarehouseList, getDeliverList, getPickupManList, getPickupCarList, getCompanyList, addPickupBook, editPickupBook, getDetail, checkStock } from "@/api/supply/pickup";
|
|
|
import { getDictList } from "@/api/common";
|
|
|
|
|
|
export default {
|
|
@@ -293,10 +293,6 @@ export default {
|
|
|
if(this.tableSelection.length < 1) {
|
|
|
return this.$errorMsg('请选择发货申请单');
|
|
|
}
|
|
|
- this.formLoading = true;
|
|
|
-
|
|
|
- let takerName = this.pickupManList.find(o => o.id == this.mainForm.pickupMan).takerName;
|
|
|
- let correspondName = this.warehouseList.find(o => o.id == this.mainForm.warehouse).name;
|
|
|
|
|
|
let orderList = [];
|
|
|
this.tableSelection.forEach(item => {
|
|
@@ -304,43 +300,74 @@ export default {
|
|
|
});
|
|
|
let params = {
|
|
|
correspondId: this.mainForm.warehouse,
|
|
|
- correspondName,
|
|
|
pickTime: this.mainForm.date + ' 00:00:00',
|
|
|
- pickStatus: Number(this.mainForm.timeSlot),
|
|
|
- pickType: Number(this.mainForm.pickupWay),
|
|
|
- takerId: this.mainForm.pickupMan,
|
|
|
- takerName,
|
|
|
- remark: this.mainForm.remark,
|
|
|
invoiceOrderIds: orderList,
|
|
|
}
|
|
|
- if(this.mainForm.pickupWay == '1') {
|
|
|
- params.takerCarId = this.mainForm.pickupCar;
|
|
|
- }
|
|
|
- if(this.mainForm.pickupWay == '2') {
|
|
|
- params.pickLogistics = this.mainForm.company;
|
|
|
- }
|
|
|
- if(this.listItem) {
|
|
|
- params.id = this.listItem.id;
|
|
|
- editPickupBook(params).then(res => {
|
|
|
- this.$successMsg('提交成功');
|
|
|
- this.goBack();
|
|
|
- this.$parent.getList();
|
|
|
- }).finally(res => {
|
|
|
- this.formLoading = false;
|
|
|
- })
|
|
|
- }else {
|
|
|
- addPickupBook(params).then(res => {
|
|
|
- this.$successMsg('提交成功');
|
|
|
- this.goBack();
|
|
|
- this.$parent.getList();
|
|
|
- }).finally(res => {
|
|
|
- this.formLoading = false;
|
|
|
- })
|
|
|
- }
|
|
|
+ checkStock(params).then(res => {
|
|
|
+ if(res.data) {
|
|
|
+ this.$confirm(res.data, '提示', {
|
|
|
+ confirmButtonText: '确定',
|
|
|
+ cancelButtonText: '取消',
|
|
|
+ type: 'warning'
|
|
|
+ }).then(() => {
|
|
|
+ this.submitForm();
|
|
|
+ }).catch(() => {});
|
|
|
+ }else {
|
|
|
+ this.submitForm();
|
|
|
+ }
|
|
|
+ })
|
|
|
+
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
|
|
|
+ submitForm() {
|
|
|
+ this.formLoading = true;
|
|
|
+
|
|
|
+ let takerName = this.pickupManList.find(o => o.id == this.mainForm.pickupMan).takerName;
|
|
|
+ let correspondName = this.warehouseList.find(o => o.id == this.mainForm.warehouse).name;
|
|
|
+
|
|
|
+ let orderList = [];
|
|
|
+ this.tableSelection.forEach(item => {
|
|
|
+ orderList.push(item.invoiceOrderId);
|
|
|
+ });
|
|
|
+ let params = {
|
|
|
+ correspondId: this.mainForm.warehouse,
|
|
|
+ correspondName,
|
|
|
+ pickTime: this.mainForm.date + ' 00:00:00',
|
|
|
+ pickStatus: Number(this.mainForm.timeSlot),
|
|
|
+ pickType: Number(this.mainForm.pickupWay),
|
|
|
+ takerId: this.mainForm.pickupMan,
|
|
|
+ takerName,
|
|
|
+ remark: this.mainForm.remark,
|
|
|
+ invoiceOrderIds: orderList,
|
|
|
+ }
|
|
|
+ if(this.mainForm.pickupWay == '1') {
|
|
|
+ params.takerCarId = this.mainForm.pickupCar;
|
|
|
+ }
|
|
|
+ if(this.mainForm.pickupWay == '2') {
|
|
|
+ params.pickLogistics = this.mainForm.company;
|
|
|
+ }
|
|
|
+ if(this.listItem) {
|
|
|
+ params.id = this.listItem.id;
|
|
|
+ editPickupBook(params).then(res => {
|
|
|
+ this.$successMsg('提交成功');
|
|
|
+ this.goBack();
|
|
|
+ this.$parent.getList();
|
|
|
+ }).finally(res => {
|
|
|
+ this.formLoading = false;
|
|
|
+ })
|
|
|
+ }else {
|
|
|
+ addPickupBook(params).then(res => {
|
|
|
+ this.$successMsg('提交成功');
|
|
|
+ this.goBack();
|
|
|
+ this.$parent.getList();
|
|
|
+ }).finally(res => {
|
|
|
+ this.formLoading = false;
|
|
|
+ })
|
|
|
+ }
|
|
|
+ },
|
|
|
+
|
|
|
resetForm() {
|
|
|
this.$refs.mainForm.resetFields();
|
|
|
this.deliverList = [];
|