<template>
|
<view class="page-addCart" :class="isPageShow ? 'pageShow' : ''">
|
<view class="pageBg"></view>
|
<view class="header" :style="{ paddingTop: menuTop + 'px' }">
|
<view class="header_text" :style="{ lineHeight: lineHeight + 'px' }">购物车</view>
|
</view>
|
<view class='shoppingCart copy-data'>
|
<view class="nav_box">
|
<view class='labelNav acea-row row-around'>
|
<view class='item'><text class='iconfont icon-xuanzhong'></text>100%正品保证</view>
|
<view class='item'><text class='iconfont icon-xuanzhong'></text>所有商品精挑细选</view>
|
<view class='item'><text class='iconfont icon-xuanzhong'></text>售后无忧</view>
|
</view>
|
<view
|
v-if="(cartList.valid.length === 0 && cartList.invalid.length === 0) || (cartList.valid.length > 0)"
|
class='nav acea-row row-between-wrapper my_nav'>
|
<view>购物车数量 <text class='num font-color'>{{ cartCount }}</text></view>
|
<view v-if="cartList.valid.length > 0 || cartList.invalid.length > 0"
|
class='administrate acea-row row-center-wrapper' @click='manage'>
|
{{ footerswitch ? '管理' : '取消管理' }}
|
</view>
|
</view>
|
</view>
|
<view class="cartBox" v-if="hasReady">
|
<view v-if="cartList.valid.length > 0 || cartList.invalid.length > 0">
|
<view v-if="cartList.valid.length > 0">
|
<checkbox-group @change="checkboxChange">
|
<view class='list' v-for="(item, index) in cartList.valid" :key="index">
|
<view class="list_name"><text>{{ item[0]['zoneName'] }}</text><text class="text2"
|
v-if="item[0].zoneMaxBuyNumber && item[0].zoneMaxBuyNumber > 0 && item.length > item[0].zoneMaxBuyNumber">{{
|
toChineseNum(item.length) }}选{{ toChineseNum(item[0].zoneMaxBuyNumber) }}</text>
|
<text class="promotion-tip">{{
|
(item[0].zoneId && zoneGroupCache[item[0].zoneId] &&
|
zoneGroupCache[item[0].zoneId].firstItem &&
|
zoneGroupCache[item[0].zoneId].firstItem.zonePromotionPreview &&
|
zoneGroupCache[item[0].zoneId].firstItem.zonePromotionPreview.matched) ?
|
zoneGroupCache[item[0].zoneId].firstItem.zonePromotionPreview.matchedRuleName
|
: ''
|
}}
|
</text>
|
<navigator v-if="item[0]['zoneId']" class="text3"
|
:url="'/pages/zone/index?id=' + item[0]['zoneId']" hover-class='none'>进专区
|
</navigator>
|
</view>
|
<view v-for="(subItem, index2) in item" :key="index2">
|
<view class='item acea-row row-between-wrapper'>
|
<!-- #ifndef MP -->
|
<checkbox :value="(subItem.id).toString()" :checked="subItem.checked"
|
:disabled="!subItem.attrStatus && footerswitch"
|
style="margin-right: 10rpx;" />
|
<!-- #endif -->
|
<!-- #ifdef MP -->
|
<checkbox :value="subItem.id" :checked="subItem.checked"
|
:disabled="!subItem.attrStatus && footerswitch" />
|
<!-- #endif -->
|
<view class='picTxt acea-row row-between-wrapper'>
|
<navigator class='pictrue'
|
:url='"/pages/goods_details/index?id=" + subItem.productId + (subItem.zoneId ? ("&zoneId=" + subItem.zoneId) : "")'
|
hover-class='none'>
|
<image :src='subItem.image'></image>
|
</navigator>
|
<navigator class='text'
|
:url='"/pages/goods_details/index?id=" + subItem.productId + (subItem.zoneId ? ("&zoneId=" + subItem.zoneId) : "")'
|
hover-class='none'>
|
<view class='line1' :class="subItem.attrStatus ? '' : 'reColor'">
|
{{ subItem.storeName }}
|
</view>
|
<view class='infor line1' v-if="subItem.suk">属性:{{ subItem.suk }}</view>
|
<view class='money color-blue' v-if="subItem.attrStatus">
|
<block v-if="subItem.payPrice && toNumber(subItem.payPrice) > 0">
|
¥{{ toNumber(subItem.payPrice) }}
|
</block>
|
<block
|
v-if="subItem.payPrice && toNumber(subItem.payPrice) > 0 && toNumber(subItem.payCareBean) > 0">
|
<br><text>+</text>
|
</block>
|
<block v-if="subItem.payCareBean > 0">
|
<text>{{ toThousands(toNumber(subItem.payCareBean)) }}悦养豆</text>
|
</block>
|
</view>
|
<view class="reElection acea-row row-between-wrapper" v-else>
|
<view class="title">请重新选择商品规格</view>
|
<view class="reBnt cart-color acea-row row-center-wrapper"
|
@click.stop="reElection(subItem)">重选</view>
|
</view>
|
</navigator>
|
<view class='carnum acea-row row-center-wrapper' v-if="subItem.attrStatus">
|
<view class="reduce" :class="subItem.numSub ? 'on' : ''"
|
@click.stop='subCart(index, index2)'>-</view>
|
<view class='num'><input class="input" type="number" pattern="[0-9]*"
|
v-model="subItem.cartNum"
|
@blur="blurInput($event, index, index2)">
|
</view>
|
<view class="plus" :class="subItem.numAdd ? 'on' : ''"
|
@click.stop='addCart(index, index2)'>+</view>
|
</view>
|
</view>
|
</view>
|
</view>
|
<!-- 赠送商品列表 -->
|
<view
|
v-if="zoneGroupCache[item[0].zoneId] && zoneGroupCache[item[0].zoneId].firstItem.zonePromotionPreview && zoneGroupCache[item[0].zoneId].firstItem.zonePromotionPreview.matched && zoneGroupCache[item[0].zoneId].firstItem.zonePromotionPreview.matchedRuleType === 3"
|
class="gift-list">
|
<view
|
v-for="(gift, giftIndex) in getMatchedGiftList(zoneGroupCache[item[0].zoneId].firstItem)"
|
:key="giftIndex">
|
<!-- 商品类型 -->
|
<view v-if="gift.giftType === 1" class='item acea-row row-between-wrapper'
|
:class="{ 'gift-item': true }">
|
<view class='picTxt acea-row row-between-wrapper'
|
style="flex-wrap: nowrap;">
|
<view class='pictrue' @click="goGiftDetail(gift)">
|
<image :src='getGiftImage(gift)'></image>
|
<view class="gift-tag">赠品</view>
|
</view>
|
<view class='text' style="margin-left:30rpx">
|
<view class='line1'>{{ getGiftName(gift) }}</view>
|
<view class='infor'>x{{ gift.giftNum }}</view>
|
</view>
|
</view>
|
</view>
|
<!-- 优惠券类型 -->
|
<view v-else-if="gift.giftType === 2" class='item acea-row row-between-wrapper'
|
:class="{ 'gift-item': true }">
|
<view class='picTxt acea-row row-between-wrapper'
|
style="flex-wrap: nowrap;">
|
<view class='pictrue'>
|
<image :src='getGiftImage(gift)'></image>
|
<view class="gift-tag">赠品</view>
|
</view>
|
<view class='text' style="margin-left:30rpx">
|
<view class='line1'>{{ getGiftName(gift) }}</view>
|
<view class='infor'>x{{ gift.giftNum }}</view>
|
</view>
|
</view>
|
</view>
|
</view>
|
</view>
|
</view>
|
</checkbox-group>
|
</view>
|
<view v-if="cartList.invalid.length > 0" class='invalidGoods borRadius14'
|
:style="cartList.valid.length === 0 && cartList.invalid.length > 0 ? 'position: relative;z-index: 111;top: -120rpx;' : 'position: static;'">
|
<view class='goodsNav acea-row row-between-wrapper'>
|
<view v-if="cartList.invalid.length > 1 || cartList.valid.length > 0" @click='goodsOpen'>
|
<text class='iconfont'
|
:class='goodsHidden == true ? "icon-xiangxia" : "icon-xiangshang"'></text>失效商品
|
</view>
|
<view v-else>
|
失效商品
|
</view>
|
<view class='del' @click='unsetCart'><text class='iconfont icon-shanchu1'></text>清空</view>
|
</view>
|
<view class='goodsList' :hidden='goodsHidden' v-for="(item, index) in cartList.invalid"
|
:key='index'>
|
<view class="goodsList_name">{{ item[0]['zoneName'] }}</view>
|
<block v-for="(subItem, index2) in item" :key='index2'>
|
<view class='item acea-row row-between-wrapper'>
|
<view class='invalid'>失效</view>
|
<view class='picTxt acea-row row-between-wrapper'>
|
<view class='pictrue'>
|
<image :src='subItem.image'></image>
|
</view>
|
<view class='text acea-row row-column-between'>
|
<view class='line1 name'>{{ subItem.storeName }}</view>
|
<view class='infor line1' v-if="subItem.suk">属性:{{ subItem.suk }}</view>
|
<view class='acea-row row-between-wrapper'>
|
<view class='end'>该商品已失效</view>
|
</view>
|
</view>
|
</view>
|
</view>
|
</block>
|
</view>
|
</view>
|
<view class='loadingicon acea-row row-center-wrapper' v-if="cartList.invalid.length && loadend">
|
<text class='loading iconfont icon-jiazai' :hidden='loadingInvalid == false'></text>{{
|
loadTitleInvalid }}
|
</view>
|
</view>
|
<view class='noCart' v-if="cartList.valid.length == 0 && cartList.invalid.length == 0 && canShow">
|
<view class="pictrueBox">
|
<view class='pictrue'>
|
<image src='https://ossacmall.bluedeer.com.cn/app/static/images/noCart.png'></image>
|
</view>
|
<view class="addIcon" @click="addMore">
|
<image src='https://ossacmall.bluedeer.com.cn/app/static/images/addCart_more.png'></image>
|
</view>
|
</view>
|
<recommend :pageName="'购物车'" :hostProduct='hostProduct'></recommend>
|
</view>
|
</view>
|
</view>
|
<view style="height: 140rpx;"></view>
|
<view class='footer' v-if="cartList.valid.length > 0">
|
<view class="footer_box acea-row row-between-wrapper">
|
<view class='money acea-row row-middle'>
|
<checkbox-group @change="checkboxAllChange">
|
<checkbox value="all" :checked="!!isAllSelect" />
|
|
</checkbox-group>
|
<text class='checkAll' style="white-space: nowrap;">全选({{ selectValue.length }})</text>
|
<text v-if="footerswitch == true" class="label"
|
style="padding-right: 4rpx;white-space: nowrap;">总价</text>
|
<text v-if="footerswitch == true">
|
<text style="display: inline-block;" class="font-bold color-blue"
|
v-if="toNumber(selectCareBean) <= 0 || (toNumber(selectCareBean) > 0 && toNumber(selectCountPrice) > 0)">
|
¥{{ toNumber(selectCountPrice) }}<block
|
v-if="toNumber(selectCountPrice) > 0 && toNumber(selectCareBean) > 0"
|
class="font-bold color-blue">+</block>
|
</text>
|
<block v-if="toNumber(selectCareBean) > 0"><text class="font-bold color-blue">{{
|
toThousands(toNumber(selectCareBean)) }}悦养豆</text>
|
</block>
|
</text>
|
<button v-if="footerswitch" class='placeOrder bg-color' @click="subOrder">立即结算</button>
|
</view>
|
<view class='button acea-row row-middle' v-if="!footerswitch">
|
<form @submit="subCollect" report-submit='true'>
|
<button class='bnt collect' formType="submit">收藏</button>
|
</form>
|
<form @submit="subDel" report-submit='true'>
|
<button class='bnt del' formType="submit">删除</button>
|
</form>
|
</view>
|
</view>
|
</view>
|
<!-- #ifdef MP -->
|
<!-- <authorize :isAuto="isAuto" :isShowAuth="isShowAuth" @authColse="authColse"></authorize> -->
|
<!-- #endif -->
|
<productWindow :iScart='1' :attr="attr" :productSelect="attr.productSelect" :careBeanStep="careBeanStep"
|
:isShow='1' :iSplus='1' @myevent="onMyEvent" @ChangeAttr="ChangeAttr" @ChangeCartNum="ChangeCartNum"
|
@ChangeCareBeanNum="ChangeCareBeanNum" @attrVal="attrVal" @blurCareBeanNum="blurCareBeanNum"
|
@iptCareBeanNum="iptCareBeanNum" @iptCartNum="iptCartNum" @blurCartNum="blurCartNum" @goCat="reGoCat"
|
id='product-window'>
|
</productWindow>
|
<view style="height: 218rpx;"></view>
|
<tabBar :tab-id="3"></tabBar>
|
<popCoupon ref="popCoupon" :pageName="'addcart'"></popCoupon>
|
</view>
|
</template>
|
|
<script>
|
import BigNumber from 'bignumber.js';
|
let sysHeight = 0
|
import {
|
getCartList,
|
getCartCounts,
|
changeCartNum,
|
cartDel,
|
getResetCart,
|
} from '@/api/order.js';
|
import {
|
getProductHot,
|
collectAll,
|
getProductDetail,
|
postCartAdd,
|
batchPostCartAdd,
|
getZonePromotionPreview
|
} from '@/api/store.js';
|
import {
|
toLogin
|
} from '@/libs/login.js';
|
import {
|
handsCoupon
|
} from '@/api/user.js'
|
import {
|
mapGetters
|
} from "vuex";
|
import recommend from '@/components/recommend';
|
import productWindow from '@/components/productWindow';
|
import popCoupon from '@/components/popCoupon/index.vue';
|
export default {
|
components: {
|
recommend,
|
productWindow,
|
popCoupon
|
},
|
data() {
|
return {
|
cartCount: 0,
|
goodsHidden: false,
|
footerswitch: true,
|
hostProduct: [],
|
cartList: {
|
valid: [],
|
invalid: []
|
},
|
isAllSelect: false, //全选
|
selectValue: [], //选中的数据
|
selectCountPrice: 0.00,
|
selectCareBean: 0,
|
zoneGroupCache: {}, // 专区促销缓存
|
isAuto: false, //没有授权的不会自动授权
|
isShowAuth: false, //是否隐藏授权
|
hotScroll: false,
|
hotPage: 1,
|
hotLimit: 10,
|
loading: false,
|
loadend: false,
|
loadTitle: '加载更多', //提示语
|
page: 1,
|
limit: 999,
|
loadingInvalid: false,
|
loadendInvalid: false,
|
loadTitleInvalid: '加载更多', //提示语
|
pageInvalid: 1,
|
limitInvalid: 99999,
|
attr: {
|
cartAttr: false,
|
productAttr: [],
|
productSelect: {}
|
},
|
productValue: [], //系统属性
|
productInfo: {},
|
attrValue: '', //已选属性
|
attrTxt: '请选择', //属性页面提示
|
cartId: 0,
|
product_id: 0,
|
product_zoneId: 0,
|
sysHeight: sysHeight,
|
canShow: false,
|
selectCareBean: 0,
|
selectPrice: 0,
|
careBeanRate: 0,
|
careBeanStep: 0,
|
isClicking: false,
|
menuTop: 0,
|
lineHeight: 34,
|
isPageShow: false,
|
loginBackFn: null,
|
hasReady: false,
|
isFromReturn: false,
|
hasListenReturn: false,
|
entranceNameVar: '',
|
productIds: [],
|
giftCache: {}, // 赠品详情缓存
|
};
|
},
|
computed: mapGetters(['isLogin']),
|
onLoad: function (options) {
|
let that = this;
|
that.menuTop = uni.getMenuButtonBoundingClientRect().top;
|
that.lineHeight = uni.getMenuButtonBoundingClientRect().height;
|
if (!this.hasListenReturn) {
|
uni.$on('returnEvent', function (data) {
|
if (data && data.name == 'goods_details' && data.returnPage.indexOf(
|
'pages/order_addcart/order_addcart') >= 0) {
|
that.isFromReturn = true;
|
console.log('listen return ' + that.isFromReturn);
|
}
|
});
|
this.hasListenReturn = true;
|
}
|
},
|
onHide() {
|
let that = this;
|
if (that.$store.getters.isSystemHide) {
|
console.log('系统事件触发了onHide事件');
|
return false;
|
}
|
this.isPageShow = false;
|
uni.$off('loginFlSuccess', that.registerFn);
|
uni.$off('BELONG_READY', that.belongInfoReadyFn);
|
},
|
onShow: function () {
|
let that = this;
|
if (that.$store.getters.isSystemHide) {
|
console.log('系统事件触发了onshow事件');
|
that.$store.getters.isSystemHide = false;
|
return false;
|
}
|
uni.$off('loginFlSuccess', that.registerFn);
|
uni.$off('BELONG_READY', that.belongInfoReadyFn);
|
that.isPageShow = true;
|
console.log('addcart onShow');
|
let pages = getCurrentPages(),
|
currPage = pages[pages.length - 1];
|
console.log('------------------page onShow start-----------------');
|
console.log('route', currPage.route);
|
console.log('options', currPage.options);
|
console.log('------------------page onShow end-----------------');
|
let options = currPage.options;
|
if (options.entranceNameVar && options.entranceNameVar == 'newyear') {
|
this.productIds = options.ids;
|
this.entranceNameVar = options.entranceNameVar;
|
console.log('aaaaaaaaa', this.entranceNameVar);
|
}
|
if (options.scene) {
|
if (this.$Cache.get('order_addcart_scene') && this.$Cache.get('order_addcart_scene') == options.scene && this.$Cache.get(
|
'order_addcart_param')) {
|
let params = JSON.parse(this.$Cache.get('order_addcart_param'));
|
if (params.ids) {
|
that.productIds = params.ids;
|
}
|
if (params.entranceNameVar) {
|
that.entranceNameVar = params.entranceNameVar;
|
}
|
} else {
|
uni.$once('finishSceneParam', (res) => {
|
console.log(res);
|
if (res && res.data) {
|
this.$Cache.set('order_addcart_scene', options.scene);
|
this.$Cache.set('order_addcart_param', res.data);
|
if (res.data.ids) {
|
that.productIds = res.data.ids;
|
} else {
|
that.productIds = '';
|
}
|
if (res.data.entranceNameVar) {
|
that.entranceNameVar = res.data.entranceNameVar;
|
} else {
|
that.entranceNameVar = '';
|
}
|
}
|
});
|
}
|
}
|
this.canShow = true;
|
this.loadend = false;
|
this.page = 1;
|
this.loadendInvalid = false;
|
this.pageInvalid = 1;
|
this.footerswitch = true;
|
|
this.cartList = {
|
valid: [],
|
invalid: []
|
};
|
this.isAllSelect = false; //全选
|
this.selectValue = []; //选中的数据
|
this.selectCountPrice = 0.00;
|
this.selectCareBean = 0;
|
this.cartCount = 0;
|
this.isShowAuth = false;
|
console.log('-----------', that.$store.getters.isLogin, that.$store.getters.unionId);
|
|
if (that.$store.getters.isBelong) {
|
that.belongInfoReadyFn({
|
isRegister: false
|
})
|
} else {
|
uni.$once('BELONG_READY', that.belongInfoReadyFn);
|
}
|
|
},
|
methods: {
|
toChineseNum(num) {
|
const chineseNums = ['零', '一', '二', '三', '四', '五', '六', '七', '八', '九'];
|
const chineseUnits = ['', '十', '百', '千', '万', '亿', '兆'];
|
|
if (num === 0) {
|
return chineseNums[0];
|
}
|
|
const digits = Math.floor(num).toString().split('');
|
const len = digits.length;
|
|
let result = '';
|
|
for (let i = 0; i < len; i++) {
|
const digit = parseInt(digits[i]);
|
const unit = chineseUnits[len - 1 - i];
|
|
if (digit !== 0) {
|
result += chineseNums[digit] + unit;
|
} else {
|
if (result[result.length - 1] !== chineseNums[0]) {
|
result += chineseNums[digit]
|
}
|
}
|
}
|
return result;
|
},
|
getMatchedGiftList(item) {
|
if (!item.zonePromotionPreview || !item.zonePromotionPreview.ruleList) return [];
|
const matchedRuleId = item.zonePromotionPreview.matchedRuleId;
|
const rule = item.zonePromotionPreview.ruleList.find(r => r.id === matchedRuleId);
|
const gifts = rule ? (rule.giftList || []) : [];
|
console.log(1111111111, matchedRuleId, gifts);
|
// 获取赠品详情
|
gifts.forEach(gift => {
|
this.fetchGiftDetail(gift);
|
});
|
return gifts;
|
},
|
fetchGiftDetail(gift) {
|
// giftType: 1=商品, 2=优惠券
|
if (gift.giftType !== 1) return;
|
if (this.giftCache[gift.giftRefId]) return;
|
|
getProductDetail(gift.giftRefId, '', '', '').then(res => {
|
this.$set(this.giftCache, gift.giftRefId, {
|
image: res.data.productInfo.image,
|
storeName: res.data.productInfo.storeName,
|
price: res.data.productInfo.price
|
});
|
}).catch(() => { });
|
},
|
getGiftImage(gift) {
|
if (gift.giftType === 1) {
|
if (this.giftCache[gift.giftRefId]) {
|
return this.giftCache[gift.giftRefId].image || '/static/images/def.png';
|
}
|
} else {
|
// 优惠券使用默认图片
|
return 'https://ossacmall.bluedeer.com.cn/app/static/images/coupon.png';
|
}
|
return '';
|
},
|
getGiftName(gift) {
|
if (gift.giftType === 1 && this.giftCache[gift.giftRefId]) {
|
return this.giftCache[gift.giftRefId].storeName || gift.giftName;
|
}
|
return gift.giftName || '赠品';
|
},
|
goGiftDetail(gift) {
|
// giftType: 1=商品, 2=优惠券
|
if (gift.giftType === 1) {
|
uni.navigateTo({
|
url: `/pages/goods_details/index?id=${gift.giftRefId}`
|
});
|
}
|
},
|
belongInfoReadyFn(data) {
|
let that = this;
|
if (!data.isRegister) {
|
that.checkLoginFn()
|
}
|
},
|
checkLoginFn() {
|
let that = this;
|
let pages = getCurrentPages(),
|
currPage = pages[pages.length - 1];
|
that.addTrack('yy_pageView', {
|
pageTitle_var: '购物车',
|
pagePath_var: currPage.$page.fullPath,
|
pageType_var: '购物车'
|
});
|
if (that.$store.getters.isLogin) {
|
if (!that.$store.getters.careBeanRate) {
|
uni.$once('updateCareBeanRate', () => {
|
that.onLoadFn();
|
});
|
} else {
|
that.onLoadFn();
|
}
|
} else {
|
if (!that.isFromReturn) {
|
this.hotPage = 1;
|
this.hostProduct = [];
|
this.hotScroll = false,
|
this.hotLimit = 10;
|
that.getHostProduct();
|
if (this.entranceNameVar) {
|
toLogin(this);
|
this.loginBackFn = function () {
|
if (!that.$store.getters.careBeanRate) {
|
uni.$once('updateCareBeanRate', () => {
|
that.onLoadFn();
|
});
|
} else {
|
that.onLoadFn();
|
}
|
}
|
}
|
}
|
}
|
that.isFromReturn = false;
|
uni.$once('loginFlSuccess', that.registerFn);
|
},
|
registerFn() {
|
console.log('registerFn');
|
let that = this;
|
if (that.loginBackFn) {
|
that.loginBackFn();
|
}
|
that.loginBackFn = null;
|
},
|
onLoadFn() {
|
let that = this;
|
that.careBeanRate = that.$store.getters.careBeanRate;
|
that.careBeanStep = BigNumber(that.careBeanRate).div(100).toNumber();
|
handsCoupon().then(res => {
|
if (res.code == 200) {
|
that.$refs.popCoupon.show();
|
}
|
});
|
if (that.entranceNameVar) {
|
uni.showLoading()
|
getCartList({
|
page: 1,
|
limit: 9999,
|
isValid: true
|
}).then((res) => {
|
if (res.data) {
|
console.log(res.data);
|
var ids = [];
|
res.data.list.forEach((arr, index) => {
|
arr.forEach((item, index2) => {
|
ids.push(item.id);
|
})
|
});
|
if (ids.length > 0) {
|
cartDel(ids.join(',')).then(() => {
|
that.batchAddShoppingCart().then(() => {
|
uni.hideLoading()
|
that.getCartList();
|
that.getInvalidList();
|
}).catch(() => {
|
uni.hideLoading()
|
that.getCartList();
|
that.getInvalidList();
|
});
|
}).catch(() => {
|
uni.hideLoading()
|
});
|
} else {
|
that.batchAddShoppingCart().then(() => {
|
uni.hideLoading()
|
that.getCartList();
|
that.getInvalidList();
|
}).catch(() => {
|
uni.hideLoading()
|
});
|
}
|
} else {
|
that.batchAddShoppingCart().then(() => {
|
uni.hideLoading()
|
that.getCartList();
|
that.getInvalidList();
|
})
|
}
|
}).catch(function (err) {
|
uni.hideLoading()
|
that.$util.Tips({
|
title: (err && err.message) ? err.message : err
|
});
|
})
|
} else {
|
that.getCartList();
|
that.getInvalidList();
|
}
|
//检查用户有可以手动领取导入优惠券记录
|
// that.$refs.popCoupon.show();
|
},
|
batchAddShoppingCart() {
|
let that = this;
|
return new Promise((resolve, reject) => {
|
batchPostCartAdd({ ids: this.productIds }).then(function (res) {
|
uni.hideLoading();
|
resolve();
|
}).catch(res => {
|
uni.hideLoading();
|
that.$util.Tips({
|
title: (res && res.message) ? res.message : res
|
});
|
reject();
|
});
|
});
|
},
|
addShoppingCart() {
|
let that = this;
|
return new Promise((resolve, reject) => {
|
let idIndex = -1;
|
let ids = this.productIds.split(',');
|
|
function join() {
|
idIndex++;
|
if (idIndex > ids.length - 1) {
|
resolve();
|
} else {
|
let productId = ids[idIndex];
|
uni.showLoading()
|
that.getProductDetail(productId).then(() => {
|
if (parseFloat(that.attr.productSelect.cart_num) < 1) {
|
return that.$util.Tips({
|
title: "商品数量不能小于1"
|
});
|
}
|
uni.hideLoading()
|
let q = {
|
productId: productId,
|
cartNum: parseFloat(that.attr.productSelect.cart_num),
|
isNew: false,
|
productAttrUnique: that.attr.productSelect !== undefined ?
|
that.attr.productSelect.unique : that.productInfo.id
|
};
|
if (that.productInfo.payWay == 1 || that.productInfo.payWay == 3) {
|
q.payCareBean = that.attr.productSelect.selectCareBeanNumber
|
}
|
if (that.zoneId) {
|
q.zoneId = that.zoneId;
|
}
|
uni.showLoading()
|
postCartAdd(q).then(function (res) {
|
uni.hideLoading();
|
that.addTrack('yy_addToCartSuccess', {
|
productName_var: that.productInfo.storeName,
|
productID_var: that.productInfo.id,
|
addQuantity_var: q.cartNum
|
});
|
join();
|
}).catch(res => {
|
uni.hideLoading();
|
that.$util.Tips({
|
title: (res && res.message) ? res.message : res
|
});
|
join();
|
});
|
}).catch(() => {
|
uni.hideLoading()
|
})
|
}
|
}
|
if (ids.length > 0) {
|
join();
|
} else {
|
reject();
|
}
|
});
|
|
},
|
addMore() {
|
if (this.$store.getters.isLogin) {
|
uni.switchTab({
|
url: "/pages/goods_cate/goods_cate"
|
})
|
} else {
|
toLogin(this);
|
this.loginBackFn = function () {
|
uni.switchTab({
|
url: "/pages/goods_cate/goods_cate"
|
})
|
}
|
}
|
},
|
// 授权关闭
|
authColse: function (e) {
|
this.isShowAuth = e;
|
},
|
// 修改购物车
|
reGoCat: function () {
|
let that = this,
|
productSelect = that.productValue[this.attrValue];
|
//如果有属性,没有选择,提示用户选择
|
if (
|
that.attr.productAttr.length &&
|
productSelect === undefined
|
)
|
return that.$util.Tips({
|
title: "产品库存不足,请选择其它"
|
});
|
|
let q = {
|
id: that.cartId,
|
productId: that.product_id,
|
num: that.attr.productSelect.cart_num,
|
unique: that.attr.productSelect !== undefined ?
|
that.attr.productSelect.unique : that.productInfo.id
|
};
|
if (that.product_zoneId) {
|
q.zoneId = that.product_zoneId;
|
}
|
getResetCart(q)
|
.then(function (res) {
|
that.attr.cartAttr = false;
|
that.$util.Tips({
|
title: "添加购物车成功",
|
success: () => {
|
that.loadend = false;
|
that.page = 1;
|
that.cartList.valid = [];
|
that.getCartList();
|
that.getCartNum();
|
}
|
});
|
})
|
.catch(err => {
|
return that.$util.Tips({
|
title: (err && err.message) ? err.message : err
|
});
|
});
|
},
|
onMyEvent: function () {
|
this.$set(this.attr, 'cartAttr', false);
|
},
|
|
reElection: function (item) {
|
this.getGoodsDetails(item)
|
},
|
/**
|
* 获取产品详情
|
*
|
*/
|
getGoodsDetails: function (item) {
|
uni.showLoading({
|
title: '加载中',
|
mask: true
|
});
|
let that = this;
|
that.cartId = item.id;
|
that.product_id = item.productId;
|
if (item.zoneId) {
|
that.product_zoneId = item.zoneId;
|
} else {
|
that.product_zoneId = 0;
|
}
|
this.getProductDetail(that.product_id).then(() => {
|
that.attr.cartAttr = true;
|
});
|
},
|
getProductDetail(productId) {
|
let that = this;
|
return new Promise((resolve, reject) => {
|
getProductDetail(productId, '', '', '').then(res => {
|
uni.hideLoading();
|
let productInfo = res.data.productInfo;
|
that.$set(that, 'productInfo', productInfo);
|
// that.$set(that.attr, 'productAttr', res.data.productAttr);
|
that.$set(that, 'productValue', res.data.productValue);
|
let productAttr = res.data.productAttr.map(item => {
|
return {
|
attrName: item.attrName,
|
attrValues: item.attrValues.split(','),
|
id: item.id,
|
isDel: item.isDel,
|
productId: item.productId,
|
type: item.type
|
}
|
});
|
this.$set(that.attr, 'productAttr', productAttr);
|
that.careBeanRate = that.$store.getters.careBeanRate;
|
that.careBeanStep = BigNumber(that.careBeanRate).div(100).toNumber();
|
that.DefaultSelect();
|
resolve();
|
}).catch(err => {
|
reject();
|
uni.hideLoading();
|
})
|
});
|
},
|
/**
|
* 属性变动赋值
|
*
|
*/
|
getSelectPrice(price, careBeanNumber) {
|
console.log('getSelectPrice', price, careBeanNumber);
|
return BigNumber(price).minus(BigNumber(careBeanNumber).div(this.careBeanRate)).toFixed(2);
|
},
|
ChangeAttr: function (res) {
|
let productSelect = this.productValue[res];
|
if (!productSelect) {
|
for (var i in this.productValue) {
|
productSelect = this.productValue[i]
|
}
|
}
|
if (productSelect) {
|
this.$set(this.attr.productSelect, "image", productSelect.image);
|
this.$set(this.attr.productSelect, "payWay", this.productInfo.payWay);
|
this.$set(this.attr.productSelect, "price", productSelect.price);
|
this.$set(this.attr.productSelect, "sales", productSelect.sales);
|
this.$set(this.attr.productSelect, "stock", productSelect.stock);
|
this.$set(this.attr.productSelect, "careBeanMinNumber", productSelect.careBeanMinNumber);
|
this.$set(this.attr.productSelect, "careBeanMaxNumber", productSelect.careBeanMaxNumber);
|
|
this.setPriceAndCareBean(productSelect);
|
this.$set(this.attr.productSelect, "unique", productSelect.id);
|
this.$set(this.attr.productSelect, "cart_num", 1);
|
this.$set(this, "attrValue", res);
|
this.$set(this, "attrTxt", "已选择");
|
}
|
},
|
/**
|
* 默认选中属性
|
*
|
*/
|
DefaultSelect: function () {
|
let that = this;
|
let productAttr = this.attr.productAttr;
|
let value = [];
|
let minKey = '';
|
let minPr = 0;
|
for (let key in this.productValue) {
|
if (this.productInfo.payWay == 3) {
|
if (!minKey || this.productValue[key].careBeanMinNumber < minPr) {
|
minPr = this.productValue[key].careBeanMinNumber;
|
minKey = key;
|
}
|
} else {
|
if (!minKey || this.productValue[key].price < minPr) {
|
minPr = this.productValue[key].price;
|
minKey = key;
|
}
|
}
|
}
|
value = this.attr.productAttr.length ? minKey.split(",") : []
|
for (let i = 0; i < productAttr.length; i++) {
|
this.$set(productAttr[i], "index", value[i]);
|
}
|
let productSelect = this.productValue[value.join(",")];
|
if (productSelect && productAttr.length) {
|
this.$set(
|
this.attr.productSelect,
|
"storeName",
|
this.productInfo.storeName
|
);
|
this.$set(this.attr.productSelect, "image", productSelect.image);
|
this.$set(this.attr.productSelect, "payWay", this.productInfo.payWay);
|
this.$set(this.attr.productSelect, "price", productSelect.price);
|
this.$set(this.attr.productSelect, "sales", productSelect.sales);
|
this.$set(this.attr.productSelect, "stock", productSelect.stock);
|
this.$set(this.attr.productSelect, "careBeanMinNumber", productSelect.careBeanMinNumber);
|
this.$set(this.attr.productSelect, "careBeanMaxNumber", productSelect.careBeanMaxNumber);
|
|
this.setPriceAndCareBean(productSelect);
|
|
this.$set(this.attr.productSelect, "unique", productSelect.id);
|
this.$set(this.attr.productSelect, "cart_num", 1);
|
this.$set(this, "attrValue", value.join(","));
|
this.$set(this, "attrTxt", "已选择");
|
}
|
},
|
showUserLvPrice() {
|
if (this.seckillId
|
|| (this.productInfo.couponAfterPriceStatus > 0 && !(this.zoneId && this.zoneType == 1))
|
|| (this.zoneId && !(this.zoneType == 1))
|
|| (this.zoneId && this.zoneType == 1 && this.productInfo.userLv == 3)
|
|| this.productInfo.isVisual == 2) {
|
console.log('showUserLvPrice')
|
return true;
|
} else {
|
console.log('not showUserLvPrice')
|
return false;
|
}
|
},
|
setPriceAndCareBean(productSelect) {
|
let that = this;
|
if (this.zoneId && this.zoneType == 1) {
|
this.$set(this.attr.productSelect, "afterPrice", this.productInfo.payWay == 3 ? this.toNumber(productSelect.zhenXiangPrice) : productSelect.zhenXiangPrice);
|
} else if (this.productInfo.userLv == 0) {
|
this.$set(this.attr.productSelect, "afterPrice", this.productInfo.payWay == 3 ? this.toNumber(productSelect.puTongPrice) : productSelect.puTongPrice);
|
} else if (this.productInfo.userLv == 1) {
|
this.$set(this.attr.productSelect, "afterPrice", this.productInfo.payWay == 3 ? this.toNumber(productSelect.changXiangPrice) : productSelect.changXiangPrice);
|
} else if (this.productInfo.userLv == 2) {
|
this.$set(this.attr.productSelect, "afterPrice", this.productInfo.payWay == 3 ? this.toNumber(productSelect.yueXiangPrice) : productSelect.yueXiangPrice);
|
} else {
|
this.$set(this.attr.productSelect, "afterPrice", this.productInfo.payWay == 3 ? this.toNumber(productSelect.zhenXiangPrice) : productSelect.zhenXiangPrice);
|
}
|
if (this.productInfo.payWay == 3) {
|
this.$set(this.attr.productSelect, "selectPrice", 0);
|
if (this.showUserLvPrice()) {
|
this.$set(this.attr.productSelect, "selectCareBeanNumber", this.attr.productSelect.afterPrice);
|
} else {
|
this.$set(this.attr.productSelect, "selectCareBeanNumber", this.attr.productSelect.careBeanMinNumber);
|
}
|
} else if (this.productInfo.payWay == 1) {
|
if (this.showUserLvPrice()) {
|
this.$set(this.attr.productSelect, "selectPrice", this.getSelectPrice(this.attr
|
.productSelect.afterPrice, this.attr.productSelect.careBeanMaxNumber));
|
} else {
|
this.$set(this.attr.productSelect, "selectPrice", this.getSelectPrice(this.attr
|
.productSelect.price, this.attr.productSelect.careBeanMaxNumber));
|
}
|
this.$set(this.attr.productSelect, "selectCareBeanNumber", this.attr.productSelect.careBeanMaxNumber);
|
} else {
|
if (this.showUserLvPrice()) {
|
this.$set(this.attr.productSelect, "selectPrice", this.attr.productSelect.afterPrice);
|
} else {
|
this.$set(this.attr.productSelect, "selectPrice", this.attr.productSelect.price);
|
}
|
this.$set(this.attr.productSelect, "selectCareBeanNumber", 0);
|
}
|
},
|
/**
|
* 悦养豆数量加和数量减
|
*
|
*/
|
ChangeCareBeanNum(isAdd) {
|
let that = this;
|
if (isAdd) {
|
if (this.attr.productSelect.careBeanMaxNumber >= this.attr.productSelect.selectCareBeanNumber + this
|
.careBeanStep) {
|
this.$set(this.attr.productSelect, "selectCareBeanNumber", this.attr.productSelect
|
.selectCareBeanNumber + this.careBeanStep);
|
if (this.productInfo.couponAfterPriceStatus > 0 || this.product_zoneId) {
|
this.$set(this.attr.productSelect, "selectPrice", this.getSelectPrice(this.attr
|
.productSelect.afterPrice, this.attr.productSelect.selectCareBeanNumber));
|
} else {
|
this.$set(this.attr.productSelect, "selectPrice", this.getSelectPrice(this.attr
|
.productSelect.price, this.attr.productSelect.selectCareBeanNumber));
|
}
|
}
|
} else {
|
if (this.attr.productSelect.careBeanMinNumber <= this.attr.productSelect.selectCareBeanNumber - this
|
.careBeanStep) {
|
this.$set(this.attr.productSelect, "selectCareBeanNumber", this.attr.productSelect
|
.selectCareBeanNumber - this.careBeanStep);
|
if (this.productInfo.couponAfterPriceStatus > 0 || this.product_zoneId) {
|
this.$set(this.attr.productSelect, "selectPrice", this.getSelectPrice(this.attr
|
.productSelect.afterPrice, this.attr.productSelect.selectCareBeanNumber));
|
} else {
|
this.$set(this.attr.productSelect, "selectPrice", this.getSelectPrice(this.attr
|
.productSelect.price, this.attr.productSelect.selectCareBeanNumber));
|
}
|
|
}
|
}
|
},
|
/**
|
* 购物车数量加和数量减
|
*
|
*/
|
ChangeCartNum: function (changeValue) {
|
//changeValue:是否 加|减
|
//获取当前变动属性
|
let productSelect = this.productValue[this.attrValue];
|
//如果没有属性,赋值给商品默认库存
|
if (productSelect === undefined && !this.attr.productAttr.length)
|
productSelect = this.attr.productSelect;
|
//无属性值即库存为0;不存在加减;
|
if (productSelect === undefined) return;
|
let stock = productSelect.stock || 0;
|
let num = this.attr.productSelect;
|
if (changeValue) {
|
num.cart_num++;
|
if (num.cart_num > stock) {
|
this.$set(this.attr.productSelect, "cart_num", stock);
|
this.$set(this, "cart_num", stock);
|
}
|
} else {
|
num.cart_num--;
|
if (num.cart_num < 1) {
|
this.$set(this.attr.productSelect, "cart_num", 1);
|
this.$set(this, "cart_num", 1);
|
}
|
}
|
},
|
attrVal(val) {
|
this.$set(this.attr.productAttr[val.indexw], 'index', this.attr.productAttr[val.indexw].attrValues[val
|
.indexn]);
|
},
|
|
/**
|
* 购物车手动填写
|
*
|
*/
|
iptCartNum: function (e) {
|
this.$set(this.attr.productSelect, 'cart_num', (e && !isNaN(e)) ? e : 1);
|
},
|
blurCartNum: function (e) {
|
let num = e ? e : 1;
|
if (num > this.attr.productSelect.stock) {
|
num = this.attr.productSelect.stock;
|
} else if (num < 0) {
|
num = 0;
|
}
|
console.log(num);
|
this.$set(this.attr.productSelect, 'cart_num', num);
|
},
|
iptCareBeanNum: function (e) {
|
if ((e && e.detail && e.detail.value && !isNaN(e.detail.value))) {
|
let num = Number(e.detail.value);
|
this.$set(this.attr.productSelect, 'selectCareBeanNumber', num);
|
if (this.productInfo.couponAfterPriceStatus > 0 || this.product_zoneId) {
|
this.$set(this.attr.productSelect, "selectPrice", this.getSelectPrice(this.attr
|
.productSelect.afterPrice, this.attr.productSelect.selectCareBeanNumber));
|
} else {
|
this.$set(this.attr.productSelect, "selectPrice", this.getSelectPrice(this.attr
|
.productSelect.price, this.attr.productSelect.selectCareBeanNumber));
|
}
|
} else {
|
this.$set(this.attr.productSelect, 'selectCareBeanNumber', '');
|
}
|
},
|
blurCareBeanNum: function (e) {
|
let num = this.attr.productSelect.careBeanMinNumber;
|
if ((e && e.detail && e.detail.value && !isNaN(e.detail.value))) {
|
console.log(e);
|
num = Number(e.detail.value);
|
if (num < this.attr.productSelect.careBeanMinNumber) {
|
num = this.attr.productSelect.careBeanMinNumber;
|
}
|
if (num > this.attr.productSelect.careBeanMaxNumber) {
|
num = this.attr.productSelect.careBeanMaxNumber;
|
}
|
console.log(num);
|
}
|
this.$set(this.attr.productSelect, 'selectCareBeanNumber', num);
|
if (this.productInfo.couponAfterPriceStatus > 0 || this.product_zoneId) {
|
this.$set(this.attr.productSelect, "selectPrice", this.getSelectPrice(this.attr
|
.productSelect.afterPrice, this.attr.productSelect.selectCareBeanNumber));
|
} else {
|
this.$set(this.attr.productSelect, "selectPrice", this.getSelectPrice(this.attr
|
.productSelect.price, this.attr.productSelect.selectCareBeanNumber));
|
}
|
},
|
subDel: function (event) {
|
let that = this,
|
selectValue = that.selectValue;
|
if (selectValue.length > 0) {
|
that.$refs.showConfirm.show({
|
title: '提示',
|
content: '确认删除该商品?',
|
center: true,
|
success: function (res) {
|
if (res.confirm) {
|
cartDel(selectValue).then(res => {
|
that.loadend = false;
|
that.page = 1;
|
that.cartList.valid = [];
|
that.getCartList();
|
that.getCartNum();
|
});
|
}
|
}
|
})
|
} else {
|
return that.$util.Tips({
|
title: '您还没有选择商品哦!'
|
});
|
}
|
},
|
getSelectValueProductId: function () {
|
let pages = getCurrentPages(),
|
currPage = pages[pages.length - 1];
|
let that = this;
|
let validList = that.cartList.valid;
|
let selectValue = that.selectValue;
|
let productId = [];
|
if (selectValue.length > 0) {
|
for (let index in validList) {
|
for (let index2 in validList[index]) {
|
if (that.inArray(validList[index][index2].id, selectValue)) {
|
productId.push(validList[index][index2].productId);
|
that.addTrack('yy_favoriteClick', {
|
'pageTitle_var': '购物车',
|
'pageType_var': '购物车',
|
'pagePath_var': currPage.$page.fullPath,
|
'productID_var': validList[index][index2].id,
|
'productName_var': validList[index][index2].storeName,
|
'favoriteStatus_var': '收藏'
|
});
|
}
|
}
|
|
}
|
};
|
return productId;
|
},
|
subCollect: function (event) {
|
let that = this,
|
selectValue = that.selectValue;
|
if (selectValue.length > 0) {
|
|
collectAll(that.getSelectValueProductId()).then(res => {
|
return that.$util.Tips({
|
title: '收藏成功',
|
icon: 'success'
|
});
|
}).catch(err => {
|
return that.$util.Tips({
|
title: (err && err.message) ? err.message : err
|
});
|
});
|
} else {
|
return that.$util.Tips({
|
title: '您还没有选择商品哦!'
|
});
|
}
|
},
|
// 立即下单
|
subOrder: function (event) {
|
let that = this,
|
selectValue = that.selectValue;
|
if (that.isClicking) {
|
return false;
|
}
|
if (selectValue.length > 0) {
|
let valid = that.cartList.valid;
|
let canUp = true;
|
let nameArr = [];
|
valid.forEach((item, index) => {
|
if (that.inArray(item.id, selectValue) && item.cartNum > item.stock) {
|
canUp = false;
|
nameArr.push(item.storeName);
|
// that.$util.Tips({
|
// title:
|
// });
|
}
|
});
|
if (!canUp) {
|
uni.$emit("showTips", {
|
'title': nameArr.join('、') + ' 库存不足,请重新选择',
|
'icon': 'none'
|
});
|
return '';
|
}
|
that.isClicking = true;
|
that.getPreOrder();
|
} else {
|
return that.$util.Tips({
|
title: '您还没有选择商品哦!'
|
});
|
}
|
},
|
/**
|
* 预下单
|
*/
|
getPreOrder: function () {
|
let that = this;
|
let shoppingCartId = this.selectValue.map(item => {
|
return {
|
"shoppingCartId": that.toNumber(item)
|
}
|
})
|
this.$Order.getPreOrder("shoppingCart", shoppingCartId, false, false, false, this.entranceNameVar).then(() => {
|
setTimeout(() => {
|
that.isClicking = false;
|
}, 1000)
|
}).catch((e, data) => {
|
setTimeout(() => {
|
if (e.code == '601') {
|
that.loadend = false;
|
that.page = 1;
|
that.loadendInvalid = false;
|
that.pageInvalid = 1;
|
that.onLoadFn();
|
}
|
that.isClicking = false;
|
}, 2000)
|
});
|
},
|
checkboxAllChange: function (event) {
|
let value = event.detail.value;
|
if (value.length > 0) {
|
this.setAllSelectValue(1)
|
} else {
|
this.setAllSelectValue(0)
|
}
|
},
|
setAllSelectValue: function (status) {
|
let that = this;
|
let selectValue = [];
|
let valid = that.cartList.valid;
|
if (valid.length > 0) {
|
valid.map(child => [
|
child.map(item => {
|
if (status) {
|
if (that.footerswitch) {
|
if (item.attrStatus) {
|
item.checked = true;
|
selectValue.push(item.id);
|
} else {
|
item.checked = false;
|
}
|
} else {
|
item.checked = true;
|
selectValue.push(item.id);
|
}
|
} else {
|
item.checked = false;
|
}
|
})
|
])
|
if (status) {
|
that.isAllSelect = true;
|
} else {
|
that.isAllSelect = false;
|
}
|
//that.$set(that.cartList, 'valid', newValid);
|
that.selectValue = selectValue;
|
that.$Cache.set('cartCachSelect', that.selectValue.join(','))
|
console.log(that.$Cache.get('cartCachSelect'));
|
that.switchSelect();
|
}
|
},
|
checkboxChange: function (event) {
|
let that = this;
|
let value = event.detail.value;
|
let valid = that.cartList.valid;
|
let arr1 = [];
|
let arr2 = [];
|
let arr3 = [];
|
let totalLen = 0;
|
valid.map(child => {
|
child.map(item => {
|
totalLen++;
|
if (that.inArray(item.id, value)) {
|
if (that.footerswitch) {
|
if (item.attrStatus) {
|
item.checked = true;
|
arr1.push(item);
|
} else {
|
item.checked = false;
|
}
|
} else {
|
item.checked = true;
|
arr1.push(item);
|
}
|
} else {
|
item.checked = false;
|
arr2.push(item);
|
}
|
return item;
|
})
|
});
|
if (that.footerswitch) {
|
arr3 = arr2.filter(item => !item.attrStatus);
|
}
|
//that.$set(that.cartList, 'valid', newValid);
|
that.isAllSelect = totalLen === arr1.length + arr3.length;
|
that.selectValue = value;
|
that.$Cache.set('cartCachSelect', that.selectValue.join(','))
|
console.log(that.$Cache.get('cartCachSelect'));
|
that.switchSelect();
|
},
|
inArray: function (search, array) {
|
for (let i in array) {
|
if (array[i] == search) {
|
return true;
|
}
|
}
|
return false;
|
},
|
switchSelect: async function () {
|
let that = this;
|
let validList = that.cartList.valid;
|
let selectValue = that.selectValue;
|
console.log(selectValue);
|
let selectCountPrice = 0.00;
|
let selectCareBean = 0;
|
if (selectValue.length < 1) {
|
that.selectCountPrice = selectCountPrice;
|
that.selectCareBean = selectCareBean;
|
that.zoneGroupCache = {};
|
} else {
|
// 按专区分组计算
|
let zoneGroup = {};
|
that.zoneGroupCache = {};
|
console.log('VVVVVVVVVVVVVVVVVVVVVVV')
|
for (let index in validList) {
|
console.log(validList[index].length);
|
for (let index2 in validList[index]) {
|
let item = validList[index][index2];
|
console.log(item.id, that.inArray(item.id, selectValue));
|
if (that.inArray(item.id, selectValue)) {
|
let zoneId = item.zoneId || 'default';
|
if (!zoneGroup[zoneId]) {
|
zoneGroup[zoneId] = {
|
totalPrice: 0,
|
careBean: 0,
|
applyNum: 0,
|
promotionFee: 0,
|
firstItem: item // 记录该专区分组第一个商品
|
};
|
}
|
zoneGroup[zoneId].totalPrice = that.$util.$h.Add(zoneGroup[zoneId].totalPrice, that.$util.$h.Mul(item.cartNum, item.payPrice));
|
zoneGroup[zoneId].careBean = that.$util.$h.Add(zoneGroup[zoneId].careBean, that.$util.$h.Mul(item.cartNum, item.payCareBean));
|
zoneGroup[zoneId].applyNum += item.cartNum;
|
}
|
}
|
}
|
// 调用预估接口计算每个专区的促销优惠
|
for (let zoneId in zoneGroup) {
|
if (zoneId !== 'default' && zoneId > 0) {
|
try {
|
let res = await getZonePromotionPreview(zoneId, zoneGroup[zoneId].applyNum, zoneGroup[zoneId].totalPrice);
|
if (res.code === 200 && res.data) {
|
zoneGroup[zoneId].promotionFee = res.data.promotionFee || 0;
|
// 更新该专区第一个商品的 zonePromotionPreview
|
if (zoneGroup[zoneId].firstItem) {
|
that.$set(zoneGroup[zoneId].firstItem, 'zonePromotionPreview', res.data);
|
that.$forceUpdate();
|
}
|
}
|
} catch (e) {
|
console.log('获取促销预估失败', e);
|
}
|
}
|
}
|
// 保存到缓存
|
that.zoneGroupCache = zoneGroup;
|
// 计算总价并减去每个专区的促销减免金额
|
for (let zoneId in zoneGroup) {
|
selectCountPrice = that.$util.$h.Add(selectCountPrice, zoneGroup[zoneId].totalPrice);
|
selectCareBean = that.$util.$h.Add(selectCareBean, zoneGroup[zoneId].careBean);
|
// 减去促销减免金额
|
if (zoneGroup[zoneId].promotionFee > 0) {
|
selectCountPrice = that.$util.$h.Sub(selectCountPrice, zoneGroup[zoneId].promotionFee);
|
}
|
}
|
that.selectCountPrice = selectCountPrice;
|
that.selectCareBean = selectCareBean;
|
}
|
},
|
blurInput: function (e, index, index2) {
|
let that = this;
|
let item = that.cartList.valid[index][index2];
|
let num = (e && e.detail.value) ? e.detail.value : 1;
|
console.log(e);
|
item.cartNum = num;
|
if (item.cartNum <= 1) {
|
item.cartNum = 1;
|
item.numSub = true;
|
} else {
|
item.numSub = false;
|
}
|
if (item.cartNum >= item.stock) {
|
item.cartNum = item.stock;
|
item.numAdd = true;
|
} else if (item.zoneProductMaxBuyMember && item.zoneProductMaxBuyMember > 0 && item.cartNum >= item.zoneProductMaxBuyMember) {
|
item.cartNum = item.zoneProductMaxBuyMember;
|
item.numAdd = true;
|
} else {
|
item.numAdd = false;
|
}
|
that.setCartNum(item.id, item.cartNum, item.zoneId, function (data) {
|
that.cartList.valid[index][index2] = item;
|
that.switchSelect();
|
that.getCartNum();
|
});
|
},
|
subCart: function (index, index2) {
|
let that = this;
|
let status = false;
|
let item = that.cartList.valid[index][index2];
|
item.cartNum = that.toNumber(item.cartNum) - 1;
|
if (item.cartNum < 1) status = true;
|
if (item.cartNum <= 1) {
|
item.cartNum = 1;
|
item.numSub = true;
|
} else {
|
item.numSub = false;
|
}
|
if (item.cartNum >= item.stock) {
|
item.cartNum = item.stock;
|
item.numAdd = true;
|
} else if (item.zoneProductMaxBuyMember && item.zoneProductMaxBuyMember > 0 && item.cartNum >= item.zoneProductMaxBuyMember) {
|
item.cartNum = item.zoneProductMaxBuyMember;
|
item.numAdd = true;
|
} else {
|
item.numAdd = false;
|
}
|
if (false == status) {
|
that.setCartNum(item.id, item.cartNum, item.zoneId, function (data) {
|
that.cartList.valid[index][index2] = item;
|
that.switchSelect();
|
that.getCartNum();
|
});
|
}
|
},
|
addCart: function (index, index2) {
|
let that = this;
|
let item = that.cartList.valid[index][index2];
|
item.cartNum = that.toNumber(item.cartNum) + 1;
|
let productInfo = item;
|
if (item.cartNum <= 1) {
|
item.cartNum = 1;
|
item.numSub = true;
|
} else {
|
item.numSub = false;
|
}
|
if (item.cartNum >= item.stock) {
|
item.cartNum = item.stock;
|
item.numAdd = true;
|
} else if (item.zoneProductMaxBuyMember && item.zoneProductMaxBuyMember > 0 && item.cartNum >= item.zoneProductMaxBuyMember) {
|
item.cartNum = item.zoneProductMaxBuyMember;
|
item.numAdd = true;
|
} else {
|
item.numAdd = false;
|
}
|
that.setCartNum(item.id, item.cartNum, item.zoneId, function (data) {
|
that.cartList.valid[index][index2] = item;
|
that.switchSelect();
|
that.getCartNum();
|
});
|
},
|
setCartNum(cartId, cartNum, zoneId, successCallback) {
|
let that = this;
|
changeCartNum(cartId, cartNum, zoneId).then(res => {
|
successCallback && successCallback(res.data);
|
});
|
},
|
getCartNum: function () {
|
let that = this;
|
getCartCounts(true, 'sum').then(res => {
|
that.cartCount = res.data.count;
|
});
|
},
|
getCartData(data) {
|
let that = this;
|
return new Promise((resolve, reject) => {
|
getCartList(data).then((res) => {
|
that.hasReady = true;
|
resolve(res.data);
|
}).catch(function (err) {
|
uni.hideLoading()
|
that.loading = false;
|
that.canShow = true;
|
that.$util.Tips({
|
title: (err && err.message) ? err.message : err
|
});
|
})
|
});
|
},
|
async getCartList() {
|
uni.showLoading({ mask: true });
|
let that = this;
|
let data = {
|
page: that.page,
|
limit: that.limit,
|
isValid: true
|
}
|
getCartCounts(true, 'sum').then(async c => {
|
that.cartCount = c.data.count;
|
if (c.data.count === 0) that.getHostProduct();
|
let cartList = await this.getCartData(data);
|
if (that.page == 1) {
|
that.cartList.valid = [];
|
}
|
let valid = cartList.list;
|
let validList = that.$util.SplitArray(valid, that.cartList.valid);
|
let numSub = [{
|
numSub: true
|
}, {
|
numSub: false
|
}];
|
let numAdd = [{
|
numAdd: true
|
}, {
|
numAdd: false
|
}],
|
selectValue = [];
|
let totalNum = 0;
|
if (validList.length > 0) {
|
let cartCachSelect = that.$Cache.get('cartCachSelect') ? that.$Cache.get(
|
'cartCachSelect').split(',') : [];
|
validList.forEach((item) => {
|
for (var index in item) {
|
totalNum++;
|
if ((item[index].couponAfterPriceStatus > 0 && !(item[index]
|
.zoneId && item[index].zoneType == 1)) ||
|
(item[index].zoneId && !(item[index].zoneType == 1)) ||
|
(item[index].zoneId && item[index].zoneType == 1 && item[index]
|
.userLv == 3) ||
|
item[index].isVisual == 2) {
|
if (item[index].payWay == 3) { //纯悦养豆
|
if (item[index].zoneType == 1 && !(item[index].userLv ==
|
3)) {
|
|
} else if (item[index].userLv == 3) {
|
item[index].payCareBean = BigNumber(item[index]
|
.zhenXiangPrice).toFixed(0);
|
} else if (item[index].userLv == 0) {
|
item[index].payCareBean = BigNumber(item[index]
|
.puTongPrice).toFixed(0);
|
} else if (item[index].userLv == 1) {
|
item[index].payCareBean = BigNumber(item[index]
|
.changXiangPrice).toFixed(0);
|
} else if (item[index].userLv == 2) {
|
item[index].payCareBean = BigNumber(item[index]
|
.yueXiangPrice).toFixed(0);
|
} else {
|
|
}
|
} else {
|
if (item[index].zoneType == 1 && !(item[index].userLv ==
|
3)) {
|
item[index].payPrice = that.getSelectPrice(item[index]
|
.price, item[index].payCareBean);
|
} else if (item[index].userLv == 3) {
|
item[index].payPrice = that.getSelectPrice(item[index]
|
.zhenXiangPrice, item[index].payCareBean);
|
} else if (item[index].userLv == 0) {
|
item[index].payPrice = that.getSelectPrice(item[index]
|
.puTongPrice, item[index].payCareBean);
|
} else if (item[index].userLv == 1) {
|
item[index].payPrice = that.getSelectPrice(item[index]
|
.changXiangPrice, item[index].payCareBean);
|
} else if (item[index].userLv == 2) {
|
item[index].payPrice = that.getSelectPrice(item[index]
|
.yueXiangPrice, item[index].payCareBean);
|
} else {
|
item[index].payPrice = that.getSelectPrice(item[index]
|
.price, item[index].payCareBean);
|
}
|
}
|
|
}
|
if (item[index].cartNum == 1) {
|
item[index].numSub = true;
|
} else {
|
item[index].numSub = false;
|
}
|
let productInfo = item[index];
|
let stock = item[index].stock ? item[index].stock : 0;
|
if (item[index].cartNum == stock) {
|
item[index].numAdd = true;
|
} else if (item[index].cartNum >= item[index].stock) {
|
item[index].numAdd = true;
|
} else if (item[index].zoneProductMaxBuyMember && item[index].zoneProductMaxBuyMember > 0 && item[index]
|
.cartNum >= item[index].zoneProductMaxBuyMember) {
|
item[index].numAdd = true;
|
} else {
|
item[index].numAdd = false;
|
}
|
if (cartCachSelect.indexOf(item[index].id.toString()) >= 0) {
|
item[index].checked = true;
|
selectValue.push(item[index].id);
|
} else {
|
item[index].checked = false;
|
}
|
}
|
})
|
}
|
that.$set(that.cartList, 'valid', validList);
|
data.page += 1;
|
that.selectValue = selectValue;
|
that.$Cache.set('cartCachSelect', that.selectValue.join(','));
|
that.isAllSelect = totalNum == selectValue.length && totalNum;
|
that.switchSelect();
|
|
that.loading = false;
|
that.canShow = true;
|
uni.hideLoading();
|
});
|
},
|
getInvalidList: function () {
|
let that = this;
|
if (this.loadendInvalid) return false;
|
if (this.loadingInvalid) return false;
|
let data = {
|
page: that.pageInvalid,
|
limit: that.limitInvalid,
|
isValid: false
|
}
|
uni.showLoading()
|
getCartList(data).then(res => {
|
uni.hideLoading();
|
if (that.pageInvalid == 1) {
|
that.cartList.invalid = [];
|
}
|
let invalid = res.data.list,
|
loadendInvalid = invalid.length < that.limitInvalid;
|
let invalidList = that.$util.SplitArray(invalid, that.cartList.invalid);
|
that.$set(that.cartList, 'invalid', invalidList);
|
that.loadendInvalid = loadendInvalid;
|
that.loadTitleInvalid = loadendInvalid ? '我也是有底线的' : '加载更多';
|
that.pageInvalid = that.pageInvalid + 1;
|
that.loadingInvalid = false;
|
//if(invalid.length===0) that.getHostProduct();
|
}).catch(res => {
|
that.loadingInvalid = false;
|
that.loadTitleInvalid = '加载更多';
|
})
|
|
},
|
getHostProduct: function () {
|
let that = this;
|
if (that.hotScroll) return
|
getProductHot(
|
that.hotPage,
|
that.hotLimit,
|
).then(res => {
|
that.hasReady = true;
|
that.hotPage++
|
that.hotScroll = res.data.list.length < that.hotLimit
|
that.hostProduct = that.hostProduct.concat(res.data.list)
|
});
|
},
|
goodsOpen: function () {
|
let that = this;
|
that.goodsHidden = !that.goodsHidden;
|
},
|
manage: function () {
|
let that = this;
|
that.footerswitch = !that.footerswitch;
|
let arr1 = [];
|
let arr2 = [];
|
let totalLen = 0;
|
that.cartList.valid.map((child) => {
|
child.map(item => {
|
totalLen++;
|
if (that.footerswitch) {
|
if (item.attrStatus) {
|
if (item.checked) {
|
arr1.push(item.id);
|
}
|
} else {
|
item.checked = false;
|
arr2.push(item);
|
}
|
} else {
|
if (item.checked) {
|
arr1.push(item.id);
|
}
|
}
|
})
|
})
|
if (that.footerswitch) {
|
that.isAllSelect = totalLen === arr1.length + arr2.length;
|
} else {
|
that.isAllSelect = totalLen === arr1.length;
|
}
|
that.selectValue = arr1;
|
that.$Cache.set('cartCachSelect', that.selectValue.join(','))
|
that.switchSelect();
|
},
|
unsetCart: function () {
|
let that = this,
|
ids = [];
|
that.cartList.invalid.forEach((item, index) => {
|
item.forEach((subItem, index) => {
|
ids.push(subItem.id);
|
})
|
});
|
|
cartDel(ids).then(res => {
|
that.$util.Tips({
|
title: '清除成功'
|
});
|
that.$set(that.cartList, 'invalid', []);
|
that.getHostProduct();
|
}).catch(res => {
|
|
});
|
}
|
},
|
onReachBottom() {
|
let that = this;
|
if (that.loadend) {
|
that.getInvalidList();
|
}
|
if (that.cartList.valid.length == 0 && that.cartList.invalid.length == 0 && this.hotPage != 1) {
|
that.getHostProduct();
|
}
|
}
|
}
|
</script>
|
|
<style scoped lang="scss">
|
page {
|
background: #BF8A3E !important;
|
}
|
|
.page-addCart {
|
position: relative;
|
}
|
|
.pageBg {
|
width: 100%;
|
height: 900rpx;
|
position: absolute;
|
left: 0;
|
top: 0;
|
background: url("https://ossacmall.bluedeer.com.cn/app/static/images/page_commonBg.png") center top/100% auto no-repeat;
|
z-index: 0;
|
}
|
|
.header {
|
position: sticky;
|
top: 0;
|
z-index: 200000;
|
width: 100%;
|
text-align: center;
|
padding-top: 88rpx;
|
font-size: 30rpx;
|
line-height: 64rpx;
|
font-weight: bold;
|
}
|
.invalidClas {
|
position: relative;
|
z-index: 111;
|
top: -120rpx;
|
}
|
|
.invalidClasNO {
|
position: static;
|
margin-top: 15px;
|
}
|
|
.cartBox {
|
padding: 20rpx;
|
position: relative;
|
}
|
|
.shoppingCart {
|
padding-top: 30rpx;
|
}
|
|
.shoppingCart .nav_box {
|
width: 690rpx;
|
margin: 0 auto;
|
background-color: #ffffff;
|
position: sticky;
|
border-radius: 15rpx;
|
overflow: hidden;
|
}
|
|
.shoppingCart .labelNav {
|
font-size: 22rpx;
|
height: 57rpx;
|
line-height: 57rpx;
|
padding: 0 30rpx 0 30rpx;
|
color: #BF8A3E;
|
background-color: #FFFBE7;
|
}
|
|
.shoppingCart .labelNav .item .iconfont {
|
font-size: 25rpx;
|
margin-right: 10rpx;
|
}
|
|
.shoppingCart .nav {
|
width: 100%;
|
height: 90rpx;
|
padding: 0 21rpx;
|
-webkit-box-sizing: border-box;
|
box-sizing: border-box;
|
font-size: 28rpx;
|
line-height: 48rpx;
|
color: #979797;
|
}
|
|
.shoppingCart .nav .num {
|
margin-left: 12rpx;
|
color: #000000 !important;
|
}
|
|
.shoppingCart .nav .administrate {
|
font-size: 28rpx;
|
padding: 0 30rpx;
|
color: #000000;
|
background-color: #FFE20E;
|
border-radius: 6rpx;
|
}
|
|
.shoppingCart .noCart .pictrueBox {
|
width: 690rpx;
|
border-radius: 15rpx;
|
background-color: #fff;
|
margin: 20rpx auto 20rpx auto;
|
padding: 78rpx 0 56rpx 0;
|
}
|
|
.shoppingCart .noCart .pictrue {
|
width: 414rpx;
|
height: 336rpx;
|
margin: 0 auto;
|
}
|
|
.shoppingCart .noCart .pictrue image {
|
width: 414rpx;
|
height: 336rpx;
|
margin: 0 auto;
|
}
|
|
.shoppingCart .noCart .addIcon {
|
width: 56rpx;
|
height: 56rpx;
|
margin: 30rpx auto 0 auto;
|
|
image {
|
width: 56rpx;
|
height: 56rpx;
|
}
|
}
|
|
.shoppingCart .list {
|
width: 100%;
|
overflow: hidden;
|
border-radius: 15rpx;
|
background-color: #fff;
|
margin-bottom: 20rpx;
|
}
|
|
.shoppingCart .list_name {
|
line-height: 92rpx;
|
font-size: 30rpx;
|
padding: 0 30rpx;
|
background: url(https://ossacmall.bluedeer.com.cn/app/static/images/addCart_listTitle.jpg) center center/cover no-repeat;
|
position: relative;
|
|
.text2 {
|
font-size: 0.75em;
|
}
|
|
.text3 {
|
padding: 0 20rpx;
|
position: absolute;
|
right: 30rpx;
|
top: 15rpx;
|
color: #ffffff;
|
background-color: #016DCC;
|
border-radius: 6rpx;
|
font-size: 27rpx;
|
line-height: 60rpx;
|
}
|
}
|
|
.shoppingCart .promotion-tip {
|
margin-left: 32rpx;
|
font-size: 24rpx;
|
color: #FF6600;
|
font-weight: 500;
|
}
|
|
.shoppingCart .gift-list {
|
padding: 0 30rpx;
|
padding-left: 80rpx;
|
|
.gift-item {
|
padding: 24rpx 0;
|
border-bottom: 1rpx solid #f5f5f5;
|
|
&:last-child {
|
border-bottom: none;
|
}
|
|
.pictrue {
|
width: 160rpx;
|
height: 160rpx;
|
border-radius: 8rpx;
|
overflow: hidden;
|
position: relative;
|
|
image {
|
width: 100%;
|
height: 100%;
|
}
|
|
.gift-tag {
|
position: absolute;
|
top: 0;
|
left: 0;
|
padding: 4rpx 8rpx;
|
background: #FF6600;
|
color: #FFFFFF;
|
font-size: 20rpx;
|
border-radius: 8rpx 0 8rpx 0;
|
}
|
}
|
|
.text {
|
width: calc(100% - 200rpx);
|
|
.infor {
|
font-size: 26rpx;
|
color: #666666;
|
margin-top: 10rpx;
|
}
|
}
|
}
|
}
|
|
.shoppingCart .list .item {
|
padding: 24rpx;
|
}
|
|
.shoppingCart .list .item .picTxt {
|
width: 582rpx;
|
position: relative;
|
}
|
|
.shoppingCart .list .item .picTxt .pictrue {
|
width: 160rpx;
|
height: 160rpx;
|
}
|
|
.shoppingCart .list .item .picTxt .pictrue image {
|
width: 100%;
|
height: 100%;
|
border-radius: 6rpx;
|
}
|
|
.shoppingCart .list .item .picTxt .text {
|
width: 396rpx;
|
font-size: 28rpx;
|
color: #282828;
|
}
|
|
.shoppingCart .list .item .picTxt .text .reColor {
|
color: #999;
|
}
|
|
.shoppingCart .list .item .picTxt .text .reElection {
|
margin-top: 20rpx;
|
}
|
|
.shoppingCart .list .item .picTxt .text .reElection .title {
|
font-size: 24rpx;
|
}
|
|
.shoppingCart .list .item .picTxt .text .reElection .reBnt {
|
width: 120rpx;
|
height: 46rpx;
|
border-radius: 23rpx;
|
font-size: 26rpx;
|
}
|
|
.shoppingCart .list .item .picTxt .text .infor {
|
font-size: 24rpx;
|
color: #999999;
|
margin-top: 16rpx;
|
}
|
|
.shoppingCart .list .item .picTxt .text .money {
|
font-size: 27rpx;
|
color: #FF780D;
|
margin-top: 28rpx;
|
font-weight: 600;
|
width: 230rpx;
|
}
|
|
.shoppingCart .list .item .picTxt .carnum {
|
height: 47rpx;
|
position: absolute;
|
// bottom: 7rpx;
|
top: 117rpx;
|
right: 0;
|
}
|
|
.shoppingCart .list .item .picTxt .carnum view {
|
border: 1rpx solid #a4a4a4;
|
width: 66rpx;
|
text-align: center;
|
height: 100%;
|
line-height: 40rpx;
|
font-size: 28rpx;
|
color: #000;
|
}
|
|
.shoppingCart .list .item .picTxt .carnum .reduce {
|
border-right: 0;
|
border-radius: 3rpx 0 0 3rpx;
|
border-radius: 22rpx 0rpx 0rpx 22rpx;
|
border: none;
|
font-size: 34rpx;
|
line-height: 40rpx;
|
}
|
|
.shoppingCart .list .item .picTxt .carnum .reduce.on {
|
border-color: #e3e3e3;
|
color: #dedede;
|
}
|
|
.shoppingCart .list .item .picTxt .carnum .plus {
|
border-left: 0;
|
border-radius: 0 3rpx 3rpx 0;
|
border-radius: 0rpx 22rpx 22rpx 0rpx;
|
border: none;
|
font-size: 34rpx;
|
line-height: 40rpx;
|
}
|
|
.shoppingCart .list .item .picTxt .carnum .plus.on {
|
border-color: #e3e3e3;
|
color: #dedede;
|
}
|
|
.shoppingCart .list .item .picTxt .carnum .num {
|
color: #282828;
|
background-color: #F5F5F5;
|
border: none;
|
height: 40rpx;
|
|
.input {
|
min-height: unset !important;
|
height: 40rpx !important;
|
line-height: 40rpx !important;
|
}
|
}
|
|
.shoppingCart .goodsList_name {
|
line-height: 92rpx;
|
font-size: 30rpx;
|
padding: 0 30rpx;
|
background: url(https://ossacmall.bluedeer.com.cn/app/static/images/addCart_listTitle.jpg) center center/cover no-repeat;
|
|
.text2 {
|
font-size: 0.75em;
|
}
|
}
|
|
.shoppingCart .invalidGoods {
|
background-color: #fff;
|
margin-top: 30rpx;
|
/* #ifdef MP */
|
margin-top: 140rpx;
|
/* #endif */
|
|
}
|
|
.shoppingCart .invalidGoods .goodsNav {
|
width: 100%;
|
height: 90rpx;
|
padding: 0 24rpx;
|
box-sizing: border-box;
|
font-size: 28rpx;
|
color: #333333;
|
}
|
|
.shoppingCart .invalidGoods .goodsNav .iconfont {
|
color: #424242;
|
font-size: 28rpx;
|
margin-right: 17rpx;
|
}
|
|
.shoppingCart .invalidGoods .goodsNav .del {
|
font-size: 26rpx;
|
color: #333;
|
}
|
|
.shoppingCart .invalidGoods .goodsNav .del .icon-shanchu1 {
|
color: #333;
|
font-size: 33rpx;
|
vertical-align: -2rpx;
|
margin-right: 8rpx;
|
}
|
|
.shoppingCart .invalidGoods .goodsList .item {
|
padding: 24rpx;
|
}
|
|
.shoppingCart .invalidGoods .goodsList .picTxt {
|
width: 576rpx;
|
}
|
|
.shoppingCart .invalidGoods .goodsList .item .invalid {
|
font-size: 22rpx;
|
color: #CCCCCC;
|
height: 36rpx;
|
border-radius: 3rpx;
|
text-align: center;
|
line-height: 36rpx;
|
}
|
|
.shoppingCart .invalidGoods .goodsList .item .pictrue {
|
width: 160rpx;
|
height: 160rpx;
|
}
|
|
.shoppingCart .invalidGoods .goodsList .item .pictrue image {
|
width: 100%;
|
height: 100%;
|
border-radius: 6rpx;
|
}
|
|
.shoppingCart .invalidGoods .goodsList .item .text {
|
width: 396rpx;
|
font-size: 28rpx;
|
color: #999;
|
height: 140rpx;
|
}
|
|
.shoppingCart .invalidGoods .goodsList .item .text .name {
|
width: 100%;
|
}
|
|
.shoppingCart .invalidGoods .goodsList .item .text .infor {
|
font-size: 24rpx;
|
}
|
|
.shoppingCart .invalidGoods .goodsList .item .text .end {
|
font-size: 26rpx;
|
color: #bbb;
|
}
|
|
.footer {
|
z-index: 9;
|
width: 100%;
|
padding-bottom: 210rpx;
|
background-color: #fff;
|
position: fixed;
|
border-top: 1rpx solid #eee;
|
// border-bottom: 1px solid #EEEEEE;
|
/* #ifdef H5 */
|
bottom: 98rpx;
|
/* #endif */
|
/* #ifdef MP */
|
bottom: 0;
|
/* #endif */
|
/* #ifndef MP */
|
// bottom: 98rpx;
|
// bottom: calc(98rpx+ constant(safe-area-inset-bottom)); ///兼容 IOS<11.2/
|
// bottom: calc(98rpx + env(safe-area-inset-bottom)); ///兼容 IOS>11.2/
|
/* #endif */
|
}
|
|
.footer_box {
|
padding: 0 24rpx;
|
box-sizing: border-box;
|
height: 100rpx;
|
}
|
|
.footer .checkAll {
|
font-size: 23rpx;
|
color: #282828;
|
margin-left: 14rpx;
|
}
|
|
.footer .money {
|
width: 100%;
|
font-size: 27rpx;
|
position: relative;
|
box-sizing: border-box;
|
padding-right: 187rpx;
|
flex-wrap: unset;
|
|
.font-color {
|
font-weight: normal;
|
color: #FF780D !important;
|
|
.label {
|
color: #000000 !important;
|
padding-left: 10rpx;
|
padding-right: 10rpx;
|
}
|
}
|
}
|
|
.footer .placeOrder {
|
color: #fff;
|
font-size: 27rpx;
|
width: 191rpx;
|
height: 70rpx;
|
border-radius: 11rpx;
|
text-align: center;
|
line-height: 70rpx;
|
background-color: #016DCC !important;
|
position: absolute;
|
right: 0;
|
top: 0;
|
}
|
|
.footer .button {
|
position: absolute;
|
right: 30rpx;
|
}
|
|
.footer .button .bnt {
|
font-size: 27rpx;
|
color: #000;
|
border-radius: 11rpx;
|
width: 160rpx;
|
height: 60rpx;
|
text-align: center;
|
line-height: 60rpx;
|
background: #FFE20E;
|
|
&.del {
|
color: #fff;
|
background: #016DCC;
|
}
|
}
|
|
.footer .button form~form {
|
margin-left: 17rpx;
|
}
|
|
.uni-p-b-96 {
|
height: 96rpx;
|
}
|
</style>
|