From a1d7e81859f554f3a53680cc35f0f49bf1f77098 Mon Sep 17 00:00:00 2001
From: wwf <1971391498@qq.com>
Date: 星期四, 14 五月 2026 14:37:02 +0800
Subject: [PATCH] 导入项目
---
src/views/mall/promotion/rewardActivity/components/RewardRule.vue | 138 ++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 138 insertions(+), 0 deletions(-)
diff --git a/src/views/mall/promotion/rewardActivity/components/RewardRule.vue b/src/views/mall/promotion/rewardActivity/components/RewardRule.vue
new file mode 100644
index 0000000..2c63a42
--- /dev/null
+++ b/src/views/mall/promotion/rewardActivity/components/RewardRule.vue
@@ -0,0 +1,138 @@
+<template>
+ <!-- 婊″噺閫佹椿鍔ㄨ鍒欑粍浠� -->
+ <el-row>
+ <template v-if="formData.rules">
+ <el-col v-for="(rule, index) in formData.rules" :key="index" :span="24">
+ <span class="font-bold">娲诲姩灞傜骇{{ index + 1 }}</span>
+ <el-button v-if="index !== 0" link type="danger" @click="deleteRule(index)">
+ 鍒犻櫎
+ </el-button>
+ <el-form ref="formRef" :model="rule">
+ <el-form-item label="浼樻儬闂ㄦ:" label-width="100px" prop="limit">
+ 婊�
+ <el-input-number
+ v-if="PromotionConditionTypeEnum.PRICE.type === formData.conditionType"
+ v-model="rule.limit"
+ :min="0"
+ :precision="2"
+ :step="0.1"
+ class="w-150px! p-x-20px!"
+ placeholder=""
+ type="number"
+ controls-position="right"
+ />
+ <el-input
+ v-else
+ v-model="rule.limit"
+ :min="0"
+ class="w-150px! p-x-20px!"
+ placeholder=""
+ type="number"
+ />
+ {{ PromotionConditionTypeEnum.PRICE.type === formData.conditionType ? '鍏�' : '浠�' }}
+ </el-form-item>
+ <el-form-item label="浼樻儬鍐呭:" label-width="100px">
+ <el-col :span="24">
+ 璁㈠崟閲戦浼樻儬
+ <el-form-item>
+ 鍑�
+ <el-input-number
+ v-model="rule.discountPrice"
+ :min="0"
+ :precision="2"
+ :step="0.1"
+ class="w-150px! p-x-20px!"
+ controls-position="right"
+ />
+ 鍏�
+ </el-form-item>
+ </el-col>
+ <el-col :span="24">
+ <span>鍖呴偖锛�</span>
+ <el-switch
+ v-model="rule.freeDelivery"
+ active-text="鏄�"
+ inactive-text="鍚�"
+ inline-prompt
+ />
+ </el-col>
+ <el-col :span="24">
+ <span>閫佺Н鍒嗭細</span>
+ <el-form-item>
+ 閫�
+ <el-input
+ v-model="rule.point"
+ class="w-150px! p-x-20px!"
+ placeholder=""
+ type="number"
+ />
+ 绉垎
+ </el-form-item>
+ </el-col>
+ <el-col :span="24">
+ <span>閫佷紭鎯犲埜锛�</span>
+ <RewardRuleCouponSelect ref="rewardRuleCouponSelectRef" v-model="rule!" />
+ </el-col>
+ </el-form-item>
+ </el-form>
+ </el-col>
+ </template>
+ <el-col :span="24" class="mt-10px">
+ <el-button type="primary" @click="addRule">娣诲姞浼樻儬瑙勫垯</el-button>
+ </el-col>
+ <el-col :span="24">
+ <el-tag type="warning"> 璧犻�佺Н鍒嗕负 0 鏃朵笉璧犻�併�傛湭閫変紭鎯犲埜鏃朵笉璧犻�併��</el-tag>
+ </el-col>
+ </el-row>
+</template>
+
+<script lang="ts" setup>
+import RewardRuleCouponSelect from './RewardRuleCouponSelect.vue'
+import { RewardActivityVO } from '@/api/mall/promotion/reward/rewardActivity'
+import { PromotionConditionTypeEnum } from '@/utils/constants'
+import { useVModel } from '@vueuse/core'
+import { isEmpty } from '@/utils/is'
+
+defineOptions({ name: 'RewardRule' })
+
+const props = defineProps<{
+ modelValue: RewardActivityVO
+}>()
+
+const emits = defineEmits<{
+ (e: 'update:modelValue', v: any): void
+ (e: 'deleteRule', v: number): void
+}>()
+
+const formData = useVModel(props, 'modelValue', emits) // 娲诲姩鏁版嵁
+const rewardRuleCouponSelectRef = ref<InstanceType<typeof RewardRuleCouponSelect>[]>() // 娲诲姩瑙勫垯浼樻儬鍒� Ref
+
+/** 鍒犻櫎浼樻儬瑙勫垯 */
+const deleteRule = (ruleIndex: number) => {
+ formData.value.rules.splice(ruleIndex, 1)
+}
+
+/** 娣诲姞浼樻儬瑙勫垯 */
+const addRule = () => {
+ if (isEmpty(formData.value.rules)) {
+ formData.value.rules = []
+ }
+ formData.value.rules.push({
+ limit: 0,
+ discountPrice: 0,
+ freeDelivery: false,
+ point: 0
+ })
+}
+
+/** 璁剧疆瑙勫垯浼樻儬鍒�-鎻愪氦鏃� */
+const setRuleCoupon = () => {
+ if (isEmpty(rewardRuleCouponSelectRef.value)) {
+ return
+ }
+
+ rewardRuleCouponSelectRef.value?.forEach((item) => item.setGiveCouponList())
+}
+
+defineExpose({ setRuleCoupon })
+</script>
--
Gitblit v1.8.0