|
|
@@ -5,44 +5,146 @@
|
|
|
<div class="publish-seek">
|
|
|
<div class="content-line">
|
|
|
<span><i>*</i>型号:</span>
|
|
|
- <input type="text" placeholder="请勿填中文符号">
|
|
|
+ <input type="text" v-model="applyObj.code" placeholder="请勿填中文符号">
|
|
|
</div>
|
|
|
<div class="content-line">
|
|
|
<span><i>*</i>品牌:</span>
|
|
|
- <input type="text" placeholder="请勿填中文符号">
|
|
|
+ <input type="text" v-model="applyObj.brand" placeholder="请勿填中文符号">
|
|
|
</div>
|
|
|
<div class="content-line">
|
|
|
<span><i>*</i>截止日期:</span>
|
|
|
- <input type="text" placeholder="请勿填中文符号">
|
|
|
+ <input type="text" v-model="applyObj.deadline" @blur="formatDeadLine" placeholder="如2017-02-11">
|
|
|
</div>
|
|
|
<div class="content-line">
|
|
|
<span>币种:</span>
|
|
|
- <a href="">RMB </a>
|
|
|
- <ul>
|
|
|
- <li>不限</li>
|
|
|
- <li>RMB</li>
|
|
|
- <li>USD</li>
|
|
|
+ <a v-text="applyObj.currency" @click="showCurrencyList = !showCurrencyList"></a>
|
|
|
+ <img v-if="!showCurrencyList" src="/images/mobile/@2x/applyPurchase/currency-arrow-down.png" alt="">
|
|
|
+ <img v-if="showCurrencyList" src="/images/mobile/@2x/applyPurchase/currency-arrow-up.png" alt="">
|
|
|
+ <ul v-if="showCurrencyList">
|
|
|
+ <li @click="setCurrency('RMB')">RMB</li>
|
|
|
+ <li @click="setCurrency('USD')">USD</li>
|
|
|
</ul>
|
|
|
</div>
|
|
|
<div class="content-line">
|
|
|
<span>数量:</span>
|
|
|
- <input type="text">
|
|
|
+ <input type="text" v-model="applyObj.amount">
|
|
|
</div>
|
|
|
<div class="content-line">
|
|
|
- <span>规格:</span>
|
|
|
- <input type="text">
|
|
|
+ <span>生产日期:</span>
|
|
|
+ <input type="text" v-model="applyObj.produceDate">
|
|
|
</div>
|
|
|
- <a>确认发布</a>
|
|
|
+ <a @click="goPublish">确认发布</a>
|
|
|
</div>
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
|
<script>
|
|
|
+ let formatDate = function (date, fmt) {
|
|
|
+ if (typeof date === 'string') {
|
|
|
+ date = new Date(Date.parse(date.replace(/-/g, '/')))
|
|
|
+ }
|
|
|
+ let o = {
|
|
|
+ 'M+': date.getMonth() + 1, // 月份
|
|
|
+ 'd+': date.getDate(), // 日
|
|
|
+ 'h+': 23, // 小时
|
|
|
+ 'm+': 59, // 分
|
|
|
+ 's+': 59, // 秒
|
|
|
+ 'q+': Math.floor((date.getMonth() + 3) / 3), // 季度
|
|
|
+ 'S': date.getMilliseconds() // 毫秒
|
|
|
+ }
|
|
|
+ if (/(y+)/.test(fmt)) {
|
|
|
+ fmt = fmt.replace(RegExp.$1, (date.getFullYear() + '').substr(4 - RegExp.$1.length))
|
|
|
+ }
|
|
|
+ for (let k in o) {
|
|
|
+ if (new RegExp('(' + k + ')').test(fmt)) {
|
|
|
+ fmt = fmt.replace(RegExp.$1, (RegExp.$1.length === 1) ? (o[k]) : (('00' + o[k]).substr(('' + o[k]).length)))
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return fmt
|
|
|
+ }
|
|
|
export default {
|
|
|
props: ['showSayPriceBox'],
|
|
|
+ data () {
|
|
|
+ return {
|
|
|
+ applyObj: {
|
|
|
+ code: '',
|
|
|
+ brand: '',
|
|
|
+ unitPrice: '',
|
|
|
+ currency: 'RMB',
|
|
|
+ encapsulation: '',
|
|
|
+ produceDate: '',
|
|
|
+ amount: '',
|
|
|
+ deadline: ''
|
|
|
+ },
|
|
|
+ showCurrencyList: false
|
|
|
+ }
|
|
|
+ },
|
|
|
+ computed: {
|
|
|
+ user () {
|
|
|
+ return this.$store.state.option.user
|
|
|
+ }
|
|
|
+ },
|
|
|
methods: {
|
|
|
cancel: function () {
|
|
|
this.$emit('cancelAction')
|
|
|
+ },
|
|
|
+ emptyForm: function () {
|
|
|
+ for (let attr in this.applyObj) {
|
|
|
+ this.applyObj[attr] = attr === 'currency' ? 'RMB' : ''
|
|
|
+ }
|
|
|
+ },
|
|
|
+ goPublish: function () {
|
|
|
+ let inquiry = {}
|
|
|
+ let inquiryItem = {}
|
|
|
+ if (this.user.data.enterprise) {
|
|
|
+ inquiry.enUU = this.user.data.enterprise.uu
|
|
|
+ }
|
|
|
+ let date = new Date()
|
|
|
+ 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.prodTitle = this.applyObj.code
|
|
|
+ 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.applyObj.brand
|
|
|
+ inquiryItem.currency = this.applyObj.unitPrice ? this.applyObj.currency : null
|
|
|
+ inquiryItem.cmpCode = (this.applyObj.code).toUpperCase()
|
|
|
+ inquiryItem.unitPrice = this.applyObj.unitPrice
|
|
|
+ inquiryItem.produceDate = this.applyObj.produceDate
|
|
|
+ inquiryItem.date = date
|
|
|
+ inquiryItem.endDate = this.applyObj.deadline
|
|
|
+ inquiryItem.encapsulation = this.applyObj.encapsulation
|
|
|
+ let inquiryItems = []
|
|
|
+ inquiryItems.push(inquiryItem)
|
|
|
+ inquiry.inquiryItems = inquiryItems
|
|
|
+ this.$http.post('/inquiry/buyer/save', inquiry)
|
|
|
+ .then(response => {
|
|
|
+ this.$message.success('发布成功')
|
|
|
+// this.showRemindBox = true
|
|
|
+ this.emptyForm()
|
|
|
+// this.validObj.deadline = true
|
|
|
+ this.$emit('reloadAction')
|
|
|
+ this.cancel()
|
|
|
+ }, error => {
|
|
|
+ console.log(error)
|
|
|
+ this.$message.error('发布失败')
|
|
|
+ })
|
|
|
+ },
|
|
|
+ formatDeadLine: function () {
|
|
|
+ if (this.applyObj.deadline) {
|
|
|
+ this.applyObj.deadline = formatDate(this.applyObj.deadline, 'yyyy-MM-dd hh:mm:ss')
|
|
|
+ }
|
|
|
+ },
|
|
|
+ setCurrency: function (type) {
|
|
|
+ this.applyObj.currency = type
|
|
|
+ this.showCurrencyList = false
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -81,6 +183,11 @@
|
|
|
font-size: .26rem;
|
|
|
color: #666;
|
|
|
}
|
|
|
+ > img {
|
|
|
+ width: .12rem;
|
|
|
+ height: .06rem;
|
|
|
+ margin-left: .04rem;
|
|
|
+ }
|
|
|
> ul {
|
|
|
position: absolute;
|
|
|
top: .6rem;
|