123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237 |
- <!-- 下单界面,收货地址 or 自提门店的选择组件 -->
- <template>
- <v-card class="allAddress" elevation="1" :style="state.isPickUp ? '' : 'padding-top:10rpx;'">
- <!-- 情况一:收货地址的选择 -->
- <div
- class="address"
- @click="onSelectAddress"
- v-if="state.deliveryType === 1"
- :style="state.isPickUp ? '' : 'border-top-left-radius: 14rpx;border-top-right-radius: 14rpx;'"
- >
- <div class="addressCon" v-if="state.addressInfo.name">
- <div class="name d-flex"
- >{{ state.addressInfo.name }}
- <div class="phone ml-3">{{ state.addressInfo.mobile }}</div>
- </div>
- <div class="d-flex mt-1">
- <div class="default font-color" v-if="state.addressInfo.defaultStatus">[默认]</div>
- <div class="line2 ml-3">
- {{ state.addressInfo.areaName }} {{ state.addressInfo.detailAddress }}
- </div>
- </div>
- </div>
- <div class="addressCon" v-else>
- <div class="setaddress">设置收货地址</div>
- </div>
- <div class="iconfont">
- <div class="ss-rest-button">
- <div class="_icon-forward" />
- </div>
- </div>
- </div>
- </v-card>
- </template>
- <script setup>
- import { computed } from 'vue';
- import { isEmpty1 } from '@/utils/is'
- // import Snackbar from '@/plugins/snackbar'
- const props = defineProps({
- modelValue: {
- type: Object,
- default() {},
- },
- });
- const emits = defineEmits(['update:modelValue']);
- // computed 解决父子组件双向数据同步
- const state = computed({
- get() {
- return new Proxy(props.modelValue, {
- set(obj, name, val) {
- emits('update:modelValue', {
- ...obj,
- [name]: val,
- });
- return true;
- },
- });
- },
- set(val) {
- emits('update:modelValue', val);
- },
- });
- // 选择地址
- function onSelectAddress() {
- // let emitName = 'SELECT_ADDRESS';
- // let addressPage = '/pages/user/address/list?type=select';
- // if (state.value.deliveryType === 2) {
- // emitName = 'SELECT_PICK_UP_INFO';
- // addressPage = '/pages/user/goods_details_store/index';
- // }
- // uni.$once(emitName, (e) => {
- // changeConsignee(e.addressInfo);
- // });
- // sheep.$router.go(addressPage);
- }
- // 更改收货人地址&计算订单信息
- async function changeConsignee(addressInfo = {}) {
- if (!isEmpty1(addressInfo)) {
- if (state.value.deliveryType === 1) {
- state.value.addressInfo = addressInfo;
- }
- if (state.value.deliveryType === 2) {
- state.value.pickUpInfo = addressInfo;
- }
- }
- }
- // 收货方式切换
- const switchDeliveryType = (type) => {
- state.value.deliveryType = type;
- };
- </script>
- <style scoped lang="scss">
- .allAddress .font-color {
- color: #e93323 !important;
- }
- .line2 {
- width: 504rpx;
- }
- .textR {
- text-align: right;
- }
- .line {
- width: 100%;
- height: 3rpx;
- }
- .line image {
- width: 100%;
- height: 100%;
- display: block;
- }
- .address {
- background-color: #fff;
- box-sizing: border-box;
- padding: 12px;
- border-radius: 10px;
- }
- .address .addressCon {
- width: 596rpx;
- font-size: 26rpx;
- color: #666;
- }
- .address .addressCon .name {
- font-size: 30rpx;
- color: #282828;
- font-weight: bold;
- margin-bottom: 10rpx;
- }
- .address .addressCon .name .phone {
- margin-left: 50rpx;
- }
- .address .addressCon .default {
- margin-right: 12rpx;
- }
- .address .addressCon .setaddress {
- color: #333;
- font-size: 28rpx;
- }
- .address .iconfont {
- font-size: 35rpx;
- color: #707070;
- }
- .allAddress {
- width: 100%;
- padding-top: 100rpx;
- padding-bottom: 10rpx;
- }
- .allAddress .nav {
- width: 690rpx;
- margin: 0 auto;
- }
- .allAddress .nav .item {
- width: 334rpx;
- }
- .allAddress .nav .item.on {
- position: relative;
- width: 230rpx;
- }
- .allAddress .nav .item.on::before {
- position: absolute;
- bottom: 0;
- content: '快递配送';
- font-size: 28rpx;
- display: block;
- height: 0;
- width: 336rpx;
- border-width: 0 20rpx 80rpx 0;
- border-style: none solid solid;
- border-color: transparent transparent #fff;
- z-index: 2;
- border-radius: 14rpx 36rpx 0 0;
- text-align: center;
- line-height: 80rpx;
- }
- .allAddress .nav .item:nth-of-type(2).on::before {
- content: '到店自提';
- border-width: 0 0 80rpx 20rpx;
- border-radius: 36rpx 14rpx 0 0;
- }
- .allAddress .nav .item.on2 {
- position: relative;
- }
- .allAddress .nav .item.on2::before {
- position: absolute;
- bottom: 0;
- content: '到店自提';
- font-size: 28rpx;
- display: block;
- height: 0;
- width: 401rpx;
- border-width: 0 0 60rpx 60rpx;
- border-style: none solid solid;
- border-color: transparent transparent #f7c1bd;
- border-radius: 36rpx 14rpx 0 0;
- text-align: center;
- line-height: 60rpx;
- }
- .allAddress .nav .item:nth-of-type(1).on2::before {
- content: '快递配送';
- border-width: 0 60rpx 60rpx 0;
- border-radius: 14rpx 36rpx 0 0;
- }
- .allAddress .address {
- width: 690rpx;
- max-height: 180rpx;
- margin: 0 auto;
- }
- .allAddress .line {
- width: 100%;
- margin: 0 auto;
- }
- </style>
|