修复结算页中有无效商品店铺显示问题。优化购物车页。管理端增加搜索热词全删除

master
paulGao 2022-04-22 16:48:43 +08:00
parent 7ff51b5e53
commit 0635dd38a2
3 changed files with 172 additions and 75 deletions

View File

@ -34,7 +34,9 @@
<div class="cart-goods">
<div class="cart-goods-title">
<div class="width_60">
<Checkbox v-model="allChecked" @on-change="changeChecked(allChecked, 'all')"
<Checkbox
v-model="allChecked"
@on-change="changeChecked(allChecked, 'all')"
>全选</Checkbox
>
</div>
@ -77,7 +79,9 @@
v-for="(item, index) in shop.couponList"
:key="index"
>
<span v-if="item.couponType === 'PRICE'">{{ item.price }}</span>
<span v-if="item.couponType === 'PRICE'"
>{{ item.price }}</span
>
<span v-if="item.couponType === 'DISCOUNT'"
>{{ item.couponDiscount }}</span
>
@ -100,12 +104,16 @@
<div class="width_60">
<Checkbox
v-model="goods.checked"
@on-change="changeChecked(goods.checked, 'goods', goods.goodsSku.id)"
@on-change="
changeChecked(goods.checked, 'goods', goods.goodsSku.id)
"
></Checkbox>
</div>
<div
class="goods-title"
@click="goGoodsDetail(goods.goodsSku.id, goods.goodsSku.goodsId)"
@click="
goGoodsDetail(goods.goodsSku.id, goods.goodsSku.goodsId)
"
>
<img
:src="
@ -115,24 +123,34 @@
/>
<div>
<p>{{ goods.goodsSku.goodsName }}</p>
<template v-for="(promotion, promotionIndex) in goods.promotions">
<template
v-for="(promotion, promotionIndex) in goods.promotions"
>
<div
class="promotion"
:key="promotionIndex"
v-if="promotion.promotionType === 'SECKILL'"
>
<span>秒杀</span>
<promotion :time="promotion.endTime" type="cart"></promotion>
<promotion
:time="promotion.endTime"
type="cart"
></promotion>
</div>
</template>
<template v-for="(promotion, promotionIndex) in goods.promotions">
<template
v-for="(promotion, promotionIndex) in goods.promotions"
>
<div
class="promotion"
:key="promotionIndex"
v-if="promotion.promotionType === 'FULL_DISCOUNT'"
>
<span>满优惠活动</span>
<promotion :time="promotion.endTime" type="cart"></promotion>
<promotion
:time="promotion.endTime"
type="cart"
></promotion>
</div>
</template>
</div>
@ -155,22 +173,27 @@
{{ goods.subTotal | unitPrice("¥") }}
</div>
<div class="width_100">
<span
class="handle-btn"
<Button
v-if="!goods.errorMessage"
size="small"
type="primary"
@click="delGoods(goods.goodsSku.id)"
>删除</span
>删除</Button
>
<span
class="handle-btn"
<Button
v-if="!goods.errorMessage"
size="small"
type="info"
@click="collectGoods(goods.goodsSku.id)"
>收藏</span
style="margin-left: 10px"
>收藏</Button
>
</div>
<div class="error-goods" v-if="goods.errorMessage">
<div>{{ goods.errorMessage }}</div>
<Button type="primary" @click="delGoods(goods.goodsSku.id)"></Button>
<div style="margin-top: 20px">{{ goods.errorMessage }}</div>
<Button type="primary" @click="delGoods(goods.goodsSku.id)"
>删除</Button
>
</div>
</div>
</template>
@ -179,13 +202,19 @@
<div class="cart-goods-footer">
<div>
<div class="width_60">
<Checkbox v-model="allChecked" @on-change="changeChecked(allChecked, 'all')"
<Checkbox
v-model="allChecked"
@on-change="changeChecked(allChecked, 'all')"
>全选</Checkbox
>
</div>
<div class="width_100 handle-btn" @click="delGoods()"></div>
<div class="width_100 handle-btn" @click="delGoods()">
删除选中商品
</div>
<!-- <div class="width_100 handle-btn" @click="collectGoods"></div> -->
<div class="width_100 handle-btn" @click="clearCart"></div>
<div class="width_100 handle-btn" @click="clearCart">
清空购物车
</div>
</div>
<div>
<div class="selected-count">
@ -193,7 +222,9 @@
>件商品
</div>
<div class="ml_20 save-price">
已节省<span>{{ priceDetailDTO.discountPrice | unitPrice("¥") }}</span>
已节省<span>{{
priceDetailDTO.discountPrice | unitPrice("¥")
}}</span>
</div>
<div class="ml_20 total-price">
总价不含运费:

