Explorar o código

型号搜索=》现货/期货

yangc %!s(int64=6) %!d(string=hai) anos
pai
achega
560097d97f

+ 222 - 0
components/applyPurchase/SeekProduct.vue

@@ -0,0 +1,222 @@
+<template>
+  <div class="seek-product">
+    <el-dialog
+      title="我要询价"
+      :visible.sync="showObj.show">
+      <div class="form_dialog">
+        <ul class="list-inline">
+          <li class="form-item">
+            <span>品牌:</span>
+            <p>123123123123</p>
+          </li>
+          <li class="form-item">
+            <span>物料名称(类目):</span>
+            <p>1123132123</p>
+          </li>
+          <li class="form-item">
+            <span>型号:</span>
+            <p>3123123123123123123123123</p>
+          </li>
+          <li class="form-item">
+            <span>规格:</span>
+            <p>3</p>
+          </li>
+          <li class="form-item">
+            <span><i>*</i>截止日期:</span>
+            <el-date-picker
+              :class="{'error': !validObj.deadline}"
+              v-model="applyObj.deadline"
+              type="date"
+              :picker-options="pickerOptions"
+              @change="setDeadLineValid"
+              :editable="false"
+              :clearable="true"
+              size="mini">
+            </el-date-picker>
+          </li>
+          <li class="form-item">
+            <span>封装:</span>
+            <input type="text" class="form-control" v-model="applyObj.encapsulation"/>
+          </li>
+          <!--<li class="form-item">-->
+          <!--<span>单价预算:</span>-->
+          <!--<select v-model="applyObj.currency" class="form-control" style="width:40px;">-->
+          <!--<option value="RMB">¥</option>-->
+          <!--<option value="USD">$</option>-->
+          <!--</select>-->
+          <!--<input type="number" v-model="applyObj.unitPrice" class="form-control" :class="{'error': !validObj.unitPrice}"/>-->
+          <!--</li>-->
+          <!--<li class="form-item">-->
+          <!--<span>生产日期:</span>-->
+          <!--<input type="text" class="form-control" v-model="applyObj.produceDate"/>-->
+          <!--</li>-->
+          <li class="form-item">
+            <span>采购数量(PCS):</span>
+            <input type="number" class="form-control" v-model="applyObj.amount" :class="{'error': !validObj.amount}"/>
+          </li>
+        </ul>
+      </div>
+      <span slot="footer" class="dialog-footer">
+        <button @click="authorityInterceptor(baseUrls.userPublishSeek, goPublish)">询价提交</button>
+      </span>
+    </el-dialog>
+  </div>
+</template>
+<script>
+  import { seekProduct } from '~utils/mixin'
+  export default {
+    mixins: [seekProduct],
+    props: {
+      showObj: {
+        type: Object,
+        default: function () {
+          return {show: false}
+        }
+      },
+      /*
+      *  spec: '',
+       prodName: '',
+       brand: '',
+       cmpCode: ''
+      * */
+      productItem: {
+        type: Object,
+        default: {}
+      }
+    }
+  }
+</script>
+<style lang="scss">
+  .seek-product {
+    .el-dialog{
+      width: 680px!important;
+      .el-dialog__header{
+        background: #4290f7;
+        line-height: 40px;
+        padding: 0 20px 0;
+        display:block;
+        .el-dialog__title{
+          color:#fff;
+        }
+        .el-dialog__headerbtn:hover .el-dialog__close, .el-dialog__headerbtn:focus .el-dialog__close{
+          color:#fff;
+        }
+      }
+      .el-dialog__body{
+        padding: 10px 20px;
+      }
+      .el-dialog__footer{
+        text-align: center;
+        button{
+          display:inline-block;
+          border:0;
+          box-shadow: none;
+          background: #3c7cf5;
+          color:#fff;
+          font-size: 14px;
+          line-height: 30px;
+          height:30px;
+          padding:0 10px;
+          border-radius:5px;
+        }
+      }
+    }
+    .form_dialog{
+      .el-date-editor--date {
+        width: 230px;
+        &.error {
+          input {
+            border: 1px solid #f4645f !important;
+          }
+        }
+      }
+      ul{
+        li{
+          width:50%;
+          font-size: 14px;
+          color:#666;
+          vertical-align: top;
+          margin-bottom:15px;
+          &.form-item {
+            position: relative;
+            p{
+              margin:0;
+              margin-left:112px;
+              word-break: break-all;
+              word-wrap: break-word;
+            }
+            span {
+              float:left;
+              width: 112px;
+              text-align: right;
+              display: inline-block;
+              color:#3c7cf5;
+              i {
+                position: relative;
+                top: 2px;
+                right: 5px;
+                color: #e41515;
+              }
+            }
+            ul {
+              line-height: normal;
+              position: absolute;
+              top: 19px;
+              left: 79px;
+              background: #fff;
+              border: 1px solid #b5b5b5;
+              z-index: 1;
+              max-height: 120px;
+              overflow-y: auto;
+              overflow-x: hidden;
+              border-radius: 3px;
+              width: 114px;
+              font-size: 12px;
+              li {
+                height: 24px;
+                line-height: 24px;
+                cursor: pointer;
+                overflow: hidden;
+                text-overflow: ellipsis;
+                white-space: nowrap;
+                padding: 0 5px;
+                &:hover {
+                  background: #ddd;
+                }
+              }
+            }
+            select {
+              width: 40px;
+              position: absolute;
+              height: 20px;
+              background: url('/images/applyPurchase/select.png')no-repeat right;
+              background-position-x: 23px;
+              padding: 0 0 0 7px;
+              border-radius: 0;
+              & + input {
+                padding-left: 45px;
+              }
+            }
+            .el-input {
+              width: 198px;
+            }
+            input {
+              font-size: 14px;
+              width: 198px;
+              height: 20px;
+              line-height: 20px;
+              border-radius: 2px;
+              padding: 0 3px;
+              box-shadow: none;
+              -webkit-box-shadow: none;
+              -moz-box-shadow: none;
+              &.error {
+                border-color: #f4645f!important;
+              }
+            }
+          }
+        }
+      }
+    }
+  }
+</style>

