Browse Source

新增移动端我的界面

shenjj 7 years ago
parent
commit
8dfd67d4d8
2 changed files with 126 additions and 46 deletions
  1. 6 4
      components/mobile/common/userHeader.vue
  2. 120 42
      pages/mobile/user/index.vue

+ 6 - 4
components/mobile/common/userHeader.vue

@@ -5,7 +5,7 @@
       <div class="user-info">
         <p v-text="userInfo.data.userName"></p>
         <p>
-          <span class="en-name">{{enterpriseInfo.enName}}</span>
+          <span class="en-name">{{enterpriseInfo2.enName}}</span>
         </p>
         <div class="switch" v-if="isShow">
           <a @click="setShowEnterpriseToggle(!showEnterpriseToggle, $event)">切换</a>
@@ -14,11 +14,11 @@
         <ul class="en-list" v-show="showEnterpriseToggle">
           <li class="menu-item"
               v-for="en in sortEnterprises"
-              v-if="en.uu != enterpriseInfo.uu"
+              v-if="en.uu != enterpriseInfo2.uu"
               v-bind:key="en.uu">
             <a @click="switchEnterprise(en)">{{ en.enName }}</a>
           </li>
-          <li class="menu-item"  v-if="enterpriseInfo.uu">
+          <li class="menu-item"  v-if="enterpriseInfo2.uu">
             <a @click="switchEnterprise({uu: 0})"><span v-text="userInfo.data.userName"></span>(个人账户)</a>
           </li>
         </ul>
