Commit 84d7ffd2 by liwk

权益管理页面

1 parent a49581dc
...@@ -70,6 +70,22 @@ export const orderApi = { ...@@ -70,6 +70,22 @@ export const orderApi = {
}) { }) {
return request(data, 'dj.api.scrm.goods.listWithPageOutGoods') return request(data, 'dj.api.scrm.goods.listWithPageOutGoods')
}, },
/**商品编号获取商品信息(第三方)*/
getEquityOutGoodsBySupplierProductId(data = {}) {
return request(data, 'dj.api.scrm.goods.getEquityOutGoodsBySupplierProductId')
},
/** 同渠道商品编码校验*/
sameGoodsCheck(data = {}) {
return request(data, 'dj.api.scrm.goods.sameGoodsCheck')
},
/** 库存与下架校验*/
stockAndStatusCheck(data = {}) {
return request(data, 'dj.api.scrm.goods.stockAndStatusCheck')
},
/**商品新增*/
createGoods(data = {}) {
return request(data, 'dj.api.scrm.goods.insert')
},
} }
// export const orderApi = { // export const orderApi = {
// /**获取财务管理列表*/ // /**获取财务管理列表*/
......
import App from './index.vue'
import base from '@/base'
import GlsxVueCommon from 'glsx-vue-common'
base.getConfig().then(data => {
console.log(data);
const { vue, config } = data
vue.use(GlsxVueCommon, config)
base.render(App)
})
\ No newline at end of file \ No newline at end of file
<template>
<div class="layout">
<div class="box">
<div class="equity-title">汽车权益</div>
<div class="add-box">
<el-button type="primary">添加</el-button>
</div>
<div class="table-box">
<d2-table
ref="carTable"
:tableParams="carTableParams"
:hasPage="false"
:hasNum="false"
>
<span
slot="auth-button"
slot-scope="scope"
:data="scope.scope"
>
<el-button type="text">编辑</el-button>
<el-button type="text">下架</el-button>
<el-button type="text">置顶</el-button>
</span>
</d2-table>
</div>
</div>
<div class="box">
<div class="equity-title">商品权益</div>
<div class="tags-box">
<template v-for="(item,index) in tags">
<el-tag
:key="index"
type="info"
>{{item.goodsCategory}}</el-tag>
</template>
<el-button
class="addTag"
size="small"
@click="showInput"
>添加分类</el-button>
</div>
<div class="add-box">
<el-button type="primary">添加</el-button>
</div>
<div class="table-box">
<d2-table
ref="carTable"
:tableParams="goodsTableParams"
:hasPage="false"
:hasNum="false"
>
<span
slot="auth-button"
slot-scope="scope"
:data="scope.scope"
>
<el-button type="text">编辑</el-button>
<el-button type="text">下架</el-button>
<el-button type="text">置顶</el-button>
</span>
</d2-table>
</div>
</div>
</div>
</template>
<script type='text/ecmascript-6'>
import { orderApi } from '@api/api'
export default {
name: '',
data () {
return {
tags: [{ goodsCategory: '恒河猴' }, { goodsCategory: '恒河猴2' }],
carTableParams: {
tableOption: true,
tableColumns: [
{
label: '权益名称',
prop: 'salesPrice',
minWidth: '200',
},
{
label: '权益描述',
prop: 'salesPrice',
minWidth: '200',
},
{
label: '权益图标\n(80*80,支持JPG、PNG、GIF)',
minWidth: '200',
formatter: (cell) => {
}
},
{
label: '服务提供方',
prop: 'salesPrice',
minWidth: '200',
},
]
},
goodsTableParams: {
tableOption: true,
tableColumns: [
{
label: '权益名称',
prop: 'salesPrice',
minWidth: '200',
},
{
label: '权益描述',
prop: 'salesPrice',
minWidth: '200',
},
{
label: '权益图标\n(80*80,支持JPG、PNG、GIF)',
minWidth: '200',
formatter: (cell) => {
}
},
{
label: '品牌名称',
prop: 'salesPrice',
minWidth: '200',
},
{
label: '产品提供方',
prop: 'salesPrice',
minWidth: '200',
},
]
}
}
},
mounted () {
},
methods: {
}
}
</script>
<style src="@a/css/tao.css"></style>
<style scoped>
.equity-title {
height: 44px;
line-height: 44px;
background-color: rgb(242, 242, 242);
padding-left: 40px;
}
.add-box,
.tags-box {
padding: 20px 0 10px;
}
.el-tag + .el-tag {
margin-left: 10px;
}
.addTag {
margin-left: 10px;
}
</style>
\ No newline at end of file \ No newline at end of file
...@@ -81,6 +81,14 @@ ...@@ -81,6 +81,14 @@
财务管理 财务管理
</a> </a>
</li> </li>
<li>
<a
href="../equity/list.html"
target="_self"
>
权益管理
</a>
</li>
</ul> </ul>
</el-card> </el-card>
</div> </div>
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
ref="ruleForm" ref="ruleForm"
label-width="150px" label-width="150px"
size="medium" size="medium"
:key="resetTime"
> >
<div class="box"> <div class="box">
<div class="title">商品类型</div> <div class="title">商品类型</div>
...@@ -46,12 +47,13 @@ ...@@ -46,12 +47,13 @@
<el-select <el-select
filterable filterable
v-model="ruleForm.brandName" v-model="ruleForm.brandName"
@change="changeBrandName"
> >
<el-option <el-option
v-for="item in brandNameList" v-for="item in brandNameList"
:key="item.id" :key="item.id"
:label="item.brandName" :label="item.brandName"
:value="item.id" :value="item.brandId"
> >
</el-option> </el-option>
</el-select> </el-select>
...@@ -75,11 +77,13 @@ ...@@ -75,11 +77,13 @@
v-model="ruleForm.productId" v-model="ruleForm.productId"
placeholder="365淘券所对应的商品编码" placeholder="365淘券所对应的商品编码"
maxlength="20" maxlength="20"
@blur="getEquityOutGoodsBySupplierProductId"
></el-input> ></el-input>
</el-form-item> </el-form-item>
<el-form-item <el-form-item
label="商品图片" label="商品图片"
:required="ruleForm.appearance == 1" :required="ruleForm.appearance == 1"
prop="goodsImage"
> >
<el-upload <el-upload
class="avatar-uploader" class="avatar-uploader"
...@@ -223,16 +227,49 @@ ...@@ -223,16 +227,49 @@
import { orderApi, commonApi } from '@api/api' import { orderApi, commonApi } from '@api/api'
const validatorWarrantyPeriod = (rule, value, callback) => { const validatorWarrantyPeriod = (rule, value, callback) => {
if (window.vm.$children[0].ruleForm.appearance == 1) { if (window.vm.$children[0].ruleForm.appearance == 1) {
if (!value) callback('请输入商品质保期') if (!value) {
callback('请输入商品质保期')
} else {
callback()
}
} else {
callback()
}
}
const validatorbuysNotes = (rule, value, callback) => {
if (!value) {
callback('请输入购买页使用须知')
} else {
callback()
}
}
const validatoruseNotes = (rule, value, callback) => {
if (window.vm.$children[0].ruleForm.appearance == 1) {
if (!value) {
callback('请输入卡券页使用须知')
} else {
callback()
}
} else {
callback()
}
}
const validatorgoodsImage = (rule, value, callback) => {
if (window.vm.$children[0].ruleForm.appearance == 1) {
if (!value) {
callback('请上传商品图片')
} else {
callback()
}
} else { } else {
callback() callback()
} }
} }
export default { export default {
name: '', name: '',
data () { data () {
return { return {
resetTime: new Date().getTime(),
editorOption: { editorOption: {
modules: { modules: {
toolbar: [ toolbar: [
...@@ -251,8 +288,6 @@ export default { ...@@ -251,8 +288,6 @@ export default {
ruleForm: { ruleForm: {
supplier: 'HW', supplier: 'HW',
appearance: 1, appearance: 1,
brandName: ''
}, },
stock: '', stock: '',
brandNameList: [], brandNameList: [],
...@@ -266,28 +301,55 @@ export default { ...@@ -266,28 +301,55 @@ export default {
productId: [ productId: [
{ required: true, message: '请输入商品编码', trigger: 'blur' }, { required: true, message: '请输入商品编码', trigger: 'blur' },
], ],
goodsImage: [
{ validator: validatorgoodsImage },
],
denomination: [ denomination: [
{ required: true, message: '请输入直值面额', trigger: 'blur' }, { required: true, type: 'number', message: '请输入直值面额', trigger: 'blur' },
], ],
salesPrice: [ salesPrice: [
{ required: true, message: '请输入销售价', trigger: 'blur' }, { required: true, type: 'number', message: '请输入销售价', trigger: 'blur' },
], ],
costPrice: [ costPrice: [
{ required: true, message: '请输入成本含税价', trigger: 'blur' }, { required: true, type: 'number', message: '请输入成本含税价', trigger: 'blur' },
], ],
lineationPrice: [ lineationPrice: [
{ required: true, message: '请输入官方价/划线价', trigger: 'blur' }, { required: true, type: 'number', message: '请输入官方价/划线价', trigger: 'blur' },
], ],
warrantyPeriod: [ warrantyPeriod: [
{ validator: validatorWarrantyPeriod, trigger: 'blur' }, { validator: validatorWarrantyPeriod, type: 'number', trigger: 'blur' },
], ],
buysNotes: [
{ validator: validatorbuysNotes },
],
useNotes: [
{ validator: validatoruseNotes },
]
}, },
} }
}, },
mounted () { mounted () {
let { id } = this.getParams()
if (id) {
this.getEquityGoodsById(id)
} else {
this.getListWithPageOutGoods() this.getListWithPageOutGoods()
}
}, },
methods: { methods: {
getEquityGoodsById (id) {
orderApi.getEquityGoodsById({ id }).then(({ code, data, message }) => {
if (code == 0) {
Object.keys(data).map(key => {
if (data[key] == null) delete data[key]
})
this.ruleForm = data
} else {
this.$message.error(message)
}
})
},
getListWithPageOutGoods () { getListWithPageOutGoods () {
orderApi.getListWithPageOutGoods().then(({ code, data: { list } }) => { orderApi.getListWithPageOutGoods().then(({ code, data: { list } }) => {
if (code == 0) { if (code == 0) {
...@@ -295,6 +357,34 @@ export default { ...@@ -295,6 +357,34 @@ export default {
} }
}) })
}, },
getEquityOutGoodsBySupplierProductId () {
let { productId } = this.ruleForm
if (!productId) return
orderApi.getEquityOutGoodsBySupplierProductId({
productId,
supplier: 'HW'
}).then(({ code, message, data }) => {
if (code == 0) {
console.log(data)
this.ruleForm.brandName = data.brandName
this.ruleForm.brandId = data.brandId
this.ruleForm.productName = data.productName
this.ruleForm.costPrice = Number(data.officialPrice)
this.resetTime = new Date().getTime()
} else {
this.$message.error(message)
}
})
},
changeBrandName (e) {
console.log(e)
this.brandNameList.map(i => {
if (i.brandId == e) this.ruleForm.brandName = i.brandName
})
},
upLoadImg (file) { upLoadImg (file) {
let fileName = file.name let fileName = file.name
if (file.name.lastIndexOf('.') === -1) { if (file.name.lastIndexOf('.') === -1) {
...@@ -323,7 +413,34 @@ export default { ...@@ -323,7 +413,34 @@ export default {
} }
} }
}, },
onSubmit () { } onSubmit () {
this.$refs.ruleForm.validate((valid) => {
if (!valid) {
console.log('error submit!!')
return false
} else {
console.log()
let { supplier, brandId, productId } = this.ruleForm
orderApi.sameGoodsCheck({
supplier,
brandId,
productId
}).then(res => {
console.log(res)
if (res.code = 0) {
orderApi.stockAndStatusCheck({
productId,
supplier
}).then(_res => {
console.log(_res)
})
} else {
this.$message.error('已存在相同商品编码的商品')
}
})
}
})
}
} }
} }
</script> </script>
......
...@@ -106,7 +106,8 @@ ...@@ -106,7 +106,8 @@
<el-button <el-button
type="text" type="text"
@click="jump(scope.scope)" @click="jump(scope.scope)"
>查看详情</el-button> >编辑</el-button>
<el-button type="text">复制</el-button>
</span> </span>
<template slot='custom'> <template slot='custom'>
<div class="table-custom"> <div class="table-custom">
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!