+ 2 - 1
components/applyPurchase/index.js

@@ -7,5 +7,6 @@ import ArticleOne from './articleOne'
 import ArticleTwo from './articleTwo'
 import ArticleThree from './articleThree'
 import ArticleFour from './articleFour'
+import SeekProduct from './SeekProduct.vue'
 
-export { ApplyInfo, PublishApply, ApplyFooter, BusinessOpportunities, BatchPublish, ArticleOne, ArticleTwo, ArticleThree, ArticleFour }
+export { ApplyInfo, PublishApply, ApplyFooter, BusinessOpportunities, BatchPublish, ArticleOne, ArticleTwo, ArticleThree, ArticleFour, SeekProduct }

+ 141 - 0
components/search/ForwardGoodsList.vue

@@ -0,0 +1,141 @@
+<template>
+  <div class="forward-goods-list">
+    <table>
+      <thead>
+        <tr>
+          <th width="25%">型号/品牌</th>
+          <th width="25%">卖家名称</th>
+          <th width="25%">物料名称(类目)/单位</th>
+          <th width="15%">规格</th>
+          <th width="15%"></th>
+        </tr>
+      </thead>
+      <tbody>
+        <tr>
+          <td>
+            <div class="line">
+              <span class="title inline-block">原厂型号</span>
+              <span class="content inline-block">asdasdad</span>
+            </div>
+            <div class="line">
+              <span class="title inline-block">品牌</span>
+              <span class="content inline-block">asdasdad</span>
+            </div>
+          </td>
+          <td class="single">
+            <div class="line">
+              <span class="title inline-block">卖家</span>
+              <span class="content inline-block">asdasdad</span>
+            </div>
+          </td>
+          <td>
+            <div class="line">
+              <span class="title inline-block">物料名称(类目)</span>
+              <span class="content inline-block">asdasdad</span>
+            </div>
+            <div class="line">
+              <span class="title inline-block">单位</span>
+              <span class="content inline-block">asdasdad</span>
+            </div>
+          </td>
+          <td class="single">
+            <div class="line">
+              <span class="title inline-block">规格</span>
+              <span class="content inline-block text-ellipse">asdasdad</span>
+            </div>
+          </td>
+          <td><button @click="goSeek()">立即询价</button></td>
+        </tr>
+      </tbody>
+    </table>
+    <seek-product :productItem="productItem" :showObj="showSeekObj"></seek-product>
+  </div>
+</template>
+<script>
+  import { SeekProduct } from '~components/applyPurchase'
+  export default {
+    data () {
+      return {
+        showSeekObj: {
+          show: false
+        },
+        productItem: {}
+      }
+    },
+    components: {
+      SeekProduct
+    },
+    methods: {
+      goSeek: function () {
+        this.showSeekObj.show = true
+      }
+    }
+  }
+</script>
+<style lang="scss" scoped>
+  .forward-goods-list {
+    table {
+      width: 100%;
+      margin: 10px 0 50px;
+      thead tr {
+        background: #f7f7f7;
+        font-size: 14px;
+        color: #333;
+        height: 40px;
+        th {
+          text-align: center;
+        }
+      }
+      tbody tr {
+        &:hover {
+          background: #ecf2fd;
+        }
+        border: 1px solid #e8e8e8;
+        border-bottom: none;
+        &:last-child {
+          border-bottom: 1px solid #e8e8e8;
+        }
+        td {
+          padding: 24px 0;
+          font-size: 12px;
+          &.single {
+            float: left;
+            width: 100%;
+            height: 100%;
+          }
+          .line {
+            margin-top: 24px;
+            &:first-child {
+              margin-top: 0;
+            }
+            .title {
+              color: #2496f1;
+              width: 27%;
+              text-align: right;
+              vertical-align: top;
+            }
+            .content {
+              width: 73%;
+              padding-left: 10px;
+              vertical-align: top;
+              word-break: break-all;
+              color: #666;
+              height: 30px;
+              overflow: hidden;
+            }
+          }
+          button {
+            width: 80px;
+            text-align: center;
+            border-radius: 3px;
+            height: 30px;
+            color: #fff;
+            background: #2e91f0;
+            border: none;
+            outline: none;
+          }
+        }
+      }
+    }
+  }
+</style>

