diff --git a/.local.config.js b/.local.config.js
index 45a4eb2..5590cd8 100644
--- a/.local.config.js
+++ b/.local.config.js
@@ -119,10 +119,14 @@ const localDevConfig = ({
uniacid: 2485,
domain: 'https://xcx6.aigc-quickapp.com/',
},
+ '2821': { // 离型纸硅油纸
+ uniacid: 2821,
+ domain: 'https://xcx.aigc-quickapp.com/',
+ },
// })['5g-237']; // 商品分类,没有立即咨询文字
// })['5g-97']; // 大宗商品贸易,支持自定义字体大小、颜色
// })['5g-50']; // 燃气安全产品机器人,购物车无反应
-})['2482']; // 低空经济
+})['2821']; // 离型纸硅油纸
// })['2485']; // 验证电子表单前后端数据一致性
// })['5g-11']; // 数码
// })['5g-213']; // 选择要使用的环境配置
diff --git a/components-diy/diy-category-item.vue b/components-diy/diy-category-item.vue
index f7a5d29..b91076d 100644
--- a/components-diy/diy-category-item.vue
+++ b/components-diy/diy-category-item.vue
@@ -5,17 +5,44 @@
-
- {{ category.category_name }}
-
-
-
-
-
- {{ one.category_name }}
+
+
+
+ {{ one.category_name }}
+
+
+
+
+
+ {{ item.label_name }}
+
+
+
+ {{ isEnEnv ? item.en_goods_name : item.goods_name }}
+
+
+
+
+ {{ $lang('common.currencySymbol') }}
+ {{ parseFloat(showPrice(item)).toFixed(2).split('.')[0] }}
+ .{{ parseFloat(showPrice(item)).toFixed(2).split('.')[1] }}
+
+
+
+
+
+
+
+
+
+ {{ $lang('components-diy.diy-category.noCategory') }}
+
@@ -296,6 +323,10 @@ export default {
isList: {
type: Boolean,
default: false
+ },
+ lastSecondCategoryName: {
+ type: String,
+ default: ''
}
},
mixins: [DiyMinx],
@@ -316,13 +347,27 @@ export default {
scrollTop: 0,
loadType: '',
timeout: {},
- cartEditRepeat: false
+ cartEditRepeat: false,
+ selectedSecondCategory: null,
+ secondCategoryGoodsList: []
};
},
created() {
this.type = this.value.template == 1 ? 'category' : 'goods';
if (this.index == this.select && this.pageIndex == 0) this.getGoodsList();
this.loadType = this.value.goodsLevel == 1 && this.value.loadType == 'all' ? 'all' : 'part';
+ if (this.index == this.select && parseInt(this.value.level) == 2 && this.category.child_list && this.category.child_list.length > 0) {
+ let targetCategory = null;
+ if (this.lastSecondCategoryName) {
+ targetCategory = this.category.child_list.find(item => item.category_name === this.lastSecondCategoryName);
+ }
+ if (!targetCategory) {
+ targetCategory = this.category.child_list[0];
+ }
+ this.selectedSecondCategory = targetCategory.category_id;
+ this.secondCategoryGoodsList = [];
+ this.getSecondCategoryGoods(targetCategory.category_id);
+ }
},
mounted() {
setTimeout(() => {
@@ -332,6 +377,18 @@ export default {
if (data) this.contentWrapHeight = data.height;
}).exec();
}, 1000);
+ if (parseInt(this.value.level) == 2 && this.category.child_list && this.category.child_list.length > 0) {
+ let targetCategory = null;
+ if (this.lastSecondCategoryName) {
+ targetCategory = this.category.child_list.find(item => item.category_name === this.lastSecondCategoryName);
+ }
+ if (!targetCategory) {
+ targetCategory = this.category.child_list[0];
+ }
+ this.selectedSecondCategory = targetCategory.category_id;
+ this.secondCategoryGoodsList = [];
+ this.getSecondCategoryGoods(targetCategory.category_id);
+ }
},
watch: {
oneCategorySelect: function () {
@@ -360,6 +417,18 @@ export default {
} else if (this.loadType == 'part') {
this.scrollTop = -1;
}
+ if (parseInt(this.value.level) == 2 && this.category.child_list && this.category.child_list.length > 0) {
+ let targetCategory = null;
+ if (this.lastSecondCategoryName) {
+ targetCategory = this.category.child_list.find(item => item.category_name === this.lastSecondCategoryName);
+ }
+ if (!targetCategory) {
+ targetCategory = this.category.child_list[0];
+ }
+ this.selectedSecondCategory = targetCategory.category_id;
+ this.secondCategoryGoodsList = [];
+ this.getSecondCategoryGoods(targetCategory.category_id);
+ }
},
'globalStoreInfo.store_id': {
handler(nval, oval) {
@@ -739,6 +808,59 @@ export default {
if (!link) return;
this.$util.diyRedirectTo(JSON.parse(link));
},
+ selectSecondCategory(category) {
+ if (this.selectedSecondCategory === category.category_id) {
+ this.selectedSecondCategory = null;
+ this.secondCategoryGoodsList = [];
+ } else {
+ this.selectedSecondCategory = category.category_id;
+ this.secondCategoryGoodsList = [];
+ this.getSecondCategoryGoods(category.category_id);
+ this.$emit('saveSecondCategory', category.category_name);
+ }
+ },
+ getSecondCategoryGoods(categoryId) {
+ this.loading = true;
+ let order = '';
+ let sort = '';
+ if (this.value.sortWay) {
+ if (this.value.sortWay == 'default') {
+ order = '';
+ sort = '';
+ } else if (this.value.sortWay == 'sales') {
+ order = 'sale_num';
+ sort = 'desc';
+ } else if (this.value.sortWay == 'price') {
+ order = 'discount_price';
+ sort = 'desc';
+ } else if (this.value.sortWay == 'news') {
+ order = 'create_time';
+ sort = 'desc';
+ }
+ }
+ this.$api.sendRequest({
+ url: '/api/goodssku/pageByCategory',
+ data: {
+ page: 1,
+ page_size: this.pageSize,
+ category_id: categoryId,
+ order: order,
+ sort: sort
+ },
+ success: res => {
+ if (res.code == 0 && res.data) {
+ this.secondCategoryGoodsList = res.data.list || [];
+ this.secondCategoryGoodsList.forEach((item) => {
+ item.num = this.cartList['goods_' + item.goods_id] ? this.cartList['goods_' + item.goods_id].num : 0;
+ });
+ }
+ this.loading = false;
+ },
+ fail: () => {
+ this.loading = false;
+ }
+ });
+ },
//加载商品在购物车的总数量
loadGoodsCartNum(isRefresh = false) {
this.goodsList.forEach((item) => {
@@ -803,6 +925,58 @@ export default {
}
}
+.second-category-btns {
+ display: flex;
+ flex-wrap: wrap;
+ background: #fff;
+ margin: 0 20rpx;
+ border-radius: 10rpx;
+ padding: 20rpx;
+ gap: 16rpx;
+ margin-bottom: 20rpx;
+
+ .second-category-btn {
+ padding: 16rpx 32rpx;
+ background: #f5f5f5;
+ border-radius: 20rpx;
+ font-size: 26rpx;
+ color: #333;
+ cursor: pointer;
+ user-select: none;
+ z-index: 100;
+ position: relative;
+
+ &.selected {
+ background: var(--color-base-bg, #ff5000);
+ color: #fff;
+ }
+ }
+}
+
+.category-goods-list {
+ padding: 0 20rpx;
+ margin-bottom: 20rpx;
+}
+
+.category-goods-empty {
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ justify-content: center;
+ padding: 60rpx 0;
+
+ image {
+ width: 200rpx;
+ height: 200rpx;
+ margin-bottom: 20rpx;
+ }
+
+ .tips {
+ font-size: 26rpx;
+ color: #999;
+ }
+}
+
.category-list {
display: flex;
flex-wrap: wrap;
diff --git a/components-diy/diy-category.vue b/components-diy/diy-category.vue
index e6e01ce..330fd40 100644
--- a/components-diy/diy-category.vue
+++ b/components-diy/diy-category.vue
@@ -98,11 +98,12 @@
refresher-default-style="none" :refresher-triggered="triggered" @refresherrefresh="onRefresh"
@refresherrestore="onRestore">
+ :id="'category-' + index" v-if="select == index">
+ @loadfinish="getHeightArea" @saveSecondCategory="saveSecondCategoryName">
{{ $lang('components-diy.diy-category.reachedBottom') }}
@@ -194,7 +195,8 @@ export default {
loadType: '',
templateFourData: [],
isList: false,
- lang: uni.getStorageSync("lang")//en-us 英文
+ lang: uni.getStorageSync("lang"),
+ lastSecondCategoryName: ''
};
},
created() {
@@ -373,9 +375,11 @@ export default {
if (index >= this.categoryTree.length) return;
this.select = index;
this.categoryId = 'category-' + index;
- // 阻止切换分类之后滚动事件也立即执行
this.scrollLock = true;
},
+ saveSecondCategoryName(name) {
+ this.lastSecondCategoryName = name;
+ },
touchStart() {
this.scrollLock = false;
},