Browse Source

Merge remote-tracking branch 'origin/feature-201823-wangcz' into feature-201823-wangcz

yangc 7 years ago
parent
commit
8a36494b91

+ 13 - 4
components/mobile/applyPurchase/SayPrice.vue

@@ -11,11 +11,11 @@
             <div class="content-line">
             <div class="content-line">
               物料名称:<span>{{purchaseDetail.prodTitle || '-'}}</span>
               物料名称:<span>{{purchaseDetail.prodTitle || '-'}}</span>
             </div>
             </div>
-            <div class="content-line">
-              型号:<span>{{purchaseDetail.cmpCode || '-'}}</span>
+            <div class="content-line clearfix">
+             <div class="pull-left"> 型号:</div><span class="pull-left">{{purchaseDetail.cmpCode || '-'}}</span>
             </div>
             </div>
-            <div class="content-line">
-              规格:<span>{{purchaseDetail.spec || '-'}}</span>
+            <div class="content-line clearfix">
+              <div class="pull-left"> 规格:</div><span class="pull-left">{{purchaseDetail.spec || '-'}}</span>
             </div>
             </div>
             <div class="content-line">
             <div class="content-line">
               采购数量(PCS):<span>{{purchaseDetail.needquantity || '-'}}</span>
               采购数量(PCS):<span>{{purchaseDetail.needquantity || '-'}}</span>
@@ -355,6 +355,15 @@
 <style lang="scss" scoped>
 <style lang="scss" scoped>
   .mobile-modal {
   .mobile-modal {
     z-index: 1;
     z-index: 1;
+    .base-info .content-line{
+      height: auto;
+      white-space: inherit;
+    }
+    .base-info .content-line span {
+      width: 5.5rem;
+      word-wrap:break-word;
+      word-break:break-all;
+    }
     .mobile-modal-box {
     .mobile-modal-box {
       top: 1.66rem;
       top: 1.66rem;
       left: 3%;
       left: 3%;

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

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

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

@@ -13,12 +13,7 @@
         </div>
         </div>
       </div>
       </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">
       <li v-for="(item, index) in addressList">
         <div class="wrapper-line clearfix">
         <div class="wrapper-line clearfix">
           <div class="name pull-left">{{isSend ? '发货地址:' : '收货地址:'}}</div>
           <div class="name pull-left">{{isSend ? '发货地址:' : '收货地址:'}}</div>
@@ -94,6 +89,9 @@
           } else {
           } else {
             this.addressList = [...this.addressList, ...val.content]
             this.addressList = [...this.addressList, ...val.content]
           }
           }
+          if (this.addressList.length <= 0) {
+            this.editClick()
+          }
         },
         },
         immediate: true
         immediate: true
       }
       }

+ 25 - 0
components/mobile/center/addinvoice.vue

@@ -10,6 +10,14 @@
       </div>
       </div>
     </div>
     </div>
     <div class="addinvoice-content-wrapper" ref="ScrollContent">
     <div class="addinvoice-content-wrapper" ref="ScrollContent">
+      <!--<div class="order-nav">-->
+        <!--<div :class="{'active': invoiceType === 'speci', 'noclick2': isSaveinvoiceType === 1205}" @click="isSaveinvoiceType === 0 ? changeType('speci') : (isSaveinvoiceType === 1205 ?  setRemindText('已有增值税专票信息') : '')">-->
+          <!--<span>增值税专票</span>-->
+        <!--</div>-->
+        <!--<div :class="{'active' : invoiceType === 'normal', 'noclick2': isSaveinvoiceType === 1206}" @click="isSaveinvoiceType === 0 ? changeType('normal') :  (isSaveinvoiceType === 1206 ?  setRemindText('已有增值税普票信息') : '')">-->
+          <!--<span>增值税普票</span>-->
+        <!--</div>-->
+      <!--</div>-->
       <div>
       <div>
         <div class="addinvoice-title" v-if="joinType !== 'add'">{{chooseItem.kind === 1206 ? '增值税普票' : '增值税专票'}}</div>
         <div class="addinvoice-title" v-if="joinType !== 'add'">{{chooseItem.kind === 1206 ? '增值税普票' : '增值税专票'}}</div>
         <div class="addinvoice-ul" :style="joinType === 'add' ? 'margin-top: 0.2rem' : ''">
         <div class="addinvoice-ul" :style="joinType === 'add' ? 'margin-top: 0.2rem' : ''">
