Browse Source

Merge branch 'feature/yc-spec-0408'

yangc 7 years ago
parent
commit
55ce8fcc39

+ 173 - 404
components/applyPurchase/ApplyInfo.vue

@@ -9,95 +9,71 @@
       </div>
     </div>
     <div class="apply-info-list">
-      <p>
-        <span>发布时间
-          <a href="javascript:void(0)" @click="sortListByParam('releaseDate')">
-            <!--<i class=" fa fa-long-arrow-up" :class="{active: sorting.releaseDate == 'ASC'}"></i>-->
-            <!--<i class=" fa fa-long-arrow-down" :class="{active: sorting.releaseDate == 'DESC'}"></i>-->
-          </a>
+      <p class="list-title">
+        <span class="list-title-item">买家/发布时间
+          <!--<a href="javascript:void(0)" @click="sortListByParam('releaseDate')">
+            <i class=" fa fa-long-arrow-up" :class="{active: sorting.releaseDate == 'ASC'}"></i>
+            <i class=" fa fa-long-arrow-down" :class="{active: sorting.releaseDate == 'DESC'}"></i>
+          </a>-->
         </span>
-        <span>买家</span>
-        <span>型号</span>
-        <span>品牌</span>
-        <span>已报价
-          <a href="javascript:void(0)" @click="sortListByParam('offerAmount')">
-            <!--<i class=" fa fa-long-arrow-up" :class="{active: sorting.offerAmount == 'ASC'}"></i>-->
-            <!--<i class=" fa fa-long-arrow-down" :class="{active: sorting.offerAmount == 'DESC'}"></i>-->
-          </a>
+        <span class="list-title-item">产品信息</span>
+        <span class="list-title-item">已报价
+          <!--<a href="javascript:void(0)" @click="sortListByParam('offerAmount')">
+            <i class=" fa fa-long-arrow-up" :class="{active: sorting.offerAmount == 'ASC'}"></i>
+            <i class=" fa fa-long-arrow-down" :class="{active: sorting.offerAmount == 'DESC'}"></i>
+          </a>-->
         </span>
-        <span>截止时间
-          <a href="javascript:void(0)" @click="sortListByParam('deadline')">
-            <!--<i class=" fa fa-long-arrow-up" :class="{active: sorting.deadline == 'ASC'}"></i>-->
-            <!--<i class=" fa fa-long-arrow-down" :class="{active: sorting.deadline == 'DESC'}"></i>-->
-          </a>
+        <span class="list-title-item">截止时间
+          <!--<a href="javascript:void(0)" @click="sortListByParam('deadline')">
+            <i class=" fa fa-long-arrow-up" :class="{active: sorting.deadline == 'ASC'}"></i>
+            <i class=" fa fa-long-arrow-down" :class="{active: sorting.deadline == 'DESC'}"></i>
+          </a>-->
         </span>
-        <span>操作</span>
       </p>
       <ul v-if="purchaseManList.content && purchaseManList.content.length">
         <li v-for="(purchaseMan, index) in purchaseManList.content" :class="{'active': purchaseMan.active}">
-          <div>{{purchaseMan.date| date}}</div>
-          <div v-if="purchaseMan.inquiry.enterprise && purchaseMan.inquiry.enterprise.enName" :title="user.logged ? purchaseMan.inquiry.enterprise.enName : null">{{[purchaseMan.inquiry.enterprise.enName, user] | enterpriseFilter}}</div>
-          <div v-else :title="user.logged ? purchaseMan.userName : null">{{[purchaseMan.userName, user] | userNameFilter}}</div>
-          <div :title="purchaseMan.cmpCode">{{purchaseMan.cmpCode || '-'}}</div>
-          <div :title="purchaseMan.inbrand">{{purchaseMan.inbrand || '-'}}</div>
-          <div class="number-content"><img src="/images/applyPurchase/hot-fire.png" alt="" v-if="purchaseMan.offerAmount > 10"><span :style="purchaseMan.offerAmount > 10 ? 'color: #ff9a00': ''">{{purchaseMan.offerAmount || 0}}</span>&nbsp;条</div>
-          <div class="date-content">
-            <div v-if="purchaseMan.remainingTime > 0">
-              <span>剩余&nbsp;</span>
-              <span v-if="getDay(purchaseMan.remainingTime) > 0" v-text="getDay(purchaseMan.remainingTime)"></span>
-              <i v-if="getDay(purchaseMan.remainingTime) > 0">&nbsp;天&nbsp;</i>
-              <span v-if="getDay(purchaseMan.remainingTime) <= 0" v-text="getHours(purchaseMan.remainingTime)"></span>
-              <i v-if="getDay(purchaseMan.remainingTime) <= 0" >&nbsp;小时</i>
-            </div>
-            <span v-if="!purchaseMan.remainingTime || purchaseMan.remainingTime <= 0">已截止</span>
-          </div>
-          <div class="btn-content">
-            <!--<a @click="setLinkBoxIndex(index)">联系买家</a>-->
-            <!--判断该求购是自己的-->
-            <div class="is-say-price" v-if="purchaseMan.remainingTime > 0 && purchaseMan.quoted == 1">已报价 <img src="/images/applyPurchase/green-check.png" alt=""></div>
-            <div v-else>
-              <a title="该求购已截止" v-if="!purchaseMan.remainingTime || purchaseMan.remainingTime <= 0" style="background: #cccbcb;" @click="sayPriceStop">我要报价</a>
-              <a title="此为贵公司的求购" v-if="purchaseMan.remainingTime > 0 && (!purchaseMan.quoted || purchaseMan.quoted != 1) && (user.logged && ((purchaseMan.inquiry.enterprise && user.data.enterprise && (purchaseMan.inquiry.enterprise.uu === user.data.enterprise.uu)) || (!user.data.enterprise.uu && purchaseMan.userUU == user.data.userUU  && !purchaseMan.inquiry.enterprise)))" style="background: #cccbcb;" @click="sayPriceSeft">我要报价</a>
-              <a v-if="purchaseMan.remainingTime > 0 && (!purchaseMan.quoted || purchaseMan.quoted != 1) && !(user.logged && ((purchaseMan.inquiry.enterprise && user.data.enterprise && (purchaseMan.inquiry.enterprise.uu === user.data.enterprise.uu)) || (!user.data.enterprise.uu && purchaseMan.userUU == user.data.userUU  && !purchaseMan.inquiry.enterprise)))" @click="sayPrice(purchaseMan, index)">我要报价</a>
-            </div>
+          <div class="il-item il-left">
+            <div class="item" v-if="purchaseMan.inquiry.enterprise && purchaseMan.inquiry.enterprise.enName" :title="user.logged ? purchaseMan.inquiry.enterprise.enName : null">{{[purchaseMan.inquiry.enterprise.enName, user] | enterpriseFilter}}</div>
+            <div class="item" v-else :title="user.logged ? purchaseMan.userName : null">{{[purchaseMan.userName, user] | userNameFilter}}</div>
+            <div>{{purchaseMan.date| date}}</div>
           </div>
