Merge remote-tracking branch 'origin/master' into v3.3
This commit is contained in:
@ -8,19 +8,39 @@
|
|||||||
:before-upload="beforeAvatarUpload"
|
:before-upload="beforeAvatarUpload"
|
||||||
:show-file-list="false"
|
:show-file-list="false"
|
||||||
>
|
>
|
||||||
<img v-if="imageUrl" :src="imageUrl" class="single-img__img">
|
<img
|
||||||
<i v-else class="el-icon-upload">
|
v-if="imageUrl"
|
||||||
|
:src="imageUrl"
|
||||||
|
class="single-img__img"
|
||||||
|
>
|
||||||
|
<i
|
||||||
|
v-else
|
||||||
|
class="el-icon-upload"
|
||||||
|
>
|
||||||
<div class="el-upload__text"><em>选择图片</em></div>
|
<div class="el-upload__text"><em>选择图片</em></div>
|
||||||
<div class="el-upload__tip" slot="tip">{{tip}}</div>
|
<div
|
||||||
|
class="el-upload__tip"
|
||||||
|
slot="tip"
|
||||||
|
>{{tip.label}}</div>
|
||||||
</i>
|
</i>
|
||||||
</el-upload>
|
</el-upload>
|
||||||
<div class="overlay" v-if="imageUrl">
|
<div
|
||||||
|
class="overlay"
|
||||||
|
v-if="imageUrl"
|
||||||
|
>
|
||||||
<!-- <i class="iconfont icon-chakan" @click="showImage"></i>
|
<!-- <i class="iconfont icon-chakan" @click="showImage"></i>
|
||||||
<i class="iconfont icon-shanchu1" @click="delImage"></i> -->
|
<i class="iconfont icon-shanchu1" @click="delImage"></i> -->
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<el-dialog title="图片展示" :visible.sync="dialogVisible">
|
<el-dialog
|
||||||
<img width="100%" :src="dialogImageUrl" alt="">
|
title="图片展示"
|
||||||
|
:visible.sync="dialogVisible"
|
||||||
|
>
|
||||||
|
<img
|
||||||
|
width="100%"
|
||||||
|
:src="dialogImageUrl"
|
||||||
|
alt=""
|
||||||
|
>
|
||||||
</el-dialog>
|
</el-dialog>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
@ -41,12 +61,12 @@ export default {
|
|||||||
default: ''
|
default: ''
|
||||||
},
|
},
|
||||||
tip: {
|
tip: {
|
||||||
type: String,
|
type: Object,
|
||||||
default: '建议尺寸: 1080*900px, 小于1MB'
|
default:()=>({}),
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted () {
|
mounted () {
|
||||||
this.fileUploadURL = process.env.VUE_APP_BASE_API +'/api/canvas/upload?name=demo&type=console'
|
this.fileUploadURL = process.env.VUE_APP_BASE_API + '/api/canvas/upload?name=demo&type=console'
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
handleAvatarSuccess (res, file) {
|
handleAvatarSuccess (res, file) {
|
||||||
@ -71,53 +91,53 @@ export default {
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
.single-img{
|
.single-img {
|
||||||
&__box{
|
&__box {
|
||||||
position: relative;
|
position: relative;
|
||||||
>>> .el-upload{
|
>>> .el-upload {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
|
}
|
||||||
|
>>> .el-upload-dragger {
|
||||||
|
width: 100%;
|
||||||
|
.el-upload__text {
|
||||||
|
line-height: 40px;
|
||||||
}
|
}
|
||||||
>>> .el-upload-dragger{
|
.el-upload__tip {
|
||||||
width: 100%;
|
line-height: 1em;
|
||||||
.el-upload__text{
|
|
||||||
line-height: 40px;
|
|
||||||
}
|
|
||||||
.el-upload__tip{
|
|
||||||
line-height: 1em;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
.overlay{
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
&:hover .overlay{
|
|
||||||
position: absolute;
|
|
||||||
top:0;
|
|
||||||
left: 0;
|
|
||||||
width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
background-color: rgba(0,0,0,0.3);
|
|
||||||
color: #fff;
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
.iconfont{
|
|
||||||
padding: 5px;
|
|
||||||
margin: 0 5px;
|
|
||||||
font-size: 20px;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
&__img{
|
.overlay {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
&:hover .overlay {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
max-width: 100%;
|
|
||||||
height: 100%;
|
|
||||||
max-height: 100%;
|
|
||||||
margin: auto;
|
|
||||||
top: 0;
|
top: 0;
|
||||||
right: 0;
|
|
||||||
bottom: 0;
|
|
||||||
left: 0;
|
left: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
background-color: rgba(0, 0, 0, 0.3);
|
||||||
|
color: #fff;
|
||||||
|
display: flex;
|
||||||
|
justify-content: center;
|
||||||
|
align-items: center;
|
||||||
|
.iconfont {
|
||||||
|
padding: 5px;
|
||||||
|
margin: 0 5px;
|
||||||
|
font-size: 20px;
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
&__img {
|
||||||
|
position: absolute;
|
||||||
|
max-width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
max-height: 100%;
|
||||||
|
margin: auto;
|
||||||
|
top: 0;
|
||||||
|
right: 0;
|
||||||
|
bottom: 0;
|
||||||
|
left: 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
@ -4,15 +4,39 @@
|
|||||||
<div class="head-container">
|
<div class="head-container">
|
||||||
<div v-if="crud.props.searchToggle">
|
<div v-if="crud.props.searchToggle">
|
||||||
<!-- 搜索 -->
|
<!-- 搜索 -->
|
||||||
<el-input v-model="query.value" clearable placeholder="输入搜索内容" style="width: 200px;" class="filter-item" @keyup.enter.native="crud.toQuery" />
|
<el-input
|
||||||
<el-select v-model="query.type" clearable placeholder="类型" class="filter-item" style="width: 130px">
|
v-model="query.value"
|
||||||
<el-option v-for="item in queryTypeOptions" :key="item.key" :label="item.display_name" :value="item.key" />
|
clearable
|
||||||
|
placeholder="输入搜索内容"
|
||||||
|
style="width: 200px;"
|
||||||
|
class="filter-item"
|
||||||
|
@keyup.enter.native="crud.toQuery"
|
||||||
|
/>
|
||||||
|
<el-select
|
||||||
|
v-model="query.type"
|
||||||
|
clearable
|
||||||
|
placeholder="类型"
|
||||||
|
class="filter-item"
|
||||||
|
style="width: 130px"
|
||||||
|
>
|
||||||
|
<el-option
|
||||||
|
v-for="item in queryTypeOptions"
|
||||||
|
:key="item.key"
|
||||||
|
:label="item.display_name"
|
||||||
|
:value="item.key"
|
||||||
|
/>
|
||||||
</el-select>
|
</el-select>
|
||||||
<rrOperation :crud="crud" />
|
<rrOperation :crud="crud" />
|
||||||
</div>
|
</div>
|
||||||
<!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
|
<!--如果想在工具栏加入更多按钮,可以使用插槽方式, slot = 'left' or 'right'-->
|
||||||
<crudOperation :permission="permission">
|
<crudOperation :permission="permission">
|
||||||
<el-tooltip slot="right" class="item" effect="dark" content="数据库中表字段变动时使用该功能" placement="top-start">
|
<el-tooltip
|
||||||
|
slot="right"
|
||||||
|
class="item"
|
||||||
|
effect="dark"
|
||||||
|
content="数据库中表字段变动时使用该功能"
|
||||||
|
placement="top-start"
|
||||||
|
>
|
||||||
<el-button
|
<el-button
|
||||||
class="filter-item"
|
class="filter-item"
|
||||||
size="mini"
|
size="mini"
|
||||||
@ -21,118 +45,223 @@
|
|||||||
:loading="syncLoading"
|
:loading="syncLoading"
|
||||||
:disabled="crud.selections.length === 0"
|
:disabled="crud.selections.length === 0"
|
||||||
@click="sync"
|
@click="sync"
|
||||||
>同步</el-button>
|
>同步</el-button
|
||||||
|
>
|
||||||
</el-tooltip>
|
</el-tooltip>
|
||||||
</crudOperation>
|
</crudOperation>
|
||||||
<!--表单组件-->
|
<!--表单组件-->
|
||||||
<el-dialog :close-on-click-modal="false" :before-close="crud.cancelCU" :visible.sync="crud.status.cu > 0" :title="crud.status.title" width="800px">
|
<el-dialog
|
||||||
<el-form ref="form" :model="form" :rules="rules" size="small" label-width="140px">
|
:close-on-click-modal="false"
|
||||||
<el-form-item label="选择商品" prop="coverImgeUrl" >
|
:before-close="crud.cancelCU"
|
||||||
<cgood v-model="form.good":disabled="isdisabled" ></cgood>
|
:visible.sync="crud.status.cu > 0"
|
||||||
|
:title="crud.status.title"
|
||||||
|
width="800px"
|
||||||
|
>
|
||||||
|
<el-form
|
||||||
|
ref="form"
|
||||||
|
:model="form"
|
||||||
|
:rules="rules"
|
||||||
|
size="small"
|
||||||
|
label-width="140px"
|
||||||
|
>
|
||||||
|
<el-form-item label="选择商品" prop="coverImgeUrl">
|
||||||
|
<cgood v-model="form.good" :disabled="isdisabled"></cgood>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="商品封面图:" prop="coverImgeUrl">
|
<el-form-item label="商品封面图:" prop="coverImgeUrl">
|
||||||
<single-pic v-model="form.coverImgeUrl" type="image" :num="1" :width="150" :height="150" />
|
<single-pic
|
||||||
<p style="color: #cf0f0f">图片规则:图片尺寸最大300像素*300像素;</p>
|
v-model="form.coverImgeUrl"
|
||||||
|
type="image"
|
||||||
|
:num="1"
|
||||||
|
:width="150"
|
||||||
|
:height="150"
|
||||||
|
/>
|
||||||
|
<p style="color: #cf0f0f">
|
||||||
|
图片规则:图片尺寸最大300像素*300像素;
|
||||||
|
</p>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
|
|
||||||
<el-form-item label="商品小程序路径" prop="url" >
|
<el-form-item label="商品小程序路径" prop="url">
|
||||||
<el-input v-model="form.url" style="width: 370px;" :disabled="true"/>
|
<el-input
|
||||||
|
v-model="form.url"
|
||||||
|
style="width: 370px;"
|
||||||
|
:disabled="true"
|
||||||
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<!-- 1:一口价(只需要传入price,price2不传)-->
|
<!-- 1:一口价(只需要传入price,price2不传)-->
|
||||||
<!-- 2:价格区间(price字段为左边界,price2字段为右边界,price和price2必传)-->
|
<!-- 2:价格区间(price字段为左边界,price2字段为右边界,price和price2必传)-->
|
||||||
<!-- 3:显示折扣价(price字段为原价,price2字段为现价, price和price2必传)-->
|
<!-- 3:显示折扣价(price字段为原价,price2字段为现价, price和price2必传)-->
|
||||||
<el-form-item label="商品名称" prop="name" >
|
<el-form-item label="商品名称" prop="name">
|
||||||
<el-input v-model="form.name" style="width: 370px;" :disabled="isdisabled"/>
|
<el-input
|
||||||
|
v-model="form.name"
|
||||||
|
style="width: 370px;"
|
||||||
|
:disabled="isdisabled"
|
||||||
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="价格类型" prop="priceType" >
|
<el-form-item label="价格类型" prop="priceType">
|
||||||
<el-radio-group v-model="form.priceType" >
|
<el-radio-group v-model="form.priceType">
|
||||||
<el-radio :label="'1'" class="radio">一口价</el-radio>
|
<el-radio :label="'1'" class="radio">一口价</el-radio>
|
||||||
<el-radio :label="'2'" class="radio">价格区间</el-radio>
|
<el-radio :label="'2'" class="radio">价格区间</el-radio>
|
||||||
<el-radio :label="'3'" class="radio">显示折扣价</el-radio>
|
<el-radio :label="'3'" class="radio">显示折扣价</el-radio>
|
||||||
</el-radio-group>
|
</el-radio-group>
|
||||||
<p v-if="isdisabled" style="color: #cf0f0f">商品审核通过已入库,只能修改价格</p>
|
<p v-if="isdisabled" style="color: #cf0f0f">
|
||||||
|
商品审核通过已入库,只能修改价格
|
||||||
|
</p>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-col v-if="form.priceType=='1'" v-bind="grid">
|
<el-col v-if="form.priceType == '1'" v-bind="grid">
|
||||||
<el-form-item label="一口价" prop="price" >
|
<el-form-item label="一口价" prop="price">
|
||||||
<el-input v-model="form.price" style="width: 200px;" />
|
<el-input v-model="form.price" style="width: 200px;" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col v-if="form.priceType=='2'" v-bind="grid">
|
<el-col v-if="form.priceType == '2'" v-bind="grid">
|
||||||
<el-form-item label="最低价格" prop="price" >
|
<el-form-item label="最低价格" prop="price">
|
||||||
<el-input v-model="form.price" style="width: 200px;"/>
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
<el-col v-if="form.priceType=='2'" v-bind="grid">
|
|
||||||
<el-form-item label="最高价格" prop="price2" >
|
|
||||||
<el-input v-model="form.price2" style="width: 200px;"/>
|
|
||||||
</el-form-item>
|
|
||||||
</el-col>
|
|
||||||
<el-col v-if="form.priceType=='3'" v-bind="grid">
|
|
||||||
<el-form-item label="市场价" prop="price" >
|
|
||||||
<el-input v-model="form.price" style="width: 200px;" />
|
<el-input v-model="form.price" style="width: 200px;" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
<el-col v-if="form.priceType=='3'" v-bind="grid">
|
<el-col v-if="form.priceType == '2'" v-bind="grid">
|
||||||
<el-form-item label="现价" prop="price2" >
|
<el-form-item label="最高价格" prop="price2">
|
||||||
<el-input v-model="form.price2" style="width: 200px;"/>
|
<el-input v-model="form.price2" style="width: 200px;" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col v-if="form.priceType == '3'" v-bind="grid">
|
||||||
|
<el-form-item label="市场价" prop="price">
|
||||||
|
<el-input v-model="form.price" style="width: 200px;" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-col>
|
||||||
|
<el-col v-if="form.priceType == '3'" v-bind="grid">
|
||||||
|
<el-form-item label="现价" prop="price2">
|
||||||
|
<el-input v-model="form.price2" style="width: 200px;" />
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-col>
|
</el-col>
|
||||||
</el-form>
|
</el-form>
|
||||||
<div slot="footer" class="dialog-footer">
|
<div slot="footer" class="dialog-footer">
|
||||||
<el-button type="text" @click="crud.cancelCU">取消</el-button>
|
<el-button type="text" @click="crud.cancelCU">取消</el-button>
|
||||||
<el-button :loading="crud.cu === 2" type="primary" @click="crud.submitCU">确认</el-button>
|
<el-button
|
||||||
|
:loading="crud.cu === 2"
|
||||||
|
type="primary"
|
||||||
|
@click="crud.submitCU"
|
||||||
|
>确认</el-button
|
||||||
|
>
|
||||||
</div>
|
</div>
|
||||||
</el-dialog>
|
</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" />
|
||||||
<el-table-column v-if="columns.visible('goodsId')" prop="goodsId" label="直播商品id" />
|
<el-table-column
|
||||||
<el-table-column v-if="columns.visible('name')" prop="name" label="商品名称" />
|
v-if="columns.visible('goodsId')"
|
||||||
<el-table-column v-if="columns.visible('productId')" prop="productId" label="关联商品id" />
|
prop="goodsId"
|
||||||
<el-table-column v-if="columns.visible('coverImgeUrl')" prop="coverImgUrl" label="商品图片" >
|
label="直播商品id"
|
||||||
|
/>
|
||||||
|
<el-table-column
|
||||||
|
v-if="columns.visible('name')"
|
||||||
|
prop="name"
|
||||||
|
label="商品名称"
|
||||||
|
/>
|
||||||
|
<el-table-column
|
||||||
|
v-if="columns.visible('productId')"
|
||||||
|
prop="productId"
|
||||||
|
label="关联商品id"
|
||||||
|
/>
|
||||||
|
<el-table-column
|
||||||
|
v-if="columns.visible('coverImgeUrl')"
|
||||||
|
prop="coverImgUrl"
|
||||||
|
label="商品图片"
|
||||||
|
>
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<a :href="scope.row.coverImgeUrl" style="color: #42b983" target="_blank"><img :src="scope.row.coverImgeUrl" alt="点击打开" class="el-avatar"></a>
|
<a
|
||||||
|
:href="scope.row.coverImgeUrl"
|
||||||
|
style="color: #42b983"
|
||||||
|
target="_blank"
|
||||||
|
><img
|
||||||
|
:src="scope.row.coverImgeUrl"
|
||||||
|
alt="点击打开"
|
||||||
|
class="el-avatar"
|
||||||
|
/></a>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column v-if="columns.visible('url')" prop="url" label="商品小程序路径" />
|
<el-table-column
|
||||||
<el-table-column v-if="columns.visible('priceType')" prop="priceType" label="价格类型" >
|
v-if="columns.visible('url')"
|
||||||
|
prop="url"
|
||||||
|
label="商品小程序路径"
|
||||||
|
/>
|
||||||
|
<el-table-column
|
||||||
|
v-if="columns.visible('priceType')"
|
||||||
|
prop="priceType"
|
||||||
|
label="价格类型"
|
||||||
|
>
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<div>
|
<div>
|
||||||
<el-tag v-if="scope.row.priceType == 1" :type="''">一口价</el-tag>
|
<el-tag v-if="scope.row.priceType == 1" :type="''">一口价</el-tag>
|
||||||
<el-tag v-else-if="scope.row.priceType == 2" :type="''">价格区间</el-tag>
|
<el-tag v-else-if="scope.row.priceType == 2" :type="''"
|
||||||
<el-tag v-else-if="scope.row.priceType == 3" :type="''">显示折扣价</el-tag>
|
>价格区间</el-tag
|
||||||
|
>
|
||||||
|
<el-tag v-else-if="scope.row.priceType == 3" :type="''"
|
||||||
|
>显示折扣价</el-tag
|
||||||
|
>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<!-- <el-table-column v-if="columns.visible('price')" prop="price" label="price" />-->
|
<!-- <el-table-column v-if="columns.visible('price')" prop="price" label="price" />-->
|
||||||
<!-- <el-table-column v-if="columns.visible('price2')" prop="price2" label="price2" />-->
|
<!-- <el-table-column v-if="columns.visible('price2')" prop="price2" label="price2" />-->
|
||||||
<el-table-column v-if="columns.visible('auditStatus')" prop="auditStatus" label="审核状态" >
|
<el-table-column
|
||||||
|
v-if="columns.visible('auditStatus')"
|
||||||
|
prop="auditStatus"
|
||||||
|
label="审核状态"
|
||||||
|
>
|
||||||
<!-- //0:未审核,1:审核中,2:审核通过,3审核失败-->
|
<!-- //0:未审核,1:审核中,2:审核通过,3审核失败-->
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<div>
|
<div>
|
||||||
<el-tag v-if="scope.row.auditStatus === 0" :type="''">未审核</el-tag>
|
<el-tag v-if="scope.row.auditStatus === 0" :type="''"
|
||||||
<el-tag v-else-if="scope.row.auditStatus === 1" :type="''">审核中</el-tag>
|
>未审核</el-tag
|
||||||
<el-tag v-else-if="scope.row.auditStatus === 2" :type="''">审核通过</el-tag>
|
>
|
||||||
<el-tag v-else-if="scope.row.auditStatus === 3" :type="''">审核失败</el-tag>
|
<el-tag v-else-if="scope.row.auditStatus === 1" :type="''"
|
||||||
|
>审核中</el-tag
|
||||||
|
>
|
||||||
|
<el-tag v-else-if="scope.row.auditStatus === 2" :type="''"
|
||||||
|
>审核通过</el-tag
|
||||||
|
>
|
||||||
|
<el-tag v-else-if="scope.row.auditStatus === 3" :type="''"
|
||||||
|
>审核失败</el-tag
|
||||||
|
>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<!-- 1, 2:表示是为api添加商品,否则是直播控制台添加的商品-->
|
<!-- 1, 2:表示是为api添加商品,否则是直播控制台添加的商品-->
|
||||||
<el-table-column v-if="columns.visible('thirdPartyTag')" prop="thirdPartyTag" label="添加途径" >
|
<el-table-column
|
||||||
|
v-if="columns.visible('thirdPartyTag')"
|
||||||
|
prop="thirdPartyTag"
|
||||||
|
label="添加途径"
|
||||||
|
>
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<div>
|
<div>
|
||||||
<el-tag v-if="scope.row.thirdPartyTag == 0" :type="''">api添加</el-tag>
|
<el-tag v-if="scope.row.thirdPartyTag == 0" :type="''"
|
||||||
<el-tag v-else-if="scope.row.thirdPartyTag == 2" :type="''">控制台</el-tag>
|
>api添加</el-tag
|
||||||
|
>
|
||||||
|
<el-tag v-else-if="scope.row.thirdPartyTag == 2" :type="''"
|
||||||
|
>控制台</el-tag
|
||||||
|
>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
|
||||||
<el-table-column v-permission="['admin','yxWechatLiveGoods:edit','yxWechatLiveGoods:del']" label="操作" width="150px" align="center">
|
<el-table-column
|
||||||
|
v-permission="[
|
||||||
|
'admin',
|
||||||
|
'yxWechatLiveGoods:edit',
|
||||||
|
'yxWechatLiveGoods:del'
|
||||||
|
]"
|
||||||
|
label="操作"
|
||||||
|
width="150px"
|
||||||
|
align="center"
|
||||||
|
>
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<udOperation
|
<udOperation :data="scope.row" :permission="permission" />
|
||||||
:data="scope.row"
|
|
||||||
:permission="permission"
|
|
||||||
/>
|
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
@ -143,21 +272,52 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { sync } from '@/api/yxWechatLiveGoods'
|
import { sync } from "@/api/yxWechatLiveGoods";
|
||||||
import crudYxWechatLiveGoods from '@/api/yxWechatLiveGoods'
|
import crudYxWechatLiveGoods from "@/api/yxWechatLiveGoods";
|
||||||
import CRUD, { presenter, header, form, crud } from '@crud/crud'
|
import CRUD, { presenter, header, form, crud } from "@crud/crud";
|
||||||
import rrOperation from '@crud/RR.operation'
|
import rrOperation from "@crud/RR.operation";
|
||||||
import crudOperation from '@crud/CRUD.operation'
|
import crudOperation from "@crud/CRUD.operation";
|
||||||
import udOperation from '@crud/UD.operation'
|
import udOperation from "@crud/UD.operation";
|
||||||
import pagination from '@crud/Pagination'
|
import pagination from "@crud/Pagination";
|
||||||
import cgood from '@/views/components/good'
|
import cgood from "@/views/components/good";
|
||||||
import singlePic from '@/components/singlematerial'
|
import singlePic from "@/components/singlematerial";
|
||||||
// crud交由presenter持有
|
// crud交由presenter持有
|
||||||
const defaultCrud = CRUD({ title: '直播商品', url: 'api/yxWechatLiveGoods', sort: 'goods_id,desc', crudMethod: { ...crudYxWechatLiveGoods }})
|
const defaultCrud = CRUD({
|
||||||
const defaultForm = { good: {productId: null,storeName: null,image: null,price: null,otPrice: null}, goodsId: null, productId: null, coverImgeUrl: '', url: null, priceType: null, price: null, price2: null, name: null, thirdPartyTag: null, auditId: null, auditStatus: null }
|
title: "直播商品",
|
||||||
|
url: "api/yxWechatLiveGoods",
|
||||||
|
sort: "goods_id,desc",
|
||||||
|
crudMethod: { ...crudYxWechatLiveGoods }
|
||||||
|
});
|
||||||
|
const defaultForm = {
|
||||||
|
good: {
|
||||||
|
productId: null,
|
||||||
|
storeName: null,
|
||||||
|
image: null,
|
||||||
|
price: null,
|
||||||
|
otPrice: null
|
||||||
|
},
|
||||||
|
goodsId: null,
|
||||||
|
productId: null,
|
||||||
|
coverImgeUrl: "",
|
||||||
|
url: null,
|
||||||
|
priceType: null,
|
||||||
|
price: null,
|
||||||
|
price2: null,
|
||||||
|
name: null,
|
||||||
|
thirdPartyTag: null,
|
||||||
|
auditId: null,
|
||||||
|
auditStatus: null
|
||||||
|
};
|
||||||
export default {
|
export default {
|
||||||
name: 'YxWechatLiveGoods',
|
name: "YxWechatLiveGoods",
|
||||||
components: { pagination, crudOperation, rrOperation, udOperation ,cgood,singlePic},
|
components: {
|
||||||
|
pagination,
|
||||||
|
crudOperation,
|
||||||
|
rrOperation,
|
||||||
|
udOperation,
|
||||||
|
cgood,
|
||||||
|
singlePic
|
||||||
|
},
|
||||||
mixins: [presenter(defaultCrud), header(), form(defaultForm), crud()],
|
mixins: [presenter(defaultCrud), header(), form(defaultForm), crud()],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
@ -171,133 +331,126 @@ export default {
|
|||||||
xs: 24
|
xs: 24
|
||||||
},
|
},
|
||||||
permission: {
|
permission: {
|
||||||
add: ['admin', 'yxWechatLiveGoods:add'],
|
add: ["admin", "yxWechatLiveGoods:add"],
|
||||||
edit: ['admin', 'yxWechatLiveGoods:edit'],
|
edit: ["admin", "yxWechatLiveGoods:edit"],
|
||||||
del: ['admin', 'yxWechatLiveGoods:del']
|
del: ["admin", "yxWechatLiveGoods:del"]
|
||||||
},
|
},
|
||||||
rules: {
|
rules: {
|
||||||
coverImgUrl: [
|
coverImgUrl: [
|
||||||
{ required: true, message: '商品图片不能为空', trigger: 'blur' }
|
{ required: true, message: "商品图片不能为空", trigger: "blur" }
|
||||||
],
|
],
|
||||||
priceType: [
|
priceType: [
|
||||||
{ required: true, message: '价格类型不能为空', trigger: 'blur' }
|
{ required: true, message: "价格类型不能为空", trigger: "blur" }
|
||||||
],
|
],
|
||||||
price: [
|
price: [{ required: true, message: "不能为空", trigger: "blur" }],
|
||||||
{ required: true, message: '不能为空', trigger: 'blur' }
|
name: [{ required: true, message: "商品名称不能为空", trigger: "blur" }]
|
||||||
],
|
|
||||||
name: [
|
|
||||||
{ required: true, message: '商品名称不能为空', trigger: 'blur' }
|
|
||||||
]
|
|
||||||
},
|
},
|
||||||
queryTypeOptions: [
|
queryTypeOptions: [{ key: "name", display_name: "商品名称" }]
|
||||||
{ key: 'name', display_name: '商品名称' }
|
};
|
||||||
]
|
},
|
||||||
|
watch: {
|
||||||
|
"form.good": {
|
||||||
|
handler(val, oldVal) {
|
||||||
|
this.form.productId = val.productId;
|
||||||
|
this.form.name = val.storeName;
|
||||||
|
this.form.price = val.price;
|
||||||
|
this.form.price2 = val.otPrice;
|
||||||
|
this.form.priceType = "3";
|
||||||
|
if (val.productId) {
|
||||||
|
this.form.url = "pages/shop/GoodsCon/index?id=" + val.productId;
|
||||||
|
}
|
||||||
|
this.isdisabled = false;
|
||||||
|
},
|
||||||
|
deep: true //对象内部的属性监听,也叫深度监听
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
watch:{
|
computed: {
|
||||||
'form.good': {
|
disable() {
|
||||||
handler(val,oldVal){
|
if (this.form.auditStatus == "2") {
|
||||||
this.form.productId = val.productId
|
return (this.isdisabled = true);
|
||||||
this.form.name = val.storeName
|
} else {
|
||||||
this.form.price = val.price
|
return (this.isdisabled = false);
|
||||||
this.form.price2 = val.otPrice
|
|
||||||
this.form.priceType = '3'
|
|
||||||
if(val.productId){
|
|
||||||
this.form.url="/pages/shop/GoodsCon/index?id="+val.productId
|
|
||||||
}
|
|
||||||
this.isdisabled=false;
|
|
||||||
},
|
|
||||||
deep:true//对象内部的属性监听,也叫深度监听
|
|
||||||
},
|
|
||||||
},
|
|
||||||
computed:{
|
|
||||||
disable(){
|
|
||||||
if(this.form.auditStatus=="2"){
|
|
||||||
return this.isdisabled=true;
|
|
||||||
}else{
|
|
||||||
return this.isdisabled=false;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
sync() {
|
sync() {
|
||||||
const ids = []
|
const ids = [];
|
||||||
this.crud.selections.forEach(val => {
|
this.crud.selections.forEach(val => {
|
||||||
ids.push(val.goodsId)
|
ids.push(val.goodsId);
|
||||||
})
|
});
|
||||||
this.crud.selections.forEach(val => {
|
this.crud.selections.forEach(val => {});
|
||||||
})
|
this.syncLoading = true;
|
||||||
this.syncLoading = true
|
sync(ids)
|
||||||
sync(ids).then(() => {
|
.then(() => {
|
||||||
this.crud.refresh()
|
this.crud.refresh();
|
||||||
this.crud.notify('同步成功', CRUD.NOTIFICATION_TYPE.SUCCESS)
|
this.crud.notify("同步成功", CRUD.NOTIFICATION_TYPE.SUCCESS);
|
||||||
this.syncLoading = false
|
this.syncLoading = false;
|
||||||
}).then(() => {
|
})
|
||||||
this.syncLoading = false
|
.then(() => {
|
||||||
})
|
this.syncLoading = false;
|
||||||
|
});
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* 执行删除
|
* 执行删除
|
||||||
* @param {*} data 数据项
|
* @param {*} data 数据项
|
||||||
*/
|
*/
|
||||||
doDelete(data) {
|
doDelete(data) {
|
||||||
let delAll = false
|
let delAll = false;
|
||||||
let dataStatus
|
let dataStatus;
|
||||||
const ids = []
|
const ids = [];
|
||||||
if (data instanceof Array) {
|
if (data instanceof Array) {
|
||||||
delAll = true
|
delAll = true;
|
||||||
data.forEach(val => {
|
data.forEach(val => {
|
||||||
ids.push(val.goodsId)
|
ids.push(val.goodsId);
|
||||||
})
|
});
|
||||||
} else {
|
} else {
|
||||||
ids.push(data.goodsId)
|
ids.push(data.goodsId);
|
||||||
dataStatus = crud.getDataStatus(data.goodsId)
|
dataStatus = crud.getDataStatus(data.goodsId);
|
||||||
}
|
}
|
||||||
if (!callVmHook(crud, CRUD.HOOK.beforeDelete, data)) {
|
if (!callVmHook(crud, CRUD.HOOK.beforeDelete, data)) {
|
||||||
return
|
return;
|
||||||
}
|
}
|
||||||
if (!delAll) {
|
if (!delAll) {
|
||||||
dataStatus.delete = CRUD.STATUS.PROCESSING
|
dataStatus.delete = CRUD.STATUS.PROCESSING;
|
||||||
}
|
}
|
||||||
return crud.crudMethod.del(ids).then(() => {
|
return crud.crudMethod
|
||||||
if (delAll) {
|
.del(ids)
|
||||||
crud.delAllLoading = false
|
.then(() => {
|
||||||
} else dataStatus.delete = CRUD.STATUS.PREPARED
|
if (delAll) {
|
||||||
crud.dleChangePage(1)
|
crud.delAllLoading = false;
|
||||||
crud.delSuccessNotify()
|
} else dataStatus.delete = CRUD.STATUS.PREPARED;
|
||||||
callVmHook(crud, CRUD.HOOK.afterDelete, data)
|
crud.dleChangePage(1);
|
||||||
crud.refresh()
|
crud.delSuccessNotify();
|
||||||
}).catch(() => {
|
callVmHook(crud, CRUD.HOOK.afterDelete, data);
|
||||||
if (delAll) {
|
crud.refresh();
|
||||||
crud.delAllLoading = false
|
})
|
||||||
} else dataStatus.delete = CRUD.STATUS.PREPARED
|
.catch(() => {
|
||||||
})
|
if (delAll) {
|
||||||
|
crud.delAllLoading = false;
|
||||||
|
} else dataStatus.delete = CRUD.STATUS.PREPARED;
|
||||||
|
});
|
||||||
},
|
},
|
||||||
// 获取数据前设置好接口地址
|
// 获取数据前设置好接口地址
|
||||||
[CRUD.HOOK.beforeRefresh]() {
|
[CRUD.HOOK.beforeRefresh]() {
|
||||||
const query = this.query
|
const query = this.query;
|
||||||
if (query.type && query.value) {
|
if (query.type && query.value) {
|
||||||
this.crud.params[query.type] = query.value
|
this.crud.params[query.type] = query.value;
|
||||||
}else{
|
} else {
|
||||||
delete this.crud.params.name
|
delete this.crud.params.name;
|
||||||
}
|
}
|
||||||
return true
|
return true;
|
||||||
}, // 新增与编辑前做的操作
|
}, // 新增与编辑前做的操作
|
||||||
[CRUD.HOOK.beforeToCU](crud, form) {
|
[CRUD.HOOK.beforeToCU](crud, form) {
|
||||||
this.form.good.productId = form.productId
|
this.form.good.productId = form.productId;
|
||||||
this.form.good.storeName = form.name
|
this.form.good.storeName = form.name;
|
||||||
this.form.good.image = form.coverImgeUrl
|
this.form.good.image = form.coverImgeUrl;
|
||||||
this.form.good.price = form.price
|
this.form.good.price = form.price;
|
||||||
this.form.good.otPrice = form.price2
|
this.form.good.otPrice = form.price2;
|
||||||
this.form.good.auditStatus = form.auditStatus
|
this.form.good.auditStatus = form.auditStatus;
|
||||||
},
|
}
|
||||||
}
|
}
|
||||||
}
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style scoped>
|
<style scoped>
|
||||||
|
Reference in New Issue
Block a user