@@ -283,6 +291,23 @@
     left: 0;
     left: 0;
     bottom: 0;
     bottom: 0;
     right: 0;
     right: 0;
+    .order-nav {
+      background: #fff;
+      div {
+        height: 0.82rem;
+        line-height: 0.82rem;
+        display: inline-block;
+        width: 25%;
+        text-align: center;
+        font-size: .28rem;
+        color: #666;
+        &.active span{
+          color: #3f84f6;
+          border-bottom: 0.04rem solid #3f84f6;
+          padding-bottom: 0.2rem;
+        }
+      }
+    }
     .mobile-header{
     .mobile-header{
       position: fixed;
       position: fixed;
       top: 0;
       top: 0;

+ 7 - 0
pages/mobile/center/user/invoice/index.vue

@@ -262,6 +262,13 @@
       RemindBox,
       RemindBox,
       addinvoice,
       addinvoice,
       MobileFooter
       MobileFooter
+    },
+    mounted() {
+      this.$nextTick(() => {
+        if (this.invoiceList.length === 0) {
+          this.addInvoiceNew()
+        }
+      })
     }
     }
   }
   }
 </script>
 </script>

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

@@ -24,10 +24,14 @@
     },
     },
     data () {
     data () {
       return {
       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: {
     computed: {
       isSend () {
       isSend () {
         return false
         return false

+ 133 - 11
pages/mobile/wechat/index.vue

@@ -21,9 +21,22 @@
             请输入正确的手机号码
             请输入正确的手机号码
           </div>
           </div>
         </li>
         </li>
-        <li class="password">
+        <li class="password" v-if="!bindShow">
           <input placeholder="请输入密码" type="password" v-model="passwordNum"/>
           <input placeholder="请输入密码" type="password" v-model="passwordNum"/>
         </li>
         </li>
+        <li v-if="bindShow" class="code clearfix">
+          <input placeholder="请输入验证码" type="tel" v-model="codeNum" style="margin-left: 0;"/>
+          <span class="pull-right codeBtn" @click="getCode()">
+            {{showExtraTime ? getExtraTime + 'S' : '获取验证码'}}
+          </span>
+        </li>
+        <li class="wechat-view-info clearfix" v-if="bindShow">
+          <div v-show="codeerror" class="pull-left">
+            验证码错误
+          </div>
+          <div class="pull-right" @click="bindShow = false">用户名密码登录</div>
+        </li>
+        <li class="toInfoBind" @click="toInfoBind()" v-if="!bindShow">通过短信绑定</li>
       </ul>
       </ul>
       <div class="loginBtn" @click="login">确定绑定已有账号登录</div>
       <div class="loginBtn" @click="login">确定绑定已有账号登录</div>
       <div class="register">还没有优软账号,直接<span @click="resgiter">创建新账号</span></div>
       <div class="register">还没有优软账号,直接<span @click="resgiter">创建新账号</span></div>
@@ -37,7 +50,7 @@
       </nuxt-link>
       </nuxt-link>
     </div>
     </div>
     <remind-box :title="collectResult" :timeoutCount="timeoutCount"></remind-box>
     <remind-box :title="collectResult" :timeoutCount="timeoutCount"></remind-box>
-    <div class="listAlert" ref="userContent" v-show="wechatInfo.enterprises">
+    <div class="listAlert" ref="userContent" v-show="wechatInfo.enterprises && enuu === ''">
       <ul>
       <ul>
         <li v-for="(item, index) in wechatInfo.enterprises" @click="clickItem(item)">
         <li v-for="(item, index) in wechatInfo.enterprises" @click="clickItem(item)">
           {{item.enName}}
           {{item.enName}}
@@ -63,7 +76,13 @@
          timeoutCount: 0,
          timeoutCount: 0,
          telerror: false,
          telerror: false,
          telphoneNum: '',
          telphoneNum: '',
-         passwordNum: ''
+         passwordNum: '',
+         codeNum: '',
+         bindShow: false, // 选择手机验证码绑定
+         codeerror: false, // 显示验证码错误
+         showExtraTime: false, // 倒计时
+         getExtraTime: 60,
+         enuu: ''
        }
        }
     },
     },
     mounted() {
     mounted() {
@@ -71,18 +90,29 @@
       if (this.$route.query.url) {
       if (this.$route.query.url) {
         localStorage.setItem('RETURNURL', this.$route.query.url || '')
         localStorage.setItem('RETURNURL', this.$route.query.url || '')
       }
       }
+      if (this.$route.query.enuu) {
+        this.enuu = this.$route.query.enuu
+      }
       let ua = this.$store.state.option.userAgent.toLowerCase()
       let ua = this.$store.state.option.userAgent.toLowerCase()
       if (ua.match(/micromessenger/i) && ua.match(/micromessenger/i)[0] === 'micromessenger' && !this.$route.query.code && !info) {
       if (ua.match(/micromessenger/i) && ua.match(/micromessenger/i)[0] === 'micromessenger' && !this.$route.query.code && !info) {
         window.location.href = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxb3274b676737a319&redirect_uri=https://www.usoftmall.com/mobile/wechat&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect`
         window.location.href = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxb3274b676737a319&redirect_uri=https://www.usoftmall.com/mobile/wechat&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect`
       } else if (info) {
       } else if (info) {
+        // 绑定过的用户一定存在openid
         info = JSON.parse(info)
         info = JSON.parse(info)
         if (info.openid) {
         if (info.openid) {
-          this.$store.dispatch('GerWechatInfo', {code: '', openId: info.openid})
+          this.$store.dispatch('GerWechatInfo', {code: '', openId: info.openid}).then(res => {
+            // 存在enuu
+            if (this.enuu) {
+              this.loginFromEnuu()
+            }
+          })
         } else {
         } else {
           localStorage.removeItem('USOFTMALLWECHATINFO')
           localStorage.removeItem('USOFTMALLWECHATINFO')
           window.location.href = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxb3274b676737a319&redirect_uri=https://www.usoftmall.com/mobile/wechat&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect`
           window.location.href = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=wxb3274b676737a319&redirect_uri=https://www.usoftmall.com/mobile/wechat&response_type=code&scope=snsapi_userinfo&state=STATE#wechat_redirect`
         }
         }
       } else {
       } else {
+        // 用户第一次进入公众号
+        // this.$store.dispatch('GerWechatInfo', {code: '', openId: 'o2o8JwgMp9I8Es7yneC88JD7H2ts'}) // 测试用的数据
         this.$store.dispatch('GerWechatInfo', {code: this.$route.query.code})
         this.$store.dispatch('GerWechatInfo', {code: this.$route.query.code})
       }
       }
       this.$nextTick(() => {
       this.$nextTick(() => {
@@ -96,6 +126,17 @@
       })
       })
     },
     },
     methods: {
     methods: {
+      // 路由带有enuu
+      loginFromEnuu() {
+        let _item = {}
+        this.wechatInfo.enterprises.forEach((item) => {
+          if (item.uu === parseInt(this.enuu)) {
+            _item = item
+          }
+        })
+        this.clickItem(_item)
+      },
+      // 选择账套登录
       clickItem(item) {
       clickItem(item) {
         let userAccount = this.baseUtils.deepCopy(this.$store.state.option.wechatInfo.data.userAccount)
         let userAccount = this.baseUtils.deepCopy(this.$store.state.option.wechatInfo.data.userAccount)
         userAccount.spaceUU = item.uu
         userAccount.spaceUU = item.uu
@@ -117,29 +158,52 @@
           })
           })
         })
         })
       },
       },
