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

144 lines
3.7 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="confirm">确认</button>
  27. </view>
  28. </view>
  29. </view>
  30. <lf-pay-password v-if="show_pay" @comfirm="payComfirm" title="请输入支付密码"></lf-pay-password>
  31. </view>
  32. </template>
  33. <script>
  34. import countdownTimer from '@/components/countdown-timer/countdown-timer';
  35. import lfPayPassword from '@/components/lf-payPassword/lf-payPassword.vue'
  36. export default {
  37. components: {
  38. countdownTimer,
  39. lfPayPassword
  40. },
  41. data() {
  42. return {
  43. time: new Date('2021/09/8 14:15:00').getTime() - new Date('2021/09/8 14:10:00').getTime(),
  44. amount: 0,
  45. clerk_id: 0,
  46. brand_id: 0,
  47. is_date_end: false,
  48. show_pay: false,
  49. pay_pwd: '' // 支付密码
  50. }
  51. },
  52. onLoad(options){
  53. this.amount = options.amount || 0;
  54. this.clerk_id = options.clerk_id;
  55. this.brand_id = options.brand_id;
  56. },
  57. methods: {
  58. dateFinish(){
  59. console.log("倒计时结束");
  60. this.is_date_end = true;
  61. },
  62. // 确认
  63. confirm(){
  64. if(this.amount == 0){
  65. return this.$msg('支付金额不能为0');
  66. }
  67. if(this.is_date_end){
  68. uni.showModal({
  69. title: '温馨提示',
  70. content: '支付时间已结束, 请重新操作',
  71. showCancel: false,
  72. confirmColor: '#1c8482'
  73. });
  74. return;
  75. };
  76. this.show_pay = true;
  77. },
  78. // 密码输入完毕
  79. payComfirm(event){
  80. this.show_pay = false;
  81. this.pay_pwd = event;
  82. this.offlinePay();
  83. },
  84. offlinePay(){
  85. uni.showLoading({
  86. title: '正在支付中'
  87. })
  88. let token = this.$cookieStorage.get('user_token');
  89. this.$http.post({
  90. api: 'api/offline/pay',
  91. data: {
  92. clerk_id: this.clerk_id,
  93. brand_id: this.brand_id,
  94. amount: this.amount,
  95. pay_pwd: this.pay_pwd
  96. },
  97. header: {
  98. Authorization: token
  99. }
  100. }).then(res => {
  101. uni.hideLoading();
  102. if(res.data.code == 200){
  103. this.$url('/pages/aboutpay/paystate?payState=1&amount='+ this.amount, {type: 'redirect'});
  104. }else{
  105. this.$msg(res.data.message || res.data.data || '支付失败').then(() => {
  106. this.$url('/pages/aboutpay/paystate?payState=0', {type: 'redirect'});
  107. })
  108. }
  109. }).catch(err => uni.hideLoading())
  110. }
  111. }
  112. }
  113. </script>
  114. <style>
  115. page {
  116. background-color: #F8F8F8;
  117. }
  118. </style>
  119. <style scoped lang="scss">
  120. .confirmcash-btn {
  121. width: 550rpx;
  122. height: 100rpx;
  123. background: #15716E;
  124. border-radius: 50rpx;
  125. display: flex;
  126. justify-content: center;
  127. font-size: 32rpx;
  128. color: white;
  129. align-items: center;
  130. }
  131. .confirm-card {
  132. padding: 30rpx 0;
  133. width: 686rpx;
  134. height: 475rpx;
  135. background: #FFFFFF;
  136. border-radius: 20rpx;
  137. display: flex;
  138. justify-content: space-around;
  139. align-items: center;
  140. flex-direction: column;
  141. }
  142. </style>