<template> <view class="park"> <view class="park-navbar"> <u-navbar title="物流查询" :border-bottom="false" :background="background"></u-navbar> </view> <view class="contentDes"> <u-field v-model="logisticsNum" label="物流单号" placeholder="请填写物流单号"> </u-field> <view class="btnGroup"> <view class="btnItem" @click="scanCode" style="margin-right:35px;"> <image :src="$picUrl+'/static/news3/scan.png'" mode="widthFix"></image> <text>扫码识别</text> </view> <view class="btnItem" style="margin-left:66upx;" @click="getClipboardData"> <image :src="$picUrl+'/static/news3/copy.png'" mode="widthFix"></image> <text>粘贴单号</text> </view> </view> </view> <view class="footerBtn" :style="{'opacity': logisticsNum?1:0.6 }" @click="onCheck"> 查快递 </view><addShuiyin /> </view> </template> <script> export default { data() { return { background: { background: `url(${this.$picUrl}/static/news/login-bg.png) center top no-repeat`, backgroundSize: '100%', }, logisticsNum: '', }; }, methods: { getClipboardData(value) { uni.getClipboardData({ success: (res) => { // 获取成功回调 this.logisticsNum = res.data } }); }, scanCode() { uni.scanCode({ success: (res) => { this.logisticsNum = res.result; }, fail: (res) => { console.log(res) uni.showToast({ title: '扫描失败', icon: 'none' }) } }) }, onBack() { uni.navigateBack({ delta: 1 // 表示返回到上一页(默认为1) }); }, /** * 查快递 */ onCheck() { if (!this.logisticsNum) { return this.$toast('请输入物流单号') } uni.navigateTo({ url: "/pages/news3/LogisticsDetails?logisticsNum=" + this.logisticsNum }) } } } </script> <style scoped lang="scss"> page { background-color: #F7F8FA; min-height: 100%; height: 100%; } .park { width: 100%; background: url(https://www.royaum.com.cn/static/news/login-bg.png) center 0 no-repeat; background-size: 100% auto; min-height: 100vh; } .contentDes { margin: 0upx 26upx; background-color: #fff; background: #FFFFFF; border-radius: 6px 6px 6px 6px; opacity: 1; padding: 0 28upx; } .navBarContent { height: 140upx; line-height: 140upx; text-align: center; position: relative; text { font-size: 32upx; font-family: PingFang SC, PingFang SC; font-weight: 500; color: #000; } } ::v-deep .u-field { padding: 45rpx 28upx !important; } .btnGroup { display: flex; justify-content: flex-end; padding: 44upx 40upx; .btnItem { display: flex; align-items: center; image { width: 40upx; height: auto; } text { font-size: 28upx; font-family: PingFang SC, PingFang SC; font-weight: 500; color: #3B3B3B; margin-left: 20upx; } } } .footerBtn { width: 86%; height: 98upx; background: #FF5050; border-radius: 6px; opacity: 1; font-size: 28upx; font-family: PingFang SC, PingFang SC; font-weight: 500; color: #FFFFFF; line-height: 98upx; text-align: center; margin: 96upx auto 0 auto; } </style>