修改订单结算积分

This commit is contained in:
2026-01-05 10:11:32 +08:00
parent 55207667b0
commit 85aedcbedb
2 changed files with 1643 additions and 1706 deletions

View File

@@ -3,13 +3,12 @@
<template #desc> <template #desc>
<view class="u-text-left u-p-30 color-666 u-font-28"> <view class="u-text-left u-p-30 color-666 u-font-28">
<view class="u-m-t-32 u-flex"> <view class="u-m-t-32 u-flex">
<view class="" v-if="accountPoints.calcRes.usable"> <view class="" v-if="pointDeductionRule.enableRewards">
<text class="color-red">*</text> <text class="color-red">*</text>
<text class="" v-if="accountPoints.calcRes.equivalentPoints" <text class=""
>{{ accountPoints.calcRes.equivalentPoints }}积分等于1元,</text v-if="pointDeductionRule.equivalentPoints">{{ pointDeductionRule.equivalentPoints }}积分等于1元,</text>
>
<text> <text>
最大抵扣积分{{ accountPoints.calcRes.maxUsablePoints }} 最大抵扣积分{{ maxCanUsePoints }}
</text> </text>
<text>, 最小抵扣积分0 </text> <text>, 最小抵扣积分0 </text>
</view> </view>
@@ -17,15 +16,8 @@
<view class="u-m-t-40 u-flex"> <view class="u-m-t-40 u-flex">
<view>积分</view> <view>积分</view>
<view class="u-m-l-32 border u-p-l-10 u-p-r-10 u-flex-1"> <view class="u-m-l-32 border u-p-l-10 u-p-r-10 u-flex-1">
<uni-easyinput <uni-easyinput type="number" @input="pointsInput" @change="pointsChange" paddingNone
type="number" :inputBorder="false" v-model="form.points" placeholder="输入积分抵扣数量"></uni-easyinput>
@input="pointsInput"
@change="pointsChange"
paddingNone
:inputBorder="false"
v-model="form.points"
placeholder="输入积分抵扣数量"
></uni-easyinput>
</view> </view>
</view> </view>
</view> </view>
@@ -33,13 +25,9 @@
<template #btn> <template #btn>
<view class="u-p-30"> <view class="u-p-30">
<view class="u-m-t-10"> <view class="u-m-t-10">
<my-button @tap="confirm" shape="circle" fontWeight="700" <my-button @tap="confirm" shape="circle" fontWeight="700">修改</my-button>
>修改</my-button
>
<view class=""> <view class="">
<my-button @tap="close" type="cancel" bgColor="#fff" <my-button @tap="close" type="cancel" bgColor="#fff">取消</my-button>
>取消</my-button
>
</view> </view>
</view> </view>
</view> </view>
@@ -48,26 +36,33 @@
</template> </template>
<script setup> <script setup>
import { reactive, nextTick, ref, watch } from "vue"; import {
import myModel from "@/components/my-components/my-model.vue"; reactive,
import myButton from "@/components/my-components/my-button.vue"; nextTick,
import myTabs from "@/components/my-components/my-tabs.vue"; ref,
import infoBox from "@/commons/utils/infoBox.js"; watch
const props = defineProps({ } from "vue";
import myModel from "@/components/my-components/my-model.vue";
import myButton from "@/components/my-components/my-button.vue";
import myTabs from "@/components/my-components/my-tabs.vue";
import infoBox from "@/commons/utils/infoBox.js";
const props = defineProps({
title: { title: {
type: String, type: String,
default: "积分抵扣", default: "积分抵扣",
}, },
accountPoints: { maxCanUsePoints: {
type: Number,
default: 0
},
pointDeductionRule: {
type: Object, type: Object,
default: () => { default: () => {
return { return {
calcRes: { enableRewards: false,
usable: false,
unusableReason: "", unusableReason: "",
minDeductionPoints: 0, minDeductionPoints: 0,
maxUsablePoints: 0, maxUsablePoints: 0,
},
}; };
}, },
}, },
@@ -75,83 +70,83 @@ const props = defineProps({
type: [Number, String], type: [Number, String],
default: 0, default: 0,
}, },
}); });
function to2(n) { function to2(n) {
if (!n) { if (!n) {
return ""; return "";
} }
return n.toFixed(2); return n.toFixed(2);
} }
function pointsInput(e) { function pointsInput(e) {
setTimeout(() => { setTimeout(() => {
form.points = Math.floor(e); form.points = Math.floor(e);
}, 100); }, 100);
} }
function pointsChange(newval) { function pointsChange(newval) {
form.points = Math.floor(newval); form.points = Math.floor(newval);
if (newval < 0) { if (newval < 0) {
form.points = 0; form.points = 0;
return infoBox.showToast("积分抵扣不能小于0"); return infoBox.showToast("积分抵扣不能小于0");
} }
if (newval > props.accountPoints.calcRes.maxUsablePoints) { if (newval > props.maxCanUsePoints) {
form.points = props.price; form.points = props.price;
return infoBox.showToast( return infoBox.showToast(
"积分抵扣不能大于" + props.accountPoints.calcRes.maxUsablePoints "积分抵扣不能大于" + props.maxCanUsePoints
); );
} }
} }
const form = reactive({ const form = reactive({
points: props.price, points: props.price,
}); });
watch( watch(
() => props.price, () => props.price,
(newval) => { (newval) => {
form.points = newval; form.points = newval;
} }
); );
function resetForm() { function resetForm() {
form.points = 0; form.points = 0;
} }
const model = ref(null); const model = ref(null);
function open() { function open() {
model.value.open(); model.value.open();
form.points = props.price; form.points = props.price;
} }
function close() { function close() {
model.value.close(); model.value.close();
} }
const emits = defineEmits(["confirm"]); const emits = defineEmits(["confirm"]);
function confirm() { function confirm() {
emits("confirm", Math.floor(form.points)); emits("confirm", Math.floor(form.points));
close(); close();
} }
defineExpose({ defineExpose({
open, open,
close, close,
}); });
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.border { .border {
border-radius: 8rpx; border-radius: 8rpx;
overflow: hidden; overflow: hidden;
border-color: #999; border-color: #999;
} }
.lh34 { .lh34 {
line-height: 34rpx; line-height: 34rpx;
} }
.tag { .tag {
background-color: #fff; background-color: #fff;
border: 1px solid #e5e5e5; border: 1px solid #e5e5e5;
line-height: inherit; line-height: inherit;
@@ -164,40 +159,40 @@ defineExpose({
border-color: #e6f0ff; border-color: #e6f0ff;
color: $my-main-color; color: $my-main-color;
} }
} }
.hover-class { .hover-class {
background-color: #e5e5e5; background-color: #e5e5e5;
} }
.discount { .discount {
.u-absolute { .u-absolute {
top: 0; top: 0;
bottom: 0; bottom: 0;
right: 0; right: 0;
} }
} }
.bg1 { .bg1 {
background: #f7f7fa; background: #f7f7fa;
} }
.tab { .tab {
padding: 0 80rpx; padding: 0 80rpx;
} }
.border { .border {
border: 1px solid #e5e5e5; border: 1px solid #e5e5e5;
border-radius: 4rpx; border-radius: 4rpx;
} }
.input-box { .input-box {
padding: 22rpx 32rpx; padding: 22rpx 32rpx;
font-size: 28rpx; font-size: 28rpx;
color: #666; color: #666;
} }
.placeholder-class { .placeholder-class {
font-size: 28rpx; font-size: 28rpx;
} }
</style> </style>

File diff suppressed because it is too large Load Diff