刘翔宇-旅管家 3 years ago
parent 0ca0ded33f
commit e4363d1e82

@ -220,7 +220,6 @@ import addCommonServiceProduct from '@/views/productService/components/common/ad
}) })
this.total = res.total this.total = res.total
this.list = res.rows this.list = res.rows
console.log(res)
}, },
destroyProduct(row) { destroyProduct(row) {

@ -268,7 +268,7 @@ export default {
fee:'', fee:'',
sharing:'', sharing:'',
maxQuantity:'', maxQuantity:'',
limitQuantity:'', limitQuantity:'1',
pretendQuantity:0, pretendQuantity:0,
time:[], time:[],
sortnumber:0, sortnumber:0,
@ -342,7 +342,7 @@ export default {
this.typeChange(res?.product_type_pid) this.typeChange(res?.product_type_pid)
this.form = { this.form = {
name:res?.name, name:res?.name,
poster:res?.poster_url, poster:res?.poster,
merchantId:{ merchantId:{
label:res.merchant.name, label:res.merchant.name,
value:res.merchant.id value:res.merchant.id

@ -164,49 +164,44 @@
</template> </template>
<template v-slot:set_list> <template v-slot:set_list>
<div class="xy-table-item"> <div class="xy-table-item-label"> <div class="xy-table-item">
明细 <div class="xy-table-item-label">
明细
</div> </div>
<div class="xy-table-item-content"> <div class="xy-table-item-content">
<Button type="primary" icon="md-add" @click="addListCombo" style="margin-bottom: 10px">新增</Button> <Button type="primary" icon="md-add" @click="addListCombo" style="margin-bottom: 10px">新增</Button>
<xy-table :height="260" :is-page="false" :list="form.set_list" :table-item="tableCombo"> <xy-table :height="260" :is-page="false" :list="form.set_list" :table-item="tableCombo">
<template v-slot:btns> <template v-slot:btns>
<el-table-column label="操作" width="90" header-align="center" align="center"> <el-table-column label="操作" width="90" header-align="center" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<Button size="small" type="primary" ghost @click="deleteCombo(scope)"></Button> <Button size="small" type="primary" ghost @click="deleteCombo(scope)"></Button>
</template>
</el-table-column>
</template> </template>
</el-table-column> </xy-table>
</template> </div>
</xy-table> </div>
</div> </template>
</div>
</template>
<template v-slot:picture_list>
<div class="xy-table-item">
<template v-slot:picture_list> <div class="xy-table-item-label">
<div class="xy-table-item"> <div class="xy-table-item-label"> 图集
图集 </div>
</div> <div class="xy-table-item-content">
<div class="xy-table-item-content">
<el-upload class="upload-demo" :action="action" :before-upload="pichandleBefore"
<el-upload :on-success="pichandleSuccess" :on-preview="pichandlePreview" :before-remove="pichandleBeforeRemove"
class="upload-demo" :on-remove="pichandleRemove" :file-list="picfileList" list-type="picture" multiple>
:action="action" <el-button size="small" type="primary">点击上传</el-button>
:before-upload="pichandleBefore" <div slot="tip" class="el-upload__tip">只能上传jpg/png文件或者视频文件且不超过10M</div>
:on-success="pichandleSuccess" </el-upload>
:on-preview="pichandlePreview" </div>
:before-remove="pichandleBeforeRemove" </div>
:on-remove="pichandleRemove" </template>
:file-list="picfileList"
list-type="picture" multiple>
<el-button size="small" type="primary">点击上传</el-button>
<div slot="tip" class="el-upload__tip">只能上传jpg/png文件或者视频文件且不超过2M</div>
</el-upload>
</div>
</div>
</template>
@ -218,7 +213,9 @@
import { import {
store, store,
show, show,
save save,
getPicture,
getCombo
} from "@/api/productService/commonServiceProduct" } from "@/api/productService/commonServiceProduct"
import { import {
index as clubIndex index as clubIndex
@ -236,38 +233,61 @@
tinymce tinymce
}, },
data() { data() {
return { return {
picfileList:[], picfileList: [],
id: '', id: '',
isShow: false, isShow: false,
type: '', type: '',
listCombo:[], listCombo: [],
tableCombo:[ tableCombo: [{
{ label: '名称',
label:'名称', sortable: false,
sortable:false, minWidth: 220,
minWidth:220, customFn: (row) => {
customFn:(row)=>{ return ( <
return ( div >
<div> <el-input size = 'small'
<el-input size='small' placeholder="请输入名称" value={row.name} on={{['input']:(e)=>{row.name = e}}}/> placeholder = "请输入名称"
</div> value = {
) row.name
} }
}, on = {
{ {
label:'内容', ['input']: (e) => {
sortable:false, row.name = e
minWidth:420, }
customFn:(row)=>{ }
return ( }
<div> /> < /
<el-input size='small' placeholder="请输入内容" value={row.content} on={{['input']:(e)=>{row.content = e}}}/> div >
</div> )
) }
} },
} {
], label: '内容',
sortable: false,
minWidth: 420,
customFn: (row) => {
return ( <
div >
<el-input size = 'small'
placeholder = "请输入内容"
value = {
row.content
}
on = {
{
['input']: (e) => {
row.content = e
}
}
}
/> < /
div >
)
}
}
],
action: `${process.env.VUE_APP_BASE_API}api/admin/upload-file`, action: `${process.env.VUE_APP_BASE_API}api/admin/upload-file`,
clubSelect: { clubSelect: {
@ -290,9 +310,9 @@
coverPicture: '', coverPicture: '',
timeLimit: '', timeLimit: '',
content: '', content: '',
video: "", video: "",
set_list:[], set_list: [],
picture_list:[] picture_list: []
}, },
rules: { rules: {
name: [{ name: [{
@ -314,40 +334,40 @@
} }
} }
}, },
methods: { methods: {
pichandleBefore(file){ pichandleBefore(file) {
console.log(file) console.log(file)
if((file.size/1000) > 10240){ if ((file.size / 1000) > 10240) {
Message({ Message({
type:'warning', type: 'warning',
message:'上传文件大小超过2M' message: '上传文件大小超过10M'
}) })
return false return false
} }
}, },
pichandleRemove(file, fileList) { pichandleRemove(file, fileList) {
//console.log(file, fileList); //console.log(file, fileList);
}, },
pichandlePreview(file) { pichandlePreview(file) {
console.log(file); console.log(file);
}, },
pichandleSuccess(response, file, fileList){ pichandleSuccess(response, file, fileList) {
this.picfileList.push(response.url) this.picfileList.push(response.url)
}, },
pichandleBeforeRemove(file){ pichandleBeforeRemove(file) {
this.picfileList.splice(this.picfileList.indexOf(file.response.id),1) this.picfileList.splice(this.picfileList.indexOf(file.response.id), 1)
},
addListCombo() {
this.form.set_list.push({
name: '',
content: ''
})
},
deleteCombo(scope) {
this.form.set_list.splice(scope.$index, 1)
}, },
addListCombo(){
this.form.set_list.push({
name:'',
content:''
})
},
deleteCombo(scope){
this.form.set_list.splice(scope.$index,1)
},
// //
uploadFailVideo(err) { uploadFailVideo(err) {
console.log(err) console.log(err)
@ -444,7 +464,9 @@
coverPicture: res?.cover_picture, coverPicture: res?.cover_picture,
timeLimit: res?.time_limit?.split(','), timeLimit: res?.time_limit?.split(','),
content: res?.content, content: res?.content,
video: res?.video video: res?.video,
set_list: [],
picture_list: []
} }
this.$refs['tinymce'].setContent(this.form.content) this.$refs['tinymce'].setContent(this.form.content)
}, },
@ -453,13 +475,39 @@
this.clubSelect.page++ this.clubSelect.page++
this.getClubs() this.getClubs()
}, },
async getCombo() {
let list = []
const res = await getCombo({
common_products_id: this.id
})
list.push(...res);
return list;
},
async getPic() {
let list = []
const res = await getPicture({
common_products_id: this.id
})
list.push(...res.map(item => {
return {
url: item.picture,
name: item.name || item.picture,
id: item.id
}
}))
return list;
},
submit() {
let list = [];
submit() {
let list=[];
let _form = { let _form = {
name: this.form.name, name: this.form.name,
room_type: this.form.roomType, room_type: this.form.roomType,
@ -475,9 +523,9 @@
price: this.form.price, price: this.form.price,
room_area: this.form.roomArea, room_area: this.form.roomArea,
time_limit: this.form.timeLimit?.toString(), time_limit: this.form.timeLimit?.toString(),
video: this.form.video, video: this.form.video,
set_list:this.form.set_list, set_list: this.form.set_list,
picture_list:list picture_list: list
} }
if (this.type === 'add') { if (this.type === 'add') {
store(_form).then(res => { store(_form).then(res => {

Loading…
Cancel
Save