-          <div class="expand-content">
-            <div>
-              封装:{{purchaseMan.encapsulation || '-'}}
-            </div>
-            <div>
-              采购数量:<span>{{purchaseMan.needquantity || '-'}}</span><span v-if="purchaseMan.needquantity">个</span>
-            </div>
-            <div>
-              单价预算:<span>{{purchaseMan.unitPrice ? (purchaseMan.currency == 'RMB' ? '¥' : '$') + purchaseMan.unitPrice : '-'}}</span>
+          <div class="il-item il-center">
+            <div class="il-box-large il-box">
+              <div :title="purchaseMan.prodTitle | nullFilter" class="fl item"><span>类目:</span><div class="content">{{(purchaseMan.prodTitle || '-') | nullFilter}}</div></div>
+              <div :title="purchaseMan.cmpCode" class="fl item"><span>型号:</span><div class="content">{{purchaseMan.cmpCode || '-'}}</div></div>
+              <div :title="purchaseMan.inbrand" class="fl item bottom"><span>品牌:</span><div class="content">{{purchaseMan.inbrand || '-'}}</div></div>
+              <div :title="purchaseMan.spec" class="fl item bottom"><span>规格:</span><div class="content">{{purchaseMan.spec || '-'}}</div></div>
             </div>
-            <div>
-              生产日期:{{purchaseMan.produceDate || '-'}}
+            <div class="il-box-small il-box">
+              <div :title="purchaseMan.encapsulation" class="item"><span>封装:</span>{{purchaseMan.encapsulation || '-'}}</div>
+              <div :title="purchaseMan.produceDate" class="item"><span>生产日期:</span>{{purchaseMan.produceDate || '-'}}</div>
+              <div :title="purchaseMan.needquantity" class="item"><span>采购数量:</span>{{purchaseMan.needquantity || '-'}}</div>
+              <div :title="purchaseMan.unitPrice ? (purchaseMan.currency == 'RMB' ? '¥' : '$') + purchaseMan.unitPrice : '-'" class="item"><span>单价预算:</span>{{purchaseMan.unitPrice ? (purchaseMan.currency == 'RMB' ? '¥' : '$') + purchaseMan.unitPrice : '-'}}</div>
             </div>
           </div>
-          <!--<div class="say-price">
-            <div>报价</div>
-            <div>
-              <i>*</i>单价
-              <select v-if="!purchaseMan.currency" v-model="sayPriceObj.currency">
-                <option value="RMB">¥</option>
-                <option value="USD">$</option>
-              </select>
-              <div v-if="purchaseMan.currency" v-text="purchaseMan.currency == 'RMB' ? '¥' : '$'"></div>
-              <input type="number" v-model="sayPriceObj.unitPrice" class="form-control" @blur="onUnitPriceBlur" @input="onUnitPriceChange">
+          <div class="il-item number-content"><img src="/images/applyPurchase/hot-fire.png" alt="" v-if="purchaseMan.offerAmount > 10"><span :style="purchaseMan.offerAmount > 10 ? 'color: #ff9a00': ''">{{purchaseMan.offerAmount || 0}}</span>&nbsp;条</div>
+          <div class="il-item il-right">
+            <div class="date-content">
+              <div v-if="purchaseMan.remainingTime > 0">
+                <span>剩余&nbsp;</span>
+                <span v-if="getDay(purchaseMan.remainingTime) > 0" v-text="getDay(purchaseMan.remainingTime)"></span>
+                <i v-if="getDay(purchaseMan.remainingTime) > 0">&nbsp;天&nbsp;</i>
+                <span v-if="getDay(purchaseMan.remainingTime) <= 0" v-text="getHours(purchaseMan.remainingTime)"></span>
+                <i v-if="getDay(purchaseMan.remainingTime) <= 0" >&nbsp;小时</i>
+              </div>
+              <span v-if="!purchaseMan.remainingTime || purchaseMan.remainingTime <= 0">已截止</span>
             </div>
-            <div>
-              <i>*</i>交期&nbsp;
-              <input type="number" v-model="sayPriceObj.minDay" @blur="onMinDayInput" @input="onMinDayChange" class="form-control">&nbsp;-&nbsp;<input type="number" v-model="sayPriceObj.maxDay" @blur="onMaxDayInput" @input="onMaxDayChange" class="form-control">&nbsp;天
+            <div class="btn-content">
+              <!--<a @click="setLinkBoxIndex(index)">联系买家</a>-->
+              <!--判断该求购是自己的-->
+              <div class="is-say-price" v-if="purchaseMan.remainingTime > 0 && purchaseMan.quoted == 1">已报价 <img src="/images/applyPurchase/green-check.png" alt=""></div>
+              <div v-else>
+                <a title="该求购已截止" v-if="!purchaseMan.remainingTime || purchaseMan.remainingTime <= 0" style="background: #cccbcb;" @click="sayPriceStop">我要报价</a>
+                <a title="此为贵公司的求购" v-if="purchaseMan.remainingTime > 0 && (!purchaseMan.quoted || purchaseMan.quoted != 1) && (user.logged && ((purchaseMan.inquiry.enterprise && user.data.enterprise && (purchaseMan.inquiry.enterprise.uu === user.data.enterprise.uu)) || (!user.data.enterprise.uu && purchaseMan.userUU == user.data.userUU  && !purchaseMan.inquiry.enterprise)))" style="background: #cccbcb;" @click="sayPriceSeft">我要报价</a>
+                <a v-if="purchaseMan.remainingTime > 0 && (!purchaseMan.quoted || purchaseMan.quoted != 1) && !(user.logged && ((purchaseMan.inquiry.enterprise && user.data.enterprise && (purchaseMan.inquiry.enterprise.uu === user.data.enterprise.uu)) || (!user.data.enterprise.uu && purchaseMan.userUU == user.data.userUU  && !purchaseMan.inquiry.enterprise)))" @click="sayPrice(purchaseMan, index)">我要报价</a>
+              </div>
             </div>
-            <div>
-              生产日期&nbsp;<input v-model="sayPriceObj.produceDate" @input="onProduceDateChange" type="text" class="form-control">
-            </div>
-            <div>
-              <span @click="cancelSayPrice(purchaseMan)">取消</span>
-              <span @click="commitSayPrice(purchaseMan)">提交</span>
-            </div>
-          </div>-->
+          </div>
         </li>
       </ul>
       <div class="empty" v-else>
@@ -130,6 +106,7 @@
 <script>
   import Page from '~components/common/page/pageComponent.vue'
   import SayPrice from './SayPrice.vue'