@@ -90,10 +90,12 @@
     },
     computed: {
       userInfo () {
+        // console.log(this.$store.state.option.user)
         return this.$store.state.option.user
       },
-      enterpriseInfo () {
+      enterpriseInfo2 () {
         if (this.userInfo.data.enterprises) {
+          console.log(1)
           let ens = this.userInfo.data.enterprises.slice()
           if (ens && ens.length) {
             for (let i = 0; i < ens.length; i++) {

+ 120 - 42
pages/mobile/user/index.vue

@@ -13,7 +13,7 @@
             店铺信息
           </div>
           <div class="pull-right" @click="updateInfo()" v-show="storeState === 'look'">
-            <img src="/images/vendor/edit.png"/>
+            <img src="/images/vendor/updateinfo.png"/>
             编辑
           </div>
         </div>
@@ -31,7 +31,12 @@
             <div class="name pull-left" :class="{update: storeState !== 'look'}">简介:</div>
             <div class="text pull-left clearfix" v-if="storeState === 'look'">
               {{Islook ? dealWithText(storeInfo.description) : dealWithText()}}
-              <a class="pull-right" @click="dealWithText()" v-show="Islook">全部<img src="/images/store/default/openblack.png"/></a>
+              <a class="pull-right" @click="dealWithText2('open')" v-show="Islook">
+               全部<img src="/images/store/default/openblack.png"/>
+              </a>
+              <a class="pull-right upload" @click="dealWithText2('hide')" v-show="!hidelook">
+                收起<img src="/images/store/default/openblack.png"/>
+              </a>
             </div>
             <div class="text pull-left" v-else>
               <textarea v-model="storeInfo.description">
@@ -94,7 +99,10 @@
             </div>
           </li>
         </ul>
-        <div class="save" @click="storeInfosave()" v-if="storeState !== 'look'">保存</div>
+        <div class="control clearfix">
+          <div class="cancel" @click="storeInfosave('cancel')" v-if="storeState !== 'look'">取消</div>
+          <div class="save" @click="storeInfosave()" v-if="storeState !== 'look'">保存</div>
+        </div>
       </template>
       <template v-else>
         <div class="none-state">
@@ -113,13 +121,13 @@
           企业信息
         </div>
         <div class="pull-right" @click="updateInfo()" v-show="storeState === 'look' && enterpriseInfo.enName">
-          <img src="/images/vendor/edit.png"/>
+          <img src="/images/vendor/updateinfo.png"/>
           编辑
         </div>
       </div>
       <ul class="infoul infoul2">
         <li class="clearfix" :class="{noupdate:  storeState !== 'look'}">
-          <div class="name pull-left" :class="{update: storeState !== 'look'}">企业名称:</div>
+          <div class="name pull-left" :class="{update: storeState !== 'look'}" >企业名称:</div>
           <div class="text pull-left" :class="{update: storeState !== 'look'}">
             {{enterpriseInfo.enName || '-'}}
           </div>
@@ -160,13 +168,13 @@
           <div v-else class="text pull-left clearfix">
             <input v-model="enterpriseInfo.enIndustry" type="text" style="width: 4.5rem"/>
             <div class="moreIcon pull-right" @click="isShowTypeAlert = true">
-              <img src="/images/store/default/openblackR.png" @click="isShowTypeAlert = true"/>
+              <img src="/images/store/default/moreicon.png" @click="isShowTypeAlert = true"/>
             </div>
           </div>
         </li>
 
         <li class="clearfix" :class="{border:  storeState !== 'look'}">
-          <div class="name pull-left" :class="{update: storeState !== 'look'}">经营范围:</div>
+          <div class="name pull-left" :class="{update: storeState !== 'look'}" style="margin-top: 0.04rem;">经营范围:</div>
           <div class="text pull-left" v-if="storeState === 'look'" >
             <span v-for="item in scopeLabel" class="label">
               {{item}}
@@ -191,10 +199,10 @@
         </li>
       </ul>
       <template v-if="storeState === 'look'">
-        <div class="topinfo clearfix" style="color: #999;border-top: 1px solid #b4b4b4">
+        <div class="topinfo clearfix" style="color: #999;border-top: 1px solid #d9d9d9;background: #fafafa">
             个人信息
         </div>
-        <ul class="infoul infoul2" style="color: #999">
+        <ul class="infoul infoul2" style="color: #999;background: #fafafa">
           <li class="clearfix">
             <div class="name pull-left">用户名:</div>
             <div class="text pull-left">
@@ -215,10 +223,10 @@
           </li>
         </ul>
 
-        <div class="topinfo clearfix" style="color: #999;border-top: 1px solid #b4b4b4">
+        <div class="topinfo clearfix" style="color: #999;border-top: 1px solid #d9d9d9;background: #fafafa">
           管理员信息
         </div>
-        <ul class="infoul infoul2" style="color: #999">
+        <ul class="infoul infoul2" style="color: #999;background: #fafafa">
           <li class="clearfix">
             <div class="name pull-left">姓名:</div>
             <div class="text pull-left">
@@ -239,7 +247,10 @@
           </li>
         </ul>
       </template>
-      <div class="save" @click="storeInfosave()" v-if="storeState !== 'look'">保存</div>
+      <div class="control clearfix">
+        <div class="cancel" @click="storeInfosave('cancel')" v-if="storeState !== 'look'">取消</div>
+        <div class="save" @click="storeInfosave()" v-if="storeState !== 'look'">保存</div>
+      </div>
     </template>
     <!-- /end 账户管理 -->
 
@@ -278,6 +289,7 @@
     <!-- /end 选择行业弹窗 -->
     <remind-box :title="collectResult" :timeoutCount="timeoutCount"></remind-box>
     <!--<loading v-show="isSearchSearchingMore"></loading>-->
+    <div v-if="enterprise && false"></div>
   </div>
 </template>
 
@@ -317,7 +329,9 @@
           secondsListShow: false,
           threetListShow: false
         },
-        TypeObj: {}
+        TypeObj: {},
+        enterpriseInfo: {},
+        hidelook: true
       }
     },
     components: {
@@ -346,14 +360,14 @@
         return '您的账户暂未开通卖家中心,请前往pc端申请开通!'
       },
       storeInfo() {
-        console.log(this.$store.state.option.storeStatus.data)
         let str = JSON.stringify(this.$store.state.option.storeStatus.data)
         return JSON.parse(str)
       },
-      enterpriseInfo() {
+      enterprise() {
         // return this.$store.state.supplier.material.enUser.data
         let str = JSON.stringify(this.$store.state.supplier.material.enUser.data)
-        return JSON.parse(str)
+        this.enterpriseInfo = JSON.parse(str)
+        return ''
       },
       userInfo() {
         return this.$store.state.option.user.data
@@ -445,6 +459,7 @@
       addBtn(text) {
         if (text !== undefined) {
           this.labelText = text
+          this.IsChange = text
         }
         this.AddBtnShow = false
       },
@@ -453,12 +468,23 @@
         if (this.labelText === '') {
           return false
         }
-        if (this.enterpriseInfo.enBusinessScope.trim() === '') {
-          this.enterpriseInfo.enBusinessScope += this.labelText
+        if (this.IsChange !== '') {
+          let ms = this.enterpriseInfo.enBusinessScope.split(',')
+          for (let j = 0; j < ms.length; j++) {
+            if (ms[j].trim() === this.IsChange) {
+              ms[j] = this.labelText
+            }
+          }
+          this.enterpriseInfo.enBusinessScope = ms.join(',')
         } else {
-          this.enterpriseInfo.enBusinessScope += ',' + this.labelText
+          if (this.enterpriseInfo.enBusinessScope.trim() === '') {
+            this.enterpriseInfo.enBusinessScope += this.labelText
+          } else {
+            this.enterpriseInfo.enBusinessScope += ',' + this.labelText
+          }
         }
         this.labelText = ''
+        this.IsChange = ''
         this.scopeLabel = this.enterpriseInfo.enBusinessScope.split(',')
         // this.enterpriseInfo.enBusinessScope.push(this.labelText)
       },
@@ -469,6 +495,8 @@
         this.updateEnterpriseInfo()
       },
       updateEnterpriseInfo() {
+        this.hidelook = true
+        this.Islook = true
         this.admininfo = {}
         this.$store.dispatch('supplier/loadEnUser', {enUU: this.storeInfo.enUU, filter: 'enUU'}).then(() => {
           this.scopeLabel = this.enterpriseInfo.enBusinessScope ? this.enterpriseInfo.enBusinessScope.split(',') : []
@@ -481,13 +509,24 @@
       updateInfo() {
         this.storeState = 'update'
       },
+      dealWithText2(tp) {
+        if (tp === 'open') {
+          this.Islook = false
+          this.hidelook = false
+        } else {
+          this.Islook = true
+          this.hidelook = true
+        }
+      },
       dealWithText(_T) {
         if (_T) {
           // 文本处理
           this.normalText = _T
-          if (_T.length > 140) {
+          if (_T.length < 140) {
+            this.Islook = false
             return _T
           } else {
+            this.Islook = true
             return _T.substr(0, 140) + '...'
           }
         } else {
@@ -511,7 +550,11 @@
           this.$store.dispatch('mobile/SetInputGetFocus', true)
         }, 300)
       },
-      storeInfosave() {
+      storeInfosave(_tp) {
+        if (_tp === 'cancel') {
+          this.storeState = 'look'
+          return
+        }
         if (this.activeType === 'store') {
           let kay = {
             description: this.storeInfo.description,
@@ -520,15 +563,20 @@
             storeShortName: this.storeInfo.storeShortName
           }
           this.$http.put(`/store-service/stores/${this.storeInfo.uuid}?kind=BASIC_INFO`, kay).then(res => {
-            this.collectResult = '删除成功'
+            this.collectResult = '保存成功'
             this.timeoutCount++
             this.storeState = 'look'
           })
         } else {
-          this.$http.post(`/basic/enterprise/${this.storeInfo.enUU}/info`, this.enterpriseInfo).then(res => {
-            this.collectResult = '删除成功'
+          this.$http.post(`/basic/enterprise/${this.storeInfo.enUU}/updateInfo`, this.enterpriseInfo).then(res => {
+            this.collectResult = '保存成功'
             this.timeoutCount++
             this.storeState = 'look'
+          }).catch(err => {
+            this.collectResult = err.response.data
+            this.timeoutCount++
+            let str = JSON.stringify(this.$store.state.supplier.material.enUser.data)
+            this.enterpriseInfo = JSON.parse(str)
           })
         }
       }
@@ -576,7 +624,7 @@
       height: 0.8rem;
       line-height: 0.8rem;
       padding: 0 0.24rem;
-      border-bottom: 1px solid #b4b4b4;
+      border-bottom: 0.01rem solid #d9d9d9;
       .pull-right {
         color: #999;
         font-size: 0.26rem;
@@ -587,16 +635,22 @@
       }
     }
     .infoul {
+      .upload {
+        img {
+          transform: rotate(180deg);
+        }
+      }
       color: #666;
       font-size: 0.28rem;
       li {
-        padding: 0.15rem 0.24rem;
+        padding: 0.15rem 0.05rem;
         line-height: 1.3;
         &.border {
-          border-bottom: 1px solid #b4b4b4;
+          border-bottom: 0.01rem solid #d9d9d9;
         }
         &.noupdate {
           background: #fafafa;
+          color: #999;
         }
       }
       .name {
@@ -622,15 +676,31 @@
         border: 0px solid #b4b4b4;
       }
     }
+    .control {
+      width: 90%;
+      margin: 0.15rem auto 0.4rem;
+      height: .88rem;
+      line-height: 0.88rem;
+    }
     .save {
       border-radius: 3px;
-      width: 90%;
+      width: 48%;
       color: #fff;
       text-align: center;
-      height: .77rem;
-      line-height: 0.77rem;
+      height: .88rem;
+      line-height: 0.88rem;
       background: #3e82f5;
-      margin: 0.15rem auto 0.4rem;
+      float: right;
+    }
+    .cancel {
+      border-radius: 3px;
+      width: 48%;
+      background: #acabab;
+      color: #fff;
+      text-align: center;
+      height: .88rem;
+      line-height: 0.88rem;
+      float: left;
     }
     .infoul2 {
       .name {
@@ -645,23 +715,25 @@
       .nolabel {
         position: relative;
         width: auto;
-        padding: 0 3px;
-        margin: 0 3px;
-        background: #f2f3f7;
-        border-radius: 5px;
         text-align: center;
         color: #666;
-        font-size: 0.12rem;
+        font-size: 0.24rem;
+        display: inline-block;
+        vertical-align: top;
+        padding: 2px 4px;
+        margin: 0.02rem 3px 0px;
+        background: #f2f3f7;
+        border-radius: 5px;
       }
       .label {
         width: auto;
         padding: 2px 4px;
-        margin: 0.06rem 3px 0 3px;
+        margin: 0.08rem 3px 0 3px;
         background: #5078cb;
         border-radius: 5px;
         text-align: center;
         color: #fff;
-        font-size: 0.2rem;
+        font-size: 0.24rem;
         display: inline-block;
         vertical-align: top;
       }
@@ -675,6 +747,7 @@
         display: inline-block;
         vertical-align: top;
         margin: 0px 3px 3px 3px;
+        font-size: 0px;
       }
       .Updatelabel {
         padding: 0 4px;
@@ -682,6 +755,7 @@
         font-size: 0.26rem;
         height: 100%;
         display: inline-block;
+        vertical-align: top;
       }
       .updatespan {
         background: #353535;
@@ -690,6 +764,7 @@
         padding:0 2px;
         height: 100%;
         display: inline-block;
+        vertical-align: top;
       }
       .addBtn {
         background-image: url('/images/mobile/@2x/addBtn.png');
@@ -697,6 +772,7 @@
         width: 1.4rem;
         height: 0.54rem;
         display: inline-block;
+        vertical-align: middle;
       }
       .commit {
 
@@ -728,10 +804,12 @@
         margin-left: -0.1rem;
       }
       .moreIcon {
-        width: 0.18rem;
-        height: 0.3rem;
         margin-top: 0.06rem;
         position: relative;
+        img {
+          width: 0.17rem;
+          height: 0.3rem;
+        }
         &:after {
           position: absolute;
           left: -10px;
@@ -772,7 +850,7 @@
         font-size: 0.28rem;
         height: 0.5rem;
         line-height: 0.5rem;
-        border-bottom: 1px solid #999;
+        border-bottom: 0.01rem solid #999;
         div {
           width: 33.3%;
           float: left;
@@ -781,7 +859,7 @@
             height: 0.5rem;
             line-height: 0.5rem;
             color: #3f84f6 !important;
-            border-bottom: 1px solid #3f84f6;
+            border-bottom: 0.01rem solid #3f84f6;
             display: inline-block;
             width: 80%;
             overflow: hidden;