Commit e035e66ffdae4064b4e7401324814e2b9c2b0851

Authored by LAPTOP-CNV4CMCJ\cheng
2 parents dcb3f1c8 d91655f3

Merge branch 'feature/1.8.0-uniapp' of https://gitee.com/zhijiantianya/ruoyi-vue…

…-pro into feature/1.8.0-uniapp
Showing 12 changed files with 172 additions and 164 deletions
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/property/vo/value/ProductPropertyValueUpdateReqVO.java
@@ -12,6 +12,6 @@ public class ProductPropertyValueUpdateReqVO extends ProductPropertyValueBaseVO @@ -12,6 +12,6 @@ public class ProductPropertyValueUpdateReqVO extends ProductPropertyValueBaseVO
12 12
13 @ApiModelProperty(value = "主键", required = true, example = "1024") 13 @ApiModelProperty(value = "主键", required = true, example = "1024")
14 @NotNull(message = "主键不能为空") 14 @NotNull(message = "主键不能为空")
15 - private Integer id; 15 + private Long id;
16 16
17 } 17 }
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/controller/admin/spu/vo/ProductSpuDetailRespVO.java
@@ -55,9 +55,8 @@ public class ProductSpuDetailRespVO extends ProductSpuBaseVO { @@ -55,9 +55,8 @@ public class ProductSpuDetailRespVO extends ProductSpuBaseVO {
55 55
56 } 56 }
57 57
58 - // TODO @luowenfeng: categoryIds => categoryId,example 也要改下哈  
59 - @ApiModelProperty(value = "分类 id 数组,一直递归到一级父节点", example = "[1,2,4]")  
60 - private Long categoryIds; 58 + @ApiModelProperty(value = "分类 id 数组,一直递归到一级父节点", example = "4")
  59 + private Long categoryId;
