Browse Source

手机端收货地址空状态修改

wangcz 7 years ago
parent
commit
c5c964527b

+ 12 - 7
components/mobile/base/addressEdit.vue

@@ -108,7 +108,8 @@
         isActive: false,
         addressShow: false,
         timeoutCount: 0,
-        collectResult: ''
+        collectResult: '',
+        noClose: false
       }
     },
     watch: {
@@ -122,6 +123,13 @@
         immediate: true
       }
     },
+    mounted () {
+      let data = this.baseUtils.deepCopy(this.$store.state.mobileAddress.address.data)
+      data && data.content.length > 0 ? this.noClose = false : this.noClose = true
+      this.$nextTick(() => {
+        this.refleshSc()
+      })
+    },
     methods: {
       editClick (data) {
         this.$emit('isEditEvent', data || {}, false)
@@ -142,7 +150,9 @@
       storeInfosave(_tp) {
         this.BScroll.refresh()
         if (_tp === 'cancel') {
-          this.editClick()
+          if (!this.noClose) {
+            this.editClick()
+          }
           return false
         }
         if (!this.params.name || this.params.name === '') {
@@ -188,11 +198,6 @@
     components: {
       RemindBox,
       SelectAddress
-    },
-    mounted() {
-      this.$nextTick(() => {
-        this.refleshSc()
-      })
     }
   }
 </script>

+ 4 - 6
components/mobile/base/addressView.vue

@@ -13,12 +13,7 @@
         </div>
       </div>
     </div>
-    <div class="com-none-state" v-if="addressList.length === 0">
-      <img src="/images/mobile/@2x/empty-collect.png">
-      <p>抱歉,您还没有添加地址信息</p>
-      <nuxt-link to="/">返回首页</nuxt-link>
-    </div>
-    <ul class="list-unstyled" v-else>
+    <ul class="list-unstyled">
       <li v-for="(item, index) in addressList">
         <div class="wrapper-line clearfix">
           <div class="name pull-left">{{isSend ? '发货地址:' : '收货地址:'}}</div>
@@ -94,6 +89,9 @@
           } else {
             this.addressList = [...this.addressList, ...val.content]
           }
+          if (this.addressList.length <= 0) {
+            this.editClick()
+          }
         },
         immediate: true
       }

+ 6 - 2
pages/mobile/user/address.vue

@@ -24,10 +24,14 @@
     },
     data () {
       return {
-        isEdit: false,
-        setData: {}
+        setData: {},
+        isEdit: false
       }
     },
+    mounted () {
+      let data = this.baseUtils.deepCopy(this.$store.state.mobileAddress.address.data)
+      data && data.content.length > 0 ? this.isEdit = false : this.isEdit = true
+    },
     computed: {
       isSend () {
         return false