You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
782 lines
26 KiB
782 lines
26 KiB
<template>
|
|
<view class="container" @touchmove.stop="touchmove">
|
|
<block v-if="isload">
|
|
<block v-if="cartlist.length>0">
|
|
<view class="cartmain">
|
|
<view class="regulate-title flex"><text @click="regulateDel" :style="{color: t('color1')}">{{isRegulate ? '退出管理': '管理'}}</text></view>
|
|
<block v-for="(item, index) in cartlist" :key="item.bid">
|
|
<view class="cartmain-item">
|
|
<!-- <view v-show="isSowso && swctbid != item.bid " class="swipe-action-item-smk b-s" style="background-color: rgba(255, 255, 255, 0);" @touchstart.stop="tstart($event)"></view> -->
|
|
<view class="cartmain-item__hd flex al-item-center">
|
|
<view class="cartmain-item__hd-label" @tap.stop="changeradio" :data-index="index">
|
|
<view class="label-radio" :style="item.checked ? 'background:'+'linear-gradient(to right bottom, #00AE68, #096742)'+';border:0' : ''"><image class="label-radio__checked" :src="event_rul +'/static/img/static/img/checkd.png'"/></view>
|
|
</view>
|
|
<image class="cartmain-item__hd-logo" :src="item.business.logo" mode=""></image>
|
|
<view v-if="item.bid == 0" class="cartmain-item__hd-name" >{{item.business.name}} </view>
|
|
<view v-else class="cartmain-item__hd-name flex al-item-center" @tap="goto" :data-url="'/pagesA/shop/index?id=' + item.business.id">{{item.business.name}} <text class="iconfont icon-arrow-right"></text></view>
|
|
</view>
|
|
<view class="cartmain-item__bd">
|
|
<uni-swipe-action>
|
|
<uni-swipe-action-item v-for="(item2,index2) in item.prolist" :key="index2" ref="closall" @change="swatinChange($event,item.bid, item2.id, index)">
|
|
<view class="swipe-action-item flex al-item-center">
|
|
<!-- <view class="swipe-action-item-smk b-s" v-if="item2.status == 0 || item2.guige.stock == 0"></view> -->
|
|
<view class="swipe-action-item__label" @tap.stop="changeradio2" :data-index="index" :data-index2="index2">
|
|
<view class="label-radio" :style="item2.checked ? 'background:'+'linear-gradient(to right bottom, #00AE68, #096742)'+';border:0' : ''"><image class="label-radio__checked" :src="event_rul +'/static/img/static/img/checkd.png'"/></view>
|
|
</view>
|
|
<view class="swipe-action-item__bd flex" :style="(item.prolist).length == index2+1 ? 'border:0' : ''">
|
|
<view class="swipe-action-item__img">
|
|
<image class="img-url" :src="item2.product.pic" @tap.stop="goto" :data-url="'/pages/shop/product?id=' + item2.product.id"/>
|
|
<view class="img-tips" v-if="item2.status == 0">已下架</view>
|
|
<view class="img-tips" v-else-if="item2.guige.stock == 0">无货</view>
|
|
</view>
|
|
<view class="swipe-action-item__info">
|
|
<view class="info-title" @tap="goto" :data-url="'/pages/shop/product?id=' + item2.product.id"><text>{{item2.product.name}}</text></view>
|
|
<view class="info-subtitle text-overflow-line"><text>{{item2.guige.name}}</text></view>
|
|
<view class="info-price"><text class="symbol">¥</text>{{item2.guige.sell_price}}</view>
|
|
|
|
<view class="swipe-action-item__btn flex al-item-center">
|
|
<image class="btn-sub" :src="event_rul +'/static/img/static/img/cart-minus.png'" @tap="gwcminus" :data-index="index" :data-index2="index2" :data-cartid="item2.id" :data-num="item2.num" :data-limit_start="item2.product.limit_start" :data-limit_start_guige="item2.guige.limit_start"></image>
|
|
<input class="input" type="number" :value="item2.num" @blur="gwcinput" :data-max="item2.guige.store_nums" :data-index="index" :data-index2="index2" :data-cartid="item2.id" :data-num="item2.num" :data-limit_start="item2.product.limit_start" :data-limit_start_guige="item2.guige.limit_start" />
|
|
<image class="btn-add" :src="event_rul +'/static/img/static/img/cart-plus.png'" @tap="gwcplus" :data-index="index" :data-index2="index2" :data-max="item2.guige.store_nums" :data-num="item2.num" :data-cartid="item2.id" :data-limit_start="item2.product.limit_start" :data-limit_start_guige="item2.guige.limit_start"></image>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
<template v-slot:right>
|
|
<view class="sideslip-box flex">
|
|
<view v-if="item2.status != 0" class="sideslip-collectible flex al-item-center j-center" @tap.stop="delCollectible(item2.id, item2.product.id, item2)">
|
|
<text class="iconfont icon-a-Fill11"></text>
|
|
<view class="sideslip-box__txt">移至收藏</view>
|
|
</view>
|
|
<view class="sideslip-del flex al-item-center j-center" @tap.stop="delShop(item2.id)">
|
|
<text class="iconfont icon-a-Fill1"></text>
|
|
<view class="sideslip-box__txt">删除</view>
|
|
</view>
|
|
</view>
|
|
</template>
|
|
</uni-swipe-action-item>
|
|
</uni-swipe-action>
|
|
</view>
|
|
</view>
|
|
</block>
|
|
</view>
|
|
</block>
|
|
<block v-else>
|
|
<view class="data-empty flex al-item-center">
|
|
<image class="data-empty-img" :src="event_rul+'/static/images/empty-cart.svg'"></image>
|
|
<view class="data-empty-txt">购物车空空如也~</view>
|
|
<view class="data-empty-tips" style="margin-top:20rpx;font-size:24rpx">赶紧慰劳一下自己吧</view>
|
|
<view class="data-empty-btn" @tap="goto" :data-url="indexurl" data-opentype="reLaunch">去逛逛</view>
|
|
</view>
|
|
</block>
|
|
</block>
|
|
<view v-if="tjdatalist.length > 0">
|
|
<view class="xihuan">
|
|
<view class="xihuan-text" style="flex: 1;">
|
|
<image :src="event_rul +'/static/images/title-decorate.svg'" class="img-n" mode="widthFix" />
|
|
<text class="txt" style="padding: 0 30rpx;">为您推荐</text>
|
|
<image :src="event_rul +'/static/images/title-decorate.svg'" class="img-n" mode="widthFix" />
|
|
</view>
|
|
</view>
|
|
<view class="prolist">
|
|
<dp-product-item types='cart' :data="tjdatalist" @addcart="addcart" @touchmove="touchmove" :menuindex="menuindex"></dp-product-item>
|
|
</view>
|
|
</view>
|
|
|
|
<loading v-if="loading"></loading>
|
|
<block v-if="cartlist.length>0">
|
|
<view v-if="isRegulate">
|
|
<view class="footer flex" :class="menuindex>-1?'tabbarbot':'notabbarbot'">
|
|
<view class="check-all" @tap.stop="changeradioAll">
|
|
<view class="radio" :style="allchecked ? 'background:'+'linear-gradient(to right bottom, #00AE68, #096742)'+';border:0' : ''"><image class="radio-img" :src="event_rul +'/static/img/static/img/checkd.png'"/></view>
|
|
<view class="text0">全选({{selectedcount}})</view>
|
|
</view>
|
|
<view class="flex1"></view>
|
|
<view class="op" :style="{background:'linear-gradient(to right, #00AE68, #096742)'}" @tap="showDel">删除</view>
|
|
</view>
|
|
</view>
|
|
<block v-else>
|
|
<view class="footer flex" :class="menuindex>-1?'tabbarbot':'notabbarbot'">
|
|
<view class="check-all" @tap.stop="changeradioAll">
|
|
<view class="radio" :style="allchecked ? 'background:'+'linear-gradient(to right bottom, #00AE68, #096742)'+';border:0' : ''"><image class="radio-img" :src="event_rul +'/static/img/static/img/checkd.png'"/></view>
|
|
<view class="text0">全选({{selectedcount}})</view>
|
|
</view>
|
|
<view class="flex1"></view>
|
|
<view class="text1">合计:</view>
|
|
<view class="text2"><text style="font-size:24rpx">¥</text>{{totalprice}}</view>
|
|
<view class="op" :style="{background:'linear-gradient(to right, #00AE68, #096742)'}" @tap="toOrder">去结算</view>
|
|
</view>
|
|
</block>
|
|
<!-- 删除弹框 -->
|
|
<view v-if="isAllDel" class="del-dialog" @touchmove.stop.prevent="moveHandle">
|
|
<view class="del-dialog__con">
|
|
<view class="del-dialog__title">确定将这{{actionLet.length > 0 ? '' : selectedcount}}个商品删除吗?</view>
|
|
<view class="del-dialog__btns flex al-item-center j-between">
|
|
<button class="del-dialog__btn confirm-btn" type="primflex-direction: column;ary" @click="allDel">删除</button>
|
|
<button class="del-dialog__btn cancel-btn" type="primary" @click="cenlDel">我再想想</button>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</block>
|
|
<!-- 悬浮按钮 -->
|
|
<drag-button></drag-button>
|
|
<dp-tabbar :opt="opt" @getmenuindex="getmenuindex"></dp-tabbar>
|
|
<popmsg ref="popmsg"></popmsg>
|
|
</view>
|
|
</template>
|
|
|
|
<script>
|
|
var app = getApp();
|
|
export default {
|
|
data() {
|
|
return {
|
|
opt:{},
|
|
loading:false,
|
|
isload: false,
|
|
menuindex:-1,
|
|
|
|
indexurl:app.globalData.indexurl,
|
|
cartlist:[],
|
|
tjdatalist:[],
|
|
totalprice: '0.00',
|
|
selectedcount: 0,
|
|
allchecked:true,
|
|
|
|
isRegulate: false,
|
|
isAllDel: false, // 删除提示
|
|
|
|
actionLet: [], // 左滑删除的数组
|
|
|
|
event_rul: app.globalData.event_url,
|
|
|
|
isSowso:false,
|
|
swctbid: -1,
|
|
swctid: -1,
|
|
};
|
|
},
|
|
|
|
onLoad: function (opt) {
|
|
this.opt = app.getopts(opt);
|
|
},
|
|
onShow:function(){
|
|
this.getdata();
|
|
this.loading = false
|
|
this.$forceUpdate()
|
|
},
|
|
onPullDownRefresh: function () {
|
|
this.getdata();
|
|
},
|
|
methods: {
|
|
touchmove() {
|
|
this.$refs.closall.forEach(item => {
|
|
item.is_show = 'none'
|
|
})
|
|
},
|
|
// 滑动选中项
|
|
swatinChange(e, bid, id, idx) {
|
|
this.swctbid = bid
|
|
this.swctid = id
|
|
if(e == 'right') {
|
|
this.isSowso = true
|
|
}else {
|
|
this.isSowso = false
|
|
}
|
|
},
|
|
// 点击管理显示多删除
|
|
regulateDel() {
|
|
this.isRegulate = !this.isRegulate
|
|
},
|
|
//收藏操作
|
|
delCollectible(proid, productId, data) {
|
|
if(data.status == 0) {
|
|
app.error('该商品已下架,无法收藏')
|
|
return
|
|
}
|
|
var that = this;
|
|
let ids = []
|
|
ids.push(proid)
|
|
app.confirm('确定要移至收藏吗?', () => {
|
|
if(data.isfavorite) {
|
|
app.post('ApiShop/cartdelete', {ids: ids}, (data) => {
|
|
that.getdata()
|
|
app.success('已收藏');
|
|
this.isSowso = false
|
|
})
|
|
}else {
|
|
app.post('ApiShop/addfavorite', {
|
|
proid: productId,
|
|
type: 'shop'
|
|
}, data => {
|
|
if (data.status == 1) {
|
|
app.post('ApiShop/cartdelete', {ids: ids}, (data) => {
|
|
that.getdata()
|
|
})
|
|
}
|
|
this.isSowso = false
|
|
app.success(data.msg);
|
|
});
|
|
}
|
|
|
|
}, () => {this.isSowso = false})
|
|
},
|
|
// 滑动删除
|
|
delShop(bid) {
|
|
let ids = []
|
|
ids.push(bid)
|
|
this.actionLet = ids
|
|
this.isAllDel = true
|
|
// var that = this;
|
|
// app.confirm('确定要从购物车移除吗?', () => {
|
|
// app.post('ApiShop/cartdelete', {ids: ids}, (data) => {
|
|
// app.success('操作成功');
|
|
// this.isSowso = false
|
|
// setTimeout(() => {
|
|
// that.getdata();
|
|
// }, 1000);
|
|
// });
|
|
// },() => {this.isSowso = false})
|
|
},
|
|
// 阻止滑动穿透
|
|
moveHandle(){
|
|
return true
|
|
},
|
|
// 点击显示删除弹框
|
|
showDel() {
|
|
if(this.selectedcount == 0) {
|
|
app.confirm('请选择要删除的商品', () => {
|
|
|
|
})
|
|
return
|
|
}
|
|
this.isAllDel = true
|
|
},
|
|
// 多选删除
|
|
allDel() {
|
|
let ids = []
|
|
var that = this;
|
|
if (this.actionLet.length > 0) {
|
|
ids = this.actionLet
|
|
}else {
|
|
for(var i in that.cartlist){
|
|
for(var j in that.cartlist[i].prolist){
|
|
if(that.cartlist[i].prolist[j].checked){
|
|
ids.push(that.cartlist[i].prolist[j].id);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
app.post('ApiShop/cartdelete', {ids: ids}, (data) => {
|
|
this.isAllDel = false
|
|
setTimeout(() => {
|
|
app.success('操作成功');
|
|
that.getdata();
|
|
this.actionLet = []
|
|
}, 500);
|
|
});
|
|
|
|
},
|
|
// 取消删除
|
|
cenlDel() {
|
|
this.isAllDel = false
|
|
this.actionLet = []
|
|
},
|
|
getdata: function (){
|
|
|
|
let carSelectList = uni.getStorageSync('cart_select_list')
|
|
var that = this;
|
|
var bid = that.opt.bid ? that.opt.bid : '';
|
|
if(bid){
|
|
that.indexurl = 'pages/business/index?id='+bid;
|
|
}
|
|
that.loading = true;
|
|
app.get('ApiShop/cart', {bid:bid}, function (res) {
|
|
that.loading = false;
|
|
that.cartlist = res.cartlist;
|
|
|
|
that.tjdatalist = res.tjdatalist;
|
|
if(carSelectList.length > 0) {
|
|
for(let i = 0; i < carSelectList.length;i++){
|
|
for(let j = 0;j< carSelectList[i].prolist.length;j++){
|
|
that.cartlist.forEach((data, ndx) => {
|
|
data.checked = true;
|
|
data.prolist.forEach((datm, ndx) => {
|
|
if ( datm.id == carSelectList[i].prolist[j].id) {
|
|
datm.checked = carSelectList[i].prolist[j].checked
|
|
}
|
|
if(!datm.checked){
|
|
data.checked = false;
|
|
}
|
|
})
|
|
})
|
|
|
|
}
|
|
}
|
|
}
|
|
let alSleArr = []
|
|
that.cartlist.forEach((item, idx) => {
|
|
if(item.checked) {
|
|
alSleArr.push(item.checked)
|
|
}
|
|
})
|
|
if(alSleArr.length == that.cartlist.length) {
|
|
that.allchecked = true
|
|
}else {
|
|
that.allchecked = false
|
|
}
|
|
uni.setStorageSync('cart_select_list', that.cartlist);
|
|
that.calculate();
|
|
that.loaded();
|
|
that.$forceUpdate();
|
|
});
|
|
},
|
|
calculate: function () {
|
|
var that = this;
|
|
var cartlist = that.cartlist;
|
|
var ids = [];
|
|
var totalprice = 0.00;
|
|
var selectedcount = 0;
|
|
for(var i in cartlist){
|
|
for(var j in cartlist[i].prolist){
|
|
if(cartlist[i].prolist[j].checked){
|
|
ids.push(cartlist[i].prolist[j].id);
|
|
var thispro = cartlist[i].prolist[j];
|
|
totalprice += thispro.guige.sell_price * thispro.num;
|
|
selectedcount += thispro.num;
|
|
}
|
|
}
|
|
}
|
|
that.totalprice = totalprice.toFixed(2);
|
|
that.selectedcount = selectedcount;
|
|
},
|
|
changeradio: function (e) {
|
|
var that = this;
|
|
var index = e.currentTarget.dataset.index;
|
|
var cartlist = that.cartlist;
|
|
var checked = cartlist[index].checked;
|
|
if(checked){
|
|
cartlist[index].checked = false;
|
|
}else{
|
|
cartlist[index].checked = true;
|
|
}
|
|
for(var i in cartlist[index].prolist){
|
|
cartlist[index].prolist[i].checked = cartlist[index].checked;
|
|
}
|
|
that.cartlist = cartlist;
|
|
let alSleArr = []
|
|
that.cartlist.forEach(item => {
|
|
if(item.checked) {
|
|
alSleArr.push(item.checked)
|
|
}
|
|
})
|
|
if(alSleArr.length == that.cartlist.length) {
|
|
this.allchecked = true
|
|
}else {
|
|
this.allchecked = false
|
|
}
|
|
uni.setStorageSync('cart_select_list', that.cartlist);
|
|
that.calculate();
|
|
},
|
|
|
|
changeradio2: function (e) {
|
|
var that = this;
|
|
var index = e.currentTarget.dataset.index;
|
|
var index2 = e.currentTarget.dataset.index2;
|
|
var cartlist = that.cartlist;
|
|
var checked = cartlist[index].prolist[index2].checked;
|
|
if(checked){
|
|
cartlist[index].prolist[index2].checked = false;
|
|
}else{
|
|
cartlist[index].prolist[index2].checked = true;
|
|
}
|
|
var isallchecked = true;
|
|
for(var i in cartlist[index].prolist){
|
|
if(cartlist[index].prolist[i].checked == false){
|
|
isallchecked = false;
|
|
}
|
|
}
|
|
if(isallchecked){
|
|
cartlist[index].checked = true;
|
|
}else{
|
|
cartlist[index].checked = false;
|
|
}
|
|
that.cartlist = cartlist;
|
|
let alSleArr = []
|
|
that.cartlist.forEach(item => {
|
|
if(item.checked) {
|
|
alSleArr.push(item.checked)
|
|
}
|
|
})
|
|
if(alSleArr.length == that.cartlist.length) {
|
|
this.allchecked = true
|
|
}else {
|
|
this.allchecked = false
|
|
}
|
|
uni.setStorageSync('cart_select_list', that.cartlist);
|
|
that.calculate();
|
|
},
|
|
changeradioAll:function(){
|
|
var that = this;
|
|
var cartlist = that.cartlist;
|
|
var allchecked = that.allchecked
|
|
for(var i in cartlist){
|
|
cartlist[i].checked = allchecked ? false : true;
|
|
for(var j in cartlist[i].prolist){
|
|
cartlist[i].prolist[j].checked = allchecked ? false : true;
|
|
}
|
|
}
|
|
that.cartlist = cartlist;
|
|
that.allchecked = allchecked ? false : true;
|
|
uni.setStorageSync('cart_select_list', that.cartlist);
|
|
that.calculate();
|
|
},
|
|
cartdelete: function (e) {
|
|
var that = this;
|
|
var id = e.currentTarget.dataset.cartid;
|
|
app.confirm('确定要从购物车移除吗?', function () {
|
|
app.post('ApiShop/cartdelete', {id: id}, function (data) {
|
|
app.success('操作成功');
|
|
setTimeout(function () {
|
|
that.getdata();
|
|
}, 1000);
|
|
});
|
|
});
|
|
},
|
|
cartdeleteb:function(e){
|
|
var that = this;
|
|
var bid = e.currentTarget.dataset.bid;
|
|
app.confirm('确定要从购物车移除吗?', function () {
|
|
app.post('ApiShop/cartdelete', {bid: bid}, function (data) {
|
|
app.success('操作成功');
|
|
setTimeout(function () {
|
|
that.getdata();
|
|
}, 1000);
|
|
});
|
|
});
|
|
},
|
|
toOrder: function () {
|
|
var that = this;
|
|
var cartlist = that.cartlist;
|
|
var ids = [];
|
|
var prodata = [];
|
|
for(var i in cartlist){
|
|
for(var j in cartlist[i].prolist){
|
|
if(cartlist[i].prolist[j].checked){
|
|
var thispro = cartlist[i].prolist[j];
|
|
prodata.push(thispro.product.id + ',' + thispro.guige.id + ',' + thispro.num);
|
|
}
|
|
}
|
|
}
|
|
if (prodata == undefined || prodata.length == 0) {
|
|
app.error('请先选择产品');
|
|
return;
|
|
}
|
|
app.goto('/pagesA/shop/buy?prodata=' + prodata.join('-'));
|
|
},
|
|
//加
|
|
gwcplus: function (e) {
|
|
var index = parseInt(e.currentTarget.dataset.index);
|
|
var index2 = parseInt(e.currentTarget.dataset.index2);
|
|
var maxnum = parseInt(e.currentTarget.dataset.max);
|
|
var cartid = e.currentTarget.dataset.cartid;
|
|
var num = parseInt(e.currentTarget.dataset.num);
|
|
if (num >= maxnum) {
|
|
app.error('库存不足');
|
|
return;
|
|
}
|
|
var cartlist = this.cartlist;
|
|
cartlist[index].prolist[index2].num++;
|
|
this.cartlist = cartlist
|
|
this.calculate();
|
|
var that = this;
|
|
app.post('ApiShop/cartChangenum', {id: cartid,num: num + 1}, function (data){
|
|
if (data.status == 1) {
|
|
//that.getdata();
|
|
} else {
|
|
app.error(data.msg);
|
|
cartlist[index].prolist[index2].num--;
|
|
}
|
|
});
|
|
},
|
|
//减
|
|
gwcminus: function (e) {
|
|
var index = parseInt(e.currentTarget.dataset.index);
|
|
var index2 = parseInt(e.currentTarget.dataset.index2);
|
|
var maxnum = parseInt(e.currentTarget.dataset.max);
|
|
var cartid = e.currentTarget.dataset.cartid;
|
|
var num = parseInt(e.currentTarget.dataset.num);
|
|
var limit_start = parseInt(e.currentTarget.dataset.limit_start);
|
|
var limit_start_guige = parseInt(e.currentTarget.dataset.limit_start_guige);
|
|
if(limit_start_guige > 0 && num <= limit_start_guige){
|
|
app.error('该商品规格'+limit_start_guige+'件起售');
|
|
return;
|
|
}
|
|
if(limit_start > 0 && num <= limit_start){
|
|
app.error('该商品'+limit_start+'件起售');
|
|
return;
|
|
}
|
|
if (num == 1) return;
|
|
var cartlist = this.cartlist;
|
|
cartlist[index].prolist[index2].num--;
|
|
this.cartlist = cartlist
|
|
this.calculate();
|
|
var that = this;
|
|
app.post('ApiShop/cartChangenum', {id: cartid,num: num - 1}, function (data) {
|
|
if (data.status == 1) {
|
|
//that.getdata();
|
|
} else {
|
|
app.error(data.msg);
|
|
cartlist[index].prolist[index2].num++;
|
|
}
|
|
});
|
|
},
|
|
//输入
|
|
gwcinput: function (e) {
|
|
var index = parseInt(e.currentTarget.dataset.index);
|
|
var index2 = parseInt(e.currentTarget.dataset.index2);
|
|
var maxnum = parseInt(e.currentTarget.dataset.max);
|
|
var cartid = e.currentTarget.dataset.cartid;
|
|
var num = e.currentTarget.dataset.num;
|
|
var newnum = parseInt(e.detail.value);
|
|
if (num == newnum) return;
|
|
var limit_start = parseInt(e.currentTarget.dataset.limit_start);
|
|
var limit_start_guige = parseInt(e.currentTarget.dataset.limit_start_guige);
|
|
if(limit_start_guige > 0 && newnum < limit_start_guige){
|
|
app.error('该商品规格'+limit_start_guige+'件起售');
|
|
return;
|
|
}
|
|
if(limit_start > 0 && newnum < limit_start){
|
|
app.error('该商品'+limit_start+'件起售');
|
|
return;
|
|
}
|
|
if (newnum < 1) {
|
|
app.error('最小数量为1');
|
|
return;
|
|
}
|
|
|
|
if (newnum > maxnum) {
|
|
app.error('库存不足');
|
|
return;
|
|
}
|
|
var cartlist = this.cartlist;
|
|
cartlist[index].prolist[index2].num = newnum;
|
|
this.cartlist = cartlist
|
|
this.calculate();
|
|
|
|
var that = this;
|
|
app.post('ApiShop/cartChangenum', {id: cartid,num: newnum}, function (data) {
|
|
if (data.status == 1) {
|
|
//that.getdata();
|
|
} else {
|
|
app.error(data.msg);
|
|
}
|
|
});
|
|
},
|
|
addcart:function(){
|
|
setTimeout(() => {
|
|
this.getdata();
|
|
}, 500);
|
|
}
|
|
}
|
|
};
|
|
</script>
|
|
<style lang="scss">
|
|
.container{
|
|
height: 100vh;
|
|
background: #F5F5F5;
|
|
padding-bottom: 110rpx;
|
|
box-sizing: border-box;
|
|
overflow-y: auto;
|
|
& ::-webkit-scrollbar {
|
|
display: none;
|
|
}
|
|
}
|
|
|
|
.cartmain {
|
|
padding: 86rpx 24rpx 0;
|
|
&-item {
|
|
background: #fff;border-radius: 12rpx;padding: 32rpx 24rpx;
|
|
&:not(:last-child) {margin-bottom: 24rpx;}
|
|
&__hd {
|
|
&-label {
|
|
flex-shrink: 0;
|
|
.label-radio{
|
|
width: 40rpx;height: 40rpx;border: 1rpx solid #CCCCCC;border-radius: 50%;overflow: hidden;
|
|
&__checked {width: 100%;height: 100%;}
|
|
}
|
|
}
|
|
&-logo { width: 36rpx;height: 36rpx;margin-left: 24rpx; }
|
|
&-name {
|
|
flex: 1;font-size: 28rpx;font-weight: bold;color: #333333;line-height: 40rpx;margin-left: 16rpx;
|
|
.icon-arrow-right {color: #CCCCCC;font-size: 32rpx;}
|
|
}
|
|
}
|
|
&__bd {
|
|
.swipe-action-item {
|
|
margin-top: 40rpx;
|
|
&__label {
|
|
flex-shrink: 0;
|
|
.label-radio{
|
|
width: 40rpx;height: 40rpx;border: 1rpx solid #CCCCCC;border-radius: 50%;overflow: hidden;
|
|
&__checked {width: 100%;height: 100%;}
|
|
}
|
|
}
|
|
&__bd {
|
|
flex: 1;
|
|
margin-left: 24rpx;
|
|
}
|
|
&__img {position: relative;}
|
|
.img-url {width: 168rpx;height: 168rpx;border-radius: 12rpx;}
|
|
.img-tips {
|
|
position: absolute;
|
|
top: 50%;
|
|
left: 0;
|
|
right: 0;
|
|
transform: translateY(-50%);
|
|
background: rgba($color: #000000, $alpha: 0.4);
|
|
border-radius: 18rpx;
|
|
font-size: 24rpx;
|
|
color: #FFFFFF;
|
|
line-height: 36rpx;
|
|
text-align: center;
|
|
}
|
|
&__info {margin-left: 24rpx;font-weight: bold;}
|
|
.info-title {font-size: 26rpx;color: #333333;line-height: 36rpx;height: 72rpx;overflow: hidden;text-overflow: ellipsis;display: -webkit-box;-webkit-line-clamp: 2;}
|
|
.info-subtitle {margin-top: 6rpx;font-size: 22rpx;color: #CCCCCC;line-height: 36rpx;}
|
|
.info-price {margin-top: 6rpx;font-size: 36rpx;color: #ED5925;line-height: 60rpx;height: 60rpx;}
|
|
.symbol {font-size: 24rpx;}
|
|
&__btn {position: absolute;right: 0;bottom: 0;border: 1rpx solid #CCCCCC;border-radius: 12rpx;height: 56rpx;}
|
|
.input {width: 80rpx;text-align: center;font-size: 28rpx;color: #333333;border: 1rpx solid #CCCCCC;border-top: none;border-bottom: none;height: 100%;line-height: 54rpx;}
|
|
.btn-sub,.btn-add {width: 18rpx;height: 18rpx;margin: 18rpx;}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
.footer {width: 100%;background: #fff;position: fixed;left: 0px;z-index:8;display:flex;align-items:center;padding:24rpx 20rpx;border-top:1px solid #EFEFEF}
|
|
.footer .radio{flex-shrink:0;width: 40rpx;height: 40rpx;background: #FFFFFF;border: 1rpx solid #BFBFBF;border-radius: 50%;margin-right:8rpx}
|
|
.footer .radio .radio-img{width:100%;height:100%}
|
|
.footer .text0{color:#999999;font-size:24rpx;line-height: 34rpx;}
|
|
.footer .text1 {line-height: 34rpx;color:#333333;font-size:24rpx;}
|
|
.footer .text2 {color: #ED5925;font-size: 40rpx;font-weight:bold}
|
|
.footer .op{width: 198rpx;height: 80rpx;line-height:80rpx;border-radius: 40rpx;font-weight:bold;color:#FFF;font-size:28rpx;text-align:center;margin-left: 24rpx}
|
|
|
|
.xihuan{display:flex;align-items:center;padding: 28rpx 0 24rpx;}
|
|
.xihuan-line{height: auto; padding: 0; overflow: hidden;flex:1;height:0;border-top:1px solid #eee}
|
|
.xihuan-text{padding:0 32rpx;text-align:center;display:flex;align-items:center;justify-content:center}
|
|
.xihuan-text .txt{color:#0A5D3B;font-size:30rpx}
|
|
.xihuan-text .img{text-align:center;width:36rpx;height:36rpx;margin-right:12rpx}
|
|
|
|
.prolist{width: 100%;height:auto;padding: 8rpx 20rpx;}
|
|
|
|
.data-empty {
|
|
background: #FFF;padding: 72rpx 20rpx 32rpx;flex-direction: column;font-weight: 500;font-size: 28rpx;
|
|
&-img { width: 346rpx; height: 278rpx; }
|
|
&-txt { font-size: 26rpx;color: #999999;line-height: 36rpx; }
|
|
&-tips { margin-top: 6rpx;color: #0A5D3B;line-height: 40rpx; }
|
|
&-btn { background: linear-gradient(to right,#00AE68 0%,#096742 100%);margin-top: 44rpx;width: 158rpx;height: 62rpx;border-radius: 62rpx;text-align: center;color: #FFF;line-height: 62rpx; }
|
|
}
|
|
|
|
.data-empty-text{ display: block; text-align: center; color: #999999; font-size:32rpx; width: 100%; margin-top: 30rpx; }
|
|
|
|
.xihuan .img-n {width: 36rpx;}
|
|
|
|
/* 全选 */
|
|
.check-all {display: flex;align-items:center ;}
|
|
|
|
|
|
/* 管理 */
|
|
.regulate-title {
|
|
position: fixed;
|
|
background: #F5F5F5;
|
|
top: 0;
|
|
left: 0;
|
|
right: 0;
|
|
padding: 24rpx;
|
|
z-index: 3;
|
|
justify-content: flex-end;
|
|
}
|
|
/* 侧滑删除 */
|
|
.sideslip-box {
|
|
margin-left: 24rpx;
|
|
margin-top: 40rpx;
|
|
&__txt {
|
|
font-size: 28rpx;
|
|
font-weight: bold;
|
|
color: #FFFFFF;
|
|
line-height: 40rpx;
|
|
margin-top: 8rpx;
|
|
}
|
|
.iconfont {
|
|
color: #FFF;
|
|
font-size: 36rpx;
|
|
}
|
|
}
|
|
.sideslip-del {
|
|
width: 148rpx;
|
|
flex-direction: column;
|
|
background-color: #fa4a4a;
|
|
.iconfont {
|
|
font-size: 36rpx;
|
|
}
|
|
}
|
|
/* 侧滑删除收藏 */
|
|
.sideslip-collectible {
|
|
width: 148rpx;
|
|
flex-direction: column;
|
|
background-color: #ffa32e;
|
|
}
|
|
|
|
// .not-s {
|
|
// position: relative;
|
|
// display: flex;
|
|
// }
|
|
// .swipe-action-item-smk {
|
|
// width: 100%;
|
|
// height: 100%;
|
|
// text-align: center;
|
|
// line-height: 176rpx;
|
|
// font-size: 50rpx;
|
|
// border-radius: 50%;
|
|
// position: absolute;
|
|
// top: 0%;
|
|
// left: 0;
|
|
// background-color: rgba(0, 0, 0, .3);
|
|
// color: #fff;
|
|
// z-index: 7;
|
|
// }
|
|
// .b-s {
|
|
// border-radius: 0;
|
|
// background-color: rgba(255, 255, 255, .3);
|
|
// }
|
|
|
|
/* 删除弹框 */
|
|
.del-dialog {
|
|
width: 100%;height: 100%;position: fixed;top: 0;left: 0;background-color: rgba(0,0,0, .5);z-index: 9999999;
|
|
&__con {
|
|
width: 598rpx;
|
|
position: fixed;
|
|
top: 40%;
|
|
left: 50%;
|
|
transform: translateX(-50%) translateY(-50%);
|
|
background: #FFFFFF;
|
|
border-radius: 12rpx;
|
|
padding: 70rpx 50rpx 44rpx;
|
|
}
|
|
&__title {
|
|
text-align: center;font-size: 28rpx;font-weight: bold;color: #333333;line-height: 20px;
|
|
}
|
|
&__btns { margin-top: 60rpx; }
|
|
&__btn {
|
|
font-size: 28rpx; line-height: 80rpx;border-radius: 40rpx;width: 236rpx;
|
|
&.confirm-btn {
|
|
border: 1rpx solid #E8E8E8;color: #666666;
|
|
}
|
|
&.cancel-btn {
|
|
background: linear-gradient(to right,#00AE68 0%,#096742 100%);
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|