洪海涛 8 роки тому
батько
коміт
5320f8a08a

+ 2 - 1
www/vue/src/components/address/addresList.vue

@@ -64,7 +64,8 @@
         config.addressContent = config.orderAddress = this.shopAddress[index]
         axios.get('o2o/order/checkAddress&address_id=' + this.shopAddress[index].address_id + '&user_id=' + config.userId).then(res => {
           if (res.data.success) {
-            this.$router.push({path: '/placeOrder'})
+//            this.$router.push({path: '/placeOrder'})
+            this.$router.go(-1)
             config.station = res.data.data.station
 //            this.alertTitle = '恭喜'
 //            this.alertContent = '当前地址在范围范围内!'

+ 1 - 1
www/vue/src/components/address/addressAdd.vue

@@ -63,7 +63,7 @@
     watch: {
       results: function (val, oldVal) {
         if (val) {
-//          this.$router.push({path: '/addressList'})
+          this.$router.push({path: '/addressList'})
         }
       }
     },

+ 42 - 19
www/vue/src/components/address/addressDetail.vue

@@ -20,8 +20,11 @@
         <x-input title="详细地址" v-model='userAddress' @on-blur="addressBlur" placeholder="填写详细地址如15号楼1单元201室"></x-input>
       </group>
     </scroller>
-    <!--确认地址-->
-    <div @click="right" class="btnAddress">更新地址</div>
+    <!--点击区域-->
+    <div class="btn-address">
+      <div @click="right" class="btnAddress">更新地址</div>
+      <div @click="deleteAddress" class="btnAddress">删除地址</div>
+    </div>
     <!--展示报错信息-->
     <alert v-model="showAlert" :title="(alertTitle)"> {{ (alertContent) }}</alert>
   </div>
@@ -50,7 +53,8 @@
       TransferDom
     },
     components: {XInput, Group, Cell, Alert},
-    beforeCreate () {},
+    beforeCreate () {
+    },
     computed: {},
     watch: {
       results: function (val, oldVal) {
@@ -77,6 +81,19 @@
       addressBlur (evl) {
         config.addressAdd.userAddress = evl
       },
+      // 删除地址
+      deleteAddress () {
+        axios.get('api/shop/delAddress&address_id=' + config.editAddress.address_id + '&user_id=' + config.userId).then(res => {
+          if (res.data.success) {
+            this.$router.push({path: '/addressList'})
+          } else {
+            this.alertContent = '地址删除失败'
+            this.showAlert = true
+            return
+          }
+        })
+      },
+      // 编辑地址
       right () {
         // 姓名不为空
         if (!this.userName) {
@@ -151,24 +168,30 @@
     margin-top: 15px;
   }
 
-  .btnAddress {
-    webkit-touch-callout: none;
-    -webkit-user-select: none;
-    -khtml-user-select: none;
-    -moz-user-select: none;
-    -ms-user-select: none;
-    user-select: none;
-    width: 100%;
-    padding: 3% 0;
-    color: #fff;
-    font-size: 20px;
-    margin: 0 auto;
+  .btn-address {
+    display: flex;
     position: absolute;
     bottom: 0;
-    background-color: #997e03;
-    &:active {
-      background-color: #bd9f03;
-      color: #bababa;
+    left: 0;
+    right: 0;
+    .btnAddress {
+      margin: 5px;
+      webkit-touch-callout: none;
+      -webkit-user-select: none;
+      -khtml-user-select: none;
+      -moz-user-select: none;
+      -ms-user-select: none;
+      user-select: none;
+      width: 50%;
+      padding: 3% 0;
+      color: #fff;
+      font-size: 20px;
+      background-color: #997e03;
+      &:active {
+        background-color: #bd9f03;
+        color: #bababa;
+      }
     }
   }
+
 </style>