diff --git a/components/cartData.vue b/components/cartData.vue index 3521934..274aa39 100644 --- a/components/cartData.vue +++ b/components/cartData.vue @@ -137,7 +137,7 @@ this.cartData = data this.setAllSelect() } else { - this.Post({},'/api/shopping/getShoppingList').then(res => { + this.Post({noForceLogin: true},'/api/shopping/getShoppingList').then(res => { if (res) { this.cartData = (res.data || []).map(v=>{return {...v, isSelected:selectedData.includes(v.specifications_id)}}) this.setAllSelect() diff --git a/static/js/request.js b/static/js/request.js index e65369d..17d364d 100644 --- a/static/js/request.js +++ b/static/js/request.js @@ -18,8 +18,8 @@ const getToken = () => { return store.state.user.userInfo.token; }; -// 定义错误处理函数 -const handleError = (res, reject) => { +// 定义错误处理函数 noForceLogin 不强制登录 +const handleError = (res, reject, noForceLogin) => { setTimeout(() => { uni.showToast({ title: res.data?.msg || res.msg, @@ -28,6 +28,7 @@ const handleError = (res, reject) => { reject(res); }, 0); if (res.data?.code === 401) { + if (noForceLogin) { return } store.commit('changeLoginPath'); } }; @@ -67,7 +68,7 @@ Vue.prototype.Post = (params = {}, apiurl) => { fail: (err) => { console.log('err', err); uni.hideLoading() - handleError(err, reject); + handleError(err, reject, params.noForceLogin); } }); }); diff --git a/subPackages/techan/index.vue b/subPackages/techan/index.vue index 61ac7a0..91dd487 100644 --- a/subPackages/techan/index.vue +++ b/subPackages/techan/index.vue @@ -4,44 +4,92 @@ - + -
+
+ + - - - - 味 | WEI - - - - - - - - - {{item.goods.title}} - - - {{item.goods.money/100}} + + + + + 暂无搜索结果 + + + + + + + + + {{item.goods.title}} + + + {{item.goods.money/100}} + {{item.goods.price/100}} + + + + + - - - + + + + + + + + {{item.goods.title}} + + + {{item.goods.money/100}} + {{item.goods.price/100}} + + + + + - - - - + + @@ -139,14 +187,13 @@ headImg: null, typeParam: [ - {id: 1, title: ''},{id: 1, title: ''},{id: 1, title: ''}, + {id: 60, title: ''},{id: 59, title: ''},{id: 60, title: ''}, {id: 1, title: ''},{id: 1, title: ''},{id: 1, title: ''}, {id: 1, title: ''},{id: 1, title: ''},{id: 1, title: ''}, {id: 1, title: ''},{id: 1, title: ''},{id: 1, title: ''}, {id: 1, title: ''},{id: 1, title: ''},{id: 1, title: ''}, ], typeIndex: 0, - list:[], finished: false, @@ -159,7 +206,8 @@ cartDataVueShow: false, searchText: '', - searchList: [] + searchList: [], + searchFinish: false, } }, onLoad(options) { @@ -178,10 +226,10 @@ this.height = sysInfo.statusBarHeight + 40 }, - changeType (typeName, value) { - if (this[typeName]!==value) { - this[typeName]=value - + changeType (item, i) { + if (this.typeIndex!== i) { + this.typeIndex=i + this.finished = false this.list = [] this.getList() } @@ -190,7 +238,7 @@ // 根据产品分类获取产品列表 getList(){ this.Post({ - tag_id: 60, + tag_id: this.typeParam[this.typeIndex].id, offset: this.list.length, limit: 10, },'/api/tag/getGoodsByTagId').then(res => { @@ -200,6 +248,11 @@ } }) }, + scrollLow () { + if (!this.finished) { + this.getList() + } + }, viewDetail(item) { // this.goOtherDetail(item) if(!item.link_type) { @@ -311,12 +364,21 @@ goCartOrder () { this.$refs.cartDataVueRef.goCartOrder() }, - + + + //搜索 + search () { + this.searchFinish = false + this.searchList = [] + // todo 请求 + this.searchList = [...this.list,...this.list,...this.list,...this.list] + }, }, onReachBottom() { - setTimeout(() => { - if (!this.finished) this.getList() - },1000) + if (!this.searchFinish) { + this.search() + } + console.log(1) } } @@ -357,6 +419,7 @@ padding-left: 14rpx; font-weight: 400; font-size: 24rpx; + color: #030000; } } @@ -452,16 +515,19 @@ font-size: 24rpx; } } - .buy-cart{ - width: 44rpx; - height: 44rpx; - image{ - width: 100%; - height: 100%; - } - } + } } +.buy-cart{ + width: 44rpx; + height: 44rpx; + color: #FFFFFF; + background: #74A5AA; + line-height: 44rpx; + font-size: 30rpx; + text-align: center; + border-radius: 50%; +} .btn-list { z-index: 99; @@ -676,5 +742,48 @@ } } - +.search-result{ + display: flex; + flex-direction: column; + width: 100%; + flex: 1; + flex-shrink: 0; + + .search-item{ + width: 337rpx; + box-shadow: 0rpx 0rpx 9rpx 0rpx rgba(153,153,153,0.33); + border-radius: 13rpx; + flex-shrink: 0; + margin-bottom: 20rpx; + height: fit-content; + image{ + width: 100%; + border-radius: 13rpx; + } + .search-container{ + padding: 20rpx; + .title{ + font-weight: 500; + font-size: 27rpx; + color: #000000; + } + .price{ + font-weight: 400; + font-size: 33rpx; + color: #D70000; + } + .price:before{ + content: "¥"; + font-size: 23rpx; + } + .oldPrice{ + font-weight: 400; + font-size: 21rpx; + color: #999999; + text-decoration-line: line-through; + padding-left: 12rpx; + } + } + } +}