海南旅游项目 前端仓库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

110 lines
2.9 KiB

  1. <template>
  2. <view class="lf-p-40 lf-w-100 lf-h-100 lf-row-center" style="height: 1200rpx;">
  3. <!-- <view class="lf-row-center lf-font-28">确认核销权限...</view> -->
  4. <button class="lf-m-t-30 cu-btn" v-if="haveVerfiy==false" open-type="getPhoneNumber" @getphonenumber="getPhoneNumber">
  5. <text class="lf-font-32">确认核销</text>
  6. </button>
  7. <button class="lf-m-t-30 cu-btn1" v-else>
  8. <text class="lf-font-32">核销完成</text>
  9. </button>
  10. </view>
  11. </template>
  12. <script>
  13. export default {
  14. data() {
  15. return {
  16. userInfo: '',
  17. loadOptions: '',
  18. haveVerfiy: false,
  19. ifProduct: false,
  20. strVerfiy: ''
  21. }
  22. },
  23. onLoad(options) {
  24. this.userInfo = uni.getStorageSync('userinfo');
  25. this.loadOptions = decodeURIComponent(options.scene);
  26. this.strVerfiy = this.loadOptions.slice(2,this.loadOptions.length);
  27. var search_0$ = this.loadOptions.slice(0,2);
  28. if(search_0$ == '0$') {
  29. this.ifProduct = false;
  30. }else {
  31. this.ifProduct = true
  32. }
  33. },
  34. methods: {
  35. // 普通产品核销
  36. getPhoneNumber(event){
  37. if(this.userInfo.mobile == '') {
  38. if(event.detail.errMsg == 'getPhoneNumber:ok'){
  39. let encryptedData = event.detail.encryptedData;
  40. let iv = event.detail.iv;
  41. this.$http(this.API.API_WECHAT_SETPHONE, {
  42. encryptedData,
  43. iv,
  44. // token: userInfo.token // 已在公共参数传
  45. }).then(res => {
  46. this.$msg('更新成功', {icon: 'success'});
  47. uni.setStorageSync('userinfo', res.data);
  48. if(this.ifProduct == true) {
  49. this.$http(this.API.API_CONFIRMPRODUCT_CODE, {verify_code: this.strVerfiy}).then(res => {
  50. this.$msg('核销成功!');
  51. this.haveVerfiy = true
  52. }).catch(err => {
  53. this.$msg(JSON.stringify(err.msg))
  54. });
  55. }else {
  56. this.$http(this.API.API_CONFIRM_CODE, {verify_code: this.strVerfiy}).then(res => {
  57. this.$msg('核销成功!');
  58. this.haveVerfiy = true
  59. }).catch(err => {
  60. this.$msg(JSON.stringify(err.msg))
  61. });
  62. }
  63. })
  64. }
  65. }else {
  66. if(this.ifProduct == true) {
  67. this.$http(this.API.API_CONFIRMPRODUCT_CODE, {verify_code: this.strVerfiy}).then(res => {
  68. this.$msg('核销成功!');
  69. this.haveVerfiy = true
  70. }).catch(err => {
  71. this.$msg(JSON.stringify(err.msg))
  72. });
  73. }else {
  74. this.$http(this.API.API_CONFIRM_CODE, {verify_code: this.strVerfiy}).then(res => {
  75. this.$msg('核销成功!');
  76. this.haveVerfiy = true
  77. }).catch(err => {
  78. this.$msg(JSON.stringify(err.msg))
  79. });
  80. }
  81. }
  82. },
  83. }
  84. }
  85. </script>
  86. <style scoped>
  87. .cu-btn {
  88. width: 260rpx;
  89. height: 260rpx;
  90. border-radius: 50%;
  91. background-color: #1998FE;
  92. color: white;
  93. display: flex;
  94. justify-content: center;
  95. align-items: center;
  96. }
  97. .cu-btn1 {
  98. width: 260rpx;
  99. height: 260rpx;
  100. border-radius: 50%;
  101. background-color: #777;
  102. color: white;
  103. display: flex;
  104. justify-content: center;
  105. align-items: center;
  106. }
  107. </style>