会员积分针对代码格式、功能优化

1.修改积分抵扣单位,按照分显示
This commit is contained in:
xiaqing 2023-08-09 22:32:13 +08:00
parent de941ec6ba
commit f2e029dca6

View File

@ -16,12 +16,12 @@
<el-form-item>
<el-text class="mx-1" size="small" type="info">下单积分是否抵用订单金额</el-text>
</el-form-item>
<!-- TODO @xiaqing用户看到的是元最多 2 分是后端的存储哈 -->
<el-form-item label="积分抵扣" prop="tradeDeductUnitPrice" class="item-bottom">
<el-input-number
v-model="formData.tradeDeductUnitPrice"
v-model="computedTradeDeductUnitPrice"
placeholder="请输入积分抵扣金额"
style="width: 300px"
:precision="2"
/>
</el-form-item>
<el-form-item>
@ -67,11 +67,19 @@ const dialogVisible = ref(false) // 弹窗的是否展示
const formLoading = ref(false) // 12
const formData = ref({
id: undefined,
tradeDeductEnable: undefined,
tradeDeductUnitPrice: undefined,
tradeDeductMaxPrice: undefined,
tradeGivePoint: undefined
tradeDeductEnable: true,
tradeDeductUnitPrice: 0,
tradeDeductMaxPrice: 0,
tradeGivePoint: 0
})
// tradeDeductUnitPrice
const computedTradeDeductUnitPrice = computed({
get: () => (formData.value.tradeDeductUnitPrice / 100).toFixed(2),
set: (newValue) => {
formData.value.tradeDeductUnitPrice = Math.round(newValue * 100)
}
})
const formRules = reactive({})
const formRef = ref() // Ref
@ -97,7 +105,8 @@ const onSubmit = async () => {
const getConfig = async () => {
try {
const data = await ConfigApi.getConfig()
formData.value = data
// if (data === null) return
// formData.value = data
} finally {
}
}