fixbug: 修改页面改造bug

This commit is contained in:
2026-07-14 23:08:25 +08:00
parent fd25002ab3
commit 45176d7d22
7 changed files with 243 additions and 291 deletions
+12 -10
View File
@@ -14,8 +14,8 @@
<view>
<!-- <view class="tags_row" v-if="Array.isArray(item.tags)"> -->
<view class="tags_row">
<image v-for="i in item.goodsTagList" :key="i.mchId" :src="i.icon"
class="tag_image" mode="heightFix"></image>
<image v-for="i in item.goodsTagList" :key="i.mchId" :src="i.icon" class="tag_image"
mode="heightFix"></image>
</view>
<!-- 商品名称 -->
@@ -26,7 +26,8 @@
<view class="coupon_row" v-if="hasCoupon">
<view class="coupon_badge" v-if="activedType === 'seckill'">
<text class="flash_icon">⚡</text>
<text class="coupon_text" v-if="item.secDiscount || item.subsidy">加倍补{{ item.secDiscount || item.subsidy }}元</text>
<text class="coupon_text" v-if="item.secDiscount || item.subsidy">加倍补{{ item.secDiscount ||
item.subsidy }}元</text>
</view>
<view class="coupon_badge" v-if="activedType === 'super'">
<text class="flash_icon">⚡</text>
@@ -39,15 +40,16 @@
<view class="price_section">
<text class="price_symbol">¥</text>
<text class="price_integer">{{ item.price }}</text>
<text class="original_price seckill" >{{ `${attributes.leftTime ?
<text class="original_price seckill">{{ `${attributes.leftTime ?
`只剩${attributes.leftTime}` : ''}` }}</text>
<!-- <text class="original_price" v-else>¥{{ formatOriginalPrice }}</text> -->
</view>
<!-- Alarm clock button -->
<view class="alarm_btn_wrapper" @click.stop="$emit('action', item)">
<image class="uni-image" v-if="activedType === 'seckill'" src="https://static.tbmall.xin/static/new-home/home_3.png"></image>
<image class="uni-image seckill-icon" v-else
src="https://static.tbmall.xin/static/home/qiang.png"></image>
<view class="alarm_btn_wrapper">
<image class="uni-image" v-if="activedType === 'seckill'"
src="https://static.tbmall.xin/static/new-home/home_3.png"></image>
<image class="uni-image seckill-icon" v-else src="https://static.tbmall.xin/static/home/qiang.png">
</image>
</view>
</view>
</view>
@@ -108,8 +110,8 @@ export default {
methods: {
// 商品
onSelectProct(item) {
let url = "/pages/other_package/productInfo/productInfo?id=" + item.id ;
if(this.activedType === 'seckill'){
let url = "/pages/other_package/productInfo/productInfo?id=" + item.id;
if (this.activedType === 'seckill') {
url = "/pages/other_package/productInfo/productInfo?id=" + item.id + "&activedType=" + this.activedType + "&activityId=" + item.activityId;
}
uni.navigateTo({
+33 -33
View File
@@ -20,26 +20,21 @@
<view class="tab-view">
<!-- 限时秒杀卡片 -->
<view class="tab-card">
<view
class="tab-item"
:class="{ active: activeTab === index }"
@click="onActiveTabChange(index)"
v-for="(item, index) in activeTabList"
:key="index"
>
<view class="tab-card">
<view class="tab-item" :class="{ active: activeTab === index }" @click="onActiveTabChange(index)"
v-for="(item, index) in activeTabList" :key="index">
<text class="tab-text">{{ item.name }}</text>
</view>
</view>
<!-- 限时秒杀标签 -->
<view class="tab-list-container">
<view class="tab-list" @click="onTab(index)" v-for="(item, index) in tabList" :key="index">
<text class="text-28 text-space" :style="{
color: curTab == index ? '#7A35F6' : '#666',
}">{{ item.name }}</text>
<!-- <view class="line" v-if="curTab == index"></view> -->
<view class="tab-list-container">
<view class="tab-list" @click="onTab(index)" v-for="(item, index) in tabList" :key="index">
<text class="text-28 text-space" :style="{
color: curTab == index ? '#7A35F6' : '#666',
}">{{ item.name }}</text>
<!-- <view class="line" v-if="curTab == index"></view> -->
</view>
</view>
</view>
</view>
<view class="setting-view">
@@ -135,10 +130,10 @@ export default {
url().then((res) => {
if (res.bizcode === 100) {
this.activityId = res.data.activityId;
console.log('获取秒杀当前时间',res.data);
this.attributes ={
leftTime: res.data.leftTime || null,
console.log('获取秒杀当前时间', res.data);
this.attributes = {
leftTime: res.data.leftTime || null,
}
this.$nextTick(() => {
this.mescroll && this.mescroll.resetUpScroll();
@@ -210,10 +205,10 @@ export default {
this.activeTab = index;
this.dataList = [];
const item = this.activeTabList[index];
this.onGetSeckillCurrent(item.type);
this.onGetSeckillCurrent(item.type);
}
},
init() {
this.onGetSeckillCurrent();
this.cascadeCategory();
@@ -223,7 +218,7 @@ export default {
delta: 1, // 返回的页面数,默认为1,返回到上一级
});
},
onSwiper(index) {
onSwiper(index) {
uni.previewImage({
current: index,
loop: true,
@@ -257,7 +252,7 @@ export default {
.u-swiper__wrapper__item__wrapper__image {
height: 600rpx !important;
border-radius: 0 !important;
border-radius: 0 !important;
}
}
}
@@ -330,13 +325,14 @@ export default {
}
.tab-card {
width: 100%;
width: calc(100% - 64rpx);
height: 74rpx;
display: flex;
align-items: center;
background-color: #f5f5f5;
border-radius: 12rpx;
padding: 0 4rpx;
margin: 0 32rpx;
margin-bottom: 16rpx;
.tab-item {
@@ -372,20 +368,24 @@ export default {
width: 100%;
display: flex;
flex-direction: column;
padding: 24rpx 32rpx 0;
padding: 24rpx 0 0;
box-sizing: border-box;
background-color: #fff;;
background-color: #fff;
;
overflow-x: auto;
position: absolute;
top: 520rpx;
left: 0;
.tab-list-container{
width: 100%;
height: 60rpx;
display: flex;
flex-direction: row;
align-items: center;
}
.tab-list-container {
width: 100%;
height: 60rpx;
display: flex;
flex-direction: row;
align-items: center;
overflow-x: auto;
}
.tab-list {
margin-right: 24rpx;
display: flex;
+21 -8
View File
@@ -52,7 +52,7 @@
<view class="yp_item" v-for="item in faddishProduct" :key="item.id"
@click.stop="jumpInfo(item)">
<view class="yp_item_image_wrapper">
<up-image :src="item.url" width="100%" height="80" bgColor="#f1f6ff00"
<up-image :src="item.url" width="100%" height="88" bgColor="#f1f6ff00"
shape="square" radius="15"></up-image>
</view>
<view class="yp_item_info">
@@ -102,8 +102,8 @@
<view class="product_comm_tip" @click="jumpPage(item.path)">
<view class="product_comm_tip_left">
<image class="uni-image" :src="item.title_icon"></image>
<view class="tip_title" v-if="item.title_text">{{ item.title_text }}</view>
<view class="tip_title_lable">{{ item.title }}</view>
<view :class="[activedTabId === 'actived' ? 'tip_title_lable' : 'tip_title']" style="margin-right: 10rpx;" v-if="item.title_text" @click.stop="jumpTab(item, 'actived')">{{ item.title_text }}</view>
<view :class="[activedTabId === 'seckill' ? 'tip_title_lable' : 'tip_title']" @click.stop="jumpTab(item, 'seckill')">{{ item.title }}</view>
</view>
<view class="product_comm_tip_right">{{ item.rightText }}
@@ -125,6 +125,10 @@
</view>
</view>
</view>
<!-- 为您精选 -->
<choiceness />
</view>
</view>
@@ -197,6 +201,7 @@ import {
getGoodsDetail,
searchList,
getSeckillCurrent,
getSeckillPreview,
getSeckillGoodsList,
getGoodsTags,
} from "@/api/product.js";
@@ -266,8 +271,8 @@ export default {
rightText: '专属补贴 . 低价秒杀',
activedType: 'seckill'
},
], // 首页活动列表
activedTabId: 'seckill', // 当前选中的活动类型
};
},
onShow() {
@@ -311,9 +316,15 @@ export default {
},
mounted() { },
methods: {
// 切换活动类型
jumpTab(item, type) {
this.activedTabId = type;
this.onGetSeckillCurrent();
},
// 获取秒杀
onGetSeckillCurrent() {
getSeckillCurrent().then((res) => {
const url = this.activedTabId === 'seckill' ? getSeckillCurrent : getSeckillPreview;
url().then((res) => {
console.log("获取秒杀", res);
if (res.bizcode === 100) {
res.data.activityId && this.onGetSeckillGoodsList(res.data.activityId, 'seckillGoodsList');
@@ -812,7 +823,11 @@ export default {
}
.yp_item {
flex: 0 0 32%;
// flex: 0 0 32%;
flex:1;
// height: 268rpx;
max-width: 33.3%;
gap: 10rpx;
min-width: 0;
background-color: #ffffff;
border-radius: 24rpx;
@@ -828,7 +843,6 @@ export default {
width: 100%;
display: flex;
justify-content: center;
margin-bottom: 12rpx;
}
.yp_item_info {
@@ -1065,7 +1079,6 @@ export default {
.tip_title {
color: #666666;
margin-right: 12rpx;
}
.tip_title_lable {
@@ -37,7 +37,7 @@
</view>
<view v-for="(addItem, addIndex) in item.addrTimes" :key="addIndex">
<!-- 单个地址 -->
<view v-if="addItem.address" class="shops_address_warp"
<!-- <view v-if="addItem.address" class="shops_address_warp"
@click="checkAddressShow(true, 'addrTimes', addIndex, index)">
<view class="shops_address_warp_title">
<text style="margin-right: 20rpx">{{ addItem.address.name }}</text>
@@ -46,7 +46,7 @@
<view>
<up-image src="/static/common/right.png" width="16" height="16" bgColor="#f1f6ff00"></up-image>
</view>
</view>
</view> -->
<!-- 产品详情 -->
<view v-if="ids" class="order_item_content" v-for="(pItem, pIndex) in addItem.goods" :key="pItem.id">
<up-image :src="pItem.img" width="80" height="80" bgColor="#f1f6ff00"
@@ -60,7 +60,7 @@
<view class="content_right_total">
<view>¥<text style="font-size: 36rpx">{{
pItem.totalPrice
}}</text></view>
}}</text></view>
<view>每件到手价¥{{ pItem.unitPrice }}</view>
</view>
<view class="shopping_info_quantity">
@@ -84,7 +84,7 @@
<view class="content_right_total">
<view>¥<text style="font-size: 36rpx">{{
pItem.totalPrice
}}</text></view>
}}</text></view>
<view>每件到手价¥{{ pItem.unitPrice }}</view>
</view>
<view class="shopping_info_quantity">
@@ -108,7 +108,7 @@
<view class="order_freight_item">
<view>运费<text style="color: #c0c3c6; margin-left: 20rpx">{{
getValue(PRODUCT_DELIVERY_TIME, addItem.deliveryTime)
}}</text></view>
}}</text></view>
<view class="value_">
{{ orderInfo.postage ? "¥" + orderInfo.postage : "包邮" }}
</view>
@@ -201,7 +201,7 @@
<view style="display: flex; align-items: center;">
<view class="seckill-tag">限时秒杀</view>
<view class="text-24 " style="margin-right:8rpx;color:#7934F6;font-size: 32rpx;font-weight: bold;">¥{{
allOrderInfo.activity?.activityPrice}}</view>
allOrderInfo.activity?.activityPrice }}</view>
</view>
</view>
<view class="price-view" v-if="isCoupon">
@@ -256,7 +256,7 @@
</up-popup>
<!-- 选择地址 -->
<up-popup v-model:show="addressShow" :round="10" :closeOnClickOverlay="false" :closeable="true"
<up-popup v-model:show="addressShow" v-if="addressShow" :round="10" :closeOnClickOverlay="false" :closeable="true"
:safeAreaInsetBottom="false" @close="checkAddressShow(false, null, 0, 0)">
<view class="address_popup_warp">
<view class="address_popup_title">收件地址</view>
@@ -294,7 +294,8 @@
<up-toast ref="uToastRef"></up-toast>
<!-- 优惠券选择弹框 -->
<CouponDialog :show="couponShow" v-if="couponShow" @close="couponShow = false" @select="handleCouponSelect"></CouponDialog>
<CouponDialog :show="couponShow" v-if="couponShow" @close="couponShow = false" @select="handleCouponSelect">
</CouponDialog>
</view>
</template>
@@ -541,8 +542,8 @@ export default {
parmas.isDeduction = true;
}
if(this.sed.activedType == "seckill"){
parmas["types"] = "1,2,3";
if (this.sed?.activedType == "seckill") {
parmas["types"] = "1,2,3";
}
const result = await getSupportPay(parmas);
if (result && result.bizcode === 100) {
@@ -630,9 +631,10 @@ export default {
if (resp && resp.bizcode === 100) {
const data = resp.data;
this.isPoints = data.type == 3 ? 1 : 0;
console.log("秦星星data", data);
this.orderInfo = {
address: null,
amount:this.sed?.activedType == "seckill" ? data.activity?.activityPrice :this.sed.goodsNum * this.sed.specsId.price || 0,
amount: this.sed?.activedType == "seckill" ? data.activity?.activityPrice : this.sed.goodsNum * this.sed.specsId.price || 0,
postage: 0,
shops: [
{
+37 -16
View File
@@ -56,7 +56,10 @@
</view>
<view class="content_data_series">
<!-- 暂时隐藏 -->
<view></view>
<view class="content_data_series_tag" v-if="orderInfo.contribution">
<image class="uni-image" src="https://static.tbmall.xin/static/new-home/home_3.png"></image>
下单送{{ orderInfo.contribution }}贡献值
</view>
<!-- 销量还需要改 -->
<view>销量{{ limit999(orderInfo.sales) }}件</view>
</view>
@@ -846,7 +849,7 @@ export default {
if (this.isCoupon) {
params.type = -1;
}
if(this.activedType === 'seckill'){
if (this.activedType === 'seckill') {
params.activityId = this.activityId;
params.activityType = 'seckill';
}
@@ -863,9 +866,9 @@ export default {
data.addressObj = {}; // 收件人地址
data.quantity = 1; // 数量
data.inventory = 0; // 库存
if(this.activedType === 'seckill'){
if (this.activedType === 'seckill') {
data.minPrice = data.activity?.activityPrice;
}
}
this.orderInfo = data;
}
},
@@ -1081,25 +1084,25 @@ export default {
specsId: selectTempl.id, // 规格ID
goodsNum: this.orderInfo.quantity, // 商品数量
};
console.log("selectTempl", selectTempl);
if (this.isShowCart == 1 || this.isCoupon) {
console.log("活动类型params---秦星星", params,this.isCoupon);
console.log("活动类型params---秦星星", params, this.isCoupon);
params["specsId"] = selectTempl;
let url = "";
if(this.activedType == "seckill"){
params["activedType"] = this.activedType; // 活动类型
params["activityId"] = this.activityId;// 秒杀活动ID
url = `/pages/order_package/order_submit/order_submit?sed=${JSON.stringify(
params
)}`;
}
if (this.activedType == "seckill") {
params["activedType"] = this.activedType; // 活动类型
params["activityId"] = this.activityId;// 秒杀活动ID
url = `/pages/order_package/order_submit/order_submit?sed=${JSON.stringify(
params
)}`;
}
if(this.isCoupon){
url =`/pages/order_package/order_submit/order_submit?sed=${JSON.stringify(
if (this.isCoupon) {
url = `/pages/order_package/order_submit/order_submit?sed=${JSON.stringify(
params
)}&address=${this.selectAddress?.id}&isCoupon=${this.isCoupon}`
}
}
uni.navigateTo({
url: url
@@ -1236,6 +1239,24 @@ export default {
font-size: 24rpx;
color: #999999;
margin-top: 10rpx;
.content_data_series_tag {
font-weight: 500;
font-size: 24rpx;
height: 45rpx;
color: #7934F6;
padding: 0 12rpx;
border-radius: 8rpx;
display: flex;
align-items: center;
justify-content: center;
background: rgba(121, 52, 246, 0.1);
.uni-image {
width: 40rpx;
height: 28rpx;
}
}
}
.tui-view {
+40 -130
View File
@@ -1,102 +1,46 @@
<template>
<view>
<view
:calss="[
isDataNull ? 'isDataNull-calss' : 'isDataNull-active',
platformType ? '' : 'iosplatformType',
]"
class="shopping_cart_warp"
>
<view :calss="[
isDataNull ? 'isDataNull-calss' : 'isDataNull-active',
platformType ? '' : 'iosplatformType',
]" class="shopping_cart_warp">
<view class="shopping_cart_header">
<view class="cart">购物车({{ shoppingTotal }})</view>
<view
class="enit_but"
@click="isEdit = true"
v-if="!isEdit"
v-show="!isDataNull"
>编辑</view
>
<view
class="enit_but"
@click="isEdit = false"
v-else
v-show="isDataNull"
>取消</view
>
<view class="enit_but" @click="isEdit = true" v-if="!isEdit" v-show="!isDataNull">编辑</view>
<view class="enit_but" @click="isEdit = false" v-else>取消</view>
</view>
<!-- 购物车列表 -->
<up-loading-page :loading="listLoading"></up-loading-page>
<view class="shopping_cart_content">
<view
v-if="!isDataNull"
class="shopping_cart_content_item"
v-for="(item, index) in shoppingList"
:key="item.id"
>
<view v-if="!isDataNull" class="shopping_cart_content_item" v-for="(item, index) in shoppingList"
:key="item.id">
<!-- 店铺头部 -->
<up-checkbox
:customStyle="{ marginBottom: '8px' }"
name="isCheck"
usedAlone
v-model:checked="item.isCheck"
shape="circle"
activeColor="#7934F6"
size="19"
iconSize="18"
@change="(event) => shoppingChange(event, index)"
>
<up-checkbox :customStyle="{ marginBottom: '8px' }" name="isCheck" usedAlone v-model:checked="item.isCheck"
shape="circle" activeColor="#7934F6" size="19" iconSize="18"
@change="(event) => shoppingChange(event, index)">
<template #label>
<view class="content_item_header">
<up-image
:src="
item.shopLogo ? item.shopLogo : '/static/shopping/store.png'
"
width="22"
height="22"
bgColor="#f1f6ff00"
shape="circle"
></up-image>
<view class="order_product_title"
>{{ item.shopName }}{{ item.id }}</view
>
<up-image :src="item.shopLogo ? item.shopLogo : '/static/shopping/store.png'
" width="22" height="22" bgColor="#f1f6ff00" shape="circle"></up-image>
<view class="order_product_title">{{ item.shopName }}{{ item.id }}</view>
</view>
</template>
</up-checkbox>
<view>
<view
class="content_item_info"
v-for="(pItem, pIndex) in item.product"
:key="pItem.id"
>
<view class="content_item_info" v-for="(pItem, pIndex) in item.product" :key="pItem.id">
<!-- 单个商品 -->
<up-checkbox
:customStyle="{ marginBottom: '8px' }"
name="isCheck"
usedAlone
v-model:checked="pItem.isCheck"
shape="circle"
activeColor="#7934F6"
size="19"
iconSize="18"
<up-checkbox :customStyle="{ marginBottom: '8px' }" name="isCheck" usedAlone
v-model:checked="pItem.isCheck" shape="circle" activeColor="#7934F6" size="19" iconSize="18"
:disabled="!isEdit && [1, 2].includes(pItem.goodsStatus)"
@change="(event) => productChange(event, index, pIndex)"
>
@change="(event) => productChange(event, index, pIndex)">
</up-checkbox>
<view class="info_item">
<up-image
:src="pItem.mainGraph"
width="100"
height="100"
bgColor="#f1f6ff00"
@click="jumpInfo(pItem)"
></up-image>
<up-image :src="pItem.mainGraph" width="100" height="100" bgColor="#f1f6ff00"
@click="jumpInfo(pItem)"></up-image>
<view class="content_info">
<view
class="shopping_content_info_title"
@click="jumpInfo(pItem)"
>{{ pItem.name }}</view
>
<view class="shopping_content_info_title" @click="jumpInfo(pItem)">{{ pItem.name }}</view>
<view class="content_info_description">
{{ pItem.goodsSpece }}
</view>
@@ -108,34 +52,16 @@
pItem.unitPrice
}}</text>
</view>
<view class="shopping_info_amount_original"
>¥{{ pItem.unitPrice }}</view
>
<view class="shopping_info_amount_original">¥{{ pItem.unitPrice }}</view>
</view>
<view>
<view class="shopping_info_quantity">
<view
class="quantity_but"
@click="quantityFun('minus', index, pIndex, pItem.id)"
>-</view
>
<view class="quantity_but" @click="quantityFun('minus', index, pIndex, pItem.id)">-</view>
<view class="quantity_value">{{ pItem.buyNum }}</view>
<view
class="quantity_but"
@click="quantityFun('add', index, pIndex, pItem.id)"
>+</view
>
<view class="quantity_but" @click="quantityFun('add', index, pIndex, pItem.id)">+</view>
</view>
<view
v-if="[1].includes(pItem.goodsStatus)"
class="insufficient_stock"
>库存不足</view
>
<view
v-if="[2].includes(pItem.goodsStatus)"
class="insufficient_stock"
>商品已下架</view
>
<view v-if="[1].includes(pItem.goodsStatus)" class="insufficient_stock">库存不足</view>
<view v-if="[2].includes(pItem.goodsStatus)" class="insufficient_stock">商品已下架</view>
</view>
</view>
</view>
@@ -144,12 +70,8 @@
</view>
</view>
<view v-else class="not_order_warp">
<up-image
src="https://static.tbmall.xin/static/not_shopping.png"
width="80"
height="80"
bgColor="#f1f6ff00"
></up-image>
<up-image src="https://static.tbmall.xin/static/not_shopping.png" width="80" height="80"
bgColor="#f1f6ff00"></up-image>
<view class="not_order_msg_warp">购物车是空的</view>
</view>
<choiceness />
@@ -159,25 +81,13 @@
<view class="shopping_cart_but">
<!-- 全选 -->
<view class="shopping_cart_but_total">
<up-checkbox
name="isAll"
usedAlone
v-model:checked="isAll"
shape="circle"
activeColor="#7934F6"
size="19"
iconSize="18"
@change="isAllChange"
>
<up-checkbox name="isAll" usedAlone v-model:checked="isAll" shape="circle" activeColor="#7934F6" size="19"
iconSize="18" @change="isAllChange">
<template #label>
<text style="font-size: 26rpx; color: #444444">全选</text>
</template>
</up-checkbox>
<text
style="margin-left: 20rpx; font-size: 24rpx; color: #444444"
v-if="!isEdit"
>合计:</text
>
<text style="margin-left: 20rpx; font-size: 24rpx; color: #444444" v-if="!isEdit">合计:</text>
<text style="font-size: 24rpx" v-if="!isEdit">¥</text>
<text style="font-size: 32rpx" v-if="!isEdit">{{ total }}</text>
</view>
@@ -231,7 +141,7 @@ export default {
/*#endif*/
this.getCartList();
},
onLoad() {},
onLoad() { },
methods: {
/**
* 查询购物车列表
@@ -532,12 +442,15 @@ export default {
background-color: $app-bj;
padding: 104rpx 30rpx 30rpx;
overflow: hidden;
&.isDataNull-calss {
height: calc(100vh - 100rpx - env(safe-area-inset-bottom));
}
&.isDataNull-active {
height: calc(100vh - 100rpx - env(safe-area-inset-bottom) - 100rpx);
}
&.iosplatformType {
height: calc(100vh - 100rpx - 50rpx) !important;
@@ -545,9 +458,9 @@ export default {
height: calc(100vh - 104rpx - 30rpx - 30rpx - 100rpx - 10rpx) !important;
}
.shopping_cart_but{
bottom: 90rpx !important;
}
.shopping_cart_but {
bottom: 90rpx !important;
}
}
}
@@ -569,10 +482,7 @@ export default {
.shopping_cart_content {
margin-top: 30rpx;
height: calc(
100vh - 104rpx - 30rpx - 30rpx - 100rpx - env(safe-area-inset-bottom) -
10rpx
);
height: calc(100vh - 104rpx - 30rpx - 30rpx - 100rpx - env(safe-area-inset-bottom) - 10rpx);
overflow-y: auto;
.shopping_cart_content_item {
+87 -83
View File
@@ -8,56 +8,28 @@
</view>
</view>
<view class="tab-box">
<view
class="tab-item"
v-for="(item, index) in tabArr"
:key="index"
@click="onTab(index)"
>
<image
:src="curTab == index ? item.icon : item.icon"
mode="aspectFill"
class="tab-img"
></image>
<view
class="tab-name"
:style="{
color: curTab == index ? '#7A35F6' : '#666',
}"
>{{ item.name }}</view
>
<view class="tab-item" v-for="(item, index) in tabArr" :key="item.id" @click="onTab(item.id)">
<image :src="curTab == item.id ? item.iconActive : item.icon" mode="aspectFill" class="tab-img">
</image>
<view class="tab-name" :style="{
color: curTab == item.id ? '#7A35F6' : '#666',
}">{{ item.name }}</view>
</view>
</view>
<view class="setting-view">
<view class="name-box">
<mescroll-uni
ref="mescrollRef"
@down="downCallback"
@up="upCallback"
:up="upOption"
:down="downOption"
@init="mescrollInit"
:fixed="false"
>
<mescroll-uni ref="mescrollRef" @down="downCallback" @up="upCallback" :up="upOption" :down="downOption"
@init="mescrollInit" :fixed="false">
<!-- 原来单个 v-for 替换成两列 -->
<view class="mescrollUniView">
<view class="fall-col">
<PingItem
v-for="(item, i) in leftList"
:key="item.id"
:obj="item"
@ok="onJumpShop"
style="margin-top: 24rpx"
/>
<PingItem v-for="(item, i) in leftList" :key="item.id" :obj="item" @ok="onJumpShop"
style="margin-top: 24rpx" />
</view>
<view class="fall-col">
<PingItem
v-for="(item, i) in rightList"
:key="item.id"
:obj="item"
@ok="onJumpShop"
style="margin-top: 24rpx"
/>
<PingItem v-for="(item, i) in rightList" :key="item.id" :obj="item" @ok="onJumpShop"
style="margin-top: 24rpx" />
</view>
</view>
</mescroll-uni>
@@ -75,19 +47,41 @@ import Header from "@/components/common/header.vue";
import TopSafe from "@/components/common/top-safe.nvue";
import MyBtn from "@/components/common/my-btn.vue";
import PingItem from "@/components/shop/ping-item.vue";
import { searchList,getGoodsTags } from "@/api/product.js";
import { searchList, getGoodsTags } from "@/api/product.js";
import CustomTabBar from "@/components/custom-tab-bar.vue";
import MescrollMixin from "@/components/mescroll-uni/mescroll-mixins.js";
import MescrollUni from "@/components/mescroll-uni/mescroll-uni.vue";
export default {
mixins: [MescrollMixin],
components: { Header, TopSafe, MyBtn,PingItem, CustomTabBar, MescrollUni },
components: { Header, TopSafe, MyBtn, PingItem, CustomTabBar, MescrollUni },
data() {
return {
dataList: [],
tabArr: [ ],
curTab: 0,
tabArr: [
{
id: 7,
name: '信任专享',
icon: 'https://static.tbmall.xin/static/new-home/xinren.png',
iconActive: 'https://static.tbmall.xin/static/new-home/xinren_active.png',
}, {
id: 15,
name: '全网爆款',
icon: 'https://static.tbmall.xin/static/new-home/baokuan.png',
iconActive: 'https://static.tbmall.xin/static/new-home/baokuan_active.png',
}, {
id: 16,
name: '低价好物',
icon: 'https://static.tbmall.xin/static/new-home/cart.png',
iconActive: 'https://static.tbmall.xin/static/new-home/cart_active.png',
}, {
id: 6,
name: '品牌特卖',
icon: 'https://static.tbmall.xin/static/new-home/huiyuan.png',
iconActive: 'https://static.tbmall.xin/static/new-home/huiyuan_active.png',
},
],
curTab: 7,
upOption: {
auto: false,
page: {
@@ -111,18 +105,20 @@ export default {
};
},
onLoad(options) {
this.init();
if(options.index){
console.log("+++++", options)
if (options.index) {
this.curTab = options.index;
}
this.getSearchList()
},
onShow() {
if (this.tabArr.length > 0) {
const sortParams = uni.getStorageSync('sortParams');
if (sortParams) {
const targetIndex = this.tabArr.find(item => item.name === sortParams.value)?.id;
uni.removeStorageSync('sortParams');
const targetIndex = this.tabArr.findIndex(item => item.name === sortParams.value);
if (targetIndex !== -1 && targetIndex !== this.curTab) {
if (targetIndex) {
this.curTab = targetIndex;
this.dataList = [];
this.downCallback();
@@ -132,29 +128,29 @@ export default {
},
methods: {
/**
* 查询分类列表
*/
async getSortList() {
const resp = await getGoodsTags({ type: 5 });
if (resp && resp.bizcode === 100) {
this.tabArr = resp.data.sort((a, b) => a.sort - b.sort);
this.$nextTick(() => {
this.applySortParams();
this.downCallback();
});
}
},
applySortParams() {
const sortParams = uni.getStorageSync('sortParams');
if (sortParams && this.tabArr.length > 0) {
uni.removeStorageSync('sortParams');
const targetIndex = this.tabArr.findIndex(item => item.name === sortParams.value);
if (targetIndex !== -1 && targetIndex !== this.curTab) {
this.curTab = targetIndex;
this.dataList = [];
}
}
},
* 查询分类列表
*/
async getSortList() {
const resp = await getGoodsTags({ type: 5 });
if (resp && resp.bizcode === 100) {
this.tabArr = resp.data.sort((a, b) => a.sort - b.sort);
this.$nextTick(() => {
this.applySortParams();
this.downCallback();
});
}
},
applySortParams() {
const sortParams = uni.getStorageSync('sortParams');
if (sortParams && this.tabArr.length > 0) {
uni.removeStorageSync('sortParams');
const targetIndex = this.tabArr.findIndex(item => item.name === sortParams.value);
if (targetIndex !== -1 && targetIndex !== this.curTab) {
this.curTab = targetIndex;
this.dataList = [];
}
}
},
mescrollInit(mescroll) {
this.mescroll = mescroll;
},
@@ -166,11 +162,10 @@ export default {
type: 2,
page: page.num,
pageSize: page.size,
isPar: true
isPar: true,
tag: this.curTab
};
if (this.tabArr.length > 0 && this.tabArr[this.curTab]) {
params["tag"] = this.tabArr[this.curTab].id;
}
searchList(params).then((res) => {
let curPageLen = res.data.length;
this.dataList = this.dataList.concat(res.data);
@@ -187,22 +182,19 @@ export default {
onTab(index) {
if (index != this.curTab) {
this.curTab = index;
console.log("----", this.curTab)
this.dataList = [];
this.downCallback();
}
},
init() {;
this.getSortList();
},
async getSearchList() {
const params = {
page: 1,
pageSize: 10,
isPar: true,
tag: this.curTab
};
if (this.tabArr.length > 0 && this.tabArr[this.curTab]) {
params["type"] = this.tabArr[this.curTab].id;
}
const resp = await searchList(params);
if (resp && resp.bizcode === 100) {
this.dataList = resp.data || [];
@@ -249,6 +241,7 @@ export default {
height: calc(100vh);
background-color: $app-bj;
}
.head-view {
width: 100%;
min-height: 88rpx;
@@ -258,6 +251,7 @@ export default {
padding: 0 32rpx;
box-sizing: border-box;
background-color: #fff;
.head-search {
width: 100%;
height: 76rpx;
@@ -269,6 +263,7 @@ export default {
border-radius: 16rpx;
}
}
.tab-box {
width: 100%;
height: 160rpx;
@@ -280,21 +275,25 @@ export default {
box-sizing: border-box;
background-color: #fff;
overflow-x: auto;
.tab-item {
display: flex;
flex: 1;
flex-direction: column;
align-items: center;
.tab-img {
width: 56rpx;
height: 56rpx;
}
.tab-name {
font-size: 28rpx;
margin-top: 24rpx;
}
}
}
.tab-view {
width: 100%;
height: 80rpx;
@@ -305,6 +304,7 @@ export default {
box-sizing: border-box;
background-color: #fff;
overflow-x: auto;
.tab-list {
margin-right: 24rpx;
display: flex;
@@ -315,12 +315,14 @@ export default {
justify-content: space-between;
margin-top: 22rpx;
}
.line {
width: 48rpx;
height: 6rpx;
background-color: #7a35f6;
}
}
.setting-view {
width: 100%;
height: calc(100vh - 88rpx - 80rpx - 100rpx - var(--status-bar-height));
@@ -332,6 +334,7 @@ export default {
padding: 0 32rpx;
box-sizing: border-box;
position: relative;
.name-box {
width: 100%;
height: calc(100vh - 88rpx - 80rpx - 100rpx - var(--status-bar-height));
@@ -346,7 +349,8 @@ export default {
justify-content: space-between;
.fall-col {
width: 332rpx; /* 与 PingItem 宽度一致 */
width: 332rpx;
/* 与 PingItem 宽度一致 */
height: 100%;
}
}