Zhifuyemian.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. <template>
  2. <view>
  3. <!-- <web-view :webview-styles="webviewStyles" src="https://uniapp.dcloud.io/static/web-view.html"></web-view> -->
  4. <web-view :webview-styles="webviewStyles" :src="Url" @message="webMessage"></web-view>
  5. </view>
  6. </template>
  7. <script>
  8. import {
  9. pushMsg
  10. } from '@/pages/api/basic.js';
  11. export default {
  12. data() {
  13. return {
  14. webviewStyles: {
  15. progress: {
  16. color: '#FF3333'
  17. }
  18. },
  19. Url:'',
  20. cid:'',
  21. ddid:''
  22. }
  23. },
  24. onLoad(option) {
  25. this.cid = uni.getStorageSync("cid");
  26. this.ddid = option.ddid;
  27. console.log(this.ddid);
  28. const url = JSON.parse(decodeURIComponent(option.url));
  29. this.Url = url;
  30. // setTimeout(() => {
  31. // console.log('setTimeout');
  32. // //this.pushMsg();
  33. // //uni.navigateBack();
  34. // }, 10000);
  35. uni.onPushMessage((res) => {
  36. if(null==res.data.payload||undefined==res.data.payload||''==res.data.payload){
  37. return;
  38. }
  39. console.log(res);
  40. var payload = JSON.parse(res.data.payload);
  41. console.log('完成支付订单',payload);
  42. //判断ddid正确则返回
  43. var tempid = payload.vnp_OrderInfo.substring(0, 2);
  44. if('CZ'==tempid){
  45. if(payload.vnp_TransactionStatus=='00'&&payload.vnp_ResponseCode=='00'){
  46. uni.showToast({
  47. title: this.$t('order.zhifuchg'),
  48. icon: 'none',
  49. duration: 2000
  50. })
  51. }
  52. else{
  53. if(payload.vnp_ResponseCode=='00'){
  54. uni.showToast({
  55. title: this.$t('order.yinhangculz'),
  56. icon: 'none',
  57. duration: 2000
  58. })
  59. }
  60. else{
  61. uni.showToast({
  62. title: this.$t('order.zhifushib'),
  63. icon: 'none',
  64. duration: 2000
  65. })
  66. }
  67. }
  68. setTimeout(function() {
  69. // 这里写要延时执行的代码
  70. uni.redirectTo({
  71. url:'/pages/tixian/Baozhengjin'
  72. })
  73. // uni.reLaunch({
  74. // url:'/pages/tixian/Baozhengjin'
  75. // })
  76. }, 2000);
  77. }
  78. });
  79. },
  80. onShow() {
  81. },
  82. methods:{
  83. webMessage(data){
  84. console.log(data);
  85. },
  86. async pushMsg(){//消息推送
  87. await this.$http.get(`${pushMsg}`, {
  88. cid:this.cid,
  89. title:'11',
  90. content:'22',
  91. payload:"{\"date\":\"20230808000230\",\"orderNo\":\"1691419030972\",\"notes\":\"\",\"sign\":\"96411cf48914fc94c24593babac979b9\",\"remark\":\"手动调为成功\",\"orderAmt\":\"1.00\",\"version\":\"V2\",\"bizAmt\":\"1.00\",\"status\":\"1\"}",
  92. },false)
  93. .then(async r => {
  94. console.log(r)
  95. })
  96. .catch(err => {
  97. console.log(err)
  98. })
  99. },
  100. },
  101. }
  102. </script>
  103. <style>
  104. </style>