| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565 |
- <template>
- <div class="apply-info">
- <div class="apply-info-title">
- <p>最新求购信息</p>
- <span>海量求购,一网打尽</span>
- <div>
- <input type="text" class="form-control" v-model="keyWord" @keyup.13="searchList" placeholder="请输入要查找的内容" />
- <span @click="searchList">查询</span>
- </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>
- </span>
- <span>买家</span>
- <span>型号</span>
- <span>品牌</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>
- <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>
- <span>操作</span>
- </p>
- <ul>
- <li v-for="purchaseMan in purchaseManList.content" :class="{'active': purchaseMan.active}">
- <span>{{purchaseMan.releaseDate | date}}</span>
- <span :title="getPurchaseManName(purchaseMan)">{{getPurchaseManName(purchaseMan)}}</span>
- <span :title="purchaseMan.code">{{purchaseMan.code}}</span>
- <span :title="purchaseMan.brand">{{purchaseMan.brand}}</span>
- <span class="date-content"><span>剩余 </span><span v-text="getDay(purchaseMan.remainingTime)"></span> 天 <span v-text="getHours(purchaseMan.remainingTime)"></span> 小时</span>
- <span 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> 条</span>
- <span class="btn-content">
- <a>联系买家</a>
- <a @click="sayPrice(purchaseMan)">我要报价</a>
- </span>
- <div class="expand-content">
- <div>
- 生产日期:{{purchaseMan.produceDate || '-'}}
- </div>
- <div>
- 封装:{{purchaseMan.encapsulation || '-'}}
- </div>
- <div>
- 采购数量:<span>{{purchaseMan.amount || '-'}}</span><span v-if="purchaseMan.amount">个</span>
- </div>
- <div>
- 单价预算:<span>{{purchaseMan.unitPrice ? (purchaseMan.currency == 'RMB' ? '¥' : '$') + purchaseMan.unitPrice : '-'}}</span>
- </div>
- </div>
- <div class="say-price">
- <div>报价</div>
- <div>
- <i>*</i>单价
- <!-- <select v-model="sayPriceObj.currency">
- <option value="RMB">¥</option>
- <option value="USD">$</option>
- </select>-->
- <div v-text="purchaseMan.currency == 'RMB' ? '¥' : '$'"></div>
- <input type="text" v-model="sayPriceObj.unitPrice" class="form-control">
- </div>
- <div>
- <i>*</i>交期
- <input type="number" v-model="sayPriceObj.minDay" @blur="onMinDayInput" class="form-control"> - <input type="number" v-model="sayPriceObj.maxDay" @blur="onMaxDayInput" class="form-control"> 天
- </div>
- <div>
- 生产日期 <input v-model="sayPriceObj.produceDate" type="text" class="form-control">
- </div>
- <div>
- <span @click="cancelSayPrice(purchaseMan)">取消</span>
- <span @click="commitSayPrice(purchaseMan)">提交</span>
- </div>
- </div>
- </li>
- </ul>
- </div>
- <page :total="totalCount" :page-size="pageSize"
- :current="nowPage" v-on:childEvent="listenPage"></page>
- </div>
- </template>
- <script>
- import Page from '~components/common/page/pageComponent.vue'
- export default {
- data () {
- return {
- pageSize: 10,
- nowPage: 1,
- sayPriceObj: {
- currency: 'RMB',
- unitPrice: '',
- minDay: '',
- maxDay: '',
- produceDate: '',
- spId: ''
- },
- keyWord: '',
- sorting: {}
- }
- },
- components: {
- Page
- },
- filters: {
- date: function (date) {
- const d = new Date(Number(date))
- const year = d.getFullYear()
- const monthTemp = d.getMonth() + 1
- const month = monthTemp < 10 ? '0' + monthTemp : '' + monthTemp
- const hour = d.getHours() < 10 ? '0' + d.getHours() : '' + d.getHours()
- const minutes = d.getMinutes() < 10 ? '0' + d.getMinutes() : '' + d.getMinutes() + ' '
- const day = d.getDate() < 10 ? '0' + d.getDate() : '' + d.getDate() + ' '
- return year + '-' + month + '-' + day + ' ' + hour + ':' + minutes
- },
- phone: function (str) {
- return str.substring(0, 3) + '****' + str.substring(7, 11)
- }
- },
- computed: {
- purchaseManList () {
- return this.$store.state.applyPurchase.purchaseManList.purchaseManList.data
- },
- totalCount () {
- return this.purchaseManList.totalElements
- },
- user () {
- return this.$store.state.option.user
- }
- },
- methods: {
- getDay: function (timeStamp) {
- return Math.floor(timeStamp / (1000 * 60 * 60 * 24))
- },
- getHours: function (timeStamp) {
- return Math.floor((timeStamp / (1000 * 60 * 60)) % 24)
- },
- getPurchaseManName: function (purchaseMan) {
- return purchaseMan.enUu ? purchaseMan.userName : purchaseMan.userName.charAt(0) + '**'
- },
- listenPage: function (page) {
- this.nowPage = page
- this.resetList()
- },
- sayPrice: function (purchaseMan) {
- let _this = this
- for (let i = 0; i < this.purchaseManList.content.length; i++) {
- _this.purchaseManList.content[i].active = false
- }
- purchaseMan.active = true
- },
- cancelSayPrice: function (purchaseMan) {
- purchaseMan.active = false
- },
- commitSayPrice: function (purchaseMan) {
- if (this.user.logged) {
- let valid = this.sayPriceObj.currency && this.sayPriceObj.unitPrice && this.sayPriceObj.minDay && this.sayPriceObj.maxDay
- if (valid) {
- this.sayPriceObj.spId = purchaseMan.id
- this.sayPriceObj.currency = purchaseMan.currency
- this.$http.post('/seek/offer/saveOffer', this.sayPriceObj).then(response => {
- this.$message.success('报价成功')
- this.nowPage = 1
- this.resetSayPrice()
- this.resetList()
- }, error => {
- console.log(error)
- this.$message.error('系统错误')
- })
- } else {
- this.$message.error('请填写正确的信息')
- }
- } else {
- this.$router.push('/auth/login')
- }
- },
- resetList: function () {
- this.$store.dispatch('applyPurchase/loadPurchaseManList', {page: this.nowPage, count: this.pageSize, keyWord: this.keyWord, sorting: !this.sorting || JSON.stringify(this.sorting) === '{}' ? {releaseDate: 'DESC'} : this.sorting})
- },
- resetSayPrice: function () {
- this.sayPriceObj = {
- currency: 'RMB',
- unitPrice: '',
- minDay: '',
- maxDay: '',
- produceDate: '',
- spId: ''
- }
- },
- onMinDayInput: function () {
- this.sayPriceObj.minDay = Math.floor(this.sayPriceObj.minDay)
- if (this.sayPriceObj.maxDay) {
- if (this.sayPriceObj.maxDay < this.sayPriceObj.minDay) {
- this.sayPriceObj.minDay = this.sayPriceObj.maxDay
- }
- } else if (this.sayPriceObj.minDay < 0) {
- this.sayPriceObj.minDay = 0
- }
- },
- onMaxDayInput: function () {
- this.sayPriceObj.maxDay = Math.floor(this.sayPriceObj.maxDay)
- if (this.sayPriceObj.minDay) {
- if (this.sayPriceObj.maxDay < this.sayPriceObj.minDay) {
- this.sayPriceObj.maxDay = this.sayPriceObj.minDay
- }
- } else if (this.sayPriceObj.maxDay < 0) {
- this.sayPriceObj.maxDay = 0
- }
- },
- searchList: function () {
- this.resetList()
- },
- sortListByParam: function (param) {
- if (this.sorting[param]) {
- if (this.sorting[param] === 'ASC') {
- this.$set(this.sorting, param, 'DESC')
- } else {
- this.$delete(this.sorting, param)
- }
- } else {
- this.sorting = {}
- this.$set(this.sorting, param, 'ASC')
- }
- this.resetList()
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .apply-info {
- width: 1190px;
- margin: 0 auto;
- .apply-info-title {
- border-bottom: 1px solid #3975f4;
- >p {
- display: inline-block;
- width: 156px;
- height: 33px;
- line-height: 33px;
- color: #fff;
- background: #3975f4;
- font-size: 18px;
- text-align: center;
- border: {
- top-left-radius: 3px;
- top-right-radius: 3px;
- }
- margin: 0;
- }
- >span {
- color: #999;
- margin-left: 16px;
- }
- >div {
- float: right;
- height: 25px;
- line-height: 25px;
- >input {
- width: 241px;
- height: 25px;
- line-height: 25px;
- font-size: 13px;
- border: {
- top-right-radius: 0;
- bottom-right-radius: 0;
- }
- }
- >span {
- display: inline-block;
- width: 69px;
- color: #fff;
- background: #3975f4;
- text-align: center;
- margin: 0 6px 0 -1px;
- border: {
- top-right-radius: 3px;
- bottom-right-radius: 3px;
- }
- cursor: pointer;
- }
- >a {
- background: #ffa200;
- color: #fff;
- width: 79px;
- border-radius: 3px;
- text-align: center;
- display: inline-block;
- }
- }
- }
- .apply-info-list {
- >p {
- background: #ededed;
- height: 40px;
- line-height: 40px;
- margin: 9px 0 0 0;
- span {
- display: inline-block;
- text-align: center;
- a {
- i {
- color: #333;
- &.active {
- color: #5078cb;
- }
- }
- }
- &: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: 214px;
- }
- }
- }
- >ul {
- margin-bottom: 29px;
- li {
- min-height: 67px;
- line-height: 67px;
- border: 1px solid #ededed;
- >span {
- overflow: hidden;
- text-overflow: ellipsis;
- white-space: nowrap;
- display: inline-block;
- text-align: center;
- color: #3c3c3c;
- 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: 212px;
- }
- &.date-content {
- span {
- &:first-child {
- font-size: 12px;
- color: #666;
- }
- color: #f71026;
- }
- }
- &.number-content {
- span {
- color: #5392f9;
- &.active {
- color: #ff9a00;
- }
- }
- >img {
- margin-bottom: 5px;
- margin-right: 2px;
- }
- }
- &.btn-content {
- a {
- display: inline-block;
- width: 71px;
- height: 28px;
- line-height: 28px;
- color: #fff;
- background: #3c7cf5;
- border-radius: 3px;
- cursor: pointer;
- &:first-child {
- background: #ffa200;
- margin-right: 10px;
- }
- }
- }
- }
- .expand-content {
- display: none;
- justify-content: space-between;
- padding: 0 236px 0 36px;
- background: #fffbf0;
- height: 45px;
- line-height: 45px;
- color: #020202;
- div {
- display: inline-block;
- span {
- color: #f71026;
- }
- }
- }
- &:hover {
- box-shadow: 1.5px 3px 7px 0 rgb( 178, 178, 179 );
- .expand-content {
- display: flex;
- }
- }
- .say-price {
- background-color: #e7eef9;
- 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: 3px;
- & + 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;
- }
- }
- }
- &:nth-child(3) {
- margin-right: 37px;
- input {
- width: 32px;
- height: 26px;
- }
- }
- &:nth-child(4) {
- margin-right: 132px;
- input {
- width: 118px;
- height: 26px;
- }
- }
- &:nth-child(5) {
- span {
- width: 71px;
- height: 28px;
- line-height: 28px;
- text-align: center;
- display: inline-block;
- cursor: pointer;
- &:first-child {
- background: #dedddd;
- margin-right: 10px;
- }
- &:last-child {
- background: #fa4701;
- color: #fff;
- }
- }
- }
- i {
- color: #e41515;
- position: relative;
- top: 2px;
- right: 3px;
- }
- }
- }
- &.active {
- border-color: #f71026;
- box-shadow: none;
- .expand-content {
- display: flex;
- -webkit-box-shadow: none;
- -moz-box-shadow: none;
- box-shadow: none;
- }
- .say-price {
- display: block;
- }
- }
- }
- }
- }
- .page-wrap {
- text-align: right;
- float: none;
- }
- }
- </style>
|