|
@@ -134,14 +134,14 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
|
- <el-dialog :title="isAdd?'添加组合商品':'查看组合商品'" destroy-on-close :visible.sync="routeShopStatus" @close="onFormClose('ruleForm')"
|
|
|
+ <el-dialog :title="isAdd?'添加组合商品':'修改组合商品'" destroy-on-close :visible.sync="routeShopStatus" @close="onFormClose('ruleForm')"
|
|
|
width="600px">
|
|
|
<el-form :model="form" :rules="rules" ref="ruleForm">
|
|
|
<el-form-item label="商品名称" prop="name" :label-width="formLabelWidth">
|
|
|
- <el-input placeholder="请输入商品名称" type="text" :disabled="!isAdd" v-model.trim="form.name"></el-input>
|
|
|
+ <el-input placeholder="请输入商品名称" type="text" v-model.trim="form.name"></el-input>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="货号" prop="sn" :label-width="formLabelWidth">
|
|
|
- <el-input placeholder="请输入货号" type="text" :disabled="!isAdd" v-model.trim="form.sn"></el-input>
|
|
|
+ <el-input placeholder="请输入货号" type="text" v-model.trim="form.sn"></el-input>
|
|
|
</el-form-item>
|
|
|
<el-form-item label="品牌" prop="brand" :label-width="formLabelWidth">
|
|
|
<el-input v-model.trim="form.brand" placeholder="请输入品牌"></el-input>
|
|
@@ -164,13 +164,13 @@
|
|
|
<div v-for="(goodsList, index) in form.goodsList" :key="index">
|
|
|
<el-form-item :label="'商品' + (index + 1)" :label-width="formLabelWidth" style="display: inline-block;" :prop="'goodsList.' + index + '.id'"
|
|
|
:rules="[{ required: true, message: '请选择商品', trigger: 'change' }]">
|
|
|
- <el-select v-model.trim="goodsList.id" :disabled="!isAdd" @change="onGoodsChange" placeholder="请选择商品">
|
|
|
+ <el-select v-model.trim="goodsList.id" @change="onGoodsChange" placeholder="请选择商品">
|
|
|
<el-option v-for="(item,index) in selectGoodsList" :key="index" :disabled="item.disabled" :label="item.name" :value="item.id"></el-option>
|
|
|
</el-select>
|
|
|
</el-form-item>
|
|
|
- <el-button icon="el-icon-minus" :disabled="!isAdd" v-if="form.goodsList.length > 1" @click.prevent="removeGoodsList(goodsList)"
|
|
|
+ <el-button icon="el-icon-minus" v-if="form.goodsList.length > 1" @click.prevent="removeGoodsList(goodsList)"
|
|
|
circle></el-button>
|
|
|
- <el-button icon="el-icon-plus" :disabled="!isAdd" @click.prevent="addGoodsList" circle style="margin-left: 5px;"></el-button>
|
|
|
+ <el-button icon="el-icon-plus" @click.prevent="addGoodsList" circle style="margin-left: 5px;"></el-button>
|
|
|
</div>
|
|
|
|
|
|
<el-form-item label="商品价格" prop="marketPrice" :label-width="formLabelWidth">
|
|
@@ -298,9 +298,6 @@
|
|
|
type: null,
|
|
|
goodsCategoryId: null,
|
|
|
specification: null,
|
|
|
- stockCount: null,
|
|
|
- taxStockCount: null,
|
|
|
- stockType: null,
|
|
|
marketPrice: null,
|
|
|
groupPurchasePrice: null,
|
|
|
clientShow: null,
|
|
@@ -371,21 +368,6 @@
|
|
|
trigger: 'blur'
|
|
|
}
|
|
|
],
|
|
|
- stockCount: [{
|
|
|
- required: true,
|
|
|
- validator: validStock,
|
|
|
- trigger: 'blur'
|
|
|
- }],
|
|
|
- taxStockCount: [{
|
|
|
- required: true,
|
|
|
- validator: validStock,
|
|
|
- trigger: 'blur'
|
|
|
- }],
|
|
|
- stockType: [{
|
|
|
- required: true,
|
|
|
- message: '请选择库存类型',
|
|
|
- trigger: 'change'
|
|
|
- }],
|
|
|
marketPrice: [{
|
|
|
required: true,
|
|
|
validator: validPrice,
|
|
@@ -561,14 +543,34 @@
|
|
|
let pageInfo = JSON.stringify(this.pageInfo)
|
|
|
let searchForm = JSON.stringify(this.searchForm)
|
|
|
let paramInfo = JSON.stringify(params)
|
|
|
- this.$router.push({
|
|
|
- path: '/shopManager/shopOperation',
|
|
|
- query: {
|
|
|
- searchForm,
|
|
|
- paramInfo,
|
|
|
- pageInfo
|
|
|
+ // 判断是否是修改组合商品
|
|
|
+ if(type == 'update' && row.complementGoodsIdList) {
|
|
|
+ this.routeShopStatus = true
|
|
|
+ this.isAdd = false
|
|
|
+
|
|
|
+ let form = this.form
|
|
|
+ for(let i in form) {
|
|
|
+ form[i] = row[i]
|
|
|
}
|
|
|
- })
|
|
|
+ let ids = row.complementGoodsIdList.split(',')
|
|
|
+ let goodsList = []
|
|
|
+ ids.forEach(item => {
|
|
|
+ goodsList.push({
|
|
|
+ id: Number(item)
|
|
|
+ })
|
|
|
+ })
|
|
|
+ form.goodsList = goodsList
|
|
|
+ form.id = row.id
|
|
|
+ } else {
|
|
|
+ this.$router.push({
|
|
|
+ path: '/shopManager/shopOperation',
|
|
|
+ query: {
|
|
|
+ searchForm,
|
|
|
+ paramInfo,
|
|
|
+ pageInfo
|
|
|
+ }
|
|
|
+ })
|
|
|
+ }
|
|
|
},
|
|
|
beforeUpload(file) {
|
|
|
// console.log(file.type)
|
|
@@ -652,7 +654,6 @@
|
|
|
onShopSubmit(formName) {
|
|
|
this.$refs[formName].validate((valid) => {
|
|
|
if (valid) {
|
|
|
- console.log(this.form)
|
|
|
let form = Object.assign({}, this.form)
|
|
|
let tempIds = []
|
|
|
form.goodsList.forEach(item => {
|
|
@@ -670,7 +671,7 @@
|
|
|
goodsAdd(cleanDeep(form)).then(res => {
|
|
|
this.messageTips('添加', res)
|
|
|
})
|
|
|
- } else if (this.pageType == 'update') {
|
|
|
+ } else {
|
|
|
goodsUpdate(cleanDeep(form)).then(res => {
|
|
|
this.messageTips('修改', res)
|
|
|
})
|