SeekList.vue 9.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311
  1. <template>
  2. <div>
  3. <ul class="seek-list">
  4. <li v-for="(item, index) in purchaseManListData">
  5. <p>
  6. <span v-if="item.inquiry && 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. 类目(产品名称):
  13. <span>{{item.prodTitle || '-'}}</span>
  14. </div>
  15. <div>
  16. 型号:
  17. <span>{{item.cmpCode || '-'}}</span>
  18. </div>
  19. <div>
  20. 品牌:
  21. <span>{{item.inbrand || '-'}}</span>
  22. </div>
  23. <div>
  24. 规格:
  25. <span>{{item.spec || '-'}}</span>
  26. </div>
  27. <div>
  28. 采购数量:
  29. <span>{{item.needquantity || '-'}}</span>
  30. </div>
  31. <div>
  32. 截止日期:
  33. <span class="date">{{item.endDate | date}}</span>
  34. </div>
  35. </div>
  36. <div class="fr">
  37. <p v-if="item.remainingTime > 0">剩余&nbsp;:
  38. <span v-if="getDay(item.remainingTime) > 0" v-text="getDay(item.remainingTime)"></span>
  39. <i v-if="getDay(item.remainingTime) > 0">&nbsp;天&nbsp;</i>
  40. <span v-if="getDay(item.remainingTime) <= 0" v-text="getHours(item.remainingTime)"></span>
  41. <i v-if="getDay(item.remainingTime) <= 0">&nbsp;小时</i>
  42. </p>
  43. <p class="over-deadline" v-else>已截止</p>
  44. <!--<a v-if="!userType && item.quoted == 1">已报价</a>-->
  45. <a v-if="!userType && item.remainingTime > 0 && (!item.quoted || item.quoted != 1) && (user.logged && ((item.inquiry && 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>
  46. <a v-if="!(userType == 'saler' && seekType && seekType != 'wait') && (item.remainingTime > 0 && (!item.quoted || item.quoted != 1) && !(user.logged && ((item.inquiry && item.inquiry.enterprise && user.data.enterprise && (item.inquiry.enterprise.uu === user.data.enterprise.uu)) || (!user.data.enterprise.uu && item.userUU == user.data.userUU))))" @click="goSayPrice(item.id, index)">我要报价</a>
  47. <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>
  48. </div>
  49. </div>
  50. </li>
  51. </ul>
  52. <div class="none-state" v-if="!purchaseManListData || !purchaseManListData.length && !isDataChange">
  53. <img src="/images/mobile/@2x/car@2x.png">
  54. <p v-text="'抱歉,暂无求购信息'"></p>
  55. </div>
  56. <login-box @onLoginBoxClose="showLoginBox = false" v-if="showLoginBox"></login-box>
  57. <say-price :showSayPriceBox="showSayPriceBox" @cancelSayPriceAction="onSayPriceCancel"></say-price>
  58. <say-price-info v-if="showSayPriceInfoBox" :agreed="agreed" @cancelSayPriceInfoAction="onSayPriceInfoCancel"></say-price-info>
  59. <remind-box :title="remindText" :timeoutCount="timeoutCount"></remind-box>
  60. </div>
  61. </template>
  62. <script>
  63. import { LoginBox, RemindBox } from '~components/mobile/common'
  64. import { SayPrice, SayPriceInfo } from '~components/mobile/applyPurchase'
  65. export default {
  66. components: {
  67. LoginBox,
  68. SayPrice,
  69. RemindBox,
  70. SayPriceInfo
  71. },
  72. data() {
  73. return {
  74. showLoginBox: false,
  75. showSayPriceBox: false,
  76. showSayPriceInfoBox: false,
  77. activeIndex: -1,
  78. remindText: '',
  79. timeoutCount: 0,
  80. agreed: 0,
  81. purchaseManListData: []
  82. }
  83. },
  84. props: ['userType', 'seekType', 'purchaseManList', 'isDataChange'],
  85. filters: {
  86. date: function(date) {
  87. if (date) {
  88. const d = new Date(Number(date))
  89. const year = d.getFullYear()
  90. const monthTemp = d.getMonth() + 1
  91. const month = monthTemp < 10 ? '0' + monthTemp : '' + monthTemp
  92. const day =
  93. d.getDate() < 10 ? '0' + d.getDate() : '' + d.getDate() + ' '
  94. return year + '-' + month + '-' + day
  95. } else {
  96. return '-'
  97. }
  98. },
  99. enterpriseFilter([str, logged]) {
  100. if (logged) {
  101. return str
  102. } else {
  103. return str && str.length > 4
  104. ? str.substring(0, 2) +
  105. '**' +
  106. str.substring(str.length - 2, str.length)
  107. : str || '-'
  108. }
  109. },
  110. userNameFilter([str, logged]) {
  111. if (logged) {
  112. return str
  113. } else {
  114. return str ? str.substring(0, 1) + '**' : '-'
  115. }
  116. }
  117. },
  118. watch: {
  119. 'purchaseManList': {
  120. handler () {
  121. this.purchaseManListData = JSON.parse(JSON.stringify(this.purchaseManList))
  122. },
  123. immediate: true
  124. }
  125. },
  126. computed: {
  127. user() {
  128. return this.$store.state.option.user
  129. }
  130. },
  131. methods: {
  132. getDay: function(timeStamp) {
  133. return Math.floor(timeStamp / (1000 * 60 * 60 * 24))
  134. },
  135. getHours: function(timeStamp) {
  136. return Math.floor((timeStamp / (1000 * 60 * 60)) % 24)
  137. },
  138. goSayPrice: function(id, index) {
  139. if (this.user.logged) {
  140. if (this.user.data.enterprise.uu) {
  141. if (
  142. this.user.data.enterprise.isVendor &&
  143. this.user.data.enterprise.isVendor !== '1690'
  144. ) {
  145. this.$store.dispatch('applyPurchase/loadPurchaseManDetail', {
  146. itemId: id,
  147. enuu: this.$store.state.option.user.data.enterprise
  148. ? this.$store.state.option.user.data.enterprise.uu
  149. : null
  150. })
  151. this.showSayPriceBox = true
  152. this.activeIndex = index
  153. } else {
  154. this.onRemind('抱歉,您需开通卖家功能才可报价')
  155. }
  156. } else {
  157. this.onRemind('个人账户暂不可报价')
  158. }
  159. } else {
  160. this.showLoginBox = true
  161. }
  162. return false
  163. },
  164. goSayPriceInfo: function(id, agreed, index) {
  165. this.userType === 'buyer'
  166. ? this.$store.dispatch('applyPurchase/loadBuyerInquiryDetail', {
  167. id: id
  168. })
  169. : this.$store.dispatch('applyPurchase/loadVendorInquiryDetail', {
  170. id: id
  171. })
  172. this.agreed = agreed
  173. this.showSayPriceInfoBox = true
  174. this.activeIndex = index
  175. // '/mobile/applyPurchase/list/' + (userType ? (item.quteId || item.id) + '?type=' + userType : (item.quteId || item.id)) + (userType ? '&' : '?') + 'status=' + item.agreed
  176. },
  177. onSayPriceCancel: function(flag, quteId) {
  178. if (flag) {
  179. this.purchaseManListData[this.activeIndex].quoted = 1
  180. this.purchaseManListData[this.activeIndex].quteId = quteId
  181. this.onRemind('报价成功')
  182. }
  183. this.showSayPriceBox = false
  184. },
  185. onSayPriceInfoCancel: function(flag) {
  186. if (flag) {
  187. this.purchaseManListData[this.activeIndex].agreed = 1
  188. this.onRemind('采纳成功')
  189. }
  190. this.showSayPriceInfoBox = false
  191. },
  192. onRemind: function(str) {
  193. this.remindText = str
  194. this.timeoutCount++
  195. }
  196. }
  197. }
  198. </script>
  199. <style lang="scss" scoped>
  200. .seek-list {
  201. padding: .13rem .12rem 0;
  202. background: #fff;
  203. li {
  204. border: 1px solid #e0e0e4;
  205. height: 4.2rem;
  206. margin-bottom: .2rem;
  207. > p {
  208. font-size: .32rem;
  209. color: #3a3a3a;
  210. background: #f8f7fa;
  211. height: .92rem;
  212. line-height: .92rem;
  213. span {
  214. display: block;
  215. width: 6.9rem;
  216. border-bottom: 1px dashed #9f9f9f;
  217. margin: 0 auto;
  218. }
  219. }
  220. > div {
  221. font-size: .3rem;
  222. .fl {
  223. color: #666;
  224. width: 4.8rem;
  225. height: 2.62rem;
  226. margin: .27rem 0 .29rem .18rem;
  227. line-height: .46rem;
  228. border-right: 1px dashed #9f9f9f;
  229. > div {
  230. overflow: hidden;
  231. text-overflow: ellipsis;
  232. white-space: nowrap;
  233. span {
  234. color: #333;
  235. &.date {
  236. color: #e6353d;
  237. }
  238. }
  239. }
  240. }
  241. .fr {
  242. width: 2.2rem;
  243. padding: .9rem 0 0 0;
  244. p {
  245. font-size: .28rem;
  246. text-align: center;
  247. &.over-deadline {
  248. text-align: center;
  249. padding-right: .2rem;
  250. }
  251. span {
  252. font-size: .35rem;
  253. color: #ff3208;
  254. }
  255. i {
  256. font-style: normal;
  257. }
  258. }
  259. a {
  260. display: block;
  261. width: 1.64rem;
  262. height: .58rem;
  263. line-height: .58rem;
  264. text-align: center;
  265. font-size: .32rem;
  266. color: #e62f36;
  267. border: 1px solid #ea494f;
  268. margin: .34rem auto 0;
  269. border-radius: .06rem;
  270. &.self-publish {
  271. background: rgb(204, 203, 203);
  272. color: #fff;
  273. border-color: #fff;
  274. }
  275. }
  276. }
  277. }
  278. }
  279. }
  280. .none-state {
  281. text-align: center;
  282. margin-top: 1.1rem;
  283. img {
  284. width: 4.08rem;
  285. height: 2.62rem;
  286. }
  287. p {
  288. font-size: .32rem;
  289. color: #999;
  290. margin: 1.19rem 0 0 0;
  291. }
  292. }
  293. </style>