SeekList.vue 9.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302
  1. <template>
  2. <div>
  3. <ul class="seek-list">
  4. <li v-for="(item, index) in purchaseManList">
  5. <div class="top">
  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. </div>
  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.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.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>
  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="!purchaseManList || !purchaseManList.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. }
  82. },
  83. props: ['userType', 'seekType', 'purchaseManList', 'isDataChange'],
  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. computed: {
  118. // purchaseManList () {
  119. // return this.$store.state.applyPurchase.purchaseManList.purchaseManList.data
  120. // },
  121. user() {
  122. return this.$store.state.option.user
  123. }
  124. },
  125. methods: {
  126. getDay: function(timeStamp) {
  127. return Math.floor(timeStamp / (1000 * 60 * 60 * 24))
  128. },
  129. getHours: function(timeStamp) {
  130. return Math.floor((timeStamp / (1000 * 60 * 60)) % 24)
  131. },
  132. goSayPrice: function(id, index) {
  133. if (this.user.logged) {
  134. if (this.user.data.enterprise.uu) {
  135. if (
  136. this.user.data.enterprise.isVendor &&
  137. this.user.data.enterprise.isVendor !== '1690'
  138. ) {
  139. this.$store.dispatch('applyPurchase/loadPurchaseManDetail', {
  140. itemId: id,
  141. enuu: this.$store.state.option.user.data.enterprise
  142. ? this.$store.state.option.user.data.enterprise.uu
  143. : null
  144. })
  145. this.showSayPriceBox = true
  146. this.activeIndex = index
  147. } else {
  148. this.onRemind('抱歉,您需开通卖家功能才可报价')
  149. }
  150. } else {
  151. this.onRemind('个人账户暂不可报价')
  152. }
  153. } else {
  154. this.showLoginBox = true
  155. }
  156. },
  157. goSayPriceInfo: function(id, agreed, index) {
  158. this.userType === 'buyer'
  159. ? this.$store.dispatch('applyPurchase/loadBuyerInquiryDetail', {
  160. id: id
  161. })
  162. : this.$store.dispatch('applyPurchase/loadVendorInquiryDetail', {
  163. id: id
  164. })
  165. this.agreed = agreed
  166. this.showSayPriceInfoBox = true
  167. this.activeIndex = index
  168. // '/mobile/applyPurchase/list/' + (userType ? (item.quteId || item.id) + '?type=' + userType : (item.quteId || item.id)) + (userType ? '&' : '?') + 'status=' + item.agreed
  169. },
  170. onSayPriceCancel: function(flag, quteId) {
  171. if (flag) {
  172. this.purchaseManList[this.activeIndex].quoted = 1
  173. this.purchaseManList[this.activeIndex].quteId = quteId
  174. this.onRemind('报价成功')
  175. }
  176. this.showSayPriceBox = false
  177. },
  178. onSayPriceInfoCancel: function(flag) {
  179. if (flag) {
  180. this.purchaseManList[this.activeIndex].agreed = 1
  181. this.onRemind('采纳成功')
  182. }
  183. this.showSayPriceInfoBox = false
  184. },
  185. onRemind: function(str) {
  186. this.remindText = str
  187. this.timeoutCount++
  188. }
  189. }
  190. }
  191. </script>
  192. <style lang="scss" scoped>
  193. .seek-list {
  194. width: 7.26rem;
  195. margin: 0.13rem auto 0;
  196. li {
  197. border: 1px solid #e0e0e4;
  198. height: 4.2rem;
  199. margin-bottom: 0.2rem;
  200. div.top {
  201. font-size: 0.32rem;
  202. color: #3a3a3a;
  203. background: #f8f7fa;
  204. height: 0.92rem;
  205. line-height: 0.92rem;
  206. span {
  207. display: block;
  208. width: 6.9rem;
  209. border-bottom: 1px dashed #9f9f9f;
  210. margin: 0 auto;
  211. }
  212. }
  213. > div {
  214. font-size: 0.3rem;
  215. // display: inline-block;
  216. &::after {
  217. clear: both;
  218. visibility: hidden;
  219. zoom: 1;
  220. display: block;
  221. content: ' ';
  222. }
  223. .fl {
  224. color: #666;
  225. width: 4.8rem;
  226. height: 2.62rem;
  227. margin: 0.27rem 0 0.29rem 0.18rem;
  228. line-height: 0.46rem;
  229. border-right: 1px dashed #9f9f9f;
  230. > div {
  231. overflow: hidden;
  232. text-overflow: ellipsis;
  233. white-space: nowrap;
  234. span {
  235. color: #333;
  236. &.date {
  237. color: #e6353d;
  238. }
  239. }
  240. }
  241. }
  242. .fr {
  243. width: 2.2rem;
  244. padding: 0.9rem 0 0 0;
  245. p {
  246. font-size: 0.28rem;
  247. text-align: center;
  248. &.over-deadline {
  249. text-align: center;
  250. padding-right: 0.2rem;
  251. }
  252. span {
  253. font-size: 0.35rem;
  254. color: #ff3208;
  255. }
  256. i {
  257. font-style: normal;
  258. }
  259. }
  260. a {
  261. display: block;
  262. width: 1.64rem;
  263. height: 0.58rem;
  264. line-height: 0.58rem;
  265. text-align: center;
  266. font-size: 0.32rem;
  267. color: #e62f36;
  268. border: 1px solid #ea494f;
  269. margin: 0.34rem auto 0;
  270. border-radius: 0.06rem;
  271. &.self-publish {
  272. background: rgb(204, 203, 203);
  273. color: #fff;
  274. border-color: #fff;
  275. }
  276. }
  277. }
  278. }
  279. }
  280. }
  281. .none-state {
  282. text-align: center;
  283. margin-top: 1.1rem;
  284. img {
  285. width: 4.08rem;
  286. height: 2.62rem;
  287. }
  288. p {
  289. font-size: 0.32rem;
  290. color: #999;
  291. margin: 1.19rem 0 0 0;
  292. }
  293. }
  294. </style>