+ 2 - 2
components/search/index.js

@@ -1,6 +1,6 @@
 import GoodList from './GoodList.vue'
 import Kind from './Kind.vue'
 import ResultTitle from './ResultTitle.vue'
-// import ForwardGoodsList from './ForwardGoodsList.vue'
+import ForwardGoodsList from './ForwardGoodsList.vue'
 
-export { GoodList, Kind, ResultTitle }
+export { GoodList, Kind, ResultTitle, ForwardGoodsList }

+ 17 - 8
pages/search/_keyword.vue

@@ -12,16 +12,19 @@
     <span class="inline-block" :class="{active: resultType == 'current'}" @click="setResultType('current')">现货(5条)</span>
     <span class="inline-block" :class="{active: resultType == 'forward'}" @click="setResultType('forward')">期货(5条)</span>
   </div>
-  <good-list @pageEvent="listenPage"
-             @sortEvent="listenSort"
-             @filterPriceEvent="listenPriceFilter"
-             :crname_click_flag="crname_click_flag"
-  ></good-list>
-  <!--<forward-goods-list></forward-goods-list>-->
+  <template v-if="searchType == 'code'">
+    <good-list v-if="resultType === 'current'"
+               @pageEvent="listenPage"
+               @sortEvent="listenSort"
+               @filterPriceEvent="listenPriceFilter"
+               :crname_click_flag="crname_click_flag"
+    ></good-list>
+    <forward-goods-list v-else></forward-goods-list>
+  </template>
 </div>
 </template>
 <script>
-  import { GoodList, ResultTitle } from '~components/search'
+  import { GoodList, ResultTitle, ForwardGoodsList } from '~components/search'
 //  import DetailBrand from '~components/search/DetailBrand.vue'
   export default{
     layout: 'main',
@@ -52,7 +55,8 @@
     },
     components: {
       ResultTitle,
-      GoodList
+      GoodList,
+      ForwardGoodsList
 //      DetailBrand
     },
     watch: {
@@ -64,6 +68,11 @@
         immediate: false
       }
     },
+    computed: {
+      searchType () {
+        return this.$route.query.searchType || 'code'
+      }
+    },
     methods: {
       reloadAll: function () {
         this.filter = {}

+ 122 - 0
utils/mixin.js

@@ -231,3 +231,125 @@ export const goodsPurchaseOperate = {
     }
   }
 }
