| | |
| | | <text class="close" @click="closePopup">×</text> |
| | | </view> |
| | | <scroll-view scroll-y="true" class="card-scroll"> |
| | | <view class="card-item" v-for="(card, index) in businessList" :key="index" |
| | | @click="selectCard(index)"> |
| | | <uni-swipe-action> |
| | | <view v-for="(card, index) in businessList" :key="index"> |
| | | <uni-swipe-action-item :right-options="rightOptions" @click="handleDel(index, card)"> |
| | | <view @click="selectCard(index)" class="card-item"> |
| | | <view :class="{active: card.is_default==1}" class="card-preview"> |
| | | <image style="width: 650rpx;border-radius: 12rpx;" :src="card.mp" mode="widthFix"></image> |
| | | <image v-show="card.is_default==1" src="@/static/icon/mrmp.png" class="mrmp"> |
| | | </image> |
| | | <image v-show="card.is_default==1" src="@/static/icon/mrmp.png" class="mrmp"></image> |
| | | </view> |
| | | </view> |
| | | </uni-swipe-action-item> |
| | | </view> |
| | | </uni-swipe-action> |
| | | <view class="add-card" @click="addNewCard()"> |
| | | <text class="icon iconfont icon-add"></text> |
| | | <text>添加新名片</text> |
| | |
| | | |
| | | <script> |
| | | import Popup from '@/components/uni-popup.vue'; |
| | | import uniSwipeAction from '@/uni_modules/uni-swipe-action/components/uni-swipe-action/uni-swipe-action.vue'; |
| | | import uniSwipeActionItem from '@/uni_modules/uni-swipe-action/components/uni-swipe-action-item/uni-swipe-action-item.vue'; |
| | | export default { |
| | | components: { |
| | | Popup |
| | | Popup, |
| | | uniSwipeAction, |
| | | uniSwipeActionItem |
| | | }, |
| | | data() { |
| | | return { |
| | |
| | | showPayment: false, // 显示支付弹窗 |
| | | paymentMethod: 'balance', // 支付方式 |
| | | topSetting: {}, // 置顶设置 |
| | | userInfo: {} // 用户信息 |
| | | userInfo: {}, // 用户信息 |
| | | rightOptions: [{ |
| | | text: '删除', |
| | | style: { |
| | | backgroundColor: '#FF3B30' |
| | | } |
| | | }] |
| | | }; |
| | | }, |
| | | onLoad() { |
| | |
| | | } else { |
| | | return date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate(); |
| | | } |
| | | }, |
| | | // 删除名片 |
| | | handleDel(index, card) { |
| | | // 防止删除默认名片 |
| | | if (card.is_default === 1) { |
| | | this.showToast('默认名片不能删除'); |
| | | return; |
| | | } |
| | | |
| | | uni.showModal({ |
| | | title: '提示', |
| | | content: '确定要删除这个名片吗?', |
| | | success: (res) => { |
| | | if (res.confirm) { |
| | | // 调用删除接口 |
| | | this._post('plus.business.business/delete', { |
| | | business_card_id: card.business_card_id |
| | | }, (res) => { |
| | | if (res.code === 1) { |
| | | // 删除成功,更新列表 |
| | | this.businessList.splice(index, 1); |
| | | this.showToast('删除成功'); |
| | | |
| | | // 如果删除的是当前选中的名片,切换到第一个名片 |
| | | if (index === this.current) { |
| | | if (this.businessList.length > 0) { |
| | | this.current = 0; |
| | | this.getStatistics(this.businessList[this.current].business_card_id); |
| | | } |
| | | } else if (index < this.current) { |
| | | // 如果删除的是当前选中名片之前的,current减1 |
| | | this.current--; |
| | | } |
| | | } else { |
| | | this.showToast(res.msg || '删除失败'); |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | }); |
| | | }, |
| | | // 显示提示信息 |
| | | showToast(msg) { |
| | | uni.showToast({ |
| | | title: msg, |
| | | icon: 'none', |
| | | duration: 2000 |
| | | }); |
| | | } |
| | | }, |
| | | onShareAppMessage() { |
| | |
| | | |
| | | .icon { |
| | | font-size: 32rpx; |
| | | color: #37bde6; |
| | | color: #D41003; |
| | | margin-right: 16rpx; |
| | | } |
| | | |
| | |
| | | |
| | | .btn { |
| | | flex: 1; |
| | | background: #37bde6; |
| | | background: #D41003; |
| | | color: #fff; |
| | | text-align: center; |
| | | padding: 24rpx 0; |
| | |
| | | |
| | | &.active { |
| | | background: #f5f5f5; |
| | | border: #37bde6 solid 1rpx; |
| | | border: #D41003 solid 1rpx; |
| | | } |
| | | |
| | | .card-company { |
| | |
| | | align-items: center; |
| | | justify-content: center; |
| | | padding: 30rpx; |
| | | color: #37bde6; |
| | | color: #D41003; |
| | | font-size: 30rpx; |
| | | |
| | | .icon { |
| | |
| | | position: relative; |
| | | |
| | | &.active { |
| | | border-color: #37bde6; |
| | | border-color: #D41003; |
| | | background: #f0f9ff; |
| | | } |
| | | |
| | |
| | | } |
| | | |
| | | .checked { |
| | | color: #37bde6; |
| | | color: #D41003; |
| | | font-size: 36rpx; |
| | | } |
| | | } |