Authored by 张文文

地址选中

1 <template> 1 <template>
2 <LayoutApp title="选择地址" :show-back="true"> 2 <LayoutApp title="选择地址" :show-back="true">
3 - <AddressItem :list="addressList" :pageName="pageName"></AddressItem> 3 + <AddressItem :list="addressList" :pageName="pageName" :selectedAddressId="selectedAddressId"></AddressItem>
4 </LayoutApp> 4 </LayoutApp>
5 </template> 5 </template>
6 6
@@ -21,7 +21,8 @@ export default { @@ -21,7 +21,8 @@ export default {
21 }, 21 },
22 data() { 22 data() {
23 return { 23 return {
24 - pageName: "" 24 + pageName: "",
  25 + selectedAddressId: ""
25 }; 26 };
26 }, 27 },
27 computed: { 28 computed: {
@@ -39,6 +40,9 @@ export default { @@ -39,6 +40,9 @@ export default {
39 // 通过 `vm` 访问组件实例 40 // 通过 `vm` 访问组件实例
40 vm.pageName = from.name; 41 vm.pageName = from.name;
41 }); 42 });
  43 + },
  44 + mounted() {
  45 + this.selectedAddressId = this.$route.query.address_id;
42 } 46 }
43 }; 47 };
44 </script> 48 </script>
@@ -4,6 +4,9 @@ @@ -4,6 +4,9 @@
4 <div v-for="(item, index) in list" :key="index" class="item" @click="toOrderPage(item)"> 4 <div v-for="(item, index) in list" :key="index" class="item" @click="toOrderPage(item)">
5 <slot name="item" :data="item"> 5 <slot name="item" :data="item">
6 <div class="user-item"> 6 <div class="user-item">
  7 + <div
  8 + :class="{'uncheck-item' : item.address_id !== selectedAddressId , 'check-item' : item.address_id === selectedAddressId }"
  9 + ></div>
7 <div class="user-info"> 10 <div class="user-info">
8 <div class="extra"> 11 <div class="extra">
9 <p class="name">{{item.consignee}}</p> 12 <p class="name">{{item.consignee}}</p>
@@ -18,10 +21,10 @@ @@ -18,10 +21,10 @@
18 >编辑</div> 21 >编辑</div>
19 </div> 22 </div>
20 <p class="address">{{item.area}}{{item.address}}</p> 23 <p class="address">{{item.area}}{{item.address}}</p>
21 - <div class="border-line"></div>  
22 </div> 24 </div>
23 </div> 25 </div>
24 </slot> 26 </slot>
  27 + <div class="border-line"></div>
25 </div> 28 </div>
26 </div> 29 </div>
27 <div class="add-btn" :data-add="1" @click="toEditorPage">新增地址</div> 30 <div class="add-btn" :data-add="1" @click="toEditorPage">新增地址</div>
@@ -49,6 +52,10 @@ export default { @@ -49,6 +52,10 @@ export default {
49 pageName: { 52 pageName: {
50 type: String, 53 type: String,
51 default: "" 54 default: ""
  55 + },
  56 + selectedAddressId: {
  57 + type: String,
  58 + default: ""
52 } 59 }
53 }, 60 },
54 data() { 61 data() {
@@ -118,22 +125,37 @@ export default { @@ -118,22 +125,37 @@ export default {
118 background-color: white; 125 background-color: white;
119 126
120 .border-line { 127 .border-line {
  128 + width: 100%;
121 height: 1px; 129 height: 1px;
122 - margin-top: 40px;  
123 - background-color: #e0e0e0; 130 + background-color: #eee;
124 } 131 }
125 } 132 }
126 133
127 .user-item { 134 .user-item {
128 display: flex; 135 display: flex;
129 padding-top: 40px; 136 padding-top: 40px;
130 - padding-left: 40px; 137 + padding-bottom: 44px;
  138 + padding-left: 28px;
131 padding-right: 40px; 139 padding-right: 40px;
132 align-items: center; 140 align-items: center;
133 141
  142 + .check-item {
  143 + width: 40px;
  144 + height: 40px;
  145 + background: url(~statics/image/address/selected.png) no-repeat;
  146 + background-size: cover;
  147 + }
  148 + .uncheck-item {
  149 + width: 40px;
  150 + height: 40px;
  151 + background: url(~statics/image/address/unselected.png) no-repeat;
  152 + background-size: cover;
  153 + }
  154 +
134 .user-info { 155 .user-info {
135 flex-grow: 1; 156 flex-grow: 1;
136 overflow: hidden; 157 overflow: hidden;
  158 + margin-left: 32px;
137 } 159 }
138 160
139 .extra { 161 .extra {