2021-05-13 10:56:04 +08:00
|
|
|
|
<template>
|
|
|
|
|
<div class="cart" @click="couponAvailable = false">
|
|
|
|
|
<BaseHeader></BaseHeader>
|
|
|
|
|
<!-- LOGO 搜索 -->
|
|
|
|
|
<div class="width_1200 logo">
|
|
|
|
|
<div>
|
2021-12-11 13:50:58 +08:00
|
|
|
|
<router-link to="/"><img :src="$store.state.logoImg" /></router-link>
|
2021-05-13 10:56:04 +08:00
|
|
|
|
<div>
|
2021-12-11 13:50:58 +08:00
|
|
|
|
购物车(<span>{{ goodsTotal }}</span
|
|
|
|
|
>)
|
2021-05-13 10:56:04 +08:00
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<Search :showTag="false" :showLogo="false"></Search>
|
|
|
|
|
</div>
|
|
|
|
|
<Divider />
|
|
|
|
|
<!-- 购物车主体 -->
|
|
|
|
|
<div class="cart-content width_1200 center">
|
|
|
|
|
<div class="available-area">
|
|
|
|
|
<div class="cart-steps">
|
|
|
|
|
<span :class="stepIndex == 0 ? 'active' : ''">1.我的购物车</span>
|
2021-12-11 13:50:58 +08:00
|
|
|
|
<Icon
|
|
|
|
|
:class="stepIndex == 0 ? 'active-arrow' : ''"
|
|
|
|
|
custom="icomoon icon-next"
|
|
|
|
|
></Icon>
|
2021-05-13 10:56:04 +08:00
|
|
|
|
<span :class="stepIndex == 1 ? 'active' : ''">2.填写订单信息</span>
|
2021-12-11 13:50:58 +08:00
|
|
|
|
<Icon
|
|
|
|
|
:class="stepIndex == 1 ? 'active-arrow' : ''"
|
|
|
|
|
custom="icomoon icon-next"
|
|
|
|
|
></Icon>
|
2021-05-13 10:56:04 +08:00
|
|
|
|
<span :class="stepIndex == 2 ? 'active' : ''">3.成功提交订单</span>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<!-- 购物车商品列表 -->
|
|
|
|
|
<div class="cart-goods">
|
|
|
|
|
<div class="cart-goods-title">
|
|
|
|
|
<div class="width_60">
|
2021-12-11 13:50:58 +08:00
|
|
|
|
<Checkbox v-model="allChecked" @on-change="changeChecked(allChecked, 'all')"
|
|
|
|
|
>全选</Checkbox
|
|
|
|
|
>
|
2021-05-13 10:56:04 +08:00
|
|
|
|
</div>
|
|
|
|
|
<div class="goods-title">商品</div>
|
|
|
|
|
<div class="width_150">单价(元)</div>
|
|
|
|
|
<div class="width_100">数量</div>
|
|
|
|
|
<div class="width_150">小计</div>
|
|
|
|
|
<div class="width_100">操作</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div v-if="cartList.length === 0" class="cart-empty">
|
|
|
|
|
<p>购物车空空如也</p>
|
|
|
|
|
<router-link to="/">去选购></router-link>
|
|
|
|
|
</div>
|
2021-12-11 13:50:58 +08:00
|
|
|
|
<div
|
|
|
|
|
v-else
|
|
|
|
|
class="cart-goods-items"
|
|
|
|
|
v-for="(shop, index) in cartList"
|
|
|
|
|
:key="index"
|
|
|
|
|
>
|
2021-05-13 10:56:04 +08:00
|
|
|
|
<div class="shop-name">
|
|
|
|
|
<div>
|
2021-12-11 13:50:58 +08:00
|
|
|
|
<Checkbox
|
|
|
|
|
v-model="shop.checked"
|
|
|
|
|
@on-change="changeChecked(shop.checked, 'shop', shop.storeId)"
|
|
|
|
|
></Checkbox>
|
|
|
|
|
<span class="go-shop-page" @click="goShopPage(shop.storeId)">{{
|
|
|
|
|
shop.storeName
|
|
|
|
|
}}</span>
|
2021-05-13 10:56:04 +08:00
|
|
|
|
</div>
|
2021-12-11 13:50:58 +08:00
|
|
|
|
<span
|
|
|
|
|
class="shop-coupon"
|
|
|
|
|
v-if="shop.couponList.length"
|
|
|
|
|
:class="couponAvailable === index ? 'shop-coupon-show' : ''"
|
|
|
|
|
@click.stop="showCoupon(shop.id, index)"
|
|
|
|
|
>
|
2021-05-13 10:56:04 +08:00
|
|
|
|
<!-- 优惠券模态框 -->
|
|
|
|
|
<div v-if="couponAvailable === index">
|
2021-12-11 13:50:58 +08:00
|
|
|
|
<div
|
|
|
|
|
class="coupon-item"
|
|
|
|
|
v-for="(item, index) in shop.couponList"
|
|
|
|
|
:key="index"
|
|
|
|
|
>
|
2021-05-13 10:56:04 +08:00
|
|
|
|
<span v-if="item.couponType === 'PRICE'">¥{{ item.price }}</span>
|
2021-12-11 13:50:58 +08:00
|
|
|
|
<span v-if="item.couponType === 'DISCOUNT'"
|
|
|
|
|
>{{ item.couponDiscount }}折</span
|
|
|
|
|
>
|
|
|
|
|
<span>满{{ item.consumeThreshold }}元可用</span>
|
|
|
|
|
<Button
|
|
|
|
|
class="coupon-btn"
|
|
|
|
|
size="small"
|
|
|
|
|
type="primary"
|
|
|
|
|
@click="receiveShopCoupon(item)"
|
|
|
|
|
:disabled="item.disabled"
|
|
|
|
|
>{{ item.disabled ? "已领取" : "领取" }}</Button
|
|
|
|
|
>
|
2021-05-13 10:56:04 +08:00
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</span>
|
2021-12-11 13:50:58 +08:00
|
|
|
|
<div class="promotion-notice">{{ shop.promotionNotice }}</div>
|
2021-05-13 10:56:04 +08:00
|
|
|
|
</div>
|
|
|
|
|
<template v-for="(goods, goodsIndex) in shop.skuList">
|
2021-06-17 15:24:34 +08:00
|
|
|
|
<div class="goods-item" :key="goodsIndex">
|
2021-05-13 10:56:04 +08:00
|
|
|
|
<div class="width_60">
|
2021-12-11 13:50:58 +08:00
|
|
|
|
<Checkbox
|
|
|
|
|
v-model="goods.checked"
|
|
|
|
|
@on-change="changeChecked(goods.checked, 'goods', goods.goodsSku.id)"
|
|
|
|
|
></Checkbox>
|
2021-05-13 10:56:04 +08:00
|
|
|
|
</div>
|
2021-12-11 13:50:58 +08:00
|
|
|
|
<div
|
|
|
|
|
class="goods-title"
|
|
|
|
|
@click="goGoodsDetail(goods.goodsSku.id, goods.goodsSku.goodsId)"
|
|
|
|
|
>
|
|
|
|
|
<img
|
|
|
|
|
:src="
|
|
|
|
|
goods.goodsSku.thumbnail ||
|
|
|
|
|
'../assets/images/goodsDetail/item-detail-1.jpg'
|
|
|
|
|
"
|
|
|
|
|
/>
|
2021-05-13 10:56:04 +08:00
|
|
|
|
<div>
|
|
|
|
|
<p>{{ goods.goodsSku.goodsName }}</p>
|
|
|
|
|
<template v-for="(promotion, promotionIndex) in goods.promotions">
|
2021-12-11 13:50:58 +08:00
|
|
|
|
<div
|
|
|
|
|
class="promotion"
|
|
|
|
|
:key="promotionIndex"
|
|
|
|
|
v-if="promotion.promotionType === 'SECKILL'"
|
|
|
|
|
>
|
2021-05-13 10:56:04 +08:00
|
|
|
|
<span>秒杀</span>
|
|
|
|
|
<promotion :time="promotion.endTime" type="cart"></promotion>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
2021-08-26 11:15:07 +08:00
|
|
|
|
<template v-for="(promotion, promotionIndex) in goods.promotions">
|
2021-12-11 13:50:58 +08:00
|
|
|
|
<div
|
|
|
|
|
class="promotion"
|
|
|
|
|
:key="promotionIndex"
|
|
|
|
|
v-if="promotion.promotionType === 'FULL_DISCOUNT'"
|
|
|
|
|
>
|
2021-08-26 11:15:07 +08:00
|
|
|
|
<span>满优惠活动</span>
|
|
|
|
|
<promotion :time="promotion.endTime" type="cart"></promotion>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
2021-05-13 10:56:04 +08:00
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="width_150">
|
2021-09-03 09:40:57 +08:00
|
|
|
|
{{ goods.purchasePrice | unitPrice("¥") }}
|
2021-05-13 10:56:04 +08:00
|
|
|
|
</div>
|
|
|
|
|
<div class="width_100">
|
2021-12-11 13:50:58 +08:00
|
|
|
|
<InputNumber
|
|
|
|
|
:min="1"
|
|
|
|
|
size="small"
|
|
|
|
|
v-model="goods.num"
|
|
|
|
|
@on-change="changeNum(goods.num, goods.goodsSku.id)"
|
|
|
|
|
></InputNumber>
|
|
|
|
|
<div class="fontsize_12">
|
|
|
|
|
{{ goods.goodsSku.quantity > 0 ? "有货" : "无货" }}
|
|
|
|
|
</div>
|
2021-05-13 10:56:04 +08:00
|
|
|
|
</div>
|
|
|
|
|
<div class="width_150">
|
2021-09-03 09:40:57 +08:00
|
|
|
|
{{ goods.subTotal | unitPrice("¥") }}
|
2021-05-13 10:56:04 +08:00
|
|
|
|
</div>
|
|
|
|
|
<div class="width_100">
|
2021-12-11 13:50:58 +08:00
|
|
|
|
<span
|
|
|
|
|
class="handle-btn"
|
|
|
|
|
v-if="!goods.errorMessage"
|
|
|
|
|
@click="delGoods(goods.goodsSku.id)"
|
|
|
|
|
>删除</span
|
|
|
|
|
>
|
|
|
|
|
<span
|
|
|
|
|
class="handle-btn"
|
|
|
|
|
v-if="!goods.errorMessage"
|
|
|
|
|
@click="collectGoods(goods.goodsSku.id)"
|
|
|
|
|
>收藏</span
|
|
|
|
|
>
|
2021-05-13 10:56:04 +08:00
|
|
|
|
</div>
|
|
|
|
|
<div class="error-goods" v-if="goods.errorMessage">
|
2021-12-11 13:50:58 +08:00
|
|
|
|
<div>{{ goods.errorMessage }}</div>
|
2021-06-17 15:24:34 +08:00
|
|
|
|
<Button type="primary" @click="delGoods(goods.goodsSku.id)">删除</Button>
|
2021-05-13 10:56:04 +08:00
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
</div>
|
|
|
|
|
<!-- 底部支付栏 -->
|
|
|
|
|
<div class="cart-goods-footer">
|
|
|
|
|
<div>
|
|
|
|
|
<div class="width_60">
|
2021-12-11 13:50:58 +08:00
|
|
|
|
<Checkbox v-model="allChecked" @on-change="changeChecked(allChecked, 'all')"
|
|
|
|
|
>全选</Checkbox
|
|
|
|
|
>
|
2021-05-13 10:56:04 +08:00
|
|
|
|
</div>
|
2021-12-25 18:36:15 +08:00
|
|
|
|
<div class="width_100 handle-btn" @click="delGoods()">删除选中商品</div>
|
2021-05-13 10:56:04 +08:00
|
|
|
|
<!-- <div class="width_100 handle-btn" @click="collectGoods">移到我的收藏</div> -->
|
|
|
|
|
<div class="width_100 handle-btn" @click="clearCart">清空购物车</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div>
|
|
|
|
|
<div class="selected-count">
|
2021-12-11 13:50:58 +08:00
|
|
|
|
已选择<span>{{ checkedNum }}</span
|
|
|
|
|
>件商品
|
2021-05-13 10:56:04 +08:00
|
|
|
|
</div>
|
|
|
|
|
<div class="ml_20 save-price">
|
|
|
|
|
已节省<span>{{ priceDetailDTO.discountPrice | unitPrice("¥") }}</span>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="ml_20 total-price">
|
2021-12-11 13:50:58 +08:00
|
|
|
|
总价(不含运费):
|
|
|
|
|
<div>{{ priceDetailDTO.flowPrice | unitPrice("¥") }}</div>
|
2021-05-13 10:56:04 +08:00
|
|
|
|
</div>
|
2021-05-21 10:24:56 +08:00
|
|
|
|
<div class="pay ml_20" @click="pay">去结算</div>
|
2021-05-13 10:56:04 +08:00
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<Spin size="large" fix v-if="loading"></Spin>
|
|
|
|
|
</div>
|
|
|
|
|
<BaseFooter></BaseFooter>
|
|
|
|
|
</div>
|
|
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script>
|
2021-12-11 13:50:58 +08:00
|
|
|
|
import Promotion from "@/components/goodsDetail/Promotion";
|
|
|
|
|
import Search from "@/components/Search";
|
|
|
|
|
import * as APICart from "@/api/cart";
|
|
|
|
|
import * as APIMember from "@/api/member";
|
2021-05-13 10:56:04 +08:00
|
|
|
|
export default {
|
2021-12-11 13:50:58 +08:00
|
|
|
|
name: "Cart",
|
|
|
|
|
beforeRouteEnter(to, from, next) {
|
2021-05-13 10:56:04 +08:00
|
|
|
|
window.scrollTo(0, 0);
|
|
|
|
|
next();
|
|
|
|
|
},
|
|
|
|
|
components: {
|
|
|
|
|
Search,
|
2021-12-11 13:50:58 +08:00
|
|
|
|
Promotion,
|
2021-05-13 10:56:04 +08:00
|
|
|
|
},
|
2021-12-11 13:50:58 +08:00
|
|
|
|
data() {
|
2021-05-13 10:56:04 +08:00
|
|
|
|
return {
|
2021-05-13 11:35:57 +08:00
|
|
|
|
couponAvailable: false, // 展示优惠券
|
2021-05-13 10:56:04 +08:00
|
|
|
|
stepIndex: 0, // 当前处于哪一步,购物车==0,填写订单信息==1,成功提交订单==2
|
2022-03-31 09:26:24 +08:00
|
|
|
|
goodsTotal: 0, // 商品数量
|
2021-05-13 11:35:57 +08:00
|
|
|
|
checkedNum: 0, // 选中数量
|
|
|
|
|
allChecked: false, // 全选
|
|
|
|
|
loading: false, // 加载状态
|
|
|
|
|
cartList: [], // 购物车列表
|
|
|
|
|
couponList: [], // 优惠券列表
|
|
|
|
|
priceDetailDTO: {}, // 价格明细
|
2021-12-11 13:50:58 +08:00
|
|
|
|
skuList: [], // sku列表
|
2021-05-13 10:56:04 +08:00
|
|
|
|
};
|
|
|
|
|
},
|
|
|
|
|
methods: {
|
|
|
|
|
// 跳转商品详情
|
2021-12-11 13:50:58 +08:00
|
|
|
|
goGoodsDetail(skuId, goodsId) {
|
2021-05-13 10:56:04 +08:00
|
|
|
|
let routeUrl = this.$router.resolve({
|
2021-12-11 13:50:58 +08:00
|
|
|
|
path: "/goodsDetail",
|
|
|
|
|
query: { skuId, goodsId },
|
2021-05-13 10:56:04 +08:00
|
|
|
|
});
|
2021-12-11 13:50:58 +08:00
|
|
|
|
window.open(routeUrl.href, "_blank");
|
2021-05-13 10:56:04 +08:00
|
|
|
|
},
|
|
|
|
|
// 跳转店铺首页
|
2021-12-11 13:50:58 +08:00
|
|
|
|
goShopPage(id) {
|
2021-05-13 10:56:04 +08:00
|
|
|
|
let routeUrl = this.$router.resolve({
|
2021-12-11 13:50:58 +08:00
|
|
|
|
path: "/Merchant",
|
|
|
|
|
query: { id },
|
2021-05-13 10:56:04 +08:00
|
|
|
|
});
|
2021-12-11 13:50:58 +08:00
|
|
|
|
window.open(routeUrl.href, "_blank");
|
2021-05-13 10:56:04 +08:00
|
|
|
|
},
|
|
|
|
|
// 收藏商品
|
2021-12-11 13:50:58 +08:00
|
|
|
|
collectGoods(id) {
|
2021-05-13 10:56:04 +08:00
|
|
|
|
this.$Modal.confirm({
|
2021-12-11 13:50:58 +08:00
|
|
|
|
title: "收藏",
|
|
|
|
|
content: "<p>商品收藏后可在个人中心我的收藏查看</p>",
|
2021-05-13 10:56:04 +08:00
|
|
|
|
onOk: () => {
|
2021-12-11 13:50:58 +08:00
|
|
|
|
APIMember.collectGoods("GOODS", id).then((res) => {
|
2021-05-13 10:56:04 +08:00
|
|
|
|
if (res.success) {
|
2021-12-11 13:50:58 +08:00
|
|
|
|
this.$Message.success("收藏商品成功");
|
2021-05-13 10:56:04 +08:00
|
|
|
|
this.getCartList();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
},
|
2021-12-11 13:50:58 +08:00
|
|
|
|
onCancel: () => {},
|
2021-05-13 10:56:04 +08:00
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
// 删除商品
|
2021-12-11 13:50:58 +08:00
|
|
|
|
delGoods(id) {
|
2021-05-13 10:56:04 +08:00
|
|
|
|
const idArr = [];
|
|
|
|
|
if (!id) {
|
|
|
|
|
const list = this.cartList;
|
|
|
|
|
list.forEach((shop) => {
|
|
|
|
|
shop.skuList.forEach((goods) => {
|
2022-03-31 09:26:24 +08:00
|
|
|
|
if (goods.checked) {
|
2021-12-25 18:36:15 +08:00
|
|
|
|
idArr.push(goods.goodsSku.id);
|
|
|
|
|
}
|
2021-05-13 10:56:04 +08:00
|
|
|
|
});
|
|
|
|
|
});
|
|
|
|
|
} else {
|
|
|
|
|
idArr.push(id);
|
|
|
|
|
}
|
|
|
|
|
this.$Modal.confirm({
|
2021-12-11 13:50:58 +08:00
|
|
|
|
title: "删除",
|
|
|
|
|
content: "<p>确定要删除该商品吗?</p>",
|
2021-05-13 10:56:04 +08:00
|
|
|
|
onOk: () => {
|
|
|
|
|
APICart.delCartGoods({ skuIds: idArr.toString() }).then((res) => {
|
2021-05-17 16:04:36 +08:00
|
|
|
|
if (res.success) {
|
2021-12-11 13:50:58 +08:00
|
|
|
|
this.$Message.success("删除成功");
|
2021-05-13 10:56:04 +08:00
|
|
|
|
this.getCartList();
|
|
|
|
|
} else {
|
|
|
|
|
this.$Message.error(res.message);
|
|
|
|
|
}
|
|
|
|
|
});
|
2021-12-11 13:50:58 +08:00
|
|
|
|
},
|
2021-05-13 10:56:04 +08:00
|
|
|
|
});
|
|
|
|
|
},
|
2021-07-31 09:49:17 +08:00
|
|
|
|
// 清空购物车
|
2021-12-11 13:50:58 +08:00
|
|
|
|
clearCart() {
|
2021-05-13 10:56:04 +08:00
|
|
|
|
this.$Modal.confirm({
|
2021-12-11 13:50:58 +08:00
|
|
|
|
title: "提示",
|
|
|
|
|
content: "<p>确定要清空购物车吗?清空后不可恢复</p>",
|
2021-05-13 10:56:04 +08:00
|
|
|
|
onOk: () => {
|
|
|
|
|
APICart.clearCart().then((res) => {
|
2021-05-17 16:04:36 +08:00
|
|
|
|
if (res.success) {
|
2021-12-11 13:50:58 +08:00
|
|
|
|
this.$Message.success("清空购物车成功");
|
2021-05-13 10:56:04 +08:00
|
|
|
|
this.getCartList();
|
|
|
|
|
} else {
|
|
|
|
|
this.$Message.error(res.message);
|
|
|
|
|
}
|
|
|
|
|
});
|
2021-12-11 13:50:58 +08:00
|
|
|
|
},
|
2021-05-13 10:56:04 +08:00
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
// 跳转支付页面
|
2021-12-11 13:50:58 +08:00
|
|
|
|
pay() {
|
2021-05-13 10:56:04 +08:00
|
|
|
|
if (this.checkedNum) {
|
2021-12-11 13:50:58 +08:00
|
|
|
|
this.$router.push({ path: "/pay", query: { way: "CART" } });
|
2021-05-13 10:56:04 +08:00
|
|
|
|
} else {
|
2021-12-11 13:50:58 +08:00
|
|
|
|
this.$Message.warning("请至少选择一件商品");
|
2021-05-13 10:56:04 +08:00
|
|
|
|
}
|
|
|
|
|
},
|
|
|
|
|
// 展示优惠券
|
2021-12-11 13:50:58 +08:00
|
|
|
|
showCoupon(storeId, index) {
|
2021-05-13 10:56:04 +08:00
|
|
|
|
this.couponAvailable = index;
|
|
|
|
|
},
|
2021-07-31 09:49:17 +08:00
|
|
|
|
// 设置购买数量
|
2021-12-11 13:50:58 +08:00
|
|
|
|
changeNum(val, id) {
|
2021-05-13 10:56:04 +08:00
|
|
|
|
console.log(val, id);
|
|
|
|
|
APICart.setCartGoodsNum({ skuId: id, num: val }).then((res) => {
|
|
|
|
|
console.log(res);
|
2021-05-17 16:04:36 +08:00
|
|
|
|
if (res.success) {
|
2021-05-13 10:56:04 +08:00
|
|
|
|
this.getCartList();
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
},
|
2021-07-31 09:49:17 +08:00
|
|
|
|
// 设置商品选中状态
|
2021-12-11 13:50:58 +08:00
|
|
|
|
async changeChecked(status, type, id) {
|
2021-05-13 10:56:04 +08:00
|
|
|
|
const check = status ? 1 : 0;
|
2021-12-11 13:50:58 +08:00
|
|
|
|
if (type === "all") {
|
2021-05-13 10:56:04 +08:00
|
|
|
|
// 全选
|
|
|
|
|
await APICart.setCheckedAll({ checked: check });
|
2021-12-11 13:50:58 +08:00
|
|
|
|
} else if (type === "shop") {
|
2021-05-13 10:56:04 +08:00
|
|
|
|
// 选中店铺所有商品
|
|
|
|
|
await APICart.setCheckedSeller({ checked: check, storeId: id });
|
|
|
|
|
} else {
|
|
|
|
|
// 单个商品
|
|
|
|
|
await APICart.setCheckedGoods({ checked: check, skuId: id });
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
this.getCartList();
|
|
|
|
|
},
|
2021-07-31 09:49:17 +08:00
|
|
|
|
// 领取优惠券
|
2021-12-11 13:50:58 +08:00
|
|
|
|
async receiveShopCoupon(item) {
|
2021-06-17 15:24:34 +08:00
|
|
|
|
let res = await APIMember.receiveCoupon(item.id);
|
2021-05-17 16:04:36 +08:00
|
|
|
|
if (res.success) {
|
2021-12-11 13:50:58 +08:00
|
|
|
|
this.$set(item, "disabled", true);
|
|
|
|
|
this.$Message.success("领取成功");
|
2021-05-13 10:56:04 +08:00
|
|
|
|
} else {
|
2021-06-17 15:24:34 +08:00
|
|
|
|
this.$Message.error(res.message);
|
2021-05-13 10:56:04 +08:00
|
|
|
|
}
|
|
|
|
|
},
|
2021-07-31 09:49:17 +08:00
|
|
|
|
// 购物车列表
|
2021-12-11 13:50:58 +08:00
|
|
|
|
async getCartList() {
|
2021-05-13 10:56:04 +08:00
|
|
|
|
this.loading = true;
|
|
|
|
|
try {
|
|
|
|
|
let res = await APICart.cartGoodsAll();
|
|
|
|
|
this.loading = false;
|
2021-05-17 16:04:36 +08:00
|
|
|
|
if (res.success) {
|
2021-05-13 10:56:04 +08:00
|
|
|
|
this.cartList = res.result.cartList;
|
|
|
|
|
this.priceDetailDTO = res.result.priceDetailDTO;
|
|
|
|
|
this.skuList = res.result.skuList;
|
|
|
|
|
this.checkedNum = 0;
|
|
|
|
|
let allChecked = true;
|
|
|
|
|
for (let k = 0; k < this.cartList.length; k++) {
|
2021-06-17 15:24:34 +08:00
|
|
|
|
let shop = this.cartList[k];
|
|
|
|
|
let list = await APIMember.couponList({ storeId: shop.storeId });
|
|
|
|
|
shop.couponList.push(...list.result.records);
|
2021-05-13 10:56:04 +08:00
|
|
|
|
}
|
|
|
|
|
for (let i = 0; i < this.skuList.length; i++) {
|
|
|
|
|
if (this.skuList[i].checked) {
|
|
|
|
|
this.checkedNum += this.skuList[i].num;
|
|
|
|
|
} else {
|
|
|
|
|
allChecked = false;
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-06-17 15:24:34 +08:00
|
|
|
|
this.$forceUpdate();
|
2021-05-13 10:56:04 +08:00
|
|
|
|
this.allChecked = allChecked;
|
|
|
|
|
}
|
|
|
|
|
} catch (error) {
|
|
|
|
|
this.loading = false;
|
|
|
|
|
}
|
2021-12-11 13:50:58 +08:00
|
|
|
|
},
|
2021-05-13 10:56:04 +08:00
|
|
|
|
},
|
2021-12-11 13:50:58 +08:00
|
|
|
|
mounted() {
|
2021-05-13 10:56:04 +08:00
|
|
|
|
this.getCartList();
|
2021-06-17 15:24:34 +08:00
|
|
|
|
APICart.cartCount().then((res) => {
|
|
|
|
|
// 购物车商品数量
|
2021-05-13 10:56:04 +08:00
|
|
|
|
if (res.success) this.goodsTotal = res.result;
|
|
|
|
|
});
|
2021-12-11 13:50:58 +08:00
|
|
|
|
},
|
2021-05-13 10:56:04 +08:00
|
|
|
|
};
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
<style scoped lang="scss">
|
|
|
|
|
/** logo 搜索 start **/
|
|
|
|
|
.logo {
|
|
|
|
|
height: 40px;
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
align-items: center;
|
|
|
|
|
margin: 20px auto 0;
|
|
|
|
|
div:nth-child(1) {
|
|
|
|
|
display: flex;
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
align-items: center;
|
|
|
|
|
img {
|
|
|
|
|
width: 150px;
|
|
|
|
|
height: auto;
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
}
|
|
|
|
|
div:nth-child(2) {
|
|
|
|
|
width: 200px;
|
|
|
|
|
color: #999;
|
|
|
|
|
font-size: 16px;
|
|
|
|
|
margin: 0 20px;
|
|
|
|
|
span {
|
|
|
|
|
color: $theme_color;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
.cart-content {
|
|
|
|
|
margin: 0 auto;
|
|
|
|
|
width: 1200px;
|
|
|
|
|
position: relative;
|
|
|
|
|
}
|
|
|
|
|
/** logo end */
|
|
|
|
|
/** step步骤条 */
|
|
|
|
|
.cart-steps {
|
|
|
|
|
height: 30px;
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
margin-bottom: 15px;
|
|
|
|
|
span {
|
|
|
|
|
@include content_color($light_content_color);
|
|
|
|
|
height: 30px;
|
|
|
|
|
text-align: center;
|
|
|
|
|
line-height: 30px;
|
|
|
|
|
display: inline-block;
|
|
|
|
|
padding: 0 15px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.ivu-icon {
|
|
|
|
|
@include content_color($light_content_color);
|
|
|
|
|
font-size: 20px;
|
|
|
|
|
margin: 0 15px;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.active {
|
|
|
|
|
border-radius: 50px;
|
|
|
|
|
background-color: #ff8f23;
|
|
|
|
|
color: #fff;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.active-arrow {
|
|
|
|
|
color: #ff8f23;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
/** 步骤条和配送区域总体 */
|
|
|
|
|
.available-area {
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
margin-bottom: 15px;
|
|
|
|
|
}
|
|
|
|
|
/** 商品列表 */
|
|
|
|
|
.cart-goods {
|
|
|
|
|
&-title {
|
|
|
|
|
height: 50px;
|
|
|
|
|
@include background_color($light_white_background_color);
|
|
|
|
|
@include title_color($title_color);
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
padding: 0 20px;
|
|
|
|
|
div {
|
|
|
|
|
text-align: center;
|
|
|
|
|
}
|
|
|
|
|
.goods-title {
|
|
|
|
|
flex: 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
.cart-empty {
|
|
|
|
|
width: 100%;
|
|
|
|
|
text-align: center;
|
|
|
|
|
height: 300px;
|
|
|
|
|
padding-top: 100px;
|
|
|
|
|
}
|
|
|
|
|
&-items {
|
|
|
|
|
.shop-name {
|
|
|
|
|
height: 50px;
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
padding: 0 20px;
|
|
|
|
|
position: relative;
|
|
|
|
|
@include title_color($light_title_color);
|
|
|
|
|
> * {
|
|
|
|
|
width: 50%;
|
|
|
|
|
}
|
|
|
|
|
.go-shop-page:hover {
|
|
|
|
|
color: $theme_color;
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
}
|
|
|
|
|
.customer-service {
|
|
|
|
|
margin-left: 5px;
|
|
|
|
|
color: #fcc217;
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
&:hover {
|
|
|
|
|
color: $theme_color;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
/** 优惠券 */
|
|
|
|
|
.shop-coupon {
|
|
|
|
|
width: 80px;
|
|
|
|
|
height: 24px;
|
|
|
|
|
position: relative;
|
|
|
|
|
background: url(../assets/images/cart-coupon-icons02.png) 0 0 no-repeat;
|
|
|
|
|
> div {
|
|
|
|
|
position: absolute;
|
|
|
|
|
top: 35px;
|
|
|
|
|
left: 0;
|
|
|
|
|
width: 300px;
|
|
|
|
|
height: 300px;
|
|
|
|
|
background-color: #fff;
|
|
|
|
|
border: 1px solid $theme_color;
|
|
|
|
|
// border-radius: 3px;
|
|
|
|
|
z-index: 1;
|
|
|
|
|
padding: 10px 20px;
|
|
|
|
|
&::before {
|
|
|
|
|
content: "";
|
|
|
|
|
display: block;
|
|
|
|
|
background: url(../assets/images/cart-coupon-icons02.png) 0 -58px no-repeat;
|
|
|
|
|
width: 80px;
|
|
|
|
|
height: 12px;
|
|
|
|
|
position: absolute;
|
|
|
|
|
top: -12px;
|
|
|
|
|
left: 0;
|
|
|
|
|
}
|
|
|
|
|
.coupon-item {
|
|
|
|
|
margin-bottom: 10px;
|
|
|
|
|
span:nth-child(1) {
|
|
|
|
|
border: 1px solid #e33937;
|
|
|
|
|
display: inline-block;
|
|
|
|
|
padding: 3px 10px;
|
|
|
|
|
color: $theme_color;
|
|
|
|
|
border-radius: 3px;
|
|
|
|
|
}
|
|
|
|
|
span:nth-child(2) {
|
|
|
|
|
font-size: 12px;
|
|
|
|
|
margin-left: 5px;
|
|
|
|
|
color: #999;
|
|
|
|
|
}
|
|
|
|
|
.coupon-btn {
|
|
|
|
|
height: 26px;
|
|
|
|
|
float: right;
|
|
|
|
|
font-size: 12px;
|
|
|
|
|
}
|
|
|
|
|
&::after {
|
|
|
|
|
display: block;
|
|
|
|
|
content: "";
|
|
|
|
|
clear: right;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
.promotion-notice {
|
|
|
|
|
text-align: right;
|
|
|
|
|
font-size: 12px;
|
|
|
|
|
}
|
|
|
|
|
.shop-coupon-show {
|
|
|
|
|
background-position-y: -34px;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
.goods-item {
|
|
|
|
|
position: relative;
|
|
|
|
|
@extend .cart-goods-title;
|
|
|
|
|
@include background_color($light_white_background_color);
|
|
|
|
|
padding: 10px 20px;
|
|
|
|
|
height: auto;
|
|
|
|
|
> div:nth-child(1) {
|
|
|
|
|
padding-left: 15px;
|
|
|
|
|
width: 30px;
|
|
|
|
|
}
|
|
|
|
|
> div:nth-child(2) {
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
display: flex;
|
|
|
|
|
box-sizing: border-box;
|
|
|
|
|
padding-left: 20px;
|
|
|
|
|
position: relative;
|
|
|
|
|
img {
|
|
|
|
|
width: 70px;
|
|
|
|
|
height: 70px;
|
|
|
|
|
}
|
2021-06-17 15:24:34 +08:00
|
|
|
|
> div > p {
|
2021-05-13 10:56:04 +08:00
|
|
|
|
@include content_color($light_content_color);
|
|
|
|
|
font-size: 13px;
|
|
|
|
|
text-align: left;
|
|
|
|
|
margin-left: 10px;
|
|
|
|
|
&:hover {
|
|
|
|
|
color: $theme_color;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
> div:nth-child(5) {
|
|
|
|
|
font-weight: bold;
|
|
|
|
|
}
|
|
|
|
|
.num-input {
|
|
|
|
|
width: 60px;
|
|
|
|
|
border: 1px solid #999;
|
|
|
|
|
border-radius: 5px;
|
|
|
|
|
padding: 0 5px;
|
|
|
|
|
&:focus {
|
|
|
|
|
outline-color: $theme_color;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-06-17 15:24:34 +08:00
|
|
|
|
.error-goods {
|
2021-05-13 10:56:04 +08:00
|
|
|
|
position: absolute;
|
|
|
|
|
width: 100%;
|
|
|
|
|
height: 100%;
|
|
|
|
|
margin-left: -20px;
|
2021-06-17 15:24:34 +08:00
|
|
|
|
background-color: rgba($color: #999, $alpha: 0.5);
|
2021-05-13 10:56:04 +08:00
|
|
|
|
z-index: 10;
|
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
padding-left: 150px;
|
|
|
|
|
color: #000;
|
|
|
|
|
padding-right: 30px;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
&-footer {
|
|
|
|
|
@extend .cart-goods-title;
|
|
|
|
|
position: sticky;
|
|
|
|
|
bottom: 0;
|
|
|
|
|
border-top: 1px solid #ddd;
|
|
|
|
|
margin-top: 10px;
|
|
|
|
|
padding: 0 0 0 20px;
|
|
|
|
|
line-height: 50px;
|
|
|
|
|
justify-content: space-between;
|
|
|
|
|
> div {
|
|
|
|
|
display: flex;
|
|
|
|
|
}
|
|
|
|
|
.selected-count {
|
|
|
|
|
span {
|
|
|
|
|
color: $theme_color;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
.save-price span {
|
|
|
|
|
color: #000;
|
|
|
|
|
}
|
2021-06-17 15:24:34 +08:00
|
|
|
|
.total-price div {
|
2021-05-13 10:56:04 +08:00
|
|
|
|
color: $theme_color;
|
|
|
|
|
font-size: 20px;
|
|
|
|
|
}
|
|
|
|
|
.pay {
|
|
|
|
|
background-color: $theme_color;
|
|
|
|
|
width: 150px;
|
|
|
|
|
font-size: 20px;
|
|
|
|
|
color: #fff;
|
|
|
|
|
height: 100%;
|
|
|
|
|
line-height: 50px;
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
.handle-btn {
|
|
|
|
|
font-size: 12px;
|
|
|
|
|
color: $handle-btn-color;
|
|
|
|
|
cursor: pointer;
|
|
|
|
|
&:hover {
|
|
|
|
|
color: $theme_color;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
.like {
|
|
|
|
|
width: 1200px;
|
|
|
|
|
margin: 10px auto;
|
|
|
|
|
// padding: 20px 0;
|
|
|
|
|
@include white_background_color();
|
|
|
|
|
}
|
|
|
|
|
.likeGoods,
|
|
|
|
|
.shop-nav-container {
|
|
|
|
|
width: 1200px;
|
|
|
|
|
margin: 0 auto;
|
|
|
|
|
}
|
|
|
|
|
.ivu-divider {
|
|
|
|
|
background: $theme_color;
|
|
|
|
|
height: 2px;
|
|
|
|
|
}
|
|
|
|
|
.width_150 {
|
|
|
|
|
width: 150px;
|
|
|
|
|
}
|
|
|
|
|
.width_60 {
|
|
|
|
|
width: 60px;
|
|
|
|
|
}
|
|
|
|
|
.promotion {
|
|
|
|
|
display: flex;
|
|
|
|
|
margin-top: 5px;
|
|
|
|
|
margin-left: 5px;
|
2021-06-17 15:24:34 +08:00
|
|
|
|
> span {
|
2021-05-13 10:56:04 +08:00
|
|
|
|
border: 1px solid $theme_color;
|
|
|
|
|
color: $theme_color;
|
|
|
|
|
font-size: 12px;
|
|
|
|
|
border-radius: 2px;
|
|
|
|
|
padding: 0 2px;
|
|
|
|
|
}
|
2021-06-17 15:24:34 +08:00
|
|
|
|
> p {
|
2021-05-13 10:56:04 +08:00
|
|
|
|
font-size: 12px;
|
|
|
|
|
margin-left: 10px;
|
|
|
|
|
color: #999;
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-12-11 13:50:58 +08:00
|
|
|
|
.cart-goods-footer > div {
|
2021-06-17 15:24:34 +08:00
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
overflow: hidden;
|
|
|
|
|
}
|
2021-12-11 13:50:58 +08:00
|
|
|
|
.total-price {
|
2021-06-17 15:24:34 +08:00
|
|
|
|
display: flex;
|
|
|
|
|
align-items: center;
|
|
|
|
|
}
|
2021-05-13 10:56:04 +08:00
|
|
|
|
</style>
|
|
|
|
|
<style>
|
2021-06-17 15:24:34 +08:00
|
|
|
|
.ivu-input-number-input {
|
|
|
|
|
text-align: center;
|
|
|
|
|
}
|
2021-05-13 10:56:04 +08:00
|
|
|
|
</style>
|