Browse Source

修改直播添加商品逻辑

master
xuwenbo 4 years ago
parent
commit
e529a4de51
  1. 10
      src/api/yxWechatLive.js
  2. 17
      src/views/components/livegoods/index.vue
  3. 108
      src/views/wechat/live/index.vue

10
src/api/yxWechatLive.js

@ -30,4 +30,12 @@ export function sync() {
method: 'get' method: 'get'
}) })
} }
export default { add, edit, del, sync }
export function addGoods(data) {
return request({
url: 'api/yxWechatLive/addGoods',
method: 'post',
data
})
}
export default { add, edit, del, sync, addGoods }

17
src/views/components/livegoods/index.vue

@ -1,7 +1,7 @@
<template> <template>
<div> <div>
<div> <div>
<ul v-for="(item,index) in newValue" :key="index" class="el-upload-list el-upload-list--picture-card"> <ul v-for="(item,index) in product" :key="index" class="el-upload-list el-upload-list--picture-card">
<li tabindex="0" class="el-upload-list__item is-ready" :style="'width: '+width+'px;height: '+height+'px'"> <li tabindex="0" class="el-upload-list__item is-ready" :style="'width: '+width+'px;height: '+height+'px'">
<div> <div>
<img :src="item.coverImgeUrl" alt="" class="el-upload-list__item-thumbnail"> <img :src="item.coverImgeUrl" alt="" class="el-upload-list__item-thumbnail">
@ -105,12 +105,7 @@ export default {
components: { }, components: { },
mixins: [initData], mixins: [initData],
props: { props: {
value: { product : Array,
type: Array,
default() {
return []
}
},
// //
width: { width: {
type: Number, type: Number,
@ -128,7 +123,7 @@ export default {
}, },
data() { data() {
return { return {
newValue:this.value, product:this.product,
delLoading: false, delLoading: false,
visible: false, visible: false,
queryTypeOptions: [ queryTypeOptions: [
@ -151,13 +146,13 @@ export default {
cancelButtonText: '取消', cancelButtonText: '取消',
type: 'warning' type: 'warning'
}).then(function() { }).then(function() {
that.newValue.splice(index, 1) that.product.splice(index, 1)
that.url = [] that.url = []
}) })
}, },
doSelect() { doSelect() {
this.newValue = this.multipleSelection this.product = this.multipleSelection
this.$emit("selectGoods", this.newValue) this.$emit("selectGoods", this.product)
this.dialog = false this.dialog = false
}, },
handleSelectionChange(val) { handleSelectionChange(val) {

108
src/views/wechat/live/index.vue

@ -46,9 +46,7 @@
<el-form-item label="主播头像" prop="anchorImg" > <el-form-item label="主播头像" prop="anchorImg" >
<MaterialList v-model="form.anchorImgArr" style="width: 370px" type="image" :num="1" :width="150" :height="150" :disabled="isDisabled"/> <MaterialList v-model="form.anchorImgArr" style="width: 370px" type="image" :num="1" :width="150" :height="150" :disabled="isDisabled"/>
</el-form-item> </el-form-item>
<!-- <el-form-item label="选择入库商品" >-->
<!-- <LiveGoods v-model="form.product" @selectGoods="getGoods" > </LiveGoods>-->
<!-- </el-form-item>-->
<el-form-item label="直播间类型" prop="type" > <el-form-item label="直播间类型" prop="type" >
<el-radio-group v-model="form.type":disabled="isDisabled" > <el-radio-group v-model="form.type":disabled="isDisabled" >
<el-radio :label="1" class="radio">推流</el-radio> <el-radio :label="1" class="radio">推流</el-radio>
@ -104,6 +102,20 @@
<el-button :loading="crud.cu === 2" type="primary" @click="crud.submitCU" :disabled="isDisabled">确认</el-button> <el-button :loading="crud.cu === 2" type="primary" @click="crud.submitCU" :disabled="isDisabled">确认</el-button>
</div> </div>
</el-dialog> </el-dialog>
<el-dialog title="修改直播间商品信息"
:visible.sync="closeDialogVisible"
width="40%">
<el-form :model="form"
label-width="150px">
<el-form-item label="选择入库商品" >
<LiveGoods :product="form.product" @selectGoods="getGoods" > </LiveGoods>
</el-form-item>
</el-form>
<span slot="footer" class="dialog-footer">
<el-button @click="closeDialog()"> </el-button>
<el-button type="primary" @click="handleCloseOrder"> </el-button>
</span>
</el-dialog>
<!--表格渲染--> <!--表格渲染-->
<el-table ref="table" v-loading="crud.loading" :data="crud.data" size="small" style="width: 100%;" @selection-change="crud.selectionChangeHandler"> <el-table ref="table" v-loading="crud.loading" :data="crud.data" size="small" style="width: 100%;" @selection-change="crud.selectionChangeHandler">
<el-table-column type="selection" width="55" /> <el-table-column type="selection" width="55" />
@ -157,38 +169,6 @@
<el-tag v-else :type="''">手机直播</el-tag> <el-tag v-else :type="''">手机直播</el-tag>
</div> </div>
</template> </template>
</el-table-column>
<el-table-column v-if="columns.visible('screenType')" prop="screenType" label="横屏、竖屏" >
<template slot-scope="scope">
<div>
<el-tag v-if="scope.row.screenType === 1" :type="''">横屏</el-tag>
<el-tag v-else :type="''">竖屏</el-tag>
</div>
</template>
</el-table-column>
<el-table-column v-if="columns.visible('closeLike')" prop="closeLike" label="点赞" >
<template slot-scope="scope">
<div>
<el-tag v-if="scope.row.closeLike === 1" :type="''">关闭</el-tag>
<el-tag v-else :type="''">开启</el-tag>
</div>
</template>
</el-table-column>
<el-table-column v-if="columns.visible('closeGoods')" prop="closeGoods" label="货架" >
<template slot-scope="scope">
<div>
<el-tag v-if="scope.row.closeGoods === 1" :type="''">关闭</el-tag>
<el-tag v-else :type=" '' ">开启</el-tag>
</div>
</template>
</el-table-column>
<el-table-column v-if="columns.visible('closeComment')" prop="closeComment" label="评论" >
<template slot-scope="scope">
<div>
<el-tag v-if="scope.row.closeComment === 1" :type="''">关闭</el-tag>
<el-tag v-else :type=" '' ">开启</el-tag>
</div>
</template>
</el-table-column> </el-table-column>
<el-table-column v-if="columns.visible('closeReplay')" prop="closeReplay" label="回放" > <el-table-column v-if="columns.visible('closeReplay')" prop="closeReplay" label="回放" >
<template slot-scope="scope"> <template slot-scope="scope">
@ -198,28 +178,21 @@
</div> </div>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column v-if="columns.visible('closeShare')" prop="closeShare" label="分享" >
<template slot-scope="scope">
<div>
<el-tag v-if="scope.row.closeShare === 1" :type="''">关闭</el-tag>
<el-tag v-else :type=" '' ">开启</el-tag>
</div>
</template>
</el-table-column>
<el-table-column v-if="columns.visible('closeKf')" prop="closeKf" label="客服" >
<template slot-scope="scope">
<div>
<el-tag v-if="scope.row.closeKf === 1" :type="''">关闭</el-tag>
<el-tag v-else :type=" '' ">开启</el-tag>
</div>
</template>
</el-table-column>
<el-table-column v-permission="['admin','yxWechatLive:edit','yxWechatLive:del']" label="操作" width="150px" align="center"> <el-table-column v-permission="['admin','yxWechatLive:edit','yxWechatLive:del']" label="操作" width="150px" align="center">
<template slot-scope="scope"> <template slot-scope="scope">
<udOperation <udOperation
:data="scope.row" :data="scope.row"
:permission="permission" :permission="permission"
/> >
</udOperation>
<el-button
size="mini"
type="success"
@click="showCloseOrderDialog(scope.row)"
>
添加商品
</el-button>
</template> </template>
</el-table-column> </el-table-column>
</el-table> </el-table>
@ -240,6 +213,7 @@ import MaterialList from '@/components/material'
import LiveGoods from '@/views/components/livegoods' import LiveGoods from '@/views/components/livegoods'
import udOperation from '@crud/UD.operation' import udOperation from '@crud/UD.operation'
import {formatTimeThree} from '@/utils/index' import {formatTimeThree} from '@/utils/index'
import { addGoods } from '@/api/yxWechatLive'
// crudpresenter // crudpresenter
const defaultCrud = CRUD({ optShow: { const defaultCrud = CRUD({ optShow: {
add: true, add: true,
@ -247,13 +221,14 @@ const defaultCrud = CRUD({ optShow: {
del: false, del: false,
download: true download: true
},title: '直播房间', url: 'api/yxWechatLive', sort: 'room_id,desc', crudMethod: { ...crudYxWechatLive }}) },title: '直播房间', url: 'api/yxWechatLive', sort: 'room_id,desc', crudMethod: { ...crudYxWechatLive }})
const defaultForm = { product: [],roomId: null,productId: null, name: null, coverImge: null, startDate: null, endDate : null,shareImge: null, liveStatus: null, coverImgArr: [],shareImgArr: [],anchorImgArr: [],startTime: null, endTime: null, anchorName: null, anchorWechat: null, anchorImge: null, type: 1, screenType: 0, closeLike: 0,closeGoods: 0, closeComment: 0,closeReplay: 0,closeShare:0,closeKf:0 } const defaultForm = { product: [],roomId: null,productId: null, name: null, coverImge: null, startDate: null, endDate : null,shareImge: null, liveStatus: null, coverImgArr: [],shareImgArr: [],anchorImgArr: [],startTime: null, endTime: null, anchorName: null, anchorWechat: null, anchorImge: null, type: 0, screenType: 0, closeLike: 0,closeGoods: 0, closeComment: 0,closeReplay: 0,closeShare:0,closeKf:0 }
export default { export default {
name: 'YxWechatLive', name: 'YxWechatLive',
components: { pagination, crudOperation, rrOperation ,MaterialList,udOperation,LiveGoods}, components: { pagination, crudOperation, rrOperation ,MaterialList,udOperation,LiveGoods},
mixins: [presenter(defaultCrud), header(), form(defaultForm), crud()], mixins: [presenter(defaultCrud), header(), form(defaultForm), crud()],
data() { data() {
return { return {
closeDialogVisible:false,
disabled: false, disabled: false,
syncLoading: false, syncLoading: false,
permission: { permission: {
@ -309,6 +284,33 @@ export default {
} }
}, },
methods: { methods: {
closeDialog(){
this.form.product = []
this.closeDialogVisible=false;
},
showCloseOrderDialog(row){
this.closeDialogVisible=true;
this.form.roomId = row.id;
this.form.product = row.product
},
handleCloseOrder(){
this.$confirm('是否提交?', '提示', {
confirmButtonText: '确定',
cancelButtonText: '取消',
type: 'warning'
}).then(() => {
let params ={
"roomId": this.form.roomId,
"productId": this.form.productId
}
addGoods(params).then(res=>{
console.log(res,89888)
this.closeDialogVisible=true;
}).catch(err => {
})
});
},
formatTimeThree, formatTimeThree,
getGoods(p) { getGoods(p) {
var ids = [] var ids = []

Loading…
Cancel
Save