SeekList.vue 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267
  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, user.logged] | enterpriseFilter}}</span>
  7. <span v-else>{{[item.userName, user.logged] | 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, logged]) {
  86. if (logged) {
  87. return str
  88. } else {
  89. return str && str.length > 4 ? str.substring(0, 2) + '**' + str.substring(str.length - 2, str.length) : str || '-'
  90. }
  91. },
  92. userNameFilter ([str, logged]) {
  93. if (logged) {
  94. return str
  95. } else {
  96. return str ? str.substring(0, 1) + '**' : '-'
  97. }
  98. }
  99. },
  100. computed: {
  101. // purchaseManList () {
  102. // return this.$store.state.applyPurchase.purchaseManList.purchaseManList.data
  103. // },
  104. user () {
  105. return this.$store.state.option.user
  106. }
  107. },
  108. methods: {
  109. getDay: function (timeStamp) {
  110. return Math.floor(timeStamp / (1000 * 60 * 60 * 24))
  111. },
  112. getHours: function (timeStamp) {
  113. return Math.floor((timeStamp / (1000 * 60 * 60)) % 24)
  114. },
  115. goSayPrice: function (id, index) {
  116. if (this.user.logged) {
  117. // this.$router.push('/mobile/applyPurchase/sayPrice/' + path)
  118. this.$store.dispatch('applyPurchase/loadPurchaseManDetail', {itemId: id, enuu: this.$store.state.option.user.data.enterprise ? this.$store.state.option.user.data.enterprise.uu : null})
  119. this.showSayPriceBox = true
  120. this.activeIndex = index
  121. } else {
  122. this.showLoginBox = true
  123. }
  124. },
  125. goSayPriceInfo: function (id, agreed, index) {
  126. this.userType === 'buyer' ? this.$store.dispatch('applyPurchase/loadBuyerInquiryDetail', {id: id}) : this.$store.dispatch('applyPurchase/loadVendorInquiryDetail', {id: id})
  127. this.agreed = agreed
  128. this.showSayPriceInfoBox = true
  129. this.activeIndex = index
  130. // '/mobile/applyPurchase/list/' + (userType ? (item.quteId || item.id) + '?type=' + userType : (item.quteId || item.id)) + (userType ? '&' : '?') + 'status=' + item.agreed
  131. },
  132. onSayPriceCancel: function (flag, quteId) {
  133. if (flag) {
  134. this.purchaseManList[this.activeIndex].quoted = 1
  135. this.purchaseManList[this.activeIndex].quteId = quteId
  136. this.onRemind('报价成功')
  137. }
  138. this.showSayPriceBox = false
  139. },
  140. onSayPriceInfoCancel: function (flag) {
  141. if (flag) {
  142. this.purchaseManList[this.activeIndex].agreed = 1
  143. this.onRemind('采纳成功')
  144. }
  145. this.showSayPriceInfoBox = false
  146. },
  147. onRemind: function (str) {
  148. this.remindText = str
  149. this.timeoutCount ++
  150. }
  151. }
  152. }
  153. </script>
  154. <style lang="scss" scoped>
  155. .seek-list {
  156. width: 7.26rem;
  157. margin: .13rem auto 0;
  158. li {
  159. border: 1px solid #e0e0e4;
  160. height: 3.32rem;
  161. margin-bottom: .2rem;
  162. > p {
  163. font-size: .32rem;
  164. color: #3a3a3a;
  165. background: #f8f7fa;
  166. height: .92rem;
  167. line-height: .92rem;
  168. span {
  169. display: block;
  170. width: 6.9rem;
  171. border-bottom: 1px dashed #9f9f9f;
  172. margin: 0 auto;
  173. }
  174. }
  175. > div {
  176. font-size: .3rem;
  177. display: inline-block;
  178. .fl {
  179. color: #666;
  180. width: 4.8rem;
  181. height: 1.74rem;
  182. margin: .27rem 0 .29rem .18rem;
  183. line-height: .46rem;
  184. border-right: 1px dashed #9f9f9f;
  185. > div {
  186. overflow: hidden;
  187. text-overflow: ellipsis;
  188. white-space: nowrap;
  189. span {
  190. color: #333;
  191. &.date {
  192. color: #e6353d;
  193. }
  194. }
  195. }
  196. }
  197. .fr {
  198. width: 2.2rem;
  199. padding: .66rem 0 0 0;
  200. p {
  201. font-size: .28rem;
  202. text-align: center;
  203. &.over-deadline {
  204. text-align: center;
  205. padding-right: .2rem;
  206. }
  207. span {
  208. font-size: .35rem;
  209. color: #ff3208;
  210. }
  211. i {
  212. font-style: normal;
  213. }
  214. }
  215. a {
  216. display: block;
  217. width: 1.64rem;
  218. height: .58rem;
  219. line-height: .58rem;
  220. text-align: center;
  221. font-size: .32rem;
  222. color: #e62f36;
  223. border: 1px solid #ea494f;
  224. margin: .34rem auto 0;
  225. border-radius: .06rem;
  226. &.self-publish {
  227. background: rgb(204, 203, 203);
  228. color: #fff;
  229. border-color: #fff;
  230. }
  231. }
  232. }
  233. }
  234. }
  235. }
  236. .none-state {
  237. text-align: center;
  238. margin-top: 1.1rem;
  239. img {
  240. width: 4.08rem;
  241. height: 2.62rem;
  242. }
  243. p {
  244. font-size: .32rem;
  245. color: #999;
  246. margin: 1.19rem 0 0 0;
  247. }
  248. }
  249. </style>