+      // 手机号码失去焦点
       telphoneBlur() {
       telphoneBlur() {
+        if (this.telphoneNum === '') { return }
         this.telerror = false
         this.telerror = false
         if (!/^1[3|5|7|8]\d{9}$/.test(this.telphoneNum)) {
         if (!/^1[3|5|7|8]\d{9}$/.test(this.telphoneNum)) {
           this.telerror = true
           this.telerror = true
         }
         }
       },
       },
+      // 绑定操作
       login() {
       login() {
+        let openid = this.$store.state.option.wechatInfo.data.openid
         if (this.telerror === true) {
         if (this.telerror === true) {
           return false
           return false
         }
         }
-        if (!this.passwordNum || this.passwordNum === '') {
-          this.collectResult = '码不能为空'
+        if (!this.telphoneNum || this.telphoneNum === '') {
+          this.collectResult = '手机号码不能为空'
           this.timeoutCount++
           this.timeoutCount++
           return false
           return false
         }
         }
-        let openid = this.$store.state.option.wechatInfo.data.openid
-        this.$http.post('/wx/bindUser', {userTel: this.telphoneNum, userPwd: this.passwordNum, openId: openid}).then(res => {
+        // 'o2o8JwgMp9I8Es7yneC88JD7H2ts'
+        let _item = {
+          userTel: this.telphoneNum,
+          openId: openid
+        }
+        if (this.bindShow === true) {
+          if (!this.codeNum || this.codeNum === '') {
+            this.collectResult = '验证码不能为空'
+            this.timeoutCount++
+            return false
+          }
+          _item.code = this.codeNum
+        } else {
+          if (!this.passwordNum || this.passwordNum === '') {
+            this.collectResult = '密码不能为空'
+            this.timeoutCount++
+            return false
+          }
+          _item.userPwd = this.passwordNum
+        }
+        this.$http.post('/wx/bindUser', _item).then(res => {
           if (res.data.success) {
           if (res.data.success) {
             this.$store.commit('option/REQUEST_WECHATINFO_STATUS_SUCCESS', res.data)
             this.$store.commit('option/REQUEST_WECHATINFO_STATUS_SUCCESS', res.data)
             localStorage.setItem('USOFTMALLWECHATINFO', JSON.stringify(res.data))
             localStorage.setItem('USOFTMALLWECHATINFO', JSON.stringify(res.data))
           } else {
           } else {
             localStorage.removeItem('USOFTMALLWECHATINFO')
             localStorage.removeItem('USOFTMALLWECHATINFO')
-            this.collectResult = res.data.message
+            this.collectResult = res.data.message || res.data.errMsg
             this.timeoutCount++
             this.timeoutCount++
           }
           }
         }, err => {
         }, err => {
@@ -154,6 +218,44 @@
             window.location.href = response.data.content
             window.location.href = response.data.content
           }
           }
         })
         })
