mirror of
https://gitee.com/beijing_hongye_huicheng/lilishop-ui.git
synced 2026-06-23 18:40:25 +08:00
fix: 更新 API 请求参数格式及优化组件样式
- 将 addEvaluation API 的参数从 params 修改为 data,以符合标准请求格式 - 在多个组件中调整样式,提升响应式布局和用户体验 - 优化商品详情页的倒计时显示,增强视觉效果 - 更新购物车操作按钮样式,提升一致性和可用性
This commit is contained in:
@@ -158,7 +158,7 @@ export function addEvaluation (params) {
|
||||
url: `/buyer/member/evaluation`,
|
||||
method: Method.POST,
|
||||
needToken: true,
|
||||
params
|
||||
data: params
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -18,5 +18,8 @@
|
||||
}
|
||||
|
||||
// 与 CateNav 商品分类栏、Carousel 左占位一致的列宽
|
||||
$index-main-width: 1200px;
|
||||
$index-side-col-width: 263.2px;
|
||||
$index-col-gap: 10px;
|
||||
// 1200 - 263.2*2 - 10*2 = 653.6px
|
||||
$index-center-col-width: $index-main-width - ($index-side-col-width * 2) - ($index-col-gap * 2);
|
||||
|
||||
@@ -3,7 +3,12 @@
|
||||
<div class="wrapper" v-if="type === 'goodsDetail'">
|
||||
<div class="wr-l"><el-icon :size="23"><AlarmClock /></el-icon> 秒杀活动</div>
|
||||
<div class="count-down" v-if="end === ''">
|
||||
<p>倒计时:</p><span>{{ hours }}</span><span>{{ minutes }}</span><span>{{ seconds }}</span>
|
||||
<span class="count-down-label">倒计时:</span>
|
||||
<span class="count-down-num">{{ hours }}</span>
|
||||
<span class="count-down-colon">:</span>
|
||||
<span class="count-down-num">{{ minutes }}</span>
|
||||
<span class="count-down-colon">:</span>
|
||||
<span class="count-down-num">{{ seconds }}</span>
|
||||
</div>
|
||||
<div v-else>{{end}}</div>
|
||||
</div>
|
||||
@@ -89,36 +94,35 @@ export default {
|
||||
font-size: 13px;
|
||||
}
|
||||
.count-down {
|
||||
margin-right: -20px;
|
||||
p{
|
||||
float: left;
|
||||
line-height: 20px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 4px;
|
||||
font-size: 13px;
|
||||
line-height: 1;
|
||||
|
||||
.count-down-label {
|
||||
flex-shrink: 0;
|
||||
white-space: nowrap;
|
||||
}
|
||||
> span {
|
||||
position: relative;
|
||||
float: left;
|
||||
width: 20px;
|
||||
|
||||
.count-down-num {
|
||||
display: inline-flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
min-width: 20px;
|
||||
height: 20px;
|
||||
text-align: center;
|
||||
padding: 0 2px;
|
||||
background-color: #2f3430;
|
||||
margin-right: 20px;
|
||||
color: white;
|
||||
color: #fff;
|
||||
font-size: 14px;
|
||||
line-height: 20px;
|
||||
&::after {
|
||||
content: ":";
|
||||
display: block;
|
||||
position: absolute;
|
||||
right: -20px;
|
||||
font-weight: bolder;
|
||||
font-size: 14px;
|
||||
width: 20px;
|
||||
height: 100%;
|
||||
top: 0;
|
||||
}
|
||||
line-height: 1;
|
||||
border-radius: 2px;
|
||||
}
|
||||
> span:last-child::after {
|
||||
content: "";
|
||||
|
||||
.count-down-colon {
|
||||
font-weight: bold;
|
||||
font-size: 14px;
|
||||
line-height: 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -69,7 +69,12 @@
|
||||
<p class="remarks-content">{{ item.reply }}</p>
|
||||
<div>
|
||||
<div class="comment-img" v-if="item.replyImage">
|
||||
<div v-for="(img, imgIndex) in item.replyImage.split(',')" @click="$previewImage(img)" :key="imgIndex">
|
||||
<div
|
||||
v-for="(img, imgIndex) in item.replyImage.split(',')"
|
||||
:key="imgIndex"
|
||||
:class="{ borderColor: img === item.previewImg }"
|
||||
@click="previewImg(img, item)"
|
||||
>
|
||||
<img :src="img" alt="">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -226,7 +226,7 @@ export default {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.nav ul {
|
||||
.nav > ul {
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
@@ -234,10 +234,11 @@ export default {
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.nav li {
|
||||
.nav > ul > li,
|
||||
.location > ul.flex > li {
|
||||
cursor: pointer;
|
||||
float: none;
|
||||
line-height: 1;
|
||||
line-height: 36px;
|
||||
margin-right: 15px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
@@ -331,6 +332,7 @@ export default {
|
||||
|
||||
.username-p {
|
||||
position: relative;
|
||||
z-index: 100;
|
||||
|
||||
div {
|
||||
cursor: pointer;
|
||||
@@ -345,59 +347,71 @@ export default {
|
||||
.drop-items {
|
||||
position: absolute;
|
||||
display: none;
|
||||
top: 45px;
|
||||
left: 0;
|
||||
right: 0;
|
||||
margin: 0 auto;
|
||||
padding: 5px 10px;
|
||||
z-index: 20;
|
||||
height: 150px;
|
||||
flex-direction: column;
|
||||
top: calc(100% + 10px);
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
margin: 0;
|
||||
padding: 4px 0;
|
||||
z-index: 1000;
|
||||
min-width: 100px;
|
||||
width: max-content;
|
||||
background-color: #fff;
|
||||
width: 80px;
|
||||
border: 1px solid #eee;
|
||||
box-shadow: 2px 2px 7px #999;
|
||||
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
|
||||
list-style: none;
|
||||
|
||||
li {
|
||||
color: rgb(107, 106, 106);
|
||||
display: block;
|
||||
float: none;
|
||||
width: 100%;
|
||||
border-bottom: 1px solid rgb(207, 206, 206);
|
||||
margin: 0;
|
||||
padding: 8px 16px;
|
||||
line-height: 1.4;
|
||||
color: #666;
|
||||
font-size: 13px;
|
||||
font-weight: normal;
|
||||
text-align: center;
|
||||
white-space: nowrap;
|
||||
border-bottom: 1px solid #f0f0f0;
|
||||
box-sizing: border-box;
|
||||
|
||||
&:last-child {
|
||||
border: none;
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
cursor: pointer;
|
||||
color: $theme_color;
|
||||
background-color: #fff7f7;
|
||||
}
|
||||
}
|
||||
|
||||
&::before {
|
||||
position: absolute;
|
||||
top: -20px;
|
||||
left: 30px;
|
||||
top: -6px;
|
||||
left: 50%;
|
||||
transform: translateX(-50%);
|
||||
content: '';
|
||||
width: 0;
|
||||
height: 0;
|
||||
border: 10px solid #999;
|
||||
border-color: transparent transparent #fff transparent;
|
||||
border: 6px solid transparent;
|
||||
border-bottom-color: #fff;
|
||||
}
|
||||
|
||||
&::after {
|
||||
content: '';
|
||||
position: absolute;
|
||||
width: 80px;
|
||||
height: 20px;
|
||||
top: -20px;
|
||||
width: 100%;
|
||||
height: 10px;
|
||||
top: -10px;
|
||||
left: 0;
|
||||
}
|
||||
}
|
||||
|
||||
&:hover {
|
||||
.drop-items {
|
||||
display: block;
|
||||
display: flex;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,6 +38,7 @@ export default {
|
||||
<style lang="scss" scoped>
|
||||
.model-form {
|
||||
position: relative;
|
||||
z-index: 0;
|
||||
width: 100%;
|
||||
}
|
||||
.model-content {
|
||||
|
||||
@@ -193,8 +193,10 @@ export default {
|
||||
}
|
||||
.carousel-wrap {
|
||||
width: 100%;
|
||||
max-width: 1200px;
|
||||
margin: 0 auto;
|
||||
box-sizing: border-box;
|
||||
overflow: visible;
|
||||
overflow: hidden;
|
||||
}
|
||||
.bannerAd{
|
||||
width: 100%;
|
||||
|
||||
@@ -4,15 +4,15 @@
|
||||
<!-- 侧边导航占位(与 CateNav 分类栏同宽,勿与 CateNav .nav-side 混用类名) -->
|
||||
<div class="carousel-side-spacer"></div>
|
||||
<div class="nav-content">
|
||||
<!-- 轮播图:无数据时不挂载 el-carousel,避免 Element Plus 卸载子项时报错 -->
|
||||
<!-- 轮播图:无有效图片时不挂载 el-carousel;勿对 el-carousel 使用随图片变化的 key,否则 Vue3 patch 会报 emitsOptions 错误 -->
|
||||
<el-carousel
|
||||
v-if="carouselList.length"
|
||||
:key="carouselRenderKey"
|
||||
v-if="displaySlides.length"
|
||||
height="334px"
|
||||
:interval="5000"
|
||||
:loop="displaySlides.length > 1"
|
||||
>
|
||||
<el-carousel-item
|
||||
v-for="(item, index) in carouselList"
|
||||
v-for="(item, index) in displaySlides"
|
||||
:key="carouselItemKey(item, index)"
|
||||
>
|
||||
<div class="swiper-img">
|
||||
@@ -96,10 +96,8 @@ export default {
|
||||
carouselList() {
|
||||
return this.data?.options?.list || [];
|
||||
},
|
||||
carouselRenderKey() {
|
||||
const moduleKey = this.data?.key || "carousel";
|
||||
const imgs = this.carouselList.map((item) => item?.img || "").join("|");
|
||||
return `${moduleKey}-${this.carouselList.length}-${imgs}`;
|
||||
displaySlides() {
|
||||
return this.carouselList.filter((item) => item && item.img);
|
||||
},
|
||||
},
|
||||
data() {
|
||||
@@ -291,12 +289,14 @@ export default {
|
||||
}
|
||||
|
||||
.model-carousel {
|
||||
width: 1200px;
|
||||
max-width: 100%;
|
||||
width: 100%;
|
||||
max-width: 1200px;
|
||||
height: 340px;
|
||||
margin: 0 auto;
|
||||
overflow: visible;
|
||||
overflow: hidden;
|
||||
box-sizing: border-box;
|
||||
position: relative;
|
||||
z-index: 0;
|
||||
}
|
||||
|
||||
.hover-pointer {
|
||||
@@ -358,14 +358,14 @@ export default {
|
||||
|
||||
}
|
||||
|
||||
/* 导航主体:固定列宽与 CateNav 完全一致(263.2 + 10 + 637 + 10 + 263.2 = 1183.4px) */
|
||||
/* 导航主体:263.2 + 10 + 1fr + 10 + 263.2 = 1200px,与下方楼层右缘对齐 */
|
||||
.nav-body {
|
||||
width: 1200px;
|
||||
max-width: 100%;
|
||||
width: 100%;
|
||||
max-width: 1200px;
|
||||
height: 340px;
|
||||
margin: 0 auto;
|
||||
display: grid;
|
||||
grid-template-columns: 263.2px 637px 263.2px;
|
||||
grid-template-columns: 263.2px minmax(0, 1fr) 263.2px;
|
||||
column-gap: 10px;
|
||||
align-items: start;
|
||||
box-sizing: border-box;
|
||||
@@ -385,9 +385,8 @@ export default {
|
||||
/*导航内容*/
|
||||
.nav-content {
|
||||
grid-column: 2;
|
||||
width: 637px;
|
||||
min-width: 637px;
|
||||
max-width: 637px;
|
||||
width: 100%;
|
||||
min-width: 0;
|
||||
margin-top: 10px;
|
||||
height: 333.9px;
|
||||
position: relative;
|
||||
|
||||
@@ -260,7 +260,7 @@ export default {
|
||||
}
|
||||
.cate-nav {
|
||||
position: relative;
|
||||
z-index: 3;
|
||||
z-index: 5;
|
||||
width: 100%;
|
||||
margin: 14px 0 0;
|
||||
box-sizing: border-box;
|
||||
@@ -286,6 +286,7 @@ export default {
|
||||
font-weight: normal;
|
||||
color: #333333;
|
||||
letter-spacing: 0px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.nav-item {
|
||||
flex: 1;
|
||||
@@ -317,7 +318,7 @@ export default {
|
||||
position: absolute;
|
||||
left: 0;
|
||||
top: 46px;
|
||||
z-index: 10;
|
||||
z-index: 1000;
|
||||
}
|
||||
|
||||
.nav-side {
|
||||
@@ -356,11 +357,14 @@ export default {
|
||||
.nav-side ul {
|
||||
width: 100%;
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
.nav-side li {
|
||||
padding: 0 0 16.2px 37.4px;
|
||||
font-size: 13px;
|
||||
line-height: 18px;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.nav-side-item:hover {
|
||||
cursor: pointer;
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
<div class="width_150">单价(元)</div>
|
||||
<div class="width_100">数量</div>
|
||||
<div class="width_150">小计</div>
|
||||
<div class="width_100">操作</div>
|
||||
<div class="cart-ops-col">操作</div>
|
||||
</div>
|
||||
<div v-if="cartList.length === 0" class="cart-empty">
|
||||
<p>购物车空空如也</p>
|
||||
@@ -172,22 +172,21 @@
|
||||
<div class="width_150">
|
||||
{{ $filters.unitPrice(goods.subTotal, "¥") }}
|
||||
</div>
|
||||
<div class="width_100">
|
||||
<el-button
|
||||
v-if="!goods.errorMessage"
|
||||
size="small"
|
||||
type="primary"
|
||||
@click="delGoods(goods.goodsSku.id)"
|
||||
>删除</el-button
|
||||
>
|
||||
<el-button
|
||||
v-if="!goods.errorMessage"
|
||||
size="small"
|
||||
type="info"
|
||||
@click="collectGoods(goods.goodsSku.id)"
|
||||
style="margin-left: 10px"
|
||||
>收藏</el-button
|
||||
>
|
||||
<div class="cart-ops-col">
|
||||
<div v-if="!goods.errorMessage" class="cart-ops">
|
||||
<el-button
|
||||
size="small"
|
||||
class="cart-del-btn"
|
||||
@click="delGoods(goods.goodsSku.id)"
|
||||
>删除</el-button
|
||||
>
|
||||
<el-button
|
||||
size="small"
|
||||
class="cart-collect-btn"
|
||||
@click="collectGoods(goods.goodsSku.id)"
|
||||
>收藏</el-button
|
||||
>
|
||||
</div>
|
||||
</div>
|
||||
<div class="error-goods" v-if="goods.errorMessage">
|
||||
<div style="margin-top: 20px">{{ goods.errorMessage }}</div>
|
||||
@@ -767,6 +766,48 @@ export default {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.cart-ops-col {
|
||||
width: 130px;
|
||||
min-width: 130px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.cart-ops {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
gap: 8px;
|
||||
flex-wrap: nowrap;
|
||||
}
|
||||
|
||||
.cart-del-btn {
|
||||
background-color: #ff7d79 !important;
|
||||
border-color: #ff7d79 !important;
|
||||
color: #fff !important;
|
||||
margin: 0 !important;
|
||||
|
||||
&:hover,
|
||||
&:focus {
|
||||
background-color: #ff6b66 !important;
|
||||
border-color: #ff6b66 !important;
|
||||
color: #fff !important;
|
||||
}
|
||||
}
|
||||
|
||||
.cart-collect-btn {
|
||||
background-color: #fa6419 !important;
|
||||
border-color: #fa6419 !important;
|
||||
color: #fff !important;
|
||||
margin: 0 !important;
|
||||
|
||||
&:hover,
|
||||
&:focus {
|
||||
background-color: #e55a15 !important;
|
||||
border-color: #e55a15 !important;
|
||||
color: #fff !important;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<style>
|
||||
.el-input-number .el-input__inner {
|
||||
|
||||
@@ -28,10 +28,10 @@
|
||||
<div class="eval-con">
|
||||
<div>
|
||||
<span class="color999">商品评价:</span>
|
||||
<el-radio-group style="margin-bottom:5px;color:#999" v-model="orderGoods.grade" type="button" button-style="solid">
|
||||
<el-radio label="GOOD">好评</el-radio>
|
||||
<el-radio label="MODERATE">中评</el-radio>
|
||||
<el-radio label="WORSE">差评</el-radio>
|
||||
<el-radio-group v-model="orderGoods.grade">
|
||||
<el-radio-button value="GOOD">好评</el-radio-button>
|
||||
<el-radio-button value="MODERATE">中评</el-radio-button>
|
||||
<el-radio-button value="WORSE">差评</el-radio-button>
|
||||
</el-radio-group>
|
||||
<el-input type="textarea" maxlength="500" show-word-limit :rows="4" v-model="orderGoods.content" />
|
||||
</div>
|
||||
@@ -106,6 +106,12 @@ export default {
|
||||
|
||||
if (!this.form.descriptionScore) {
|
||||
this.$Message.warning('描述评价不能为空')
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!this.orderGoods.content || !String(this.orderGoods.content).trim()) {
|
||||
this.$Message.warning('评论内容不能为空')
|
||||
return false;
|
||||
}
|
||||
|
||||
this.loading = true;
|
||||
@@ -118,17 +124,20 @@ export default {
|
||||
serviceScore: this.form.serviceScore,
|
||||
deliveryScore: this.form.deliveryScore,
|
||||
grade: goods.grade,
|
||||
content: goods.content || '',
|
||||
images: goods.uploadList.toString()
|
||||
content: goods.content.trim(),
|
||||
images: goods.uploadList.length ? goods.uploadList.join(',') : ''
|
||||
}
|
||||
addEvaluation(params).then(res => {
|
||||
this.loading = false
|
||||
if (res.success) {
|
||||
this.$Message.success('评价成功')
|
||||
this.$router.push('/home/CommentList')
|
||||
} else {
|
||||
this.$Message.error(res.message || '评价失败,请稍后重试')
|
||||
}
|
||||
}).catch(() => {
|
||||
}).catch((err) => {
|
||||
this.loading = false;
|
||||
this.$Message.error(err?.message || '评价失败,请稍后重试')
|
||||
})
|
||||
},
|
||||
goGoodsDetail (skuId, goodsId) { // 跳转商品详情
|
||||
|
||||
@@ -29,8 +29,13 @@
|
||||
<el-input type="number" v-model="form.num" style="width:260px" />
|
||||
</el-form-item>
|
||||
<el-form-item label="提交原因" prop="reason">
|
||||
<el-select v-model="form.reason" style="width:260px">
|
||||
<el-option v-for="item in reasonList" :value="item.id" :key="item.id">{{ item.reason }}</el-option>
|
||||
<el-select v-model="form.reason" style="width:260px" placeholder="请选择提交原因">
|
||||
<el-option
|
||||
v-for="item in reasonList"
|
||||
:key="item.id"
|
||||
:label="item.reason"
|
||||
:value="item.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="问题描述" prop="problemDesc">
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<div class="address-header">
|
||||
<span>
|
||||
{{ item.name }}
|
||||
<el-tag class="ml_10" v-if="item.isDefault" color="red">默认地址</el-tag>
|
||||
<el-tag class="ml_10 default-address-tag" v-if="item.isDefault">默认地址</el-tag>
|
||||
<el-tag class="ml_10" v-if="item.alias" color="warning">{{item.alias}}</el-tag>
|
||||
</span>
|
||||
<div class="address-action">
|
||||
@@ -121,6 +121,12 @@ export default {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.default-address-tag {
|
||||
background-color: #fff3f2 !important;
|
||||
border: 1px solid $theme_color !important;
|
||||
color: $theme_color !important;
|
||||
}
|
||||
|
||||
#map-container {
|
||||
width: 500px;
|
||||
height: 300px;
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
:key="index"
|
||||
@click="goodsDetail(item.id, item.goodsId)"
|
||||
>
|
||||
<img :src="item.thumbnail" :alt="item.thumbnail" width="200" height="200" />
|
||||
<img :src="item.thumbnail" :alt="item.goodsName" />
|
||||
<p class="ellipsis">{{ item.goodsName }}</p>
|
||||
<p>{{ $filters.unitPrice(item.price, "¥") }}</p>
|
||||
<span class="del-icon" @click.stop="clearById(item.goodsId)">
|
||||
@@ -132,15 +132,27 @@ export default {
|
||||
}
|
||||
|
||||
.track-list {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
display: grid;
|
||||
grid-template-columns: repeat(4, 1fr);
|
||||
gap: 12px;
|
||||
padding: 0 15px;
|
||||
box-sizing: border-box;
|
||||
|
||||
li {
|
||||
width: 200px;
|
||||
width: 100%;
|
||||
min-width: 0;
|
||||
overflow: hidden;
|
||||
margin-left: 15px;
|
||||
margin-bottom: 10px;
|
||||
border: 1px solid #eee;
|
||||
position: relative;
|
||||
box-sizing: border-box;
|
||||
|
||||
img {
|
||||
width: 100%;
|
||||
aspect-ratio: 1;
|
||||
object-fit: cover;
|
||||
display: block;
|
||||
}
|
||||
|
||||
&:hover {
|
||||
cursor: pointer;
|
||||
box-shadow: 1px 1px 3px #999;
|
||||
|
||||
@@ -23,7 +23,8 @@
|
||||
</template>
|
||||
</ul>
|
||||
<!-- 秒杀商品列表 -->
|
||||
<div class="goods-list">
|
||||
<div class="seckill-goods-wrap">
|
||||
<div class="goods-list">
|
||||
<empty v-if="goodsList.length === 0" />
|
||||
<div v-else class="goods-show-info1" v-for="(item, index) in goodsList" :key="index"
|
||||
@click="goGoodsDetail(item.skuId, item.goodsId)">
|
||||
@@ -69,6 +70,7 @@
|
||||
<span>{{ item.storeName }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<BaseFooter />
|
||||
</div>
|
||||
@@ -199,10 +201,12 @@ export default {
|
||||
|
||||
.time-line {
|
||||
width: 1200px;
|
||||
max-width: 1200px;
|
||||
height: 60px;
|
||||
margin: 0 auto;
|
||||
background-color: #fff;
|
||||
display: flex;
|
||||
box-sizing: border-box;
|
||||
|
||||
li {
|
||||
padding: 0 30px;
|
||||
@@ -242,15 +246,29 @@ export default {
|
||||
}
|
||||
}
|
||||
|
||||
.seckill-goods-wrap {
|
||||
width: 1200px;
|
||||
max-width: 1200px;
|
||||
margin: 0 auto;
|
||||
box-sizing: border-box;
|
||||
|
||||
.goods-list {
|
||||
width: 100%;
|
||||
margin: 0;
|
||||
column-gap: 10px;
|
||||
}
|
||||
}
|
||||
|
||||
.goods-show-info1 {
|
||||
width: 290px;
|
||||
width: calc(25% - 8px);
|
||||
min-width: 0;
|
||||
padding: 6px;
|
||||
margin: 10px 0px;
|
||||
margin-left: 8px;
|
||||
margin: 10px 0;
|
||||
position: relative;
|
||||
border: 1px solid #fff;
|
||||
cursor: pointer;
|
||||
background-color: #fff;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.goods-show-info1:hover {
|
||||
@@ -261,6 +279,22 @@ export default {
|
||||
.goods-show-img {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
|
||||
img {
|
||||
width: 100%;
|
||||
max-width: 200px;
|
||||
height: auto;
|
||||
aspect-ratio: 1;
|
||||
object-fit: cover;
|
||||
}
|
||||
}
|
||||
|
||||
.goods-show-num1 {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
font-size: 12px;
|
||||
margin-bottom: 6px;
|
||||
color: #666;
|
||||
}
|
||||
|
||||
.el-progress-bar__inner {
|
||||
|
||||
@@ -27,9 +27,7 @@
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<div
|
||||
class="wap-content-list"
|
||||
>
|
||||
<div class="wap-content-list">
|
||||
<div
|
||||
class="wap-content-item"
|
||||
:class="{ active: item.selected }"
|
||||
@@ -77,13 +75,19 @@
|
||||
<script>
|
||||
import * as API_Goods from "@/api/goods";
|
||||
export default {
|
||||
props: {
|
||||
selectedWay: {
|
||||
type: Array,
|
||||
default: () => [],
|
||||
},
|
||||
},
|
||||
data() {
|
||||
return {
|
||||
type: "multiple", //单选或者多选 single multiple
|
||||
skuList: [], // 商品sku列表
|
||||
total: 0, // 商品总数
|
||||
type: "multiple",
|
||||
selectedList: [],
|
||||
skuList: [],
|
||||
total: 0,
|
||||
goodsParams: {
|
||||
// 商品请求参数
|
||||
pageNumber: 1,
|
||||
pageSize: 15,
|
||||
order: "desc",
|
||||
@@ -92,37 +96,30 @@ export default {
|
||||
categoryPath: "",
|
||||
marketEnable: "UPPER",
|
||||
authFlag: "PASS",
|
||||
sort:"createTime"
|
||||
sort: "createTime",
|
||||
},
|
||||
category: [], // 分类
|
||||
goodsData: [], // 商品数据
|
||||
empty: false, // 空数据
|
||||
loading: false, // 加载状态
|
||||
category: [],
|
||||
goodsData: [],
|
||||
empty: false,
|
||||
loading: false,
|
||||
};
|
||||
},
|
||||
props: {
|
||||
selectedWay: {
|
||||
type: Array,
|
||||
default: function () {
|
||||
return new Array();
|
||||
},
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
category(val) {
|
||||
this.goodsParams.categoryPath = val[2];
|
||||
this.goodsParams.categoryPath = val && val.length ? val[2] : "";
|
||||
},
|
||||
selectedWay: {
|
||||
handler() {
|
||||
this.$emit("selected", this.selectedWay);
|
||||
handler(val) {
|
||||
this.selectedList = Array.isArray(val) ? val.slice() : [];
|
||||
},
|
||||
deep: true,
|
||||
immediate: true,
|
||||
},
|
||||
"goodsParams.categoryPath": {
|
||||
handler: function () {
|
||||
handler() {
|
||||
this.goodsData = [];
|
||||
(this.goodsParams.pageNumber = 0), this.getQueryGoodsList();
|
||||
this.goodsParams.pageNumber = 1;
|
||||
this.getQueryGoodsList();
|
||||
},
|
||||
deep: true,
|
||||
},
|
||||
@@ -136,57 +133,59 @@ export default {
|
||||
this.goodsParams.pageNumber = 1;
|
||||
this.getQueryGoodsList();
|
||||
},
|
||||
changePageSize(v){
|
||||
changePageSize(v) {
|
||||
this.goodsParams.pageNumber = v;
|
||||
this.getQueryGoodsList();
|
||||
},
|
||||
// 获取商品列表
|
||||
getQueryGoodsList() {
|
||||
API_Goods.getGoodsSkuData(this.goodsParams).then((res) => {
|
||||
this.initGoods(res);
|
||||
});
|
||||
this.loading = true;
|
||||
API_Goods.getGoodsSkuData(this.goodsParams)
|
||||
.then((res) => {
|
||||
this.initGoods(res);
|
||||
})
|
||||
.finally(() => {
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
// 获取列表方法
|
||||
initGoods(res) {
|
||||
if (res.result.records.length != 0) {
|
||||
res.result.records.forEach((item) => {
|
||||
const records = res?.result?.records || [];
|
||||
if (records.length) {
|
||||
records.forEach((item) => {
|
||||
item.selected = false;
|
||||
item.___type = "goods"; //设置为goods让pc wap知道标识
|
||||
this.selectedWay.forEach((e) => {
|
||||
item.___type = "goods";
|
||||
this.selectedList.forEach((e) => {
|
||||
if (e.id && e.id === item.id) {
|
||||
item.selected = true;
|
||||
}
|
||||
});
|
||||
});
|
||||
/**
|
||||
* 解决数据请求中,滚动栏会一直上下跳动
|
||||
*/
|
||||
this.total = res.result.total;
|
||||
this.goodsData = res.result.records;
|
||||
this.total = res.result.total || 0;
|
||||
this.goodsData = records;
|
||||
this.empty = false;
|
||||
} else {
|
||||
this.goodsData = [];
|
||||
this.empty = true;
|
||||
}
|
||||
},
|
||||
// 查询商品
|
||||
emitSelected(list) {
|
||||
this.selectedList = list;
|
||||
this.$emit("selected", this.selectedList);
|
||||
},
|
||||
init() {
|
||||
API_Goods.getGoodsSkuData(this.goodsParams).then((res) => {
|
||||
// 商品
|
||||
this.initGoods(res);
|
||||
});
|
||||
API_Goods.getCategoryTree({deleteFlag: false}).then((res) => {
|
||||
API_Goods.getCategoryTree({ deleteFlag: false }).then((res) => {
|
||||
if (res.success) {
|
||||
this.deepGroup(res.result);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
deepGroup(val) {
|
||||
val.forEach((item) => {
|
||||
let childWay = []; //第二级
|
||||
// 第二层
|
||||
let childWay = [];
|
||||
if (item.children) {
|
||||
item.children.forEach((child) => {
|
||||
// // 第三层
|
||||
if (child.children) {
|
||||
child.children.forEach((grandson, index, arr) => {
|
||||
arr[index] = {
|
||||
@@ -195,52 +194,36 @@ export default {
|
||||
};
|
||||
});
|
||||
}
|
||||
let children = {
|
||||
childWay.push({
|
||||
value: child.id,
|
||||
label: child.name,
|
||||
children: child.children,
|
||||
};
|
||||
childWay.push(children);
|
||||
});
|
||||
});
|
||||
}
|
||||
// 第一层
|
||||
let way = {
|
||||
this.skuList.push({
|
||||
value: item.id,
|
||||
label: item.name,
|
||||
children: childWay,
|
||||
};
|
||||
|
||||
this.skuList.push(way);
|
||||
});
|
||||
});
|
||||
},
|
||||
|
||||
/**
|
||||
* 点击商品
|
||||
*/
|
||||
checkedGoods(val, index) {
|
||||
// 如果单选的话
|
||||
if (this.type != "multiple") {
|
||||
checkedGoods(val) {
|
||||
if (this.type !== "multiple") {
|
||||
this.goodsData.forEach((item) => {
|
||||
item.selected = false;
|
||||
});
|
||||
this.selectedWay = [];
|
||||
val.selected = true;
|
||||
this.selectedWay.push(val);
|
||||
|
||||
return false;
|
||||
this.emitSelected([val]);
|
||||
return;
|
||||
}
|
||||
|
||||
if (val.selected == false) {
|
||||
if (!val.selected) {
|
||||
val.selected = true;
|
||||
this.selectedWay.push(val);
|
||||
this.emitSelected([...this.selectedList, val]);
|
||||
} else {
|
||||
val.selected = false;
|
||||
for (let i = 0; i < this.selectedWay.length; i++) {
|
||||
if (this.selectedWay[i].id === val.id) {
|
||||
this.selectedWay.splice(i, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
this.emitSelected(this.selectedList.filter((item) => item.id !== val.id));
|
||||
}
|
||||
},
|
||||
},
|
||||
@@ -271,9 +254,6 @@ export default {
|
||||
margin: 10px 7px;
|
||||
padding: 6px 0;
|
||||
}
|
||||
// .wap-content-item{
|
||||
|
||||
// }
|
||||
.active {
|
||||
background: url("../../assets/selected.png") no-repeat;
|
||||
background-position: right;
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
<div
|
||||
v-for="(item, index) in data[plant]"
|
||||
:key="index"
|
||||
:class="{ active: chiosend[plantIndex]?.id == item.id }"
|
||||
:class="{ active: chiosend[plantIndex] && chiosend[plantIndex].id == item.id }"
|
||||
class="map-item"
|
||||
@click="
|
||||
init(
|
||||
|
||||
@@ -380,7 +380,8 @@ export default {
|
||||
this.getDataList();
|
||||
},
|
||||
getOrderNumData() {
|
||||
const { orderStatus, ...searchParams } = this.searchForm;
|
||||
// orderNum 接口仅查 li_order,不含 order_item 关联;keywords/goodsName 会引用 oi 字段导致 SQL 报错
|
||||
const { orderStatus, keywords, goodsName, ...searchParams } = this.searchForm;
|
||||
API_Order.getOrderNum(searchParams)
|
||||
.then((res) => {
|
||||
if (res.success) {
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
</el-card>
|
||||
|
||||
<el-card>
|
||||
<div class="operation" style="margin: 10px 0">
|
||||
<el-button type="primary" @click="delAll">批量下架</el-button>
|
||||
<div class="operation">
|
||||
<el-button type="primary" @click="add">添加</el-button>
|
||||
</div>
|
||||
|
||||
<el-table
|
||||
@@ -35,44 +35,35 @@
|
||||
:data="data"
|
||||
class="mt_10"
|
||||
style="width: 100%"
|
||||
@selection-change="changeSelect"
|
||||
>
|
||||
<el-table-column type="selection" width="55" align="center" fixed="left" />
|
||||
<el-table-column label="商品图片" width="120" align="center" fixed="left">
|
||||
<el-table-column label="商品名称" min-width="250">
|
||||
<template #default="{ row }">
|
||||
<img
|
||||
v-if="row"
|
||||
:src="row.thumbnail || ''"
|
||||
alt="商品图"
|
||||
style="cursor: pointer; width: 80px; height: 60px; margin: 10px 0; object-fit: contain"
|
||||
/>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="商品名称" min-width="220" show-overflow-tooltip>
|
||||
<template #default="{ row }">
|
||||
<template v-if="row">
|
||||
<div class="div-zoom">
|
||||
<a class="link-text" @click="linkTo(row.goodsId, row.skuId)">{{ row.goodsName }}</a>
|
||||
</div>
|
||||
<el-popover trigger="hover" title="扫码在手机中查看" placement="top" width="180">
|
||||
<template #reference>
|
||||
<img
|
||||
src="../../assets/qrcode.svg"
|
||||
class="hover-pointer"
|
||||
width="20"
|
||||
height="20"
|
||||
alt="qrcode"
|
||||
<div v-if="row" class="goods-msg">
|
||||
<img :src="row.thumbnail" width="60" height="60" alt="" />
|
||||
<div>
|
||||
<div class="div-zoom">
|
||||
<a class="link-text" @click="linkTo(row.goodsId, row.skuId)">{{ row.goodsName }}</a>
|
||||
</div>
|
||||
<el-popover trigger="hover" title="扫码在手机中查看" placement="top" width="180">
|
||||
<template #reference>
|
||||
<img
|
||||
src="../../assets/qrcode.svg"
|
||||
class="hover-pointer"
|
||||
width="20"
|
||||
height="20"
|
||||
alt="qrcode"
|
||||
/>
|
||||
</template>
|
||||
<vue-qr
|
||||
:text="wapLinkTo(row.goodsId, row.skuId)"
|
||||
:margin="0"
|
||||
color-dark="#000"
|
||||
color-light="#fff"
|
||||
:size="150"
|
||||
/>
|
||||
</template>
|
||||
<vue-qr
|
||||
:text="wapLinkTo(row.goodsId, row.skuId)"
|
||||
:margin="0"
|
||||
color-dark="#000"
|
||||
color-light="#fff"
|
||||
:size="150"
|
||||
/>
|
||||
</el-popover>
|
||||
</template>
|
||||
</el-popover>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="商品价格" min-width="110">
|
||||
@@ -82,15 +73,16 @@
|
||||
</el-table-column>
|
||||
<el-table-column prop="quantity" label="库存" min-width="80" />
|
||||
<el-table-column prop="createTime" label="添加时间" min-width="160" />
|
||||
<el-table-column prop="storeName" label="店铺名称" min-width="120" show-overflow-tooltip />
|
||||
<el-table-column label="佣金金额" min-width="110">
|
||||
<template #default="{ row }">
|
||||
<span v-if="row" :style="{ color: $mainColor }">{{ $filters.unitPrice(row.commission, "¥") }}</span>
|
||||
<span v-if="row" :style="{ color: $mainColor }">
|
||||
{{ $filters.unitPrice(row.commission ?? 0, "¥") }}
|
||||
</span>
|
||||
</template>
|
||||
</el-table-column>
|
||||
<el-table-column label="操作" min-width="100" align="center" fixed="right">
|
||||
<template #default="{ row }">
|
||||
<a v-if="row" class="link-text" @click="remove(row)">下架</a>
|
||||
<a v-if="row" class="link-text" @click="remove(row)">删除</a>
|
||||
</template>
|
||||
</el-table-column>
|
||||
</el-table>
|
||||
@@ -99,7 +91,7 @@
|
||||
<el-pagination
|
||||
v-model:current-page="searchForm.pageNumber"
|
||||
v-model:page-size="searchForm.pageSize"
|
||||
:page-sizes="[20, 50, 100]"
|
||||
:page-sizes="[10, 20, 50]"
|
||||
:total="total"
|
||||
layout="total, sizes, prev, pager, next, jumper"
|
||||
size="small"
|
||||
@@ -108,27 +100,67 @@
|
||||
/>
|
||||
</div>
|
||||
</el-card>
|
||||
|
||||
<liliDialog ref="liliDialog" @selectedGoodsData="selectedGoodsData" />
|
||||
|
||||
<el-dialog
|
||||
v-model="modalVisible"
|
||||
:title="modalTitle"
|
||||
width="500px"
|
||||
:close-on-click-modal="false"
|
||||
append-to-body
|
||||
>
|
||||
<el-form ref="form" :model="form" label-width="100px" :rules="formValidate">
|
||||
<el-form-item label="分销佣金" prop="commission">
|
||||
<el-input v-model="form.commission" clearable placeholder="请输入分销佣金" />
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="modalVisible = false">取消</el-button>
|
||||
<el-button type="primary" :loading="submitLoading" @click="handleSubmit">提交</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { delDistributionGoods, getDistributionGoods } from "@/api/distribution";
|
||||
import {
|
||||
getDistributionGoods,
|
||||
distributionGoodsCancel,
|
||||
distributionGoodsCheck,
|
||||
} from "@/api/distribution";
|
||||
import liliDialog from "@/views/lili-dialog";
|
||||
import vueQr from "vue-qr";
|
||||
|
||||
export default {
|
||||
name: "distributionGoods",
|
||||
components: { vueQr },
|
||||
components: { liliDialog, vueQr },
|
||||
data() {
|
||||
return {
|
||||
modalVisible: false,
|
||||
modalTitle: "添加分销商品",
|
||||
submitLoading: false,
|
||||
loading: true,
|
||||
searchForm: {
|
||||
pageNumber: 1,
|
||||
pageSize: 20,
|
||||
pageSize: 10,
|
||||
sort: "createTime",
|
||||
order: "desc",
|
||||
},
|
||||
selectList: [],
|
||||
selectCount: 0,
|
||||
form: {
|
||||
commission: 1,
|
||||
},
|
||||
skuId: 0,
|
||||
formValidate: {
|
||||
commission: [
|
||||
{ required: true, message: "请输入大于1小于9999的合法佣金金额", trigger: "blur" },
|
||||
{
|
||||
pattern: /^[1-9]\d{0,3}(\.\d{1,2})?$/,
|
||||
message: "请输入大于1小于9999的合法佣金金额",
|
||||
trigger: "blur",
|
||||
},
|
||||
],
|
||||
},
|
||||
data: [],
|
||||
total: 0,
|
||||
};
|
||||
@@ -137,72 +169,74 @@ export default {
|
||||
init() {
|
||||
this.getDataList();
|
||||
},
|
||||
add() {
|
||||
this.$refs.liliDialog.goodsData = [];
|
||||
this.$refs.liliDialog.open("goods", "single");
|
||||
},
|
||||
selectedGoodsData(selected) {
|
||||
if (!selected?.length) return;
|
||||
this.modalVisible = true;
|
||||
this.form.commission = 1;
|
||||
this.modalTitle = "添加分销商品";
|
||||
this.skuId = selected[0].id;
|
||||
},
|
||||
handleSubmit() {
|
||||
this.$refs.form.validate((valid) => {
|
||||
if (!valid) return;
|
||||
this.submitLoading = true;
|
||||
distributionGoodsCheck(this.skuId, this.form)
|
||||
.then((res) => {
|
||||
if (res?.success || res?.message === "success") {
|
||||
this.$Message.success("添加成功");
|
||||
}
|
||||
this.modalVisible = false;
|
||||
this.getDataList();
|
||||
})
|
||||
.finally(() => {
|
||||
this.submitLoading = false;
|
||||
});
|
||||
});
|
||||
},
|
||||
changePage(v) {
|
||||
this.searchForm.pageNumber = v;
|
||||
this.getDataList();
|
||||
this.clearSelectAll();
|
||||
},
|
||||
changePageSize(v) {
|
||||
this.searchForm.pageSize = v;
|
||||
this.searchForm.pageNumber = 1;
|
||||
this.getDataList();
|
||||
},
|
||||
handleSearch() {
|
||||
this.searchForm.pageNumber = 1;
|
||||
this.searchForm.pageSize = 20;
|
||||
this.getDataList();
|
||||
},
|
||||
clearSelectAll() {
|
||||
this.$refs.table?.clearSelection();
|
||||
},
|
||||
changeSelect(e) {
|
||||
this.selectList = e;
|
||||
this.selectCount = e.length;
|
||||
},
|
||||
getDataList() {
|
||||
this.loading = true;
|
||||
getDistributionGoods(this.searchForm)
|
||||
.then((res) => {
|
||||
if (res.success) {
|
||||
this.data = res.result.records;
|
||||
this.total = res.result.total;
|
||||
if (res?.success) {
|
||||
const page = res.result || {};
|
||||
this.data = page.records || [];
|
||||
this.total = page.total || 0;
|
||||
} else {
|
||||
this.data = [];
|
||||
this.total = 0;
|
||||
}
|
||||
})
|
||||
.finally(() => {
|
||||
this.loading = false;
|
||||
});
|
||||
},
|
||||
remove(v) {
|
||||
remove(row) {
|
||||
this.$Modal.confirm({
|
||||
title: "确认下架",
|
||||
content: "您确认要下架么?",
|
||||
title: "确认删除",
|
||||
content: "您确认要删除此分销商品吗?",
|
||||
loading: true,
|
||||
onOk: () => {
|
||||
delDistributionGoods(v.id).then((res) => {
|
||||
distributionGoodsCancel(row.id).then((res) => {
|
||||
this.$Modal.remove();
|
||||
if (res.success) {
|
||||
this.$Message.success("下架成功");
|
||||
this.getDataList();
|
||||
}
|
||||
});
|
||||
},
|
||||
});
|
||||
},
|
||||
delAll() {
|
||||
if (this.selectCount <= 0) {
|
||||
this.$Message.warning("您还未选择要下架的数据");
|
||||
return;
|
||||
}
|
||||
this.$Modal.confirm({
|
||||
title: "确认下架",
|
||||
content: "您确认要下架所选的 " + this.selectCount + " 条数据?",
|
||||
loading: true,
|
||||
onOk: () => {
|
||||
const ids = this.selectList.map((item) => item.id);
|
||||
delDistributionGoods(ids.toString()).then((res) => {
|
||||
this.$Modal.remove();
|
||||
if (res.success) {
|
||||
this.$Message.success("下架成功");
|
||||
this.clearSelectAll();
|
||||
if (res?.success) {
|
||||
this.$Message.success("删除成功");
|
||||
this.getDataList();
|
||||
}
|
||||
});
|
||||
@@ -217,21 +251,39 @@ export default {
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.operation {
|
||||
margin: 10px 0;
|
||||
}
|
||||
|
||||
.goods-msg {
|
||||
display: flex;
|
||||
align-items: flex-start;
|
||||
gap: 13px;
|
||||
padding: 5px 0;
|
||||
|
||||
img {
|
||||
object-fit: contain;
|
||||
}
|
||||
}
|
||||
|
||||
.link-text {
|
||||
color: #409eff;
|
||||
cursor: pointer;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.div-zoom {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
margin-bottom: 4px;
|
||||
}
|
||||
|
||||
.hover-pointer {
|
||||
cursor: pointer;
|
||||
vertical-align: middle;
|
||||
}
|
||||
|
||||
.mt_10 {
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
@@ -24,8 +24,8 @@
|
||||
style="width: 200px"
|
||||
/>
|
||||
</el-form-item>
|
||||
<el-form-item label="货号" prop="id">
|
||||
<el-input v-model="searchForm.skuSn" placeholder="请输入货号" clearable style="width: 200px" />
|
||||
<el-form-item label="货号" prop="sn">
|
||||
<el-input v-model="searchForm.sn" placeholder="请输入货号" clearable style="width: 200px" />
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" class="search-btn" @click="handleSearch">搜索</el-button>
|
||||
|
||||
@@ -55,22 +55,6 @@
|
||||
<el-option label="虚拟商品" value="VIRTUAL_GOODS" />
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item label="商品分组" prop="groupId">
|
||||
<el-select
|
||||
v-model="searchForm.groupId"
|
||||
placeholder="请选择商品分组"
|
||||
clearable
|
||||
filterable
|
||||
style="width: 240px"
|
||||
>
|
||||
<el-option
|
||||
v-for="item in goodsGroupList"
|
||||
:key="item.id"
|
||||
:label="item.groupName"
|
||||
:value="item.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
<el-form-item>
|
||||
<el-button type="primary" class="search-btn" @click="handleSearch">搜索</el-button>
|
||||
</el-form-item>
|
||||
@@ -90,14 +74,6 @@
|
||||
</div>
|
||||
|
||||
<div class="batch-operations" style="margin: 10px 0">
|
||||
<el-button
|
||||
type="primary"
|
||||
:disabled="selectedRows.length === 0"
|
||||
style="margin-right: 10px"
|
||||
@click="openSetGoodsGroup"
|
||||
>
|
||||
批量设置分组
|
||||
</el-button>
|
||||
<el-button
|
||||
type="success"
|
||||
:disabled="selectedRows.length === 0"
|
||||
@@ -209,38 +185,15 @@
|
||||
<el-button type="primary" :loading="submitLoading" @click="lower">提交</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
|
||||
<el-dialog v-model="goodsGroupFlag" title="批量设置商品分组" width="420px">
|
||||
<el-form ref="goodsGroupForm" :model="goodsGroupForm" :rules="goodsGroupRule" label-width="90px">
|
||||
<el-form-item label="商品分组" prop="groupId">
|
||||
<el-select v-model="goodsGroupForm.groupId" clearable filterable style="width: 240px">
|
||||
<el-option
|
||||
v-for="item in goodsGroupList"
|
||||
:key="item.id"
|
||||
:label="item.groupName"
|
||||
:value="item.id"
|
||||
/>
|
||||
</el-select>
|
||||
</el-form-item>
|
||||
</el-form>
|
||||
<template #footer>
|
||||
<el-button @click="goodsGroupFlag = false">取消</el-button>
|
||||
<el-button type="primary" :loading="goodsGroupLoading" @click="submitSetGoodsGroup">确定</el-button>
|
||||
</template>
|
||||
</el-dialog>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import * as API_Shop from "@/api/shops";
|
||||
|
||||
import {
|
||||
getGoodsListData,
|
||||
getGoodsNumerData,
|
||||
upGoods,
|
||||
lowGoods,
|
||||
getGoodsGroupByPage,
|
||||
addGoodsGroupItems
|
||||
} from "@/api/goods";
|
||||
export default {
|
||||
name: "goods",
|
||||
@@ -255,7 +208,6 @@ export default {
|
||||
pageSize: 20, // 页面大小
|
||||
sort: "create_time", // 默认排序字段
|
||||
order: "desc", // 默认排序方式
|
||||
groupId: "",
|
||||
},
|
||||
underForm: {
|
||||
// 下架原因
|
||||
@@ -268,15 +220,6 @@ export default {
|
||||
goodsNumerData: {},
|
||||
selectedRows: [], // 选中的行数据
|
||||
selectAll: false, // 全选状态
|
||||
goodsGroupFlag: false,
|
||||
goodsGroupLoading: false,
|
||||
goodsGroupList: [],
|
||||
goodsGroupForm: {
|
||||
groupId: ""
|
||||
},
|
||||
goodsGroupRule: {
|
||||
groupId: [{ required: true, message: "请选择商品分组", trigger: "change" }]
|
||||
}
|
||||
};
|
||||
},
|
||||
computed: {
|
||||
@@ -322,7 +265,6 @@ export default {
|
||||
init() {
|
||||
this.getDataList();
|
||||
this.getNumberData();
|
||||
this.loadGoodsGroupList();
|
||||
},
|
||||
// 分页 改变页码
|
||||
changePage(v) {
|
||||
@@ -505,49 +447,6 @@ export default {
|
||||
}
|
||||
});
|
||||
},
|
||||
loadGoodsGroupList() {
|
||||
getGoodsGroupByPage({ pageNumber: 1, pageSize: 1000 }).then((res) => {
|
||||
if (res && res.success && res.result) {
|
||||
this.goodsGroupList = res.result.records || [];
|
||||
}
|
||||
});
|
||||
},
|
||||
openSetGoodsGroup() {
|
||||
if (this.selectedRows.length === 0) {
|
||||
this.$Message.warning("请先选择商品");
|
||||
return;
|
||||
}
|
||||
this.goodsGroupFlag = true;
|
||||
this.goodsGroupLoading = false;
|
||||
this.goodsGroupForm = { groupId: "" };
|
||||
this.$nextTick(() => {
|
||||
if (this.$refs.goodsGroupForm) this.$refs.goodsGroupForm.resetFields();
|
||||
});
|
||||
this.loadGoodsGroupList();
|
||||
},
|
||||
submitSetGoodsGroup() {
|
||||
this.$refs.goodsGroupForm.validate((valid) => {
|
||||
if (!valid) return;
|
||||
const goodsIds = this.selectedRows.map((item) => item.id);
|
||||
this.goodsGroupLoading = true;
|
||||
addGoodsGroupItems(this.goodsGroupForm.groupId, goodsIds).then((res) => {
|
||||
this.goodsGroupLoading = false;
|
||||
if (res && res.success) {
|
||||
this.$Message.success("设置成功");
|
||||
this.goodsGroupFlag = false;
|
||||
this.selectedRows = [];
|
||||
this.selectAll = false;
|
||||
this.clearTableSelection();
|
||||
this.getDataList();
|
||||
} else if (res && res.message) {
|
||||
this.$Message.error(res.message);
|
||||
}
|
||||
}).catch(() => {
|
||||
this.goodsGroupLoading = false;
|
||||
this.$Message.error("设置失败,请检查权限或后端接口");
|
||||
});
|
||||
});
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.init();
|
||||
|
||||
@@ -82,6 +82,7 @@ export default {
|
||||
data() {
|
||||
return {
|
||||
type: "multiple",
|
||||
selectedList: [],
|
||||
skuList: [],
|
||||
total: 0,
|
||||
goodsParams: {
|
||||
@@ -106,8 +107,8 @@ export default {
|
||||
this.goodsParams.categoryPath = val && val.length ? val.join(",") : "";
|
||||
},
|
||||
selectedWay: {
|
||||
handler() {
|
||||
this.$emit("selected", this.selectedWay);
|
||||
handler(val) {
|
||||
this.selectedList = Array.isArray(val) ? val.slice() : [];
|
||||
},
|
||||
deep: true,
|
||||
immediate: true,
|
||||
@@ -145,24 +146,29 @@ export default {
|
||||
});
|
||||
},
|
||||
initGoods(res) {
|
||||
if (res.result.records.length != 0) {
|
||||
res.result.records.forEach((item) => {
|
||||
const records = res?.result?.records || [];
|
||||
if (records.length) {
|
||||
records.forEach((item) => {
|
||||
item.selected = false;
|
||||
item.___type = "goods";
|
||||
this.selectedWay.forEach((e) => {
|
||||
this.selectedList.forEach((e) => {
|
||||
if (e.id && e.id === item.id) {
|
||||
item.selected = true;
|
||||
}
|
||||
});
|
||||
});
|
||||
this.total = res.result.total;
|
||||
this.goodsData = res.result.records;
|
||||
this.total = res.result.total || 0;
|
||||
this.goodsData = records;
|
||||
this.empty = false;
|
||||
} else {
|
||||
this.goodsData = [];
|
||||
this.empty = true;
|
||||
}
|
||||
},
|
||||
emitSelected(list) {
|
||||
this.selectedList = list;
|
||||
this.$emit("selected", this.selectedList);
|
||||
},
|
||||
init() {
|
||||
API_Goods.getGoodsSkuData(this.goodsParams).then((res) => {
|
||||
this.initGoods(res);
|
||||
@@ -201,26 +207,20 @@ export default {
|
||||
});
|
||||
},
|
||||
checkedGoods(val) {
|
||||
if (this.type != "multiple") {
|
||||
if (this.type !== "multiple") {
|
||||
this.goodsData.forEach((item) => {
|
||||
item.selected = false;
|
||||
});
|
||||
this.selectedWay = [];
|
||||
val.selected = true;
|
||||
this.selectedWay.push(val);
|
||||
return false;
|
||||
this.emitSelected([val]);
|
||||
return;
|
||||
}
|
||||
if (val.selected == false) {
|
||||
if (!val.selected) {
|
||||
val.selected = true;
|
||||
this.selectedWay.push(val);
|
||||
this.emitSelected([...this.selectedList, val]);
|
||||
} else {
|
||||
val.selected = false;
|
||||
for (let i = 0; i < this.selectedWay.length; i++) {
|
||||
if (this.selectedWay[i].id === val.id) {
|
||||
this.selectedWay.splice(i, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
this.emitSelected(this.selectedList.filter((item) => item.id !== val.id));
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
<div
|
||||
v-for="(item, index) in data[plant]"
|
||||
:key="index"
|
||||
:class="{ active: chiosend[plantIndex]?.id == item.id }"
|
||||
:class="{ active: chiosend[plantIndex] && chiosend[plantIndex].id == item.id }"
|
||||
class="map-item"
|
||||
@click="
|
||||
init(
|
||||
|
||||
@@ -120,7 +120,11 @@
|
||||
</el-table-column>
|
||||
<el-table-column label="售后状态" width="180">
|
||||
<template #default="{ row }">
|
||||
<el-tag v-if="row" :type="serviceStatusTagType(row.serviceStatus)">
|
||||
<el-tag
|
||||
v-if="row"
|
||||
:type="serviceStatusTagType(row.serviceStatus)"
|
||||
effect="plain"
|
||||
>
|
||||
{{ serviceStatusText(row.serviceStatus) }}
|
||||
</el-tag>
|
||||
</template>
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
class="search-form"
|
||||
@keyup.enter="handleSearch"
|
||||
>
|
||||
<el-form-item label="关键字" prop="keywords" style="display: block; width: 100%">
|
||||
<el-form-item label="关键字" prop="keywords">
|
||||
<el-input
|
||||
v-model="searchForm.keywords"
|
||||
placeholder="请输入商品名称、订单编号搜索"
|
||||
@@ -112,7 +112,11 @@
|
||||
</el-table-column>
|
||||
<el-table-column label="售后状态" width="180">
|
||||
<template #default="{ row }">
|
||||
<el-tag v-if="row" :type="serviceStatusTagType(row.serviceStatus)">
|
||||
<el-tag
|
||||
v-if="row"
|
||||
:type="serviceStatusTagType(row.serviceStatus)"
|
||||
effect="plain"
|
||||
>
|
||||
{{ serviceStatusText(row.serviceStatus) }}
|
||||
</el-tag>
|
||||
</template>
|
||||
|
||||
@@ -379,7 +379,8 @@ export default {
|
||||
this.getDataList();
|
||||
},
|
||||
getOrderNumData() {
|
||||
const { orderStatus, ...searchParams } = this.searchForm;
|
||||
// orderNum 接口仅查 li_order,不含 order_item 关联;keywords/goodsName 会引用 oi 字段导致 SQL 报错
|
||||
const { orderStatus, keywords, goodsName, ...searchParams } = this.searchForm;
|
||||
API_Order.getOrderNum(searchParams)
|
||||
.then((res) => {
|
||||
if (res.success) {
|
||||
|
||||
Reference in New Issue
Block a user