identity.vue 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. <template>
  2. <view></view>
  3. </template>
  4. <script>
  5. export default {
  6. data() {
  7. return {
  8. type: ''
  9. }
  10. },
  11. onLoad(options) {
  12. this.type = options.type
  13. this.handleCheck(this.type)
  14. },
  15. methods: {
  16. handleCheck(type) {
  17. uni.login({
  18. provider: 'weixin',
  19. success: (res) => {
  20. this.handleQuery(type, res.code)
  21. }
  22. })
  23. },
  24. // 查询请求
  25. async handleQuery(type, code) {
  26. if (type === '1') {
  27. // 查询商家是否绑定
  28. const res = await this.$myRequest({
  29. url: '/mhotel/appget_user_ma.action',
  30. data: {
  31. code
  32. }
  33. })
  34. if (res.code === 200) {
  35. let data = JSON.stringify(res.data)
  36. uni.redirectTo({
  37. url: `/pages/shopInfo/shopInfo?type=1&data=${data}`
  38. })
  39. } else {
  40. uni.redirectTo({
  41. url: '/pages/shop/shop'
  42. })
  43. }
  44. } else if (type === '2') {
  45. // 查询业主是否已绑定
  46. const res = await this.$myRequest({
  47. url: '/mhotel/appgetUser.action',
  48. data: {
  49. code
  50. }
  51. })
  52. if (res.code === 200) {
  53. let data = JSON.stringify(res.data)
  54. uni.redirectTo({
  55. url: `/pages/shopInfo/shopInfo?type=2&data=${data}`
  56. })
  57. } else {
  58. uni.redirectTo({
  59. url: '/pages/shop2/shop2'
  60. })
  61. }
  62. }
  63. }
  64. }
  65. }
  66. </script>
  67. <style lang="scss" scoped></style>