Commit 84d7ffd2 by liwk

权益管理页面

1 parent a49581dc
......@@ -70,6 +70,22 @@ export const orderApi = {
}) {
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 = {
// /**获取财务管理列表*/
......
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
<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
......@@ -81,6 +81,14 @@
财务管理
</a>
</li>
<li>
<a
href="../equity/list.html"
target="_self"
>
权益管理
</a>
</li>
</ul>
</el-card>
</div>
......
......@@ -6,6 +6,7 @@
ref="ruleForm"
label-width="150px"
size="medium"
:key="resetTime"
>
<div class="box">
<div class="title">商品类型</div>
......@@ -46,12 +47,13 @@
<el-select
filterable
v-model="ruleForm.brandName"
@change="changeBrandName"
>
<el-option
v-for="item in brandNameList"
:key="item.id"
:label="item.brandName"
:value="item.id"
:value="item.brandId"
>
</el-option>
</el-select>
......@@ -75,11 +77,13 @@
v-model="ruleForm.productId"
placeholder="365淘券所对应的商品编码"
maxlength="20"
@blur="getEquityOutGoodsBySupplierProductId"
></el-input>
</el-form-item>
<el-form-item
label="商品图片"
:required="ruleForm.appearance == 1"
prop="goodsImage"
>
<el-upload
class="avatar-uploader"
......@@ -223,16 +227,49 @@
import { orderApi, commonApi } from '@api/api'
const validatorWarrantyPeriod = (rule, value, callback) => {
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 {
callback()
}
}
export default {
name: '',
data () {
return {
resetTime: new Date().getTime(),
editorOption: {
modules: {
toolbar: [
......@@ -251,8 +288,6 @@ export default {
ruleForm: {
supplier: 'HW',
appearance: 1,
brandName: ''
},
stock: '',
brandNameList: [],
......@@ -266,28 +301,55 @@ export default {
productId: [
{ required: true, message: '请输入商品编码', trigger: 'blur' },
],
goodsImage: [
{ validator: validatorgoodsImage },
],
denomination: [
{ required: true, message: '请输入直值面额', trigger: 'blur' },
{ required: true, type: 'number', message: '请输入直值面额', trigger: 'blur' },
],
salesPrice: [
{ required: true, message: '请输入销售价', trigger: 'blur' },
{ required: true, type: 'number', message: '请输入销售价', trigger: 'blur' },
],
costPrice: [
{ required: true, message: '请输入成本含税价', trigger: 'blur' },
{ required: true, type: 'number', message: '请输入成本含税价', trigger: 'blur' },
],
lineationPrice: [
{ required: true, message: '请输入官方价/划线价', trigger: 'blur' },
{ required: true, type: 'number', message: '请输入官方价/划线价', trigger: 'blur' },
],
warrantyPeriod: [
{ validator: validatorWarrantyPeriod, trigger: 'blur' },
{ validator: validatorWarrantyPeriod, type: 'number', trigger: 'blur' },
],
buysNotes: [
{ validator: validatorbuysNotes },
],
useNotes: [
{ validator: validatoruseNotes },
]
},
}
},
mounted () {
this.getListWithPageOutGoods()
let { id } = this.getParams()
if (id) {
this.getEquityGoodsById(id)
} else {
this.getListWithPageOutGoods()
}
},
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 () {
orderApi.getListWithPageOutGoods().then(({ code, data: { list } }) => {
if (code == 0) {
......@@ -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) {
let fileName = file.name
if (file.name.lastIndexOf('.') === -1) {
......@@ -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>
......
......@@ -106,7 +106,8 @@
<el-button
type="text"
@click="jump(scope.scope)"
>查看详情</el-button>
>编辑</el-button>
<el-button type="text">复制</el-button>
</span>
<template slot='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!