123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161 |
- <template>
- <view class="content b-t">
- <hx-navbar left-text="收货地址" backTabbarUrl="/pages/user/center/center" :backgroundColor="[241,241,241]"></hx-navbar>
- <view class="bb15">
-
- </view>
- <view class="list-box">
- <view class="list b-b" v-for="(item, index) in addressList" :key="index" @click="checkAddress(item)">
- <view class="wrapper">
- <view class="address-box">
- <text v-if="item.default" class="tag">默认</text>
- <text class="address">{{item.addressName}} {{item.area}}</text>
- </view>
- <view class="u-box">
- <text class="name">{{item.name}}</text>
- <text class="mobile">{{item.mobile}}</text>
- </view>
- </view>
- <text class="hxicon-edit" @click.stop="addAddress('edit', item)"></text>
- </view>
- </view>
-
- <view class="add-btn" @click="addAddress('add')">
- <text>新增地址</text>
- </view>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- source: 0,
- addressList: [
- {
- name: '刘晓晓',
- mobile: '18666666666',
- addressName: '贵族皇仕牛排(东城店)',
- address: '北京市东城区',
- area: 'B区',
- default: true
- },{
- name: '刘大大',
- mobile: '18667766666',
- addressName: '龙回1区12号楼',
- address: '山东省济南市历城区',
- area: '西单元302',
- default: false,
- }
- ]
- }
- },
- onLoad(option){
- console.log(option.source);
- this.source = option.source;
- },
- methods: {
- //选择地址
- checkAddress(item){
- if(this.source == 1){
- //this.$api.prePage()获取上一页实例,在App.vue定义
- this.$api.prePage().addressData = item;
- uni.navigateBack()
- }
- },
- addAddress(type, item){
- uni.navigateTo({
- url: `/pages/user/address/addressManage?type=${type}&data=${JSON.stringify(item)}`
- })
- },
- //添加或修改成功之后回调
- refreshList(data, type){
- //添加或修改后事件,这里直接在最前面添加了一条数据,实际应用中直接刷新地址列表即可
- this.addressList.unshift(data);
-
- console.log(data, type);
- }
- }
- }
- </script>
- <style lang='scss'>
- .bb15{
- padding-bottom: 30upx;
- }
- .content{
- position: relative;
- }
- .list-box{
- display: flex;
- flex-direction: column;
- background-color: #fff;
- border-radius: 10px;
- overflow: hidden;
- margin: 0 15px;
- }
- .list{
- display: flex;
- align-items: center;
- padding: 14px 15px;
- background: #fff;
- position: relative;
- }
- .wrapper{
- display: flex;
- flex-direction: column;
- flex: 1;
- }
- .address-box{
- display: flex;
- align-items: center;
- .tag{
- font-size: 24upx;
- color: $base-color;
- margin-right: 10upx;
- background: #fffafb;
- border: 1px solid #ffc107;
- border-radius: 4upx;
- padding: 4upx 10upx;
- line-height: 1;
- }
- .address{
- font-size: 30upx;
- color: $font-color-dark;
- }
- }
- .u-box{
- font-size: 28upx;
- color: $font-color-light;
- margin-top: 16upx;
- .name{
- margin-right: 30upx;
- }
- }
- .icon-edit{
- display: flex;
- align-items: center;
- height: 80upx;
- font-size: 40upx;
- color: $font-color-light;
- padding-left: 30upx;
- }
-
- .add-btn{
- position: fixed;
- display: flex;
- flex-direction: row;
- justify-content: center;
- align-items: center;
- border-radius: 10px;
- overflow: hidden;
- bottom: 15px;
- left: 15px;
- right: 15px;
- height: 45px;
- font-size: 16px;
- font-weight: bold;
- color: #333;
- background: linear-gradient(45deg, #ffd900, #ffc107);
- }
- </style>
|