购物车优化-0804

master
Lee-1203 2022-08-04 16:32:06 +08:00
parent 5f4d7916f8
commit 42d73e4cfa
23 changed files with 27 additions and 33 deletions

View File

@ -4,7 +4,7 @@
projectname:'', // projectname:'', //
lat:'', // lat:'', //
lng:'' ,// lng:'' ,//
hostapi:'https://lbfurn.cn' // hostapi:'https://lbfurn.cn' ,//
}, },
// show // show
onLaunch: function() { onLaunch: function() {

View File

@ -34,7 +34,7 @@ const refreshTokenPage = () => {
uni.setStorageSync('expire',result.data.data.expire);//缓存失效时间(时间戳格式) uni.setStorageSync('expire',result.data.data.expire);//缓存失效时间(时间戳格式)
uni.setStorageSync('phone_active',result.data.data.phone_active);//是否授权手机号 uni.setStorageSync('phone_active',result.data.data.phone_active);//是否授权手机号
uni.setStorageSync('is_active',result.data.data.is_active);//是否授权头像和昵称 uni.setStorageSync('is_active',result.data.data.is_active);//是否授权头像和昵称
uni.setStorageSync('invite_code',result.data.data.invite_code);//缓存邀请码 uni.setStorageSync('business_code',result.data.data.business_code);//缓存邀请码
uni.reLaunch({ // 重新进入当前页面 uni.reLaunch({ // 重新进入当前页面
url:localRoute url:localRoute
}) })

View File

@ -46,7 +46,7 @@
</view> </view>
<!-- 暂无更多内容 --> <!-- 暂无更多内容 -->
<view class="more-txt" v-if="listData.length!==0 && noMore"> </view> <view class="more-txt" v-if="listData.length!==0 && noMore"> </view>
<nothing-page v-if="listData.length==0" content="您的购物车,空空如也(*^▽^*)"></nothing-page> <nothing-page v-if="isLoading && listData.length==0" content="您的购物车,空空如也(*^▽^*)"></nothing-page>
</view> </view>
</view> </view>
</template> </template>
@ -75,6 +75,7 @@
noMore:false, // noMore:false, //
isLoading:true, isLoading:true,
flag:true, flag:true,
showDel:false,
} }
}, },
onShow() { onShow() {
@ -272,12 +273,8 @@
confirmDel(){ confirmDel(){
this.$requst.post('/api/order/shopping-cart-del',{id:this.delIds.toString()}).then(res=>{ this.$requst.post('/api/order/shopping-cart-del',{id:this.delIds.toString()}).then(res=>{
if(res.code==0){ if(res.code==0){
this.listData = this.listData.filter(item=>item.ifcheck==false)
this.$toolAll.tools.showToast('删除成功'); this.$toolAll.tools.showToast('删除成功');
this.listData.forEach((item,index)=>{
if(item.ifcheck){
this.listData.splice(index,1)
}
})
}else{ }else{
this.$toolAll.tools.showToast(res.msg) this.$toolAll.tools.showToast(res.msg)
} }

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -11306,7 +11306,7 @@ var refreshTokenPage = function refreshTokenPage() {
uni.setStorageSync('expire', result.data.data.expire); //缓存失效时间(时间戳格式) uni.setStorageSync('expire', result.data.data.expire); //缓存失效时间(时间戳格式)
uni.setStorageSync('phone_active', result.data.data.phone_active); //是否授权手机号 uni.setStorageSync('phone_active', result.data.data.phone_active); //是否授权手机号
uni.setStorageSync('is_active', result.data.data.is_active); //是否授权头像和昵称 uni.setStorageSync('is_active', result.data.data.is_active); //是否授权头像和昵称
uni.setStorageSync('invite_code', result.data.data.invite_code); //缓存邀请码 uni.setStorageSync('business_code', result.data.data.business_code); //缓存邀请码
uni.reLaunch({ // 重新进入当前页面 uni.reLaunch({ // 重新进入当前页面
url: localRoute }); url: localRoute });

View File

@ -213,7 +213,8 @@ var _default = {
delIds: '', //删除ids delIds: '', //删除ids
noMore: false, //没有更多 noMore: false, //没有更多
isLoading: true, isLoading: true,
flag: true }; flag: true,
showDel: false };
}, },
onShow: function onShow() { onShow: function onShow() {
@ -411,12 +412,8 @@ var _default = {
confirmDel: function confirmDel() {var _this5 = this; confirmDel: function confirmDel() {var _this5 = this;
this.$requst.post('/api/order/shopping-cart-del', { id: this.delIds.toString() }).then(function (res) { this.$requst.post('/api/order/shopping-cart-del', { id: this.delIds.toString() }).then(function (res) {
if (res.code == 0) { if (res.code == 0) {
_this5.listData = _this5.listData.filter(function (item) {return item.ifcheck == false;});
_this5.$toolAll.tools.showToast('删除成功'); _this5.$toolAll.tools.showToast('删除成功');
_this5.listData.forEach(function (item, index) {
if (item.ifcheck) {
_this5.listData.splice(index, 1);
}
});
} else { } else {
_this5.$toolAll.tools.showToast(res.msg); _this5.$toolAll.tools.showToast(res.msg);
} }

View File

@ -1 +1 @@
<view class="pad-b150 data-v-8217e9aa"><status-nav vue-id="1f8ddb3b-1" ifReturn="{{true}}" navBarTitle="购物车" marginBottom="{{0}}" class="data-v-8217e9aa" bind:__l="__l"></status-nav><view class="cart-content data-v-8217e9aa"><block wx:if="{{listData.length>0}}"><view data-event-opts="{{[['tap',[['e0',['$event']]]]]}}" class="cart-admin data-v-8217e9aa" bindtap="__e"><text class="data-v-8217e9aa">购物车信息</text>{{showDel?'取消':'管理'}}</view></block><view class="slide-list data-v-8217e9aa"><block wx:for="{{listData}}" wx:for-item="item" wx:for-index="index" wx:key="index"><view class="slide-item data-v-8217e9aa"><view data-event-opts="{{[['tap',[['clickItemMethod',['$0'],[[['listData','',index]]]]]]]}}" class="slide-item-li data-v-8217e9aa" bindtap="__e"><label class="radio data-v-8217e9aa"><radio checked="{{item.ifcheck}}" color="#0073bc" data-event-opts="{{[['tap',[['chooseEv',[index]]]]]}}" catchtap="__e" class="data-v-8217e9aa"></radio></label><view data-event-opts="{{[['tap',[['goDetail',['$0','$1'],[[['listData','',index,'spuId']],[['listData','',index,'is_series']]]]]]]}}" class="shop-img data-v-8217e9aa" bindtap="__e"><image src="{{item.image}}" mode="widthFix" class="data-v-8217e9aa"></image></view><view class="shop-txt data-v-8217e9aa"><view data-event-opts="{{[['tap',[['goDetail',['$0','$1'],[[['listData','',index,'spuId']],[['listData','',index,'is_series']]]]]]]}}" class="shop-txt-top data-v-8217e9aa" bindtap="__e"><view class="title clips2 data-v-8217e9aa">{{item.title}}</view><view class="specs clips2 data-v-8217e9aa">{{"规格:"+(item.customTitle==''?item.skuName:item.customTitle)}}</view></view><view class="shop-txt-bottom data-v-8217e9aa"><view class="price data-v-8217e9aa">{{"¥"+(vipPrice?item.price:item.original_price)}}</view><view class="num data-v-8217e9aa"><view data-event-opts="{{[['tap',[['addCutEv',[index,0]]]]]}}" class="icon icon-cut count-btn _i data-v-8217e9aa" style="{{'background-color:'+(item.num==minNum||item.slide_x!=0?'#d3d3d3':'#0073bc')+';'}}" catchtap="__e"></view><input class="input data-v-8217e9aa" type="digit" disabled="{{item.slide_x!=0}}" data-event-opts="{{[['blur',[['blurEv',[index,'$event']]]],['focus',[['focusEv',['$0'],[[['listData','',index,'num']]]]]],['input',[['__set_model',['$0','num','$event',[]],[[['listData','',index]]]]]]]}}" value="{{item.num}}" bindblur="__e" bindfocus="__e" bindinput="__e"/><view data-event-opts="{{[['tap',[['addCutEv',[index,1]]]]]}}" class="icon icon-add count-btn _i data-v-8217e9aa" style="{{'background-color:'+(item.num==maxNum||item.slide_x!=0?'#d3d3d3':'#0073bc')+';'}}" catchtap="__e"></view></view></view></view></view></view></block></view><view class="change-all data-v-8217e9aa"><label data-event-opts="{{[['tap',[['chooseAll',['$event']]]]]}}" class="label data-v-8217e9aa" bindtap="__e"><radio style="transform:scale(.8);margin-left:-6rpx;" checked="{{allChoose}}" color="#0073bc" class="data-v-8217e9aa"></radio><text class="data-v-8217e9aa">全选</text></label><block wx:if="{{showDel}}"><view class="all-price data-v-8217e9aa"><view data-event-opts="{{[['tap',[['delShopEv',['$event']]]]]}}" class="btn data-v-8217e9aa" style="background-color:#f83030;" bindtap="__e">删除</view></view></block><block wx:else><view class="all-price data-v-8217e9aa"><view class="price data-v-8217e9aa">合计:<label class="_span data-v-8217e9aa">{{"¥"+allPrice}}</label></view><view data-event-opts="{{[['tap',[['submitEv',['$event']]]]]}}" class="btn data-v-8217e9aa" style="{{'background:'+(!buyNum?'#cccccc':'#0073bc')+';'}}" bindtap="__e">{{allPrice==0?'去购物':'提交订单 ('+buyNum+')'}}</view></view></block></view><block wx:if="{{listData.length!==0&&noMore}}"><view class="more-txt data-v-8217e9aa">—— 到底啦 ——</view></block><block wx:if="{{listData.length==0}}"><nothing-page vue-id="1f8ddb3b-2" content="您的购物车,空空如也(*^▽^*)" class="data-v-8217e9aa" bind:__l="__l"></nothing-page></block></view></view> <view class="pad-b150 data-v-8217e9aa"><status-nav vue-id="1f8ddb3b-1" ifReturn="{{true}}" navBarTitle="购物车" marginBottom="{{0}}" class="data-v-8217e9aa" bind:__l="__l"></status-nav><view class="cart-content data-v-8217e9aa"><block wx:if="{{listData.length>0}}"><view data-event-opts="{{[['tap',[['e0',['$event']]]]]}}" class="cart-admin data-v-8217e9aa" bindtap="__e"><text class="data-v-8217e9aa">购物车信息</text>{{showDel?'取消':'管理'}}</view></block><view class="slide-list data-v-8217e9aa"><block wx:for="{{listData}}" wx:for-item="item" wx:for-index="index" wx:key="index"><view class="slide-item data-v-8217e9aa"><view data-event-opts="{{[['tap',[['clickItemMethod',['$0'],[[['listData','',index]]]]]]]}}" class="slide-item-li data-v-8217e9aa" bindtap="__e"><label class="radio data-v-8217e9aa"><radio checked="{{item.ifcheck}}" color="#0073bc" data-event-opts="{{[['tap',[['chooseEv',[index]]]]]}}" catchtap="__e" class="data-v-8217e9aa"></radio></label><view data-event-opts="{{[['tap',[['goDetail',['$0','$1'],[[['listData','',index,'spuId']],[['listData','',index,'is_series']]]]]]]}}" class="shop-img data-v-8217e9aa" bindtap="__e"><image src="{{item.image}}" mode="widthFix" class="data-v-8217e9aa"></image></view><view class="shop-txt data-v-8217e9aa"><view data-event-opts="{{[['tap',[['goDetail',['$0','$1'],[[['listData','',index,'spuId']],[['listData','',index,'is_series']]]]]]]}}" class="shop-txt-top data-v-8217e9aa" bindtap="__e"><view class="title clips2 data-v-8217e9aa">{{item.title}}</view><view class="specs clips2 data-v-8217e9aa">{{"规格:"+(item.customTitle==''?item.skuName:item.customTitle)}}</view></view><view class="shop-txt-bottom data-v-8217e9aa"><view class="price data-v-8217e9aa">{{"¥"+(vipPrice?item.price:item.original_price)}}</view><view class="num data-v-8217e9aa"><view data-event-opts="{{[['tap',[['addCutEv',[index,0]]]]]}}" class="icon icon-cut count-btn _i data-v-8217e9aa" style="{{'background-color:'+(item.num==minNum||item.slide_x!=0?'#d3d3d3':'#0073bc')+';'}}" catchtap="__e"></view><input class="input data-v-8217e9aa" type="digit" disabled="{{item.slide_x!=0}}" data-event-opts="{{[['blur',[['blurEv',[index,'$event']]]],['focus',[['focusEv',['$0'],[[['listData','',index,'num']]]]]],['input',[['__set_model',['$0','num','$event',[]],[[['listData','',index]]]]]]]}}" value="{{item.num}}" bindblur="__e" bindfocus="__e" bindinput="__e"/><view data-event-opts="{{[['tap',[['addCutEv',[index,1]]]]]}}" class="icon icon-add count-btn _i data-v-8217e9aa" style="{{'background-color:'+(item.num==maxNum||item.slide_x!=0?'#d3d3d3':'#0073bc')+';'}}" catchtap="__e"></view></view></view></view></view></view></block></view><view class="change-all data-v-8217e9aa"><label data-event-opts="{{[['tap',[['chooseAll',['$event']]]]]}}" class="label data-v-8217e9aa" bindtap="__e"><radio style="transform:scale(.8);margin-left:-6rpx;" checked="{{allChoose}}" color="#0073bc" class="data-v-8217e9aa"></radio><text class="data-v-8217e9aa">全选</text></label><block wx:if="{{showDel}}"><view class="all-price data-v-8217e9aa"><view data-event-opts="{{[['tap',[['delShopEv',['$event']]]]]}}" class="btn data-v-8217e9aa" style="background-color:#f83030;" bindtap="__e">删除</view></view></block><block wx:else><view class="all-price data-v-8217e9aa"><view class="price data-v-8217e9aa">合计:<label class="_span data-v-8217e9aa">{{"¥"+allPrice}}</label></view><view data-event-opts="{{[['tap',[['submitEv',['$event']]]]]}}" class="btn data-v-8217e9aa" style="{{'background:'+(!buyNum?'#cccccc':'#0073bc')+';'}}" bindtap="__e">{{allPrice==0?'去购物':'提交订单 ('+buyNum+')'}}</view></view></block></view><block wx:if="{{listData.length!==0&&noMore}}"><view class="more-txt data-v-8217e9aa">—— 到底啦 ——</view></block><block wx:if="{{isLoading&&listData.length==0}}"><nothing-page vue-id="1f8ddb3b-2" content="您的购物车,空空如也(*^▽^*)" class="data-v-8217e9aa" bind:__l="__l"></nothing-page></block></view></view>