219 lines
5.0 KiB
Vue
219 lines
5.0 KiB
Vue
<template>
|
|
<div class="page-body">
|
|
<scroll-view scroll-y class="addressListPage" v-if="addList && addList.length > 0">
|
|
<radio-group :value="addressId" @change="checkAddress">
|
|
<view class="address-card" v-for="n in addList" :key="n.MEMBERADDRESS_ID"
|
|
@click="checkOrEdit(n.MEMBERADDRESS_ID)">
|
|
<view style="flex: 1.5; text-align: right; padding-left: 16rpx" v-if="pageMsg.type !== 0">
|
|
<radio :value="n.MEMBERADDRESS_ID" color="#CAA97F"></radio>
|
|
</view>
|
|
<view class="card-left">
|
|
<view class="address-title">
|
|
{{ n.ADDRESS + n.DOORPLATE }}
|
|
<text class="tip-moren" v-if="n.ISDEFAULT === 1">默认</text>
|
|
</view>
|
|
<view class="address-other">
|
|
{{ n.USER_NAME + n.USER_SEX_TEXT + " " + n.MOBILEPHONE }}
|
|
</view>
|
|
</view>
|
|
<view class="card-right" @click.stop="editAddress(n.MEMBERADDRESS_ID)">
|
|
<image src="https://eshangtech.com/ShopICO/icos/address-edit.png" style="width: 28rpx; height: 28rpx" />
|
|
</view>
|
|
</view>
|
|
</radio-group>
|
|
</scroll-view>
|
|
<view class="bottonBtnBox">
|
|
<view class="getWxAddress" @click="handleGetWxAddress">导入微信地址</view>
|
|
<navigator url="/pages/myAddress/newAdd/index" class="btn">新增收货地址</navigator>
|
|
</view>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import { mapGetters, mapMutations } from "vuex";
|
|
export default {
|
|
data() {
|
|
return {
|
|
pageMsg: {
|
|
type: 0,
|
|
},
|
|
addList: [],
|
|
addressId: 0, // 被选择的地址
|
|
};
|
|
},
|
|
computed: {
|
|
...mapGetters(["user"]),
|
|
},
|
|
methods: {
|
|
...mapMutations({
|
|
setAddress: "orderAddress",
|
|
}),
|
|
getList() {
|
|
let _this = this;
|
|
this.$api
|
|
.getCoop({
|
|
action_type: "GetAddressList",
|
|
})
|
|
.then(function (res) {
|
|
if (res.ResultCode === "100") {
|
|
_this.addList = res.Data.List;
|
|
}
|
|
});
|
|
},
|
|
editAddress(id) {
|
|
uni.navigateTo({ url: "/pages/myAddress/newAdd/index?id=" + id });
|
|
},
|
|
checkOrEdit(n) {
|
|
if (this.pageMsg.type === 0) {
|
|
this.editAddress(n);
|
|
} else {
|
|
this.addressId = Number(n);
|
|
this.setAddress(this.addressId);
|
|
uni.navigateBack({ delta: 1 });
|
|
}
|
|
},
|
|
checkAddress(event) {
|
|
this.addressId = Number(event.mp.detail);
|
|
this.setAddress(this.addressId);
|
|
uni.navigateBack({ delta: 1 });
|
|
},
|
|
|
|
// 跳转添加地址的详情 修改传入的参数 可以导入微信的地址
|
|
handleGetWxAddress() {
|
|
uni.navigateTo({ url: "/pages/myAddress/newAdd/index?type=getWx" });
|
|
},
|
|
},
|
|
onUnload() {
|
|
if (this.addList.length === 0) {
|
|
this.setAddress("");
|
|
}
|
|
this.addressId = 0;
|
|
this.pageMsg.type = 0;
|
|
},
|
|
onShow() {
|
|
this.getList();
|
|
},
|
|
onLoad(option) {
|
|
if (option.type) {
|
|
this.addressId = Number(option.id);
|
|
this.pageMsg.type = option.type;
|
|
}
|
|
this.$utils.addUserBehaviorNew();
|
|
// this.getList()
|
|
// this.handleGetWxAddress();
|
|
},
|
|
};
|
|
</script>
|
|
|
|
|
|
<style lang="less" scoped>
|
|
.page-body {
|
|
padding: 24rpx 0;
|
|
width: 100vw;
|
|
height: 100vh;
|
|
box-sizing: border-box;
|
|
}
|
|
|
|
.addressListPage {
|
|
width: 100%;
|
|
height: calc(100vh - 200rpx);
|
|
}
|
|
|
|
.addressListPage ::-webkit-scrollbar {
|
|
display: none;
|
|
}
|
|
|
|
.address-card {
|
|
display: flex;
|
|
align-items: center;
|
|
padding: 24rpx 0;
|
|
background: #fff;
|
|
}
|
|
|
|
.address-card+.address-card {
|
|
margin-top: 16rpx;
|
|
}
|
|
|
|
.card-left {
|
|
flex: 8;
|
|
padding-left: 32rpx;
|
|
}
|
|
|
|
.address-title {
|
|
display: -webkit-box;
|
|
-webkit-box-orient: vertical;
|
|
-webkit-line-clamp: 2;
|
|
overflow: hidden;
|
|
text-overflow: ellipsis;
|
|
padding-right: 40rpx;
|
|
font-size: 26rpx;
|
|
}
|
|
|
|
.address-other {
|
|
font-size: 24rpx;
|
|
color: #a1a1a1;
|
|
}
|
|
|
|
.tip-moren {
|
|
font-size: 18rpx;
|
|
color: #ffffff;
|
|
width: 40rpx;
|
|
text-align: center;
|
|
background: linear-gradient(to right, #a17356, #d8aa8b);
|
|
border-radius: 2rpx;
|
|
margin-left: 8rpx;
|
|
height: 26rpx;
|
|
display: inline-block;
|
|
vertical-align: middle;
|
|
}
|
|
|
|
.card-right {
|
|
flex: 1.5;
|
|
padding-right: 32rpx;
|
|
text-align: right;
|
|
}
|
|
|
|
.bottonBtnBox {
|
|
width: 100%;
|
|
height: 200rpx;
|
|
box-sizing: border-box;
|
|
padding-top: 12rpx;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: space-between;
|
|
padding: 0 32rpx;
|
|
|
|
|
|
.getWxAddress {
|
|
width: calc(50% - 16rpx);
|
|
height: 88rpx;
|
|
line-height: 88rpx;
|
|
text-align: center;
|
|
// margin-bottom: 12rpx;
|
|
font-size: 30rpx;
|
|
box-sizing: border-box;
|
|
border-radius: 12rpx;
|
|
// background: linear-gradient(to left, #1f1f1f, #62605f);
|
|
color: #1f1f1f;
|
|
border: 1px solid #62605f;
|
|
display: inline-block;
|
|
}
|
|
|
|
.btn {
|
|
height: 88rpx;
|
|
width: calc(50% - 16rpx);
|
|
line-height: 88rpx;
|
|
background: linear-gradient(to right, #1f1f1f, #62605f);
|
|
color: #f0dccf;
|
|
text-align: center;
|
|
font-size: 30rpx;
|
|
margin-left: 5%;
|
|
// position: fixed;
|
|
// bottom: 32rpx;
|
|
// transform: translateX(-50%);
|
|
// left: 50%;
|
|
border-radius: 12rpx;
|
|
}
|
|
}
|
|
</style>
|