account-type-select.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  1. <template>
  2. <su-popup :show="show" class="ss-checkout-counter-wrap" @close="hideModal">
  3. <view class="ss-modal-box bg-white ss-flex-col">
  4. <view class="modal-header ss-flex-col ss-col-left">
  5. <text class="modal-title ss-m-b-20">选择提现方式</text>
  6. </view>
  7. <view class="modal-content ss-flex-1 ss-p-b-100">
  8. <radio-group @change="onChange">
  9. <label class="container-list ss-p-l-34 ss-p-r-24 ss-flex ss-col-center ss-row-center"
  10. v-for="(item, index) in typeList" :key="index">
  11. <view class="container-icon ss-flex ss-m-r-20">
  12. <image :src="sheep.$url.static(item.icon)" />
  13. </view>
  14. <view class="ss-flex-1">{{ item.title }}</view>
  15. <radio :value="item.value" color="var(--ui-BG-Main)"
  16. :checked="item.value === state.currentValue" />
  17. <!-- :disabled="!methods.includes(item.value)" -->
  18. </label>
  19. </radio-group>
  20. </view>
  21. <view class="modal-footer ss-flex ss-row-center ss-col-center">
  22. <button class="ss-reset-button save-btn" @tap="onConfirm">确定</button>
  23. </view>
  24. </view>
  25. </su-popup>
  26. </template>
  27. <script setup>
  28. import {
  29. reactive,
  30. onBeforeMount,
  31. nextTick
  32. } from 'vue';
  33. import sheep from '@/sheep';
  34. const props = defineProps({
  35. modelValue: {
  36. type: Object,
  37. default () {},
  38. },
  39. show: {
  40. type: Boolean,
  41. default: false,
  42. },
  43. methods: {
  44. type: Array,
  45. default: [],
  46. },
  47. });
  48. const emits = defineEmits(['update:modelValue', 'change', 'close']);
  49. const state = reactive({
  50. currentValue: '0',
  51. });
  52. const typeList = [{
  53. // icon: '/static/img/shop/pay/wechat.png',
  54. title: '工商银行',
  55. value: '0',
  56. },
  57. {
  58. // icon: '/static/img/shop/pay/alipay.png',
  59. title: '建设银行',
  60. value: '1',
  61. },
  62. {
  63. // icon: '/static/img/shop/pay/bank.png',
  64. title: '农业',
  65. value: '2',
  66. },
  67. ];
  68. const getWalletAccountInfo = async () => {
  69. return new Promise(async (resolve, reject) => {
  70. let res = await sheep.$api.user.account.info({
  71. type: state.currentValue,
  72. });
  73. if (res.error === 0) {
  74. if (!props.methods.includes(res.data.type)) {
  75. return;
  76. }
  77. state.currentValue = res.data.type;
  78. emits('update:modelValue', {
  79. type: res.data.type,
  80. account_header: res.data.account_header,
  81. account_name: res.data.account_name,
  82. account_no: res.data.account_no,
  83. });
  84. } else {
  85. emits('update:modelValue', {
  86. type: state.currentValue,
  87. });
  88. }
  89. resolve();
  90. });
  91. };
  92. function onChange(e) {
  93. state.currentValue = e.detail.value;
  94. }
  95. const onConfirm = async () => {
  96. if (state.currentValue === '') {
  97. sheep.$helper.toast('请选择提现方式');
  98. return;
  99. }
  100. await getWalletAccountInfo();
  101. emits('close');
  102. };
  103. const hideModal = () => {
  104. emits('close');
  105. };
  106. onBeforeMount(async () => {
  107. await getWalletAccountInfo();
  108. });
  109. </script>
  110. <style lang="scss" scoped>
  111. .ss-modal-box {
  112. border-radius: 30rpx 30rpx 0 0;
  113. max-height: 1000rpx;
  114. .modal-header {
  115. position: relative;
  116. padding: 60rpx 40rpx 40rpx;
  117. .modal-title {
  118. font-size: 32rpx;
  119. font-weight: bold;
  120. }
  121. .close-icon {
  122. position: absolute;
  123. top: 10rpx;
  124. right: 20rpx;
  125. font-size: 46rpx;
  126. opacity: 0.2;
  127. }
  128. }
  129. .modal-content {
  130. overflow-y: auto;
  131. .container-list {
  132. height: 96rpx;
  133. border-bottom: 2rpx solid rgba(#dfdfdf, 0.5);
  134. font-size: 28rpx;
  135. font-weight: 500;
  136. color: #333333;
  137. .container-icon {
  138. width: 36rpx;
  139. height: 36rpx;
  140. }
  141. }
  142. }
  143. .modal-footer {
  144. height: 120rpx;
  145. .save-btn {
  146. width: 710rpx;
  147. height: 80rpx;
  148. border-radius: 40rpx;
  149. background: linear-gradient(90deg, var(--ui-BG-Main), var(--ui-BG-Main-gradient));
  150. color: $white;
  151. }
  152. }
  153. }
  154. image {
  155. width: 100%;
  156. height: 100%;
  157. }
  158. </style>