account-type-select.vue 3.7 KB

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