Blame view
src/pages/address/addressList.vue
4.36 KB
7d6833f2c 地址列表 |
1 2 3 4 5 6 7 8 9 |
<template> <view class="content"> <view v-if="addressList.length !== 0" class="list" > <view v-for="(item, index) in addressList" :key="index" |
7d6833f2c 地址列表 |
10 |
class="order-user" |
323398550 若干功能添加 |
11 |
@tap="toOrder(item.add_id)" |
7d6833f2c 地址列表 |
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
> <view class="order-user-head"> <view class="name"> <view v-if="item.default === '1'" class="default" ><text>默认</text></view>{{item.name}} </view> <text class="mobile">{{item.mobile}}</text> </view> <view class="order-user-body"> <image src="../../static/myorder-paying-location.png"></image> <text class="address">{{item.address.replace(/[-]/g,' ')}} {{item.add_detail}}</text> </view> <image |
323398550 若干功能添加 |
28 |
@tap="toEditAddress(item.add_id)" |
7d6833f2c 地址列表 |
29 30 31 32 33 |
v-if="item.default === '1'" class="arrow" src="../../static/right.png" ></image> <image |
323398550 若干功能添加 |
34 |
@tap="toEditAddress(item.add_id)" |
7d6833f2c 地址列表 |
35 36 37 38 39 40 41 42 43 44 45 46 |
v-else class="arrow pen" src="../../static/icon-pen.png" ></image> </view> </view> <view v-else class="empty" > 暂无收货地址 </view> |
4e9d88ff7 新建地址修改 |
47 |
<button @tap="toAddAddress" class="add">新建收货地址</button> |
7d6833f2c 地址列表 |
48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
</view> </template> <script> import store from '@/store' export default { data () { return {} }, computed: { addressList () { return this.$store.state.address.list } }, |
323398550 若干功能添加 |
62 63 64 65 |
onLoad ({ edit }) { if (edit) { this.edit = true } |
7d6833f2c 地址列表 |
66 67 68 |
store.dispatch('address/list') }, methods: { |
4e9d88ff7 新建地址修改 |
69 70 71 72 73 74 75 76 77 |
toAddAddress() { console.log('aaaaa-a') uni.navigateTo({ url: 'addAddress', fail: (error) => { console.error('跳转出现错误', error) } }) }, |
7d6833f2c 地址列表 |
78 79 80 81 82 83 84 85 |
toEditAddress (addId) { console.log('addId', addId) uni.navigateTo({ url: `addAddress?addId=${addId}`, fail: (error) => { console.error('跳转出现错误', error) } }) |
323398550 若干功能添加 |
86 87 88 89 90 91 92 93 94 95 |
}, toOrder (addId) { if (this.edit) { uni.navigateTo({ url: `../confirmOrder/confirmOrder?addressId=${addId}`, fail: (error) => { console.error('跳转出现错误', error) } }) } |
7d6833f2c 地址列表 |
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 |
} } } </script> <style lang="scss"> .content { min-height: 100vh; background-color: #f2f2f2; padding-top: 20rpx; padding-bottom: 112rpx; .order-user { width: 670rpx; height: 228rpx; background: #ffffff; border-radius: 14rpx; margin: 0 auto; margin-bottom: 20rpx; position: relative; .order-user-head { display: flex; height: 108rpx; width: 100%; align-items: center; margin-left: 126rpx; .name { display: flex; justify-content: space-between; font-size: 14px; color: #333333; letter-spacing: -0.26px; margin-right: 20rpx; .default { height: 40rpx; width: 80rpx; background-color: #4a90e2; border-radius: 13px; border-radius: 13px; text-align: center; margin-right: 20rpx; text { font-size: 12px; color: #ffffff; letter-spacing: -0.23px; } } } .mobile { font-size: 14px; color: #999999; letter-spacing: -0.26px; } } .order-user-body { display: flex; width: 100%; image { width: 24px; height: 26px; margin: 12rpx 32rpx 0 40rpx; } .address { font-weight: bold; font-size: 14px; color: #333333; letter-spacing: -0.26px; } } .arrow { width: 6px; height: 12px; position: absolute; right: 40rpx; bottom: 104rpx; } } .empty { color: #666; font-size: 16px; text-align: center; padding-top: 30vh; } .add { position: fixed; bottom: 0; left: 0; height: 112rpx; width: 100%; background-color: #ff6b4a; display: flex; justify-content: center; align-items: center; font-size: 16px; color: #ffffff; letter-spacing: -0.3px; } } </style> |