SeekList.vue 8.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259
  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 class="over-deadline" 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)))" class="self-publish" @click="onRemind('此为贵公司的求购')">我要报价</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, index)">查看报价</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 :showSayPriceBox="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/applyPurchase'
  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, index) {
  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. this.activeIndex = index
  122. // '/mobile/applyPurchase/list/' + (userType ? (item.quteId || item.id) + '?type=' + userType : (item.quteId || item.id)) + (userType ? '&' : '?') + 'status=' + item.agreed
  123. },
  124. onSayPriceCancel: function (flag, quteId) {
  125. if (flag) {
  126. this.purchaseManList[this.activeIndex].quoted = 1
  127. this.purchaseManList[this.activeIndex].quteId = quteId
  128. this.onRemind('报价成功')
  129. }
  130. this.showSayPriceBox = false
  131. },
  132. onSayPriceInfoCancel: function (flag) {
  133. if (flag) {
  134. this.purchaseManList[this.activeIndex].agreed = 1
  135. this.onRemind('采纳成功')
  136. }
  137. this.showSayPriceInfoBox = false
  138. },
  139. onRemind: function (str) {
  140. this.remindText = str
  141. this.timeoutCount ++
  142. }
  143. }
  144. }
  145. </script>
  146. <style lang="scss" scoped>
  147. .seek-list {
  148. width: 7.26rem;
  149. margin: .13rem auto 0;
  150. li {
  151. border: 1px solid #e0e0e4;
  152. height: 3.32rem;
  153. margin-bottom: .2rem;
  154. > p {
  155. font-size: .32rem;
  156. color: #3a3a3a;
  157. background: #f8f7fa;
  158. height: .92rem;
  159. line-height: .92rem;
  160. span {
  161. display: block;
  162. width: 6.9rem;
  163. border-bottom: 1px dashed #9f9f9f;
  164. margin: 0 auto;
  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: 1px 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. text-align: left;
  195. &.over-deadline {
  196. text-align: center;
  197. padding-right: .2rem;
  198. }
  199. span {
  200. font-size: .35rem;
  201. color: #ff3208;
  202. }
  203. i {
  204. font-style: normal;
  205. }
  206. }
  207. a {
  208. display: block;
  209. width: 1.64rem;
  210. height: .58rem;
  211. line-height: .58rem;
  212. text-align: center;
  213. font-size: .32rem;
  214. color: #e62f36;
  215. border: 1px solid #ea494f;
  216. margin-top: .34rem;
  217. border-radius: .06rem;
  218. &.self-publish {
  219. background: rgb(204, 203, 203);
  220. color: #fff;
  221. border-color: #fff;
  222. }
  223. }
  224. }
  225. }
  226. }
  227. }
  228. .none-state {
  229. text-align: center;
  230. margin-top: 1.1rem;
  231. img {
  232. width: 4.08rem;
  233. height: 2.62rem;
  234. }
  235. p {
  236. font-size: .32rem;
  237. color: #999;
  238. margin: 1.19rem 0 0 0;
  239. }
  240. }
  241. </style>