SeekList.vue 11 KB

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