...
|
...
|
@@ -24,7 +24,7 @@ |
|
|
|
|
|
<div slot="footer" style="text-align: center">
|
|
|
<Button type="primary" size="large" :loading="modal_loading" @click="submit">保存</Button>
|
|
|
<Button type="primary" size="large" :loading="modal_loading2" @click="submitAnd">保存并添加商品</Button>
|
|
|
<Button type="primary" size="large" :loading="modal_loading" @click="submitAnd">保存并添加商品</Button>
|
|
|
<Button type="primary" size="large" @click="cancel">取消</Button>
|
|
|
</div>
|
|
|
</Modal>
|
...
|
...
|
@@ -40,7 +40,6 @@ export default { |
|
|
return {
|
|
|
model: false,
|
|
|
modal_loading: false,
|
|
|
modal_loading2: false,
|
|
|
storageId: null,
|
|
|
createDate: null,
|
|
|
brandId: null
|
...
|
...
|
@@ -60,16 +59,16 @@ export default { |
|
|
this.model = false;
|
|
|
},
|
|
|
submit() {
|
|
|
this.modal_loading = true;
|
|
|
this.save().then((result) => {
|
|
|
if (result.code === 200) {
|
|
|
this.close();
|
|
|
this.emitEvent();
|
|
|
}
|
|
|
}).catch((err) => {
|
|
|
this.$Message.error(err);
|
|
|
});
|
|
|
},
|
|
|
submitAnd() {
|
|
|
this.modal_loading2 = true;
|
|
|
this.save().then((result) => {
|
|
|
if (result.code === 200) {
|
|
|
this.close();
|
...
|
...
|
@@ -77,10 +76,12 @@ export default { |
|
|
this.$router.push({
|
|
|
name: 'repository.invoice.edit',
|
|
|
params: {
|
|
|
id: this.storageId
|
|
|
id: result.data
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
}).catch((err) => {
|
|
|
this.$Message.error(err);
|
|
|
});
|
|
|
},
|
|
|
cancel() {
|
...
|
...
|
@@ -88,10 +89,31 @@ export default { |
|
|
},
|
|
|
reset() {
|
|
|
this.modal_loading = false;
|
|
|
this.modal_loading2 = false;
|
|
|
},
|
|
|
save() {
|
|
|
return service.createOrder(this.storageId, this.hanldeDate, this.brandId);
|
|
|
if (!this.storageId) {
|
|
|
return Promise.reject('请选择到货仓库');
|
|
|
}
|
|
|
|
|
|
if (!this.createDate) {
|
|
|
return Promise.reject('设置预计到货时间');
|
|
|
}
|
|
|
|
|
|
if (!this.brandId) {
|
|
|
this.$Message.error();
|
|
|
return Promise.reject('请选择品牌');
|
|
|
}
|
|
|
|
|
|
this.modal_loading = true;
|
|
|
return service.createOrder(this.storageId, this.hanldeDate, this.brandId).then((result) => {
|
|
|
if (result.code === 200) {
|
|
|
this.$Message.info('创建成功');
|
|
|
} else {
|
|
|
this.$Message.error('创建失败');
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
});
|
|
|
},
|
|
|
emitEvent() {
|
|
|
this.$emit('on-success');
|
...
|
...
|
|