SeekList.vue 9.9 KB

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