+
+/*
+* 根据产品发布询价
+* */
+export const seekProduct = {
+  data () {
+    return {
+      applyObj: {
+        unitPrice: '',
+        currency: 'RMB',
+        encapsulation: '',
+        produceDate: '',
+        amount: '',
+        deadline: ''
+      },
+      validObj: {
+        unitPrice: true,
+        amount: true,
+        deadline: true
+      },
+      pickerOptions: {
+        disabledDate (time) {
+          // 大于等于今天 小于三个月后
+          return time.getTime() < Date.now() - 1000 * 60 * 60 * 24 || time.getTime() > Date.now() + 1000 * 60 * 60 * 24 * 30 * 3
+        }
+      },
+      hasDialog: false
+    }
+  },
+  methods: {
+    // 时间格式化
+    setDeadLineValid: function () {
+      this.applyObj.deadline = this.baseUtils.formatDate(this.applyObj.deadline, 'yyyy-MM-dd hh:mm:ss')
+      this.validObj.deadline = true
+    },
+    // 检查单价预算
+    checkUnitPrice () {
+      this.validObj.unitPrice = this.applyObj.unitPrice === '' ? true : this.applyObj.unitPrice > 0 && this.applyObj.unitPrice < 100000000
+      if (!this.validObj.unitPrice && this.applyObj.unitPrice <= 0) {
+        this.$message.error('单价必须是大于0的数字')
+      }
+      return this.validObj.unitPrice
+    },
+    // 检查采购数量
+    checkAmount () {
+      this.validObj.amount = this.applyObj.amount === '' ? true : this.applyObj.amount > 0 && this.applyObj.amount < 1000000000
+      return this.validObj.amount
+    },
+    // 检查时间是否有输入
+    checkDeadline () {
+      this.validObj.deadline = Boolean(this.applyObj.deadline)
+      return this.validObj.deadline
+    },
+    // 检查各个字段输入正常数据
+    checkAll () {
+      return this.checkDeadline() && this.checkUnitPrice() && this.checkAmount()
+    },
+    emptyForm () {
+      for (let attr in this.applyObj) {
+        this.applyObj[attr] = attr === 'currency' ? 'RMB' : ''
+      }
+    },
+    // 请求询价信息
+    goPublish () {
+      // let _this = this
+      // this.isClick = true
+      // setTimeout(function () {
+      //   _this.isClick = false
+      // }, 1000)
+      if (this.checkAll()) {
+        let inquiry = {}
+        let inquiryItem = {}
+        if (this.user.data.enterprise) {
+          inquiry.enUU = this.user.data.enterprise.uu
+        }
+        let date = new Date()
+        let currency = this.applyObj.unitPrice ? this.applyObj.currency : null
+        inquiry.recorderUU = this.user.data.userUU
+        inquiry.code = 'MALL' + date.getTime()
+        inquiry.date = date
+        inquiry.recorder = this.user.data.userName
+        inquiry.endDate = this.applyObj.deadline
+        inquiry.sourceapp = 'MALL'
+        inquiry.amount = 1
+        inquiryItem.userUU = this.user.data.userUU
+        inquiryItem.source = 'MALL'
+        inquiryItem.userName = this.user.data.userName
+        inquiryItem.userTel = this.user.data.userTel
+        inquiryItem.needquantity = this.applyObj.amount
+        inquiryItem.inbrand = this.productItem.brand
+        inquiryItem.currency = currency
+        inquiryItem.cmpCode = this.productItem.cmpCode.toUpperCase()
+        inquiryItem.unitPrice = this.applyObj.unitPrice
+        inquiryItem.produceDate = this.applyObj.produceDate
+        inquiryItem.date = date
+        inquiryItem.endDate = this.applyObj.deadline
+        inquiryItem.encapsulation = this.applyObj.encapsulation
+        inquiryItem.spec = this.productItem.spec
+        inquiryItem.prodTitle = this.productItem.prodName
+        let inquiryItems = []
+        inquiryItems.push(inquiryItem)
+        inquiry.inquiryItems = inquiryItems
+        inquiry.currency = this.applyObj.unitPrice ? this.applyObj.currency : null
+        this.$http.post('/inquiry/buyer/save', inquiry)
+          .then(res => {
+            this.$message.success('发布成功')
+            this.hasDialog = false
+            this.emptyForm()
+          }, error => {
+            console.log(error)
+            this.$message.error('发布失败')
+          })
+      } else {
+        if (!this.validObj.deadline) {
+          this.$message.error('截止日期不能为空')
+        } else if (!this.validObj.amount) {
+          this.$message.error('请输入正确的数值')
+        }
+      }
+    }
+  }
+}