金诚优选前端代码
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.

124 lines
3.1 KiB

  1. <template>
  2. <view>
  3. <lf-nav :spreadOut="true" :showIcon="true" bgColor="#fff" title="确认金额"></lf-nav>
  4. <view class="lf-p-30" style="margin: 0 auto;">
  5. <view class="confirm-card">
  6. <view class="lf-font-32 lf-color-555">
  7. 请核对支付金额
  8. </view>
  9. <view style="font-size: 72rpx;color: #15716E;">¥{{ amount }}</view>
  10. <view class="lf-flex">
  11. <view class="lf-font-24 lf-m-r-10" style="color:#FF9D9D">
  12. 剩余支付时间
  13. </view>
  14. <countdown-timer :time="time" :autoStart="true" @finish="dateFinish">
  15. <template v-slot="{minute, second}">
  16. <!-- <view>{{minute}}:{{second}}</view> -->
  17. <view class="lf-flex">
  18. <view class="lf-font-24" style="color:#FF9D9D">{{ minute >= 10 ? minute : "0" + minute }}</view>
  19. <view class="lf-font-24" style="color:#FF9D9D">:</view>
  20. <view class="lf-font-24" style="color:#FF9D9D">{{ second >= 10 ? second : "0" + second }}</view>
  21. </view>
  22. </template>
  23. </countdown-timer>
  24. </view>
  25. <view>
  26. <button class="confirmcash-btn" hover-class="lf-opacity" @click="offlinePay">确认</button>
  27. </view>
  28. </view>
  29. </view>
  30. </view>
  31. </template>
  32. <script>
  33. import countdownTimer from '@/components/countdown-timer/countdown-timer';
  34. export default {
  35. components: {
  36. countdownTimer
  37. },
  38. data() {
  39. return {
  40. time: new Date('2021/09/8 14:15:00').getTime() - new Date('2021/09/8 14:10:00').getTime(),
  41. amount: 0,
  42. clerk_id: 0,
  43. brand_id: 0,
  44. is_date_end: false
  45. }
  46. },
  47. onLoad(options){
  48. this.amount = options.amount || 0;
  49. this.clerk_id = options.clerk_id;
  50. this.brand_id = options.brand_id;
  51. },
  52. methods: {
  53. dateFinish(){
  54. console.log("倒计时结束");
  55. this.is_date_end = true;
  56. },
  57. offlinePay(){
  58. if(this.amount == 0){
  59. return this.$msg('支付金额不能为0');
  60. }
  61. if(this.is_date_end){
  62. uni.showModal({
  63. title: '温馨提示',
  64. content: '支付时间已结束, 请重新操作',
  65. showCancel: false,
  66. confirmColor: '#1c8482'
  67. });
  68. return;
  69. };
  70. let token = this.$cookieStorage.get('user_token');
  71. this.$http.post({
  72. api: 'api/offline/pay',
  73. data: {
  74. clerk_id: this.clerk_id,
  75. brand_id: this.brand_id,
  76. amount: this.amount
  77. },
  78. header: {
  79. Authorization: token
  80. }
  81. }).then(res => {
  82. if(res.data.code == 200){
  83. this.$url('/pages/aboutpay/paystate?payState=1&amount='+ this.amount);
  84. }else{
  85. this.$msg(res.data.message || res.data.data || '支付失败').then(() => {
  86. this.$url('/pages/aboutpay/paystate?payState=0');
  87. })
  88. }
  89. })
  90. }
  91. }
  92. }
  93. </script>
  94. <style>
  95. page {
  96. background-color: #F8F8F8;
  97. }
  98. </style>
  99. <style scoped lang="scss">
  100. .confirmcash-btn {
  101. width: 550rpx;
  102. height: 100rpx;
  103. background: #15716E;
  104. border-radius: 50rpx;
  105. display: flex;
  106. justify-content: center;
  107. font-size: 32rpx;
  108. color: white;
  109. align-items: center;
  110. }
  111. .confirm-card {
  112. padding: 30rpx 0;
  113. width: 686rpx;
  114. height: 475rpx;
  115. background: #FFFFFF;
  116. border-radius: 20rpx;
  117. display: flex;
  118. justify-content: space-around;
  119. align-items: center;
  120. flex-direction: column;
  121. }
  122. </style>