1154079537 91fb79033b 更新
2024-06-05 18:45:30 +08:00

285 lines
6.0 KiB
Vue
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<template>
<view class="orderVerification">
<!-- 输入核销码 -->
<view class="verification">
<view class="num">1</view>
<view class="verification-title">核销券码</view>
<u-input v-model="writeCode" inputAlign="center" :customStyle="{'border-color':'#38BE41 !important'}"
placeholder="请输入核销券码"></u-input>
<view class="verification-btn" :style="{opacity:writeCode?1:'.6'}" @click="onConfirmWrite">确认核销</view>
</view>
<!-- 二维码 -->
<view class="verification">
<view class="num">2</view>
<view class="verification-title" style="margin-bottom: 48rpx;">二维码核销</view>
<view class="scan">
<view class="scan1" @click="onScanToWrite">
<u-image width="84rpx" height="84rpx" src="../images/scan.png"></u-image>
</view>
</view>
</view>
<!-- 弹框 -->
<u-popup :show="show" @close="close" @open="open" mode="center">
<view class="popup">
<view class="popup-wrap">
<view class="popup-title">请确认核销订单</view>
<view class="popup-order_num">订单编号:wxo1709797879549583601</view>
<view class="popup-goods">
<view class="popup-goods-left">
<u-image width="100rpx" height="100rpx" radius="8rpx" />
</view>
<view class="popup-goods-right">
<view class="popup-goods-right-info">
<text class='goods_name'>黄牛牛肉</text>
<text class="goods_price">10.00</text>
</view>
<view class="popup-goods-num">x5</view>
<view class="popup-goods-total">
<text class="popup-goods-total-num">共5件商品总金额</text>
<text class="popup-goods-total-price">50.00</text>
</view>
</view>
</view>
<view class="verification-btn">确认核销</view>
</view>
</view>
</u-popup>
</view>
</template>
<script setup>
import {
ref
} from "vue";
import {
writeOrderApi
} from "@/api/order.js";
const show = ref(false);
const writeCode = ref('');
// 确认核销
const onConfirmWrite = () => {
if (!writeCode) return;
writeOrderApi({
verify_code: writeCode.value
}).then(res => {
if (res.code == 1) {
uni.showToast({
title: '核销成功',
icon: 'none',
success() {
uni.$u.sleep(1500).then(rrr => {
uni.navigateBack();
})
}
})
} else {
uni.showToast({
title: '核销失败',
icon: 'none',
success() {
writeCode.value = '';
}
})
}
})
}
// 切换到核销
const onScanToWrite = () => {
uni.scanCode({
success(resp) {
writeOrderApi({
verify_code: resp.result
}).then(res => {
if (res.code == 1) {
uni.showToast({
title: '核销成功',
icon: 'none',
success() {
uni.$u.sleep(1500).then(rrr => {
uni.navigateBack();
})
}
})
} else {
uni.showToast({
title: '核销失败',
icon: 'none'
})
}
})
}
})
}
</script>
<style lang="scss" scoped>
.orderVerification {
padding-top: 68rpx;
.verification {
position: relative;
width: 710rpx;
height: 390rpx;
background-image: url(../images/circle_bg.png);
background-size: 100%;
background-repeat: no-repeat;
margin: 0 auto 66rpx;
padding: 70rpx 30rpx 0 30rpx;
box-sizing: border-box;
.num {
position: absolute;
left: 50%;
top: -36rpx;
transform: translateX(-50%);
width: 72rpx;
height: 72rpx;
line-height: 72rpx;
border-radius: 50%;
background: #20B128;
font-size: 36rpx;
color: #FFFFFF;
text-align: center;
}
.verification-title {
margin-bottom: 24rpx;
font-weight: 600;
font-size: 32rpx;
color: #333333;
text-align: center;
}
.scan {
display: flex;
align-items: center;
justify-content: center;
box-shadow: 0 0 4rpx 16rpx rgba(32, 177, 40, .1);
width: 160rpx;
height: 160rpx;
border-radius: 50%;
margin: 0 auto;
}
.scan1 {
display: flex;
align-items: center;
justify-content: center;
width: 152rpx;
height: 152rpx;
background-color: #20B128;
border-radius: 50%;
box-shadow: 0 0 0 8rpx rgba(32, 177, 40, .3);
}
}
.verification-btn {
width: 648rpx;
height: 94rpx;
line-height: 94rpx;
background: #38BE41;
border-radius: 48rpx;
margin-top: 40rpx;
font-weight: 600;
font-size: 32rpx;
color: #FFFFFF;
text-align: center;
transition: opacity .3;
}
::v-deep .u-popup__content {
background-color: transparent;
}
.popup {
.popup-wrap {
width: 710rpx;
border-radius: 12rpx;
padding: 40rpx;
box-sizing: border-box;
background-color: #fff;
.popup-title {
margin-bottom: 60rpx;
font-weight: 600;
font-size: 32rpx;
color: #333333;
text-align: center;
}
.popup-order_num {
margin-bottom: 36rpx;
font-weight: bold;
font-size: 24rpx;
color: #333333;
}
.popup-goods {
display: flex;
justify-content: space-between;
width: 630rpx;
height: 190rpx;
background: #F7F7F7;
border-radius: 16rpx;
margin-bottom: 36rpx;
padding: 24rpx;
box-sizing: border-box;
.popup-goods-left {
margin-right: 24rpx;
}
.popup-goods-right {
flex-grow: 1;
.popup-goods-right-info {
display: flex;
justify-content: space-between;
align-items: center;
margin-bottom: 20rpx;
.goods_name {
font-size: 24rpx;
color: #333333;
}
.goods_price {
font-weight: bold;
font-size: 24rpx;
color: #060606;
}
}
.popup-goods-num {
margin-bottom: 20rpx;
font-size: 24rpx;
color: #777777;
text-align: right;
}
.popup-goods-total {
text-align: right;
.popup-goods-total-num {
font-size: 24rpx;
color: #666666;
}
.popup-goods-total-price {
font-size: 24rpx;
color: #F55726;
}
}
}
}
}
}
}
</style>