SeekList.vue 9.2 KB

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