stafffail.vue 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138
  1. <template>
  2. <view class="code pt8 pb15">
  3. <view class="code_box pt80 flexdc">
  4. <view class="code_fail flex0">
  5. <image :src="failimg"></image>
  6. <view class="f16 fw co16 txc">核销失败</view>
  7. </view>
  8. <view class="txc code_tip flex1">
  9. <view>该通行码已使用</view>
  10. <view>请告知来访者重新预约</view>
  11. </view>
  12. <view class="code_btn code_btna flex0">
  13. <view class="btn btn1" @click="getFail" v-if="checkPermi(['system:reservat:cav'])">继续扫码</view>
  14. <view class="btn btn2 " @click="getBack">返回首页</view>
  15. </view>
  16. </view>
  17. </view>
  18. </template>
  19. <script>
  20. import { checkPermi, checkRole } from "@/utils/permission"; // 权限判断函数
  21. import {getReservatvav} from "@/api/mine/order.js"
  22. export default {
  23. data(){
  24. return{
  25. failimg:require("@/static/images/order/staffs/fail.png")
  26. }
  27. },
  28. onLoad: function() {
  29. },
  30. methods:{
  31. checkPermi, checkRole,
  32. getFail(){
  33. var that = this;
  34. uni.scanCode({
  35. onlyFromCamera: true,
  36. autoZoom:false,
  37. scanType: ['qrCode'],
  38. success: function(red) {
  39. let result = red.result;
  40. if (typeof result == 'string') {
  41. try {
  42. } catch (e) {
  43. uni.navigateBack({
  44. delta: 1
  45. })
  46. uni.showToast({
  47. title: '扫码查询失败,请检查二维码是否正确',
  48. icon: "none"
  49. })
  50. return
  51. }
  52. }
  53. var id = red.result
  54. var params = {
  55. "reservatId": id,
  56. }
  57. getReservatvav(params).then(res => {
  58. if (res.code == 200) {
  59. // 刷新页面
  60. if(res.msg=='核销失败'){
  61. that.$tab.redirectTo('/pages/order/stafffail')
  62. }else{
  63. uni.$emit('refreshdatalist')
  64. that.$tab.redirectTo('/pages/order/staffcode?id='+id)
  65. }
  66. } else {
  67. uni.showToast({
  68. title: res.msg,
  69. duration: 1000,
  70. icon: 'none'
  71. });
  72. }
  73. })
  74. },
  75. fail: function(e) {
  76. if (e && e.errMsg && e.errMsg.indexOf('scanCode:fail cancel') != -1) {
  77. return;
  78. }
  79. uni.showToast({
  80. title: '扫码失败',
  81. icon: "none"
  82. })
  83. },
  84. });
  85. },
  86. getBack(){
  87. this.$tab.reLaunch('/pages/index/index')
  88. },
  89. },
  90. }
  91. </script>
  92. <style lang="scss" scoped>
  93. .code{display: flex;flex-direction: column;height: 100vh;box-sizing: border-box;}
  94. .code_box{
  95. width: 684rpx;background: #FFFFFF;border-radius: 6rpx;margin: 0 auto;padding:64rpx 60rpx 40rpx;box-sizing: border-box;flex: 1;
  96. &.pt80{padding-top: 160rpx;}
  97. .code_suc{
  98. image{width: 138rpx;height: 148rpx;margin: 0 auto 32rpx;}
  99. }
  100. .code_fail{
  101. image{width: 172rpx;height: 172rpx;margin: 0 auto 32rpx;}
  102. }
  103. .cdet{padding-top: 48rpx;
  104. .ctit{font-size: 32rpx;font-weight: bold;color: #161616;position: relative;
  105. &::before{width: 6rpx;height: 34rpx;background: $com-cd3;border-radius: 2rpx;content: '';left: -26rpx;top: 3rpx;position: absolute;bottom: 3rpx;}
  106. }
  107. .cbox{padding: 36rpx 0 12rpx;}
  108. .ctxt{font-size: 30rpx;font-weight: bold;
  109. color: $com-cd3;margin-bottom: 16rpx;}
  110. .ctlist{padding: 10rpx 0;display: flex;justify-content: space-between;
  111. .tit{font-size: 30rpx;font-weight: 500;
  112. color: #AAAAAA;flex:0 0 auto;margin-right: 20rpx;}
  113. .txt{font-size: 30rpx;font-weight: 500;color: #161616;flex: 1;text-align: right;}
  114. }
  115. }
  116. }
  117. .code_tip {margin-top: 60rpx;
  118. view{font-size: 30rpx;font-weight: 500;color: #161616;}
  119. }
  120. .code_btn{flex: 0 0 auto;padding: 40rpx 32rpx;display: flex;align-items: center;justify-content: space-between;
  121. &.code_btna{padding: 0;display: block;padding-bottom: 72rpx;
  122. .btn{width: 100%;margin-bottom:20rpx;}
  123. }
  124. .btn{width: 320rpx;height: 80rpx;border-radius: 40rpx;box-sizing: border-box;font-size: 32rpx;font-weight: 500;text-align: center;line-height: 80rpx;
  125. &.btn1{background: #FFFFFF;border: 2rpx solid $com-cd3;color: $com-cd3;}
  126. &.btn2{background: $com-cd3;color: #FFFFFF;}
  127. }
  128. }
  129. </style>