update: 修复蓝驰加购异常提示问题;实现全部商品销量下拉加载商品;修复购物车刘海安全边距背景透底问题;修复蓝驰加购按钮无禁用无提示问题;

This commit is contained in:
mixtan 2025-07-28 23:27:42 +08:00
parent 27e4e817c8
commit 6cb98e9f37
4 changed files with 221 additions and 31 deletions

View File

@ -163,16 +163,15 @@
}}</label>
<label>{{ __("众宝") }}</label>
</block>
<view v-if="item.eltm4.btnType == 4" class="c4" @click.stop="addCart(items)" :style="{
<view v-if="item.eltm4.btnType == 4" class="c4" @click.stop="addCart(items)" :style="{
backgroundColor: item.eltm4.btnColor,
color: item.eltm4.btnFontColor,
}">
<label v-if="item.eltm4.btnType == 4">{{ item.eltm4.btnText }}</label>
</view>
<view v-else :class="'c' + item.eltm4.btnType" @click.stop="addCart(items)">
<label v-if="item.eltm4.btnType == 3">buy</label>
</view>
<view v-else :class="['c' + item.eltm4.btnType, { disable: getGoodsStatus(items) }]" @click.stop="addCart(items)">
<label v-if="item.eltm4.btnType == 3">buy</label>
</view>
</view>
</view>
</view>
@ -399,21 +398,21 @@
<view v-for="(items, idx) in item.eltm13.data" :key="idx">
<view class="fromInput" v-if="items.type == 1"><label :style="{ color: item.eltm13.labelColor }">{{
items.labelText
}}</label><input type="text" :name="'' + items.id" maxlength="200" :placeholder="items.placeholderText"
}}</label><input type="text" :name="'' + items.id" maxlength="200" :placeholder="items.placeholderText"
:style="{
borderColor: items.borderColor,
color: item.eltm13.textColor,
}" /></view>
<view class="fromInput" v-if="items.type == 2"><label :style="{ color: item.eltm13.labelColor }">{{
items.labelText
}}</label>
}}</label>
<picker mode="date" :value="items.name" :data-id="items.id" @change="bindDateChange">
<view class="picker">{{ items.name || __("请选择时间") }} </view>
</picker>
</view>
<view class="fromInput" v-if="items.type == 3"><label :style="{ color: item.eltm13.labelColor }">{{
items.labelText
}}</label><textarea :name="'' + items.id" maxlength="400" :placeholder="items.placeholderText" :style="{
}}</label><textarea :name="'' + items.id" maxlength="400" :placeholder="items.placeholderText" :style="{
borderColor: items.borderColor,
color: item.eltm13.textColor,
}"></textarea>
@ -442,7 +441,7 @@
</checkbox-group>
<view class="fromInput" v-if="items.type == 6"><label :style="{ color: item.eltm13.labelColor }">{{
items.labelText
}}</label>
}}</label>
<view class="upload-view">
<view v-for="(info, idx) in items.data" :key="idx" class="upload-img-item">
<image mode="aspectFit" :src="info"></image>
@ -569,7 +568,7 @@
<view class="activity-price" v-if="
item.eltm16.isShowPrice == null || item.eltm16.isShowPrice
"><label class="price" :style="{ color: item.eltm16.priceColor }">{{ __("") }}{{ items.ItemSalePrice
}}</label><label class="del-price" v-if="items.selectType == 14">{{ __("") }}{{ items.MarketPice
}}</label><label class="del-price" v-if="items.selectType == 14">{{ __("") }}{{ items.MarketPice
}}</label><label class="tip" v-if="items.selectType == 12 || items.selectType == 13">{{
items.UserLimit }}{{ __("人团") }}</label>
</view>
@ -607,7 +606,7 @@
<view class="activity-price" v-if="
item.eltm16.isShowPrice == null || item.eltm16.isShowPrice
"><label class="price" :style="{ color: item.eltm16.priceColor }">{{ __("") }}{{ items.ItemSalePrice
}}</label>
}}</label>
</view>
<view class="activity-desc" v-if="item.eltm16.isShowNum">
{{ __("已有") }}{{ items.OrderCount }} {{ __("人参加") }}
@ -651,7 +650,7 @@
<view class="activity-price" v-if="
item.eltm16.isShowPrice == null || item.eltm16.isShowPrice
"><label class="price" :style="{ color: item.eltm16.priceColor }">{{ __("") }}{{ items.ItemSalePrice
}}</label><label class="del-price" v-if="items.selectType == 14">{{ __("") }}{{ items.MarketPice
}}</label><label class="del-price" v-if="items.selectType == 14">{{ __("") }}{{ items.MarketPice
}}</label><label class="tip" v-if="items.selectType != 14">{{ items.UserLimit }}{{ __("人团")
}}</label>
</view>
@ -688,7 +687,7 @@
<view class="activity-price" v-if="
item.eltm16.isShowPrice == null || item.eltm16.isShowPrice
"><label class="price" :style="{ color: item.eltm16.priceColor }">{{ __("") }}{{ items.ItemSalePrice
}}</label></view>
}}</label></view>
<view class="activity-desc" v-if="item.eltm16.isShowNum">{{ __("已有") }}{{ items.OrderCount }} {{
__("人参加") }}
</view>
@ -736,7 +735,7 @@
<view class="activity-price" v-if="
item.eltm16.isShowPrice == null || item.eltm16.isShowPrice
"><label class="price" :style="{ color: item.eltm16.priceColor }">{{ __("") }}{{ items.ItemSalePrice
}}</label><label class="del-price" v-if="items.selectType == 14">{{ __("") }}{{ items.MarketPice
}}</label><label class="del-price" v-if="items.selectType == 14">{{ __("") }}{{ items.MarketPice
}}</label>
<view class="activity-btn" :style="{
backgroundColor: item.eltm16.btnBgColor,
@ -786,7 +785,7 @@
<view class="activity-price" v-if="
item.eltm16.isShowPrice == null || item.eltm16.isShowPrice
"><label class="price" :style="{ color: item.eltm16.priceColor }">{{ __("") }}{{ items.ItemSalePrice
}}</label><label class="del-price" v-if="items.selectType == 14">{{ __("") }}{{ items.MarketPice
}}</label><label class="del-price" v-if="items.selectType == 14">{{ __("") }}{{ items.MarketPice
}}</label>
<view class="activity-btn" :style="{
backgroundColor: item.eltm16.btnBgColor,
@ -1050,8 +1049,20 @@ export default {
"getUserInfo",
"showCartNum",
]),
getGoodsStatus (item){
return item?.product_quantity == 0 || item?.item_quantity == 0 || typeof item.product_quantity == 'undefined' || typeof item.item_quantity == 'undefined'
},
async addCart(item) {
console.log('item-------', item);
if (item?.product_quantity == 0 || item?.item_quantity == 0 || typeof item.product_quantity == 'undefined' || typeof item.item_quantity == 'undefined') {
uni.showToast({
icon: 'error',
title: this.$.__("商品库存不足")
});
return false
}
var that = this;
var params = {
@ -1070,7 +1081,7 @@ export default {
that.$.alert(that.__("添加购物车成功"), function () { }, 400);
} else {
uni.showToast({
title: "亲~商品没有库存啦!",
title: "商品库存不足",
icon: "error",
duration: 500,
});
@ -1497,17 +1508,21 @@ uni-page-body {
padding-bottom: 60rpx;
}
.activity-info{
.activity-info {
position: relative;
}
.btn_addcard{
.btn_addcard {
position: absolute;
right: 0;
bottom: 14rpx;
width: 40rpx;
height: 40rpx;
background: url(https://media-mall-prod-1259811287.cos.ap-guangzhou.myqcloud.com/static/xcxfile/appicon/pc1.png) center no-repeat;
background-size: cover;
width: 40rpx;
height: 40rpx;
background: url(https://media-mall-prod-1259811287.cos.ap-guangzhou.myqcloud.com/static/xcxfile/appicon/pc1.png) center no-repeat;
background-size: cover;
}
.disable {
filter: grayscale(1);
}
</style>

View File

@ -1978,8 +1978,8 @@ export default {
width: 100%;
position: fixed;
bottom: 0;
bottom: constant(safe-area-inset-bottom);
bottom: env(safe-area-inset-bottom);
padding-bottom: constant(safe-area-inset-bottom);
padding-bottom: env(safe-area-inset-bottom);
left: 0;
background-color: #fff;
border-top: 0rpx solid #e3e3e3;

View File

@ -428,6 +428,122 @@
</block>
</view>
</block>
<view class="m-scroll-box" v-if="loadStoreConfigComplete && commonTPL.TemplateKey == 'shopdiy'">
<view class="m-tab all_shop_tab">
<view class="m-navbar">
<view class="m-navbar-item" :class="[
'm-navbar-item',
commonTPL.post.orderby == 'product_sale_num'
? 'm-navbar-item-on'
: '',
]" @click="clickSortBySaleNum">
{{ __("销量") }}
</view>
<view class="m-navbar-item" :class="[
'm-navbar-item',
commonTPL.post.orderby == 'product_add_time'
? 'm-navbar-item-on'
: '',
]" @click="clickNewpd">
{{ __("新品") }}
</view>
<view class="m-navbar-item" :class="[
'm-navbar-item',
commonTPL.post.orderby == 'product_unit_price'
? 'm-navbar-item-on'
: '',
]" @click="clickSortByPrice">
<label class="m-sort">
{{ __("价格") }}
<image :src="'https://media-mall-prod-1259811287.cos.ap-guangzhou.myqcloud.com/static/xcxfile/appicon/images/' +
(commonTPL.sort == 1 ? 'sort-desc' : 'sort-asc') +
'.png'
" />
</label>
</view>
</view>
</view>
<view :class="[
'm-product-list',
commonTPL.viewtype == 1 ? 'fadeIn animated m-listv' : '',
]">
<view v-for="(item, i) in commonTPL.pdlist" :key="i" @click="goShopDetail('/pages/product/detail?is_store_flag=' +
commonTPL.isStoreFlag +
'&pid=' +
item.id)" class="m-product-item" style="border-radius: 19rpx">
<view class="m-product-img">
<image :src="item.ProductPic" mode="aspectFill" style="border-radius: 19rpx" />
</view>
<view class="m-product-info">
<view class="m-product-name">
<label>{{ item.SalesName }}</label>
</view>
<view class="m-product-price">
<block v-if="item.ItemSalePrice">
<label>{{ __("¥")
}}{{ number_format(item.ItemSalePrice, 2) }}</label>
</block>
<view @click.stop="addCart(item, $event)">
<uni-icons type="plus-filled" size="20" :color="item.product_quantity == 0 ? '#666' : '#fe411b'"></uni-icons>
</view>
<block v-if="item.product_unit_points">
<label style="margin: 0rpx 10rpx">+</label><label style="font-size: 32rpx">{{
number_format(item.product_unit_points)
}}</label>
<label>{{ __("积分") }}</label>
</block>
<block v-if="item.product_unit_sp">
<label style="margin: 0rpx 10rpx">+</label><label style="font-size: 32rpx">{{
item.product_unit_sp
}}</label>
<label>{{ __("众宝") }}</label>
</block>
</view>
</view>
</view>
</view>
<view class="u-top-default">
<view class="u-view" @click="onViewType">
<label :class="[
'iconfont zc',
commonTPL.viewtype == 1
? 'zc-viewlist'
: 'zc-viewgallery',
]"></label>
</view>
<view class="u-back hide" @click="retruntop">
<label class="iconfont icon-fanhuidingbu"></label>
</view>
</view>
<view class="m-loading-box">
<block v-if="commonTPL.ispage">
<view class="u-loadmore">
<label class="u-loading"></label>
<text class="u-loadmore-tips">{{ __("正在加载") }}</text>
</view>
</block>
<block v-else>
<view class="u-loadmore u-loadmore-line">
<text class="u-loadmore-tips">{{
__("没有更多数据啦!")
}}</text>
</view>
</block>
</view>
</view>
<uni-icons
v-if="loadStoreConfigComplete && commonTPL.TemplateKey == 'shopdiy'"
type="arrowup"
size="24"
class="back-to-top"
:class="{ 'show': showBackTop }"
@click="scrollToTop"
></uni-icons>
</view>
</view>
@ -560,7 +676,9 @@ export default {
loadStoreInfoComplete: false, //
loadStoreConfigComplete: false, //
loadStoreCategoryComplete: false, //
isRest:true
isRest:true,
showBackTop: false,
scrollThreshold: 600
};
},
computed: mapState([
@ -628,7 +746,9 @@ export default {
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () { },
onReachBottom: function () {
this.scrollbottom()
},
/**
* 用户点击右上角分享
@ -669,7 +789,10 @@ export default {
/**
* 页面滚动触发事件的处理函数
*/
onPageScroll: function () { },
onPageScroll: function (e) {
const scrollTop = e.scrollTop;
this.showBackTop = scrollTop >= this.scrollThreshold;
},
methods: {
...mapMutations([
@ -679,6 +802,14 @@ export default {
"getStoreInfo",
]),
//
scrollToTop() {
uni.pageScrollTo({
scrollTop: 0,
duration: 300
});
},
goShopDetail(url) {
this.$.gopage(url)
},
@ -693,6 +824,14 @@ export default {
SKU_Id: item.item_id,
};
if(item?.product_quantity == 0){
uni.showToast({
icon: 'error',
title: this.$.__("商品库存不足")
});
return false
}
await this.$store.dispatch(`addCart`, {
params: params,
callback: (data, status, msg, code) => {
@ -1650,4 +1789,36 @@ export default {
.u-top-default{
bottom: 150px;
}
.all_shop_tab{
position: sticky;
top: 0;
z-index: 100;
border-bottom: 1rpx solid #eee;
}
.back-to-top {
position: fixed;
top: 70%;
transform: translateY(-70%);
right: 20rpx;
width: 80rpx;
height: 80rpx;
text-align: center;
border-radius: 50%;
background-color: #fff;
color: #fff;
box-shadow: 0 4rpx 10rpx rgba(0, 0, 0, 0.1);
opacity: 0;
transition: opacity 0.3s ease;
z-index: 98;
pointer-events: none;
&.show {
opacity: 1;
pointer-events: auto;
}
}
</style>

View File

@ -972,8 +972,12 @@ const store = new Vuex.Store({
provider.callback && provider.callback(data, status, msg, code);
} else {
uni.showModal({
title: '友情提示',
content: msg
});
// $.alert(msg);
$.alert('点击太快了');
// $.alert('点击太快了');
}
},
fail: (err) => {