|
@@ -5,14 +5,14 @@
|
|
|
<el-checkbox :indeterminate="isIndeterminate" v-model="allChecked" @change="toggleSelectAll">
|
|
<el-checkbox :indeterminate="isIndeterminate" v-model="allChecked" @change="toggleSelectAll">
|
|
|
{{ multipleSelection.length > 0 ? `已选 ${multipleSelection.length} 条` : '选中本页' }}
|
|
{{ multipleSelection.length > 0 ? `已选 ${multipleSelection.length} 条` : '选中本页' }}
|
|
|
</el-checkbox>
|
|
</el-checkbox>
|
|
|
- <el-button plain size="mini" @click="handleShelf">上架</el-button>
|
|
|
|
|
- <el-button plain size="mini" @click="handleUnshelf">下架</el-button>
|
|
|
|
|
|
|
+ <!-- <el-button plain size="mini" @click="handleShelf">上架</el-button>-->
|
|
|
|
|
+ <!-- <el-button plain size="mini" @click="handleUnshelf">下架</el-button>-->
|
|
|
<el-button plain size="mini" @click="handleDeleteSelected">删除</el-button>
|
|
<el-button plain size="mini" @click="handleDeleteSelected">删除</el-button>
|
|
|
- <el-button plain type="mini" icon="el-icon-plus" @click="handleAddLiveGoods">添加商品</el-button>
|
|
|
|
|
|
|
+ <el-button plain type="mini" icon="el-icon-plus" @click="handleAddLiveCoupon">添加优惠券</el-button>
|
|
|
</div>
|
|
</div>
|
|
|
<el-table
|
|
<el-table
|
|
|
- ref="goodTable"
|
|
|
|
|
- :data="goodsLiveList"
|
|
|
|
|
|
|
+ ref="couponTable"
|
|
|
|
|
+ :data="couponLiveList"
|
|
|
style="width: 100%"
|
|
style="width: 100%"
|
|
|
v-loading="loading"
|
|
v-loading="loading"
|
|
|
@selection-change="handleSelectionChange"
|
|
@selection-change="handleSelectionChange"
|
|
@@ -20,41 +20,33 @@
|
|
|
<el-table-column type="selection" width="55"></el-table-column>
|
|
<el-table-column type="selection" width="55"></el-table-column>
|
|
|
<!-- 题干列:显示试题的主要内容 -->
|
|
<!-- 题干列:显示试题的主要内容 -->
|
|
|
<el-table-column
|
|
<el-table-column
|
|
|
- prop="goodsId"
|
|
|
|
|
- label="商品id"
|
|
|
|
|
|
|
+ prop="couponId"
|
|
|
|
|
+ label="优惠券id"
|
|
|
show-overflow-tooltip
|
|
show-overflow-tooltip
|
|
|
></el-table-column>
|
|
></el-table-column>
|
|
|
|
|
|
|
|
<el-table-column
|
|
<el-table-column
|
|
|
- label="商品图片"
|
|
|
|
|
- >
|
|
|
|
|
- <template slot-scope="scope">
|
|
|
|
|
- <img
|
|
|
|
|
- :src="scope.row.imgUrl"
|
|
|
|
|
- style="display: block; max-width: 100%; width: 100px; height: 100px"
|
|
|
|
|
- />
|
|
|
|
|
- </template>
|
|
|
|
|
-
|
|
|
|
|
- </el-table-column>
|
|
|
|
|
|
|
+ prop="title"
|
|
|
|
|
+ label="优惠券名称"
|
|
|
|
|
+ ></el-table-column>
|
|
|
|
|
|
|
|
<el-table-column
|
|
<el-table-column
|
|
|
- prop="productName"
|
|
|
|
|
- label="商品名称"
|
|
|
|
|
|
|
+ prop="couponPrice"
|
|
|
|
|
+ label="优惠券价格"
|
|
|
></el-table-column>
|
|
></el-table-column>
|
|
|
|
|
|
|
|
<el-table-column
|
|
<el-table-column
|
|
|
- prop="price"
|
|
|
|
|
- label="价格"
|
|
|
|
|
|
|
+ prop="useMinPrice"
|
|
|
|
|
+ label="优惠券使用最低价格"
|
|
|
></el-table-column>
|
|
></el-table-column>
|
|
|
|
|
|
|
|
<el-table-column
|
|
<el-table-column
|
|
|
- prop="stock"
|
|
|
|
|
- label="库存"
|
|
|
|
|
|
|
+ prop="couponTime"
|
|
|
|
|
+ label="优惠券有效时间"
|
|
|
></el-table-column>
|
|
></el-table-column>
|
|
|
-
|
|
|
|
|
<el-table-column
|
|
<el-table-column
|
|
|
- prop="sales"
|
|
|
|
|
- label="销量"
|
|
|
|
|
|
|
+ prop="productName"
|
|
|
|
|
+ label="绑定直播商品"
|
|
|
></el-table-column>
|
|
></el-table-column>
|
|
|
|
|
|
|
|
<el-table-column
|
|
<el-table-column
|
|
@@ -62,34 +54,16 @@
|
|
|
label="显示状态"
|
|
label="显示状态"
|
|
|
>
|
|
>
|
|
|
<template slot-scope="scope">
|
|
<template slot-scope="scope">
|
|
|
- <el-switch
|
|
|
|
|
- v-model="scope.row.isShow"
|
|
|
|
|
- @click.native.capture.prevent="handleSwitchClick(scope.row)"
|
|
|
|
|
- active-color="#13ce66"
|
|
|
|
|
- inactive-color="#ff4949">
|
|
|
|
|
- </el-switch>
|
|
|
|
|
|
|
+ <el-switch
|
|
|
|
|
+ v-model="scope.row.isShow == 1"
|
|
|
|
|
+ @click.native.capture.prevent="handleSwitchClick(scope.row)"
|
|
|
|
|
+ active-color="#13ce66"
|
|
|
|
|
+ inactive-color="#ff4949">
|
|
|
|
|
+ </el-switch>
|
|
|
</template>
|
|
</template>
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
|
|
|
|
|
- <el-table-column
|
|
|
|
|
- prop="status"
|
|
|
|
|
- label="上下架"
|
|
|
|
|
- >
|
|
|
|
|
- <template slot-scope="scope">
|
|
|
|
|
- <el-tag v-if="scope.row.status == 1">上架</el-tag>
|
|
|
|
|
- <el-tag type="info" v-if="scope.row.status == 0">下架</el-tag>
|
|
|
|
|
- </template>
|
|
|
|
|
- </el-table-column>
|
|
|
|
|
|
|
|
|
|
- <el-table-column
|
|
|
|
|
- prop="status"
|
|
|
|
|
- label="店铺上下架"
|
|
|
|
|
- >
|
|
|
|
|
- <template slot-scope="scope">
|
|
|
|
|
- <el-tag v-if="scope.row.fsStatus == 1">上架</el-tag>
|
|
|
|
|
- <el-tag type="info" v-if="scope.row.fsStatus == 0">下架</el-tag>
|
|
|
|
|
- </template>
|
|
|
|
|
- </el-table-column>
|
|
|
|
|
|
|
|
|
|
<!-- 操作列:包含编辑和删除按钮 -->
|
|
<!-- 操作列:包含编辑和删除按钮 -->
|
|
|
<el-table-column
|
|
<el-table-column
|
|
@@ -101,20 +75,14 @@
|
|
|
<el-button
|
|
<el-button
|
|
|
type="text"
|
|
type="text"
|
|
|
size="small"
|
|
size="small"
|
|
|
- style="color: #0066FF;"
|
|
|
|
|
- @click="handleGoodStock(scope.row)"
|
|
|
|
|
- >调整库存</el-button>
|
|
|
|
|
- <el-button
|
|
|
|
|
- type="text"
|
|
|
|
|
- size="small"
|
|
|
|
|
- style="color: #0066FF;"
|
|
|
|
|
- @click="handleGoodSale(scope.row)"
|
|
|
|
|
- >调整销量</el-button>
|
|
|
|
|
|
|
+ style="color: #0fae11;"
|
|
|
|
|
+ @click="handleCouponBind(scope.row)"
|
|
|
|
|
+ >绑定商品</el-button>
|
|
|
<el-button
|
|
<el-button
|
|
|
type="text"
|
|
type="text"
|
|
|
size="small"
|
|
size="small"
|
|
|
style="color: #F56C6C;"
|
|
style="color: #F56C6C;"
|
|
|
- @click="handleGoodDelete(scope.row)"
|
|
|
|
|
|
|
+ @click="handleCouponDelete(scope.row)"
|
|
|
>删除</el-button>
|
|
>删除</el-button>
|
|
|
</template>
|
|
</template>
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
@@ -122,18 +90,18 @@
|
|
|
|
|
|
|
|
<!-- 分页组件:用于分页展示试题列表 -->
|
|
<!-- 分页组件:用于分页展示试题列表 -->
|
|
|
<pagination
|
|
<pagination
|
|
|
- v-show="goodsLiveTotal > 0"
|
|
|
|
|
- :total="goodsLiveTotal"
|
|
|
|
|
- :page.sync="goodsParams.pageNum"
|
|
|
|
|
- :limit.sync="goodsParams.pageSize"
|
|
|
|
|
- @pagination="getLiveGoodsList"
|
|
|
|
|
|
|
+ v-show="couponLiveTotal > 0"
|
|
|
|
|
+ :total="couponLiveTotal"
|
|
|
|
|
+ :page.sync="couponParams.pageNum"
|
|
|
|
|
+ :limit.sync="couponParams.pageSize"
|
|
|
|
|
+ @pagination="getLiveCouponList"
|
|
|
style="margin-top: 20px;"
|
|
style="margin-top: 20px;"
|
|
|
/>
|
|
/>
|
|
|
|
|
|
|
|
- <!-- 添加商品弹窗 -->
|
|
|
|
|
|
|
+ <!-- 添加优惠券弹窗 -->
|
|
|
<el-dialog
|
|
<el-dialog
|
|
|
- title="添加商品"
|
|
|
|
|
- :visible.sync="goodsDialogVisible"
|
|
|
|
|
|
|
+ title="添加优惠券"
|
|
|
|
|
+ :visible.sync="couponDialogVisible"
|
|
|
width="800px"
|
|
width="800px"
|
|
|
:close-on-click-modal="false"
|
|
:close-on-click-modal="false"
|
|
|
:close-on-press-escape="false"
|
|
:close-on-press-escape="false"
|
|
@@ -142,18 +110,18 @@
|
|
|
<div style="text-align: right; margin-bottom: 20px;">
|
|
<div style="text-align: right; margin-bottom: 20px;">
|
|
|
<el-input
|
|
<el-input
|
|
|
v-model="searchTitle"
|
|
v-model="searchTitle"
|
|
|
- placeholder="请输入产品名称"
|
|
|
|
|
|
|
+ placeholder="请输入优惠券名称"
|
|
|
style="width: 300px;"
|
|
style="width: 300px;"
|
|
|
- @input="handleGoodsSearch"
|
|
|
|
|
|
|
+ @input="handleCouponSearch"
|
|
|
></el-input>
|
|
></el-input>
|
|
|
</div>
|
|
</div>
|
|
|
|
|
|
|
|
<el-table
|
|
<el-table
|
|
|
- :data="goodsList"
|
|
|
|
|
|
|
+ :data="couponList"
|
|
|
style="width: 100%"
|
|
style="width: 100%"
|
|
|
- v-loading="goodsLoading"
|
|
|
|
|
- @selection-change="handleGoodsChange"
|
|
|
|
|
- @row-click="handleGoodsRowClick"
|
|
|
|
|
|
|
+ v-loading="couponLoading"
|
|
|
|
|
+ @selection-change="handleCouponChange"
|
|
|
|
|
+ @row-click="handleCouponRowClick"
|
|
|
row-key="id"
|
|
row-key="id"
|
|
|
>
|
|
>
|
|
|
<el-table-column
|
|
<el-table-column
|
|
@@ -162,87 +130,76 @@
|
|
|
>
|
|
>
|
|
|
</el-table-column>
|
|
</el-table-column>
|
|
|
<el-table-column
|
|
<el-table-column
|
|
|
- prop="productName"
|
|
|
|
|
- label="产品"
|
|
|
|
|
|
|
+ prop="title"
|
|
|
|
|
+ label="优惠券名称"
|
|
|
class-name="clickable-column"
|
|
class-name="clickable-column"
|
|
|
></el-table-column>
|
|
></el-table-column>
|
|
|
<el-table-column
|
|
<el-table-column
|
|
|
- prop="price"
|
|
|
|
|
- label="价格"
|
|
|
|
|
|
|
+ prop="couponPrice"
|
|
|
|
|
+ label="优惠券价格"
|
|
|
class-name="clickable-column"
|
|
class-name="clickable-column"
|
|
|
></el-table-column>
|
|
></el-table-column>
|
|
|
<el-table-column
|
|
<el-table-column
|
|
|
- prop="stock"
|
|
|
|
|
- label="库存"
|
|
|
|
|
|
|
+ prop="useMinPrice"
|
|
|
|
|
+ label="优惠券使用最低价格"
|
|
|
|
|
+ class-name="clickable-column"
|
|
|
|
|
+ ></el-table-column>
|
|
|
|
|
+ <el-table-column
|
|
|
|
|
+ prop="couponTime"
|
|
|
|
|
+ label="优惠券有效时间"
|
|
|
class-name="clickable-column"
|
|
class-name="clickable-column"
|
|
|
></el-table-column>
|
|
></el-table-column>
|
|
|
</el-table>
|
|
</el-table>
|
|
|
|
|
|
|
|
<pagination
|
|
<pagination
|
|
|
- v-show="goodsTotal > 0"
|
|
|
|
|
- :total="goodsTotal"
|
|
|
|
|
- :page.sync="queryGoodParams.pageNum"
|
|
|
|
|
- :limit.sync="queryGoodParams.pageSize"
|
|
|
|
|
- @pagination="getStoreProductLists"
|
|
|
|
|
|
|
+ v-show="couponTotal > 0"
|
|
|
|
|
+ :total="couponTotal"
|
|
|
|
|
+ :page.sync="queryCouponParams.pageNum"
|
|
|
|
|
+ :limit.sync="queryCouponParams.pageSize"
|
|
|
|
|
+ @pagination="getCouponLists"
|
|
|
style="margin-top: 20px;"
|
|
style="margin-top: 20px;"
|
|
|
/>
|
|
/>
|
|
|
</div>
|
|
</div>
|
|
|
<div slot="footer" class="dialog-footer">
|
|
<div slot="footer" class="dialog-footer">
|
|
|
<div style="display: flex; justify-content: space-between; align-items: center;">
|
|
<div style="display: flex; justify-content: space-between; align-items: center;">
|
|
|
- <span class="selected-count">当前已选择 <span style="color: #00BFFF; font-style: italic;">{{ selectedGoods.length }}</span> 商品</span>
|
|
|
|
|
|
|
+ <span class="selected-count">当前已选择 <span style="color: #00BFFF; font-style: italic;">{{ selectedCoupon.length }}</span> 优惠券</span>
|
|
|
<div>
|
|
<div>
|
|
|
- <el-button @click="goodsDialogVisible = false">取 消</el-button>
|
|
|
|
|
- <el-button type="primary" @click="confirmAddGoods">确 定</el-button>
|
|
|
|
|
|
|
+ <el-button @click="couponDialogVisible = false">取 消</el-button>
|
|
|
|
|
+ <el-button type="primary" @click="confirmAddCoupon">确 定</el-button>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
</div>
|
|
</div>
|
|
|
</el-dialog>
|
|
</el-dialog>
|
|
|
|
|
|
|
|
- <el-dialog
|
|
|
|
|
- title="调整库存"
|
|
|
|
|
- :visible.sync="stockDialogVisible"
|
|
|
|
|
- width="400px"
|
|
|
|
|
- :close-on-click-modal="false"
|
|
|
|
|
- :close-on-press-escape="false"
|
|
|
|
|
- >
|
|
|
|
|
- <el-form :model="stockForm" ref="stockForm" :rules="stockRules">
|
|
|
|
|
- <el-form-item label="调整后库存" prop="newStock">
|
|
|
|
|
- <el-input-number
|
|
|
|
|
- v-model="stockForm.stock"
|
|
|
|
|
- :min="0"
|
|
|
|
|
- :max="999999"
|
|
|
|
|
- controls-position="right"
|
|
|
|
|
- style="width: 100%;"
|
|
|
|
|
- ></el-input-number>
|
|
|
|
|
- </el-form-item>
|
|
|
|
|
- </el-form>
|
|
|
|
|
- <div slot="footer" class="dialog-footer">
|
|
|
|
|
- <el-button @click="stockDialogVisible = false">取 消</el-button>
|
|
|
|
|
- <el-button type="primary" @click="confirmStockChange">确 定</el-button>
|
|
|
|
|
- </div>
|
|
|
|
|
- </el-dialog>
|
|
|
|
|
|
|
|
|
|
<el-dialog
|
|
<el-dialog
|
|
|
- title="调整销量"
|
|
|
|
|
- :visible.sync="salesDialogVisible"
|
|
|
|
|
|
|
+ title="绑定商品"
|
|
|
|
|
+ :visible.sync="goodsDialogVisible"
|
|
|
width="400px"
|
|
width="400px"
|
|
|
:close-on-click-modal="false"
|
|
:close-on-click-modal="false"
|
|
|
:close-on-press-escape="false"
|
|
:close-on-press-escape="false"
|
|
|
>
|
|
>
|
|
|
- <el-form :model="salesForm" ref="salesForm" :rules="salesRules">
|
|
|
|
|
- <el-form-item label="调整后销量" prop="newSales">
|
|
|
|
|
- <el-input-number
|
|
|
|
|
- v-model="salesForm.sales"
|
|
|
|
|
- :min="0"
|
|
|
|
|
- :max="999999"
|
|
|
|
|
- controls-position="right"
|
|
|
|
|
|
|
+ <el-form :model="goodsForm" ref="goodsForm" :rules="salesRules">
|
|
|
|
|
+ <!-- 新增商品下拉选择 -->
|
|
|
|
|
+ <el-form-item label="选择商品" prop="goodsId">
|
|
|
|
|
+ <el-select
|
|
|
|
|
+ v-model="goodsForm.goodsId"
|
|
|
|
|
+ placeholder="请选择商品"
|
|
|
style="width: 100%;"
|
|
style="width: 100%;"
|
|
|
- ></el-input-number>
|
|
|
|
|
|
|
+ @change="handleGoodsChange"
|
|
|
|
|
+ >
|
|
|
|
|
+ <el-option
|
|
|
|
|
+ v-for="goods in goodsList"
|
|
|
|
|
+ :key="goods.goodsId"
|
|
|
|
|
+ :label="goods.productName"
|
|
|
|
|
+ :value="goods.goodsId"
|
|
|
|
|
+ ></el-option>
|
|
|
|
|
+ </el-select>
|
|
|
</el-form-item>
|
|
</el-form-item>
|
|
|
</el-form>
|
|
</el-form>
|
|
|
<div slot="footer" class="dialog-footer">
|
|
<div slot="footer" class="dialog-footer">
|
|
|
- <el-button @click="salesDialogVisible = false">取 消</el-button>
|
|
|
|
|
- <el-button type="primary" @click="confirmSalesChange">确 定</el-button>
|
|
|
|
|
|
|
+ <el-button @click="goodsDialogVisible = false">取 消</el-button>
|
|
|
|
|
+ <el-button type="primary" @click="confirmGoodChange">确 定</el-button>
|
|
|
</div>
|
|
</div>
|
|
|
</el-dialog>
|
|
</el-dialog>
|
|
|
</div>
|
|
</div>
|
|
@@ -250,16 +207,16 @@
|
|
|
|
|
|
|
|
<script>
|
|
<script>
|
|
|
import {
|
|
import {
|
|
|
- addLiveGoods,
|
|
|
|
|
- delLiveGoods,
|
|
|
|
|
- listLiveGoods,
|
|
|
|
|
- listStoreProduct,
|
|
|
|
|
- handleShelfOrUn,
|
|
|
|
|
- handleDeleteSelected,
|
|
|
|
|
|
|
+ listLiveCoupon,
|
|
|
|
|
+ addLiveCoupon,
|
|
|
handleIsShowChange,
|
|
handleIsShowChange,
|
|
|
- updateGoodsStock,
|
|
|
|
|
- updateLiveGoods
|
|
|
|
|
-} from "@/api/live/liveGoods";
|
|
|
|
|
|
|
+ handleDeleteSelected,
|
|
|
|
|
+ delLiveCoupon,
|
|
|
|
|
+ updateLiveCouponBind,
|
|
|
|
|
+ listCoupon
|
|
|
|
|
+} from "@/api/live/liveCoupon";
|
|
|
|
|
+import { listLiveGoods} from "@/api/live/liveGoods";
|
|
|
|
|
+
|
|
|
|
|
|
|
|
export default {
|
|
export default {
|
|
|
data() {
|
|
data() {
|
|
@@ -267,46 +224,46 @@ export default {
|
|
|
liveId: '',
|
|
liveId: '',
|
|
|
loading: true,
|
|
loading: true,
|
|
|
searchTitle: '',
|
|
searchTitle: '',
|
|
|
- queryGoodParams: {
|
|
|
|
|
|
|
+ queryCouponParams: {
|
|
|
pageNum: 1,
|
|
pageNum: 1,
|
|
|
pageSize: 10,
|
|
pageSize: 10,
|
|
|
- productName: null,
|
|
|
|
|
|
|
+ couponName: '',
|
|
|
liveId: null,
|
|
liveId: null,
|
|
|
- storeId: null
|
|
|
|
|
},
|
|
},
|
|
|
- goodsLiveList: [],
|
|
|
|
|
- goodsLiveTotal: 0,
|
|
|
|
|
- goodsParams: {
|
|
|
|
|
|
|
+ couponLiveList: [],
|
|
|
|
|
+ couponLiveTotal: 0,
|
|
|
|
|
+ couponParams: {
|
|
|
pageNum: 1,
|
|
pageNum: 1,
|
|
|
pageSize: 10,
|
|
pageSize: 10,
|
|
|
liveId: null
|
|
liveId: null
|
|
|
},
|
|
},
|
|
|
- goodsList: [],
|
|
|
|
|
- goodsTotal: 0,
|
|
|
|
|
- selectedGoods: [],
|
|
|
|
|
- goodsLoading: false,
|
|
|
|
|
- goodsDialogVisible: false,
|
|
|
|
|
|
|
+ couponList: [],
|
|
|
|
|
+ couponTotal: 0,
|
|
|
|
|
+ selectedCoupon: [],
|
|
|
|
|
+ couponLoading: false,
|
|
|
|
|
+ couponDialogVisible: false,
|
|
|
multipleSelection: [],
|
|
multipleSelection: [],
|
|
|
allChecked: false,
|
|
allChecked: false,
|
|
|
isIndeterminate: false,
|
|
isIndeterminate: false,
|
|
|
socket: null,
|
|
socket: null,
|
|
|
stockDialogVisible: false,
|
|
stockDialogVisible: false,
|
|
|
- salesDialogVisible: false,
|
|
|
|
|
|
|
+ goodsDialogVisible: false,
|
|
|
|
|
+ goodsList: [],
|
|
|
stockForm: {
|
|
stockForm: {
|
|
|
goodsId: '',
|
|
goodsId: '',
|
|
|
stock: 0,
|
|
stock: 0,
|
|
|
productId: 0,
|
|
productId: 0,
|
|
|
},
|
|
},
|
|
|
- salesForm: {
|
|
|
|
|
|
|
+ goodsForm: {
|
|
|
goodsId: '',
|
|
goodsId: '',
|
|
|
sales: 0,
|
|
sales: 0,
|
|
|
productId: 0,
|
|
productId: 0,
|
|
|
},
|
|
},
|
|
|
stockRules: {
|
|
stockRules: {
|
|
|
stock: [
|
|
stock: [
|
|
|
- { required: true, message: '请输入库存数量', trigger: 'blur' },
|
|
|
|
|
- { type: 'number', min: 0, message: '库存数量不能小于0', trigger: 'blur' }
|
|
|
|
|
- ]
|
|
|
|
|
|
|
+ { required: true, message: '请输入库存数量', trigger: 'blur' },
|
|
|
|
|
+ { type: 'number', min: 0, message: '库存数量不能小于0', trigger: 'blur' }
|
|
|
|
|
+ ]
|
|
|
},
|
|
},
|
|
|
salesRules: {
|
|
salesRules: {
|
|
|
sales: [
|
|
sales: [
|
|
@@ -317,18 +274,18 @@ export default {
|
|
|
};
|
|
};
|
|
|
},
|
|
},
|
|
|
watch: {
|
|
watch: {
|
|
|
- '$route.query': {
|
|
|
|
|
|
|
+ '$route.query': {
|
|
|
handler(newQuery) {
|
|
handler(newQuery) {
|
|
|
if (this.$route.params.liveId) {
|
|
if (this.$route.params.liveId) {
|
|
|
this.liveId = this.$route.params.liveId;
|
|
this.liveId = this.$route.params.liveId;
|
|
|
}else {
|
|
}else {
|
|
|
this.liveId = this.$route.query.liveId;
|
|
this.liveId = this.$route.query.liveId;
|
|
|
}
|
|
}
|
|
|
- this.goodsParams.liveId = this.liveId
|
|
|
|
|
|
|
+ this.couponParams.liveId = this.liveId
|
|
|
if(this.liveId == null) {
|
|
if(this.liveId == null) {
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
- this.getLiveGoodsList();
|
|
|
|
|
|
|
+ this.getLiveCouponList();
|
|
|
this.socket = this.$store.state.liveWs[this.liveId]
|
|
this.socket = this.$store.state.liveWs[this.liveId]
|
|
|
},
|
|
},
|
|
|
// 初始化时立即执行一次
|
|
// 初始化时立即执行一次
|
|
@@ -346,6 +303,15 @@ export default {
|
|
|
// this.socket = this.$store.state.liveWs[this.liveId]
|
|
// this.socket = this.$store.state.liveWs[this.liveId]
|
|
|
},
|
|
},
|
|
|
methods: {
|
|
methods: {
|
|
|
|
|
+ handleGoodsChange(row){
|
|
|
|
|
+
|
|
|
|
|
+ },
|
|
|
|
|
+ getLiveGoodsList() {
|
|
|
|
|
+ listLiveGoods({"liveId":this.liveId,"pageNum":1,"pageSize":50}).then(response => {
|
|
|
|
|
+ this.goodsList = response.rows
|
|
|
|
|
+ this.goodsDialogVisible = true;
|
|
|
|
|
+ })
|
|
|
|
|
+ },
|
|
|
handleRouteChange(to, from) {
|
|
handleRouteChange(to, from) {
|
|
|
// 处理路由变化逻辑
|
|
// 处理路由变化逻辑
|
|
|
console.log('路由变化:', from.path, '->', to.path);
|
|
console.log('路由变化:', from.path, '->', to.path);
|
|
@@ -353,72 +319,60 @@ export default {
|
|
|
handleSwitchClick(row) {
|
|
handleSwitchClick(row) {
|
|
|
// 1. 获取「即将切换到的目标状态」(当前状态取反)
|
|
// 1. 获取「即将切换到的目标状态」(当前状态取反)
|
|
|
const targetStatus = !row.isShow
|
|
const targetStatus = !row.isShow
|
|
|
- const goodsList = [row.goodsId];
|
|
|
|
|
- handleIsShowChange({"goodsIds":goodsList,"isShow":targetStatus,"liveId":this.liveId}).then(res=>{
|
|
|
|
|
|
|
+ const couponList = row.id;
|
|
|
|
|
+ if (this.socket == null) {
|
|
|
|
|
+ this.$message.error("请从直播间开启展示状态!");
|
|
|
|
|
+ return;
|
|
|
|
|
+ }
|
|
|
|
|
+ handleIsShowChange({"couponId":couponList,"isShow":targetStatus,"liveId":this.liveId}).then(res=>{
|
|
|
if(res.code == 200){
|
|
if(res.code == 200){
|
|
|
- row.isShow = res.isShow
|
|
|
|
|
- if (res.msg == "目前仅支持单一物品展示") {
|
|
|
|
|
|
|
+ row.isShow = targetStatus
|
|
|
|
|
+ if (res.msg == "目前仅支持单一优惠券推送") {
|
|
|
this.$message.error(res.msg)
|
|
this.$message.error(res.msg)
|
|
|
|
|
+ return;
|
|
|
}
|
|
}
|
|
|
- if (this.socket == null) {
|
|
|
|
|
- this.$message.error("请从直播间开启展示状态!");
|
|
|
|
|
- } else {
|
|
|
|
|
- const msg = {
|
|
|
|
|
- cmd: 'goods',
|
|
|
|
|
- data: {"liveId":this.liveId,"goodsId":goodsList[0],"status":targetStatus ? 1 : 0}
|
|
|
|
|
- }
|
|
|
|
|
- this.socket.send(JSON.stringify(msg));
|
|
|
|
|
|
|
+ const msg = {
|
|
|
|
|
+ cmd: 'coupon',
|
|
|
|
|
+ data: {"liveId":this.liveId,"couponIssueId":row.id,"status":targetStatus ? 1 : 0,"goodsId":row.goodsId,"couponName":row.title,
|
|
|
|
|
+ "couponPrice":row.couponPrice,"useMinPrice":row.useMinPrice,"couponTime":row.couponTime}
|
|
|
}
|
|
}
|
|
|
|
|
+ this.socket.send(JSON.stringify(msg));
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
})
|
|
})
|
|
|
},
|
|
},
|
|
|
- handleShelf(){
|
|
|
|
|
- this.handleShelfOrUn(1)
|
|
|
|
|
- },
|
|
|
|
|
- handleUnshelf(){
|
|
|
|
|
- this.handleShelfOrUn(0)
|
|
|
|
|
- },
|
|
|
|
|
- handleShelfOrUn(type){
|
|
|
|
|
- if (this.multipleSelection.length > 0) {
|
|
|
|
|
- const goodsList = this.getSelectedList();
|
|
|
|
|
- handleShelfOrUn({"goodsIds":goodsList,"status":type}).then(res=>{
|
|
|
|
|
- this.dealResult(res)
|
|
|
|
|
- })
|
|
|
|
|
- } else {
|
|
|
|
|
- this.$message.info("请选择下架商品!")
|
|
|
|
|
- }
|
|
|
|
|
- },
|
|
|
|
|
|
|
+
|
|
|
handleDeleteSelected(){
|
|
handleDeleteSelected(){
|
|
|
if (this.multipleSelection.length > 0) {
|
|
if (this.multipleSelection.length > 0) {
|
|
|
const goodsList = this.getSelectedList();
|
|
const goodsList = this.getSelectedList();
|
|
|
- handleDeleteSelected({"goodsIds":goodsList}).then(res=>{
|
|
|
|
|
|
|
+ handleDeleteSelected({"couponIds":goodsList,"liveId":this.liveId}).then(res=>{
|
|
|
this.dealResult(res)
|
|
this.dealResult(res)
|
|
|
})
|
|
})
|
|
|
} else {
|
|
} else {
|
|
|
- this.$message.info("请选择被删除的商品!")
|
|
|
|
|
|
|
+ this.$message.info("请选择被删除的优惠券!")
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
dealResult(res){
|
|
dealResult(res){
|
|
|
if (res.code == 200) {
|
|
if (res.code == 200) {
|
|
|
- this.getLiveGoodsList();
|
|
|
|
|
- this.$refs.goodTable.clearSelection();
|
|
|
|
|
|
|
+ this.getLiveCouponList();
|
|
|
|
|
+ this.$refs.couponTable.clearSelection();
|
|
|
} else {
|
|
} else {
|
|
|
this.$message.error(res.msg);
|
|
this.$message.error(res.msg);
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
getSelectedList(){
|
|
getSelectedList(){
|
|
|
- var goodsList = []
|
|
|
|
|
|
|
+ var couponList = []
|
|
|
this.multipleSelection.forEach(item => {
|
|
this.multipleSelection.forEach(item => {
|
|
|
- goodsList.push(item.goodsId);
|
|
|
|
|
|
|
+ couponList.push(item.id);
|
|
|
})
|
|
})
|
|
|
- return goodsList;
|
|
|
|
|
|
|
+ return couponList;
|
|
|
},
|
|
},
|
|
|
// 全选或取消全选
|
|
// 全选或取消全选
|
|
|
toggleSelectAll(val) {
|
|
toggleSelectAll(val) {
|
|
|
this.checked = val; // 更新 checkbox 的状态
|
|
this.checked = val; // 更新 checkbox 的状态
|
|
|
if (val) {
|
|
if (val) {
|
|
|
// 如果 checkbox 被选中,则全选
|
|
// 如果 checkbox 被选中,则全选
|
|
|
- this.toggleSelection(this.goodsLiveList);
|
|
|
|
|
|
|
+ this.toggleSelection(this.couponLiveList);
|
|
|
} else {
|
|
} else {
|
|
|
// 如果 checkbox 被取消选中,则取消全选
|
|
// 如果 checkbox 被取消选中,则取消全选
|
|
|
this.toggleSelection();
|
|
this.toggleSelection();
|
|
@@ -427,51 +381,99 @@ export default {
|
|
|
toggleSelection(rows) {
|
|
toggleSelection(rows) {
|
|
|
if (rows && !this.isIndeterminate) {
|
|
if (rows && !this.isIndeterminate) {
|
|
|
rows.forEach(row => {
|
|
rows.forEach(row => {
|
|
|
- this.$refs.goodTable.toggleRowSelection(row);
|
|
|
|
|
|
|
+ this.$refs.couponTable.toggleRowSelection(row);
|
|
|
});
|
|
});
|
|
|
} else {
|
|
} else {
|
|
|
- this.$refs.goodTable.clearSelection();
|
|
|
|
|
|
|
+ this.$refs.couponTable.clearSelection();
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
// 多选框选中数据
|
|
// 多选框选中数据
|
|
|
handleSelectionChange(val) {
|
|
handleSelectionChange(val) {
|
|
|
this.multipleSelection = val;
|
|
this.multipleSelection = val;
|
|
|
// 根据选择项的数量更新 checkbox 的状态
|
|
// 根据选择项的数量更新 checkbox 的状态
|
|
|
- this.allChecked = val.length === this.goodsLiveList.length;
|
|
|
|
|
- this.isIndeterminate = val.length > 0 && val.length < this.goodsLiveList.length;
|
|
|
|
|
|
|
+ this.allChecked = val.length === this.couponLiveList.length;
|
|
|
|
|
+ this.isIndeterminate = val.length > 0 && val.length < this.couponLiveList.length;
|
|
|
},
|
|
},
|
|
|
|
|
|
|
|
- getLiveGoodsList() {
|
|
|
|
|
|
|
+ getLiveCouponList() {
|
|
|
this.loading = true
|
|
this.loading = true
|
|
|
- listLiveGoods(this.goodsParams).then(response => {
|
|
|
|
|
- this.goodsLiveList = response.rows
|
|
|
|
|
- this.goodsLiveTotal = response.total
|
|
|
|
|
|
|
+ listLiveCoupon(this.couponParams).then(response => {
|
|
|
|
|
+ this.couponLiveList = response.rows
|
|
|
|
|
+ this.couponLiveTotal = response.total
|
|
|
|
|
+ this.loading = false
|
|
|
|
|
+ })
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+ // // 添加确认修改库存方法
|
|
|
|
|
+ // goodsDialogVisible() {
|
|
|
|
|
+ // this.$refs.couponForm.validate((valid) => {
|
|
|
|
|
+ // if (valid) {
|
|
|
|
|
+ // updateLiveCouponBind({
|
|
|
|
|
+ // goodsId: this.goodsForm.goodsId,
|
|
|
|
|
+ // couponId: this.goodsForm.sales,
|
|
|
|
|
+ // productId: this.goodsForm.productId
|
|
|
|
|
+ // }).then(response => {
|
|
|
|
|
+ // if (response.code === 200) {
|
|
|
|
|
+ // this.$message.success('销量修改成功');
|
|
|
|
|
+ // this.salesDialogVisible = false;
|
|
|
|
|
+ // this.getLiveCouponList(); // 重新获取列表数据
|
|
|
|
|
+ // } else {
|
|
|
|
|
+ // this.$message.error(response.msg || '销量修改失败');
|
|
|
|
|
+ // }
|
|
|
|
|
+ // });
|
|
|
|
|
+ // }
|
|
|
|
|
+ // });
|
|
|
|
|
+ // },
|
|
|
|
|
+ /** 处理行点击事件 */
|
|
|
|
|
+ handleCouponRowClick(row, column) {
|
|
|
|
|
+ // 如果点击的是复选框列,不进行处理
|
|
|
|
|
+ if (column.type === 'selection') {
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 获取表格实例
|
|
|
|
|
+ const table = this.$refs.couponTable[0]
|
|
|
|
|
+ if (!table) {
|
|
|
|
|
+ return
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 判断当前行是否已经被选中
|
|
|
|
|
+ const isSelected = this.selectedCoupon.some(item => item.id === row.id)
|
|
|
|
|
+
|
|
|
|
|
+ // 切换选中状态
|
|
|
|
|
+ table.toggleRowSelection(row, !isSelected)
|
|
|
|
|
+ },
|
|
|
|
|
+ getCouponLists() {
|
|
|
|
|
+ this.queryCouponParams.liveId = this.liveId
|
|
|
|
|
+ listCoupon(this.queryCouponParams).then(response => {
|
|
|
|
|
+ this.couponList = response.rows
|
|
|
|
|
+ this.couponTotal = response.total
|
|
|
this.loading = false
|
|
this.loading = false
|
|
|
})
|
|
})
|
|
|
},
|
|
},
|
|
|
- handleAddLiveGoods(){
|
|
|
|
|
- this.goodsDialogVisible = true;
|
|
|
|
|
- this.getStoreProductLists()
|
|
|
|
|
|
|
+ handleAddLiveCoupon(){
|
|
|
|
|
+ this.couponDialogVisible = true;
|
|
|
|
|
+ this.getCouponLists()
|
|
|
},
|
|
},
|
|
|
- handleGoodsSearch(){
|
|
|
|
|
- this.queryGoodParams.pageNum = 1
|
|
|
|
|
- this.queryGoodParams.productName = this.searchTitle
|
|
|
|
|
- this.getStoreProductLists()
|
|
|
|
|
|
|
+ handleCouponSearch(){
|
|
|
|
|
+ this.queryCouponParams.pageNum = 1
|
|
|
|
|
+ this.queryCouponParams.couponName = this.searchTitle
|
|
|
|
|
+ this.getCouponLists()
|
|
|
},
|
|
},
|
|
|
- handleGoodsChange(goods) {
|
|
|
|
|
- this.selectedGoods = goods
|
|
|
|
|
|
|
+ handleCouponChange(coupon) {
|
|
|
|
|
+ this.selectedCoupon = coupon
|
|
|
},
|
|
},
|
|
|
- confirmAddGoods(){
|
|
|
|
|
- if (this.selectedGoods.length === 0) {
|
|
|
|
|
|
|
+ confirmAddCoupon(){
|
|
|
|
|
+ if (this.selectedCoupon.length === 0) {
|
|
|
this.$message({
|
|
this.$message({
|
|
|
- message: '请选择要添加的商品',
|
|
|
|
|
|
|
+ message: '请选择要添加的优惠券',
|
|
|
type: 'warning'
|
|
type: 'warning'
|
|
|
})
|
|
})
|
|
|
return
|
|
return
|
|
|
}
|
|
}
|
|
|
- addLiveGoods({
|
|
|
|
|
|
|
+ addLiveCoupon({
|
|
|
liveId: this.liveId,
|
|
liveId: this.liveId,
|
|
|
- productsId: this.selectedGoods.map(item => item.productId).join(',')
|
|
|
|
|
|
|
+ couponIds: this.selectedCoupon.map(item => item.id).join(',')
|
|
|
}).then(response => {
|
|
}).then(response => {
|
|
|
if (response.code !== 200) {
|
|
if (response.code !== 200) {
|
|
|
this.$message({
|
|
this.$message({
|
|
@@ -480,94 +482,50 @@ export default {
|
|
|
});
|
|
});
|
|
|
return;
|
|
return;
|
|
|
}
|
|
}
|
|
|
- this.goodsDialogVisible = false;
|
|
|
|
|
- this.getLiveGoodsList()
|
|
|
|
|
|
|
+ this.couponDialogVisible = false;
|
|
|
|
|
+ this.getLiveCouponList()
|
|
|
})
|
|
})
|
|
|
},
|
|
},
|
|
|
- handleGoodDelete(row){
|
|
|
|
|
- delLiveGoods(row.goodsId).then(response => {
|
|
|
|
|
- this.getLiveGoodsList()
|
|
|
|
|
|
|
+ handleCouponDelete(row){
|
|
|
|
|
+ var couponList = []
|
|
|
|
|
+ couponList.push(row.id);
|
|
|
|
|
+ delLiveCoupon({"couponIds":couponList,"liveId":this.liveId}).then(response => {
|
|
|
|
|
+ this.getLiveCouponList()
|
|
|
})
|
|
})
|
|
|
},
|
|
},
|
|
|
|
|
+ handleCouponBind(row){
|
|
|
|
|
+ this.goodsForm.couponId = row.id;
|
|
|
|
|
+ this.goodsForm.goodsId = row.goodsId;
|
|
|
|
|
+ this.getLiveGoodsList()
|
|
|
|
|
+ },
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
handleGoodStock(row){
|
|
handleGoodStock(row){
|
|
|
this.stockForm.goodsId = row.goodsId;
|
|
this.stockForm.goodsId = row.goodsId;
|
|
|
this.stockForm.stock = row.stock;
|
|
this.stockForm.stock = row.stock;
|
|
|
this.stockForm.productId = row.productId;
|
|
this.stockForm.productId = row.productId;
|
|
|
this.stockDialogVisible = true;
|
|
this.stockDialogVisible = true;
|
|
|
},
|
|
},
|
|
|
- handleGoodSale(row){
|
|
|
|
|
- this.salesForm.goodsId = row.goodsId;
|
|
|
|
|
- this.salesForm.sales = row.sales;
|
|
|
|
|
- this.salesForm.productId = row.productId;
|
|
|
|
|
- this.salesDialogVisible = true;
|
|
|
|
|
- },
|
|
|
|
|
- // 添加确认修改库存方法
|
|
|
|
|
- confirmStockChange() {
|
|
|
|
|
- this.$refs.stockForm.validate((valid) => {
|
|
|
|
|
|
|
+ // 绑定商品
|
|
|
|
|
+ confirmGoodChange() {
|
|
|
|
|
+ this.$refs.goodsForm.validate((valid) => {
|
|
|
if (valid) {
|
|
if (valid) {
|
|
|
- updateGoodsStock({
|
|
|
|
|
- goodsId: this.stockForm.goodsId,
|
|
|
|
|
- stock: this.stockForm.stock,
|
|
|
|
|
- productId: this.stockForm.productId
|
|
|
|
|
|
|
+ updateLiveCouponBind({
|
|
|
|
|
+ goodsId: this.goodsForm.goodsId,
|
|
|
|
|
+ couponId: this.goodsForm.couponId,
|
|
|
|
|
+ liveId: this.liveId
|
|
|
}).then(response => {
|
|
}).then(response => {
|
|
|
if (response.code === 200) {
|
|
if (response.code === 200) {
|
|
|
- this.$message.success('库存修改成功');
|
|
|
|
|
- this.stockDialogVisible = false;
|
|
|
|
|
- this.getLiveGoodsList(); // 重新获取列表数据
|
|
|
|
|
|
|
+ this.$message.success('商品修改成功');
|
|
|
|
|
+ this.goodsDialogVisible = false;
|
|
|
|
|
+ this.getLiveCouponList(); // 重新获取列表数据
|
|
|
} else {
|
|
} else {
|
|
|
- this.$message.error(response.msg || '库存修改失败');
|
|
|
|
|
|
|
+ this.$message.error(response.msg || '商品修改失败');
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
|
},
|
|
},
|
|
|
- // 添加确认修改库存方法
|
|
|
|
|
- confirmSalesChange() {
|
|
|
|
|
- this.$refs.salesForm.validate((valid) => {
|
|
|
|
|
- if (valid) {
|
|
|
|
|
- updateLiveGoods({
|
|
|
|
|
- goodsId: this.salesForm.goodsId,
|
|
|
|
|
- sales: this.salesForm.sales,
|
|
|
|
|
- productId: this.salesForm.productId
|
|
|
|
|
- }).then(response => {
|
|
|
|
|
- if (response.code === 200) {
|
|
|
|
|
- this.$message.success('销量修改成功');
|
|
|
|
|
- this.salesDialogVisible = false;
|
|
|
|
|
- this.getLiveGoodsList(); // 重新获取列表数据
|
|
|
|
|
- } else {
|
|
|
|
|
- this.$message.error(response.msg || '销量修改失败');
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
- },
|
|
|
|
|
- /** 处理行点击事件 */
|
|
|
|
|
- handleGoodsRowClick(row, column) {
|
|
|
|
|
- // 如果点击的是复选框列,不进行处理
|
|
|
|
|
- if (column.type === 'selection') {
|
|
|
|
|
- return
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- // 获取表格实例
|
|
|
|
|
- const table = this.$refs.goodsTable[0]
|
|
|
|
|
- if (!table) {
|
|
|
|
|
- return
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- // 判断当前行是否已经被选中
|
|
|
|
|
- const isSelected = this.selectedGoods.some(item => item.id === row.id)
|
|
|
|
|
-
|
|
|
|
|
- // 切换选中状态
|
|
|
|
|
- table.toggleRowSelection(row, !isSelected)
|
|
|
|
|
- },
|
|
|
|
|
- getStoreProductLists() {
|
|
|
|
|
- this.queryGoodParams.liveId = this.liveId
|
|
|
|
|
- listStoreProduct(this.queryGoodParams).then(response => {
|
|
|
|
|
- this.goodsList = response.rows
|
|
|
|
|
- this.goodsTotal = response.total
|
|
|
|
|
- this.loading = false
|
|
|
|
|
- })
|
|
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
};
|
|
};
|