修改订单结算积分
This commit is contained in:
@@ -1,203 +1,198 @@
|
|||||||
<template>
|
<template>
|
||||||
<my-model ref="model" :title="title" iconColor="#000" @close="resetForm">
|
<my-model ref="model" :title="title" iconColor="#000" @close="resetForm">
|
||||||
<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>
|
最大抵扣积分{{ maxCanUsePoints }}
|
||||||
最大抵扣积分{{ accountPoints.calcRes.maxUsablePoints }}
|
</text>
|
||||||
</text>
|
<text>, 最小抵扣积分0 </text>
|
||||||
<text>, 最小抵扣积分0 </text>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</view>
|
<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 type="number" @input="pointsInput" @change="pointsChange" paddingNone
|
||||||
<uni-easyinput
|
:inputBorder="false" v-model="form.points" placeholder="输入积分抵扣数量"></uni-easyinput>
|
||||||
type="number"
|
</view>
|
||||||
@input="pointsInput"
|
</view>
|
||||||
@change="pointsChange"
|
</view>
|
||||||
paddingNone
|
</template>
|
||||||
:inputBorder="false"
|
<template #btn>
|
||||||
v-model="form.points"
|
<view class="u-p-30">
|
||||||
placeholder="输入积分抵扣数量"
|
<view class="u-m-t-10">
|
||||||
></uni-easyinput>
|
<my-button @tap="confirm" shape="circle" fontWeight="700">修改</my-button>
|
||||||
</view>
|
<view class="">
|
||||||
</view>
|
<my-button @tap="close" type="cancel" bgColor="#fff">取消</my-button>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</view>
|
||||||
<template #btn>
|
</view>
|
||||||
<view class="u-p-30">
|
</template>
|
||||||
<view class="u-m-t-10">
|
</my-model>
|
||||||
<my-button @tap="confirm" shape="circle" fontWeight="700"
|
|
||||||
>修改</my-button
|
|
||||||
>
|
|
||||||
<view class="">
|
|
||||||
<my-button @tap="close" type="cancel" bgColor="#fff"
|
|
||||||
>取消</my-button
|
|
||||||
>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</view>
|
|
||||||
</template>
|
|
||||||
</my-model>
|
|
||||||
</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";
|
||||||
title: {
|
import myModel from "@/components/my-components/my-model.vue";
|
||||||
type: String,
|
import myButton from "@/components/my-components/my-button.vue";
|
||||||
default: "积分抵扣",
|
import myTabs from "@/components/my-components/my-tabs.vue";
|
||||||
},
|
import infoBox from "@/commons/utils/infoBox.js";
|
||||||
accountPoints: {
|
const props = defineProps({
|
||||||
type: Object,
|
title: {
|
||||||
default: () => {
|
type: String,
|
||||||
return {
|
default: "积分抵扣",
|
||||||
calcRes: {
|
},
|
||||||
usable: false,
|
maxCanUsePoints: {
|
||||||
unusableReason: "",
|
type: Number,
|
||||||
minDeductionPoints: 0,
|
default: 0
|
||||||
maxUsablePoints: 0,
|
},
|
||||||
},
|
pointDeductionRule: {
|
||||||
};
|
type: Object,
|
||||||
},
|
default: () => {
|
||||||
},
|
return {
|
||||||
price: {
|
enableRewards: false,
|
||||||
type: [Number, String],
|
unusableReason: "",
|
||||||
default: 0,
|
minDeductionPoints: 0,
|
||||||
},
|
maxUsablePoints: 0,
|
||||||
});
|
};
|
||||||
|
},
|
||||||
|
},
|
||||||
|
price: {
|
||||||
|
type: [Number, String],
|
||||||
|
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;
|
||||||
font-size: 24rpx;
|
font-size: 24rpx;
|
||||||
color: #666666;
|
color: #666666;
|
||||||
padding: 6rpx 20rpx;
|
padding: 6rpx 20rpx;
|
||||||
border-radius: 8rpx;
|
border-radius: 8rpx;
|
||||||
|
|
||||||
&.active {
|
&.active {
|
||||||
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
Reference in New Issue
Block a user