修复拼团秒杀编辑与新增交叉的问题

This commit is contained in:
hupeng
2021-06-23 12:39:35 +08:00
parent 5624e50553
commit bd235ad6d9
2 changed files with 11 additions and 4 deletions

View File

@ -396,6 +396,8 @@ export default {
}, },
'form1.good.productId': { 'form1.good.productId': {
handler(val,oldVal){ handler(val,oldVal){
console.info("val:"+val)
console.info("oldval:"+oldVal)
if(val){ if(val){
this.getInfoChooseGood (val) this.getInfoChooseGood (val)
} }
@ -521,6 +523,8 @@ export default {
// 详情选择商品生成规格用 // 详情选择商品生成规格用
getInfoChooseGood (id) { getInfoChooseGood (id) {
let that = this; let that = this;
let cid = that.$route.params.id || 0;
getInfo(id==null?0:id).then(async res => { getInfo(id==null?0:id).then(async res => {
let data = res.productInfo; let data = res.productInfo;
if(data){ if(data){
@ -529,7 +533,8 @@ export default {
Object.keys(that.formValidate).forEach(key=>{ Object.keys(that.formValidate).forEach(key=>{
if(data[key]) that.formValidate[key] = data[key]; if(data[key]) that.formValidate[key] = data[key];
}) })
that.formValidate.id = 0; that.formValidate.id = cid;
//that.formValidate.id = 0;
that.formValidate.productId = id that.formValidate.productId = id
that.formValidate.title = data.store_name that.formValidate.title = data.store_name
that.formValidate.info = data.store_info that.formValidate.info = data.store_info
@ -578,6 +583,7 @@ export default {
getInfo () { getInfo () {
let that = this; let that = this;
let id = that.$route.params.id || 0; let id = that.$route.params.id || 0;
that.formValidate.id = id;
getCombinationInfo(id).then(async res => { getCombinationInfo(id).then(async res => {
let data = res.productInfo; let data = res.productInfo;
if(data){ if(data){
@ -640,7 +646,7 @@ export default {
if(this.formValidate.spec_type === 1 && this.manyFormValidate.length===0){ if(this.formValidate.spec_type === 1 && this.manyFormValidate.length===0){
return this.$message.warning('请点击生成规格!'); return this.$message.warning('请点击生成规格!');
} }
add(this.formValidate).then(async res => { edit(this.formValidate).then(async res => {
this.$message({ this.$message({
message:'操作成功', message:'操作成功',
type: 'success' type: 'success'

View File

@ -527,6 +527,7 @@ export default {
// 详情选择商品生成规格用 // 详情选择商品生成规格用
getInfoChooseGood (id) { getInfoChooseGood (id) {
let that = this; let that = this;
let cid = that.$route.params.id || 0;
getInfo(id).then(async res => { getInfo(id).then(async res => {
let data = res.productInfo; let data = res.productInfo;
console.log('data:'+data) console.log('data:'+data)
@ -537,7 +538,7 @@ export default {
Object.keys(that.formValidate).forEach(key=>{ Object.keys(that.formValidate).forEach(key=>{
if(data[key]) that.formValidate[key] = data[key]; if(data[key]) that.formValidate[key] = data[key];
}) })
that.formValidate.id = 0; that.formValidate.id = cid;
that.formValidate.productId = id that.formValidate.productId = id
that.formValidate.cate_id = cate_id; that.formValidate.cate_id = cate_id;
that.oneFormValidate = [data.attr]; that.oneFormValidate = [data.attr];
@ -652,7 +653,7 @@ export default {
if(this.formValidate.spec_type === 1 && this.manyFormValidate.length===0){ if(this.formValidate.spec_type === 1 && this.manyFormValidate.length===0){
return this.$message.warning('请点击生成规格!'); return this.$message.warning('请点击生成规格!');
} }
add(this.formValidate).then(async res => { edit(this.formValidate).then(async res => {
this.$message({ this.$message({
message:'操作成功', message:'操作成功',
type: 'success' type: 'success'