index.vue 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. <template>
  2. <view class="page" :style="{height:height}">
  3. <!-- #ifdef H5-->
  4. <uni-nav-bar v-if="!$isWxBrowser()" :fixed="true" background-color="#FFE05C" :border="false" :statusBar="false" title="首页"/>
  5. <!-- #endif -->
  6. <manager v-if="isManager == '1'"></manager>
  7. <attach v-else-if="isManager == '0' && (roleTag == '0' || roleTag == '2')"></attach>
  8. <view :style="{height:height}" v-else-if="isManager == '0' && roleTag == '1'" class="flex-col justify-center">
  9. <view class="flex-row justify-center">
  10. <text>合作伙伴相关功能正在建设中...</text>
  11. </view>
  12. </view>
  13. </view>
  14. </template>
  15. <script>
  16. import manager from "./manager/manager";
  17. import attach from "./attach/attach"
  18. export default {
  19. components: {
  20. manager,
  21. attach
  22. },
  23. data() {
  24. return {
  25. isManager:'',
  26. roleTag:'',
  27. height: '',
  28. ruleList: [],
  29. roleList: [],
  30. roleBindRuleParam: {},
  31. userInfo: {}
  32. }
  33. },
  34. onLoad() {
  35. let sysInfo = uni.getSystemInfoSync()
  36. this.height = sysInfo.windowHeight + 'px'
  37. this.userInfo = uni.getStorageSync('spreadUserInfo')
  38. this.isManager = this.userInfo.isManager
  39. this.roleTag = this.userInfo.roleTag
  40. },
  41. onShow() {
  42. this.userInfo = uni.getStorageSync('spreadUserInfo')
  43. console.log('时间戳', new Date().getTime())
  44. },
  45. methods: {
  46. // 微信支付
  47. wechatPay() {
  48. const that = this;
  49. // 用户信息
  50. this.$api.service.wechatPay({
  51. orderNo: 'CZ20240223125943175'
  52. }).then((res) => {
  53. var param = res.data.data;
  54. uni.requestPayment({
  55. appId: param.appid,
  56. timeStamp: param.timestamp + "",
  57. nonceStr: param.noncestr,
  58. package: "prepay_id=" + param.prepayid,
  59. signType: "RSA",
  60. paySign: param.sign,
  61. success: res => {
  62. uni.showToast({
  63. title: '支付成功!'
  64. });
  65. // 刷新用户信息
  66. that.getUserInfo()
  67. },
  68. fail: res => {
  69. uni.showModal({
  70. content: '支付失败',
  71. showCancel: false
  72. });
  73. }
  74. });
  75. })
  76. },
  77. }
  78. }
  79. </script>
  80. <style scoped lang="scss">
  81. @import './index.rpx.css';
  82. </style>