|
@@ -148,15 +148,26 @@ export default {
|
|
|
},
|
|
|
// 提交
|
|
|
async onSubmit({ data }) {
|
|
|
- data.type = this.type;
|
|
|
- data.userid = this.user.uid;
|
|
|
- let res = await this.productCreate(data);
|
|
|
- if (this.$checkRes(res)) {
|
|
|
- this.$notify({
|
|
|
- message: '保存草稿成功',
|
|
|
- type: 'success',
|
|
|
- });
|
|
|
- this.$router.push({ path: '/userCenter/myProduct/index' });
|
|
|
+ if (data.id) {
|
|
|
+ let res = await this.productUpdate(data);
|
|
|
+ if (this.$checkRes(res)) {
|
|
|
+ this.$notify({
|
|
|
+ message: '修改草稿信息成功',
|
|
|
+ type: 'success',
|
|
|
+ });
|
|
|
+ this.$router.push({ path: '/userCenter/myProduct/index' });
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ data.type = this.type;
|
|
|
+ data.userid = this.user.uid;
|
|
|
+ let res = await this.productCreate(data);
|
|
|
+ if (this.$checkRes(res)) {
|
|
|
+ this.$notify({
|
|
|
+ message: '保存草稿成功',
|
|
|
+ type: 'success',
|
|
|
+ });
|
|
|
+ this.$router.push({ path: '/userCenter/myProduct/index' });
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
// 监听显示类型
|