selectCoupon.vue 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  1. <template>
  2. <view class="page" :style="{'height':h+'px','padding-top':mt+'px'}">
  3. <c-nav-bar title="核销" backUrl="/pagesHouse/home/index" @goBack="goBack" :showHome="false"></c-nav-bar>
  4. <view class="card" @tap="scanCode">
  5. <view>
  6. <text>扫码核销</text>
  7. </view>
  8. </view>
  9. <view class="card" @tap="showVerifyPopup">
  10. <view>
  11. <text>核销码核销</text>
  12. </view>
  13. </view>
  14. <Tabbares :tabbarid="1" :value="1"></Tabbares>
  15. </view>
  16. </template>
  17. <script>
  18. export default {
  19. data() {
  20. return {
  21. //userInfo: null,
  22. merchantId: '',
  23. types: [],
  24. list: [],
  25. showVerifyModal: false,
  26. verifyCode: '',
  27. h: 0,
  28. mt: 0
  29. }
  30. },
  31. created() {
  32. },
  33. onLoad(option) {
  34. this.initHeight();
  35. // 测试弹窗是否能正常显示
  36. // setTimeout(() => {
  37. // this.showVerifyModal = true
  38. // }, 1000)
  39. },
  40. methods: {
  41. goBack() {
  42. uni.navigateBack()
  43. },
  44. scanCode(){
  45. uni.scanCode({
  46. onlyFromCamera: true,
  47. success: (res) => {
  48. //
  49. console.log(res)
  50. uni.navigateTo({
  51. url: "/pagesHouse/Verification/detailsewm?list=" + res.result
  52. })
  53. },
  54. error: (res) => {
  55. uni.reLaunch({
  56. url:'/pagesHouse/home/index'
  57. })
  58. }
  59. })
  60. },
  61. showVerifyPopup() {
  62. uni.showModal({
  63. title: '核销码核销',
  64. content: '',
  65. editable: true,
  66. placeholderText: '请输入核销码',
  67. success: (res) => {
  68. if (res.confirm) {
  69. const inputValue = res.content.trim()
  70. if (inputValue) {
  71. this.verifyCode = inputValue
  72. this.submitVerify()
  73. } else {
  74. uni.showToast({
  75. title: '请输入核销码',
  76. icon: 'none'
  77. })
  78. }
  79. }
  80. }
  81. })
  82. },
  83. closeModal() {
  84. this.showVerifyModal = false
  85. this.verifyCode = ''
  86. },
  87. submitVerify() {
  88. if (!this.verifyCode.trim()) {
  89. uni.showToast({
  90. title: '请输入核销码',
  91. icon: 'none'
  92. })
  93. return
  94. }
  95. uni.navigateTo({
  96. url: "/pagesHouse/Verification/detailsewm?list=" + this.verifyCode
  97. })
  98. },
  99. initHeight() {
  100. uni.getSystemInfo({
  101. success: (res) => {
  102. this.h = res.windowHeight
  103. this.mt = res.statusBarHeight + 44
  104. }
  105. })
  106. }
  107. }
  108. }
  109. </script>
  110. <style scoped lang="less">
  111. .page {
  112. background: #F3F4F4;
  113. padding-bottom: 20rpx;
  114. box-sizing: border-box;
  115. overflow-y: auto;
  116. .card {
  117. width: calc(100% - 60rpx);
  118. height: 180rpx;
  119. background: #FFFFFF;
  120. border-radius: 10rpx 10rpx 10rpx 10rpx;
  121. margin: 20rpx 30rpx 0;
  122. padding: 0 30rpx 0 60rpx;
  123. box-sizing: border-box;
  124. background: url(https://fsy.shengsi.gov.cn/file/20240109/1ee084be17f74dde94617dcb7f7c8af3.png) no-repeat;
  125. background-size: 100% 100%;
  126. display: flex;
  127. align-items: center;
  128. justify-content: space-between;
  129. &>view {
  130. &:first-child {
  131. display: flex;
  132. flex-direction: column;
  133. text {
  134. font-size: 38rpx;
  135. font-family: PingFang SC, PingFang SC;
  136. font-weight: 800;
  137. color: #1E3A62;
  138. }
  139. }
  140. }
  141. }
  142. }
  143. </style>