refactor(ui): 替换iView为TDesign组件库并优化相关代码

feat(coupon): 新增优惠券详情页面
feat(api): 添加会员评价状态更新和删除接口
perf(pagination): 统一分页大小选项为[20, 50, 100]
style(theme): 移除旧主题文件并更新样式类名
fix(menu): 修复菜单组件兼容性问题
chore(deps): 更新package.json依赖项
docs(modal): 添加全局Modal组件兼容层
This commit is contained in:
pikachu1995@126.com
2025-12-07 19:08:03 +08:00
parent d701c72928
commit 43f214b40a
89 changed files with 2253 additions and 1556 deletions

View File

@@ -1,59 +1,59 @@
<template>
<div class="wrapper">
<Card>
<Form ref="searchForm" :model="params" inline :label-width="100" class="search-form">
<Form-item label="商品名称">
<Input type="text" v-model="params.name" placeholder="请输入商品名称" clearable style="width: 240px" />
</Form-item>
<t-card>
<t-form ref="searchForm" :data="params" layout="inline" :labelWidth="100" class="search-form">
<t-form-item label="商品名称" name="name">
<t-input v-model="params.name" placeholder="请输入商品名称" clearable style="width: 240px" />
</t-form-item>
<Button @click="getLiveGoodsMethods('clear')" type="primary" class="search-btn" icon="ios-search">搜索</Button>
</Form>
</Card>
<Card>
<t-form-item>
<t-button @click="getLiveGoodsMethods('clear')" theme="primary" class="search-btn">搜索</t-button>
</t-form-item>
</t-form>
</t-card>
<t-card>
<h4 v-if="!reviewed">
由于直播商品需经过小程序直播平台的审核你需要在此先提审商品为了不影响直播间选取商品请提前1天提审商品
</h4>
<div>
<Tabs v-model="params.auditStatus">
<TabPane v-for="(item,index) in liveTabWay" :key="index" :label="item.label" :name="item.type+''">
</TabPane>
</Tabs>
<t-tabs :value="params.auditStatus" @change="val => params.auditStatus = Number(val)">
<t-tab-panel v-for="(item,index) in liveTabWay" :key="index" :label="item.label" :value="item.type">
</t-tab-panel>
</t-tabs>
</div>
<Button v-if="!reviewed" type="primary" style="margin-bottom:10px;" @click="addNewLiveGoods" icon="md-add">选择商品</Button>
<Button type="primary" v-if="params.auditStatus == 0" ghost style="margin:0 0 10px 10px" @click="getLiveGoodsMethods('clear')">更新状态</Button>
<t-button v-if="!reviewed" theme="primary" class="mb_10" @click="addNewLiveGoods">选择商品</t-button>
<t-button theme="primary" v-if="params.auditStatus == 0" variant="outline" style="margin:0 0 10px 10px" @click="getLiveGoodsMethods('clear')">更新状态</t-button>
<div style="position:relative">
<Spin size="large" fix v-if="tableLoading">
</Spin>
<Table class="mt_10" disabled-hover :columns="liveGoodsColumns" :data="liveGoodsData">
<t-table class="mt_10" :columns="tColumns" :data="liveGoodsData" rowKey="id">
<template slot-scope="{ row }" slot="goodsName">
<template #goodsName="{ row }">
<div class="flex-goods">
<img class="thumbnail" :src="row.thumbnail || row.goodsImage">
{{ row.goodsName || row.name }}
</div>
</template>
<template slot-scope="{ row ,index }" class="price" slot="price">
<template #price="{ row ,index }">
<!-- 如果为新增商品显示 -->
<RadioGroup v-if="params.auditStatus == 99" @on-change="changeRadio(row,'priceType')" v-model="row.priceType">
<t-radio-group v-if="params.auditStatus == 99" @change="val => changeRadio(row,'priceType', val)" v-model="row.priceType">
<div class="price-item">
<Radio :label="1">一口价:</Radio>
<InputNumber :min="0.1" v-if="liveGoodsData[index].priceType == 1" style="width:100px" v-model="liveGoodsData[index].price"></InputNumber>
<t-radio :value="1">一口价:</t-radio>
<t-input-number :min="0.1" v-if="liveGoodsData[index].priceType == 1" style="width:100px" v-model="liveGoodsData[index].price"></t-input-number>
</div>
<div class="price-item">
<Radio :label="2">区间价:</Radio> <span v-if="liveGoodsData[index].priceType == 2">
<InputNumber :min="0.1" style="width:100px" v-model="liveGoodsData[index].price" />
<InputNumber :min="0.1" style="width:100px" v-model="liveGoodsData[index].price2" />
<t-radio :value="2">区间价:</t-radio> <span v-if="liveGoodsData[index].priceType == 2">
<t-input-number :min="0.1" style="width:100px" v-model="liveGoodsData[index].price" />
<t-input-number :min="0.1" style="width:100px" v-model="liveGoodsData[index].price2" />
</span>
</div>
<div class="price-item">
<Radio :label="3">折扣价:</Radio> <span v-if="liveGoodsData[index].priceType == 3">原价<InputNumber :min="0.1" style="width:100px" v-model="liveGoodsData[index].price"></InputNumber>现价
<InputNumber :min="0.1" style="width:100px" v-model="liveGoodsData[index].price2" />
<t-radio :value="3">折扣价:</t-radio> <span v-if="liveGoodsData[index].priceType == 3">原价<t-input-number :min="0.1" style="width:100px" v-model="liveGoodsData[index].price"></t-input-number>现价
<t-input-number :min="0.1" style="width:100px" v-model="liveGoodsData[index].price2" />
</span>
</div>
</RadioGroup>
</t-radio-group>
<div v-else>
<div v-if="row.priceType == 1"><priceColorScheme :value="row.price" :color="$mainColor" /></div>
<div class="flex" v-if="row.priceType == 2"><priceColorScheme :value="row.price" :color="$mainColor" />至<priceColorScheme :value="row.price2" :color="$mainColor" /></div>
@@ -62,25 +62,23 @@
</template>
<template slot-scope="{ row ,index }" slot="action">
<template #action="{ row ,index }">
<a v-if="params.auditStatus == 99" @click="liveGoodsData.splice(index,1)" style="color:#2d8cf0;cursor:pointer;text-decoration:none">删除</a>
<span v-if="params.auditStatus == 99 || (params.auditStatus != 99 && !reviewed) || reviewed" style="margin:0 8px;color:#dcdee2">|</span>
<a v-if="params.auditStatus != 99 && !reviewed" @click="$router.push({path:'/goods-operation-edit',query:{id:row.goodsId}})" style="color:#2d8cf0;cursor:pointer;text-decoration:none">查看</a>
<span v-if="reviewed" style="margin:0 8px;color:#dcdee2">|</span>
<a v-if="reviewed" @click="selectedLiveGoods(row,index)" style="color:#2d8cf0;cursor:pointer;text-decoration:none">{{row.___selected ? '':''}}选择</a>
</template>
</Table>
</t-table>
<div class="flex">
<Page size="small" :total="goodsTotal" @on-change="changePageNumber" class="pageration" @on-page-size-change="changePageSize" :page-size="params.pageSize" show-total show-elevator
show-sizer>
</Page>
<t-pagination size="small" :total="Number(goodsTotal)" @change="({ current }) => changePageNumber(current)" class="pageration" @page-size-change="(size) => changePageSize(size)" :pageSize="params.pageSize" :pageSizeOptions="[20, 50, 100]" showJumper showPageSize />
</div>
</div>
</Card>
</t-card>
<sku-select ref="skuSelect" @selectedGoodsData="selectedGoodsData"></sku-select>
<div v-if="params.auditStatus == 99" class="submit">
<Button type="primary" :loading="saveGoodsLoading" @click="saveLiveGoods">保存商品</Button>
<t-button theme="primary" :loading="saveGoodsLoading" @click="saveLiveGoods">保存商品</t-button>
</div>
</div>
</template>
@@ -99,7 +97,7 @@ export default {
tableLoading: false, //表格是否加载
params: {
pageNumber: 1,
pageSize: 10,
pageSize: 20,
auditStatus: 2, //商品状态
},
// 商品审核状态
@@ -152,6 +150,16 @@ export default {
selectedGoods: [],
};
},
computed: {
tColumns() {
return (this.liveGoodsColumns || []).map(c => {
const nc = Object.assign({}, c)
if (nc.key && !nc.colKey) { nc.colKey = nc.key; delete nc.key }
if (nc.slot && !nc.colKey) { nc.colKey = nc.slot; delete nc.slot }
return nc
})
}
},
props: {
// 是否是已审核,此处为组件模式时使用。去除添加等功能 只保留查询以及新增选择回调数据
reviewed: {