index.vue 2.1 KB

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