+      },
+      // 选择短信绑定操作
+      toInfoBind() {
+        this.bindShow = true
+      },
+      getCode() {
+        if (this.telerror) {
+          return false
+        }
+        if (!this.telphoneNum || this.telphoneNum === '') {
+          this.collectResult = '手机号码不能为空'
+          this.timeoutCount++
+          return false
+        }
+        if (this.showExtraTime) {
+          this.collectResult = '获取验证码已发送,请查收'
+          this.timeoutCount++
+          return
+        }
+        // todo 这里走请求验证码接口
+        this.$http.get(`/wx/sendSmsCode?mobile=${this.telphoneNum}`).then((data) => {
+          if (data.data.success) {
+            this.showExtraTime = true
+            this.$timer = setInterval(() => {
+              this.getExtraTime--
+              if (this.getExtraTime === 0) {
+                this.showExtraTime = false
+                clearInterval(this.$timer)
+              }
+            }, 1000)
+          } else {
+            this.collectResult = data.data.errMsg
+            this.timeoutCount++
+          }
+        }, err => {
+          this.collectResult = err.response.data || '获取失败'
+          this.timeoutCount++
+        })
       }
       }
     },
     },
     components: {
     components: {
@@ -166,7 +268,7 @@
       },
       },
       headerImg() {
       headerImg() {
         // return ''
         // return ''
-        return this.wechatInfo.headimgurl
+        return this.wechatInfo.headimgurl || '/images/mobile/@2x/wechat/header-img.png'
       },
       },
       wechatInfo() {
       wechatInfo() {
         return this.$store.state.option.wechatInfo.data
         return this.$store.state.option.wechatInfo.data
@@ -282,6 +384,26 @@
           vertical-align: top;
           vertical-align: top;
         }
         }
       }
       }
+      &.code {
+        border-bottom: 1px solid #eee;
+      }
+      &.toInfoBind {
+        color: #3872f4;
+        font-size: 0.28rem;
+        text-align: right;
+        margin-top: 0.2rem;
+        margin-bottom: 0.2rem;
+      }
+      .codeBtn {
+        font-size: 0.28rem;
+        color: #376ef3;
+        width: 1.8rem;
+        height: 0.5rem;
+        line-height: 0.5rem;
+        border-radius: 0.04rem;
+        border: 1px solid #376ef3;
+        text-align: center;
+      }
     }
     }
     .loginBtn {
     .loginBtn {
       width: 5.8rem;
       width: 5.8rem;
@@ -292,7 +414,7 @@
       color: #fff;
       color: #fff;
       background: #376ef3;
       background: #376ef3;
       border-radius: 5px;
       border-radius: 5px;
-      margin: 1.29rem auto 0;
+      margin: 1rem auto 0;
     }
     }
     .register {
     .register {
       width: 5.8rem;
       width: 5.8rem;