海南旅游项目 前端仓库
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

98 lines
2.2 KiB

4 years ago
  1. <template>
  2. <view>
  3. </view>
  4. </template>
  5. <script>
  6. export default {
  7. data() {
  8. return {
  9. order_id: 0
  10. }
  11. },
  12. onLoad(e) {
  13. this.order_id = e.order_id
  14. console.log(this.order_id)
  15. if(this.order_id) {
  16. this.getUserProfile()
  17. }else {
  18. this.order_id = '1111111';
  19. this.getUserProfile();
  20. console.log('oder_id',this.order_id)
  21. }
  22. },
  23. methods: {
  24. // 获取用户信息
  25. getUserProfile(){
  26. uni.getUserProfile({
  27. desc: '您的信息将用于小程序显示',
  28. lang: 'zh_CN',
  29. complete: result => {
  30. console.log(result)
  31. if(result.errMsg == 'getUserProfile:ok'){
  32. let encryptedData = result.encryptedData;
  33. let iv = result.iv;
  34. let signature = result.signature;
  35. // let userInfo = uni.getStorageSync('userinfo') || {};
  36. this.$http(this.API.API_GETUSERINFO, {
  37. encryptedData,
  38. iv,
  39. // token: userInfo.token // 已在公共参数传
  40. }).then(res => {
  41. console.log("更新用户信息", res);
  42. this.$msg('更新成功', {icon: 'success'});
  43. uni.setStorageSync('userinfo', res.data);
  44. this.payOnce()
  45. setTimeout(() => {
  46. this.$toBack();
  47. }, 1000);
  48. })
  49. }
  50. }
  51. });
  52. },
  53. payOnce() {
  54. this.$http(this.API.API_LF_PAY,{id: this.order_id}).then(res => {
  55. uni.requestPayment({
  56. orderInfo: res.data.order_num,
  57. timeStamp: res.data.timeStamp,
  58. nonceStr: res.data.nonceStr,
  59. package: res.data.package,
  60. signType: res.data.signType,
  61. paySign: res.data.paySign,
  62. success: (res) => {
  63. this.$url('/pages/payState/paystate?ifSuccess=1&order_id='+this.order_id,{type: 'redirect'})
  64. },
  65. fail: (err) => {
  66. this.$url('/pages/payState/paystate?ifSuccess=2&order_id='+this.order_id,{type: 'redirect'})
  67. },
  68. })
  69. }).catch(err => {})
  70. }
  71. }
  72. }
  73. </script>
  74. <style>
  75. .btn{
  76. margin: 0;
  77. padding: 0;
  78. width: 212rpx;
  79. height: 82rpx;
  80. background-color: #1998FE;
  81. color: #FFFFFF;
  82. line-height: 80rpx;
  83. font-size: 32rpx;
  84. border-radius: 41rpx;
  85. }
  86. .bref-box {
  87. text-overflow: -o-ellipsis-lastline;
  88. overflow: hidden;
  89. text-overflow: ellipsis;
  90. display: -webkit-box;
  91. -webkit-line-clamp: 2;
  92. -webkit-box-orient: vertical;
  93. }
  94. </style>