Commit c5f9904d by liwk

commit

1 parent 041a589c
...@@ -85,6 +85,10 @@ export const orderApi = { ...@@ -85,6 +85,10 @@ export const orderApi = {
createGoods(data = {}) { createGoods(data = {}) {
return request(data, 'dj.api.scrm.goods.insert') return request(data, 'dj.api.scrm.goods.insert')
}, },
/** 商品修改*/
updateGoods(data = {}) {
return request(data, 'dj.api.scrm.goods.update')
},
} }
export const carEquityManageApi = { export const carEquityManageApi = {
/** 获取汽车权益列表*/ /** 获取汽车权益列表*/
...@@ -99,6 +103,14 @@ export const carEquityManageApi = { ...@@ -99,6 +103,14 @@ export const carEquityManageApi = {
updateShelves(data = {}) { updateShelves(data = {}) {
return request(data, 'dj.api.scrm.car.updateShelves') return request(data, 'dj.api.scrm.car.updateShelves')
}, },
/**新增汽车权益*/
createEquity(data = {}) {
return request(data, 'dj.api.scrm.car.insert')
},
/** 更新汽车权益*/
updateEquity(data = {}) {
return request(data, 'dj.api.scrm.car.update')
},
} }
export const goodsEquityManageApi = { export const goodsEquityManageApi = {
/**获取商品权益列表*/ /**获取商品权益列表*/
...@@ -137,6 +149,25 @@ export const goodsEquityManageApi = { ...@@ -137,6 +149,25 @@ export const goodsEquityManageApi = {
updateShelves(data = {}) { updateShelves(data = {}) {
return request(data, 'dj.api.scrm.goods.groupUpdateShelves') return request(data, 'dj.api.scrm.goods.groupUpdateShelves')
}, },
/**新增商品权益*/
createEquity(data = {}) {
return request(data, 'dj.api.scrm.goods.groupInsert')
},
/**更新商品权益*/
updateEquity(data = {}) {
return request(data, 'dj.api.scrm.goods.groupUpdate')
},
/** 获取品牌列表*/
getGoodsBrandList(data = {
supplier: 'HW'
}) {
return request(data, 'dj.api.scrm.goods.brandList')
},
/* 获取品牌下商品形态列表*/
getAppearanceList(data = {}) {
return request({...data, supplier: 'HW' }, 'dj.api.scrm.goods.appearanceList')
},
} }
// export const orderApi = { // export const orderApi = {
// /**获取财务管理列表*/ // /**获取财务管理列表*/
......
<template>
<div class="equity-dialog">
<el-dialog
:title=" type == 1?'汽车权益' : '商品权益'"
:visible.sync="show"
:show-close="false"
:close-on-press-escape="false"
:close-on-click-modal="false"
>
<el-form
:model="form"
:rules="rules"
ref="ruleForm"
>
<el-form-item
v-if="type==1"
label="服务提供方"
required
prop="supplier"
>
<el-select v-model="form.supplier">
<el-option
v-for="item in supplierList"
:key="item.value"
:label="item.label"
:value="item.value"
></el-option>
</el-select>
</el-form-item>
<template v-if="type==2">
<el-form-item
label="产品提供方"
required
prop="supplier"
>
<el-select v-model="form.supplier">
<el-option
label="海威"
value="HW"
></el-option>
</el-select>
</el-form-item>
<el-form-item
label="选择品牌"
required
prop="brandName"
>
<el-select
v-model="form.brandName"
@change="changeBrandName"
>
<el-option
v-for="item in brandList"
:key="item.brandId"
:value="item.brandId"
>{{item.brandName}}</el-option>
</el-select>
</el-form-item>
<el-form-item
label="商品形态"
required
prop="appearance"
v-if="form.brandName"
>
<el-select
v-model="form.appearance"
@change="change"
>
<el-option
v-for="item in appearanceList"
:key="item.value"
:value="item.label"
>{{item.label}}</el-option>
</el-select>
</el-form-item>
</template>
<div class="flex">
<el-form-item
label="权益名称"
required
prop="equityName"
>
<el-input
v-model="form.equityName"
:maxlength="type==1?8:6"
></el-input>
</el-form-item>
<el-form-item
label="描述"
required
prop="equityDesc"
>
<el-input
v-model="form.equityDesc"
:maxlength="type==1?8:6"
></el-input>
</el-form-item>
</div>
<div>
<el-form-item
label="图标"
required
prop="equityIcon"
>
<el-upload
action="#"
class="avatar-uploader"
:show-file-list="false"
:before-upload="upLoadImg"
>
<img
v-if="form.equityIcon"
:src="form.equityIcon"
class="avatar"
>
<i
v-else
class="el-icon-plus avatar-uploader-icon"
></i>
</el-upload>
</el-form-item>
</div>
</el-form>
<div
slot="footer"
class="dialog-footer"
>
<el-button @click="close">取 消</el-button>
<el-button
type="primary"
@click="submit(type)"
>确 定</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { goodsEquityManageApi, carEquityManageApi, commonApi } from '@api/api'
const validatorgoodsImage = (rule, value, callback) => {
if (!value) {
callback('请上传图标')
} else {
callback()
}
}
export default {
name: 'equity-dialog',
data () {
return {
form: {},
brandList: [],
appearanceList: [],
appearance: '',
supplierList: [
{
label: '广联-加油',
value: 'GL_OIL'
},
{
label: '广联-道路救援',
value: 'GL_ROAD_RESCUE'
},
{
label: '广联-轮胎保障',
value: 'GL_TIRE_PROTECTION'
},
{
label: '广联-盗抢无忧',
value: 'GL_ROBBERY_PROTECTION'
},
{
label: '广联-碰撞维修',
value: 'GL_COLLISION_REPAIR'
},
{
label: '广联-整车全损',
value: 'GL_CAR_TOTAL_LOSS'
},
{
label: 'e代驾',
value: 'EDJ'
}
],
rules: {
supplier: [
{ required: true, message: '请选择服务提供方', trigger: 'change' }
],
brandName: [
{ required: true, message: '请选择品牌', trigger: 'change' }
],
appearance: [
{ required: true, message: '请选择商品形态', trigger: 'change' }
],
equityName: [
{ required: true, message: '请输入权益名称', trigger: 'blur' }
],
equityDesc: [
{ required: true, message: '请输入描述', trigger: 'blur' }
],
equityIcon: [
{ validator: validatorgoodsImage },
],
}
}
},
props: {
show: {
type: Boolean,
default: false
},
type: Number,
isEdit: Boolean,
data: {
type: Object,
default: () => { }
}
},
mounted () {
goodsEquityManageApi.getGoodsBrandList().then(({ data }) => {
this.brandList = data
})
},
watch: {
'isEdit' (n) {
if (n) {
this.form = JSON.parse(JSON.stringify(this.$parent.editData))
if (this.type == 2) {
this.form.appearance = { 1: '卡券', 2: '直充' }[this.$parent.editData.appearance]
}
}
},
'form.brandId' (n) {
goodsEquityManageApi.getAppearanceList({ brandId: n }).then(({ data }) => {
data.map(i => i.label = { 1: '卡券', 2: '直充' }[i.appearance])
this.appearanceList = data
})
},
},
methods: {
close () {
this.form = {}
this.$emit('update:show', false)
this.$emit('update:isEdit', false)
},
upLoadImg (file) {
let fileName = file.name
if (file.name.lastIndexOf('.') === -1) {
this.$message.info('路径不正确')
return false
}
let AllImgExt = '.jpg|.jpeg|.gif|.bmp|.png|.swf'
let extName = file.name.substring(file.name.lastIndexOf('.')).toLowerCase()
if (AllImgExt.indexOf(extName + '|') === -1) {
this.$message.info('图片格式不正确')
return false
}
// if (fileSize < 3145728) {
if (window.FileReader) {
let reader = new FileReader()
reader.readAsDataURL(file)
reader.onload = (img) => {
console.log(file)
let type = fileName.split('.')[1]
let imgUrl = img.target.result.split(',')[1]
commonApi.upLoadImg({
file: `${type}@${imgUrl}`
}).then(({ code, message, data }) => {
if (code == 0) {
window.vm.$set(this.form, 'equityIcon', data)
} else {
this.$message.error(message)
}
})
}
}
},
change (e) {
},
changeBrandName (e) {
console.log(e)
this.form.brandId = e
this.brandList.map(i => {
if (i.brandId == e) this.form.brandName = i.brandName
})
},
submit (type) {
let { form, isEdit } = this
let target = type == 1 ? carEquityManageApi : goodsEquityManageApi
this.$refs.ruleForm.validate((valid) => {
if (valid) {
if (type == 2) {
this.form.goodsCategoryId = this.$parent.goodsCategoryId
this.form.appearance = form.appearance == '直充' ? 2 : 1
}
let apiName = 'createEquity'
if (isEdit) apiName = 'updateEquity'
console.log(this.form)
target[apiName](this.form).then(({ code, data, message }) => {
if (code == 0) {
this.close()
type == 1 ? this.$parent.getCarList() : this.$parent.getCategoryList()
} else {
this.$message.error(message)
}
})
} else {
return
}
})
}
}
}
</script>
<style scope>
.flex {
display: flex;
align-items: center;
justify-content: space-between;
}
.avatar-uploader {
box-sizing: border-box;
border: 1px dashed #d9d9d9;
border-radius: 6px;
cursor: pointer;
position: relative;
width: 80px;
height: 80px;
margin-left: 80px;
}
.avatar-uploader-icon {
font-size: 28px;
color: #8c939d;
width: 80px;
height: 80px;
display: flex;
align-items: center;
justify-content: center;
}
.avatar {
width: 80px;
height: 80px;
display: block;
}
</style>
\ No newline at end of file \ No newline at end of file
...@@ -5,4 +5,6 @@ import Vue from 'vue' ...@@ -5,4 +5,6 @@ import Vue from 'vue'
Vue.component('table-tooltip', () => Vue.component('table-tooltip', () =>
import ('./table-tooltip/index.vue')) import ('./table-tooltip/index.vue'))
Vue.component('d2-table', () => Vue.component('d2-table', () =>
import ('./d2-table/index.vue'))
\ No newline at end of file \ No newline at end of file
import ('./d2-table/index.vue'))
Vue.component('equity-dialog', () =>
import ('./equity-dialog/index.vue'))
\ No newline at end of file \ No newline at end of file
...@@ -17,7 +17,7 @@ export default { ...@@ -17,7 +17,7 @@ export default {
minWidth: '200', minWidth: '200',
}, },
{ {
label: '权益图标\n(80*80,支持JPG、PNG、GIF)', label: '权益图标\n(80*80,支持JPG、PNG、GIF',
minWidth: '200', minWidth: '200',
formatter: (cell) => { formatter: (cell) => {
return `<img class="equity-icon" src="${cell.equityIcon}" />` return `<img class="equity-icon" src="${cell.equityIcon}" />`
...@@ -25,8 +25,18 @@ export default { ...@@ -25,8 +25,18 @@ export default {
}, },
{ {
label: '服务提供方', label: '服务提供方',
prop: 'supplier',
minWidth: '200', minWidth: '200',
formatter: (cell) => {
return {
GL_OIL: '广联-加油',
GL_ROAD_RESCUE: '广联-道路救援',
GL_TIRE_PROTECTION: '广联-轮胎保障',
GL_ROBBERY_PROTECTION: '广联-盗抢无忧',
GL_COLLISION_REPAIR: '广联-碰撞维修',
GL_CAR_TOTAL_LOSS: '广联-整车全损',
EDJ: 'e代驾'
}[cell.supplier]
}
}, },
] ]
}, },
......
...@@ -2,6 +2,7 @@ import { goodsEquityManageApi } from '@api/api' ...@@ -2,6 +2,7 @@ import { goodsEquityManageApi } from '@api/api'
export default { export default {
data() { data() {
return { return {
goodsCategoryId: '',
inputValue: '', inputValue: '',
tagInputValue: '', tagInputValue: '',
inputVisible: false, inputVisible: false,
...@@ -54,6 +55,7 @@ export default { ...@@ -54,6 +55,7 @@ export default {
list[0].active = true list[0].active = true
this.tags = list || [] this.tags = list || []
this.getGoodsList(list[0].id) this.getGoodsList(list[0].id)
this.goodsCategoryId = list[0].id
}) })
}, },
/**商品权益列表 */ /**商品权益列表 */
...@@ -71,12 +73,14 @@ export default { ...@@ -71,12 +73,14 @@ export default {
this.tags.map(e => e.active = false) this.tags.map(e => e.active = false)
this.tags[index].active = true this.tags[index].active = true
this.getGoodsList(id) this.getGoodsList(id)
this.goodsCategoryId = id
}, },
/** */ /** */
tagHover(index, type) { tagHover(index, type) {
this.$refs[`tag-${index}`][0].$el.classList[type]('tag-hover') this.$refs[`tag-${index}`][0].$el.classList[type]('tag-hover')
}, },
showInput(index) { showInput(index, val) {
this.inputValue = val
this.$refs[`tag-input-${index}`][0].$el.classList.add('input-tag-show') this.$refs[`tag-input-${index}`][0].$el.classList.add('input-tag-show')
this.$refs[`tag-input-${index}`][0].$refs.input.focus() this.$refs[`tag-input-${index}`][0].$refs.input.focus()
}, },
......
...@@ -3,7 +3,10 @@ ...@@ -3,7 +3,10 @@
<div class="box"> <div class="box">
<div class="equity-title">汽车权益</div> <div class="equity-title">汽车权益</div>
<div class="add-box"> <div class="add-box">
<el-button type="primary">添加</el-button> <el-button
type="primary"
@click="addEquity(1)"
>添加</el-button>
</div> </div>
<div class="table-box"> <div class="table-box">
<d2-table <d2-table
...@@ -18,7 +21,10 @@ ...@@ -18,7 +21,10 @@
slot-scope="scope" slot-scope="scope"
:data="scope.scope" :data="scope.scope"
> >
<el-button type="text">编辑</el-button> <el-button
type="text"
@click="editEquity(scope.scope,1)"
>编辑</el-button>
<el-button <el-button
type="text" type="text"
@click="updateShelves(scope.scope, 'car')" @click="updateShelves(scope.scope, 'car')"
...@@ -45,14 +51,14 @@ ...@@ -45,14 +51,14 @@
:ref="`tag-${index}`" :ref="`tag-${index}`"
> >
<div class="mask"> <div class="mask">
<div <span
class="edit" class="edit"
@click.stop="showInput(index)" @click.stop="showInput(index, item.goodsCategory)"
>编辑</div> >编辑</span>
<div <span
class="del" class="del"
@click.stop="categoryDelete(item.id)" @click.stop="categoryDelete(item.id)"
>删除</div> >删除</span>
</div> </div>
{{item.goodsCategory}} {{item.goodsCategory}}
<el-input <el-input
...@@ -85,7 +91,10 @@ ...@@ -85,7 +91,10 @@
>添加分类</el-button> >添加分类</el-button>
</div> </div>
<div class="add-box"> <div class="add-box">
<el-button type="primary">添加</el-button> <el-button
type="primary"
@click="addEquity(2)"
>添加</el-button>
</div> </div>
<div class="table-box"> <div class="table-box">
<d2-table <d2-table
...@@ -100,7 +109,10 @@ ...@@ -100,7 +109,10 @@
slot-scope="scope" slot-scope="scope"
:data="scope.scope" :data="scope.scope"
> >
<el-button type="text">编辑</el-button> <el-button
type="text"
@click="editEquity(scope.scope,2)"
>编辑</el-button>
<el-button <el-button
type="text" type="text"
@click="updateShelves(scope.scope,'goods')" @click="updateShelves(scope.scope,'goods')"
...@@ -113,6 +125,11 @@ ...@@ -113,6 +125,11 @@
</d2-table> </d2-table>
</div> </div>
</div> </div>
<equity-dialog
:show.sync="showDialog"
:type="dialogType"
:isEdit.sync="isEdit"
></equity-dialog>
</div> </div>
</template> </template>
...@@ -125,14 +142,20 @@ export default { ...@@ -125,14 +142,20 @@ export default {
mixins: [carMixin, goodsMixin], mixins: [carMixin, goodsMixin],
data () { data () {
return { return {
showDialog: false,
isEdit: false,
dialogType: 1,
editData: {}
} }
}, },
mounted () { mounted () {
}, },
methods: { methods: {
addEquity (type) {
this.dialogType = type
this.showDialog = true
},
setTop (id, type) { setTop (id, type) {
let target = type == 'car' ? carEquityManageApi : goodsEquityManageApi let target = type == 'car' ? carEquityManageApi : goodsEquityManageApi
target.setTop({ id }).then(({ code, message }) => { target.setTop({ id }).then(({ code, message }) => {
...@@ -144,6 +167,11 @@ export default { ...@@ -144,6 +167,11 @@ export default {
} }
}) })
}, },
editEquity (data, type) {
this.editData = data
this.isEdit = true
this.addEquity(type)
},
updateShelves ({ id, status }, type) { updateShelves ({ id, status }, type) {
let target = type == 'car' ? carEquityManageApi : goodsEquityManageApi let target = type == 'car' ? carEquityManageApi : goodsEquityManageApi
status = status == 1 ? 0 : 1 status = status == 1 ? 0 : 1
...@@ -228,7 +256,7 @@ export default { ...@@ -228,7 +256,7 @@ export default {
.tag-hover .mask { .tag-hover .mask {
display: flex !important; display: flex !important;
} }
.el-tag .mask div:hover { .el-tag .mask span:hover {
color: #409eff; color: #409eff;
} }
.addTag { .addTag {
......
...@@ -23,7 +23,10 @@ ...@@ -23,7 +23,10 @@
label="产品提供方" label="产品提供方"
required required
> >
<el-select v-model="ruleForm.supplier"> <el-select
v-model="ruleForm.supplier"
:disabled="isEdit"
>
<el-option <el-option
label="海威" label="海威"
value="HW" value="HW"
...@@ -34,7 +37,10 @@ ...@@ -34,7 +37,10 @@
label="商品形态" label="商品形态"
required required
> >
<el-radio-group v-model="ruleForm.appearance"> <el-radio-group
v-model="ruleForm.appearance"
:disabled="isEdit"
>
<el-radio-button label="1">卡券</el-radio-button> <el-radio-button label="1">卡券</el-radio-button>
<el-radio-button label="2">直充</el-radio-button> <el-radio-button label="2">直充</el-radio-button>
</el-radio-group> </el-radio-group>
...@@ -48,10 +54,11 @@ ...@@ -48,10 +54,11 @@
filterable filterable
v-model="ruleForm.brandName" v-model="ruleForm.brandName"
@change="changeBrandName" @change="changeBrandName"
:disabled="isEdit"
> >
<el-option <el-option
v-for="item in brandNameList" v-for="item in brandNameList"
:key="item.id" :key="item.brandId"
:label="item.brandName" :label="item.brandName"
:value="item.brandId" :value="item.brandId"
> >
...@@ -75,6 +82,7 @@ ...@@ -75,6 +82,7 @@
> >
<el-input <el-input
v-model="ruleForm.productId" v-model="ruleForm.productId"
:disabled="isEdit"
placeholder="365淘券所对应的商品编码" placeholder="365淘券所对应的商品编码"
maxlength="20" maxlength="20"
@blur="getEquityOutGoodsBySupplierProductId" @blur="getEquityOutGoodsBySupplierProductId"
...@@ -87,7 +95,6 @@ ...@@ -87,7 +95,6 @@
> >
<el-upload <el-upload
class="avatar-uploader" class="avatar-uploader"
action="#"
:show-file-list="false" :show-file-list="false"
:before-upload="upLoadImg" :before-upload="upLoadImg"
> >
...@@ -111,7 +118,10 @@ ...@@ -111,7 +118,10 @@
prop="denomination" prop="denomination"
required required
> >
<el-input v-model.number="ruleForm.denomination"> <el-input
v-model.number="ruleForm.denomination"
:disabled="isEdit"
>
<span slot="suffix"> <span slot="suffix">
元 元
</span> </span>
...@@ -122,7 +132,10 @@ ...@@ -122,7 +132,10 @@
prop="salesPrice" prop="salesPrice"
required required
> >
<el-input v-model.number="ruleForm.salesPrice"> <el-input
v-model.number="ruleForm.salesPrice"
:disabled="isEdit"
>
<span slot="suffix"> <span slot="suffix">
元 元
</span> </span>
...@@ -133,7 +146,11 @@ ...@@ -133,7 +146,11 @@
prop="costPrice" prop="costPrice"
required required
> >
<el-input v-model.number="ruleForm.costPrice">
<el-input
v-model.number="ruleForm.costPrice"
:disabled="isEdit"
>
<span slot="suffix"> <span slot="suffix">
元 元
</span> </span>
...@@ -144,7 +161,11 @@ ...@@ -144,7 +161,11 @@
prop="lineationPrice" prop="lineationPrice"
required required
> >
<el-input v-model.number="ruleForm.lineationPrice">
<el-input
v-model.number="ruleForm.lineationPrice"
:disabled="isEdit"
>
<span slot="suffix"> <span slot="suffix">
元 元
</span> </span>
...@@ -155,12 +176,18 @@ ...@@ -155,12 +176,18 @@
prop="warrantyPeriod" prop="warrantyPeriod"
:required="ruleForm.appearance == 1" :required="ruleForm.appearance == 1"
> >
<el-input v-model.number="ruleForm.warrantyPeriod"> <el-input
v-model.number="ruleForm.warrantyPeriod"
:disabled="isEdit"
>
<template slot="append">小时</template> <template slot="append">小时</template>
</el-input> </el-input>
</el-form-item> </el-form-item>
<el-form-item label="商品有效期"> <el-form-item label="商品有效期">
<el-input v-model.number="ruleForm.validityPeriod"> <el-input
v-model.number="ruleForm.validityPeriod"
:disabled="isEdit"
>
<template slot="prepend">兑换到账户内</template> <template slot="prepend">兑换到账户内</template>
<template slot="append">天有效</template> <template slot="append">天有效</template>
</el-input> </el-input>
...@@ -182,6 +209,7 @@ ...@@ -182,6 +209,7 @@
<quill-editor <quill-editor
v-model="ruleForm.buysNotes" v-model="ruleForm.buysNotes"
:options="editorOption" :options="editorOption"
:disabled="isEdit"
> >
</quill-editor> </quill-editor>
</el-form-item> </el-form-item>
...@@ -195,6 +223,7 @@ ...@@ -195,6 +223,7 @@
<quill-editor <quill-editor
v-model="ruleForm.useNotes" v-model="ruleForm.useNotes"
:options="editorOption" :options="editorOption"
:disabled="isEdit"
> >
</quill-editor> </quill-editor>
</el-form-item> </el-form-item>
...@@ -207,6 +236,7 @@ ...@@ -207,6 +236,7 @@
<quill-editor <quill-editor
v-model="ruleForm.useNotes" v-model="ruleForm.useNotes"
:options="editorOption" :options="editorOption"
:disabled="isEdit"
> >
</quill-editor> </quill-editor>
</el-form-item> </el-form-item>
...@@ -216,7 +246,7 @@ ...@@ -216,7 +246,7 @@
type="primary" type="primary"
@click="onSubmit" @click="onSubmit"
>提交</el-button> >提交</el-button>
<el-button>保存</el-button> <el-button @click="onSubmit">保存</el-button>
</el-form-item> </el-form-item>
</div> </div>
</el-form> </el-form>
...@@ -269,6 +299,7 @@ export default { ...@@ -269,6 +299,7 @@ export default {
name: '', name: '',
data () { data () {
return { return {
isEdit: false,
resetTime: new Date().getTime(), resetTime: new Date().getTime(),
editorOption: { editorOption: {
modules: { modules: {
...@@ -284,7 +315,6 @@ export default { ...@@ -284,7 +315,6 @@ export default {
] ]
} }
}, },
ruleForm: { ruleForm: {
supplier: 'HW', supplier: 'HW',
appearance: 1, appearance: 1,
...@@ -332,6 +362,7 @@ export default { ...@@ -332,6 +362,7 @@ export default {
let { id } = this.getParams() let { id } = this.getParams()
if (id) { if (id) {
this.getEquityGoodsById(id) this.getEquityGoodsById(id)
this.isEdit = true
} else { } else {
this.getListWithPageOutGoods() this.getListWithPageOutGoods()
} }
...@@ -343,6 +374,10 @@ export default { ...@@ -343,6 +374,10 @@ export default {
if (code == 0) { if (code == 0) {
Object.keys(data).map(key => { Object.keys(data).map(key => {
if (data[key] == null) delete data[key] if (data[key] == null) delete data[key]
let ketList = 'denomination|salesPrice|costPrice|lineationPrice|'
if (ketList.indexOf(`${key}|`) != -1) {
data[key] = Number(data[key])
}
}) })
this.ruleForm = data this.ruleForm = data
} else { } else {
...@@ -404,8 +439,12 @@ export default { ...@@ -404,8 +439,12 @@ export default {
let imgUrl = img.target.result.split(',')[1] let imgUrl = img.target.result.split(',')[1]
commonApi.upLoadImg({ commonApi.upLoadImg({
file: `${type}@${imgUrl}` file: `${type}@${imgUrl}`
}).then(res => { }).then(({ code, data, message }) => {
console.log(res) if (code == 0) {
window.vm.$set(this.ruleForm, 'goodsImage', data)
} else {
this.$message.error(message)
}
}) })
} }
} }
...@@ -416,7 +455,10 @@ export default { ...@@ -416,7 +455,10 @@ export default {
console.log('error submit!!') console.log('error submit!!')
return false return false
} else { } else {
console.log() if (this.isEdit) {
this.createGoods('updateGoods')
return
}
let { supplier, brandId, productId } = this.ruleForm let { supplier, brandId, productId } = this.ruleForm
orderApi.sameGoodsCheck({ orderApi.sameGoodsCheck({
supplier, supplier,
...@@ -435,7 +477,7 @@ export default { ...@@ -435,7 +477,7 @@ export default {
return return
} }
if (_res.errId == -1006) { if (_res.errId == -1006) {
this.$confirm(_res.errId, '提示', { this.$confirm(_res.message, '提示', {
confirmButtonText: '保存', confirmButtonText: '保存',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning', type: 'warning',
...@@ -444,7 +486,7 @@ export default { ...@@ -444,7 +486,7 @@ export default {
this.createGoods() this.createGoods()
}) })
} else if (_res.errId = -1003) { } else if (_res.errId = -1003) {
this.$confirm(_res.errId, '提示', { this.$confirm(_res.message, '提示', {
confirmButtonText: '提交', confirmButtonText: '提交',
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning', type: 'warning',
...@@ -461,8 +503,8 @@ export default { ...@@ -461,8 +503,8 @@ export default {
} }
}) })
}, },
createGoods () { createGoods (name = 'createGoods') {
orderApi.createGoods(this.ruleForm).then(({ code, message }) => { orderApi[name](this.ruleForm).then(({ code, message }) => {
if (code == 0) { if (code == 0) {
window.location.href = './index.html' window.location.href = './index.html'
} else { } else {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!