init
This commit is contained in:
@@ -0,0 +1,156 @@
|
||||
<!-- 地址卡片 -->
|
||||
<template>
|
||||
<view
|
||||
class="address-item ss-row-between ss-col-center"
|
||||
:class="[{ 'border-bottom': props.hasBorderBottom, bg24: props.theme == 2 }]"
|
||||
>
|
||||
<view class="item-left" v-if="!isEmpty(props.item)">
|
||||
<view class="person-text" :class="theme == 2 ? 'c0' : ''">
|
||||
{{ props.item.name }} {{ props.item.mobile }}
|
||||
</view>
|
||||
|
||||
<view class="address-text" :class="theme == 2 ? 'c0' : ''">
|
||||
{{ props.item.areaName }} {{ props.item.detailAddress }}
|
||||
</view>
|
||||
</view>
|
||||
<view v-else>
|
||||
<view class="address-text ss-m-b-10" :class="theme == 2 ? 'c0' : ''">请选择收货地址</view>
|
||||
</view>
|
||||
<slot>
|
||||
<view class="flex-center ju-between btns border-top">
|
||||
<view @click.stop="statusChange">
|
||||
<radio-group @change="statusChange" class="flex-center">
|
||||
<radio
|
||||
style="transform: scale(0.8)"
|
||||
:checked="props.item.defaultStatus"
|
||||
:color="theme == 2 ? '#FA7E31' : '#F13227'"
|
||||
/>
|
||||
<text :class="theme == 2 ? 'c3' : ''">{{
|
||||
props.item.defaultStatus ? '已设默认' : '默认'
|
||||
}}</text>
|
||||
</radio-group>
|
||||
</view>
|
||||
<view class="flex">
|
||||
<view @tap.stop="onEdit" class="edit_btn btn" :class="theme == 2 ? 'c3 border3' : ''"
|
||||
>编辑</view
|
||||
>
|
||||
<view class="delete_btn btn" @click.stop="delAddress">删除</view>
|
||||
</view>
|
||||
</view>
|
||||
</slot>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script setup>
|
||||
/**
|
||||
* 基础组件 - 地址卡片
|
||||
*
|
||||
* @param {String} icon = _icon-edit - icon
|
||||
*
|
||||
* @event {Function()} click - 点击
|
||||
* @event {Function()} actionClick - 点击工具栏
|
||||
*
|
||||
* @slot - 默认插槽
|
||||
*/
|
||||
import sheep from '@/sheep';
|
||||
import { isEmpty } from 'lodash-es';
|
||||
import AddressApi from '@/sheep/api/member/address';
|
||||
const props = defineProps({
|
||||
item: {
|
||||
type: Object,
|
||||
default() {},
|
||||
},
|
||||
hasBorderBottom: {
|
||||
type: Boolean,
|
||||
defult: true,
|
||||
},
|
||||
theme: {
|
||||
type: Number,
|
||||
default: 2,
|
||||
},
|
||||
});
|
||||
|
||||
const onEdit = () => {
|
||||
emit('edit');
|
||||
};
|
||||
const delAddress = () => {
|
||||
emit('del');
|
||||
};
|
||||
const emit = defineEmits(['edit', 'del', 'getData']);
|
||||
const statusChange = async (e) => {
|
||||
if (!e) return;
|
||||
let obj = JSON.parse(JSON.stringify(props.item));
|
||||
obj.defaultStatus = !obj.defaultStatus;
|
||||
let ref = await AddressApi.updateAddress(obj);
|
||||
emit('getData');
|
||||
};
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
.address-item {
|
||||
padding: 24rpx 30rpx;
|
||||
padding-top: 38rpx;
|
||||
box-sizing: border-box;
|
||||
background-color: #fff;
|
||||
margin-bottom: 24rpx;
|
||||
|
||||
.item-left {
|
||||
margin-bottom: 30rpx;
|
||||
}
|
||||
|
||||
.area-text {
|
||||
font-size: 26rpx;
|
||||
font-weight: 400;
|
||||
color: $dark-9;
|
||||
}
|
||||
|
||||
.address-text {
|
||||
font-size: 32rpx;
|
||||
font-weight: 500;
|
||||
color: #333333;
|
||||
line-height: 48rpx;
|
||||
}
|
||||
|
||||
.person-text {
|
||||
font-size: 28rpx;
|
||||
font-weight: 400;
|
||||
color: #333333;
|
||||
margin-bottom: 16rpx;
|
||||
}
|
||||
}
|
||||
|
||||
.edit-btn {
|
||||
width: 44rpx;
|
||||
height: 44rpx;
|
||||
background: $gray-f;
|
||||
border-radius: 50%;
|
||||
|
||||
.edit-icon {
|
||||
width: 24rpx;
|
||||
height: 24rpx;
|
||||
}
|
||||
}
|
||||
image {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
.btn {
|
||||
width: 86rpx;
|
||||
height: 48rpx;
|
||||
text-align: center;
|
||||
line-height: 48rpx;
|
||||
font-size: 28rpx;
|
||||
border: 2rpx solid #9c9c9c;
|
||||
color: #58595b;
|
||||
border-radius: 8rpx;
|
||||
}
|
||||
.delete_btn {
|
||||
border: 2rpx solid #f13227;
|
||||
color: #f13227;
|
||||
margin-left: 20rpx;
|
||||
}
|
||||
.btns {
|
||||
padding-top: 18rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
</style>
|
||||
Reference in New Issue
Block a user