diff --git a/mobile-web/src/api/product.js b/mobile-web/src/api/product.js index 8813dda5f..22e77135e 100644 --- a/mobile-web/src/api/product.js +++ b/mobile-web/src/api/product.js @@ -8,4 +8,16 @@ export function getProductCategoryList(pid) { pid } }); +} + +export function getProductSpuPage(cid, pageNo, pageSize) { + return request({ + url: 'product-api/users/spu/page', + method: 'get', + params: { + cid, + pageNo: pageNo || 1, + pageSize: pageSize || 10, + } + }); } \ No newline at end of file diff --git a/mobile-web/src/components/common/productcard.vue b/mobile-web/src/components/common/productcard.vue index 3e8084d30..131b8d3e2 100644 --- a/mobile-web/src/components/common/productcard.vue +++ b/mobile-web/src/components/common/productcard.vue @@ -1,106 +1,123 @@ diff --git a/mobile-web/src/config/router.js b/mobile-web/src/config/router.js index 934463d62..285fff4bb 100644 --- a/mobile-web/src/config/router.js +++ b/mobile-web/src/config/router.js @@ -151,7 +151,14 @@ const routes = [ } }, { - path: '/search', + path: '/product/search', + component: () => import('../page/product/search'), + meta: { + title: '商品搜索' + } + }, + { + path: '/products/list', component: () => import('../page/product/list'), meta: { title: '商品列表' diff --git a/mobile-web/src/page/category/index.vue b/mobile-web/src/page/category/index.vue index 1d3282821..b02a17997 100644 --- a/mobile-web/src/page/category/index.vue +++ b/mobile-web/src/page/category/index.vue @@ -66,10 +66,10 @@
  • - + {{ category.name }} - +
  • @@ -96,6 +96,7 @@ export default { rootCategories: [], childCategories: [], activeKey: 0, + activeCategory: {}, // 选中的分类 fullHeight: document.documentElement.clientHeight - 93, fullWidth: document.documentElement.clientWidth - 99 }; @@ -113,7 +114,8 @@ export default { this.activeKey = key; // 读取子节点的分类 if (this.rootCategories.length > key) { - let response = getProductCategoryList(this.rootCategories[key].id); + this.activeCategory = this.rootCategories[key]; + let response = getProductCategoryList(this.activeCategory.id); response.then(data => { this.childCategories = data; }); @@ -129,6 +131,7 @@ export default { this.rootCategories = data; // 获得首个根节点的分类 if (data && data.length > 0) { + this.activeCategory = data[0]; let response = getProductCategoryList(data[0].id); response.then(data => { this.childCategories = data; diff --git a/mobile-web/src/page/product/list.vue b/mobile-web/src/page/product/list.vue index 53757f628..e86c9364a 100644 --- a/mobile-web/src/page/product/list.vue +++ b/mobile-web/src/page/product/list.vue @@ -1,167 +1,12 @@ @@ -254,151 +84,4 @@ export default { height: 34px; } } -.filterbar { - font-size: 14px; - position: relative; - ul { - width: 100%; - height: 40px; - } - li { - color: #999; - width: 25%; - float: left; - text-align: center; - height: 40px; - line-height: 40px; - border-bottom: 1px solid #eee; - i { - font-size: 12px; - margin-left: 2px; - } - .down { - -webkit-transform: rotate(90deg); - transform: rotate(90deg); - } - } - .selected { - color: #e93b3d; - } - .show { - .down { - -webkit-transform: rotate(-90deg); - transform: rotate(-90deg); - } - } - .item_options { - width: 100%; - position: absolute; - top: 41px; - background: #fff; - display: none; - z-index: 1; - li { - width: 100%; - text-align: left; - padding-left: 10px; - } - } - - .item_options.show { - display: block; - } - .filterlayer { - width: 85%; - height: 100%; - background-color: #f7f7f7; - &_bottom { - &_buttons { - display: -webkit-box; - display: -webkit-flex; - display: flex; - z-index: 10; - position: absolute; - bottom: 0; - left: 0; - right: 0; - - .cancel { - color: #333; - background-color: #fff; - box-shadow: 0 -1px 2px 0 rgba(0, 0, 0, 0.07); - } - .confirm { - color: #fff; - background-color: #e93b3d; - } - } - &_button { - -webkit-box-flex: 1; - -webkit-flex: 1; - flex: 1; - font-size: 16px; - height: 49px; - line-height: 49px; - text-align: center; - } - } - ul { - height: auto; - background: #fff; - margin-bottom: 15px; - } - li { - width: 100%; - text-align: left; - height: auto; - line-height: initial; - .van-cell{ - font-size: 16px; - } - .big { - height: 25px; - max-width: 250px; - overflow: hidden; - font-size: 16px; - color: #333; - text-overflow: ellipsis; - margin-left: 10px; - } - } - .filterInner{ - overflow-y: scroll; - max-height: 100%; - .van-button{ - height: 40px; - margin-bottom: 15px; - line-height: 40px; - } - } - .tags_selection { - font-size: 14px; - text-align: center; - background-color: #fff; - position: relative; - margin: 0; - padding: 10px 0 0 10px; - .option { - box-sizing: border-box; - float: left; - width: 33.33%; - padding-right: 10px; - height: 30px; - line-height: 30px; - margin-bottom: 10px; - a { - position: relative; - display: block; - padding: 0 5px; - color: #666; - background-color: #f7f7f7; - border-radius: 4px; - overflow: hidden; - text-overflow: ellipsis; - height: 30px; - } - } - } - } -} diff --git a/mobile-web/src/page/product/search.vue b/mobile-web/src/page/product/search.vue new file mode 100644 index 000000000..53757f628 --- /dev/null +++ b/mobile-web/src/page/product/search.vue @@ -0,0 +1,404 @@ + + + + + diff --git a/product/product-application/src/main/java/cn/iocoder/mall/product/application/vo/users/UsersProductSpuVO.java b/product/product-application/src/main/java/cn/iocoder/mall/product/application/vo/users/UsersProductSpuVO.java index 70b4ff3c2..5f7e5d1fd 100644 --- a/product/product-application/src/main/java/cn/iocoder/mall/product/application/vo/users/UsersProductSpuVO.java +++ b/product/product-application/src/main/java/cn/iocoder/mall/product/application/vo/users/UsersProductSpuVO.java @@ -28,6 +28,12 @@ public class UsersProductSpuVO { * 目前的计算方式是,以 Sku 最小价格为准 */ private Integer price; + /** + * 库存数量 + * + * 目前的计算方式是,以 Sku 库存累加为准 + */ + private Integer quantity; public Integer getId() { return id; @@ -82,4 +88,13 @@ public class UsersProductSpuVO { this.price = price; return this; } + + public Integer getQuantity() { + return quantity; + } + + public UsersProductSpuVO setQuantity(Integer quantity) { + this.quantity = quantity; + return this; + } } \ No newline at end of file diff --git a/product/product-service-impl/src/main/java/cn/iocoder/mall/product/service/ProductSpuServiceImpl.java b/product/product-service-impl/src/main/java/cn/iocoder/mall/product/service/ProductSpuServiceImpl.java index d9bf5d858..cf394f9d1 100644 --- a/product/product-service-impl/src/main/java/cn/iocoder/mall/product/service/ProductSpuServiceImpl.java +++ b/product/product-service-impl/src/main/java/cn/iocoder/mall/product/service/ProductSpuServiceImpl.java @@ -202,7 +202,7 @@ public class ProductSpuServiceImpl implements ProductSpuService { public CommonResult getProductSpuPage(ProductSpuPageDTO productSpuPageDTO) { ProductSpuPageBO productSpuPage = new ProductSpuPageBO(); // 查询分页数据 - int offset = productSpuPageDTO.getPageNo() * productSpuPageDTO.getPageSize(); + int offset = (productSpuPageDTO.getPageNo() - 1) * productSpuPageDTO.getPageSize(); productSpuPage.setSpus(ProductSpuConvert.INSTANCE.convert(productSpuMapper.selectListByNameLikeOrderBySortAsc( productSpuPageDTO.getName(), productSpuPageDTO.getCid(), productSpuPageDTO.getVisible(), offset, productSpuPageDTO.getPageSize())));