61 60
62 // TODO @芋艿:在瞅瞅~ 61 // TODO @芋艿:在瞅瞅~
63 @ApiModelProperty(value = "规格属性修改和详情展示组合", example = "[{\"propertyId\":2,\"name\":\"内存\",\"propertyValues\":[{\"v1\":11,\"v2\":\"64G\"},{\"v1\":10,\"v2\":\"32G\"}]},{\"propertyId\":3,\"name\":\"尺寸\",\"propertyValues\":[{\"v1\":16,\"v2\":\"6.1\"},{\"v1\":15,\"v2\":\"5.7\"}]}]") 62 @ApiModelProperty(value = "规格属性修改和详情展示组合", example = "[{\"propertyId\":2,\"name\":\"内存\",\"propertyValues\":[{\"v1\":11,\"v2\":\"64G\"},{\"v1\":10,\"v2\":\"32G\"}]},{\"propertyId\":3,\"name\":\"尺寸\",\"propertyValues\":[{\"v1\":16,\"v2\":\"6.1\"},{\"v1\":15,\"v2\":\"5.7\"}]}]")
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/category/ProductCategoryDO.java
@@ -64,6 +64,4 @@ public class ProductCategoryDO extends BaseDO { @@ -64,6 +64,4 @@ public class ProductCategoryDO extends BaseDO {
64 */ 64 */
65 private Integer status; 65 private Integer status;
66 66
67 - // TODO 芋艿:is_recommend 是否首页推荐:1-是;0-否  
68 -  
69 } 67 }
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/property/ProductPropertyMapper.java
@@ -25,10 +25,9 @@ public interface ProductPropertyMapper extends BaseMapperX<ProductPropertyDO> { @@ -25,10 +25,9 @@ public interface ProductPropertyMapper extends BaseMapperX<ProductPropertyDO> {
25 .orderByDesc(ProductPropertyDO::getId)); 25 .orderByDesc(ProductPropertyDO::getId));
26 } 26 }
27 27
28 - // TODO @luowenfeng: selectByNameLike,这样更清晰哈。  
29 default ProductPropertyDO selectByName(String name) { 28 default ProductPropertyDO selectByName(String name) {
30 return selectOne(new LambdaQueryWrapperX<ProductPropertyDO>() 29 return selectOne(new LambdaQueryWrapperX<ProductPropertyDO>()
31 - .likeIfPresent(ProductPropertyDO::getName, name)); 30 + .eqIfPresent(ProductPropertyDO::getName, name));
32 } 31 }
33 32
34 } 33 }
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/mysql/property/ProductPropertyValueMapper.java
@@ -17,8 +17,7 @@ import java.util.List; @@ -17,8 +17,7 @@ import java.util.List;
17 @Mapper 17 @Mapper
18 public interface ProductPropertyValueMapper extends BaseMapperX<ProductPropertyValueDO> { 18 public interface ProductPropertyValueMapper extends BaseMapperX<ProductPropertyValueDO> {
19 19
20 - // TODO @luowenfeng: selectListByPropertyId 是不是就可以啦  
21 - default List<ProductPropertyValueDO> selectListByPropertyValueListByPropertyId(List<Long> propertyIds) { 20 + default List<ProductPropertyValueDO> selectListByPropertyId(List<Long> propertyIds) {
22 return selectList(new LambdaQueryWrapperX<ProductPropertyValueDO>() 21 return selectList(new LambdaQueryWrapperX<ProductPropertyValueDO>()
23 .inIfPresent(ProductPropertyValueDO::getPropertyId, propertyIds)); 22 .inIfPresent(ProductPropertyValueDO::getPropertyId, propertyIds));
24 } 23 }
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/property/ProductPropertyServiceImpl.java
@@ -19,6 +19,7 @@ import javax.annotation.Resource; @@ -19,6 +19,7 @@ import javax.annotation.Resource;
19 import java.util.Collection; 19 import java.util.Collection;
20 import java.util.List; 20 import java.util.List;
21 import java.util.Map; 21 import java.util.Map;
  22 +import java.util.Objects;
22 23
23 import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; 24 import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
24 import static cn.iocoder.yudao.module.product.enums.ErrorCodeConstants.PROPERTY_EXISTS; 25 import static cn.iocoder.yudao.module.product.enums.ErrorCodeConstants.PROPERTY_EXISTS;
@@ -58,8 +59,8 @@ public class ProductPropertyServiceImpl implements ProductPropertyService { @@ -58,8 +59,8 @@ public class ProductPropertyServiceImpl implements ProductPropertyService {
58 public void updateProperty(ProductPropertyUpdateReqVO updateReqVO) { 59 public void updateProperty(ProductPropertyUpdateReqVO updateReqVO) {
59 // 校验存在 60 // 校验存在
60 this.validatePropertyExists(updateReqVO.getId()); 61 this.validatePropertyExists(updateReqVO.getId());
61 - // TODO @luowenfeng:如果是自己的情况下,名字相同也是 ok 的呀~  
62 - if (productPropertyMapper.selectByName(updateReqVO.getName()) != null) { 62 + ProductPropertyDO productPropertyDO = productPropertyMapper.selectByName(updateReqVO.getName());
  63 + if (productPropertyDO != null && !productPropertyDO.getId().equals(updateReqVO.getId())) {
63 throw exception(PROPERTY_EXISTS); 64 throw exception(PROPERTY_EXISTS);
64 } 65 }
65 // 更新 66 // 更新
@@ -97,10 +98,6 @@ public class ProductPropertyServiceImpl implements ProductPropertyService { @@ -97,10 +98,6 @@ public class ProductPropertyServiceImpl implements ProductPropertyService {
97 return ProductPropertyConvert.INSTANCE.convertPage(pageResult); 98 return ProductPropertyConvert.INSTANCE.convertPage(pageResult);
98 } 99 }
99 100
100 - private List<ProductPropertyValueDO> getPropertyValueListByPropertyId(List<Long> propertyIds) {  
101 - return productPropertyValueMapper.selectListByPropertyValueListByPropertyId(propertyIds);  
102 - }  
103 -  
104 @Override 101 @Override
105 public ProductPropertyRespVO getProperty(Long id) { 102 public ProductPropertyRespVO getProperty(Long id) {
106 ProductPropertyDO property = productPropertyMapper.selectById(id); 103 ProductPropertyDO property = productPropertyMapper.selectById(id);
@@ -117,7 +114,7 @@ public class ProductPropertyServiceImpl implements ProductPropertyService { @@ -117,7 +114,7 @@ public class ProductPropertyServiceImpl implements ProductPropertyService {
117 List<ProductPropertyRespVO> propertyList = getPropertyList(listReqVO); 114 List<ProductPropertyRespVO> propertyList = getPropertyList(listReqVO);
118 115
119 // 查询属性值 116 // 查询属性值
120 - List<ProductPropertyValueDO> valueDOList = productPropertyValueMapper.selectListByPropertyValueListByPropertyId(CollectionUtils.convertList(propertyList, ProductPropertyRespVO::getId)); 117 + List<ProductPropertyValueDO> valueDOList = productPropertyValueMapper.selectListByPropertyId(CollectionUtils.convertList(propertyList, ProductPropertyRespVO::getId));
121 Map<Long, List<ProductPropertyValueDO>> valueDOMap = CollectionUtils.convertMultiMap(valueDOList, ProductPropertyValueDO::getPropertyId); 118 Map<Long, List<ProductPropertyValueDO>> valueDOMap = CollectionUtils.convertMultiMap(valueDOList, ProductPropertyValueDO::getPropertyId);
122 return CollectionUtils.convertList(propertyList, m -> { 119 return CollectionUtils.convertList(propertyList, m -> {
123 ProductPropertyAndValueRespVO productPropertyAndValueRespVO = ProductPropertyConvert.INSTANCE.convert(m); 120 ProductPropertyAndValueRespVO productPropertyAndValueRespVO = ProductPropertyConvert.INSTANCE.convert(m);
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/property/ProductPropertyValueServiceImpl.java
@@ -14,6 +14,7 @@ import org.springframework.validation.annotation.Validated; @@ -14,6 +14,7 @@ import org.springframework.validation.annotation.Validated;
14 14
15 import javax.annotation.Resource; 15 import javax.annotation.Resource;
16 import java.util.List; 16 import java.util.List;
  17 +import java.util.Objects;
17 18
18 import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception; 19 import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
19 import static cn.iocoder.yudao.module.product.enums.ErrorCodeConstants.PROPERTY_VALUE_EXISTS; 20 import static cn.iocoder.yudao.module.product.enums.ErrorCodeConstants.PROPERTY_VALUE_EXISTS;
@@ -42,8 +43,8 @@ public class ProductPropertyValueServiceImpl implements ProductPropertyValueServ @@ -42,8 +43,8 @@ public class ProductPropertyValueServiceImpl implements ProductPropertyValueServ
42 43
43 @Override 44 @Override
44 public void updatePropertyValue(ProductPropertyValueUpdateReqVO updateReqVO) { 45 public void updatePropertyValue(ProductPropertyValueUpdateReqVO updateReqVO) {
45 - // TODO @luowenfeng:如果是自己的情况下,名字相同也是 ok 的呀~  
46 - if (productPropertyValueMapper.selectByName(updateReqVO.getPropertyId(), updateReqVO.getName()) != null) { 46 + ProductPropertyValueDO productPropertyValueDO = productPropertyValueMapper.selectByName(updateReqVO.getPropertyId(), updateReqVO.getName());
  47 + if (productPropertyValueDO != null && !productPropertyValueDO.getId().equals(updateReqVO.getId())) {
47 throw exception(PROPERTY_VALUE_EXISTS); 48 throw exception(PROPERTY_VALUE_EXISTS);
48 } 49 }
49 ProductPropertyValueDO convert = ProductPropertyValueConvert.INSTANCE.convert(updateReqVO); 50 ProductPropertyValueDO convert = ProductPropertyValueConvert.INSTANCE.convert(updateReqVO);
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/service/spu/ProductSpuServiceImpl.java
@@ -162,7 +162,6 @@ public class ProductSpuServiceImpl implements ProductSpuService { @@ -162,7 +162,6 @@ public class ProductSpuServiceImpl implements ProductSpuService {
162 }); 162 });
163 respVO.setProductPropertyViews(productPropertyViews); 163 respVO.setProductPropertyViews(productPropertyViews);
164 } 164 }
165 - respVO.setCategoryIds(respVO.getCategoryId());  
166 } 165 }
167 return respVO; 166 return respVO;
168 } 167 }
yudao-module-mall/yudao-module-product-biz/src/test/java/cn/iocoder/yudao/module/product/service/spu/ProductSpuServiceImplTest.java
1 package cn.iocoder.yudao.module.product.service.spu; 1 package cn.iocoder.yudao.module.product.service.spu;
2 2
  3 +import cn.hutool.core.date.DateUtil;
  4 +import cn.hutool.core.util.RandomUtil;
3 import cn.iocoder.yudao.framework.common.exception.ServiceException; 5 import cn.iocoder.yudao.framework.common.exception.ServiceException;
4 import cn.iocoder.yudao.framework.common.pojo.PageResult; 6 import cn.iocoder.yudao.framework.common.pojo.PageResult;
5 import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils; 7 import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
  8 +import cn.iocoder.yudao.framework.common.util.collection.SetUtils;
6 import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest; 9 import cn.iocoder.yudao.framework.test.core.ut.BaseDbUnitTest;
7 import cn.iocoder.yudao.module.product.controller.admin.property.vo.property.ProductPropertyRespVO; 10 import cn.iocoder.yudao.module.product.controller.admin.property.vo.property.ProductPropertyRespVO;
8 import cn.iocoder.yudao.module.product.controller.admin.property.vo.value.ProductPropertyValueRespVO; 11 import cn.iocoder.yudao.module.product.controller.admin.property.vo.value.ProductPropertyValueRespVO;
@@ -29,16 +32,16 @@ import org.springframework.boot.test.mock.mockito.MockBean; @@ -29,16 +32,16 @@ import org.springframework.boot.test.mock.mockito.MockBean;
29 import org.springframework.context.annotation.Import; 32 import org.springframework.context.annotation.Import;
30 33
31 import javax.annotation.Resource; 34 import javax.annotation.Resource;
32 -import java.util.ArrayList;  
33 -import java.util.List;  
34 -import java.util.Map; 35 +import java.util.*;
35 import java.util.stream.Collectors; 36 import java.util.stream.Collectors;
36 import java.util.stream.Stream; 37 import java.util.stream.Stream;
37 38
  39 +import static cn.iocoder.yudao.framework.common.util.object.ObjectUtils.cloneIgnoreId;
38 import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals; 40 import static cn.iocoder.yudao.framework.test.core.util.AssertUtils.assertPojoEquals;
39 import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomPojo; 41 import static cn.iocoder.yudao.framework.test.core.util.RandomUtils.randomPojo;
40 42
41 // TODO @芋艿:review 下单元测试 43 // TODO @芋艿:review 下单元测试
  44 +
42 /** 45 /**
43 * {@link ProductSpuServiceImpl} 的单元测试类 46 * {@link ProductSpuServiceImpl} 的单元测试类
44 * 47 *
@@ -69,6 +72,13 @@ public class ProductSpuServiceImplTest extends BaseDbUnitTest { @@ -69,6 +72,13 @@ public class ProductSpuServiceImplTest extends BaseDbUnitTest {
69 @MockBean 72 @MockBean
70 private ProductPropertyValueService productPropertyValueService; 73 private ProductPropertyValueService productPropertyValueService;
71 74
  75 + public String generateNo() {
  76 + return DateUtil.format(new Date(), "yyyyMMddHHmmss") + RandomUtil.randomInt(100000, 999999);
  77 + }
  78 +
  79 + public Long generateId() {
  80 + return RandomUtil.randomLong(100000, 999999);
  81 + }
72 82
73 @Test 83 @Test
74 public void testCreateSpu_success() { 84 public void testCreateSpu_success() {
@@ -208,35 +218,120 @@ public class ProductSpuServiceImplTest extends BaseDbUnitTest { @@ -208,35 +218,120 @@ public class ProductSpuServiceImplTest extends BaseDbUnitTest {
208 Assertions.assertIterableEquals(createReqVO, spuList); 218 Assertions.assertIterableEquals(createReqVO, spuList);
209 } 219 }
210 220
211 - // TODO @luowenfeng:单测要分情况;类似你这个,可以分 2 个单测;一个是有预存预警的;一个是没库存预警的;  
212 - // 然后,参考其它模块的 getPage 类型的方法的单测。  
213 @Test 221 @Test
214 - void getSpuPage() { 222 + void getSpuPage_alarmStock_empty() {
  223 + // 调用
  224 + ProductSpuPageReqVO productSpuPageReqVO = new ProductSpuPageReqVO();
  225 + productSpuPageReqVO.setAlarmStock(true);
  226 +
  227 + PageResult<ProductSpuRespVO> spuPage = productSpuService.getSpuPage(productSpuPageReqVO);
  228 +
  229 + PageResult<Object> result = PageResult.empty();
  230 + Assertions.assertIterableEquals(result.getList(), spuPage.getList());
  231 + Assertions.assertEquals(spuPage.getTotal(), result.getTotal());
  232 + }
  233 +
  234 + @Test
  235 + void getSpuPage_alarmStock() {
  236 + // mock 数据
  237 + Long brandId = generateId();
  238 + Long categoryId = generateId();
  239 + String code = generateNo();
  240 +
215 // 准备参数 241 // 准备参数
216 - ProductSpuDO createReqVO = randomPojo(ProductSpuDO.class); 242 + ProductSpuDO createReqVO = randomPojo(ProductSpuDO.class, o->{
  243 + o.setStatus(ProductSpuStatusEnum.ENABLE.getStatus());
  244 + o.setTotalStock(500);
  245 + o.setMinPrice(1);
  246 + o.setMaxPrice(50);
  247 + o.setMarketPrice(25);
  248 + o.setSpecType(ProductSpuSpecTypeEnum.RECYCLE.getType());
  249 + o.setBrandId(brandId);
  250 + o.setCategoryId(categoryId);
  251 + o.setClickCount(100);
  252 + o.setCode(code);
  253 + o.setDescription("测试商品");
  254 + o.setPicUrls(new ArrayList<>());
  255 + o.setName("测试");
  256 + o.setSalesCount(100);
  257 + o.setSellPoint("超级加倍");
  258 + o.setShowStock(true);
  259 + o.setVideoUrl("");
  260 + });
217 productSpuMapper.insert(createReqVO); 261 productSpuMapper.insert(createReqVO);
218 262
219 - ArrayList<ProductSkuDO> remindSpuIds = Lists.newArrayList(  
220 -// randomPojo(ProductSkuDO.class, o -> o.setSpuId(createReqVO.getId())),  
221 -// randomPojo(ProductSkuDO.class, o -> o.setSpuId(createReqVO.getId()))  
222 - ); 263 + Set<Long> alarmStockSpuIds = SetUtils.asSet(createReqVO.getId());
  264 +
  265 + List<ProductSkuDO> productSpuDOS = Arrays.asList(randomPojo(ProductSkuDO.class, o -> {
  266 + o.setSpuId(createReqVO.getId());
  267 + }), randomPojo(ProductSkuDO.class, o -> {
  268 + o.setSpuId(createReqVO.getId());
  269 + }));
223 270
224 - Mockito.when(productSkuService.getRemindSpuIds()).thenReturn(remindSpuIds); 271 + Mockito.when(productSkuService.getSkusByAlarmStock()).thenReturn(productSpuDOS);
225 272
226 // 调用 273 // 调用
227 ProductSpuPageReqVO productSpuPageReqVO = new ProductSpuPageReqVO(); 274 ProductSpuPageReqVO productSpuPageReqVO = new ProductSpuPageReqVO();
228 - productSpuPageReqVO.setTabStatus(2);  
229 - 275 + productSpuPageReqVO.setAlarmStock(true);
230 PageResult<ProductSpuRespVO> spuPage = productSpuService.getSpuPage(productSpuPageReqVO); 276 PageResult<ProductSpuRespVO> spuPage = productSpuService.getSpuPage(productSpuPageReqVO);
231 277
232 - ArrayList<Long> resultRemindSpuIds = new ArrayList<>();  
233 - resultRemindSpuIds.add(null);  
234 - PageResult<ProductSpuRespVO> result = ProductSpuConvert.INSTANCE.convertPage(productSpuMapper.selectPage(productSpuPageReqVO, resultRemindSpuIds)); 278 + PageResult<ProductSpuRespVO> result = ProductSpuConvert.INSTANCE.convertPage(productSpuMapper.selectPage(productSpuPageReqVO, alarmStockSpuIds));
235 Assertions.assertIterableEquals(result.getList(), spuPage.getList()); 279 Assertions.assertIterableEquals(result.getList(), spuPage.getList());
236 Assertions.assertEquals(spuPage.getTotal(), result.getTotal()); 280 Assertions.assertEquals(spuPage.getTotal(), result.getTotal());
237 } 281 }
238 282
239 @Test 283 @Test
  284 + void getSpuPage() {
  285 + // mock 数据
  286 + Long brandId = generateId();
  287 + Long categoryId = generateId();
  288 +
  289 + // 准备参数
  290 + ProductSpuDO createReqVO = randomPojo(ProductSpuDO.class, o->{
  291 + o.setStatus(ProductSpuStatusEnum.ENABLE.getStatus());
  292 + o.setTotalStock(1);
  293 + o.setMinPrice(1);
  294 + o.setMaxPrice(1);
  295 + o.setMarketPrice(1);
  296 + o.setSpecType(ProductSpuSpecTypeEnum.RECYCLE.getType());
  297 + o.setBrandId(brandId);
  298 + o.setCategoryId(categoryId);
  299 + o.setClickCount(1);
  300 + o.setCode(generateNo());
  301 + o.setDescription("测试商品");
  302 + o.setPicUrls(new ArrayList<>());
  303 + o.setName("测试");
  304 + o.setSalesCount(1);
  305 + o.setSellPoint("卖点");
  306 + o.setShowStock(true);
  307 + });
  308 +
  309 + // 准备参数
  310 + productSpuMapper.insert(createReqVO);
  311 + // 测试 status 不匹配
  312 + productSpuMapper.insert(cloneIgnoreId(createReqVO, o -> o.setStatus(ProductSpuStatusEnum.DISABLE.getStatus())));
  313 + productSpuMapper.insert(cloneIgnoreId(createReqVO, o -> o.setStatus(ProductSpuStatusEnum.RECYCLE.getStatus())));
  314 + // 测试 SpecType 不匹配
  315 + productSpuMapper.insert(cloneIgnoreId(createReqVO, o -> o.setSpecType(ProductSpuSpecTypeEnum.DISABLE.getType())));
  316 + // 测试 BrandId 不匹配
  317 + productSpuMapper.insert(cloneIgnoreId(createReqVO, o -> o.setBrandId(generateId())));
  318 + // 测试 CategoryId 不匹配
  319 + productSpuMapper.insert(cloneIgnoreId(createReqVO, o -> o.setCategoryId(generateId())));
  320 +
  321 + // 调用
  322 + ProductSpuPageReqVO productSpuPageReqVO = new ProductSpuPageReqVO();
  323 + productSpuPageReqVO.setAlarmStock(false);
  324 + productSpuPageReqVO.setBrandId(brandId);
  325 + productSpuPageReqVO.setStatus(ProductSpuStatusEnum.ENABLE.getStatus());
  326 + productSpuPageReqVO.setCategoryId(categoryId);
  327 +
  328 + PageResult<ProductSpuRespVO> spuPage = productSpuService.getSpuPage(productSpuPageReqVO);
  329 +
  330 + PageResult<ProductSpuRespVO> result = ProductSpuConvert.INSTANCE.convertPage(productSpuMapper.selectPage(productSpuPageReqVO, (Set<Long>) null));
  331 + Assertions.assertEquals(result, spuPage);
  332 + }
  333 +
  334 + @Test
240 void testGetSpuPage() { 335 void testGetSpuPage() {
241 // 准备参数 336 // 准备参数
242 ProductSpuDO createReqVO = randomPojo(ProductSpuDO.class, o -> { 337 ProductSpuDO createReqVO = randomPojo(ProductSpuDO.class, o -> {
@@ -244,13 +339,6 @@ public class ProductSpuServiceImplTest extends BaseDbUnitTest { @@ -244,13 +339,6 @@ public class ProductSpuServiceImplTest extends BaseDbUnitTest {
244 }); 339 });
245 productSpuMapper.insert(createReqVO); 340 productSpuMapper.insert(createReqVO);
246 341
247 - ArrayList<ProductSkuDO> remindSpuIds = Lists.newArrayList(  
248 -// randomPojo(ProductSkuDO.class, o -> o.setSpuId(createReqVO.getId())),  
249 -// randomPojo(ProductSkuDO.class, o -> o.setSpuId(createReqVO.getId()))  
250 - );  
251 -  
252 - Mockito.when(productSkuService.getRemindSpuIds()).thenReturn(remindSpuIds);  
253 -  
254 // 调用 342 // 调用
255 AppSpuPageReqVO appSpuPageReqVO = new AppSpuPageReqVO(); 343 AppSpuPageReqVO appSpuPageReqVO = new AppSpuPageReqVO();
256 appSpuPageReqVO.setCategoryId(2L); 344 appSpuPageReqVO.setCategoryId(2L);
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/dataobject/order/TradeOrderDO.java
@@ -2,7 +2,6 @@ package cn.iocoder.yudao.module.trade.dal.dataobject.order; @@ -2,7 +2,6 @@ package cn.iocoder.yudao.module.trade.dal.dataobject.order;
2 2
3 import cn.iocoder.yudao.framework.common.enums.TerminalEnum; 3 import cn.iocoder.yudao.framework.common.enums.TerminalEnum;
4 import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO; 4 import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
5 -import cn.iocoder.yudao.module.product.enums.delivery.DeliveryTypeEnum;  
6 import cn.iocoder.yudao.module.trade.enums.order.TradeOrderCancelTypeEnum; 5 import cn.iocoder.yudao.module.trade.enums.order.TradeOrderCancelTypeEnum;
7 import cn.iocoder.yudao.module.trade.enums.order.TradeOrderRefundStatusEnum; 6 import cn.iocoder.yudao.module.trade.enums.order.TradeOrderRefundStatusEnum;
8 import cn.iocoder.yudao.module.trade.enums.order.TradeOrderStatusEnum; 7 import cn.iocoder.yudao.module.trade.enums.order.TradeOrderStatusEnum;
@@ -38,7 +37,7 @@ public class TradeOrderDO extends BaseDO { @@ -38,7 +37,7 @@ public class TradeOrderDO extends BaseDO {
38 * 37 *
39 * 例如说,1146347329394184195 38 * 例如说,1146347329394184195
40 */ 39 */
41 - private String sn; 40 + private String no;
42 /** 41 /**
43 * 订单类型 42 * 订单类型
44 * 43 *
@@ -113,44 +112,38 @@ public class TradeOrderDO extends BaseDO { @@ -113,44 +112,38 @@ public class TradeOrderDO extends BaseDO {
113 // 价格文档 - 京东到家:https://openo2o.jddj.com/api/getApiDetail/182/4d1494c5e7ac4679bfdaaed950c5bc7f.htm 112 // 价格文档 - 京东到家:https://openo2o.jddj.com/api/getApiDetail/182/4d1494c5e7ac4679bfdaaed950c5bc7f.htm
114 // 价格文档 - 有赞:https://doc.youzanyun.com/detail/API/0/906 113 // 价格文档 - 有赞:https://doc.youzanyun.com/detail/API/0/906
115 114
116 -// TODO promotion_details(订单优惠信息明细,商品和订单级优惠一般都在里面)  
117 -  
118 /** 115 /**
119 * 商品原价(总),单位:分 116 * 商品原价(总),单位:分
120 * 117 *
121 * 基于 {@link TradeOrderItemDO#getTotalOriginalPrice()} 求和 118 * 基于 {@link TradeOrderItemDO#getTotalOriginalPrice()} 求和
122 */ 119 */
123 - // niu - goods_money;  
124 - private Integer skuOriginalPrice;  
125 - /**  
126 - * 商品优惠(总),单位:分  
127 - *  
128 - * 基于 {@link TradeOrderItemDO#getTotalPromotionPrice()} 求和  
129 - */  
130 - private Integer skuPromotionPrice; 120 + private Integer originalPrice;
131 /** 121 /**
132 * 订单优惠(总),单位:分 122 * 订单优惠(总),单位:分
133 * 123 *
134 - * 例如说:满减折扣;不包括优惠劵、商品优惠 124 + * 例如说:满减折扣;不包括优惠劵、商品优惠(TODO)
135 */ 125 */
136 - // niu - promotion_money;taobao - discount_fee(主订单优惠)  
137 - private Integer orderPromotionPrice; 126 + private Integer promotionPrice;
138 /** 127 /**
139 * 运费金额,单位:分 128 * 运费金额,单位:分
140 */ 129 */
141 - // niu - delivery_money;taobao - post_fee(订单邮费)  
142 private Integer deliveryPrice; 130 private Integer deliveryPrice;
143 - // TODO 芋艿:taobao 的:trade.adjust_fee/order.adjust_fee(调整金额,如:卖家手动修改订单价格,官方数据修复等等) 131 + /**
  132 + * 订单调价(总),单位:分
  133 + *
  134 + * 正数,加价;负数,减价
  135 + */
  136 + private Integer adjustPrice;
144 /** 137 /**
145 * 应付金额(总),单位:分 138 * 应付金额(总),单位:分
146 * 139 *
147 - * = {@link #skuOriginalPrice} 140 + * = {@link #originalPrice}
148 * + {@link #deliveryPrice} 141 * + {@link #deliveryPrice}
149 - * - {@link #skuPromotionPrice}  
150 - * - {@link #orderPromotionPrice} 142 + * + {@link #adjustPrice}
  143 + * - {@link #promotionPrice}
  144 + * - {@link #couponPrice}
  145 + * - {@link #pointPrice}
151 */ 146 */
152 - // niu - pay_money;taobao - payment(主订单实付金额) | trade.total_fee(主订单应付金额,参考使用);  
153 -// * - {@link #couponPrice} // TODO 芋艿:靠营销表记录  
154 private Integer payPrice; 147 private Integer payPrice;
155 /** 148 /**
156 * 支付订单编号 149 * 支付订单编号
@@ -167,21 +160,6 @@ public class TradeOrderDO extends BaseDO { @@ -167,21 +160,6 @@ public class TradeOrderDO extends BaseDO {
167 160
168 // ========== 收件 + 物流基本信息 ========== 161 // ========== 收件 + 物流基本信息 ==========
169 /** 162 /**
170 - * 配送方式  
171 - * 会员用户下单时,选择的配送方式  
172 - *  
173 - * 枚举 {@link DeliveryTypeEnum}  
174 - */  
175 - private Integer deliveryType;  
176 - /**  
177 - * 实际的配送方式  
178 - * 管理后台发货时,选择的配送方式  
179 - *  
180 - * 0 - 无需物流  
181 - * 枚举 {@link DeliveryTypeEnum}  
182 - */  
183 - private Integer actualDeliveryType; // like - shipping_status;  
184 - /**  
185 * 配置模板的编号 163 * 配置模板的编号
186 * 164 *
187 * 关联 DeliveryTemplateDO 的 id 编号 165 * 关联 DeliveryTemplateDO 的 id 编号
@@ -247,58 +225,13 @@ public class TradeOrderDO extends BaseDO { @@ -247,58 +225,13 @@ public class TradeOrderDO extends BaseDO {
247 * 优惠劵编号 225 * 优惠劵编号
248 */ 226 */
249 private Long couponId; 227 private Long couponId;
250 -// /**  
251 -// * 优惠劵减免金额,单位:分 // TODO 芋艿:靠营销表记录  
252 -// */  
253 -// // niu - coupon_money;  
254 -// private Integer couponPrice;  
255 -// /**  
256 -// * 积分抵扣的金额,单位:分  
257 -// */  
258 -// private Integer integralPrice;  
259 -// /**  
260 -// * 使用的积分  
261 -// */  
262 -// private Integer useIntegral;  
263 -  
264 - // TODO ========== 待定字段:yv =========  
265 - // TODO cart_id:购物车 id  
266 - // TODO refund_reason_wap_img:退款图片  
267 - // TODO refund_reason_wap_explain:退款用户说明  
268 - // TODO refund_reason_time:退款时间  
269 - // TODO refund_reason_wap:前台退款原因  
270 - // TODO refund_reason:不退款的理由  
271 -  
272 - // TODO gain_integral:消费赚取积分  
273 - // TODO back_integral:给用户退了多少积分  
274 -  
275 - // TODO combination_id:拼团产品id  
276 - // TODO pink_id:拼团id  
277 - // TODO seckill_id:秒杀产品ID  
278 - // TODO bargain_id:砍价id  
279 -  
280 - // TODO cost:成本价  
281 - // TODO verify_code:核销码  
282 - // TODO store_id:门店id  
283 -  
284 - // TODO ========== 待定字段:cf =========  
285 - // TODO before_pay_price:改价前支付金额  
286 - // TODO is_alter_price:是否改价  
287 - // TODO out_trade_no:商户系统内部的订单号 String  
288 -  
289 - // TODO ========== 待定字段:lf =========  
290 - // TODO settle_id:未结算  
291 - // TODO settle_amount:结算金额  
292 - // TODO team_found_id: 拼团id  
293 - // TODO team_id: 拼团活动id  
294 - // TODO delivery_id: 发货单ID  
295 - // TODO attach_values: 附带的值(赠送时机,赠送积分成长值什么的)Json格式  
296 -  
297 - // TODO ========== 待定字段:nf =========  
298 - // TODO delivery_code:整体提货编码  
299 -  
300 - // TODO ========== 待定字段:niu =========  
301 - // TODO adjust_money '订单调整金额'  
302 - // TODO balance_money ''余额支付金额'' 228 + /**
  229 + * 优惠劵减免金额,单位:分
  230 + */
  231 + private Integer couponPrice;
  232 + /**
  233 + * 积分抵扣的金额,单位:分
  234 + */
  235 + private Integer pointPrice;
303 236
304 } 237 }
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/service/order/TradeOrderServiceImpl.java
@@ -123,7 +123,7 @@ public class TradeOrderServiceImpl implements TradeOrderService { @@ -123,7 +123,7 @@ public class TradeOrderServiceImpl implements TradeOrderService {
123 Long loginUserId, String clientIp) { 123 Long loginUserId, String clientIp) {
124 tradeOrderDO.setUserId(loginUserId); 124 tradeOrderDO.setUserId(loginUserId);
125 tradeOrderDO.setUserIp(clientIp); 125 tradeOrderDO.setUserIp(clientIp);
126 - tradeOrderDO.setSn(IdUtil.getSnowflakeNextId() + ""); // TODO @LeeYan9: 思考下, 怎么生成好点哈; 这个是会展示给用户的; 126 + tradeOrderDO.setNo(IdUtil.getSnowflakeNextId() + ""); // TODO @LeeYan9: 思考下, 怎么生成好点哈; 这个是会展示给用户的;
127 tradeOrderDO.setStatus(TradeOrderStatusEnum.WAITING_PAYMENT.getStatus()); 127 tradeOrderDO.setStatus(TradeOrderStatusEnum.WAITING_PAYMENT.getStatus());
128 tradeOrderDO.setType(TradeOrderTypeEnum.NORMAL.getType()); 128 tradeOrderDO.setType(TradeOrderTypeEnum.NORMAL.getType());
129 tradeOrderDO.setRefundStatus(TradeOrderRefundStatusEnum.NONE.getStatus()); 129 tradeOrderDO.setRefundStatus(TradeOrderRefundStatusEnum.NONE.getStatus());
yudao-ui-admin/src/views/mall/product/spu/save.vue
1 <template> 1 <template>
2 <div class="container"> 2 <div class="container">
  3 + <!-- TODO 样式优化:表单宽度、表单项对齐、hr 粗细; -->
3 <el-tabs v-model="activeName" class="tabs"> 4 <el-tabs v-model="activeName" class="tabs">
4 <!-- 基础设置 --> 5 <!-- 基础设置 -->
  6 + <!-- TODO @luowenfeng:基础设置,分成基础信息、配送信息 -->
  7 + <!-- TODO @luowenfeng:base=》basic 会更好哈 -->
5 <el-tab-pane label="基础设置" name="base"> 8 <el-tab-pane label="基础设置" name="base">
6 <el-form ref="base" :model="baseForm" :rules="rules" label-width="100px" style="width: 95%"> 9 <el-form ref="base" :model="baseForm" :rules="rules" label-width="100px" style="width: 95%">
7 <el-form-item label="商品名称" prop="name"> 10 <el-form-item label="商品名称" prop="name">
8 - <el-input v-model="baseForm.name" placeholder="请输入商品名称"/> 11 + <el-input v-model="baseForm.name" placeholder="请输入商品名称" />
9 </el-form-item> 12 </el-form-item>
10 <el-form-item label="促销语"> 13 <el-form-item label="促销语">
11 <el-input type="textarea" v-model="baseForm.sellPoint" placeholder="请输入促销语"/> 14 <el-input type="textarea" v-model="baseForm.sellPoint" placeholder="请输入促销语"/>
@@ -16,7 +19,6 @@ @@ -16,7 +19,6 @@
16 <el-form-item label="商品视频" prop="videoUrl"> 19 <el-form-item label="商品视频" prop="videoUrl">
17 <VideoUpload v-model="baseForm.videoUrl" :value="baseForm.videoUrl"/> 20 <VideoUpload v-model="baseForm.videoUrl" :value="baseForm.videoUrl"/>
18 </el-form-item> 21 </el-form-item>
19 -  
20 <el-form-item label="商品品牌" prop="brandId"> 22 <el-form-item label="商品品牌" prop="brandId">
21 <el-select v-model="baseForm.brandId" placeholder="请选择商品品牌"> 23 <el-select v-model="baseForm.brandId" placeholder="请选择商品品牌">
22 <el-option v-for="item in brandList" :key="item.id" :label="item.name" :value="item.id"/> 24 <el-option v-for="item in brandList" :key="item.id" :label="item.name" :value="item.id"/>
@@ -28,20 +30,20 @@ @@ -28,20 +30,20 @@
28 </el-form-item> 30 </el-form-item>
29 <el-form-item label="是否上架" prop="status"> 31 <el-form-item label="是否上架" prop="status">
30 <el-radio-group v-model="baseForm.status"> 32 <el-radio-group v-model="baseForm.status">
31 - <el-radio :label="0">立即上架</el-radio>  
32 - <el-radio :label="1">放入仓库</el-radio> 33 + <el-radio :label="1">立即上架</el-radio>
  34 + <el-radio :label="0">放入仓库</el-radio>
33 </el-radio-group> 35 </el-radio-group>
34 </el-form-item> 36 </el-form-item>
35 </el-form> 37 </el-form>
36 </el-tab-pane> 38 </el-tab-pane>
37 39
38 <!-- 价格库存 --> 40 <!-- 价格库存 -->
  41 + <!-- TODO @luowenfeng:rates=》priceStack 会更好哈 -->
39 <el-tab-pane label="价格库存" name="rates" class="rates"> 42 <el-tab-pane label="价格库存" name="rates" class="rates">
40 <el-form ref="rates" :model="ratesForm" :rules="rules"> 43 <el-form ref="rates" :model="ratesForm" :rules="rules">
41 <el-form-item label="启用多规格"> 44 <el-form-item label="启用多规格">
42 - <el-switch v-model="specSwitch" @change="changeSpecSwitch"></el-switch> 45 + <el-switch v-model="specSwitch" @change="changeSpecSwitch"/>
43 </el-form-item> 46 </el-form-item>
44 -  
45 <!-- 动态添加规格属性 --> 47 <!-- 动态添加规格属性 -->
46 <div v-show="ratesForm.spec === 2"> 48 <div v-show="ratesForm.spec === 2">
47 <div v-for="(specs, index) in dynamicSpec" :key="index" class="dynamic-spec"> 49 <div v-for="(specs, index) in dynamicSpec" :key="index" class="dynamic-spec">
@@ -59,8 +61,7 @@ @@ -59,8 +61,7 @@
59 </template> 61 </template>
60 </div> 62 </div>
61 </div> 63 </div>
62 - <el-button type="primary" @click="dynamicSpec.push({specValue: []}); ratesForm.rates = []">添加规格项目  
63 - </el-button> 64 + <el-button type="primary" @click="dynamicSpec.push({specValue: []}); ratesForm.rates = []">添加规格项目</el-button>
64 </div> 65 </div>
65 66
66 <!-- 规格明细 --> 67 <!-- 规格明细 -->
@@ -76,15 +77,13 @@ @@ -76,15 +77,13 @@
76 </template> 77 </template>
77 <el-table-column label="规格图片" width="120px" :render-header="addRedStar" key="90"> 78 <el-table-column label="规格图片" width="120px" :render-header="addRedStar" key="90">
78 <template slot-scope="scope"> 79 <template slot-scope="scope">
79 - <ImageUpload v-model="scope.row.picUrl" :limit="1" :isShowTip="false"  
80 - style="width: 100px; height: 50px"/> 80 + <ImageUpload v-model="scope.row.picUrl" :limit="1" :isShowTip="false" style="width: 100px; height: 50px"/>
81 </template> 81 </template>
82 </el-table-column> 82 </el-table-column>
83 <template v-if="this.specSwitch"> 83 <template v-if="this.specSwitch">
84 <el-table-column label="sku名称" :render-header="addRedStar" key="91"> 84 <el-table-column label="sku名称" :render-header="addRedStar" key="91">
85 <template slot-scope="scope"> 85 <template slot-scope="scope">
86 - <el-form-item :prop="'rates.'+ scope.$index + '.name'"  
87 - :rules="[{required: true, trigger: 'change'}]"> 86 + <el-form-item :prop="'rates.'+ scope.$index + '.name'" :rules="[{required: true, trigger: 'change'}]">
88 <el-input v-model="scope.row.name"/> 87 <el-input v-model="scope.row.name"/>
89 </el-form-item> 88 </el-form-item>
90 </template> 89 </template>
@@ -92,8 +91,7 @@ @@ -92,8 +91,7 @@
92 </template> 91 </template>
93 <el-table-column label="市场价(元)" :render-header="addRedStar" key="92"> 92 <el-table-column label="市场价(元)" :render-header="addRedStar" key="92">
94 <template slot-scope="scope"> 93 <template slot-scope="scope">
95 - <el-form-item :prop="'rates.'+ scope.$index + '.marketPrice'"  
96 - :rules="[{required: true, trigger: 'change'}]"> 94 + <el-form-item :prop="'rates.'+ scope.$index + '.marketPrice'" :rules="[{required: true, trigger: 'change'}]">
97 <el-input v-model="scope.row.marketPrice" 95 <el-input v-model="scope.row.marketPrice"
98 oninput="value= value.match(/\d+(\.\d{0,2})?/) ? value.match(/\d+(\.\d{0,2})?/)[0] : ''"/> 96 oninput="value= value.match(/\d+(\.\d{0,2})?/) ? value.match(/\d+(\.\d{0,2})?/)[0] : ''"/>
99 </el-form-item> 97 </el-form-item>
@@ -104,7 +102,7 @@ @@ -104,7 +102,7 @@
104 <el-form-item :prop="'rates.'+ scope.$index + '.price'" 102 <el-form-item :prop="'rates.'+ scope.$index + '.price'"
105 :rules="[{required: true, trigger: 'change'}]"> 103 :rules="[{required: true, trigger: 'change'}]">
106 <el-input v-model="scope.row.price" 104 <el-input v-model="scope.row.price"
107 - oninput="value= value.match(/\d+(\.\d{0,2})?/) ? value.match(/\d+(\.\d{0,2})?/)[0] : ''"></el-input> 105 + oninput="value= value.match(/\d+(\.\d{0,2})?/) ? value.match(/\d+(\.\d{0,2})?/)[0] : ''" />
108 </el-form-item> 106 </el-form-item>
109 </template> 107 </template>
110 </el-table-column> 108 </el-table-column>
@@ -112,17 +110,14 @@ @@ -112,17 +110,14 @@
112 <template slot-scope="scope"> 110 <template slot-scope="scope">
113 <el-form-item :prop="'rates.'+ scope.$index + '.costPrice'" 111 <el-form-item :prop="'rates.'+ scope.$index + '.costPrice'"
114 :rules="[{required: true, trigger: 'change'}]"> 112 :rules="[{required: true, trigger: 'change'}]">
115 - <el-input  
116 - v-model="scope.row.costPrice"  
117 - oninput="value= value.match(/\d+(\.\d{0,2})?/) ? value.match(/\d+(\.\d{0,2})?/)[0] : ''"  
118 - ></el-input> 113 + <el-input v-model="scope.row.costPrice"
  114 + oninput="value= value.match(/\d+(\.\d{0,2})?/) ? value.match(/\d+(\.\d{0,2})?/)[0] : ''" />
119 </el-form-item> 115 </el-form-item>
120 </template> 116 </template>
121 </el-table-column> 117 </el-table-column>
122 <el-table-column label="库存" :render-header="addRedStar" key="95"> 118 <el-table-column label="库存" :render-header="addRedStar" key="95">
123 <template slot-scope="scope"> 119 <template slot-scope="scope">
124 - <el-form-item :prop="'rates.'+ scope.$index + '.stock'"  
125 - :rules="[{required: true, trigger: 'change'}]"> 120 + <el-form-item :prop="'rates.'+ scope.$index + '.stock'" :rules="[{required: true, trigger: 'change'}]">
126 <el-input v-model="scope.row.stock" oninput="value=value.replace(/^(0+)|[^\d]+/g,'')"></el-input> 121 <el-input v-model="scope.row.stock" oninput="value=value.replace(/^(0+)|[^\d]+/g,'')"></el-input>
127 </el-form-item> 122 </el-form-item>
128 </template> 123 </template>
@@ -134,17 +129,17 @@ @@ -134,17 +129,17 @@
134 </el-table-column> 129 </el-table-column>
135 <el-table-column label="体积" key="97"> 130 <el-table-column label="体积" key="97">
136 <template slot-scope="scope"> 131 <template slot-scope="scope">
137 - <el-input v-model="scope.row.volume"></el-input> 132 + <el-input v-model="scope.row.volume" />
138 </template> 133 </template>
139 </el-table-column> 134 </el-table-column>
140 <el-table-column label="重量" key="98"> 135 <el-table-column label="重量" key="98">
141 <template slot-scope="scope"> 136 <template slot-scope="scope">
142 - <el-input v-model="scope.row.weight"></el-input> 137 + <el-input v-model="scope.row.weight" />
143 </template> 138 </template>
144 </el-table-column> 139 </el-table-column>
145 <el-table-column label="条码" key="99"> 140 <el-table-column label="条码" key="99">
146 <template slot-scope="scope"> 141 <template slot-scope="scope">
147 - <el-input v-model="scope.row.barCode"></el-input> 142 + <el-input v-model="scope.row.barCode" />
148 </template> 143 </template>
149 </el-table-column> 144 </el-table-column>
150 <template v-if="this.specSwitch"> 145 <template v-if="this.specSwitch">
@@ -169,6 +164,7 @@ @@ -169,6 +164,7 @@
169 </el-tab-pane> 164 </el-tab-pane>
170 165
171 <!-- 商品详情 --> 166 <!-- 商品详情 -->
  167 + <!-- TODO @luowenfeng:third=》detail 会更好哈 -->
172 <el-tab-pane label="商品详情" name="third"> 168 <el-tab-pane label="商品详情" name="third">
173 <el-form ref="third" :model="baseForm" :rules="rules"> 169 <el-form ref="third" :model="baseForm" :rules="rules">
174 <el-form-item prop="description"> 170 <el-form-item prop="description">
@@ -178,6 +174,7 @@ @@ -178,6 +174,7 @@
178 </el-tab-pane> 174 </el-tab-pane>
179 175
180 <!-- 销售设置 --> 176 <!-- 销售设置 -->
  177 + <!-- TODO @luowenfeng:fourth=》senior 会更好哈 -->
181 <el-tab-pane label="高级设置" name="fourth"> 178 <el-tab-pane label="高级设置" name="fourth">
182 <el-form ref="fourth" :model="baseForm" :rules="rules" label-width="100px" style="width: 95%"> 179 <el-form ref="fourth" :model="baseForm" :rules="rules" label-width="100px" style="width: 95%">
183 <el-form-item label="排序字段"> 180 <el-form-item label="排序字段">
@@ -421,15 +418,13 @@ export default { @@ -421,15 +418,13 @@ export default {
421 if (form.id == null) { 418 if (form.id == null) {
422 createSpu(form).then(() => { 419 createSpu(form).then(() => {
423 this.$modal.msgSuccess("新增成功"); 420 this.$modal.msgSuccess("新增成功");
424 - })  
425 - .then(()=>{ 421 + }).then(()=>{
426 this.cancel(); 422 this.cancel();
427 }) 423 })
428 } else { 424 } else {
429 updateSpu(form).then(() => { 425 updateSpu(form).then(() => {
430 this.$modal.msgSuccess("修改成功"); 426 this.$modal.msgSuccess("修改成功");
431 - })  
432 - .then(()=>{ 427 + }).then(()=>{
433 this.cancel(); 428 this.cancel();
434 }) 429 })
435 } 430 }
@@ -458,7 +453,7 @@ export default { @@ -458,7 +453,7 @@ export default {
458 this.baseForm.id = data.id; 453 this.baseForm.id = data.id;
459 this.baseForm.name = data.name; 454 this.baseForm.name = data.name;
460 this.baseForm.sellPoint = data.sellPoint; 455 this.baseForm.sellPoint = data.sellPoint;
461 - this.baseForm.categoryIds = data.categoryIds; 456 + this.baseForm.categoryIds = data.categoryId;
462 this.baseForm.videoUrl = data.videoUrl; 457 this.baseForm.videoUrl = data.videoUrl;
463 this.baseForm.sort = data.sort; 458 this.baseForm.sort = data.sort;
464 this.baseForm.description = data.description; 459 this.baseForm.description = data.description;