View File

@ -43,13 +43,20 @@
<div>
<span>{{ item.name }}</span>
<Tag class="ml_10" v-if="item.isDefault" color="red"></Tag>
<Tag class="ml_10" v-if="item.alias" color="warning">{{ item.alias }} </Tag>
<Tag class="ml_10" v-if="item.alias" color="warning"
>{{ item.alias }}
</Tag>
</div>
<div>{{ item.mobile }}</div>
<div>{{ item.consigneeAddressPath | unitAddress }} {{ item.detail }}</div>
<div>
{{ item.consigneeAddressPath | unitAddress }} {{ item.detail }}
</div>
<div class="edit-btn" v-show="showEditBtn === index">
<span @click.stop="editAddress(item.id)">修改</span>
<span class="ml_10" v-if="!item.isDefault" @click.stop="delAddress(item)"
<span
class="ml_10"
v-if="!item.isDefault"
@click.stop="delAddress(item)"
>删除</span
>
</div>
@ -80,7 +87,12 @@
<span>商品信息</span>
<span @click="$router.push('/cart')"></span>
</div>
<div class="goods-msg" v-for="(shop, shopIndex) in goodsList" :key="shopIndex">
<div
class="goods-msg"
v-for="(shop, shopIndex) in goodsList"
:key="shopIndex"
>
<div v-if="shop.checked">
<div class="shop-name">
<span>
<span class="hover-color" @click="goShopPage(shop.storeId)">{{
@ -97,15 +109,23 @@
>
<span
class="hover-color"
@click="goGoodsDetail(goods.goodsSku.id, goods.goodsSku.goodsId)"
@click="
goGoodsDetail(goods.goodsSku.id, goods.goodsSku.goodsId)
"
>
<img :src="goods.goodsSku.thumbnail" alt="" />
<span style="vertical-align: top">{{ goods.goodsSku.goodsName }}</span>
<span style="vertical-align: top">{{
goods.goodsSku.goodsName
}}</span>
</span>
<span class="goods-price">{{ goods.purchasePrice | unitPrice("¥") }}</span>
<span class="goods-price">{{
goods.purchasePrice | unitPrice("¥")
}}</span>
<span>x{{ goods.num }}</span>
<span>{{ goods.goodsSku.quantity > 0 ? "有货" : "无货" }}</span>
<span class="goods-price">{{ goods.subTotal | unitPrice("¥") }}</span>
<span class="goods-price">{{
goods.subTotal | unitPrice("¥")
}}</span>
</div>
</div>
<div class="order-mark">
@ -122,6 +142,7 @@
</div>
</div>
</div>
</div>
<!-- 发票信息 -->
<div class="invoice">
<div class="card-head mt_20 mb_20">
@ -146,11 +167,19 @@
</div>
<div v-if="couponList.length === 0"></div>
<ul v-else class="coupon-list">
<li v-for="(item, index) in couponList" class="coupon-item" :key="index">
<li
v-for="(item, index) in couponList"
class="coupon-item"
:key="index"
>
<div class="c-left">
<div>
<span v-if="item.couponType === 'PRICE'" class="fontsize_12 global_color"
><span class="price">{{ item.price | unitPrice }}</span></span
<span
v-if="item.couponType === 'PRICE'"
class="fontsize_12 global_color"
><span class="price">{{
item.price | unitPrice
}}</span></span
>
<span
v-if="item.couponType === 'DISCOUNT'"
@ -158,7 +187,9 @@
><span class="price">{{ item.discount }}</span
></span
>
<span class="describe">{{ item.consumeThreshold }}元可用</span>
<span class="describe"
>{{ item.consumeThreshold }}元可用</span
>
</div>
<p>使用范围{{ useScope(item.scopeType) }}</p>
<p>有效期{{ item.endTime }}</p>
@ -225,9 +256,17 @@
</div>
<BaseFooter></BaseFooter>
<!-- 添加发票模态框 -->
<invoice-modal ref="invModal" :invoiceData="invoiceData" @change="getInvMsg" />
<invoice-modal
ref="invModal"
:invoiceData="invoiceData"
@change="getInvMsg"
/>
<!-- 选择地址模态框 -->
<address-manage ref="address" :id="addrId" @change="addrChange"></address-manage>
<address-manage
ref="address"
:id="addrId"
@change="addrChange"
></address-manage>
</div>
</template>
@ -303,6 +342,15 @@ export default {
.then((res) => {
this.$Spin.hide();
if (res.success) {
if (
!res.result.checkedSkuList ||
res.result.checkedSkuList.length === 0
) {
this.$router.push({
path: "/cart",
replace: true,
});
}
this.goodsList = res.result.cartList;
this.priceDetailDTO = res.result.priceDetailDTO;
this.skuList = res.result.skuList;
@ -313,11 +361,19 @@ export default {
let notSupArea = res.result.notSupportFreight;
this.selectedCoupon = {};
if (res.result.platformCoupon)
this.selectedCoupon[res.result.platformCoupon.memberCoupon.id] = res.result.platformCoupon;
if (res.result.storeCoupons && Object.keys(res.result.storeCoupons)[0]) {
let storeMemberCouponsId = Object.keys(res.result.storeCoupons)[0];
let storeCouponId = res.result.storeCoupons[storeMemberCouponsId].memberCoupon.id;
this.selectedCoupon[storeCouponId] = res.result.storeCoupons[storeMemberCouponsId];
this.selectedCoupon[res.result.platformCoupon.memberCoupon.id] =
res.result.platformCoupon;
if (
res.result.storeCoupons &&
Object.keys(res.result.storeCoupons)[0]
) {
let storeMemberCouponsId = Object.keys(
res.result.storeCoupons
)[0];
let storeCouponId =
res.result.storeCoupons[storeMemberCouponsId].memberCoupon.id;
this.selectedCoupon[storeCouponId] =
res.result.storeCoupons[storeMemberCouponsId];
}
if (notSupArea) {
let content = [];
@ -344,7 +400,10 @@ export default {
const couponKeys = Object.keys(this.selectedCoupon);
if (couponKeys.length) {
this.couponList.forEach((e) => {
if (this.selectedCoupon[e.id] && e.id === this.selectedCoupon[e.id].memberCoupon.id) {
if (
this.selectedCoupon[e.id] &&
e.id === this.selectedCoupon[e.id].memberCoupon.id
) {
this.usedCouponId.push(e.id);
}
});

View File

@ -3,6 +3,7 @@
<Card>
<Row class="operation">
<Button @click="add()" type="primary">设置今日热词</Button>
<Button @click="deleteWords('')" type="primary">清空热词</Button>
</Row>
<Row>
<p>
@ -112,10 +113,16 @@ export default {
this.modalVisible = true;
},
deleteWords(words) {
let title = "是否确定删除热词";
let content = "<p>您确定要删除此热词吗?</p>";
if (words === '') {
title = "是否确定清空热词";
content = "<p>您确定要清空热词吗?</p>";
}
this.$Modal.confirm({
title: "是否确定删除热词",
content: "<p>您确定要删除此热词吗?</p>",
okText: "确实",
title: title,
content: content,
okText: "确",
cancelText: "取消",
onOk: () => {
deleteHotWords(words).then((res) => {