|
@@ -2,7 +2,7 @@
|
|
|
<div>
|
|
|
<el-button size="mini" type="primary" @click="editBtn">编 辑</el-button>
|
|
|
<el-drawer
|
|
|
- title="编辑促销方案"
|
|
|
+ title="创建促销方案"
|
|
|
:visible.sync="dialogFormVisible"
|
|
|
size="40%"
|
|
|
direction="rtl"
|
|
@@ -103,6 +103,24 @@
|
|
|
<el-input v-model="form.remarks" type="textarea" rows="5" placeholder="请输入方案描述"></el-input>
|
|
|
</el-form-item>
|
|
|
</el-col>
|
|
|
+ <el-col :span="24">
|
|
|
+ <el-form-item label="封面" prop="cover">
|
|
|
+ <input v-show="false" type="text" v-model="form.cover">
|
|
|
+ <uploadFile
|
|
|
+ :one="true"
|
|
|
+ :multiple="false"
|
|
|
+ ref="upload"
|
|
|
+ style="margin-top:10px"
|
|
|
+ :folderid="folderid"
|
|
|
+ accept=".JPG,.PNG,.jpg,.png"
|
|
|
+ type="image"
|
|
|
+ :bindData="bindData"
|
|
|
+ @onSuccess="uploadSuccess"
|
|
|
+ @deleteSuccess="deleteSuccess"
|
|
|
+ @onChange="coverChange">
|
|
|
+ </uploadFile>
|
|
|
+ </el-form-item>
|
|
|
+ </el-col>
|
|
|
</el-form>
|
|
|
</el-row>
|
|
|
</div>
|
|
@@ -115,9 +133,10 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+import uploadFile from '@/HDrpManagement/promotion/components/upload'
|
|
|
export default {
|
|
|
name: "add",
|
|
|
- components:{},
|
|
|
+ components:{uploadFile},
|
|
|
props:['data'],
|
|
|
data(){
|
|
|
var checkBegTimer = (rule, value, callback) => {
|
|
@@ -138,7 +157,9 @@ export default {
|
|
|
tradefieldList:[],
|
|
|
brandList:[],
|
|
|
accountList:[],
|
|
|
+ bindData:{},
|
|
|
dialogFormVisible:false,
|
|
|
+ folderid:JSON.parse(sessionStorage.getItem('folderid')).appfolderid,
|
|
|
form:{
|
|
|
"sa_promotionid":0, //sat_notice_classid<=0时 为新增
|
|
|
"sa_accountclassid": "",
|
|
@@ -151,7 +172,8 @@ export default {
|
|
|
"orderaddqty": '',
|
|
|
"orderminamount": '',
|
|
|
"begdate": '',
|
|
|
- "enddate": ""
|
|
|
+ "enddate": "",
|
|
|
+ "cover":''
|
|
|
},
|
|
|
rules:{
|
|
|
promname:[
|
|
@@ -186,18 +208,32 @@ export default {
|
|
|
tradefield:[
|
|
|
{ required: true, message: '请选择领域', trigger: 'change'},
|
|
|
],
|
|
|
+ cover:[
|
|
|
+ { required: true, message: '请上传封面', trigger: 'change'},
|
|
|
+ ],
|
|
|
},
|
|
|
}
|
|
|
},
|
|
|
watch: {
|
|
|
dialogFormVisible (val) {
|
|
|
- !val && this.$refs.form.resetFields()
|
|
|
+ if (!val) {
|
|
|
+ this.$refs.form.resetFields()
|
|
|
+ this.$refs.upload.fileLinkList = []
|
|
|
+ this.$refs.upload.$refs.upload.clearFiles()
|
|
|
+ }
|
|
|
}
|
|
|
},
|
|
|
methods:{
|
|
|
editBtn () {
|
|
|
this.dialogFormVisible = true
|
|
|
this.form = Object.assign({},this.form,this.data)
|
|
|
+ this.form.cover = this.form.attinfos
|
|
|
+ console.log(this.form);
|
|
|
+
|
|
|
+ this.$nextTick(() => {
|
|
|
+ this.$refs.upload.fileLinkList = this.form.attinfos
|
|
|
+ this.$refs.upload.fileList = this.form.attinfos
|
|
|
+ })
|
|
|
},
|
|
|
onSubmit(){
|
|
|
console.log(this.form)
|
|
@@ -211,11 +247,23 @@ export default {
|
|
|
this.tool.showMessage(res,()=>{
|
|
|
this.$emit('onSuccess')
|
|
|
this.dialogFormVisible = false
|
|
|
+ this.bindData = {
|
|
|
+ "ownertable": 'sa_promotion',
|
|
|
+ "ownerid": res.data.sa_promotionid,
|
|
|
+ "usetype": 'default',
|
|
|
+ }
|
|
|
+ this.$refs['upload'].toUpload(() => {
|
|
|
+ // this.$emit('onSuccess')
|
|
|
+ this.dialogFormVisible = false
|
|
|
+ })
|
|
|
})
|
|
|
})
|
|
|
},
|
|
|
brandChange (val) {
|
|
|
|
|
|
+ },
|
|
|
+ coverChange (data) {
|
|
|
+ this.form.cover = data
|
|
|
},
|
|
|
/* 领域 */
|
|
|
async getTradefield () {
|
|
@@ -253,6 +301,12 @@ export default {
|
|
|
this.accountList = res.data
|
|
|
console.log(this.accountList,'账户');
|
|
|
|
|
|
+ },
|
|
|
+ uploadSuccess (data) {
|
|
|
+ this.$emit('onSuccess')
|
|
|
+ },
|
|
|
+ deleteSuccess () {
|
|
|
+ this.form.cover = ''
|
|
|
}
|
|
|
},
|
|
|
created() {
|