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

146 lines
3.8 KiB

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