Commit 5db5764a by wangyalan-git

图片上传添加图片上传类型/商品添加佣金require

parent ff0b91a8
......@@ -14,7 +14,7 @@ module.exports = {
// 代理列表, 是否开启代理通过[./dev.env.js]配置
proxyTable: devEnv.OPEN_PROXY === false ? {} : {
'/proxyApi': {
target: 'http://192.168.31.113:8085/bapi',
target: 'http://192.168.31.108:8085/bapi',
changeOrigin: true,
pathRewrite: {
'^/proxyApi': '/'
......
<template>
<div>
<el-upload
:action="$http.adornUrl('/admin/file/upload/element')"
:action="$http.adornUrl(`/fileBapi/upload`)"
:headers="{Authorization: $cookie.get('Authorization')}"
:on-remove="handleRemove"
:on-success="handleUploadSuccess"
......@@ -17,13 +17,21 @@
export default {
data () {
return {
resourcesUrl: window.SITE_CONFIG.resourcesUrl
resourcesUrl: window.SITE_CONFIG.resourcesUrl,
obj: {
fileType: this.fileType,
t: new Date().getTime()
}
}
},
props: {
value: {
default: '',
type: String
},
fileType: {
default: 'default',
type: String
}
},
computed: {
......@@ -42,6 +50,10 @@
methods: {
// 图片上传
handleUploadSuccess (response, file, fileList) {
if (fileList.length) {
fileList[fileList.length - 1].response = fileList[fileList.length - 1].response.result.filePath
// fileList[fileList.length-1].url= fileList[fileList.length-1].response.result.url
}
let files = fileList.map(file => {
return file.response
}).join(',')
......
......@@ -19,14 +19,14 @@
</template>
<script>
export default {
export default {
data () {
return {
dialogImageUrl: '',
dialogVisible: false,
resourcesUrl: window.SITE_CONFIG.resourcesUrl,
obj : {
fileType: 'sku',
obj: {
fileType: this.fileType,
t: new Date().getTime()
}
}
......@@ -35,6 +35,10 @@
value: {
default: '',
type: String
},
fileType: {
default: 'default',
type: String
}
},
computed: {
......@@ -42,9 +46,9 @@
let res = []
if (this.value) {
let imageArray = this.value.split(',')
console.log('imageArray',imageArray)
console.log('imageArray', imageArray)
for (let i = 0; i < imageArray.length; i++) {
res.push({url: this.resourcesUrl + imageArray[i], response: imageArray[i]})
res.push({ url: this.resourcesUrl + imageArray[i], response: imageArray[i] })
}
}
this.$emit('input', this.value)
......@@ -54,9 +58,9 @@
methods: {
// 图片上传
handleUploadSuccess (response, file, fileList) {
console.log('fileList',fileList)
if(fileList.length){
fileList[fileList.length-1].response= fileList[fileList.length-1].response.result.filePath
console.log('fileList', fileList)
if (fileList.length) {
fileList[fileList.length - 1].response = fileList[fileList.length - 1].response.result.filePath
// fileList[fileList.length-1].url= fileList[fileList.length-1].response.result.url
}
let pics = fileList.map(file => {
......@@ -83,7 +87,7 @@
this.dialogVisible = true
}
}
}
}
</script>
<style lang="scss">
......
......@@ -20,8 +20,8 @@ export default {
data () {
return {
resourcesUrl: window.SITE_CONFIG.resourcesUrl,
obj : {
fileType: 'sku',
obj: {
fileType: this.fileType,
t: new Date().getTime()
}
}
......@@ -30,12 +30,16 @@ export default {
value: {
default: '',
type: String
},
fileType: {
default: 'default',
type: String
}
},
methods: {
// 图片上传
handleUploadSuccess (response, file, fileList) {
console.log('file.response',file.response)
console.log('file.response', file.response)
this.$emit('input', file.response.result.filePath)
},
// 限制图片上传大小
......
......@@ -4,7 +4,7 @@
ref="dataForm"
label-width="140px">
<el-form-item label="产品图片">
<mul-pic-upload v-model="dataForm.imgs"/>
<mul-pic-upload fileType="product" v-model="dataForm.imgs"/>
</el-form-item>
<el-form-item label="状态">
<el-radio-group v-model="dataForm.status">
......@@ -74,14 +74,16 @@
</el-form-item>
<div v-if="dataForm.commissionStatus == 1">
<el-form-item label="佣金类型"
prop="commissionType">
prop="commissionType"
:rules="[{ required: dataForm.commissionStatus == 1 , message: '请选择佣金类型'}]">
<el-radio-group v-model="dataForm.commissionType">
<el-radio :label="0">固定金额</el-radio>
<el-radio :label="1">比例</el-radio>
</el-radio-group>
</el-form-item>
<el-form-item :label="'佣金值'+ (dataForm.commissionType == 1? '(%)': '(元)')"
prop="commission">
prop="commission"
:rules="[{ required: dataForm.commissionStatus == 1 , message: '请输入数字'}]">
<el-col :span="8">
<el-input v-model="dataForm.commission"
onkeyup="this.value = this.value.replace(/[^\d.]/g,'');"
......@@ -90,7 +92,8 @@
</el-col>
</el-form-item>
<el-form-item :label="'每日收益增长'+ (dataForm.commissionType == 1? '(%)': '(元)')"
prop="growthIncome">
prop="growthIncome"
:rules="[{ required: dataForm.commissionStatus == 1 , message: '请输入数字'}]">
<el-col :span="8">
<el-input
onkeyup="this.value = this.value.replace(/[^\d.]/g,'');"
......@@ -101,7 +104,7 @@
</el-form-item>
<el-form-item label="收益上限值(元)"
prop="growthMax"
>
:rules="[{ required: dataForm.commissionStatus == 1 , message: '请输入数字'}]">
<el-col :span="8">
<el-input v-model="dataForm.growthMax"
placeholder="请输入数字"
......
......@@ -16,7 +16,7 @@
label="sku图片"
width="180">
<template slot-scope="scope">
<pic-upload v-model="scope.row.pic">
<pic-upload fileType="sku" v-model="scope.row.pic">
</pic-upload>
</template>
</el-table-column>
......
......@@ -8,7 +8,7 @@
window.SITE_CONFIG['baseUrl'] = 'http://192.168.0.143:8085'
// 静态资源文件url
window.SITE_CONFIG['resourcesUrl'] = 'http://192.168.31.113/zhqgImages'
window.SITE_CONFIG['resourcesUrl'] = 'http://192.168.31.108/zhqgImages'
// cdn地址 = 域名 + 版本号
window.SITE_CONFIG['domain'] = './' // 域名
window.SITE_CONFIG['version'] = '' // 版本号(年月日时分)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment