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

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

View File

@ -43,13 +43,20 @@
<div> <div>
<span>{{ item.name }}</span> <span>{{ item.name }}</span>
<Tag class="ml_10" v-if="item.isDefault" color="red"></Tag> <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>
<div>{{ item.mobile }}</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"> <div class="edit-btn" v-show="showEditBtn === index">
<span @click.stop="editAddress(item.id)">修改</span> <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 >删除</span
> >
</div> </div>
@ -80,45 +87,59 @@
<span>商品信息</span> <span>商品信息</span>
<span @click="$router.push('/cart')"></span> <span @click="$router.push('/cart')"></span>
</div> </div>
<div class="goods-msg" v-for="(shop, shopIndex) in goodsList" :key="shopIndex"> <div
<div class="shop-name"> class="goods-msg"
<span> v-for="(shop, shopIndex) in goodsList"
<span class="hover-color" @click="goShopPage(shop.storeId)">{{ :key="shopIndex"
shop.storeName >
}}</span <div v-if="shop.checked">
>&nbsp;&nbsp; <div class="shop-name">
</span> <span>
</div> <span class="hover-color" @click="goShopPage(shop.storeId)">{{
<div class="goods-list"> shop.storeName
<div }}</span
class="goods-item" >&nbsp;&nbsp;
v-for="(goods, goodsIndex) in shop.checkedSkuList"
:key="goodsIndex"
>
<span
class="hover-color"
@click="goGoodsDetail(goods.goodsSku.id, goods.goodsSku.goodsId)"
>
<img :src="goods.goodsSku.thumbnail" alt="" />
<span style="vertical-align: top">{{ goods.goodsSku.goodsName }}</span>
</span> </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>
</div> </div>
</div> <div class="goods-list">
<div class="order-mark"> <div
<Input class="goods-item"
type="textarea" v-for="(goods, goodsIndex) in shop.checkedSkuList"
maxlength="60" :key="goodsIndex"
v-model="shop.remark" >
show-word-limit <span
placeholder="订单备注" class="hover-color"
/> @click="
<span style="font-size: 12px; color: #999" goGoodsDetail(goods.goodsSku.id, goods.goodsSku.goodsId)
>提示请勿填写有关支付收货发票方面的信息</span "
> >
<img :src="goods.goodsSku.thumbnail" alt="" />
<span style="vertical-align: top">{{
goods.goodsSku.goodsName
}}</span>
</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>
</div>
</div>
<div class="order-mark">
<Input
type="textarea"
maxlength="60"
v-model="shop.remark"
show-word-limit
placeholder="订单备注"
/>
<span style="font-size: 12px; color: #999"
>提示请勿填写有关支付收货发票方面的信息</span
>
</div>
</div> </div>
</div> </div>
</div> </div>
@ -146,11 +167,19 @@
</div> </div>
<div v-if="couponList.length === 0"></div> <div v-if="couponList.length === 0"></div>
<ul v-else class="coupon-list"> <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 class="c-left">
<div> <div>
<span v-if="item.couponType === 'PRICE'" class="fontsize_12 global_color" <span
><span class="price">{{ item.price | unitPrice }}</span></span v-if="item.couponType === 'PRICE'"
class="fontsize_12 global_color"
><span class="price">{{
item.price | unitPrice
}}</span></span
> >
<span <span
v-if="item.couponType === 'DISCOUNT'" v-if="item.couponType === 'DISCOUNT'"
@ -158,7 +187,9 @@
><span class="price">{{ item.discount }}</span ><span class="price">{{ item.discount }}</span
></span ></span
> >
<span class="describe">{{ item.consumeThreshold }}元可用</span> <span class="describe"
>{{ item.consumeThreshold }}元可用</span
>
</div> </div>
<p>使用范围{{ useScope(item.scopeType) }}</p> <p>使用范围{{ useScope(item.scopeType) }}</p>
<p>有效期{{ item.endTime }}</p> <p>有效期{{ item.endTime }}</p>
@ -225,9 +256,17 @@
</div> </div>
<BaseFooter></BaseFooter> <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> </div>
</template> </template>
@ -303,6 +342,15 @@ export default {
.then((res) => { .then((res) => {
this.$Spin.hide(); this.$Spin.hide();
if (res.success) { 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.goodsList = res.result.cartList;
this.priceDetailDTO = res.result.priceDetailDTO; this.priceDetailDTO = res.result.priceDetailDTO;
this.skuList = res.result.skuList; this.skuList = res.result.skuList;
@ -313,11 +361,19 @@ export default {
let notSupArea = res.result.notSupportFreight; let notSupArea = res.result.notSupportFreight;
this.selectedCoupon = {}; this.selectedCoupon = {};
if (res.result.platformCoupon) if (res.result.platformCoupon)
this.selectedCoupon[res.result.platformCoupon.memberCoupon.id] = res.result.platformCoupon; this.selectedCoupon[res.result.platformCoupon.memberCoupon.id] =
if (res.result.storeCoupons && Object.keys(res.result.storeCoupons)[0]) { res.result.platformCoupon;
let storeMemberCouponsId = Object.keys(res.result.storeCoupons)[0]; if (
let storeCouponId = res.result.storeCoupons[storeMemberCouponsId].memberCoupon.id; res.result.storeCoupons &&
this.selectedCoupon[storeCouponId] = res.result.storeCoupons[storeMemberCouponsId]; 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) { if (notSupArea) {
let content = []; let content = [];
@ -344,7 +400,10 @@ export default {
const couponKeys = Object.keys(this.selectedCoupon); const couponKeys = Object.keys(this.selectedCoupon);
if (couponKeys.length) { if (couponKeys.length) {
this.couponList.forEach((e) => { 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); this.usedCouponId.push(e.id);
} }
}); });

View File

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