+  import { checkNullStr } from '~utils/baseUtils'
   export default {
     data () {
       return {
@@ -172,6 +149,9 @@
         } else {
           return str || '-'
         }
+      },
+      nullFilter (str) {
+        return checkNullStr(str) ? str : '-'
       }
     },
     computed: {
@@ -308,6 +288,7 @@
           background: #3975f4;
           text-align: center;
           margin: 0 6px 0 -1px;
+          height: 33px;
           /*vertical-align: middle;*/
           border: {
             top-right-radius: 3px;
@@ -326,43 +307,31 @@
       }
     }
     .apply-info-list {
-      >p {
-        background: #ededed;
+      .list-title {
+        background: #e2ebff;
         height: 40px;
         line-height: 40px;
         margin: 9px 0 0 0;
-        span {
+        .list-title-item {
           display: inline-block;
           text-align: center;
-          a {
-            i {
-              color: #333;
-              &.active {
-                color: #5078cb;
-              }
+          .fa {
+            color: #333;
+            &.active {
+              color: #5078cb;
             }
           }
           &:nth-child(1) {
-            width: 186px;
+            margin-left: 21px;
           }
           &:nth-child(2) {
-            width: 106px;
+            margin-left: 345px;
           }
           &:nth-child(3) {
-            width: 200px;
+            margin-left: 452px;
           }
           &:nth-child(4) {
-            width: 174px;
-          }
-          &:nth-child(5) {
-            width: 152px;
-          }
-          &:nth-child(6) {
-            width: 158px;
-          }
-          &:nth-child(7) {
-            width: 180px;
-            margin-left: 30px;
+            margin-left: 71px;
           }
         }
       }
@@ -370,344 +339,144 @@
         margin-bottom: 29px;
         > li {
           position: relative;
-          min-height: 61px;
-          line-height: 61px;
           border: 1px solid #ededed;
-          >div {
-            overflow-x: hidden;
-            text-overflow: ellipsis;
-            white-space: nowrap;
+          &.active {
+            border: 1px solid #4290f7;
+            box-shadow: 2px 4px 5px 0 rgb( 205, 221, 252 );
+          }
+          &:hover {
+            border: 1px solid #4290f7;
+            box-shadow: 2px 4px 5px 0 rgb( 205, 221, 252 );
+          }
+          .il-item {
+            height: 120px;
             display: inline-block;
             text-align: center;
             color: #3c3c3c;
+            padding-top: 16px;
             vertical-align: middle;
-            &:nth-child(1) {
-              width: 186px;
-            }
-            &:nth-child(2) {
-              width: 106px;
-            }
-            &:nth-child(3) {
-              width: 200px;
-            }
-            &:nth-child(4) {
-              width: 174px;
-            }
-            &:nth-child(5) {
-              width: 152px;
-            }
-            &:nth-child(6) {
-              width: 158px;
-            }
-            &:nth-child(7) {
-              width: 180px;
-              margin-left: 32px;
-              float: right;
-            }
-            &.date-content {
+            .item {
+              display: inline-block;
+              overflow: hidden;
+              text-overflow: ellipsis;
+              white-space: nowrap;
               span {
-                &:first-child {
-                  font-size: 12px;
-                  color: #666;
-                }
-                color: #f71026;
-              }
-              i {
-                font-style: normal;
+                color: #999;
               }
             }
-            &.number-content {
-              span {
-                color: #5392f9;
-                &.active {
-                  color: #ff9a00;
+            &.il-left {
+              width: 136px;
+              padding-left: 17px;
+              div {
+                display: block;
+                &:last-child {
+                  margin-top: 37px;
+                  color: #666;
                 }
               }
-              >img {
-                margin-bottom: 5px;
-                margin-right: 2px;
-              }
             }
-            &.btn-content {
-              >div a {
-                display: inline-block;
-                width: 71px;
-                height: 28px;
-                line-height: 28px;
-                color: #fff;
-                background: #3c7cf5;
-                border-radius: 3px;
-                cursor: pointer;
-                /*  &:first-child {
-                    background: #ffa200;
-                    float: left;
-                    margin-top: 19px;
-                  }*/
-              }
-              .is-say-price {
+            &.il-center {
+              margin-left: 47px;
+              text-align: left;
+              width: 707px;
+              .il-box {
                 display: inline-block;
-                color: #39ae05;
-                margin-left: 11px;
-                img {
-                  margin-bottom: 2px;
+                float: left;
+                span {
+                  color: #999;
                 }
-                .say-price-history {
-                  position: absolute;
-                  top: 53px;
-                  right: 11px;
-                  line-height: normal;
-                  width: 198px;
-                  height: 0;
-                  background: #fff;
-                  border: 1px solid #fab89a;
-                  z-index: 1;
-                  overflow: hidden;
-                  transition: height 1s;
-                  -moz-transition: height 1s; /* Firefox 4 */
-                  -webkit-transition: height 1s; /* Safari 和 Chrome */
-                  -o-transition: height 1s; /* Opera */
-                  opacity: 0;
-                  p {
-                    color: #020202;
-                    font-weight: bold;
-                    margin: 0;
-                    &.price-title {
-                      background: #fee6db;
-                      height: 28px;
-                      line-height: 28px;
-                    }
-                    &.price-level {
-                      margin: 6px 0;
-                      text-align: left;
-                    }
+              }
+              .il-box-large {
+                width: 570px;
+                .fl {
+                  width: 284px;
+                  line-height: 19px;
+                  word-break: break-all;
+                  white-space: unset;
+                  &.bottom {
+                    margin-top: 14px;
                   }
-                  > div {
-                    padding: 9px 12px;
-                    > div {
-                      display: inline-block;
-                      text-align: left;
-                      &:nth-child(1) {
-                        float: left;
-                      }
-                      &:nth-child(2) {
-                        margin-left: 32px;
-                      }
-                      span {
-                        color: #020202;
-                        margin: 0;
-                        &.red-text {
-                          color: #f62d37;
-                        }
-                      }
-                      &.pre-line {
-                        display: block;
-                        padding: 13px 0;
-                        border-bottom: 1px dashed #fee6db;
-                      }
-                    }
-                    ul {
-                      li {
-                        color: #333;
-                        height: 22px;
-                        line-height: 22px;
-                        padding: 0 6px;
-                        &:nth-child(odd) {
-                          background: #f6f5f4;
-                        }
-                        span {
-                          color: #333;
-                          display: inline-block;
-                          text-align: left;
-                          width: 50%;
-                          margin: 0;
-                        }
-                        &:last-child {
-                          span {
-                            color: #4290f7;
-                          }
-                        }
-                      }
-                    }
+                  .content {
+                    display: inline-block;
+                    width: 220px;
+                    overflow: hidden;
+                    vertical-align: middle;
+                    height: 38px;
                   }
-                }
-                &:hover {
-                  .say-price-history {
-                    opacity: 1;
-                    /* animation: expand 1s infinite;
-                     -webkit-animation: expand 1s infinite; !*Safari and Chrome*!
-                     animation-iteration-count: 1;
-                     -webkit-animation-iteration-count: 1;*/
-                    height: 210px;
+                  span {
+                    float: left;
                   }
                 }
-                /* @keyframes expand {
-                   from {bottom: 58px}
-                   to {bottom: auto}
-                 }
-                 @-webkit-keyframes expand {
-                   from {bottom: 58px}
-                   to {bottom: auto}
-                 }*/
               }
-            }
-          }
-          .expand-content {
-            display: none;
-            position: absolute;
-            top: 63px;
-            justify-content: space-between;
-            padding: 0 236px 0 36px;
-            background: #fffbf0;
-            height: 48px;
-            line-height: 48px;
-            color: #020202;
-            div {
-              display: inline-block;
-              span {
-                color: #f71026;
+              .il-box-small {
+                width: 121px;
+                margin-left: 12px;
+                .item {
+                  color: #020202;
+                  width: 121px;
+                  margin-bottom: 6px;
+                }
               }
             }
-          }
-          &:hover {
-            border-top: 1px solid #4290f7;
-            border-left: 1px solid #4290f7;
-            border-right: 1px solid #4290f7;
-            .expand-content {
-              display: flex;
-              width: 1190px;
-              z-index: 1;
-              border-bottom: 1px solid #4290f7;
-              border-left: 1px solid #4290f7;
-              border-right: 1px solid #4290f7;
-              left: -1px;
-            }
-          }
-          .say-price {
-            background-color: #e7eef9;
-            height: 64px;
-            line-height: 64px;
-            display: none;
-            >div {
-              display: inline-block;
-              position: relative;
-              height: 64px;
-              line-height: 64px;
-              input {
-                border-radius: 3px;
-              }
-              &:nth-child(1) {
-                width: 282px;
-                background: url('/images/applyPurchase/say-price.png')no-repeat;
-                text-align: center;
-                margin-right: 44px;
-              }
-              &:nth-child(2) {
-                margin-right: 39px;
-                input {
-                  width: 118px;
-                  height: 26px;
-                  border: 1px solid #5392f9;
-                }
-                select {
-                  position: absolute;
-                  top: 19px;
-                  width: 32px;
-                  height: 26px;
-                  background: url('/images/applyPurchase/arrow-down.png')no-repeat right center;
-                  -webkit-box-shadow: none;
-                  -moz-box-shadow: none;
-                  box-shadow: none;
-                  border: {
-                    left: none;
-                    top: none;
-                    bottom: none;
-                    right: 1px solid #5392f9;
-                    bottom-left-radius: 4px;
-                    top-left-radius: 4px;
-                  }
-                  color: #5392f9;
-                  font: small-caption;
-                  padding-left: 8px;
-                  & + input {
-                    padding-left: 34px;
-                  }
-                }
-                div {
-                  position: absolute;
-                  top: 19px;
-                  left: 38px;
-                  width: 32px;
-                  height: 26px;
-                  line-height: 26px;
-                  text-align: center;
-                  border: {
-                    left: none;
-                    top: none;
-                    bottom: none;
-                    right: 1px solid #5392f9;
-                    bottom-left-radius: 4px;
-                    top-left-radius: 4px;
-                  }
-                  color: #5392f9;
-                  & + input {
-                    padding-left: 34px;
+            &.il-right {
+              width: 100px;
+              .date-content {
+                margin-top: 14px;
+                margin-bottom: 17px;
+                span {
+                  &:first-child {
+                    font-size: 12px;
+                    color: #666;
                   }
+                  color: #f71026;
                 }
-              }
-              &:nth-child(3) {
-                margin-right: 37px;
-                input {
-                  width: 32px;
-                  height: 26px;
-                  padding: 0 0 0 6px;
-                }
-              }
-              &:nth-child(4) {
-                margin-right: 132px;
-                input {
-                  width: 118px;
-                  height: 26px;
+                i {
+                  font-style: normal;
                 }
               }
-              &:nth-child(5) {
-                span {
+              .btn-content {
+                >div a {
+                  display: inline-block;
                   width: 71px;
                   height: 28px;
                   line-height: 28px;
-                  text-align: center;
-                  display: inline-block;
+                  color: #fff;
+                  background: #3c7cf5;
+                  border-radius: 3px;
                   cursor: pointer;
-                  &:first-child {
-                    background: #dedddd;
-                    margin-right: 10px;
-                  }
-                  &:last-child {
-                    background: #fa4701;
-                    color: #fff;
+                  /*  &:first-child {
+                      background: #ffa200;
+                      float: left;
+                      margin-top: 19px;
+                    }*/
+                }
+                .is-say-price {
+                  display: inline-block;
+                  color: #39ae05;
+                  margin-left: 11px;
+                  img {
+                    margin-bottom: 2px;
                   }
                 }
               }
-              i {
-                color: #e41515;
-                position: relative;
-                top: 2px;
-                right: 3px;
-              }
             }
           }
-          &.active {
-            border: 1px solid #4290f7;
-            .expand-content {
-              display: flex;
-              width: 1190px;
-              z-index: 1;
-              border: 1px solid #4290f7;
-              left: -1px;
-              border-top: none;
+          .number-content {
+            margin-left: 56px;
+            line-height: 120px;
+            padding-top: 0;
+            width: 77px;
+            margin-right: 34px;
+            span {
+              color: #5392f9;
+              &.active {
+                color: #ff9a00;
+              }
+            }
+            >img {
+              margin-bottom: 5px;
+              margin-right: 2px;
             }
-            /*.say-price {*/
-            /*display: block;*/
-            /*}*/
           }
         }
       }

+ 276 - 183
components/applyPurchase/BatchPublish.vue

@@ -11,14 +11,11 @@
           <!--<label for="all"></label>-->
           <!--</label>全选-->
           <!--</th>-->
-          <th width="140"><i class="red-text">*</i>型号</th>
-          <th width="132"><i class="red-text">*</i>品牌</th>
-          <th width="80">采购数量</th>
-          <th width="108">单价预算</th>
-          <th width="76">封装</th>
-          <th width="102">生产日期</th>
-          <th width="124"><i class="red-text">*</i>截止时间</th>
-          <th width="192">操作</th>
+          <th width="615">产品信息</th>
+          <th width="95">采购数量</th>
+          <th width="114">生产日期</th>
+          <th width="136"><i class="red-text">*</i>截止时间</th>
+          <th width="186">操作</th>
         </tr>
         </thead>
         <tbody v-for="(item, index) in bomList.content">
@@ -30,44 +27,58 @@
             </label>
           </td>-->
           <td>
-            <div v-if="item.code && (!item.codeWord || item.codeWord.length == 0)" :title="item.code">{{item.code}}</div>
-            <span class="red-text" v-if="!item.code">请完善信息</span>
-            <div class="similar-select" v-if="item.codeWord && item.codeWord.length > 0" @click="setShowCodeWord(index, $event)">{{item.code}}</div>
-            <ul v-show="item.showCodeWord">
-              <li v-for="code in item.codeWord" @click="modifyItemByWord(index, code.code, 'code')" :title="code.code">{{code.code}}</li>
-            </ul>
-          </td>
-          <td>
-            <div v-if="item.brand && (!item.brandWord || item.brandWord.length == 0)" :title="item.brand">{{item.brand}}</div>
-            <span class="red-text" v-if="!item.brand">请完善信息</span>
-            <div class="similar-select" v-if="item.brandWord && item.brandWord.length > 0" @click="setShowBrandWord(index, $event)">{{item.brand}}</div>
-            <ul v-show="item.showBrandWord" class="brand-word-list">
-              <li v-for="brand in item.brandWord" @click="modifyItemByWord(index, brand.nameEn, 'brand')" :title="brand.nameEn">{{brand.nameEn}}</li>
-            </ul>
-          </td>
-          <td>
-            <div :title="item.amount">{{item.amount || '-'}}</div>
-          </td>
-          <td class="blue-text">
-            <div>
-              <span v-if="item.unitPrice">{{(item.currency === 'RMB' ? '¥' : '$') + item.unitPrice}}</span>
-              <span v-if="!item.unitPrice">-</span>
+            <div class="prod-items">
+              <div class="prod-item prod-item-large" :title="item.kind">
+                <span class="pi-title">类目:</span>
+                <div class="pi-content over-ell">{{item.kind || '-'}}</div>
+              </div>
+              <div class="prod-item prod-item-large" :title="item.code">
+                <span class="pi-title"><i class="red-text">*</i>型号:</span>
+                <div class="pi-content over-ell" v-if="item.code && (!item.codeWord || item.codeWord.length == 0)" :title="item.code">{{item.code}}</div>
+                <div class="pi-content red-text" v-if="!item.code">请完善信息</div>
+                <div class="pi-content over-ell similar-select" v-if="item.codeWord && item.codeWord.length > 0" @click="setShowCodeWord(index, $event)">{{item.code}}</div>
+                <ul v-show="item.showCodeWord">
+                  <li v-for="code in item.codeWord" @click="modifyItemByWord(index, code.code, 'code')" :title="code.code">{{code.code}}</li>
+                </ul>
+              </div>
+              <div class="prod-item prod-item-small">
+                <span class="pi-title">单价预算:</span>
+                <div class="pi-content over-ell" v-if="item.unitPrice">{{(item.currency === 'RMB' ? '¥' : '$') + item.unitPrice}}</div>
+                <div class="pi-content over-ell" v-else="!item.unitPrice">-</div>
+              </div>
+              <div class="prod-item prod-item-large" :title="item.brand">
+                <span class="pi-title"><i class="red-text">*</i>品牌:</span>
+                <div class="pi-content over-ell" v-if="item.brand && (!item.brandWord || item.brandWord.length == 0)" :title="item.brand">{{item.brand}}</div>
+                <div class="pi-content red-text" v-if="!item.brand">请完善信息</div>
+                <div class="pi-content similar-select over-ell" v-if="item.brandWord && item.brandWord.length > 0" @click="setShowBrandWord(index, $event)">{{item.brand}}</div>
+                <ul v-show="item.showBrandWord">
+                  <li v-for="brand in item.brandWord" @click="modifyItemByWord(index, brand.nameEn, 'brand')" :title="brand.nameEn">{{brand.nameEn}}</li>
+                </ul>
+              </div>
+              <div class="prod-item prod-item-large" :title="item.spec">
+                <span class="pi-title">规格:</span>
+                <div class="pi-content over-ell">{{item.spec || '-'}}</div>
+              </div>
+              <div class="prod-item prod-item-small" :title="item.encapsulation">
+                <span class="pi-title">封装:</span>
+                <div class="pi-content over-ell">
+                  {{item.encapsulation || '-'}}
+                </div>
+              </div>
             </div>
           </td>
           <td>
-            <div :title="item.encapsulation">
-              {{item.encapsulation || '-'}}
-            </div>
+            <div class="over-ell" :title="item.amount">{{item.amount || '-'}}</div>
           </td>
           <td>
-            <div :title="item.produceDate">
+            <div class="over-ell" :title="item.produceDate">
               {{item.produceDate || '-'}}
             </div>
           </td>
           <td>
             <span v-if="item.deadline">{{item.deadline | date}}</span>
             <span class="red-text" v-if="!item.deadline">请完善信息</span>
-            <div class="red-text" v-if="!isValidTime(item.deadline)">默认≤90天</div>
+            <div class="red-text remind" v-if="!isValidTime(item.deadline)">默认≤90天</div>
           </td>
           <td class="operate">
             <a @click="modifyItem(index)" class="size-s">编辑</a>
@@ -128,30 +139,46 @@
              </label>
            </td>-->
           <td>
-            <input type="text" class="form-control" v-model="modifyObj.code" :class="{'error': !validObj.code}" @blur="checkCode" @input="onCodeChange" >
-            <ul v-show="showSimilarCodeList">
-              <li v-for="sCode in similarCode" @click="setCode(sCode.code)">{{sCode.code}}</li>
-            </ul>
-          </td>
-          <td>
-            <input type="text" class="form-control" v-model="modifyObj.brand" :class="{'error': !validObj.brand}" @blur="checkBrand" @input="onBrandChange">
-            <ul class="brand-similar-list" v-show="showSimilarBrandList">
-              <li v-for="sBrand in similarBrand" @click="setBrand(sBrand.nameEn)">{{sBrand.nameEn}}</li>
-            </ul>
+            <div class="prod-items">
+              <div class="prod-item prod-item-large">
+                <span class="pi-title">类目:</span>
+                <input type="text" class="form-control" v-model="modifyObj.kind" @input="onProdTitleInput">
+              </div>
+              <div class="prod-item prod-item-large">
+                <span class="pi-title"><i class="red-text">*</i>型号:</span>
+                <input type="text" class="form-control" v-model="modifyObj.code" :class="{'error': !validObj.code}" @blur="checkCode" @input="onCodeChange" >
+                <ul v-show="showSimilarCodeList">
+                  <li v-for="sCode in similarCode" @click="setCode(sCode.code)">{{sCode.code}}</li>
+                </ul>
+              </div>
+              <div class="prod-item prod-item-small pi-select">
+                <span class="pi-title">单价预算:</span>
+                <select class="form-control" v-model="modifyObj.currency">
+                  <option value="RMB">¥</option>
+                  <option value="USD">$</option>
+                </select>
+                <input class="form-control" type="number" v-model="modifyObj.unitPrice" :class="{'error': !validObj.unitPrice}" @blur="checkUnitPrice" @input="onUnitPriceInput">
+              </div>
+              <div class="prod-item prod-item-large">
+                <span class="pi-title"><i class="red-text">*</i>品牌:</span>
+                <input type="text" class="form-control" v-model="modifyObj.brand" :class="{'error': !validObj.brand}" @blur="checkBrand" @input="onBrandChange">
+                <ul class="brand-similar-list" v-show="showSimilarBrandList">
+                  <li v-for="sBrand in similarBrand" @click="setBrand(sBrand.nameEn)">{{sBrand.nameEn}}</li>
+                </ul>
+              </div>
+              <div class="prod-item prod-item-large">
+                <span class="pi-title">规格:</span>
+                <input type="text" class="form-control" v-model="modifyObj.spec" :class="{'error': !validObj.spec}" @input="onSpecInput" @blur="checkSpec">
+              </div>
+              <div class="prod-item prod-item-small">
+                <span class="pi-title">封装:</span>
+                <input type="text" class="form-control" v-model="modifyObj.encapsulation" @input="onEncapsulationChange">
+              </div>
+            </div>
           </td>
           <td>
             <input type="text" class="form-control" v-model="modifyObj.amount" :class="{'error': !validObj.amount}" @blur="checkAmount" @input="onAmountInput">
           </td>
-          <td>
-            <select class="form-control" v-model="modifyObj.currency">
-              <option value="RMB">¥</option>
-              <option value="USD">$</option>
-            </select>
-            <input class="form-control" type="number" v-model="modifyObj.unitPrice" :class="{'error': !validObj.unitPrice}" @blur="checkUnitPrice" @input="onUnitPriceInput">
-          </td>
-          <td>
-            <input type="text" class="form-control" v-model="modifyObj.encapsulation" @input="onEncapsulationChange">
-          </td>
           <td>
             <input type="text" class="form-control" v-model="modifyObj.produceDate" @input="onProduceDateChange">
           </td>
@@ -184,7 +211,7 @@
   </div>
 </template>
 <script>
-  import { enidfilter, getRealLen, cutOutString, formatDate } from '~utils/baseUtils'
+  import { enidfilter, getRealLen, cutOutString, formatDate, checkNullStr } from '~utils/baseUtils'
   import Page from '~components/common/page/pageComponent.vue'
   export default {
     data () {
@@ -201,7 +228,9 @@
           encapsulation: '',
           produceDate: '',
           amount: '',
-          deadline: ''
+          deadline: '',
+          kind: '',
+          spec: ''
         },
         pickerOptions: {
           disabledDate (time) {
@@ -218,7 +247,8 @@
 //          encapsulation: true,
 //          produceDate: true,
           amount: true,
-          deadline: true
+          deadline: true,
+          spec: true
         },
 //        successResult: 0,
         showSimilarCodeList: false,
@@ -289,17 +319,11 @@
     methods: {
       getDate1: function () {
         this.modifyObj.deadline = formatDate(this.modifyObj.deadline, 'yyyy-MM-dd hh:mm:ss')
+        this.validObj.deadline = true
       },
       initModifyObj: function () {
-        this.modifyObj = {
-          code: '',
-          brand: '',
-          unitPrice: '',
-          currency: 'RMB',
-          encapsulation: '',
-          produceDate: '',
-          amount: '',
-          deadline: ''
+        for (let attr in this.modifyObj) {
+          this.modifyObj[attr] = attr === 'currency' ? 'RMB' : ''
         }
       },
       initValidObj: function () {
@@ -308,7 +332,8 @@
           brand: true,
           unitPrice: true,
           amount: true,
-          deadline: true
+          deadline: true,
+          spec: true
         }
       },
       listenPage: function (page) {
@@ -437,11 +462,7 @@
             })
         } else {
           if (!checkValid) {
-            if (!this.validObj.code) {
-              this.$message.error('型号不能为空')
-            } else if (!this.validObj.brand) {
-              this.$message.error('品牌不能为空')
-            } else if (!this.validObj.deadline) {
+            if (!this.validObj.deadline) {
               if (!this.isValidDate(this.modifyObj.deadline)) {
                 this.$message.error('截止日期需在90天以内')
               } else {
@@ -535,11 +556,27 @@
         return item.code && item.brand && item.deadline && this.isValidDate(item.deadline)
       },
       checkCode: function () {
-        this.validObj.code = this.modifyObj.code && this.modifyObj.code !== ''
+        let nullStrFlag = checkNullStr(this.modifyObj.code)
+        this.validObj.code = this.modifyObj.code && this.modifyObj.code !== '' && nullStrFlag
+        if (!this.validObj.code) {
+          if (!nullStrFlag) {
+            this.$message.error('型号输入不合法')
+          } else {
+            this.$message.error('型号不能为空')
+          }
+        }
         return this.validObj.code
       },
       checkBrand: function () {
-        this.validObj.brand = this.modifyObj.brand && this.modifyObj.brand !== ''
+        let nullStrFlag = checkNullStr(this.modifyObj.brand)
+        this.validObj.brand = this.modifyObj.brand && this.modifyObj.brand !== '' && nullStrFlag
+        if (!this.validObj.brand) {
+          if (!nullStrFlag) {
+            this.$message.error('品牌输入不合法')
+          } else {
+            this.$message.error('品牌不能为空')
+          }
+        }
         return this.validObj.brand
       },
       checkUnitPrice: function () {
@@ -550,8 +587,16 @@
         this.validObj.amount = (!this.modifyObj.amount || this.modifyObj.amount === '') ? true : this.modifyObj.amount > 0 && this.modifyObj.amount < 1000000000
         return this.validObj.amount
       },
+      checkSpec: function () {
+        let nullStrFlag = checkNullStr(this.modifyObj.spec)
+        this.validObj.spec = nullStrFlag
+        if (!nullStrFlag) {
+          this.$message.error('规格输入不合法')
+        }
+        return this.validObj.spec
+      },
       checkAll: function () {
-        return this.checkCode() && this.checkBrand() && this.checkDeadline() && this.checkUnitPrice() && this.checkAmount()
+        return this.checkCode() && this.checkBrand() && this.checkDeadline() && this.checkUnitPrice() && this.checkAmount() && this.checkSpec()
       },
       checkDeadline: function () {
         this.validObj.deadline = this.modifyObj.deadline && this.modifyObj.deadline !== '' && this.isValidDate(this.modifyObj.deadline)
@@ -615,6 +660,16 @@
         }
         this.getSimilarBrand()
       },
+      onProdTitleInput: function () {
+        if (this.modifyObj.kind && getRealLen(this.modifyObj.kind) > 40) {
+          this.modifyObj.kind = cutOutString(this.modifyObj.kind, 40)
+        }
+      },
+      onSpecInput: function () {
+        if (this.modifyObj.spec && getRealLen(this.modifyObj.spec) > 100) {
+          this.modifyObj.spec = cutOutString(this.modifyObj.spec, 100)
+        }
+      },
       onAmountInput: function () {
         if (!(/^[0-9]*$/).test(this.modifyObj.amount)) {
           let chineseIndex = -1
@@ -964,6 +1019,11 @@
     .blue-text {
       color: #3c7cf5;
     }
+    .over-ell {
+      overflow: hidden;
+      text-overflow: ellipsis;
+      white-space: nowrap;
+    }
     > p {
       margin: 30px 0 0 0;
       font-size: 16px;
@@ -1007,8 +1067,7 @@
         }
         > tbody {
           > tr {
-            height: 70px;
-            line-height: 70px;
+            height: 101px;
             text-align: center;
             border : {
               bottom: 1px solid #bcd2ff;
@@ -1020,75 +1079,105 @@
             }
             > td {
               position: relative;
-              > ul {
-                line-height: normal;
-                position: absolute;
-                top: 48px;
-                left: 12px;
-                background: #fff;
-                border: 1px solid #b5b5b5;
-                z-index: 1;
-                max-height: 120px;
-                overflow-y: auto;
-                overflow-x: hidden;
-                border-radius: 2px;
-                width: 145px;
-                li {
+              .prod-items {
+                height: 100px;
+                padding-top: 17px;
+                .prod-item {
+                  position: relative;
+                  display: inline-block;
                   height: 30px;
                   line-height: 30px;
-                  cursor: pointer;
-                  overflow: hidden;
-                  text-overflow: ellipsis;
-                  white-space: nowrap;
-                  padding: 0 5px;
-                  text-align: left;
-                  &:hover {
-                    background: #89aefa;
-                    color: #fff;
+                  float: left;
+                  margin-right: 5px;
+                  &:nth-child(n + 4) {
+                    margin-top: 9px;
                   }
-                }
-                &.brand-similar-list {
-                  left: 7px;
-                }
-              }
-              > div {
-                overflow: hidden;
-                overflow-y: unset;
-                text-overflow: ellipsis;
-                white-space: nowrap;
-                &.similar-select {
-                  width: 145px;
-                  margin: 0 auto;
-                  border: 1px solid #b5b5b5;
-                  height: 30px;
-                  line-height: 30px;
-                  overflow-y: hidden;
-                  padding: 0 22px 0 5px;
-                  background: url('/images/all/select-icon-full.png') no-repeat;
-                  background-color: #fff;
-                  background-position: 125px 10px;
-                  cursor: default;
-                  border-radius: 2px;
-                  & + ul {
+                  &:nth-child(3n) {
+                    margin-right: 0;
+                  }
+                  .pi-title {
+                    display: inline-block;
+                    text-align: right;
+                    color: #999;
+                    .red-text {
+                      margin-right: 3px;
+                    }
+                  }
+                  .pi-content {
+                    display: inline-block;
+                    text-align: left;
+                    vertical-align: middle;
+                  }
+                  &.prod-item-large {
+                    .pi-content {
+                      width: 145px;
+                    }
+                    .pi-title {
+                      width: 62px;
+                    }
+                  }
+                  &.prod-item-small {
+                    .pi-content {
+                      width: 105px;
+                    }
+                    .pi-title {
+                      width: 70px;
+                    }
+                  }
+                  > ul {
+                    line-height: normal;
+                    position: absolute;
+                    top: 31px;
+                    left: 62px;
+                    background: #fff;
+                    border: 1px solid #b5b5b5;
+                    z-index: 1;
+                    max-height: 120px;
+                    overflow-y: auto;
+                    overflow-x: hidden;
+                    border-radius: 2px;
                     width: 145px;
-                    top: 48px;
-                    left: 12px;
-                    &.brand-word-list {
-                      left: 7px;
+                    li {
+                      height: 30px;
+                      line-height: 30px;
+                      cursor: pointer;
+                      overflow: hidden;
+                      text-overflow: ellipsis;
+                      white-space: nowrap;
+                      padding: 0 5px;
+                      text-align: left;
+                      &:hover {
+                        background: #89aefa;
+                        color: #fff;
+                      }
                     }
                   }
                 }
               }
-              div.red-text {
-                line-height: normal;
-                position: absolute;
-                left: 42px;
-                top: 49px;
-                font-size: 12px;
+              .similar-select {
+                width: 145px;
+                margin: 0 auto;
+                border: 1px solid #b5b5b5;
+                height: 30px;
+                line-height: 30px;
+                overflow-y: hidden;
+                padding: 0 22px 0 5px;
+                background: url('/images/all/select-icon-full.png') no-repeat;
+                background-color: #fff;
+                background-position: 125px 10px;
+                cursor: default;
+                border-radius: 2px;
+                & + ul {
+                  width: 145px;
+                  top: 48px;
+                  left: 12px;
+                  &.brand-word-list {
+                    left: 7px;
+                  }
+                }
               }
               &.operate {
                 text-align: left;
-                padding-left: 18px;
                 font-size: 12px;
                 a {
                   color: #3c7cf5;
@@ -1111,6 +1200,9 @@
                   }
                 }
               }
+              .remind {
+                font-size: 12px;
+              }
             }
             &.spot-goods {
               background: #fff;
@@ -1163,27 +1255,28 @@
                                 font-size: 16px;
                                 vertical-align: middle;
                                 position: absolute;
-                                top: 13px;
+                                top: 12px;
                                 cursor: pointer;
                                 &.not-allowed {
                                   cursor: not-allowed;
                                   background: #d7d5d5;
                                 }
                                 &:first-child {
-                                  left: 10px;
+                                  left: -7px;
                                 }
                                 &:last-child {
-                                  right: 10px;
+                                  right: -7px;
                                 }
                               }
                               input {
-                                width: 46px;
-                                height: 26.1px;
+                                width: 81px;
+                                height: 26px;
                                 text-align: center;
                                 line-height: normal;
                                 vertical-align: middle;
                                 outline: none;
                                 border: 1px solid #d1d0d0;
+                                padding: 0 5px;
                               }
                             }
                           }
@@ -1215,72 +1308,72 @@
             }
             &.modify-row {
               td {
-                position: relative;
                 input, select {
                   height: 30px;
                   border-radius: 2px;
-                  border: 1px solid #b5b5b5;
+                  border: 1px solid #dadada;
                   text-align: center;
                   padding: 0 5px;
+                  display: inline-block;
                   &.error {
                     border-color: #f4645f !important;
                   }
                 }
                 input:focus {
-                -webkit-box-shadow: none;
-                -moz-box-shadow: none;
-                box-shadow: none;
-                border: 1px solid #3c7cf5;
-              }
-                &:nth-child(1) {
-                  input {
-                    width: 145px;
-                  }
+                  -webkit-box-shadow: none;
+                  -moz-box-shadow: none;
+                  box-shadow: none;
+                  border: 1px solid #3c7cf5;
                 }
-                &:nth-child(2) {
-                  input {
-                    width: 145px;
-                  }
-                }
-                &:nth-child(3) {
-                  input {
-                    width: 104px;
+                .prod-item {
+                  position: relative;
+                  &.prod-item-large {
+                    input {
+                      width: 145px;
+                    }
                   }
-                }
-                &:nth-child(4) {
-                  input {
-                    width: 103px;
-                    padding: 0 5px 0 30px;
+                  &.prod-item-small {
+                    input {
+                      width: 105px;
+                    }
                   }
-                  select {
-                    width: 25px;
-                    padding: 0 0 0 2px;
-                    background: url(/images/applyPurchase/select2.png) no-repeat right;
-                    background-size: 12px 28px;
-                    background-position: 12px 0;
-                    position: absolute;
-                    top: 20px;
-                    border-bottom: none;
-                    border-top: none;
-                    border-left: 0;
+                  &.pi-select {
+                    input {
+                      width: 103px;
+                      padding: 0 5px 0 30px;
+                    }
+                    select {
+                      width: 25px;
+                      padding: 0 0 0 2px;
+                      background: url(/images/applyPurchase/select2.png) no-repeat right;
+                      background-size: 12px 28px;
+                      background-position: 12px 0;
+                      position: absolute;
+                      top: 1px;
+                      border-bottom: none;
+                      border-top: none;
+                      border-left: 0;
+                    }
                   }
                 }
-                &:nth-child(5) {
+                &:nth-child(2) {
                   input {
-                    width: 96px;
+                    width: 83px;
                   }
                 }
-                &:nth-child(6) {
+                &:nth-child(3) {
                   input {
-                    width: 85px;
+                    width: 106px;
                   }
                 }
-                &:nth-child(7) {
+                &:nth-child(4) {
                   div {
-                    width: 101px;
+                    width: 106px;
                     overflow: unset;
                     input {
-                      width: 125px;
+                      width: 106px;
+                      border-radius: 2px;
+                      border: 1px solid #dadada;
                     }
                   }
                 }

+ 79 - 30
components/applyPurchase/PublishApply.vue

@@ -59,6 +59,18 @@
             </select>
             <input type="number" class="form-control" :class="{'error': !validObj.unitPrice}" v-model="applyObj.unitPrice" @blur="checkUnitPrice" @input="onUnitPriceInput" />
           </div>
+          <div class="form-item">
+           <span>
+              类目:
+            </span>
+            <input type="text" class="form-control" v-model="applyObj.prodTitle" @input="onProdTitleInput"/>
+          </div>
+          <div class="form-item">
+           <span>
+              规格:
+            </span>
+            <input type="text" class="form-control" :class="{'error': !validObj.spec}" v-model="applyObj.spec" @blur="checkSpec" @input="onSpecInput"/>
+          </div>
           <div class="form-item">
            <span>
               封装:
@@ -143,7 +155,7 @@
   </div>
 </template>
 <script>
-  import { getRealLen, cutOutString, formatDate } from '~utils/baseUtils'
+  import { getRealLen, cutOutString, formatDate, checkNullStr } from '~utils/baseUtils'
   export default {
     data () {
       return {
@@ -152,6 +164,8 @@
           brand: '',
           unitPrice: '',
           currency: 'RMB',
+          prodTitle: '',
+          spec: '',
           encapsulation: '',
           produceDate: '',
           amount: '',
@@ -164,7 +178,8 @@
 //          encapsulation: true,
 //          produceDate: true,
           amount: true,
-          deadline: true
+          deadline: true,
+          spec: true
         },
         pickerOptions: {
           disabledDate (time) {
@@ -248,6 +263,8 @@
             inquiryItem.date = date
             inquiryItem.endDate = this.applyObj.deadline
             inquiryItem.encapsulation = this.applyObj.encapsulation
+            inquiryItem.spec = this.applyObj.spec
+            inquiryItem.prodTitle = this.applyObj.prodTitle
             let inquiryItems = []
             inquiryItems.push(inquiryItem)
             inquiry.inquiryItems = inquiryItems
@@ -264,11 +281,7 @@
                 this.$message.error('发布失败')
               })
           } else {
-            if (!this.validObj.code) {
-              this.$message.error('型号不能为空')
-            } else if (!this.validObj.brand) {
-              this.$message.error('品牌不能为空')
-            } else if (!this.validObj.deadline) {
+            if (!this.validObj.deadline) {
               this.$message.error('截止日期不能为空')
             } else if (!this.validObj.amount) {
               this.$message.error('请输入正确的数值')
@@ -279,30 +292,48 @@
         }
       },
       getSimilarCode: function () {
-        this.$http.get('/search/similarComponents', {params: {keyword: this.applyObj.code}})
-          .then(response => {
-            this.similarCode = response.data
-            this.showSimilarCodeList = response.data.length > 0
-          })
+        if (this.applyObj.code) {
+          this.$http.get('/search/similarComponents', {params: {keyword: this.applyObj.code}})
+            .then(response => {
+              this.similarCode = response.data
+              this.showSimilarCodeList = response.data.length > 0
+            })
+        } else {
+          this.showSimilarCodeList = false
+        }
       },
       getSimilarBrand: function () {
-        this.$http.get('/search/similarBrands', {params: {keyword: this.applyObj.brand}})
-          .then(response => {
-            this.similarBrand = response.data
-            this.showSimilarBrandList = response.data.length > 0
-          })
+        if (this.applyObj.brand) {
+          this.$http.get('/search/similarBrands', {params: {keyword: this.applyObj.brand}})
+            .then(response => {
+              this.similarBrand = response.data
+              this.showSimilarBrandList = response.data.length > 0
+            })
+        } else {
+          this.showSimilarBrandList = false
+        }
       },
       checkCode: function () {
-        this.validObj.code = this.applyObj.code && this.applyObj.code !== ''
+        let nullStrFlag = checkNullStr(this.applyObj.code)
+        this.validObj.code = this.applyObj.code && this.applyObj.code !== '' && nullStrFlag
         if (!this.validObj.code) {
-          this.$message.error('型号不能为空')
+          if (!nullStrFlag) {
+            this.$message.error('型号输入不合法')
+          } else {
+            this.$message.error('型号不能为空')
+          }
         }
         return this.validObj.code
       },
       checkBrand: function () {
-        this.validObj.brand = this.applyObj.brand && this.applyObj.brand !== ''
+        let nullStrFlag = checkNullStr(this.applyObj.brand)
+        this.validObj.brand = this.applyObj.brand && this.applyObj.brand !== '' && nullStrFlag
         if (!this.validObj.brand) {
-          this.$message.error('品牌不能为空')
+          if (!nullStrFlag) {
+            this.$message.error('品牌输入不合法')
+          } else {
+            this.$message.error('品牌不能为空')
+          }
         }
         return this.validObj.brand
       },
@@ -313,12 +344,20 @@
         }
         return this.validObj.unitPrice
       },
+      checkSpec: function () {
+        let nullStrFlag = checkNullStr(this.applyObj.spec)
+        this.validObj.spec = nullStrFlag
+        if (!nullStrFlag) {
+          this.$message.error('规格输入不合法')
+        }
+        return this.validObj.spec
+      },
       checkAmount: function () {
         this.validObj.amount = this.applyObj.amount === '' ? true : this.applyObj.amount > 0 && this.applyObj.amount < 1000000000
         return this.validObj.amount
       },
       checkAll: function () {
-        return this.checkCode() && this.checkBrand() && this.checkDeadline() && this.checkUnitPrice() && this.checkAmount()
+        return this.checkCode() && this.checkBrand() && this.checkDeadline() && this.checkUnitPrice() && this.checkAmount() && this.checkSpec()
       },
       checkDeadline: function () {
         this.validObj.deadline = Boolean(this.applyObj.deadline)
@@ -351,6 +390,16 @@
           this.applyObj.encapsulation = cutOutString(this.applyObj.encapsulation, 20)
         }
       },
+      onProdTitleInput: function () {
+        if (this.applyObj.prodTitle && getRealLen(this.applyObj.prodTitle) > 40) {
+          this.applyObj.prodTitle = cutOutString(this.applyObj.prodTitle, 40)
+        }
+      },
+      onSpecInput: function () {
+        if (this.applyObj.spec && getRealLen(this.applyObj.spec) > 100) {
+          this.applyObj.spec = cutOutString(this.applyObj.spec, 100)
+        }
+      },
       onCodeChange: function () {
         this.applyObj.code = this.applyObj.code.trim()
         if ((/[^\x00-\xff]/g).test(this.applyObj.code)) {
@@ -506,16 +555,16 @@
         float: left;
         height: 100%;
         p {
-          padding-top: 18px;
-          font-size: 26px;
+          padding-top: 8px;
+          font-size: 22px;
           color: #3975f4;
-          margin-bottom: 7px;
+          margin-bottom: 4px;
         }
         >div {
           text-align: left;
           margin-left: 14px;
           .form-item {
-            margin-bottom: 5px;
+            margin-bottom: 4px;
             position: relative;
             span {
               width: 80px;
@@ -575,8 +624,8 @@
             input {
               font-size: 12px;
               width: 111px;
-              height: 20px;
-              line-height: 20px;
+              height: 18px;
+              line-height: 18px;
               border-radius: 2px;
               padding: 0 3px;
               box-shadow: none;
@@ -611,8 +660,8 @@
         color: #fff;
         position: relative;
         h1 {
-          font-size: 26px;
-          margin: 22px 0 0 0;
+          font-size: 22px;
+          margin: 11px 0 0 0;
         }
         h2 {
           font-size: 16px;

+ 1 - 1
nuxt.config.js

@@ -1,6 +1,6 @@
 const path = require('path')
 const isProdMode = Object.is(process.env.NODE_ENV, 'production')
-const baseUrl = process.env.BASE_URL || (isProdMode ? 'http://192.168.253.60:9090/platform-b2c/' : 'http://192.168.253.121:9090/platform-b2c/')
+const baseUrl = process.env.BASE_URL || (isProdMode ? 'http://192.168.253.60:9090/platform-b2c/' : 'http://10.1.51.124:8080/platform-b2c/')
 const commonUrl = process.env.COMMON_URL || (isProdMode ? 'https://api-inquiry.usoftmall.com/' : 'http://218.17.158.219:24000/')
 
 module.exports = {

+ 2 - 2
pages/applyPurchase/result.vue

@@ -11,12 +11,12 @@
     <div class="container" v-else>
       <p>发布求购</p>
       <img src="/images/applyPurchase/batch-error.png" alt="">
-      <h1>上传失败</h1>
+      <h1>发布失败</h1>
       <h2>请完善产品信息</h2>
       <div class="footer1">立刻
         <label>
           <input type="file" @change="upload" accept="*.xls, *.xlsx">
-          <a>重新上传</a>
+          <a>重新发布</a>
         </label>
       </div>
       <div class="footer2">返回 <nuxt-link to="/">商城首页</nuxt-link> | <nuxt-link to="/applyPurchase">求购首页</nuxt-link></div>

+ 12 - 1
utils/baseUtils.js

@@ -1,4 +1,7 @@
-let getRealLength = function (str) {
+
+const NULL_ARR = ['空', '没', '无', '-', '—', 'null', '#N/A']
+
+const getRealLength = function (str) {
   let len = 0
   for (let i = 0; i < str.length; i++) {
     if (str.charCodeAt(i) > 127 || str.charCodeAt(i) === 94) {
@@ -120,3 +123,11 @@ export const formatDate = (date, fmt) => {
   }
   return fmt
 }
+
+export const checkNullStr = (str) => {
+  let flag = true
+  NULL_ARR.map(s => {
+    flag = str === s ? false : flag
+  })
+  return flag
+}