123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141 |
- <template>
- <view class="sub">
- </view>
- </template>
- <script>
- import {
- getReservatvav
- } from "@/api/mine/order.js"
- export default {
- data() {
- return {};
- },
- onLoad() {
- this.scanAction()
- },
- onShow() {},
- onHide() {},
- methods: {
- //扫码功能
- scanAction() {
- var that = this;
- uni.scanCode({
- onlyFromCamera: true,
- autoZoom:false,
- scanType: ['qrCode'],
- success: function(red) {
- let result = red.result;
- if (typeof result == 'string') {
- try {
- var obj = result;
- if (typeof obj == 'string' && obj) {
- } else {
- uni.showToast({
- title: '扫码查询失败,请检查二维码是否正确',
- icon: "none"
- })
- uni.navigateBack({
- delta: 1
- })
- return;
- }
- } catch (e) {
- uni.navigateBack({
- delta: 1
- })
- uni.showToast({
- title: '扫码查询失败,请检查二维码是否正确',
- icon: "none"
- })
- return
- }
- }
- var id = red.result
- var params = {
- "reservatId": id,
- }
- getReservatvav(params).then(res => {
- if (res.code == 200) {
- // 刷新页面
- if(res.msg=='核销失败'){
- that.$tab.redirectTo('/pages/order/stafffail')
- }else{
- uni.$emit('refreshdatalist')
- that.$tab.redirectTo('/pages/order/staffcode?id='+id)
- }
-
- } else {
- uni.navigateBack({
- delta: 1
- })
- uni.showToast({
- title: res.msg,
- duration: 1000,
- icon: 'none'
- });
- }
- }).catch(re=>{
- if(re=='500'){
- uni.navigateBack({
- delta: 1
- })
- }
- })
- },
- fail: function(e) {
- console.log(e)
- if (e && e.errMsg && e.errMsg.indexOf('scanCode:fail cancel') != -1) {
- return;
- }
- uni.showToast({
- title: '扫码失败',
- icon: "none"
- })
- }
- });
- },
- }
- }
- </script>
- <style lang="scss">
- .sub {
- box-sizing: border-box;
- width: 100%;
- min-height: 100vh;
- }
- .jhyyes {
- display: flex;
- justify-content: center;
- margin-top: 200upx;
- }
- .img {
- width: 258upx;
- height: 251upx;
- // margin: auto;
- // margin-left: 50%;
- // transform: translateX(-50%);
- }
- .naver {
- width: 416rpx;
- height: 84rpx;
- width: 208px;
- height: 42px;
- background: linear-gradient(90deg, #A00517, #E93030);
- border-radius: 21px;
- display: flex;
- align-items: center;
- justify-content: center;
- font-size: 30rpx;
- color: #ffffff;
- margin: 150rpx auto 0;
- }
- </style>
|