manual.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  1. <template>
  2. <view class="manual">
  3. <view class="top"></view>
  4. <view class="head">
  5. <span class="cuIcon-back" @click="back"></span>
  6. <view class="case">
  7. 输码核销
  8. </view>
  9. </view>
  10. <view class="content">
  11. <view class="bgc">
  12. </view>
  13. <view class="import">
  14. 请输入核销码
  15. <view class="inp">
  16. <!-- {{value}} -->
  17. <u-input v-model="voucherCode" placeholder="请输入核销码" />
  18. </view>
  19. </view>
  20. <view class="keyboard" style="margin-top: 30px;">
  21. <view class="qrcode" @click="scan">
  22. <image src="/static/scan/qrcode.png" mode=""></image>去扫码
  23. </view>
  24. <view class="qrcode ticket" @click="verify">
  25. <image src="/static/scan/ticket.png" mode=""></image>验券核销
  26. </view>
  27. </view>
  28. </view>
  29. </view>
  30. </template>
  31. <script>
  32. export default {
  33. data() {
  34. return {
  35. voucherCode: '',
  36. merchantId:''
  37. }
  38. },
  39. methods: {
  40. //返回
  41. back() {
  42. uni.navigateBack({
  43. delta: 1
  44. });
  45. },
  46. verify(){
  47. console.log(111)
  48. if(this.voucherCode == ''){
  49. uni.showToast({
  50. title: '请输入核销码',
  51. icon:'none'
  52. });
  53. }
  54. let data = {
  55. merchantId:this.merchantId,
  56. voucherCode:this.voucherCode
  57. }
  58. this.$http.post("/app/writeOff/details",data).then(res => {
  59. if (res.data.code == 200) {
  60. console.log()
  61. const params = encodeURIComponent(JSON.stringify(res.data.result));
  62. uni.navigateTo({
  63. url:`/pages/scan/details?params=${params}`
  64. })
  65. }else{
  66. uni.showToast({
  67. title: res.data.message,
  68. icon:'none'
  69. });
  70. }
  71. })
  72. },
  73. scan(){
  74. let that = this
  75. uni.scanCode({
  76. success: function (res) {
  77. console.log('条码内容:' + res.result);
  78. if(res.result){
  79. that.voucherCode = res.result
  80. that.verify()
  81. }
  82. }
  83. });
  84. }
  85. },
  86. onShow() {
  87. let that = this
  88. uni.getStorage({
  89. key: 'login_user_info',
  90. success: function(res) {
  91. that.merchantId = res.data.merchantId
  92. }
  93. })
  94. }
  95. }
  96. </script>
  97. <style lang="scss" scoped>
  98. .manual {
  99. width: 100vw;
  100. height: 100vh;
  101. background: #F7F8FC;
  102. /*#ifdef APP-PLUS*/
  103. .top {
  104. width: 100%;
  105. height: var(--status-bar-height);
  106. background: linear-gradient(90deg, #E6FFFF 0%, #CEF7FF 40%, #A3CEFE 73%, #BCD6FF 100%), linear-gradient(0, #F7F8FC 0%, rgba(255, 255, 255, 0) 100%);
  107. }
  108. /*#endif*/
  109. .head {
  110. width: 100%;
  111. height: 112rpx;
  112. padding: 20rpx;
  113. display: flex;
  114. align-items: center;
  115. background: linear-gradient(90deg, #E6FFFF 0%, #CEF7FF 40%, #A3CEFE 73%, #BCD6FF 100%), linear-gradient(0, #F7F8FC 0%, rgba(255, 255, 255, 0) 100%);
  116. position: relative;
  117. .cuIcon-back {
  118. font-size: 40rpx;
  119. margin-right: 40rpx;
  120. }
  121. .case {
  122. position: absolute;
  123. left: 50%;
  124. transform: translateX(-50%);
  125. font-size: 36rpx;
  126. font-weight: 600;
  127. }
  128. }
  129. .content {
  130. width: 100%;
  131. position: relative;
  132. .bgc {
  133. width: 100%;
  134. height: 160rpx;
  135. background: linear-gradient(90deg, #E6FFFF 0%, #CEF7FF 40%, #A3CEFE 73%, #BCD6FF 100%);
  136. }
  137. .import {
  138. width: 100%;
  139. margin: 20rpx 0px;
  140. padding: 0px 20rpx;
  141. box-sizing: border-box;
  142. position: absolute;
  143. top: 0rpx;
  144. display: flex;
  145. flex-direction: column;
  146. justify-content: center;
  147. align-items: center;
  148. font-size: 40rpx;
  149. color: #333333;
  150. .inp {
  151. width: 656rpx;
  152. height: 132rpx;
  153. background: #FFFFFF;
  154. border-radius: 12rpx;
  155. border: 2rpx solid #449AFF;
  156. margin-top: 28rpx;
  157. padding: 0px 20rpx;
  158. display: flex;
  159. align-items: center;
  160. u-input {
  161. width: 100%;
  162. height: 100%;
  163. }
  164. }
  165. }
  166. .keyboard {
  167. width: 100%;
  168. height: 112rpx;
  169. position: fixed;
  170. bottom: 0;
  171. display: flex;
  172. align-items: center;
  173. justify-content: space-around;
  174. background-color: #fff;
  175. .qrcode {
  176. width: 324rpx;
  177. height: 76rpx;
  178. background: linear-gradient(90deg, #77B6FF 0%, #449AFF 100%);
  179. border-radius: 12rpx;
  180. display: flex;
  181. align-items: center;
  182. justify-content: center;
  183. font-size: 28rpx;
  184. color: #FFFFFF;
  185. image {
  186. width: 40rpx;
  187. height: 40rpx;
  188. margin-right: 10rpx;
  189. }
  190. }
  191. .ticket {
  192. background: linear-gradient(90deg, #FFA05B 0%, #FF7918 100%);
  193. }
  194. }
  195. }
  196. }
  197. </style>