Commit 356642ecea9136ef0458085e84d17de352df8944
1 parent
7bf37fcb
review 商品的 save 界面
Showing
5 changed files
with
30 additions
and
39 deletions
yudao-module-mall/yudao-module-product-biz/src/main/java/cn/iocoder/yudao/module/product/dal/dataobject/category/ProductCategoryDO.java
yudao-module-mall/yudao-module-product-biz/src/test/java/cn/iocoder/yudao/module/product/service/spu/ProductSpuServiceImplTest.java
| ... | ... | @@ -29,9 +29,7 @@ import org.springframework.boot.test.mock.mockito.MockBean; |
| 29 | 29 | import org.springframework.context.annotation.Import; |
| 30 | 30 | |
| 31 | 31 | import javax.annotation.Resource; |
| 32 | -import java.util.ArrayList; | |
| 33 | -import java.util.List; | |
| 34 | -import java.util.Map; | |
| 32 | +import java.util.*; | |
| 35 | 33 | import java.util.stream.Collectors; |
| 36 | 34 | import java.util.stream.Stream; |
| 37 | 35 | |
| ... | ... | @@ -221,15 +219,15 @@ public class ProductSpuServiceImplTest extends BaseDbUnitTest { |
| 221 | 219 | // randomPojo(ProductSkuDO.class, o -> o.setSpuId(createReqVO.getId())) |
| 222 | 220 | ); |
| 223 | 221 | |
| 224 | - Mockito.when(productSkuService.getRemindSpuIds()).thenReturn(remindSpuIds); | |
| 222 | +// Mockito.when(productSkuService.getRemindSpuIds()).thenReturn(remindSpuIds); | |
| 225 | 223 | |
| 226 | 224 | // 调用 |
| 227 | 225 | ProductSpuPageReqVO productSpuPageReqVO = new ProductSpuPageReqVO(); |
| 228 | - productSpuPageReqVO.setTabStatus(2); | |
| 226 | +// productSpuPageReqVO.setTabStatus(2); | |
| 229 | 227 | |
| 230 | 228 | PageResult<ProductSpuRespVO> spuPage = productSpuService.getSpuPage(productSpuPageReqVO); |
| 231 | 229 | |
| 232 | - ArrayList<Long> resultRemindSpuIds = new ArrayList<>(); | |
| 230 | + Set<Long> resultRemindSpuIds = new HashSet<>(); | |
| 233 | 231 | resultRemindSpuIds.add(null); |
| 234 | 232 | PageResult<ProductSpuRespVO> result = ProductSpuConvert.INSTANCE.convertPage(productSpuMapper.selectPage(productSpuPageReqVO, resultRemindSpuIds)); |
| 235 | 233 | Assertions.assertIterableEquals(result.getList(), spuPage.getList()); |
| ... | ... | @@ -249,7 +247,7 @@ public class ProductSpuServiceImplTest extends BaseDbUnitTest { |
| 249 | 247 | // randomPojo(ProductSkuDO.class, o -> o.setSpuId(createReqVO.getId())) |
| 250 | 248 | ); |
| 251 | 249 | |
| 252 | - Mockito.when(productSkuService.getRemindSpuIds()).thenReturn(remindSpuIds); | |
| 250 | +// Mockito.when(productSkuService.getRemindSpuIds()).thenReturn(remindSpuIds); | |
| 253 | 251 | |
| 254 | 252 | // 调用 |
| 255 | 253 | AppSpuPageReqVO appSpuPageReqVO = new AppSpuPageReqVO(); | ... | ... |
yudao-module-mall/yudao-module-trade-biz/src/main/java/cn/iocoder/yudao/module/trade/dal/dataobject/order/TradeOrderDO.java
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 | 123 | Long loginUserId, String clientIp) { |
| 124 | 124 | tradeOrderDO.setUserId(loginUserId); |
| 125 | 125 | tradeOrderDO.setUserIp(clientIp); |
| 126 | - tradeOrderDO.setSn(IdUtil.getSnowflakeNextId() + ""); // TODO @LeeYan9: 思考下, 怎么生成好点哈; 这个是会展示给用户的; | |
| 126 | + tradeOrderDO.setNo(IdUtil.getSnowflakeNextId() + ""); // TODO @LeeYan9: 思考下, 怎么生成好点哈; 这个是会展示给用户的; | |
| 127 | 127 | tradeOrderDO.setStatus(TradeOrderStatusEnum.WAITING_PAYMENT.getStatus()); |
| 128 | 128 | tradeOrderDO.setType(TradeOrderTypeEnum.NORMAL.getType()); |
| 129 | 129 | tradeOrderDO.setRefundStatus(TradeOrderRefundStatusEnum.NONE.getStatus()); | ... | ... |
yudao-ui-admin/src/views/mall/product/spu/save.vue
| 1 | 1 | <template> |
| 2 | 2 | <div class="container"> |
| 3 | + <!-- TODO 样式优化:表单宽度、表单项对齐、hr 粗细; --> | |
| 3 | 4 | <el-tabs v-model="activeName" class="tabs"> |
| 4 | 5 | <!-- 基础设置 --> |
| 6 | + <!-- TODO @luowenfeng:基础设置,分成商品类型、基础信息、配送信息 --> | |
| 7 | + <!-- TODO @luowenfeng:base=》basic 会更好哈 --> | |
| 5 | 8 | <el-tab-pane label="基础设置" name="base"> |
| 6 | 9 | <el-form ref="base" :model="baseForm" :rules="rules" label-width="100px" style="width: 95%"> |
| 7 | 10 | <el-form-item label="商品名称" prop="name"> |
| 8 | - <el-input v-model="baseForm.name" placeholder="请输入商品名称"/> | |
| 11 | + <el-input v-model="baseForm.name" placeholder="请输入商品名称" /> | |
| 9 | 12 | </el-form-item> |
| 10 | 13 | <el-form-item label="促销语"> |
| 11 | 14 | <el-input type="textarea" v-model="baseForm.sellPoint" placeholder="请输入促销语"/> |
| ... | ... | @@ -16,7 +19,6 @@ |
| 16 | 19 | <el-form-item label="商品视频" prop="videoUrl"> |
| 17 | 20 | <VideoUpload v-model="baseForm.videoUrl" :value="baseForm.videoUrl"/> |
| 18 | 21 | </el-form-item> |
| 19 | - | |
| 20 | 22 | <el-form-item label="商品品牌" prop="brandId"> |
| 21 | 23 | <el-select v-model="baseForm.brandId" placeholder="请选择商品品牌"> |
| 22 | 24 | <el-option v-for="item in brandList" :key="item.id" :label="item.name" :value="item.id"/> |
| ... | ... | @@ -28,20 +30,20 @@ |
| 28 | 30 | </el-form-item> |
| 29 | 31 | <el-form-item label="是否上架" prop="status"> |
| 30 | 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 | 35 | </el-radio-group> |
| 34 | 36 | </el-form-item> |
| 35 | 37 | </el-form> |
| 36 | 38 | </el-tab-pane> |
| 37 | 39 | |
| 38 | 40 | <!-- 价格库存 --> |
| 41 | + <!-- TODO @luowenfeng:rates=》priceStack 会更好哈 --> | |
| 39 | 42 | <el-tab-pane label="价格库存" name="rates" class="rates"> |
| 40 | 43 | <el-form ref="rates" :model="ratesForm" :rules="rules"> |
| 41 | 44 | <el-form-item label="启用多规格"> |
| 42 | - <el-switch v-model="specSwitch" @change="changeSpecSwitch"></el-switch> | |
| 45 | + <el-switch v-model="specSwitch" @change="changeSpecSwitch"/> | |
| 43 | 46 | </el-form-item> |
| 44 | - | |
| 45 | 47 | <!-- 动态添加规格属性 --> |
| 46 | 48 | <div v-show="ratesForm.spec === 2"> |
| 47 | 49 | <div v-for="(specs, index) in dynamicSpec" :key="index" class="dynamic-spec"> |
| ... | ... | @@ -59,8 +61,7 @@ |
| 59 | 61 | </template> |
| 60 | 62 | </div> |
| 61 | 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 | 65 | </div> |
| 65 | 66 | |
| 66 | 67 | <!-- 规格明细 --> |
| ... | ... | @@ -76,15 +77,13 @@ |
| 76 | 77 | </template> |
| 77 | 78 | <el-table-column label="规格图片" width="120px" :render-header="addRedStar" key="90"> |
| 78 | 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 | 81 | </template> |
| 82 | 82 | </el-table-column> |
| 83 | 83 | <template v-if="this.specSwitch"> |
| 84 | 84 | <el-table-column label="sku名称" :render-header="addRedStar" key="91"> |
| 85 | 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 | 87 | <el-input v-model="scope.row.name"/> |
| 89 | 88 | </el-form-item> |
| 90 | 89 | </template> |
| ... | ... | @@ -92,8 +91,7 @@ |
| 92 | 91 | </template> |
| 93 | 92 | <el-table-column label="市场价(元)" :render-header="addRedStar" key="92"> |
| 94 | 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 | 95 | <el-input v-model="scope.row.marketPrice" |
| 98 | 96 | oninput="value= value.match(/\d+(\.\d{0,2})?/) ? value.match(/\d+(\.\d{0,2})?/)[0] : ''"/> |
| 99 | 97 | </el-form-item> |
| ... | ... | @@ -104,7 +102,7 @@ |
| 104 | 102 | <el-form-item :prop="'rates.'+ scope.$index + '.price'" |
| 105 | 103 | :rules="[{required: true, trigger: 'change'}]"> |
| 106 | 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 | 106 | </el-form-item> |
| 109 | 107 | </template> |
| 110 | 108 | </el-table-column> |
| ... | ... | @@ -112,17 +110,14 @@ |
| 112 | 110 | <template slot-scope="scope"> |
| 113 | 111 | <el-form-item :prop="'rates.'+ scope.$index + '.costPrice'" |
| 114 | 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 | 115 | </el-form-item> |
| 120 | 116 | </template> |
| 121 | 117 | </el-table-column> |
| 122 | 118 | <el-table-column label="库存" :render-header="addRedStar" key="95"> |
| 123 | 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 | 121 | <el-input v-model="scope.row.stock" oninput="value=value.replace(/^(0+)|[^\d]+/g,'')"></el-input> |
| 127 | 122 | </el-form-item> |
| 128 | 123 | </template> |
| ... | ... | @@ -134,17 +129,17 @@ |
| 134 | 129 | </el-table-column> |
| 135 | 130 | <el-table-column label="体积" key="97"> |
| 136 | 131 | <template slot-scope="scope"> |
| 137 | - <el-input v-model="scope.row.volume"></el-input> | |
| 132 | + <el-input v-model="scope.row.volume" /> | |
| 138 | 133 | </template> |
| 139 | 134 | </el-table-column> |
| 140 | 135 | <el-table-column label="重量" key="98"> |
| 141 | 136 | <template slot-scope="scope"> |
| 142 | - <el-input v-model="scope.row.weight"></el-input> | |
| 137 | + <el-input v-model="scope.row.weight" /> | |
| 143 | 138 | </template> |
| 144 | 139 | </el-table-column> |
| 145 | 140 | <el-table-column label="条码" key="99"> |
| 146 | 141 | <template slot-scope="scope"> |
| 147 | - <el-input v-model="scope.row.barCode"></el-input> | |
| 142 | + <el-input v-model="scope.row.barCode" /> | |
| 148 | 143 | </template> |
| 149 | 144 | </el-table-column> |
| 150 | 145 | <template v-if="this.specSwitch"> |
| ... | ... | @@ -169,6 +164,7 @@ |
| 169 | 164 | </el-tab-pane> |
| 170 | 165 | |
| 171 | 166 | <!-- 商品详情 --> |
| 167 | + <!-- TODO @luowenfeng:third=》detail 会更好哈 --> | |
| 172 | 168 | <el-tab-pane label="商品详情" name="third"> |
| 173 | 169 | <el-form ref="third" :model="baseForm" :rules="rules"> |
| 174 | 170 | <el-form-item prop="description"> |
| ... | ... | @@ -178,6 +174,7 @@ |
| 178 | 174 | </el-tab-pane> |
| 179 | 175 | |
| 180 | 176 | <!-- 销售设置 --> |
| 177 | + <!-- TODO @luowenfeng:fourth=》senior 会更好哈 --> | |
| 181 | 178 | <el-tab-pane label="高级设置" name="fourth"> |
| 182 | 179 | <el-form ref="fourth" :model="baseForm" :rules="rules" label-width="100px" style="width: 95%"> |
| 183 | 180 | <el-form-item label="排序字段"> |
| ... | ... | @@ -421,15 +418,13 @@ export default { |
| 421 | 418 | if (form.id == null) { |
| 422 | 419 | createSpu(form).then(() => { |
| 423 | 420 | this.$modal.msgSuccess("新增成功"); |
| 424 | - }) | |
| 425 | - .then(()=>{ | |
| 421 | + }).then(()=>{ | |
| 426 | 422 | this.cancel(); |
| 427 | 423 | }) |
| 428 | 424 | } else { |
| 429 | 425 | updateSpu(form).then(() => { |
| 430 | 426 | this.$modal.msgSuccess("修改成功"); |
| 431 | - }) | |
| 432 | - .then(()=>{ | |
| 427 | + }).then(()=>{ | |
| 433 | 428 | this.cancel(); |
| 434 | 429 | }) |
| 435 | 430 | } | ... | ... |