questionCode.vue 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  1. <template>
  2. <view class="showModel" v-if="disjunctor">
  3. <view class="showModel__wrap">
  4. <view class="showModel__header">
  5. <!-- 我的二维码 -->
  6. <view>
  7. {{qrCode.title}}
  8. </view>
  9. </view>
  10. <view class="showModel__article">
  11. <view class="showModel__content">
  12. <image :src="qrCode.outQrcode" mode="widthFix" style="width: 100%;" @longpress="disableLongPress"></image>
  13. </view>
  14. </view>
  15. <view class="df-fl">
  16. <view @click="getQrCode('reload')" class="reload">刷新</view>
  17. <view class="df-fl">
  18. 有效期:
  19. <uni-countdown ref="countDown" @timeup="timeupChange" :second="refreshQRCodeTime" :showDay="false" :showHour="false" :showMinute="false"/>
  20. </view>
  21. </view>
  22. <view class="showModel__footer">
  23. <view class="showModel__know" @click="know" hover-class="seimin-btn-hover">关闭</view>
  24. </view>
  25. </view>
  26. </view>
  27. </template>
  28. <script>
  29. import {
  30. get,
  31. post,
  32. webHandle
  33. } from "../../http/http.js";
  34. export default {
  35. data() {
  36. return {
  37. qrCode: '',
  38. disjunctor:false,
  39. refreshQRCodeTime:null
  40. };
  41. },
  42. props: {
  43. orderId:null
  44. },
  45. methods: {
  46. // 关闭
  47. know() {
  48. this.disjunctor = false
  49. this.$emit("know");
  50. },
  51. // 倒计时结束
  52. timeupChange(){
  53. this.getQrCode('reload')
  54. },
  55. // 禁止长按
  56. disableLongPress(e) {
  57. // 阻止默认行为
  58. e.preventDefault();
  59. // 阻止事件冒泡
  60. e.stopPropagation();
  61. },
  62. // 获取我的二维码
  63. getQrCode(type){
  64. uni.showLoading({
  65. title: "加载中",
  66. mask: true,
  67. });
  68. post("/questionnaire/qrCode/0", {
  69. gdId: this.orderId
  70. }).then((result) => {
  71. uni.hideLoading();
  72. if (result.status == 200) {
  73. if(type=='reload'){
  74. this.$refs.countDown.update()
  75. }
  76. this.qrCode = result.data;
  77. this.refreshQRCodeTime = result.refreshQRCodeTime
  78. this.disjunctor = true
  79. } else if(result.status == 405){
  80. }else{
  81. uni.showToast({
  82. icon: "none",
  83. title: result.msg || "接口获取数据失败!",
  84. });
  85. }
  86. })
  87. }
  88. },
  89. mounted() {
  90. this.getQrCode();
  91. }
  92. };
  93. </script>
  94. <style lang="less" scoped>
  95. .showModel {
  96. position: fixed;
  97. left: 0;
  98. right: 0;
  99. top: 0;
  100. bottom: 0;
  101. background-color: rgba(0, 0, 0, 0.2);
  102. z-index: 999999;
  103. .showModel__wrap {
  104. width: 560rpx;
  105. position: absolute;
  106. left: 50%;
  107. top: 50%;
  108. transform: translate(-50%, -50%);
  109. background-color: #fff;
  110. border-radius: 12rpx;
  111. .showModel__header {
  112. font-size: 36rpx;
  113. color: #000;
  114. height: 84rpx;
  115. display: flex;
  116. justify-content: center;
  117. align-items: center;
  118. }
  119. .reload{
  120. margin: 0 20rpx;
  121. color: #49b856;
  122. }
  123. .df-fl{
  124. display: flex;
  125. justify-content: center;
  126. margin-bottom: 20rpx;
  127. }
  128. .showModel__article {
  129. color: #000;
  130. margin: 0 auto 25rpx;
  131. width: 488rpx;
  132. background-color: rgb(249, 250, 251);
  133. border: 2rpx solid rgb(229, 233, 237);
  134. border-radius: 12rpx;
  135. box-sizing: border-box;
  136. display: flex;
  137. flex-direction: column;
  138. justify-content: center;
  139. align-items: center;
  140. &.p0 {
  141. padding: 0;
  142. }
  143. &.p1 {
  144. text-align: left;
  145. }
  146. .showModel__icon {
  147. font-size: 138rpx;
  148. margin-bottom: 32rpx;
  149. &.showModel__icon--success {
  150. color: rgb(52, 179, 73);
  151. }
  152. &.showModel__icon--warn {
  153. color: rgb(245, 165, 35);
  154. }
  155. &.showModel__icon--error {
  156. color: rgb(255, 58, 82);
  157. }
  158. }
  159. .showModel__content {
  160. font-size: 36rpx;
  161. word-break: break-all;
  162. width: 100%;
  163. background: rgba(0,0,0,0);
  164. z-index: 999;
  165. image{
  166. pointer-events:none;
  167. }
  168. }
  169. .showModel__info {
  170. font-size: 32rpx;
  171. color: rgb(102, 102, 102);
  172. }
  173. .specialCloseFlag {
  174. width: 90%;
  175. height: 100%;
  176. padding: 16rpx;
  177. }
  178. .radio-wrap {
  179. .radio-item {
  180. margin-top: 16rpx;
  181. /deep/ .uni-radio-input-checked {
  182. background-color: #49b856 !important;
  183. border-color: #49b856 !important;
  184. }
  185. }
  186. }
  187. }
  188. .showModel__footer {
  189. box-sizing: border-box;
  190. height: 100rpx;
  191. border-top: 2rpx solid rgb(229, 233, 237);
  192. display: flex;
  193. align-items: center;
  194. view {
  195. height: 100%;
  196. display: flex;
  197. align-items: center;
  198. justify-content: center;
  199. font-size: 36rpx;
  200. color: rgb(102, 102, 102);
  201. position: relative;
  202. &:nth-of-type(2)::before {
  203. content: "";
  204. position: absolute;
  205. left: 0;
  206. bottom: 0;
  207. width: 2rpx;
  208. height: 87rpx;
  209. background-color: rgb(229, 233, 237);
  210. }
  211. }
  212. .showModel__ok {
  213. flex: 1;
  214. color: rgb(73, 184, 86);
  215. }
  216. .showModel__cancel {
  217. flex: 1;
  218. }
  219. .showModel__know {
  220. flex: 1;
  221. color: rgb(73, 184, 86);
  222. }
  223. }
  224. }
  225. }
  226. </style>