mirror of
				https://gitee.com/hhyykk/ipms-sjy-ui.git
				synced 2025-11-04 12:18:43 +08:00 
			
		
		
		
	
							
								
								
									
										2560
									
								
								pnpm-lock.yaml
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										2560
									
								
								pnpm-lock.yaml
									
									
									
										generated
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@@ -1,34 +1,39 @@
 | 
			
		||||
import request from '@/config/axios'
 | 
			
		||||
 | 
			
		||||
export interface DiscountActivityVO {
 | 
			
		||||
export interface RewardActivityVO {
 | 
			
		||||
  id?: number
 | 
			
		||||
  name?: string
 | 
			
		||||
  startTime?: Date
 | 
			
		||||
  endTime?: Date
 | 
			
		||||
  startAndEndTime?: Date[] // 只前端使用
 | 
			
		||||
  remark?: string
 | 
			
		||||
  conditionType?: number
 | 
			
		||||
  productScope?: number
 | 
			
		||||
  productSpuIds?: number[]
 | 
			
		||||
  rules?: DiscountProductVO[]
 | 
			
		||||
  productScopeValues?: number[] // 商品范围:值为 品类编号列表 或 商品编号列表 ,用于提交
 | 
			
		||||
  productCategoryIds?: number[] // 仅用于表单,不提交
 | 
			
		||||
  productSpuIds?: number[] // 仅用于表单,不提交
 | 
			
		||||
  rules: RewardRule[]
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// 优惠规则
 | 
			
		||||
export interface DiscountProductVO {
 | 
			
		||||
  limit: number
 | 
			
		||||
  discountPrice: number
 | 
			
		||||
  freeDelivery: boolean
 | 
			
		||||
  point: number
 | 
			
		||||
  couponIds: number[]
 | 
			
		||||
  couponCounts: number[]
 | 
			
		||||
export interface RewardRule {
 | 
			
		||||
  limit?: number
 | 
			
		||||
  discountPrice?: number
 | 
			
		||||
  freeDelivery?: boolean
 | 
			
		||||
  givePoint?: boolean
 | 
			
		||||
  point?: number
 | 
			
		||||
  giveCoupon?: boolean
 | 
			
		||||
  couponIds?: number[]
 | 
			
		||||
  couponCounts?: number[]
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// 新增满减送活动
 | 
			
