purchase-let/multipleShop/orderVerification/index.vue

283 lines
6.1 KiB
Vue
Raw Permalink Normal View History

2024-06-05 18:45:30 +08:00
<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>
2024-06-06 17:50:25 +08:00
<view class="verification-btn" :style="{opacity:writeCode?1:'.6'}" @click="onConfirmProduct">确认核销</view>
2024-06-05 18:45:30 +08:00
</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>
2024-06-06 17:50:25 +08:00
<!-- 弹框 1-1717497530223296 -->
<u-popup :show="show" @close="close" @open="open" mode="center" v-if="shopDetail != null">
2024-06-05 18:45:30 +08:00
<view class="popup">
<view class="popup-wrap">
<view class="popup-title">请确认核销订单</view>
2024-06-06 17:50:25 +08:00
<view class="popup-order_num">订单编号:{{shopDetail.order_id}}</view>
<view class="popup-goods-wrap">
<view class="popup-goods" v-for="item in shopDetail.goods_list" :key="item.id">
<view class="popup-goods-left">
<u-image width="100rpx" height="100rpx" radius="8rpx" :src="item.image" />
2024-06-05 18:45:30 +08:00
</view>
2024-06-06 17:50:25 +08:00
<view class="popup-goods-right">
<view class="popup-goods-right-info">
<text class='goods_name'>{{item.store_name}}</text>
<text class="goods_price">{{item.price}}</text>
</view>
<view class="popup-goods-num">x{{item.cart_num}}</view>
2024-06-05 18:45:30 +08:00
</view>
</view>
2024-06-06 17:50:25 +08:00
<view class="popup-goods-total">
<text class="popup-goods-total-num">{{shopDetail.total_num}}件商品总金额</text>
<text class="popup-goods-total-price">{{shopDetail.total_price}}</text>
</view>
2024-06-05 18:45:30 +08:00
</view>
2024-06-06 17:50:25 +08:00
<view class="verification-btn" @click="onConfirmWrite">确认核销</view>
2024-06-05 18:45:30 +08:00
</view>
</view>
</u-popup>
</view>
</template>
<script setup>
import {
ref
} from "vue";
import {
2024-06-06 17:50:25 +08:00
writeOrderApi,
writeCodeApi
2024-06-05 18:45:30 +08:00
} from "@/api/order.js";
2024-06-06 17:50:25 +08:00
const show = ref(true);
2024-06-05 18:45:30 +08:00
const writeCode = ref('');
// 确认核销
const onConfirmWrite = () => {
if (!writeCode) return;
writeOrderApi({
verify_code: writeCode.value
}).then(res => {
2024-06-06 17:50:25 +08:00
writeCode.value = ''; //清空
2024-06-05 18:45:30 +08:00
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 = '';
}
})
}
})
}
2024-06-06 17:50:25 +08:00
const shopDetail = ref(null);
// 根据核销码获取商品
const onConfirmProduct = () => {
writeCodeApi({
code: writeCode.value
}).then(res => {
shopDetail.value = res.data;
})
}
// 二维码
2024-06-05 18:45:30 +08:00
const onScanToWrite = () => {
uni.scanCode({
success(resp) {
2024-06-06 17:50:25 +08:00
writeCode.value = resp.result;
onConfirmProduct();
2024-06-05 18:45:30 +08:00
}
})
}
</script>
2024-06-03 18:25:34 +08:00
<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;
2024-06-05 18:45:30 +08:00
transition: opacity .3;
2024-06-03 18:25:34 +08:00
}
::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;
2024-06-06 17:50:25 +08:00
height: 150rpx;
2024-06-03 18:25:34 +08:00
background: #F7F7F7;
border-radius: 16rpx;
2024-06-06 17:50:25 +08:00
padding: 24rpx 24rpx 0;
2024-06-03 18:25:34 +08:00
box-sizing: border-box;
2024-06-06 17:50:25 +08:00
margin-bottom: 20rpx;
2024-06-03 18:25:34 +08:00
.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;
}
2024-06-06 17:50:25 +08:00
}
}
2024-06-03 18:25:34 +08:00
2024-06-06 17:50:25 +08:00
.popup-goods-total {
text-align: right;
2024-06-03 18:25:34 +08:00
2024-06-06 17:50:25 +08:00
.popup-goods-total-num {
font-size: 24rpx;
color: #666666;
}
2024-06-03 18:25:34 +08:00
2024-06-06 17:50:25 +08:00
.popup-goods-total-price {
font-size: 24rpx;
color: #F55726;
2024-06-03 18:25:34 +08:00
}
}
}
}
}
2024-06-05 18:45:30 +08:00
</style>