123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272 |
- <template>
- <view>
- <!-- 头部 -->
- <headContent borderBottom>
- <template #left>
- <reverse-back />
- </template>
- <template #right>
- <view class="head-icon" @click.stop="selectCurrency()">
- <text class="iconfont iconfont2"></text>
- </view>
- </template>
- </headContent>
- <view class="content" :style="{'height':PageContentHeight + 'px'}">
- <view class="pages-title">
- 地址管理
- </view>
- <view class="currency">
- <text class="currency-lable">{{ currencyInfo ? currencyInfo.name : '' }}</text>
- </view>
- <scroll-view class="scroll-view" scroll-y :style="{'height': scrollHeight}">
- <template v-for="(item , index) in addressList">
- <view class="address-item">
- <view class="address-title">
- <text class="title">{{ item.notes }}</text>
- <text class="del-address" @click.stop="delAddress(item)">删除</text>
- </view>
- <view class="address-currency">
- {{ currencyInfo ? `${currencyInfo.name}_` : '' }}{{ item.type }}
- </view>
- <view class="address-text">
- {{ item.address }}
- </view>
- </view>
- </template>
- <empty v-if="!addressList || addressList.length === 0" />
- </scroll-view>
- <view class="add-address">
- <view class="add-btn" @click.stop="addBtn()">
- 添加提币地址
- </view>
- </view>
- </view>
- <confirm-popup ref="confirmPopupRef" content="确定删除?" @confirm="confirmDel" />
- </view>
- </template>
- <script>
- import {
- mapGetters
- } from 'vuex'
- import {
- Way_getBiTypeList
- } from "@/utils/common-request.js"
- import {
- Api_getAddress,
- Api_delAddress
- } from "@/api/index.js"
- export default {
- name: 'addressList',
- data() {
- return {
- value11: false,
- scrollHeight: 0,
- currencyInfo: null,
- addressList: [],
- getBiStatus: false,
- delItem: {},
- };
- },
- computed: {
- ...mapGetters([
- 'PageContentHeight'
- ])
- },
- watch: {
- PageContentHeight: {
- handler(newH) {
- this.scrollHeight = newH - uni.upx2px(120) - uni.upx2px(80) - uni.upx2px(160) + 'px'
- },
- immediate: true
- },
- currencyInfo: {
- handler(newC, oldC) {
- if (newC && newC.id !== oldC?.id) {
- this.getAddress();
- this.$setStorageSync('currency', newC);
- } else {
- if (this.getBiStatus) {
- return false
- };
- this.getBiStatus = true;
- Way_getBiTypeList().then(res => {
- if (res && res.length > 0) {
- this.currencyInfo = res[0];
- this.getBiStatus = false
- }
- }).catch(err => {
- this.currencyInfo = []
- })
- }
- },
- deep: true,
- immediate: true
- },
- },
- onLoad() {
- this.currencyInfo = this.$getStorageSync('currency');
- },
- onShow() {
- },
- mounted() {
- },
- methods: {
- // 选择币种的回调
- setBiInfo(e){
- if(e){
- this.currencyInfo = e
- }
- },
- confirmDel() {
- uni.showLoading({
- title: ''
- })
- Api_delAddress({
- address_id: this.delItem?.id
- }).then(res => {
- this.getAddress()
- }).catch(err => {
- }).finally(() => {
- setTimeout(() => {
- uni.hideLoading()
- }, 200)
- })
- },
- // 删除
- delAddress(item) {
- this.delItem = item
- this.$nextTick(() => {
- this.$refs.confirmPopupRef.open();
- })
- },
- selectCurrency() {
- uni.navigateTo({
- url: `/pages/content/select-currency?type=address`
- })
- },
- addBtn() {
- uni.navigateTo({
- url: '/pages/content/add-address',
- success: res => {
- // 通过eventChannel向被打开页面传送数据
- res.eventChannel.emit('setCurrency', this.currencyInfo)
- }
- })
- },
- getAddress() {
- Api_getAddress({
- currency: this.currencyInfo?.id
- }).then(res => {
- this.addressList = res
- console.log('getAddress = ', res)
- }).catch(err => {
- })
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .content {
- width: 100%;
- .pages-title {
- height: 120rpx;
- font-size: 60rpx;
- font-weight: bold;
- line-height: 130rpx;
- padding: 0 $pages-padding;
- }
- .currency {
- width: 100%;
- height: 80rpx;
- padding: 0 $pages-padding;
- display: flex;
- justify-content: space-between;
- .currency-lable {
- font-size: 28rpx;
- }
- }
- .scroll-view {
- width: 100%;
- padding: 0 $pages-padding;
- .address-item {
- width: 100%;
- background-color: #f6f6f6;
- padding: 36rpx 20rpx;
- border-radius: 10rpx;
- margin-bottom: 20rpx;
- .address-title {
- width: 100%;
- border-bottom: 1rpx solid $border-color4;
- padding-bottom: 30rpx;
- display: flex;
- justify-content: space-between;
- .title {
- flex: 1;
- font-size: 30rpx;
- }
- .del-address {
- flex-shrink: 0;
- font-size: 26rpx;
- color: #d7b213;
- }
- }
- .address-currency {
- padding: 20rpx 0 16rpx;
- font-size: 24rpx;
- color: #aaa8a8;
- }
- .address-text {
- font-size: 22rpx;
- color: #aaa8a8;
- }
- }
- // <view class="address-item">
- // <view class="address-title">
- // <text class="title">发个按时打卡可是大家撒低级</text>
- // <text class="del-address">删除</text>
- // </view>
- // <view class="address-currency">
- // USDT_TRC20
- // </view>
- // <view class="address-text">
- // 的军事打击跨国黄金时代进口的韩国
- // </view>
- // </view>
- }
- .add-address {
- width: 100%;
- height: 160rpx;
- padding: 40rpx $pages-padding;
- .add-btn {
- width: 100%;
- height: 100%;
- text-align: center;
- line-height: 80rpx;
- background-color: $Theme-Color;
- font-size: 32rpx;
- color: #fff;
- border-radius: 10rpx;
- }
- }
- }
- </style>
|