Browse Source

特产购物车

dev
jiazhipeng 4 months ago
parent
commit
3c38d69bf3
  1. 49
      components/cartData.vue
  2. 15
      static/css/base.css
  3. 13
      subPackages/search/result.vue
  4. 8
      subPackages/search/techanResult.vue
  5. 2
      subPackages/techan/detail.vue
  6. 16
      subPackages/techan/index.vue

49
components/cartData.vue

@ -8,12 +8,12 @@
<view class="select-area flex flex-items-center" @click.stop="selectAllGoods">
<view class="select-cycle" v-show="!selectAll"></view>
<view class="select-cycle selected" v-show="selectAll">
<image src="https://cgc.js-dyyj.com/uploads/20241104/3d903e0c2788104b57b4ce5e07ea1de1.png">
<image src="https://static.ticket.sz-trip.com/uploads/20250617/c87afc2e461a01af35c71fb46ef0859d.png">
</view>
<view style="padding-left: 26rpx;" >全选</view>
</view>
<view class="delete-area flex flex-items-center" @click.stop="clearAllGoods">
<image src="https://cgc.js-dyyj.com/uploads/20241104/50900c9a5fa5fbdbdee526abc9af4a40.png"></image>
<!-- <image src="https://cgc.js-dyyj.com/uploads/20241104/50900c9a5fa5fbdbdee526abc9af4a40.png"></image> -->
<view style="padding-left: 8rpx;" >清空</view>
</view>
</view>
@ -23,10 +23,10 @@
<view class="flex flex-items-center" @tap.stop="setItemSelect(item)">
<view class="select-cycle" v-show="!item.isSelected"></view>
<view class="select-cycle selected" v-show="item.isSelected">
<image src="https://cgc.js-dyyj.com/uploads/20241104/3d903e0c2788104b57b4ce5e07ea1de1.png">
<image src="https://static.ticket.sz-trip.com/uploads/20250617/c87afc2e461a01af35c71fb46ef0859d.png">
</view>
<view style="padding-left: 26rpx;flex:1">
<view class="commodity box" >
<view class="commodity box" v-if="item.sku">
<image class="img" :src="showImg(item.sku.headimg)" mode="aspectFill"></image>
<view class="title goods-text-area">
<view class="commodity-info">
@ -49,7 +49,12 @@
</view>
</view>
<view class="no-data-zhanwei" v-if="cartData.length<=0">
<image src="https://static.ticket.sz-trip.com/uploads/20250618/0c2a469b4216f8cd570822b642d0a0fe.png"></image>
<view style="padding:50rpx 0 67rpx">暂无数据</view>
</view>
<view style="height: 140rpx;width: 1rpx;"></view>
</view>
@ -139,7 +144,7 @@
this.cartData = data
this.setAllSelect()
} else {
this.Post({},'/api/cart/get_list').then(res => {
this.Post({},'/api/cart/get_post_list').then(res => {
if (res) {
this.cartData = (res.data || []).map(v=>{return {...v, isSelected:selectedData.includes(v.specifications_id)}})
this.setAllSelect()
@ -190,13 +195,13 @@
addBuyNum(item, num,index){
if (num == -1 && item.num == 1) {
this.Post({sku_id: item.id, num: 0},'/api/cart/del_sku').then(res =>{
this.Post({sku_id: item.sku_id, num: 0},'/api/cart/del_sku').then(res =>{
this.cartData.splice(index,1)
this.setAllSelect()
})
} else {
let numData = item.num + num
this.Post({sku_id: item.id, num: numData},'/api/cart/update_sku').then(res =>{
this.Post({sku_id: item.sku_id, num: numData},'/api/cart/update_sku').then(res =>{
item.num += num
this.setAllSelect()
})
@ -229,27 +234,20 @@
})
return
}
return
// todo
let orderData = this.cartData.filter(v=>v.isSelected).map(v=>{
//
let techanOrderList = this.cartData.filter(v=>v.isSelected).map(v=>{
return {
goodsInfo: {
image: v.Specifications_image,
title:v.good_name,
merchant_name: v.merchant_name,
},
skuInfo: {
title:v.Specifications_name,
buyNum:v.num,
money: v.Specifications_money,
id: v.specifications_id,
},
pInfo: v.product,
sInfo: {...v.sku, buyNum: v.num},
}
})
// todo
this.$store.commit("changeTechanOrderList", techanOrderList);
// > > >
this.goCartNextPage(0)
},
},
@ -425,6 +423,7 @@
image{
width: 40rpx;
height: 40rpx;
border-radius: 50%;
}
}

15
static/css/base.css

@ -90,3 +90,18 @@ view {
.h-1rpx{
height: 1rpx;
}
.no-data-zhanwei{
display: flex;
flex-direction: column;
align-items: center;
font-weight: 500;
font-size: 32rpx;
color: #000000;
text-align: center;
padding-top: 90rpx;
}
.no-data-zhanwei image{
width: 347.33rpx;
height: 320.67rpx;
}

13
subPackages/search/result.vue

@ -34,17 +34,12 @@
</view>
</view>
</view>
</view>
</view>
<div class="list-common-empty" v-if="!showMore">
<p class="list-common-empty-tip"> 暂无更多 </p>
</div>
<view class="no-data-zhanwei" v-if="list.length<=0">
<image src="https://static.ticket.sz-trip.com/uploads/20250618/0c2a469b4216f8cd570822b642d0a0fe.png"></image>
<view style="padding:50rpx 0 67rpx">暂无数据</view>
</view>
</div>
</div>
</template>

8
subPackages/search/techanResult.vue

@ -31,9 +31,9 @@
</view>
</view>
<view v-if="list.length<=0" class="flex-center" style="width: 100%;height: 100%;flex-direction: column;">
<view style="font-weight: 500;font-size: 28rpx;color: #666666;
text-align: center;margin-top: 67rpx;padding-bottom: 300rpx;">暂无搜索结果</view>
<view class="no-data-zhanwei" v-if="list.length<=0">
<image src="https://static.ticket.sz-trip.com/uploads/20250618/0c2a469b4216f8cd570822b642d0a0fe.png"></image>
<view style="padding:50rpx 0 67rpx">暂无数据</view>
</view>
<scroll-view class="right-container no-scrollbar" :scroll-y="true" @scrolltolower="scrollLow()" v-else>
<view class="search-result" >
@ -42,7 +42,7 @@
<view class="search-result-container">
<view>
<view class="title text-overflowRows">{{item.title}}</view>
<view class="tags text-overflow" v-if="item.display_tags">
<view class="tags text-overflow" style="overflow-y: hidden;" v-if="item.display_tags">
<view class="tag" v-for="(tag,tagI) in item.display_tags.split(',')" :key="tagI">
{{tag}}
</view>

2
subPackages/techan/detail.vue

@ -256,7 +256,7 @@
this.Post({sku_id: goods.id,num: this.buyNum },'/api/cart/add_sku').then(res => {
if (res.code == 1) {
uni.showToast({title: res.msg,icon: 'none'});
// uni.$emit("updateDataByConnect", {msgType:'updateCartDataInfo',data:null})
uni.$emit("updateDataByConnect", {msgType:'updateCartDataInfo',data:null})
this.closePopup()
this.getCartList()
// this.$refs.cartDataVueRef.openPop()

16
subPackages/techan/index.vue

@ -67,10 +67,16 @@
</view>
</view>
</view>
<view class="no-data-zhanwei" v-if="list.length<=0">
<image src="https://static.ticket.sz-trip.com/uploads/20250618/0c2a469b4216f8cd570822b642d0a0fe.png"></image>
<view style="padding:50rpx 0 67rpx">暂无数据</view>
</view>
<view style="height: 148rpx;width: 1rpx;"></view>
</scroll-view>
</view>
</template>
@ -127,7 +133,7 @@
</view> -->
<!-- 购物车 -->
<!-- <view class="btn-bottom" >
<view class="btn-bottom" >
<cartDataVue ref="cartDataVueRef" :paramData="paramData" @changeParamData="changeParamData" style="width: 100%;height: 100%;">
<template class="btn-list" slot="content">
@ -152,7 +158,7 @@
</template>
</cartDataVue>
</view> -->
</view>
<uni-popup ref="popup" type="bottom" :safe-area="true">
<view class="popup-content" v-if="sku.length>0">
@ -412,7 +418,7 @@
this.Post({sku_id: goods.id,num: this.buyNum },'/api/cart/add_sku').then(res => {
if (res.code == 1) {
uni.showToast({title: res.msg,icon: 'none'});
// uni.$emit("updateDataByConnect", {msgType:'updateCartDataInfo',data:null})
uni.$emit("updateDataByConnect", {msgType:'updateCartDataInfo',data:null})
this.closePopup()
// this.$refs.cartDataVueRef.openPop()
}
@ -1032,6 +1038,4 @@
.active-search-item{
color: #6A8A2D;
}
</style>

Loading…
Cancel
Save