paymoment.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. <template>
  2. <view>
  3. <van-radio-group >
  4. <van-cell-group
  5. v-for="(item, index) in list"
  6. :key="index"
  7. >
  8. <van-cell
  9. :title="item.title"
  10. @click="onChange(index)"
  11. >
  12. <template slot="icon" style="padding-right: 10upx;">
  13. <van-radio-group :value="radio" >
  14. <van-radio checked-color="#D9332E" :name="index" >
  15. </van-radio>
  16. </van-radio-group>
  17. </template>
  18. </van-cell>
  19. </van-cell-group>
  20. </van-radio-group>
  21. <view class="payMoney" @click="payMoney">支付({{prices}})</view>
  22. <Dialog :orderCancel="orderCancel"
  23. :titles="titles"
  24. :values="values"
  25. @colseDialog="cancelDialog"
  26. @confirmPay="confirmOrder"
  27. />
  28. </view>
  29. </template>
  30. <script>
  31. import Dialog from '@/component/Dialog.vue'
  32. export default {
  33. components: {
  34. Dialog
  35. },
  36. data() {
  37. return {
  38. values:'',
  39. orderCancel: false,
  40. titles:'',
  41. list:[
  42. {title:'微信支付'},
  43. {title:'支付宝支付'},
  44. {title:'圈币支付'}
  45. ],
  46. radio: 0,
  47. prices: '',
  48. order_id:''
  49. }
  50. },
  51. onLoad(e) {
  52. this.prices = e.prices;
  53. this.order_id = e.order_id;
  54. },
  55. methods: {
  56. cancelDialog() {
  57. this.orderCancel = false;
  58. },
  59. confirmOrder() {
  60. this.orderCancel = false;
  61. this.request({
  62. url:'/v1/payment/pay',
  63. method:'POST',
  64. data: {
  65. pay_code: 'point',
  66. order_id: this.order_id
  67. },
  68. success: (res) => {
  69. console.log(res);
  70. }
  71. })
  72. },
  73. onChange(index) {
  74. this.radio = index;
  75. },
  76. payMoney() {
  77. console.log("kkk")
  78. if(this.radio == 0) {
  79. // 微信支付
  80. }else if(this.radio == 1) {
  81. // 支付宝支付
  82. }else {
  83. this.titles = "圈币支付";
  84. this.values = "使用圈币支付"+this.prices;
  85. this.orderCancel = true;
  86. // 圈币支付
  87. // this.request({
  88. // url:'/v1/payment/pay',
  89. // method:'POST',
  90. // data: {
  91. // pay_code: 'point',
  92. // order_id: this.order_id
  93. // },
  94. // success: (res) => {
  95. // console.log(res);
  96. // }
  97. // })
  98. }
  99. }
  100. }
  101. }
  102. </script>
  103. <style>
  104. .payMoney {
  105. width: 90%;
  106. color: #fff;
  107. background-color: #D9332E;
  108. position: fixed;
  109. text-align: center;
  110. padding: 20upx 0;
  111. bottom: 5%;
  112. left: 5%;
  113. }
  114. </style>