diff --git a/api/model/index.js b/api/model/index.js index af0426c..1dc756f 100644 --- a/api/model/index.js +++ b/api/model/index.js @@ -46,6 +46,17 @@ const api = { url: '/index_common/getCategoryList', method: 'GET', }, + // 新查询分类以及商品数据接口 + getCategoryPidList: { + url: '/index_common/getCategoryPidList', + method: 'GET', + debounce : 250, + }, + // 查询一级分类接口 + getPidList: { + url: '/index_common/getCategoryPidList', + method: 'GET', + }, // 获取分类分页商品列表接口 getClassShopPageList: { url: '/index_common/getClassShopPageList', @@ -112,6 +123,14 @@ const api = { limit: 1000, showLoading: true, }, + // 取消订单 + cancelOrder: { + url: '/index_common/cancelOrder', + method: 'GET', + auth: true, + limit: 1000, + showLoading: true, + }, // 获取首页广告列表 getRiceProductList: { url: '/index_common/getRiceAdList', diff --git a/components/user/productList.vue b/components/user/productList.vue index f632e15..3a1e257 100644 --- a/components/user/productList.vue +++ b/components/user/productList.vue @@ -31,7 +31,9 @@ - + + + @@ -71,7 +73,6 @@ .list { display: flex; flex-wrap: wrap; - .item { position: relative; width: 345rpx; diff --git a/mixins/order.js b/mixins/order.js index cb3e6ca..5fbf4d4 100644 --- a/mixins/order.js +++ b/mixins/order.js @@ -51,5 +51,20 @@ export default { } }) }, + // 取消订单 + cancelOrder(item){ + uni.showModal({ + title: '确认取消订单吗?', + success : e => { + if(e.confirm){ + this.$api('cancelOrder', { + orderId : item.id, + }, res => { + this.getData() + }) + } + } + }) + }, } } \ No newline at end of file diff --git a/pages/index/category.vue b/pages/index/category.vue index 272cb07..b724dfd 100644 --- a/pages/index/category.vue +++ b/pages/index/category.vue @@ -9,23 +9,41 @@ - + + + + + + - + - + + + {{ item.name }} + + + + - + @@ -43,11 +61,13 @@ mapState } from 'vuex' import tabber from '@/components/base/tabbar.vue' + import productList from '@/components/user/productList.vue' export default { mixins: [mixinsList], components: { productItem, tabber, + productList, }, data() { return { @@ -65,21 +85,28 @@ if (search) { this.queryParams.title = search } - this.$store.commit('getCategoryList') + // this.$store.commit('getCategoryList') if(this.category.length > 0 && cid){ this.category.forEach((n, i) => { if(n.id == cid){ this.current = i } }) - this.queryParams.classId = cid + // this.queryParams.classId = cid }else if (this.category.length > 0) { - this.queryParams.classId = this.category[0].id + // this.queryParams.classId = this.category[0].id } }, methods: { change(e) { - this.queryParams.classId = this.category[e].id + // this.queryParams.classId = this.category[e].id + this.current = e + }, + search(){ + for(let i = 0;i < 10;i++){ + delete this.queryParams[i] + } + this.queryParams.pageSize = 10 this.getData() }, } @@ -126,6 +153,30 @@ .category { font-size: 30rpx; color: #333; + .category-title{ + position: relative; + display: flex; + justify-content: center; + align-items: center; + height: 120rpx; + + &::before, + &::after { + position: absolute; + top: 50%; + content: ''; + width: 10%; + border-top: 2rpx solid black; + } + + &::before { + left: 25%; + } + + &::after { + right: 25%; + } + } &::v-deep .uv-vtabs { width: 750rpx; diff --git a/pages/index/index.vue b/pages/index/index.vue index 2bf3ef8..659f5ed 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -19,11 +19,11 @@ - - {{item.title}} + {{item.name}} @@ -131,7 +131,8 @@ riceProductList: [], //体验产品 newList: [], //新闻列表 mixinsListApi: 'getClassShopPageList', - adList: [] + adList: [], + categoryList : [], } }, computed: { @@ -146,6 +147,7 @@ this.getBanner() this.getRiceNoticeList() this.getRiceIconList() + this.getCategoryList() this.getRiceAdList() if(uni.getStorageSync('token')){ this.$store.commit('getRiceInfo') @@ -164,6 +166,14 @@ }) this.keyword = '' }, + // 查询分类接口 + getCategoryList() { + this.$api('getPidList', res => { + if (res.code == 200) { + this.categoryList = res.result + } + }) + }, // 获取轮播图 getBanner() { diff --git a/pages/index/order.vue b/pages/index/order.vue index d275cfb..0a10a59 100644 --- a/pages/index/order.vue +++ b/pages/index/order.vue @@ -6,8 +6,8 @@ + :inactiveStyle="{color: 'rgba(255,255,255,.8)'}" lineHeight="8rpx" lineWidth="50rpx" :current="current" + @click="clickTabs"> @@ -55,6 +55,10 @@ 立即付款 + + 取消订单 + + 确认收货 @@ -65,6 +69,11 @@ + + + @@ -86,7 +95,7 @@ mixins: [mixinsList, mixinsOrder], components: { tabber, - customerServicePopup + customerServicePopup, }, computed: {}, data() { @@ -97,6 +106,12 @@ { name: '待付款' }, + { + name: '待发货' + }, + { + name: '待收货' + }, { name: '已完成' }, diff --git a/store/store.js b/store/store.js index d7cfd92..083273e 100644 --- a/store/store.js +++ b/store/store.js @@ -134,7 +134,7 @@ const store = new Vuex.Store({ }, // 查询分类接口 getCategoryList(state) { - api('getCategoryList', res => { + api('getCategoryPidList', res => { if (res.code == 200) { state.category = res.result }