index.vue 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. <template>
  2. <view class="page">
  3. <uni-nav-bar :fixed="true" background-color="#FFE05C" :border="false" :statusBar="true" title="首页" />
  4. <manager :height="height" v-if="userInfo.isManager === 1"></manager>
  5. <attach :height="height" v-else></attach>
  6. <!-- <button @click="wechatPay">调起支付测试按钮</button>-->
  7. </view>
  8. </template>
  9. <script>
  10. import manager from "./manager/manager";
  11. import attach from "./attach/attach"
  12. export default {
  13. components:{
  14. manager,attach
  15. },
  16. data() {
  17. return {
  18. height:'',
  19. ruleList:[],
  20. roleList:[],
  21. roleBindRuleParam:{},
  22. userInfo:{}
  23. }
  24. },
  25. onLoad() {
  26. let sysInfo = uni.getSystemInfoSync()
  27. this.height = sysInfo.windowHeight - 45 + 'px'
  28. },
  29. onShow(){
  30. this.userInfo = uni.getStorageSync('spreadUserInfo')
  31. },
  32. methods: {
  33. // 微信支付
  34. wechatPay(){
  35. const that = this;
  36. // 用户信息
  37. this.$api.service.wechatPay({
  38. orderNo:'CZ20240223125943175'
  39. }).then((res)=>{
  40. var param = res.data.data;
  41. uni.requestPayment({
  42. appId: param.appid,
  43. timeStamp: param.timestamp+"",
  44. nonceStr: param.noncestr,
  45. package: "prepay_id="+param.prepayid,
  46. signType: "RSA",
  47. paySign: param.sign,
  48. success: res => {
  49. uni.showToast({
  50. title: '支付成功!'
  51. });
  52. // 刷新用户信息
  53. that.getUserInfo()
  54. },
  55. fail: res => {
  56. uni.showModal({
  57. content: '支付失败',
  58. showCancel: false
  59. });
  60. }
  61. });
  62. })
  63. },
  64. }
  65. }
  66. </script>
  67. <style scoped lang="scss">
  68. @import './index.rpx.css';
  69. </style>