SeekList.vue 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248
  1. <template>
  2. <div>
  3. <ul class="seek-list">
  4. <li v-for="(item, index) in purchaseManList">
  5. <p>
  6. <span v-if="item.inquiry.enterprise && item.inquiry.enterprise.enName">{{item.inquiry.enterprise.enName | enterpriseFilter}}</span>
  7. <span v-else>{{item.userName | userNameFilter}}</span>
  8. </p>
  9. <div>
  10. <div class="fl">
  11. <div>
  12. 品牌:<span>{{item.cmpCode || '-'}}</span>
  13. </div>
  14. <div>
  15. 型号:<span>{{item.inbrand || '-'}}</span>
  16. </div>
  17. <div>
  18. 规格:<span>{{item.spec || '-'}}</span>
  19. </div>
  20. <div>
  21. 截止日期:<span class="date">{{item.endDate | date}}</span>
  22. </div>
  23. </div>
  24. <div class="fr">
  25. <p v-if="item.remainingTime > 0">剩余&nbsp;:
  26. <span v-if="getDay(item.remainingTime) > 0" v-text="getDay(item.remainingTime)"></span>
  27. <i v-if="getDay(item.remainingTime) > 0">&nbsp;天&nbsp;</i>
  28. <span v-if="getDay(item.remainingTime) <= 0" v-text="getHours(item.remainingTime)"></span>
  29. <i v-if="getDay(item.remainingTime) <= 0" >&nbsp;小时</i>
  30. </p>
  31. <p v-else>已截止</p>
  32. <!--<a v-if="!userType && item.quoted == 1">已报价</a>-->
  33. <!--<a v-if="!userType && item.remainingTime > 0 && (!item.quoted || item.quoted != 1) && (user.logged && ((item.inquiry.enterprise && user.data.enterprise && (item.inquiry.enterprise.uu === user.data.enterprise.uu)) || (!user.data.enterprise.uu && item.userUU == user.data.userUU && !item.inquiry.enterprise)))">自己发布的</a>-->
  34. <a v-if="!(userType == 'saler' && seekType && seekType != 'wait') && (item.remainingTime > 0 && (!item.quoted || item.quoted != 1) && !(user.logged && ((item.inquiry.enterprise && user.data.enterprise && (item.inquiry.enterprise.uu === user.data.enterprise.uu)) || (!user.data.enterprise.uu && item.userUU == user.data.userUU && !item.inquiry.enterprise))))" @click="goSayPrice(item.id, index)">我要报价</a>
  35. <a v-if="((!userType || userType == 'buyer') && (seekType && seekType != 'wait')) || (userType == 'saler' && seekType && seekType != 'wait') || item.quoted == 1" @click="goSayPriceInfo(item.quteId || item.id, item.agreed)">查看报价</a>
  36. </div>
  37. </div>
  38. </li>
  39. </ul>
  40. <div class="none-state" v-if="!purchaseManList || !purchaseManList.length && !isDataChange">
  41. <img src="/images/mobile/@2x/car@2x.png">
  42. <p v-text="'抱歉,暂无求购信息'"></p>
  43. </div>
  44. <login-box @onLoginBoxClose="showLoginBox = false" v-if="showLoginBox"></login-box>
  45. <say-price v-if="showSayPriceBox" @cancelSayPriceAction="onSayPriceCancel"></say-price>
  46. <say-price-info v-if="showSayPriceInfoBox" :agreed="agreed" @cancelSayPriceInfoAction="onSayPriceInfoCancel"></say-price-info>
  47. <remind-box :title="remindText" :timeoutCount="timeoutCount"></remind-box>
  48. </div>
  49. </template>
  50. <script>
  51. import {LoginBox, RemindBox} from '~components/mobile/common'
  52. import {SayPrice, SayPriceInfo} from '~components/mobile'
  53. export default {
  54. components: {
  55. LoginBox,
  56. SayPrice,
  57. RemindBox,
  58. SayPriceInfo
  59. },
  60. data () {
  61. return {
  62. showLoginBox: false,
  63. showSayPriceBox: false,
  64. showSayPriceInfoBox: false,
  65. activeIndex: -1,
  66. remindText: '',
  67. timeoutCount: 0,
  68. agreed: 0
  69. }
  70. },
  71. props: ['userType', 'seekType', 'purchaseManList', 'isDataChange'],
  72. filters: {
  73. date: function (date) {
  74. if (date) {
  75. const d = new Date(Number(date))
  76. const year = d.getFullYear()
  77. const monthTemp = d.getMonth() + 1
  78. const month = monthTemp < 10 ? '0' + monthTemp : '' + monthTemp
  79. const day = d.getDate() < 10 ? '0' + d.getDate() : '' + d.getDate() + ' '
  80. return year + '-' + month + '-' + day
  81. } else {
  82. return '-'
  83. }
  84. },
  85. enterpriseFilter (str) {
  86. return str && str.length > 4 ? str.substring(0, 2) + '**' + str.substring(str.length - 2, str.length) : str || '-'
  87. },
  88. userNameFilter (str) {
  89. return str ? str.substring(0, 1) + '**' : '-'
  90. }
  91. },
  92. computed: {
  93. // purchaseManList () {
  94. // return this.$store.state.applyPurchase.purchaseManList.purchaseManList.data
  95. // },
  96. user () {
  97. return this.$store.state.option.user
  98. }
  99. },
  100. methods: {
  101. getDay: function (timeStamp) {
  102. return Math.floor(timeStamp / (1000 * 60 * 60 * 24))
  103. },
  104. getHours: function (timeStamp) {
  105. return Math.floor((timeStamp / (1000 * 60 * 60)) % 24)
  106. },
  107. goSayPrice: function (id, index) {
  108. if (this.user.logged) {
  109. // this.$router.push('/mobile/applyPurchase/sayPrice/' + path)
  110. this.$store.dispatch('applyPurchase/loadPurchaseManDetail', {itemId: id, enuu: this.$store.state.option.user.data.enterprise ? this.$store.state.option.user.data.enterprise.uu : null})
  111. this.showSayPriceBox = true
  112. this.activeIndex = index
  113. } else {
  114. this.showLoginBox = true
  115. }
  116. },
  117. goSayPriceInfo: function (id, agreed) {
  118. this.userType === 'buyer' ? this.$store.dispatch('applyPurchase/loadBuyerInquiryDetail', {id: id}) : this.$store.dispatch('applyPurchase/loadVendorInquiryDetail', {id: id})
  119. this.agreed = agreed
  120. this.showSayPriceInfoBox = true
  121. // '/mobile/applyPurchase/list/' + (userType ? (item.quteId || item.id) + '?type=' + userType : (item.quteId || item.id)) + (userType ? '&' : '?') + 'status=' + item.agreed
  122. },
  123. onSayPriceCancel: function (flag, quteId) {
  124. if (flag) {
  125. this.purchaseManList[this.activeIndex].quoted = 1
  126. this.purchaseManList[this.activeIndex].quteId = quteId
  127. this.onRemind('报价成功')
  128. }
  129. this.showSayPriceBox = false
  130. },
  131. onSayPriceInfoCancel: function (flag) {
  132. if (flag) {
  133. this.onRemind('采纳成功')
  134. }
  135. this.showSayPriceInfoBox = false
  136. },
  137. onRemind: function (str) {
  138. this.remindText = str
  139. this.timeoutCount ++
  140. }
  141. }
  142. }
  143. </script>
  144. <style lang="scss" scoped>
  145. .seek-list {
  146. width: 7.26rem;
  147. margin: .13rem auto 0;
  148. li {
  149. border: .04rem solid #e0e0e4;
  150. height: 3.32rem;
  151. margin-bottom: .2rem;
  152. >
  153. p {
  154. font-size: .32rem;
  155. color: #3a3a3a;
  156. background: #f8f7fa;
  157. height: .92rem;
  158. line-height: .92rem;
  159. span {
  160. display: block;
  161. width: 6.9rem;
  162. border-bottom: .04rem dashed #9f9f9f;
  163. margin: 0 auto;
  164. }
  165. }
  166. >
  167. div {
  168. font-size: .3rem;
  169. display: inline-block;
  170. .fl {
  171. color: #666;
  172. width: 4.8rem;
  173. height: 1.74rem;
  174. margin: .27rem 0 .29rem .18rem;
  175. line-height: .46rem;
  176. border-right: .04rem dashed #9f9f9f;
  177. > div {
  178. overflow: hidden;
  179. text-overflow: ellipsis;
  180. white-space: nowrap;
  181. span {
  182. color: #333;
  183. &.date {
  184. color: #e6353d;
  185. }
  186. }
  187. }
  188. }
  189. .fr {
  190. width: 2.2rem;
  191. padding: .66rem 0 0 .2rem;
  192. p {
  193. font-size: .28rem;
  194. span {
  195. font-size: .35rem;
  196. color: #ff3208;
  197. }
  198. i {
  199. font-style: normal;
  200. }
  201. }
  202. a {
  203. display: block;
  204. width: 1.64rem;
  205. height: .58rem;
  206. line-height: .58rem;
  207. text-align: center;
  208. font-size: .32rem;
  209. color: #e62f36;
  210. border: .02rem solid #ea494f;
  211. margin-top: .34rem;
  212. border-radius: .06rem;
  213. }
  214. }
  215. }
  216. }
  217. }
  218. .none-state {
  219. text-align: center;
  220. margin-top: 1.1rem;
  221. img {
  222. width: 4.08rem;
  223. height: 2.62rem;
  224. }
  225. p {
  226. font-size: .32rem;
  227. color: #999;
  228. margin: 1.19rem 0 0 0;
  229. }
  230. }
  231. </style>