Browse Source

【代码评审】商城:满减送活动的实现

YunaiV 10 tháng trước cách đây
mục cha
commit
a02712ca95

+ 4 - 3
src/api/mall/promotion/reward/rewardActivity.ts

@@ -9,10 +9,11 @@ export interface RewardActivityVO {
   remark?: string
   conditionType?: number
   productScope?: number
-  productScopeValues?: number[] // 商品范围:值为 品类编号列表 或 商品编号列表 ,用于提交
-  productCategoryIds?: number[] // 仅用于表单,不提交
-  productSpuIds?: number[] // 仅用于表单,不提交
   rules: RewardRule[]
+  // 如下仅用于表单,不提交
+  productScopeValues?: number[] // 商品范围:值为品类编号列表、商品编号列表
+  productCategoryIds?: number[]
+  productSpuIds?: number[]
 }
 
 // 优惠规则

+ 1 - 0
src/views/mall/promotion/rewardActivity/RewardForm.vue

@@ -169,6 +169,7 @@ const getProductScope = async () => {
       formData.value.productSpuIds = formData.value.productScopeValues
       break
     case PromotionProductScopeEnum.CATEGORY.scope:
+      // TODO @puhui999:可以直接 await nextTick() 呀。
       await nextTick(() => {
         let productCategoryIds = formData.value.productScopeValues as any
         if (Array.isArray(productCategoryIds) && productCategoryIds.length > 0) {

+ 2 - 2
src/views/mall/promotion/rewardActivity/components/RewardRule.vue

@@ -19,6 +19,7 @@
               placeholder=""
               type="number"
             />
+            <!-- TODO @puhui999:走字典数据? -->
             {{ PromotionConditionTypeEnum.PRICE.type === formData.conditionType ? '元' : '件' }}
           </el-form-item>
           <el-form-item label="优惠内容:" label-width="100px">
@@ -26,6 +27,7 @@
               订单金额优惠
               <el-form-item>
+                <!-- TODO @puhui999:需要考虑 100 换算哈 -->
                 <el-input
                   v-model="rule.discountPrice"
                   class="w-150px! p-x-20px!"
@@ -91,8 +93,6 @@ import { RewardActivityVO } from '@/api/mall/promotion/reward/rewardActivity'
 import { PromotionConditionTypeEnum } from '@/utils/constants'
 import { useVModel } from '@vueuse/core'
 
-defineOptions({ name: 'RewardRule' })
-
 const props = defineProps<{
   modelValue: RewardActivityVO
 }>()