pay-modal.vue 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. <template>
  2. <modal v-model="vValue">
  3. <view class="screen_all center">
  4. <view class="pay-modal center">
  5. <image v-if="icon" :src="icon" class="pay-modal-icon"></image>
  6. <view class="pay-success-title">{{message || ''}}</view>
  7. <view class="pay-button-group row"
  8. :class="['pay-button-'+useType+'-group']"
  9. >
  10. <view class="pay-button center"
  11. v-for="(item,index) in buttonData"
  12. :key="index"
  13. :class="{'pay-button-detail': item.border}"
  14. @click="trigger(item)"
  15. >{{item.label}}</view>
  16. </view>
  17. </view>
  18. </view>
  19. </modal>
  20. </template>
  21. <script>
  22. import props from './props';
  23. import mixins from './mixins';
  24. import Modal from "../../components/modal/main";
  25. import buttonData from './data/button';
  26. export default {
  27. name: "pay-modal",
  28. props,
  29. mixins,
  30. data(){
  31. return {
  32. vValue:false
  33. }
  34. },
  35. computed:{
  36. buttonData(){
  37. return buttonData[this.useType];
  38. },
  39. useType(){
  40. if (this.type) {
  41. return this.type;
  42. } else if(this.fail){
  43. return 'fail'
  44. } else {
  45. return 'default';
  46. }
  47. }
  48. },
  49. watch:{
  50. value(){
  51. this.changeValue(this.value);
  52. }
  53. },
  54. methods:{
  55. changeValue(value){
  56. if (this.vValue !== value) {
  57. this.vValue = value;
  58. if (this.value !== value) {
  59. return this.$emit('input',value);
  60. }
  61. }
  62. }
  63. },
  64. created(){
  65. this.changeValue(this.value);
  66. },
  67. components:{
  68. Modal,
  69. }
  70. }
  71. </script>
  72. <style scoped lang="scss" src="./style.scss">
  73. </style>