lanan-old/detection-business/pages/my/rwm.vue

264 lines
6.0 KiB
Vue
Raw Permalink Normal View History

2024-07-17 14:16:22 +08:00
<template>
<view class="content">
<view class="top-heder">
<view class="t-left" @click="getback()">
<uni-icons type="left" size="18"></uni-icons>
</view>
<view class="t-title">
<text>订单核销</text>
</view>
<view class="t-you"></view>
</view>
<view class="tab-box">
<view :class="{ 'lan' : tindex == index}" class="tabb" v-for="(item,index) in list" :key="index" @click="ting(index)">
{{item}}
</view>
</view>
<!-- 顶部 -->
<!-- <view class="w700 flex-row justify-center">
<u-tabs :list="list" :current="current" @click="changeTab" lineWidth="250rpx" lineColor="#d2c3af"
lineHeight="5rpx" :activeStyle="{
color: '#d2c3af',
fontWeight: 'bold',
transform: 'scale(1.05)'
}" :inactiveStyle="{
color: '#d2c3af',
transform: 'scale(1)'
}" itemStyle="margin-top: 20rpx;margin-bottom: 20rpx; width:300rpx; "></u-tabs>
</view> -->
<view class="contrnt-box " style="height: 100%;" v-if="current == 0">
<view class="scanBox">
<u-icon name="scan" color="#0D2E8D" size="300rpx" @click="validation"></u-icon>
</view>
<view class="input-box">
<view class="sR-input">
<u--input placeholder="请输入核销码16位" v-model="accessCode" border="bottom" inputAlign="center"
fontSize="30rpx" color="#000" type="number" maxlength="16"></u--input>
</view>
<u-button color="#0D2E8D"
:customStyle="{color:'#ffffff'}" shape="circle" text="立即核销" throttleTime="1500"
@click="validation(accessCode)" :disabled="accessCode.length != 16"></u-button>
</view>
</view>
<view class="w750 padding flex-col align-center " v-if="current == 1" style="min-height: 100%;">
<view class="response padding bg-white margin-bottom border-bottom" style="border-radius: 20rpx;"
v-for="(item, index) in validationlist" :key="index">
<view class="margin-bottom-xs">
<text>核销码:{{item.accessCode}}</text>
</view>
<view class="margin-bottom-xs">
<text>商品/服务名称:{{item.goodsTitle}}</text>
</view>
<view class="margin-bottom-xs">
<text>被核销人:{{item.realName}}</text>
</view>
<view class="margin-bottom-xs">
</view>
<view class="flex-row justify-between">
<text>核销人手机号:{{item.phonenumber}}</text>
<text class="daju">{{item.goodsPrice / 100}}</text>
</view>
<view class="flex-row justify-between">
<text class="font-sm">{{item.validationTime}}</text>
<text>核销人:{{item.validationRealName}}</text>
</view>
</view>
</view>
</view>
</template>
<script>
import config from '@/config'
import request from '../../utils/request';
export default {
data() {
return {
tindex:0,
list: ['订单核销', '核销纪录', ],
current: 0,
validationlist: [],
accessCode: ''
}
},
onLoad(option) {
// this.current = option.tab
console.log('optioncurrent: ', this.current);
},
onShow() {
this.getValidationlist()
},
methods: {
ting(index){
this.tindex = index
if(index == 1){
uni.navigateTo({
url:'/pages/my/rwmlist'
})
}
},
// 核销 扫码和录入
async validation(accessCode) {
let partnerId = uni.getStorageSync("partnerId")
if (accessCode) { // 录入
if (accessCode.length != 16) {
uni.showToast({
title:"验证码应为16位数字",
icon: "error"
})
}
const scanRes = await request({
url: '/partnerOwn/partner/orderDetailByCode?partnerId='+partnerId+'&code='+accessCode,
method: 'get',
});
if(scanRes.code = 200){
//进入核销页面
uni.navigateTo({
url:'/pages/my/my-order?orderId='+scanRes.data
})
}else{
uni.showToast({
title:scanRes.msg
})
}
} else {
uni.scanCode({ //扫码核销
onlyFromCamera: true,
success: res => {
console.log(res,'/partnerOwn/partner/orderDetailByCode?partnerId='+partnerId+'&code='+res.result)
if (res.scanType == 'QR_CODE' && res.result.length == 16) {
request({
url: '/partnerOwn/partner/orderDetailByCode?partnerId='+partnerId+'&code='+res.result,
method: 'get',
}).then((scanRes) => {
if(scanRes.code == 200){
//进入核销页面
uni.navigateTo({
url:'/pages/my/my-order?orderId='+scanRes.data
})
}else{
uni.showToast({
title:scanRes.msg
})
}
})
}
}
});
}
},
getback(){
uni.navigateBack()
},
//
async getValidationlist() {
const res = await request({
url: '/orderApi/validationListWx',
});
this.validationlist = res.data
console.log(res);
}
}
}
</script>
<style scoped lang="scss">
.content {
box-sizing: border-box;
width: 100%;
height: calc(100vh);
background: white;
padding-top: 45px;
}
.tab-box{
width: 100%;
display: flex;
align-items: center;
justify-content: space-between;
box-sizing: border-box;
padding: 10px;
}
.tabb{
width: 50%;
text-align: center;
color: #333333;
}
.lan{
color: #0D2E8D;
}
.top-heder{
width: 100%;
height: 46px;
background: white;
display: flex;
align-items: center;
justify-content: space-between;
box-sizing: border-box;
padding: 5px 15px;
}
.t-title{
font-size: 17px;
font-weight: bold;
color: #333333;
}
.t-left{
width: 10%;
}
.t-you{
height: 100%;
width: 10%;
}
.scanBox {
border: 1px solid #cbcbcb;
width: 60%;
margin: 0 auto;
box-sizing: border-box;
border-radius: 8px;
height: 400rpx;
padding: 50rpx;
background-color: white;
// margin-top: 100rpx;
display: flex;
justify-content: center;
align-items: center;
}
.contrnt-box{
background-color: #F4F4F4;
box-sizing: border-box;
padding-top: 50px;
}
.input-box{
width: 60%;
margin: 25px auto;
}
.validationInput {
margin-top: 50rpx;
}
.daju{
font-size: 18px;
font-weight: bold;
color: #F9654D;
}
.sR-input{
margin-bottom: 20px;
}
page {
height: 100vh;
background: #242A38;
}
</style>