		||||
export const createRewardActivity = async (data: DiscountActivityVO) => {
 | 
			
		||||
export const createRewardActivity = async (data: RewardActivityVO) => {
 | 
			
		||||
  return await request.post({ url: '/promotion/reward-activity/create', data })
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// 更新满减送活动
 | 
			
		||||
export const updateRewardActivity = async (data: DiscountActivityVO) => {
 | 
			
		||||
export const updateRewardActivity = async (data: RewardActivityVO) => {
 | 
			
		||||
  return await request.put({ url: '/promotion/reward-activity/update', data })
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -46,8 +46,3 @@ export const updateUserLevel = async (data: any) => {
 | 
			
		||||
export const updateUserPoint = async (data: any) => {
 | 
			
		||||
  return await request.put({ url: `/member/user/update-point`, data })
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// 修改会员用户余额
 | 
			
		||||
export const updateUserBalance = async (data: any) => {
 | 
			
		||||
  return await request.put({ url: `/member/user/update-balance`, data })
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -4,6 +4,7 @@ import request from '@/config/axios'
 | 
			
		||||
export interface PayWalletUserReqVO {
 | 
			
		||||
  userId: number
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/** 钱包 VO */
 | 
			
		||||
export interface WalletVO {
 | 
			
		||||
  id: number
 | 
			
		||||
@@ -20,7 +21,12 @@ export const getWallet = async (params: PayWalletUserReqVO) => {
 | 
			
		||||
  return await request.get<WalletVO>({ url: `/pay/wallet/get`, params })
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// 查询会员钱包列表
 | 
			
		||||
export const getWalletPage = async (params) => {
 | 
			
		||||
/** 查询会员钱包列表 */
 | 
			
		||||
export const getWalletPage = async (params: any) => {
 | 
			
		||||
  return await request.get({ url: `/pay/wallet/page`, params })
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/** 修改会员钱包余额 */
 | 
			
		||||
export const updateWalletBalance = async (data: any) => {
 | 
			
		||||
  return await request.put({ url: `/pay/wallet/update-balance`, data })
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -153,11 +153,12 @@ import * as CouponTemplateApi from '@/api/mall/promotion/coupon/couponTemplate'
 | 
			
		||||
 | 
			
		||||
defineOptions({ name: 'CouponSelect' })
 | 
			
		||||
 | 
			
		||||
defineProps<{
 | 
			
		||||
  multipleSelection: CouponTemplateApi.CouponTemplateVO[]
 | 
			
		||||
const props = defineProps<{
 | 
			
		||||
  multipleSelection?: CouponTemplateApi.CouponTemplateVO[]
 | 
			
		||||
}>()
 | 
			
		||||
const emit = defineEmits<{
 | 
			
		||||
  (e: 'update:multipleSelection', v: CouponTemplateApi.CouponTemplateVO[])
 | 
			
		||||
  (e: 'update:multipleSelection', v: CouponTemplateApi.CouponTemplateVO[]): void
 | 
			
		||||
  (e: 'change', v: CouponTemplateApi.CouponTemplateVO[]): void
 | 
			
		||||
}>()
 | 
			
		||||
const dialogVisible = ref(false) // 弹窗的是否展示
 | 
			
		||||
const dialogTitle = ref('选择优惠卷') // 弹窗的标题
 | 
			
		||||
@@ -209,7 +210,11 @@ const open = async () => {
 | 
			
		||||
defineExpose({ open }) // 提供 open 方法,用于打开弹窗
 | 
			
		||||
 | 
			
		||||
const handleSelectionChange = (val: CouponTemplateApi.CouponTemplateVO[]) => {
 | 
			
		||||
  emit('update:multipleSelection', val)
 | 
			
		||||
  if (props.multipleSelection) {
 | 
			
		||||
    emit('update:multipleSelection', val)
 | 
			
		||||
    return
 | 
			
		||||
  }
 | 
			
		||||
  emit('change', val)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const submitForm = () => {
 | 
			
		||||
 
 | 
			
		||||
@@ -1,11 +1,11 @@
 | 
			
		||||
<template>
 | 
			
		||||
  <Dialog :title="dialogTitle" v-model="dialogVisible">
 | 
			
		||||
  <Dialog v-model="dialogVisible" :title="dialogTitle" width="60%">
 | 
			
		||||
    <el-form
 | 
			
		||||
      ref="formRef"
 | 
			
		||||
      v-loading="formLoading"
 | 
			
		||||
      :model="formData"
 | 
			
		||||
      :rules="formRules"
 | 
			
		||||
      label-width="80px"
 | 
			
		||||
      v-loading="formLoading"
 | 
			
		||||
    >
 | 
			
		||||
      <el-form-item label="活动名称" prop="name">
 | 
			
		||||
        <el-input v-model="formData.name" placeholder="请输入活动名称" />
 | 
			
		||||
@@ -13,10 +13,10 @@
 | 
			
		||||
      <el-form-item label="活动时间" prop="startAndEndTime">
 | 
			
		||||
        <el-date-picker
 | 
			
		||||
          v-model="formData.startAndEndTime"
 | 
			
		||||
          type="datetimerange"
 | 
			
		||||
          range-separator="-"
 | 
			
		||||
          :start-placeholder="t('common.startTimeText')"
 | 
			
		||||
          :end-placeholder="t('common.endTimeText')"
 | 
			
		||||
          :start-placeholder="t('common.startTimeText')"
 | 
			
		||||
          range-separator="-"
 | 
			
		||||
          type="datetimerange"
 | 
			
		||||
        />
 | 
			
		||||
      </el-form-item>
 | 
			
		||||
      <el-form-item label="条件类型" prop="conditionType">
 | 
			
		||||
@@ -31,81 +31,9 @@
 | 
			
		||||
        </el-radio-group>
 | 
			
		||||
      </el-form-item>
 | 
			
		||||
      <el-form-item label="优惠设置">
 | 
			
		||||
        <template v-for="(item, index) in formData.rules" :key="index">
 | 
			
		||||
          <el-row type="flex">
 | 
			
		||||
            <el-col :span="24" style="font-weight: bold; display: flex">
 | 
			
		||||
              活动层级{{ index + 1 }}
 | 
			
		||||
              <el-button
 | 
			
		||||
                link
 | 
			
		||||
                type="danger"
 | 
			
		||||
                style="margin-left: auto"
 | 
			
		||||
                v-if="index != 0"
 | 
			
		||||
                @click="deleteActivityRule(index)"
 | 
			
		||||
              >
 | 
			
		||||
                删除
 | 
			
		||||
              </el-button>
 | 
			
		||||
            </el-col>
 | 
			
		||||
            <e-form :ref="'formRef' + index" :model="item">
 | 
			
		||||
              <el-form-item
 | 
			
		||||
                label="优惠门槛:"
 | 
			
		||||
                prop="limit"
 | 
			
		||||
                label-width="100px"
 | 
			
		||||
                style="padding-left: 50px"
 | 
			
		||||
              >
 | 
			
		||||
                满
 | 
			
		||||
                <el-input
 | 
			
		||||
                  style="width: 150px; padding: 0 10px"
 | 
			
		||||
                  v-model="item.limit"
 | 
			
		||||
                  type="number"
 | 
			
		||||
                  placeholder=""
 | 
			
		||||
                />
 | 
			
		||||
                元
 | 
			
		||||
              </el-form-item>
 | 
			
		||||
              <el-form-item label="优惠内容:" label-width="100px" style="padding-left: 50px">
 | 
			
		||||
                <el-checkbox-group v-model="activityRules[index]" style="width: 100%">
 | 
			
		||||
                  <el-col :span="24">
 | 
			
		||||
                    <el-checkbox label="订单金额优惠" name="type" />
 | 
			
		||||
                    <el-form-item v-if="activityRules[index].includes('订单金额优惠')">
 | 
			
		||||
                      减
 | 
			
		||||
                      <el-input
 | 
			
		||||
                        style="width: 150px; padding: 0 20px"
 | 
			
		||||
                        v-model="item.discountPrice"
 | 
			
		||||
                        type="number"
 | 
			
		||||
                        placeholder=""
 | 
			
		||||
                      />
 | 
			
		||||
                      元
 | 
			
		||||
                    </el-form-item>
 | 
			
		||||
                  </el-col>
 | 
			
		||||
                  <el-col :span="24">
 | 
			
		||||
                    <el-checkbox v-model="item.freeDelivery" label="包邮" name="type" />
 | 
			
		||||
                  </el-col>
 | 
			
		||||
                  <el-col :span="24">
 | 
			
		||||
                    <el-checkbox label="送积分" name="type" />
 | 
			
		||||
                    <el-form-item v-if="activityRules[index].includes('送积分')">
 | 
			
		||||
                      送
 | 
			
		||||
                      <el-input
 | 
			
		||||
                        style="width: 150px; padding: 0 20px"
 | 
			
		||||
                        v-model="item.point"
 | 
			
		||||
                        type="number"
 | 
			
		||||
                        placeholder=""
 | 
			
		||||
                      />
 | 
			
		||||
                      积分
 | 
			
		||||
                    </el-form-item>
 | 
			
		||||
                  </el-col>
 | 
			
		||||
                  <!-- 优惠券待处理  也可以参考优惠劵的SpuShowcase-->
 | 
			
		||||
                  <!-- TODO 待实现!-->
 | 
			
		||||
                  <el-col :span="24">
 | 
			
		||||
                    <el-checkbox label="送优惠券" name="type" />
 | 
			
		||||
                  </el-col>
 | 
			
		||||
                </el-checkbox-group>
 | 
			
		||||
              </el-form-item>
 | 
			
		||||
            </e-form>
 | 
			
		||||
          </el-row>
 | 
			
		||||
        </template>
 | 
			
		||||
        <!-- TODO 实现:建议改成放在每一个【活动层级】的下面,有点类似主子表 -->
 | 
			
		||||
        <el-button type="primary" @click="addActivityStratum">添加活动层级</el-button>
 | 
			
		||||
        <RewardRule v-model="formData" />
 | 
			
		||||
      </el-form-item>
 | 
			
		||||
      <el-form-item label="活动商品" prop="productScope">
 | 
			
		||||
      <el-form-item label="活动范围" prop="productScope">
 | 
			
		||||
        <el-radio-group v-model="formData.productScope">
 | 
			
		||||
          <el-radio
 | 
			
		||||
            v-for="dict in getIntDictOptions(DICT_TYPE.PROMOTION_PRODUCT_SCOPE)"
 | 
			
		||||
@@ -116,88 +44,58 @@
 | 
			
		||||
          </el-radio>
 | 
			
		||||
        </el-radio-group>
 | 
			
		||||
      </el-form-item>
 | 
			
		||||
      <!-- TODO:活动商品的开发,可以参考优惠劵的,已经搞好啦; -->
 | 
			
		||||
      <el-form-item
 | 
			
		||||
        v-if="formData.productScope === PromotionProductScopeEnum.SPU.scope"
 | 
			
		||||
        prop="productSpuIds"
 | 
			
		||||
      >
 | 
			
		||||
        <el-select
 | 
			
		||||
          v-model="formData.productSpuIds"
 | 
			
		||||
          placeholder="请选择活动商品"
 | 
			
		||||
          clearable
 | 
			
		||||
          size="small"
 | 
			
		||||
          multiple
 | 
			
		||||
          filterable
 | 
			
		||||
          style="width: 400px"
 | 
			
		||||
        >
 | 
			
		||||
          <el-option v-for="item in productSpus" :key="item.id" :label="item.name" :value="item.id">
 | 
			
		||||
            <span style="float: left">{{ item.name }}</span>
 | 
			
		||||
            <span style="float: right; font-size: 13px; color: #8492a6">
 | 
			
		||||
              ¥{{ (item.price / 100.0).toFixed(2) }}
 | 
			
		||||
            </span>
 | 
			
		||||
          </el-option>
 | 
			
		||||
        </el-select>
 | 
			
		||||
        <SpuShowcase v-model="formData.productSpuIds" />
 | 
			
		||||
      </el-form-item>
 | 
			
		||||
      <el-form-item
 | 
			
		||||
        v-if="formData.productScope === PromotionProductScopeEnum.CATEGORY.scope"
 | 
			
		||||
        label="分类"
 | 
			
		||||
        prop="productCategoryIds"
 | 
			
		||||
      >
 | 
			
		||||
        <ProductCategorySelect v-model="formData.productCategoryIds" />
 | 
			
		||||
      </el-form-item>
 | 
			
		||||
      <el-form-item label="备注" prop="remark">
 | 
			
		||||
        <el-input v-model="formData.remark" placeholder="请输入备注" />
 | 
			
		||||
      </el-form-item>
 | 
			
		||||
    </el-form>
 | 
			
		||||
    <template #footer>
 | 
			
		||||
      <el-button @click="submitForm" type="primary" :disabled="formLoading">确 定</el-button>
 | 
			
		||||
      <el-button :disabled="formLoading" type="primary" @click="submitForm">确 定</el-button>
 | 
			
		||||
      <el-button @click="dialogVisible = false">取 消</el-button>
 | 
			
		||||
    </template>
 | 
			
		||||
  </Dialog>
 | 
			
		||||
</template>
 | 
			
		||||
<script lang="ts" setup>
 | 
			
		||||
import { getSpuSimpleList } from '@/api/mall/product/spu'
 | 
			
		||||
import RewardRule from './components/RewardRule.vue'
 | 
			
		||||
import SpuShowcase from '@/views/mall/product/spu/components/SpuShowcase.vue'
 | 
			
		||||
import { DICT_TYPE, getIntDictOptions } from '@/utils/dict'
 | 
			
		||||
import * as RewardActivityApi from '@/api/mall/promotion/reward/rewardActivity'
 | 
			
		||||
import { PromotionConditionTypeEnum, PromotionProductScopeEnum } from '@/utils/constants'
 | 
			
		||||
import ProductCategorySelect from '@/views/mall/product/category/components/ProductCategorySelect.vue'
 | 
			
		||||
 | 
			
		||||
/** 初始化 **/
 | 
			
		||||
onMounted(() => {
 | 
			
		||||
  getSpuSimpleList().then((response) => {
 | 
			
		||||
    productSpus.value = response
 | 
			
		||||
  })
 | 
			
		||||
})
 | 
			
		||||
defineOptions({ name: 'ProductBrandForm' })
 | 
			
		||||
 | 
			
		||||
const { t } = useI18n() // 国际化
 | 
			
		||||
const message = useMessage() // 消息弹窗
 | 
			
		||||
 | 
			
		||||
const productSpus = ref<any[]>([]) // 商品数据
 | 
			
		||||
const dialogVisible = ref(false) // 弹窗的是否展示
 | 
			
		||||
const dialogTitle = ref('') // 弹窗的标题
 | 
			
		||||
const formLoading = ref(false) // 表单的加载中:1)修改时的数据加载;2)提交的按钮禁用
 | 
			
		||||
const formType = ref('') // 表单的类型:create - 新增;update - 修改
 | 
			
		||||
const formData = ref({
 | 
			
		||||
  id: undefined,
 | 
			
		||||
  name: undefined,
 | 
			
		||||
  startAndEndTime: undefined,
 | 
			
		||||
  startTime: undefined,
 | 
			
		||||
  endTime: undefined,
 | 
			
		||||
const formData = ref<RewardActivityApi.RewardActivityVO>({
 | 
			
		||||
  conditionType: PromotionConditionTypeEnum.PRICE.type,
 | 
			
		||||
  remark: undefined,
 | 
			
		||||
  productScope: PromotionProductScopeEnum.ALL.scope,
 | 
			
		||||
  productSpuIds: undefined,
 | 
			
		||||
  rules: [
 | 
			
		||||
    {
 | 
			
		||||
      limit: undefined,
 | 
			
		||||
      discountPrice: undefined,
 | 
			
		||||
      freeDelivery: undefined,
 | 
			
		||||
      point: undefined,
 | 
			
		||||
      couponIds: [],
 | 
			
		||||
      couponCounts: []
 | 
			
		||||
    }
 | 
			
		||||
  ]
 | 
			
		||||
})
 | 
			
		||||
const activityRules = reactive([]) // 优惠设置。每个元素都是一个 [],放“包邮”、“送积分”、“订单金额优惠”
 | 
			
		||||
  rules: []
 | 
			
		||||
} as RewardActivityApi.RewardActivityVO)
 | 
			
		||||
const formRules = reactive({
 | 
			
		||||
  name: [{ required: true, message: '活动名称不能为空', trigger: 'blur' }],
 | 
			
		||||
  startAndEndTime: [{ required: true, message: '活动时间不能为空', trigger: 'blur' }],
 | 
			
		||||
  conditionType: [{ required: true, message: '条件类型不能为空', trigger: 'change' }],
 | 
			
		||||
  productScope: [{ required: true, message: '商品范围不能为空', trigger: 'blur' }],
 | 
			
		||||
  productSpuIds: [{ required: true, message: '商品范围不能为空', trigger: 'blur' }]
 | 
			
		||||
  productSpuIds: [{ required: true, message: '商品不能为空', trigger: 'blur' }],
 | 
			
		||||
  productCategoryIds: [{ required: true, message: '商品分类不能为空', trigger: 'blur' }]
 | 
			
		||||
})
 | 
			
		||||
const formRef = ref([]) // 表单 Ref
 | 
			
		||||
 | 
			
		||||
@@ -211,24 +109,11 @@ const open = async (type: string, id?: number) => {
 | 
			
		||||
  if (id) {
 | 
			
		||||
    formLoading.value = true
 | 
			
		||||
    try {
 | 
			
		||||
      let data = await RewardActivityApi.getReward(id)
 | 
			
		||||
      data.startAndEndTime = [new Date(data.startTime), new Date(data.endTime)]
 | 
			
		||||
      activityRules.splice(0, activityRules.length)
 | 
			
		||||
      data.rules.forEach((item) => {
 | 
			
		||||
        // TODO 是不是不用 reactive,直接 [] 就可以了?
 | 
			
		||||
        let array: string[] = reactive([])
 | 
			
		||||
        if (item.freeDelivery) {
 | 
			
		||||
          array.push('包邮')
 | 
			
		||||
        }
 | 
			
		||||
        if (item.point) {
 | 
			
		||||
          array.push('送积分')
 | 
			
		||||
        }
 | 
			
		||||
        if (item.discountPrice) {
 | 
			
		||||
          array.push('订单金额优惠')
 | 
			
		||||
        }
 | 
			
		||||
        activityRules.push(array)
 | 
			
		||||
      })
 | 
			
		||||
      const data = await RewardActivityApi.getReward(id)
 | 
			
		||||
      data.startAndEndTime = [data.startTime, data.endTime]
 | 
			
		||||
      formData.value = data
 | 
			
		||||
      // 获得商品范围
 | 
			
		||||
      await getProductScope()
 | 
			
		||||
    } finally {
 | 
			
		||||
      formLoading.value = false
 | 
			
		||||
    }
 | 
			
		||||
@@ -241,25 +126,17 @@ const emit = defineEmits(['success']) // 定义 success 事件,用于操作成
 | 
			
		||||
const submitForm = async () => {
 | 
			
		||||
  // 校验表单
 | 
			
		||||
  if (!formRef) return
 | 
			
		||||
  const valid = await formRef.value.validate()
 | 
			
		||||
  if (!valid) return
 | 
			
		||||
  // 处理下数据兼容接口
 | 
			
		||||
  formData.value.startTime = +new Date(formData.value.startAndEndTime[0])
 | 
			
		||||
  formData.value.endTime = +new Date(formData.value.startAndEndTime[1])
 | 
			
		||||
  activityRules.forEach((item, index) => {
 | 
			
		||||
    formData.value.rules[index].freeDelivery = !!item.includes('包邮')
 | 
			
		||||
    if (!item.includes('送积分')) {
 | 
			
		||||
      formData.value.rules[index].point = undefined
 | 
			
		||||
    }
 | 
			
		||||
    if (!item.includes('订单金额优惠')) {
 | 
			
		||||
      formData.value.rules[index].discountPrice = undefined
 | 
			
		||||
    }
 | 
			
		||||
  })
 | 
			
		||||
  // TODO puhui999: 规则校验
 | 
			
		||||
  // const valid = await formRef.value.validate()
 | 
			
		||||
  // if (!valid) return
 | 
			
		||||
  // TODO puhui999: 处理下数据兼容接口
 | 
			
		||||
 | 
			
		||||
  // 提交请求
 | 
			
		||||
  formLoading.value = true
 | 
			
		||||
  try {
 | 
			
		||||
    const data = formData.value as RewardActivityApi.DiscountActivityVO
 | 
			
		||||
    const data = formData.value
 | 
			
		||||
    // 设置商品范围
 | 
			
		||||
    setProductScopeValues(data)
 | 
			
		||||
    if (formType.value === 'create') {
 | 
			
		||||
      await RewardActivityApi.createRewardActivity(data)
 | 
			
		||||
      message.success(t('common.createSuccess'))
 | 
			
		||||
@@ -275,51 +152,51 @@ const submitForm = async () => {
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const addActivityStratum = () => {
 | 
			
		||||
  formData.value.rules.push({
 | 
			
		||||
    limit: undefined,
 | 
			
		||||
    discountPrice: undefined,
 | 
			
		||||
    freeDelivery: undefined,
 | 
			
		||||
    point: undefined,
 | 
			
		||||
    couponIds: [],
 | 
			
		||||
    couponCounts: []
 | 
			
		||||
  })
 | 
			
		||||
  activityRules.push([])
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const deleteActivityRule = (index) => {
 | 
			
		||||
  formData.value.rules.splice(index, 1)
 | 
			
		||||
  activityRules.splice(index, 1)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/** 重置表单 */
 | 
			
		||||
const resetForm = () => {
 | 
			
		||||
  formData.value = {
 | 
			
		||||
    id: undefined,
 | 
			
		||||
    name: undefined,
 | 
			
		||||
    startAndEndTime: undefined,
 | 
			
		||||
    startTime: undefined,
 | 
			
		||||
    endTime: undefined,
 | 
			
		||||
    conditionType: PromotionConditionTypeEnum.PRICE.type,
 | 
			
		||||
    remark: undefined,
 | 
			
		||||
    productScope: PromotionProductScopeEnum.ALL.scope,
 | 
			
		||||
    productSpuIds: undefined,
 | 
			
		||||
    rules: [
 | 
			
		||||
      {
 | 
			
		||||
        limit: undefined,
 | 
			
		||||
        discountPrice: undefined,
 | 
			
		||||
        freeDelivery: undefined,
 | 
			
		||||
        point: undefined,
 | 
			
		||||
        couponIds: [],
 | 
			
		||||
        couponCounts: []
 | 
			
		||||
      }
 | 
			
		||||
    ]
 | 
			
		||||
    rules: []
 | 
			
		||||
  } as RewardActivityApi.RewardActivityVO
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/** 获得商品范围 */
 | 
			
		||||
const getProductScope = async () => {
 | 
			
		||||
  switch (formData.value.productScope) {
 | 
			
		||||
    case PromotionProductScopeEnum.SPU.scope:
 | 
			
		||||
      // 设置商品编号
 | 
			
		||||
      formData.value.productSpuIds = formData.value.productScopeValues
 | 
			
		||||
      break
 | 
			
		||||
    case PromotionProductScopeEnum.CATEGORY.scope:
 | 
			
		||||
      await nextTick(() => {
 | 
			
		||||
        let productCategoryIds = formData.value.productScopeValues as any
 | 
			
		||||
        if (Array.isArray(productCategoryIds) && productCategoryIds.length > 0) {
 | 
			
		||||
          // 单选时使用数组不能反显
 | 
			
		||||
          productCategoryIds = productCategoryIds[0]
 | 
			
		||||
        }
 | 
			
		||||
        // 设置品类编号
 | 
			
		||||
        formData.value.productCategoryIds = productCategoryIds
 | 
			
		||||
      })
 | 
			
		||||
      break
 | 
			
		||||
    default:
 | 
			
		||||
      break
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/** 设置商品范围 */
 | 
			
		||||
function setProductScopeValues(data: any) {
 | 
			
		||||
  switch (formData.value.productScope) {
 | 
			
		||||
    case PromotionProductScopeEnum.SPU.scope:
 | 
			
		||||
      data.productScopeValues = formData.value.productSpuIds
 | 
			
		||||
      break
 | 
			
		||||
    case PromotionProductScopeEnum.CATEGORY.scope:
 | 
			
		||||
      data.productScopeValues = Array.isArray(formData.value.productCategoryIds)
 | 
			
		||||
        ? formData.value.productCategoryIds
 | 
			
		||||
        : [formData.value.productCategoryIds]
 | 
			
		||||
      break
 | 
			
		||||
    default:
 | 
			
		||||
      break
 | 
			
		||||
  }
 | 
			
		||||
  activityRules.splice(0, activityRules.length)
 | 
			
		||||
  activityRules.push(reactive([]))
 | 
			
		||||
  // 解决下有时刷新页面第一次点编辑报错
 | 
			
		||||
  nextTick(() => {
 | 
			
		||||
    formRef.value?.resetFields()
 | 
			
		||||
  })
 | 
			
		||||
}
 | 
			
		||||
</script>
 | 
			
		||||
 
 | 
			
		||||
@@ -0,0 +1,129 @@
 | 
			
		||||
<template>
 | 
			
		||||
  <!-- 满减送活动规则组件 -->
 | 
			
		||||
  <el-row>
 | 
			
		||||
    <template v-if="formData.rules">
 | 
			
		||||
      <div v-for="(rule, index) in formData.rules" :key="index">
 | 
			
		||||
        <el-col :span="24">
 | 
			
		||||
          <span class="font-bold">活动层级{{ index + 1 }}</span>
 | 
			
		||||
          <el-button v-if="index !== 0" link type="danger" @click="deleteRule(index)">
 | 
			
		||||
            删除
 | 
			
		||||
          </el-button>
 | 
			
		||||
        </el-col>
 | 
			
		||||
        <el-form ref="formRef" :model="rule">
 | 
			
		||||
          <el-form-item label="优惠门槛:" label-width="100px" prop="limit">
 | 
			
		||||
            满
 | 
			
		||||
            <el-input
 | 
			
		||||
              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
 | 
			
		||||
                  v-model="rule.discountPrice"
 | 
			
		||||
                  class="w-150px! p-x-20px!"
 | 
			
		||||
                  placeholder=""
 | 
			
		||||
                  type="number"
 | 
			
		||||
                />
 | 
			
		||||
                元
 | 
			
		||||
              </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-switch
 | 
			
		||||
                v-model="rule.givePoint"
 | 
			
		||||
                active-text="是"
 | 
			
		||||
                inactive-text="否"
 | 
			
		||||
                inline-prompt
 | 
			
		||||
              />
 | 
			
		||||
              <el-form-item v-if="rule.givePoint">
 | 
			
		||||
                送
 | 
			
		||||
                <el-input
 | 
			
		||||
                  v-model="rule.point"
 | 
			
		||||
                  class="w-150px! p-x-20px!"
 | 
			
		||||
                  placeholder=""
 | 
			
		||||
                  type="number"
 | 
			
		||||
                />
 | 
			
		||||
                积分
 | 
			
		||||
              </el-form-item>
 | 
			
		||||
            </el-col>
 | 
			
		||||
            <!-- 优惠券待处理  也可以参考优惠劵的SpuShowcase-->
 | 
			
		||||
            <!-- TODO 待实现!-->
 | 
			
		||||
            <el-col :span="24">
 | 
			
		||||
              <span>送优惠券:</span>
 | 
			
		||||
              <el-switch
 | 
			
		||||
                v-model="rule.giveCoupon"
 | 
			
		||||
                active-text="是"
 | 
			
		||||
                inactive-text="否"
 | 
			
		||||
                inline-prompt
 | 
			
		||||
              />
 | 
			
		||||
              <RewardRuleCouponShowcase v-if="rule.giveCoupon" />
 | 
			
		||||
            </el-col>
 | 
			
		||||
          </el-form-item>
 | 
			
		||||
        </el-form>
 | 
			
		||||
      </div>
 | 
			
		||||
    </template>
 | 
			
		||||
    <el-col :span="24">
 | 
			
		||||
      <el-button type="primary" @click="addRule">添加优惠规则</el-button>
 | 
			
		||||
    </el-col>
 | 
			
		||||
  </el-row>
 | 
			
		||||
</template>
 | 
			
		||||
 | 
			
		||||
<script lang="ts" setup>
 | 
			
		||||
import RewardRuleCouponShowcase from './RewardRuleCouponShowcase.vue'
 | 
			
		||||
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
 | 
			
		||||
}>()
 | 
			
		||||
 | 
			
		||||
const emits = defineEmits<{
 | 
			
		||||
  (e: 'update:modelValue', v: any): void
 | 
			
		||||
  (e: 'deleteRule', v: number): void
 | 
			
		||||
}>()
 | 
			
		||||
 | 
			
		||||
const formData = useVModel(props, 'modelValue', emits) // 活动数据
 | 
			
		||||
 | 
			
		||||
/** 删除优惠规则 */
 | 
			
		||||
const deleteRule = (ruleIndex: number) => {
 | 
			
		||||
  formData.value.rules.splice(ruleIndex, 1)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/** 添加优惠规则 */
 | 
			
		||||
const addRule = () => {
 | 
			
		||||
  formData.value.rules.push({
 | 
			
		||||
    limit: 0,
 | 
			
		||||
    discountPrice: 0,
 | 
			
		||||
    freeDelivery: false,
 | 
			
		||||
    givePoint: false,
 | 
			
		||||
    point: 0,
 | 
			
		||||
    giveCoupon: false,
 | 
			
		||||
    couponIds: [],
 | 
			
		||||
    couponCounts: []
 | 
			
		||||
  })
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// TODO puhui999: 规则校验完善
 | 
			
		||||
</script>
 | 
			
		||||
 | 
			
		||||
<style lang="scss" scoped></style>
 | 
			
		||||
@@ -0,0 +1,72 @@
 | 
			
		||||
<template>
 | 
			
		||||
  <ContentWrap>
 | 
			
		||||
    <el-button @click="selectCoupon">添加优惠卷</el-button>
 | 
			
		||||
    <el-table :data="list">
 | 
			
		||||
      <el-table-column label="优惠券名称" prop="name" />
 | 
			
		||||
      <el-table-column label="类型" prop="productScope">
 | 
			
		||||
        <template #default="scope">
 | 
			
		||||
          <dict-tag :type="DICT_TYPE.PROMOTION_PRODUCT_SCOPE" :value="scope.row.productScope" />
 | 
			
		||||
        </template>
 | 
			
		||||
      </el-table-column>
 | 
			
		||||
      <el-table-column label="优惠" prop="discount">
 | 
			
		||||
        <template #default="scope">
 | 
			
		||||
          <dict-tag :type="DICT_TYPE.PROMOTION_DISCOUNT_TYPE" :value="scope.row.discountType" />
 | 
			
		||||
          {{ discountFormat(scope.row) }}
 | 
			
		||||
        </template>
 | 
			
		||||
      </el-table-column>
 | 
			
		||||
      <el-table-column
 | 
			
		||||
        :formatter="validityTypeFormat"
 | 
			
		||||
        align="center"
 | 
			
		||||
        label="使用时间"
 | 
			
		||||
        prop="validityType"
 | 
			
		||||
      />
 | 
			
		||||
      <el-table-column
 | 
			
		||||
        :formatter="remainedCountFormat"
 | 
			
		||||
        align="center"
 | 
			
		||||
        label="剩余数量"
 | 
			
		||||
        prop="totalCount"
 | 
			
		||||
      />
 | 
			
		||||
      <el-table-column align="center" fixed="right" label="状态" prop="status">
 | 
			
		||||
        <template #default="scope">
 | 
			
		||||
          <dict-tag :type="DICT_TYPE.COMMON_STATUS" :value="scope.row.status" />
 | 
			
		||||
        </template>
 | 
			
		||||
      </el-table-column>
 | 
			
		||||
    </el-table>
 | 
			
		||||
  </ContentWrap>
 | 
			
		||||
 | 
			
		||||
  <!-- 优惠券选择 -->
 | 
			
		||||
  <CouponSelect ref="couponSelectRef" @change="handleCouponChange" />
 | 
			
		||||
</template>
 | 
			
		||||
 | 
			
		||||
<script lang="ts" setup>
 | 
			
		||||
// TODO puhui999: 先简单选择后列表展示,后续继续 fix
 | 
			
		||||
import { CouponSelect } from '@/views/mall/promotion/coupon/components'
 | 
			
		||||
import * as CouponTemplateApi from '@/api/mall/promotion/coupon/couponTemplate'
 | 
			
		||||
import { DICT_TYPE } from '@/utils/dict'
 | 
			
		||||
import {
 | 
			
		||||
  discountFormat,
 | 
			
		||||
  remainedCountFormat,
 | 
			
		||||
  validityTypeFormat
 | 
			
		||||
} from '@/views/mall/promotion/coupon/formatter'
 | 
			
		||||
 | 
			
		||||
defineOptions({ name: 'RewardRuleCouponShowcase' })
 | 
			
		||||
 | 
			
		||||
const list = ref<CouponTemplateApi.CouponTemplateVO[]>([]) // 选择的优惠券列表
 | 
			
		||||
 | 
			
		||||
const couponSelectRef = ref<InstanceType<typeof CouponSelect>>() // 优惠券选择
 | 
			
		||||
/** 选择优惠券 */
 | 
			
		||||
const selectCoupon = () => {
 | 
			
		||||
  couponSelectRef.value?.open()
 | 
			
		||||
}
 | 
			
		||||
/** 选择优惠券后的回调 */
 | 
			
		||||
const handleCouponChange = (val: CouponTemplateApi.CouponTemplateVO[]) => {
 | 
			
		||||
  for (const item of val) {
 | 
			
		||||
    if (list.value.some((v) => v.id === item.id)) {
 | 
			
		||||
      continue
 | 
			
		||||
    }
 | 
			
		||||
    list.value.push(item)
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
</script>
 | 
			
		||||
 | 
			
		||||
<style lang="scss" scoped></style>
 | 
			
		||||
@@ -4,27 +4,27 @@
 | 
			
		||||
  <!-- 搜索工作栏 -->
 | 
			
		||||
  <ContentWrap>
 | 
			
		||||
    <el-form
 | 
			
		||||
      class="-mb-15px"
 | 
			
		||||
      :model="queryParams"
 | 
			
		||||
      ref="queryFormRef"
 | 
			
		||||
      :inline="true"
 | 
			
		||||
      :model="queryParams"
 | 
			
		||||
      class="-mb-15px"
 | 
			
		||||
      label-width="68px"
 | 
			
		||||
    >
 | 
			
		||||
      <el-form-item label="活动名称" prop="name">
 | 
			
		||||
        <el-input
 | 
			
		||||
          v-model="queryParams.name"
 | 
			
		||||
          placeholder="请输入活动名称"
 | 
			
		||||
          clearable
 | 
			
		||||
          @keyup.enter="handleQuery"
 | 
			
		||||
          class="!w-240px"
 | 
			
		||||
          clearable
 | 
			
		||||
          placeholder="请输入活动名称"
 | 
			
		||||
          @keyup.enter="handleQuery"
 | 
			
		||||
        />
 | 
			
		||||
      </el-form-item>
 | 
			
		||||
      <el-form-item label="活动状态" prop="status">
 | 
			
		||||
        <el-select
 | 
			
		||||
          v-model="queryParams.status"
 | 
			
		||||
          placeholder="请选择活动状态"
 | 
			
		||||
          clearable
 | 
			
		||||
          class="!w-240px"
 | 
			
		||||
          clearable
 | 
			
		||||
          placeholder="请选择活动状态"
 | 
			
		||||
        >
 | 
			
		||||
          <el-option
 | 
			
		||||
            v-for="dict in getIntDictOptions(DICT_TYPE.PROMOTION_ACTIVITY_STATUS)"
 | 
			
		||||
@@ -37,24 +37,31 @@
 | 
			
		||||
      <el-form-item label="活动时间" prop="createTime">
 | 
			
		||||
        <el-date-picker
 | 
			
		||||
          v-model="queryParams.createTime"
 | 
			
		||||
          value-format="YYYY-MM-DD HH:mm:ss"
 | 
			
		||||
          type="daterange"
 | 
			
		||||
          start-placeholder="活动开始日期"
 | 
			
		||||
          end-placeholder="活动结束日期"
 | 
			
		||||
          :default-time="[new Date('1 00:00:00'), new Date('1 23:59:59')]"
 | 
			
		||||
          class="!w-240px"
 | 
			
		||||
          end-placeholder="活动结束日期"
 | 
			
		||||
          start-placeholder="活动开始日期"
 | 
			
		||||
          type="daterange"
 | 
			
		||||
          value-format="YYYY-MM-DD HH:mm:ss"
 | 
			
		||||
        />
 | 
			
		||||
      </el-form-item>
 | 
			
		||||
      <el-form-item>
 | 
			
		||||
        <el-button @click="handleQuery"><Icon icon="ep:search" class="mr-5px" /> 搜索</el-button>
 | 
			
		||||
        <el-button @click="resetQuery"><Icon icon="ep:refresh" class="mr-5px" /> 重置</el-button>
 | 
			
		||||
        <el-button @click="handleQuery">
 | 
			
		||||
          <Icon class="mr-5px" icon="ep:search" />
 | 
			
		||||
          搜索
 | 
			
		||||
        </el-button>
 | 
			
		||||
        <el-button @click="resetQuery">
 | 
			
		||||
          <Icon class="mr-5px" icon="ep:refresh" />
 | 
			
		||||
          重置
 | 
			
		||||
        </el-button>
 | 
			
		||||
        <el-button
 | 
			
		||||
          type="primary"
 | 
			
		||||
          plain
 | 
			
		||||
          @click="openForm('create')"
 | 
			
		||||
          v-hasPermi="['product:brand:create']"
 | 
			
		||||
          plain
 | 
			
		||||
          type="primary"
 | 
			
		||||
          @click="openForm('create')"
 | 
			
		||||
        >
 | 
			
		||||
          <Icon icon="ep:plus" class="mr-5px" /> 新增
 | 
			
		||||
          <Icon class="mr-5px" icon="ep:plus" />
 | 
			
		||||
          新增
 | 
			
		||||
        </el-button>
 | 
			
		||||
      </el-form-item>
 | 
			
		||||
    </el-form>
 | 
			
		||||
@@ -62,47 +69,47 @@
 | 
			
		||||
 | 
			
		||||
  <!-- 列表 -->
 | 
			
		||||
  <ContentWrap>
 | 
			
		||||
    <el-table v-loading="loading" :data="list" row-key="id" default-expand-all>
 | 
			
		||||
    <el-table v-loading="loading" :data="list" default-expand-all row-key="id">
 | 
			
		||||
      <el-table-column label="活动名称" prop="name" />
 | 
			
		||||
      <el-table-column
 | 
			
		||||
        label="活动开始时间"
 | 
			
		||||
        align="center"
 | 
			
		||||
        prop="startTime"
 | 
			
		||||
        :formatter="dateFormatter"
 | 
			
		||||
        align="center"
 | 
			
		||||
        label="活动开始时间"
 | 
			
		||||
        prop="startTime"
 | 
			
		||||
      />
 | 
			
		||||
      <el-table-column
 | 
			
		||||
        label="活动结束时间"
 | 
			
		||||
        align="center"
 | 
			
		||||
        prop="endTime"
 | 
			
		||||
        :formatter="dateFormatter"
 | 
			
		||||
        align="center"
 | 
			
		||||
        label="活动结束时间"
 | 
			
		||||
        prop="endTime"
 | 
			
		||||
      />
 | 
			
		||||
      <el-table-column label="状态" align="center" prop="status">
 | 
			
		||||
      <el-table-column align="center" label="状态" prop="status">
 | 
			
		||||
        <template #default="scope">
 | 
			
		||||
          <dict-tag :type="DICT_TYPE.PROMOTION_ACTIVITY_STATUS" :value="scope.row.status" />
 | 
			
		||||
        </template>
 | 
			
		||||
      </el-table-column>
 | 
			
		||||
      <el-table-column
 | 
			
		||||
        label="创建时间"
 | 
			
		||||
        :formatter="dateFormatter"
 | 
			
		||||
        align="center"
 | 
			
		||||
        label="创建时间"
 | 
			
		||||
        prop="createTime"
 | 
			
		||||
        width="180"
 | 
			
		||||
        :formatter="dateFormatter"
 | 
			
		||||
      />
 | 
			
		||||
      <el-table-column label="操作" align="center">
 | 
			
		||||
      <el-table-column align="center" label="操作">
 | 
			
		||||
        <template #default="scope">
 | 
			
		||||
          <el-button
 | 
			
		||||
            v-hasPermi="['product:brand:update']"
 | 
			
		||||
            link
 | 
			
		||||
            type="primary"
 | 
			
		||||
            @click="openForm('update', scope.row.id)"
 | 
			
		||||
            v-hasPermi="['product:brand:update']"
 | 
			
		||||
          >
 | 
			
		||||
            编辑
 | 
			
		||||
          </el-button>
 | 
			
		||||
          <el-button
 | 
			
		||||
            v-hasPermi="['product:brand:delete']"
 | 
			
		||||
            link
 | 
			
		||||
            type="danger"
 | 
			
		||||
            @click="handleDelete(scope.row.id)"
 | 
			
		||||
            v-hasPermi="['product:brand:delete']"
 | 
			
		||||
          >
 | 
			
		||||
            删除
 | 
			
		||||
          </el-button>
 | 
			
		||||
@@ -111,9 +118,9 @@
 | 
			
		||||
    </el-table>
 | 
			
		||||
    <!-- 分页 -->
 | 
			
		||||
    <Pagination
 | 
			
		||||
      :total="total"
 | 
			
		||||
      v-model:page="queryParams.pageNo"
 | 
			
		||||
      v-model:limit="queryParams.pageSize"
 | 
			
		||||
      v-model:page="queryParams.pageNo"
 | 
			
		||||
      :total="total"
 | 
			
		||||
      @pagination="getList"
 | 
			
		||||
    />
 | 
			
		||||
  </ContentWrap>
 | 
			
		||||
@@ -168,9 +175,9 @@ const resetQuery = () => {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/** 添加/修改操作 */
 | 
			
		||||
const formRef = ref()
 | 
			
		||||
const formRef = ref<InstanceType<typeof RewardForm>>()
 | 
			
		||||
const openForm = (type: string, id?: number) => {
 | 
			
		||||
  formRef.value.open(type, id)
 | 
			
		||||
  formRef.value?.open(type, id)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/** 删除按钮操作 */
 | 
			
		||||
 
 | 
			
		||||
@@ -14,7 +14,7 @@
 | 
			
		||||
        <el-input v-model="formData.nickname" class="!w-240px" disabled />
 | 
			
		||||
      </el-form-item>
 | 
			
		||||
      <el-form-item label="变动前余额(元)" prop="balance">
 | 
			
		||||
        <el-input-number v-model="formData.balance" class="!w-240px" disabled />
 | 
			
		||||
        <el-input :model-value="formData.balance" class="!w-240px" disabled />
 | 
			
		||||
      </el-form-item>
 | 
			
		||||
      <el-form-item label="变动类型" prop="changeType">
 | 
			
		||||
        <el-radio-group v-model="formData.changeType">
 | 
			
		||||
@@ -32,7 +32,7 @@
 | 
			
		||||
        />
 | 
			
		||||
      </el-form-item>
 | 
			
		||||
      <el-form-item label="变动后余额(元)">
 | 
			
		||||
        <el-input-number v-model="balanceResult" class="!w-240px" disabled />
 | 
			
		||||
        <el-input :model-value="balanceResult" class="!w-240px" disabled />
 | 
			
		||||
      </el-form-item>
 | 
			
		||||
    </el-form>
 | 
			
		||||
    <template #footer>
 | 
			
		||||
@@ -57,7 +57,7 @@ const formLoading = ref(false) // 表单的加载中:1)修改时的数据加
 | 
			
		||||
const formData = ref({
 | 
			
		||||
  id: undefined,
 | 
			
		||||
  nickname: undefined,
 | 
			
		||||
  balance: '0', // TODO @puhui999:貌似有 el-input-number 的报错,看看怎么解决。应该可以
 | 
			
		||||
  balance: '0',
 | 
			
		||||
  changeBalance: 0,
 | 
			
		||||
  changeType: 1
 | 
			
		||||
})
 | 
			
		||||
@@ -108,8 +108,8 @@ const submitForm = async () => {
 | 
			
		||||
  // 提交请求
 | 
			
		||||
  formLoading.value = true
 | 
			
		||||
  try {
 | 
			
		||||
    await UserApi.updateUserBalance({
 | 
			
		||||
      id: formData.value.id,
 | 
			
		||||
    await WalletApi.updateWalletBalance({
 | 
			
		||||
      userId: formData.value.id,
 | 
			
		||||
      balance: convertToInteger(formData.value.changeBalance) * formData.value.changeType
 | 
			
		||||
    })
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user