searchOperation.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. <template>
  2. <view class="container">
  3. <block v-if="!isLoding">
  4. <view v-if="status == 'PROCESS'">
  5. <view class="tips">授权开通搜索直达待商家确认中</view>
  6. <view class="btn" @click="navBack">返回</view>
  7. </view>
  8. <view v-else-if="status == 'SUCCESS'">
  9. <view class="tips">搜索直达开通成功</view>
  10. <view class="btn" @click="navBack">返回</view>
  11. </view>
  12. <view v-else>
  13. <view class="tips">授权开通搜索直达</view>
  14. <view class="btn" @click="showquan">开通授权</view>
  15. </view>
  16. </block>
  17. </view>
  18. </template>
  19. <script>
  20. export default {
  21. data() {
  22. return {
  23. admin_id: uni.getStorageSync("admin_id"),
  24. isLoding: true,
  25. status: ""
  26. }
  27. },
  28. onLoad(e) {
  29. this.getInfo()
  30. },
  31. methods: {
  32. getInfo() {
  33. this.request({
  34. url: "alipaycoupon/operation",
  35. data: {
  36. admin_id: this.admin_id
  37. }
  38. }).then(res => {
  39. if (res.code == 200) {
  40. if (!Array.isArray(res.data)) {
  41. this.status = res.data
  42. }
  43. } else {
  44. uni.showToast({
  45. title: res.message,
  46. icon: 'none'
  47. })
  48. }
  49. this.isLoding = false
  50. }).catch(res => {
  51. uni.showToast({
  52. title: res.message,
  53. icon: 'none'
  54. })
  55. })
  56. },
  57. showquan() {
  58. this.request({
  59. url: "alipaycoupon/operation_open",
  60. data: {
  61. admin_id: this.admin_id
  62. }
  63. }).then(res => {
  64. if (res.code == 200) {
  65. uni.showModal({
  66. content: res.message,
  67. showCancel: false,
  68. success: () => {
  69. this.getInfo()
  70. }
  71. })
  72. } else {
  73. uni.showToast({
  74. title: res.message,
  75. icon: 'none'
  76. })
  77. }
  78. }).catch(res => {
  79. uni.showToast({
  80. title: res.message,
  81. icon: 'none'
  82. })
  83. })
  84. },
  85. navBack() {
  86. uni.navigateBack()
  87. }
  88. }
  89. }
  90. </script>
  91. <style scoped lang="scss">
  92. .container {
  93. padding: 200rpx 32rpx 0;
  94. .tips {
  95. text-align: center;
  96. font-size: 26rpx;
  97. color: #666;
  98. }
  99. .btn {
  100. width: 300rpx;
  101. height: 80rpx;
  102. background: linear-gradient(315deg, #3387ff 2%, #569bff 99%);
  103. border-radius: 8rpx;
  104. box-shadow: 0rpx 0rpx 8rpx 0rpx rgba(51, 135, 255, 0.20);
  105. text-align: center;
  106. line-height: 80rpx;
  107. font-size: 36rpx;
  108. font-weight: 500;
  109. color: #fff;
  110. margin: 40rpx auto;
  111. }
  112. }
  113. </style>