diff --git a/src/views/productService/commonServiceProduct.vue b/src/views/productService/commonServiceProduct.vue index 1306027..fa06077 100644 --- a/src/views/productService/commonServiceProduct.vue +++ b/src/views/productService/commonServiceProduct.vue @@ -220,7 +220,6 @@ import addCommonServiceProduct from '@/views/productService/components/common/ad }) this.total = res.total this.list = res.rows - console.log(res) }, destroyProduct(row) { diff --git a/src/views/productService/components/addProduct.vue b/src/views/productService/components/addProduct.vue index cafe0ff..b8f868b 100644 --- a/src/views/productService/components/addProduct.vue +++ b/src/views/productService/components/addProduct.vue @@ -268,7 +268,7 @@ export default { fee:'', sharing:'', maxQuantity:'', - limitQuantity:'', + limitQuantity:'1', pretendQuantity:0, time:[], sortnumber:0, @@ -342,7 +342,7 @@ export default { this.typeChange(res?.product_type_pid) this.form = { name:res?.name, - poster:res?.poster_url, + poster:res?.poster, merchantId:{ label:res.merchant.name, value:res.merchant.id diff --git a/src/views/productService/components/common/addCommonServiceProduct.vue b/src/views/productService/components/common/addCommonServiceProduct.vue index f33d075..5a56e4e 100644 --- a/src/views/productService/components/common/addCommonServiceProduct.vue +++ b/src/views/productService/components/common/addCommonServiceProduct.vue @@ -164,49 +164,44 @@ + + + + @@ -218,7 +213,9 @@ import { store, show, - save + save, + getPicture, + getCombo } from "@/api/productService/commonServiceProduct" import { index as clubIndex @@ -236,38 +233,61 @@ tinymce }, data() { - return { - picfileList:[], + return { + picfileList: [], id: '', isShow: false, - type: '', - listCombo:[], - tableCombo:[ - { - label:'名称', - sortable:false, - minWidth:220, - customFn:(row)=>{ - return ( -
- {row.name = e}}}/> -
- ) - } - }, - { - label:'内容', - sortable:false, - minWidth:420, - customFn:(row)=>{ - return ( -
- {row.content = e}}}/> -
- ) - } - } - ], + type: '', + listCombo: [], + tableCombo: [{ + label: '名称', + sortable: false, + minWidth: 220, + customFn: (row) => { + return ( < + div > + { + row.name = e + } + } + } + /> < / + div > + ) + } + }, + { + label: '内容', + sortable: false, + minWidth: 420, + customFn: (row) => { + return ( < + div > + { + row.content = e + } + } + } + /> < / + div > + ) + } + } + ], action: `${process.env.VUE_APP_BASE_API}api/admin/upload-file`, clubSelect: { @@ -290,9 +310,9 @@ coverPicture: '', timeLimit: '', content: '', - video: "", - set_list:[], - picture_list:[] + video: "", + set_list: [], + picture_list: [] }, rules: { name: [{ @@ -314,40 +334,40 @@ } } }, - methods: { - pichandleBefore(file){ - console.log(file) - if((file.size/1000) > 10240){ - Message({ - type:'warning', - message:'上传文件大小超过2M!' - }) - return false - } - }, - pichandleRemove(file, fileList) { - //console.log(file, fileList); - }, - pichandlePreview(file) { - console.log(file); - }, - pichandleSuccess(response, file, fileList){ - this.picfileList.push(response.url) - }, - pichandleBeforeRemove(file){ - this.picfileList.splice(this.picfileList.indexOf(file.response.id),1) + methods: { + pichandleBefore(file) { + console.log(file) + if ((file.size / 1000) > 10240) { + Message({ + type: 'warning', + message: '上传文件大小超过10M!' + }) + return false + } + }, + pichandleRemove(file, fileList) { + //console.log(file, fileList); + }, + pichandlePreview(file) { + console.log(file); + }, + pichandleSuccess(response, file, fileList) { + this.picfileList.push(response.url) + }, + pichandleBeforeRemove(file) { + 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) { console.log(err) @@ -444,7 +464,9 @@ coverPicture: res?.cover_picture, timeLimit: res?.time_limit?.split(','), content: res?.content, - video: res?.video + video: res?.video, + set_list: [], + picture_list: [] } this.$refs['tinymce'].setContent(this.form.content) }, @@ -453,13 +475,39 @@ this.clubSelect.page++ 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 = { name: this.form.name, room_type: this.form.roomType, @@ -475,9 +523,9 @@ price: this.form.price, room_area: this.form.roomArea, time_limit: this.form.timeLimit?.toString(), - video: this.form.video, - set_list:this.form.set_list, - picture_list:list + video: this.form.video, + set_list: this.form.set_list, + picture_list: list } if (this.type === 'add') { store(_form).then(res => {