订单结算修改,增加限时折扣

This commit is contained in:
2025-10-24 16:13:40 +08:00
parent 5aa469a7b7
commit 26532150b5
36 changed files with 4989 additions and 1885 deletions

View File

@@ -14,46 +14,92 @@
<view class="input-box u-flex">
<image class="icon" src="/user/static/duihuan.png"></image>
<view class="u-flex-1">
<input placeholder="请输入兑换码" />
<input placeholder="请输入兑换码" v-model="code" />
</view>
</view>
</view>
<view class="u-flex justify-center u-m-t-24">
<button class="duihuan">确认兑换</button>
<button class="duihuan" @click="confirmExchange">确认兑换</button>
</view>
</view>
<view class="desc">
<view>兑换说明:</view>
<view>
兑换说明 1请直接输入您获得的兑换码点击立即兑换即可
1请直接输入您获得的兑换码点击立即兑换即可
<br />
2兑换码为一次性兑换完成之后即失效
<br />
3兑换获得的奖励将直接发送至您的账号可直接前往余额或优惠券查看
<br />
4兑换码为赠品不可转赠不退不换
<br />
5兑换码需在有效期内完成兑换过期即作废
</view>
</view>
</view>
<confirmModal v-model="modal.confirm.show"></confirmModal>
<resultModal v-model="modal.result.show" :title="modal.result.title"></resultModal>
<confirmModal v-model="modal.confirm.show" :data="modal.confirm.data" @confirm="exchange"></confirmModal>
<resultModal
v-model="modal.result.show"
:title="modal.result.title"
></resultModal>
</view>
</template>
<script setup>
import { result } from "lodash";
import confirmModal from "./components/confirm.vue";
import resultModal from "./components/result.vue";
import { reactive } from "vue";
import * as exchangeApi from "@/common/api/market/exchange.js";
import { reactive, ref } from "vue";
const modal = reactive({
confirm: {
show: false,
},
result:{
show:true,
title:'该兑换码无效,请输入有效兑换码'
}
result: {
show: false,
title: "该兑换码无效,请输入有效兑换码",
},
});
const code = ref("");
function confirmExchange() {
if (code.value == "") {
uni.showToast({
title: "请输入兑换码",
icon: "none",
});
return;
}
exchangeApi.redemption({
code: code.value,
}).then((res) => {
if (res) {
modal.confirm.show = true;
modal.confirm.data = res;
}
})
}
function exchange() {
exchangeApi
.exchange({
code: code.value,
})
.then((res) => {
if (res) {
modal.result.title = "兑换成功!奖励已发放至您的账户";
modal.result.show = true;
code.value = "";
}
})
.catch((err) => {
console.log("err,", err);
modal.result.title = err.message || "该兑换码无效,请输入有效兑换码";
modal.result.show = true;
});
}
function back() {
uni.navigateBack();
}
@@ -115,7 +161,6 @@ function back() {
font-weight: 700;
}
.desc {
width: 662rpx;
color: #666666;
font-size: 24rpx;
font-weight: 400;