184 lines
3.9 KiB
Vue
184 lines
3.9 KiB
Vue
<template>
|
|
<div class="page-body">
|
|
<div v-if="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>
|
|
</div>
|
|
<navigator url="/pages/myAddress/newAdd/index" class="btn"
|
|
>新增收货地址</navigator
|
|
>
|
|
</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 });
|
|
},
|
|
},
|
|
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.getList()
|
|
},
|
|
};
|
|
</script>
|
|
|
|
|
|
<style lang="stylus" scoped>
|
|
.page-body {
|
|
padding: 24rpx 0;
|
|
}
|
|
|
|
.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;
|
|
}
|
|
|
|
.btn {
|
|
height: 88rpx;
|
|
width: 90%;
|
|
line-height: 88rpx;
|
|
background: linear-gradient(to right, #1f1f1f, #62605f);
|
|
color: #f0dccf;
|
|
text-align: center;
|
|
font-size: 30rpx;
|
|
position: fixed;
|
|
bottom: 32rpx;
|
|
transform: translateX(-50%);
|
|
left: 50%;
|
|
border-radius: 12rpx;
|
|
}
|
|
</style>
|