diff --git a/.vscode/settings.json b/.vscode/settings.json index f8fa38c..73891e1 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -1,8 +1,8 @@ { "editor.formatOnSave": true, "editor.codeActionsOnSave": { - "source.fixAll.eslint": true, - "source.organizeImports": true + "source.fixAll.eslint": "explicit", + "source.organizeImports": "explicit" }, "editor.defaultFormatter": "esbenp.prettier-vscode", "[vue]": { diff --git a/components/area-product-list/index.vue b/components/area-product-list/index.vue index 11f4cd7..4965140 100644 --- a/components/area-product-list/index.vue +++ b/components/area-product-list/index.vue @@ -108,7 +108,6 @@ export default { }, handleProductClick(item) { // 商品点击事件,可根据需求实现跳转或其他逻辑 - console.log(item, '....ite?') this.$emit('product-click', item) }, handleAddToCart(item) { diff --git a/components/area-product-list/special-area-wrapper.vue b/components/area-product-list/special-area-wrapper.vue index de8d889..e7c8329 100644 --- a/components/area-product-list/special-area-wrapper.vue +++ b/components/area-product-list/special-area-wrapper.vue @@ -6,6 +6,7 @@ @@ -15,6 +16,7 @@ @@ -24,6 +26,7 @@ @@ -33,6 +36,7 @@ @@ -94,6 +98,11 @@ export default { } }) }, + redirectList(item) { + uni.navigateTo({ + url: `/pages/specialArea/list?specialArea=${item.specialArea}&id=${item.pkId}`, + }) + }, }, } diff --git a/components/cartBtmList.vue b/components/cartBtmList.vue index 9ec480d..66d8e08 100644 --- a/components/cartBtmList.vue +++ b/components/cartBtmList.vue @@ -152,6 +152,13 @@ diff --git a/pages/specialArea/list.vue b/pages/specialArea/list.vue index f01f1fc..dbcb3f6 100644 --- a/pages/specialArea/list.vue +++ b/pages/specialArea/list.vue @@ -10,13 +10,6 @@ {{ titLabel }} - - - - - - - 积分可抵扣:{{ item.deductMoney | numberToCurrency }} - - 业绩:{{ item.waresAchieve | numberToCurrency }} - BV:{{ item.assAchieve | numberToCurrency }} @@ -181,6 +168,15 @@ import { mapGetters, mapActions } from 'vuex' import * as api from '@/config/goods' import clTabbar from '@/components/cl-tabbar.vue' import selSpaceGoods from '@/components/selSpaceGoods.vue' +import { + REGIEST_AREA, + UPGRADE_AREA, + REPURCHASE_AREA, + REISSUE_AREA, +} from '@/util/specialAreaMap' +import { MEMBER_SIGN } from '@/util/common' +import areaProductList from '@/components/area-product-list/index.vue' +import { getAreaGoods } from '@/config/special-area' export default { components: { @@ -221,13 +217,13 @@ export default { } }, onLoad(options) { - if (JSON.parse(options.children).length > 0) { + if (JSON.parse(options?.children || '[]').length > 0) { let arr = [] if (options.childArea) { this.specialArea = options.childArea // this.diff = 1 } else { - JSON.parse(options.children).forEach(item => { + JSON.parse(options?.children || '[]').forEach(item => { if (item.isShow) { arr.push(item.value) } @@ -242,40 +238,36 @@ export default { this.specialArea = options.specialArea } - this.titLabel = options.label - let tempArr = JSON.parse(options.children) - if (this.specialArea != 18) { - api.menuList().then(res => { - tempArr = tempArr.filter(item => - res.data.find(ctem => ctem.menuKey == item.name) - ) - this.itemChildren = tempArr - }) - } + // this.titLabel = options.label + // let tempArr = JSON.parse(options?.children || '[]') + // if (this.specialArea != 18) { + // api.menuList().then(res => { + // tempArr = tempArr.filter(item => + // res.data.find(ctem => ctem.menuKey == item.name) + // ) + // this.itemChildren = tempArr + // }) + // } // 修改标题 + const areaMap = { + [REGIEST_AREA.id]: REGIEST_AREA.name, + [UPGRADE_AREA.id]: UPGRADE_AREA.name, + [REPURCHASE_AREA.id]: REPURCHASE_AREA.name, + [REISSUE_AREA.id]: REISSUE_AREA.name, + } + this.titLabel = areaMap[this.specialArea] uni.setNavigationBarTitle({ title: this.titLabel, - success: () => {}, + success: () => { + console.log(title) + }, }) // 获取一级分类并获取商品列表 // this.getClassIfy() this.userInfo = uni.getStorageSync('User') - console.log( - '%c [ this.userInfo ]-242', - 'font-size:13px; background:#cb38d2; color:#ff7cff;', - this.userInfo - ) - if (this.specialArea == 1) { - if (uni.getStorageSync('pkCountry')) { - this.pkCountry = uni.getStorageSync('pkCountry') - } else { - this.pkCountry = this.userInfo.pkSettleCountry - uni.setStorageSync('pkCountry', this.pkCountry + '') - } - } else { - this.pkCountry = this.userInfo.pkSettleCountry - } + + this.pkCountry = this.userInfo.pkCountry || 1 this.setSpecial({ value: this.specialArea, }) @@ -299,7 +291,6 @@ export default { this.setSmallCarLength(0) }, beforeDestroy() { - console.log('beforeDestroy........?') this.setSmallCarLength(0) }, methods: { @@ -342,18 +333,8 @@ export default { }) }, setSpecial(item) { - if (item.value == 21) { - // uni.navigateTo({ - // url: - // '/pages/specialArea/haIndex?label=' + - // this.titLabel + - // '&specialArea=21&children=' + - // JSON.stringify(this.itemChildren), - // }) - } else { - this.specialArea = item.value - this.getClassIfy() - } + this.specialArea = item.value + this.getClassIfy() }, addCar(item) { let carList = { @@ -363,29 +344,20 @@ export default { waresCode: item.waresCode, productGroup: item.productGroup, } - if ( - item.isMakerGift == 2 && - (item.specialArea == 1 || item.specialArea == 3) - ) { - this.$refs.selSpaceGoods.getData(carList) - } else { - api.addShopping(carList).then(res => { - if (res.code == 200) { - uni.showToast({ - title: '购物车添加成功', - icon: 'success', - mask: true, + api.addShopping(carList).then(res => { + if (res.code == 200) { + uni.showToast({ + title: '购物车添加成功', + icon: 'success', + mask: true, + }) + setTimeout(() => { + this.$store.dispatch('getCarLength', this.specialArea).then(res => { + this.shopCarLength = res.data.smallCount }) - setTimeout(() => { - this.$store - .dispatch('getCarLength', this.specialArea) - .then(res => { - this.shopCarLength = res.data.smallCount - }) - }, 200) - } - }) - } + }, 200) + } + }) }, getCatLength() { this.$store.dispatch('getCarLength', this.specialArea).then(res => { @@ -429,37 +401,33 @@ export default { }) }, getAllGoods(id) { - api - .getAllGoods({ - pkCountry: this.pkCountry, - specialArea: Number(this.specialArea), - pkAreaClassify: id ? id : '', - }) - .then(res => { - this.goodList = res.data - this.goodList.forEach(item => { - if (item.waresName.length > 11) { - item.waresName = item.waresName.substring(0, 11) + '...' - } - }) + getAreaGoods({ + pkCountry: this.pkCountry, + specialArea: Number(this.specialArea), + pkAreaClassify: id ? id : '', + }).then(res => { + this.goodList = res.data || [] + this.goodList.forEach(item => { + if (item.waresName.length > 11) { + item.waresName = item.waresName.substring(0, 11) + '...' + } }) + }) }, getAllGoods1(id) { - api - .getAllGoods({ - pkCountry: this.pkCountry, - specialArea: this.specialArea, - waresName: this.waresName, - pkAreaClassify: id ? id : this.oneId, - }) - .then(res => { - this.goodList = res.data - this.goodList.forEach(item => { - if (item.waresName.length > 11) { - item.waresName = item.waresName.substring(0, 11) + '...' - } - }) + getAreaGoods({ + pkCountry: this.pkCountry, + specialArea: this.specialArea, + waresName: this.waresName, + pkAreaClassify: id ? id : this.oneId, + }).then(res => { + this.goodList = res.data + this.goodList.forEach(item => { + if (item.waresName.length > 11) { + item.waresName = item.waresName.substring(0, 11) + '...' + } }) + }) }, goDetails(item) { if (item.preSaleStatus != 3 && item.isSale != 1) {