SeekList.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427
  1. <template>
  2. <div>
  3. <ul class="seek-list">
  4. <li v-for="(item, index) in purchaseManListData" class="clearfix">
  5. <p v-if="!(userType === 'buyer' && seekType === 'wait') && !(userType !== 'buyer' && item.quotation)">
  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 class="clearfix" :class="{'no-quot': !item.quotation}">
  10. <div class="fl">
  11. <div class="content" v-if="item.quotation && userType !== 'buyer'">
  12. <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>
  13. <span v-else>{{[item.userName, user.logged] | userNameFilter}}</span>
  14. </div>
  15. <div class="content">
  16. 品牌:
  17. <span>{{item.inbrand || '-'}}</span>
  18. </div>
  19. <div class="content">
  20. 物料名称(类目):
  21. <span>{{item.title || item.prodTitle || '-'}}</span>
  22. </div>
  23. <div class="content">
  24. 型号:
  25. <span>{{item.cmpCode || '-'}}</span>
  26. </div>
  27. <div class="content">
  28. 规格:
  29. <span>{{item.spec || '-'}}</span>
  30. </div>
  31. <div class="content">
  32. 采购数量(PCS):
  33. <span>{{item.needQty || item.needquantity || '-'}}</span>
  34. </div>
  35. <div class="content">
  36. 截止日期:
  37. <span class="date">{{item.endDate | date}}</span>
  38. </div>
  39. <template v-if="item.quotation">
  40. <p class="remain-time" v-if="item.remainingTime > 0">剩余&nbsp;:
  41. <span v-if="getDay(item.remainingTime) > 0" v-text="getDay(item.remainingTime)"></span>
  42. <i v-if="getDay(item.remainingTime) > 0">&nbsp;天&nbsp;</i>
  43. <span v-if="getDay(item.remainingTime) <= 0" v-text="getHours(item.remainingTime)"></span>
  44. <i v-if="getDay(item.remainingTime) <= 0">&nbsp;小时</i>
  45. </p>
  46. <p class="remain-time" v-else><span>已截止</span></p>
  47. </template>
  48. </div>
  49. <div class="fr" :class="{'no-btn': !isSelfSeek(item) && !canSayPrice(item) && !canSeeInfo(item), 'is-qutation': item.quotation, 'is-simple': userType !== 'buyer' && item.quotation}">
  50. <template v-if="item.quotation">
  51. <div class="content" v-if="userType === 'buyer'">
  52. <span>{{item.quotation.vendName || '-'}}</span>
  53. </div>
  54. <div class="content">
  55. 报价人:
  56. <span>{{item.quotation.user ? item.quotation.user.userName : '-'}}</span>
  57. </div>
  58. <div class="content">
  59. 电话:
  60. <span>{{item.quotation.user ? item.quotation.user.userTel : '-'}}</span>
  61. </div>
  62. <div class="content">
  63. 交期:
  64. <span class="date">{{item.quotation.leadtime || '-'}}</span>
  65. </div>
  66. <table class="com-price-list">
  67. <thead>
  68. <tr>
  69. <th>分段数量</th>
  70. <th>分段单价</th>
  71. </tr>
  72. </thead>
  73. <tbody>
  74. <tr>
  75. <td class="date text-ellipse">{{item.quotation.replies[0].lapQty + '+'}}</td>
  76. <td class="date text-ellipse">{{item.quotation.replies[0].price}}</td>
  77. </tr>
  78. </tbody>
  79. </table>
  80. <button class="more-btn" @click="goSayPriceInfo(item.newId || item.quteId || item.id, item.agreed, index)">查看更多</button>
  81. </template>
  82. <template v-else>
  83. <p class="remain-time" v-if="item.remainingTime > 0">剩余&nbsp;:
  84. <span v-if="getDay(item.remainingTime) > 0" v-text="getDay(item.remainingTime)"></span>
  85. <i v-if="getDay(item.remainingTime) > 0">&nbsp;天&nbsp;</i>
  86. <span v-if="getDay(item.remainingTime) <= 0" v-text="getHours(item.remainingTime)"></span>
  87. <i v-if="getDay(item.remainingTime) <= 0">&nbsp;小时</i>
  88. </p>
  89. <p class="remain-time" v-else><span>已截止</span></p>
  90. <!--<a v-if="!userType && item.quoted == 1">已报价</a>-->
  91. <a v-if="isSelfSeek(item)" class="self-publish" @click="setRemindText('此为贵公司的求购')">我要报价</a>
  92. <a v-if="canSayPrice(item)" @click="goSayPrice(item.itemId || item.id, index)">我要报价</a>
  93. <!--<a v-if="item.newId" class="self-publish" @click="setRemindText('您已报价')">我要报价</a>-->
  94. <a v-if="canSeeInfo(item)" @click="goSayPriceInfo(item.newId || item.quteId || item.id, item.agreed, index)">查看报价</a>
  95. </template>
  96. </div>
  97. </div>
  98. </li>
  99. </ul>
  100. <empty-status v-if="!purchaseManListData || purchaseManListData.length == 0 && !isDataChange" :type="isSearch ? 'search' : 'collect'" :text="isSearch ? `抱歉,暂无与“${keyword}”匹配的求购信息` : '抱歉,暂无求购信息'" :showLink="true"></empty-status>
  101. <login-box :url="url" @onLoginBoxClose="showLoginBox = false" v-if="showLoginBox"></login-box>
  102. <say-price :showSayPriceBox="showSayPriceBox" @cancelSayPriceAction="onSayPriceCancel"></say-price>
  103. <say-price-info v-if="showSayPriceInfoBox" :agreed="agreed" @cancelSayPriceInfoAction="onSayPriceInfoCancel" :userType="userType"></say-price-info>
  104. <remind-box :title="remindText" :timeoutCount="timeoutCount"></remind-box>
  105. </div>
  106. </template>
  107. <script>
  108. import { LoginBox, RemindBox, EmptyStatus } from '~components/mobile/common'
  109. import { SayPrice, SayPriceInfo } from '~components/mobile/applyPurchase'
  110. export default {
  111. data() {
  112. return {
  113. showLoginBox: false,
  114. showSayPriceBox: false,
  115. showSayPriceInfoBox: false,
  116. activeIndex: -1,
  117. remindText: '',
  118. timeoutCount: 0,
  119. agreed: 0,
  120. purchaseManListData: [{}],
  121. url: ''
  122. }
  123. },
  124. components: {
  125. LoginBox,
  126. SayPrice,
  127. RemindBox,
  128. SayPriceInfo,
  129. EmptyStatus
  130. },
  131. props: ['userType', 'seekType', 'purchaseManList', 'isDataChange', 'isSearch', 'keyword'],
  132. filters: {
  133. date: function(date) {
  134. if (date) {
  135. const d = new Date(Number(date))
  136. const year = d.getFullYear()
  137. const monthTemp = d.getMonth() + 1
  138. const month = monthTemp < 10 ? '0' + monthTemp : '' + monthTemp
  139. const day =
  140. d.getDate() < 10 ? '0' + d.getDate() : '' + d.getDate() + ' '
  141. return year + '-' + month + '-' + day
  142. } else {
  143. return '-'
  144. }
  145. },
  146. enterpriseFilter([str, logged]) {
  147. if (logged) {
  148. return str
  149. } else {
  150. return str && str.length > 4
  151. ? str.substring(0, 2) +
  152. '**' +
  153. str.substring(str.length - 2, str.length)
  154. : str || '-'
  155. }
  156. },
  157. userNameFilter([str, logged]) {
  158. if (logged) {
  159. return str
  160. } else {
  161. return str ? str.substring(0, 1) + '**' : '-'
  162. }
  163. }
  164. },
  165. watch: {
  166. // 'purchaseManList': {
  167. // handler (newVal) {
  168. // if (this.purchaseManListData.length === 0) {
  169. // this.$store.dispatch('applyPurchase/loadMobileHomeList', {
  170. // pageNumber: 1,
  171. // pageSize: 5,
  172. // enUU: this.$store.state.option.user.data.enterprise ? this.$store.state.option.user.data.enterprise.uu : null
  173. // }).then(res => {
  174. // this.purchaseManListData = JSON.parse(JSON.stringify(this.purchaseManList))
  175. // console.log(this.purchaseManListData.length)
  176. // })
  177. // } else {
  178. // this.purchaseManListData = JSON.parse(JSON.stringify(this.purchaseManList))
  179. // }
  180. // },
  181. // immediate: true
  182. // }
  183. 'purchaseManList': {
  184. handler (newVal) {
  185. this.purchaseManListData = JSON.parse(JSON.stringify(this.purchaseManList))
  186. },
  187. immediate: true
  188. }
  189. },
  190. methods: {
  191. getDay: function(timeStamp) {
  192. return Math.floor(timeStamp / (1000 * 60 * 60 * 24))
  193. },
  194. getHours: function(timeStamp) {
  195. return Math.floor((timeStamp / (1000 * 60 * 60)) % 24)
  196. },
  197. goSayPrice: function(id, index) {
  198. if (this.user.logged) {
  199. if (this.user.data.enterprise.uu) {
  200. if (
  201. this.user.data.enterprise.isVendor &&
  202. this.user.data.enterprise.isVendor !== '1690'
  203. ) {
  204. this.authorityInterceptor(this.baseUrls.vendorBusinessSayPrice, () => {
  205. this.$store.dispatch('applyPurchase/loadPurchaseManDetail', {
  206. itemId: id,
  207. enuu: this.$store.state.option.user.data.enterprise
  208. ? this.$store.state.option.user.data.enterprise.uu
  209. : null
  210. })
  211. this.showSayPriceBox = true
  212. this.activeIndex = index
  213. })
  214. } else {
  215. this.setRemindText('抱歉,您需开通卖家功能才可报价')
  216. }
  217. } else {
  218. this.setRemindText('个人账户暂不可报价')
  219. }
  220. } else {
  221. this.url = this.$route.fullPath
  222. this.showLoginBox = true
  223. }
  224. return false
  225. },
  226. goSayPriceInfo: function(id, agreed, index) {
  227. this.requestSayPrice(id).then(() => {
  228. this.agreed = agreed
  229. this.showSayPriceInfoBox = true
  230. this.activeIndex = index
  231. }, err => {
  232. console.log(err)
  233. this.setRemindText('获取报价信息失败')
  234. })
  235. // '/mobile/applyPurchase/list/' + (userType ? (item.quteId || item.id) + '?type=' + userType : (item.quteId || item.id)) + (userType ? '&' : '?') + 'status=' + item.agreed
  236. },
  237. requestSayPrice: function (id) {
  238. if (this.userType === 'buyer') {
  239. return this.$store.dispatch('applyPurchase/loadBuyerInquiryDetail', {
  240. id: id
  241. })
  242. } else {
  243. return this.$store.dispatch('applyPurchase/loadVendorInquiryDetail', {
  244. id: id,
  245. enuu: this.user.data.enterprise.uu,
  246. useruu: this.user.data.userUU
  247. })
  248. }
  249. },
  250. onSayPriceCancel: function(flag, quteId) {
  251. if (flag) {
  252. this.purchaseManListData[this.activeIndex].quoted = 1
  253. this.purchaseManListData[this.activeIndex].quteId = quteId
  254. this.setRemindText('感谢您参与报价,敬请期待回复')
  255. }
  256. this.showSayPriceBox = false
  257. },
  258. onSayPriceInfoCancel: function(flag) {
  259. if (flag) {
  260. this.purchaseManListData[this.activeIndex].agreed = 1
  261. this.setRemindText('采纳成功')
  262. }
  263. this.showSayPriceInfoBox = false
  264. },
  265. setRemindText: function(str) {
  266. this.remindText = str
  267. this.timeoutCount++
  268. },
  269. isSelfSeek: function (item) {
  270. 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)))
  271. },
  272. canSayPrice: function (item) {
  273. 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)))))
  274. },
  275. canSeeInfo: function (item) {
  276. return ((!this.userType || this.userType === 'buyer') && (this.seekType && this.seekType !== 'wait')) || (this.userType === 'saler' && this.seekType && this.seekType !== 'wait') || item.quoted === 1 || item.newId
  277. }
  278. }
  279. }
  280. </script>
  281. <style lang="scss" scoped>
  282. .seek-list {
  283. padding: .13rem .12rem 0;
  284. background: #f1f3f6;
  285. li.clearfix {
  286. border: 1px solid #e0e0e4;
  287. /*height: 4.2rem;*/
  288. margin: auto;
  289. margin-bottom: .2rem;
  290. max-width: 7.3rem;
  291. background: #fff;
  292. > p {
  293. font-size: .28rem;
  294. color: #3a3a3a;
  295. font-weight: bold;
  296. /*background: #f8f7fa;*/
  297. height: .92rem;
  298. line-height: .92rem;
  299. span {
  300. display: block;
  301. width: 6.9rem;
  302. border-bottom: 1px solid #d3d3d3;
  303. margin: 0 auto;
  304. }
  305. }
  306. > div {
  307. font-size: .28rem;
  308. .remain-time {
  309. font-size: .28rem;
  310. text-align: center;
  311. span {
  312. font-size: .35rem;
  313. color: #ff3208;
  314. }
  315. i {
  316. font-style: normal;
  317. }
  318. }
  319. .content {
  320. overflow: hidden;
  321. text-overflow: ellipsis;
  322. white-space: nowrap;
  323. padding: 0 .18rem;
  324. line-height: .46rem;
  325. span {
  326. color: #333;
  327. }
  328. }
  329. .fl {
  330. color: #666;
  331. width: 50%;
  332. /*height: 2.62rem;*/
  333. line-height: .46rem;
  334. margin: .27rem 0;
  335. border-right: 1px dashed #9f9f9f;
  336. .remain-time {
  337. margin-top: .41rem;
  338. }
  339. }
  340. .fr {
  341. width: 50%;
  342. padding: .9rem 0 0 0;
  343. &.is-qutation {
  344. margin: .27rem 0;
  345. padding: 0 .18rem;
  346. color: #666;
  347. .more-btn {
  348. width: 3.2rem;
  349. margin: 0 auto;
  350. color: #fff;
  351. font-size: .28rem;
  352. height: .54rem;
  353. background: #3f84f6;
  354. border-radius: .08rem;
  355. }
  356. }
  357. &.is-simple {
  358. margin-top: .73rem;
  359. .more-btn {
  360. margin-top: .38rem;
  361. }
  362. }
  363. &.no-btn {
  364. padding-top: 0;
  365. line-height: 3.18rem;
  366. }
  367. a {
  368. display: block;
  369. width: 1.7rem;
  370. height: .47rem;
  371. line-height: .47rem;
  372. text-align: center;
  373. font-size: .28rem;
  374. color: #fff;
  375. background: #3f84f6;
  376. margin: .34rem auto 0;
  377. border-radius: .05rem;
  378. vertical-align: middle;
  379. &.self-publish {
  380. background: rgb(204, 203, 203);
  381. color: #fff;
  382. border-color: #fff;
  383. }
  384. }
  385. }
  386. .date {
  387. color: #e6353d !important;
  388. }
  389. }
  390. .no-quot {
  391. .fl {
  392. width: 70%;
  393. }
  394. .fr {
  395. width: 30%;
  396. }
  397. }
  398. }
  399. }
  400. .none-state {
  401. text-align: center;
  402. margin-top: 1.1rem;
  403. img {
  404. width: 4.08rem;
  405. height: 2.62rem;
  406. }
  407. p {
  408. font-size: .32rem;
  409. color: #999;
  410. margin: 1.19rem 0 0 0;
  411. }
  412. }
  413. </style>