Commit 5db5764a by wangyalan-git

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

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