_uuid.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394
  1. <template>
  2. <div class="purchase">
  3. <div class="purchase-top">
  4. <div class="purchase-top-bg">
  5. <div class="clearfix">
  6. <div class="title fl">{{purchaseDetail.inquiry.enName}}</div>
  7. <div class="time fr">{{purchaseDetail.endDate | date}}</div>
  8. </div>
  9. <div class="desc">{{purchaseDetail.prodTitle}}</div>
  10. <div class="brand">品牌:
  11. <span>{{purchaseDetail.inbrand || '-'}}</span>
  12. </div>
  13. <div class="size">规格:
  14. <span>{{purchaseDetail.spec || '-'}}</span>
  15. </div>
  16. </div>
  17. <div class="purchase-top-control clearfix">
  18. <div class="time fl">
  19. <span class="icon"></span>
  20. <template v-if="purchaseDetail.remainingTime > 0">剩余:
  21. <span class="timetext" v-if="getDay(purchaseDetail.remainingTime) > 0">
  22. <a class="number">{{getDay(purchaseDetail.remainingTime)}}</a>
  23. <a></a>
  24. </span>
  25. <span class="timetext" v-if="getDay(purchaseDetail.remainingTime) <= 0">
  26. <a class="number">{{getHours(purchaseDetail.remainingTime)}}</a>
  27. <a>小时</a>
  28. </span>
  29. </template>
  30. <span class="timetext" v-else>已截止</span>
  31. <!-- <span class="timetext">剩余时间:<a class="number">8</a><a>小时</a></span> -->
  32. </div>
  33. <div v-if="!userType && purchaseDetail.remainingTime > 0 && (!purchaseDetail.quoted || purchaseDetail.quoted != 1) && (user.logged && ((purchaseDetail.inquiry.enterprise && user.data.enterprise && (purchaseDetail.inquiry.enterprise.uu === user.data.enterprise.uu)) || (!user.data.enterprise.uu && purchaseDetail.userUU == user.data.userUU && !purchaseDetail.inquiry.enterprise)))" class="goprice fr" @click="onRemind('此为贵公司的求购')">我要报价</div>
  34. <div class="goprice fr" v-if="!(userType == 'saler' && seekType && seekType != 'wait') && (purchaseDetail.remainingTime > 0 && (!purchaseDetail.quoted || purchaseDetail.quoted != 1) && !(user.logged && ((purchaseDetail.inquiry.enterprise && user.data.enterprise && (purchaseDetail.inquiry.enterprise.uu === user.data.enterprise.uu)) || (!user.data.enterprise.uu && purchaseDetail.userUU == user.data.userUU && !purchaseDetail.inquiry.enterprise))))" @click="goSayPrice(purchaseDetail.id)">我要报价</div>
  35. <div class="goprice fr" v-if="((!userType || userType == 'buyer') && (seekType && seekType != 'wait')) || (userType == 'saler' && seekType && seekType != 'wait') || purchaseDetail.quoted == 1" @click="goSayPriceInfo(purchaseDetail.quteId || purchaseDetail.id, purchaseDetail.agreed)">查看报价</div>
  36. </div>
  37. </div>
  38. <div class="purcharse_banner">
  39. <div class="banner"></div>
  40. </div>
  41. <div class="seek-title">
  42. <img src="/images/mobile/@2x/applyPurchase/home/seek-title.png" alt="">
  43. <span>最新求购信息</span>
  44. </div>
  45. <div class="purcharseListContent">
  46. <seek-list :purchaseManList="purchaseManListData" :isDataChange="true"></seek-list>
  47. <nuxt-link to="/mobile/applyPurchase/list" class="purchase_btn_look" tag="div">查看更多</nuxt-link>
  48. <div class="purchse_btn_more_title">
  49. <a href="https://www.usoftmall.com">优软商城首页</a>
  50. </div>
  51. </div>
  52. <div class="mobile_footer company">
  53. <div class="hr"></div>
  54. <img src="/images/mobile/@2x/shareStore/logo.png" alt="">
  55. <div class="hr right"></div>
  56. <p>此页面由深圳市优软商城科技有限公司提供</p>
  57. <a href="https://www.usoftmall.com">www.usoftmall.com</a>
  58. </div>
  59. <div class="purcharse_kong"></div>
  60. <div class="purcharse_fixed clearfix" @click="sendApplyPurchase()">
  61. <div class="money_icon fl"></div>
  62. <span class="fl">发布求购</span>
  63. </div>
  64. <login-box @onLoginBoxClose="showLoginBox = false" v-if="showLoginBox"></login-box>
  65. <say-price :showSayPriceBox="showSayPriceBox" @cancelSayPriceAction="onSayPriceCancel"></say-price>
  66. <remind-box :title="remindText" :timeoutCount="timeoutCount"></remind-box>
  67. <say-price-info v-if="showSayPriceInfoBox" :agreed="agreed" @cancelSayPriceInfoAction="onSayPriceInfoCancel"></say-price-info>
  68. <publish-seek :showSayPriceBox="showsendApplyBox" @cancelAction="showsendApplyBox = false" @reloadAction="onReload" @remindAction="onRemind"></publish-seek>
  69. </div>
  70. </template>
  71. <script>
  72. import { SayPrice, SayPriceInfo } from '~components/mobile/applyPurchase'
  73. import { LoginBox, RemindBox } from '~components/mobile/common'
  74. import SeekList from '~components/mobile/applyPurchase/SeekList.vue'
  75. import PublishSeek from '~components/mobile/applyPurchase/PublishSeek.vue'
  76. export default {
  77. layout: 'mobileStore',
  78. props: ['userType', 'seekType', 'purchaseManList'],
  79. fetch({ store, params, redirect }) {
  80. if (!params.uuid) {
  81. return redirect('/error')
  82. }
  83. return Promise.all([
  84. store.dispatch('applyPurchase/loadPurchaseManDetail', {
  85. itemId: params.uuid,
  86. enuu: store.state.option.user.data.enterprise
  87. ? store.state.option.user.data.enterprise.uu
  88. : null
  89. }),
  90. store.dispatch('applyPurchase/loadPurchaseManList', {
  91. pageNumber: 1,
  92. pageSize: 10,
  93. sorting: { releaseDate: 'DESC' },
  94. keyword: '',
  95. enUU: store.state.option.user.data.enterprise
  96. ? store.state.option.user.data.enterprise.uu
  97. : null
  98. })
  99. ])
  100. },
  101. data() {
  102. return {
  103. showLoginBox: false,
  104. showSayPriceBox: false,
  105. showSayPriceInfoBox: false,
  106. remindText: '',
  107. timeoutCount: 0,
  108. agreed: 0,
  109. showsendApplyBox: false
  110. }
  111. },
  112. components: {
  113. SayPrice,
  114. SayPriceInfo,
  115. LoginBox,
  116. RemindBox,
  117. SeekList,
  118. PublishSeek
  119. },
  120. computed: {
  121. purchaseDetail() {
  122. return this.$store.state.applyPurchase.purchaseManList.purchaseManDetail
  123. .data
  124. },
  125. user() {
  126. return this.$store.state.option.user
  127. },
  128. purchaseManListData() {
  129. return this.$store.state.applyPurchase.purchaseManList.purchaseManList
  130. .data.content
  131. }
  132. },
  133. methods: {
  134. getDay: function(timeStamp) {
  135. return Math.floor(timeStamp / (1000 * 60 * 60 * 24))
  136. },
  137. getHours: function(timeStamp) {
  138. return Math.floor((timeStamp / (1000 * 60 * 60)) % 24)
  139. },
  140. onSayPriceCancel: function(flag, quteId) {
  141. if (flag) {
  142. this.purchaseDetail.quoted = 1
  143. this.purchaseDetail.quteId = quteId
  144. this.onRemind('报价成功')
  145. }
  146. this.showSayPriceBox = false
  147. },
  148. onRemind: function(str) {
  149. this.remindText = str
  150. this.timeoutCount++
  151. },
  152. onSayPriceInfoCancel: flag => {
  153. flag && ((this.purchaseDetail.agreed = 1), this.onRemind('采纳成功'))
  154. this.showSayPriceInfoBox = false
  155. },
  156. goSayPriceInfo: (id, agreed) => {
  157. this.userType === 'buyer'
  158. ? this.$store.dispatch('applyPurchase/loadBuyerInquiryDetail', {
  159. id: id
  160. })
  161. : this.$store.dispatch('applyPurchase/loadVendorInquiryDetail', {
  162. id: id
  163. })
  164. this.agreed = agreed
  165. this.showSayPriceInfoBox = true
  166. },
  167. goSayPrice: function(id) {
  168. if (this.user.logged) {
  169. this.$store.dispatch('applyPurchase/loadPurchaseManDetail', {
  170. itemId: id,
  171. enuu: this.$store.state.option.user.data.enterprise
  172. ? this.$store.state.option.user.data.enterprise.uu
  173. : null
  174. })
  175. this.showSayPriceBox = true
  176. } else {
  177. this.showLoginBox = true
  178. }
  179. },
  180. sendApplyPurchase() {
  181. if (this.user.logged) {
  182. this.showsendApplyBox = true
  183. } else {
  184. this.showLoginBox = true
  185. }
  186. },
  187. onReload: function() {
  188. const path = this.$route.path
  189. if (path === '/') {
  190. this.$store.dispatch('applyPurchase/loadMobileHomeList', {
  191. pageNumber: 1,
  192. pageSize: 5,
  193. enUU: this.user.data.enterprise ? this.user.data.enterprise.uu : null
  194. })
  195. } else if (path === '/mobile/applyPurchase/list') {
  196. this.$store.dispatch('applyPurchase/loadPurchaseManList', {
  197. pageNumber: 1,
  198. pageSize: 10,
  199. enUU: this.user.data.enterprise ? this.user.data.enterprise.uu : null
  200. })
  201. }
  202. }
  203. }
  204. }
  205. </script>
  206. <style scoped lang="scss">
  207. .clearfix {
  208. &::after {
  209. clear: both;
  210. visibility: hidden;
  211. zoom: 1;
  212. display: block;
  213. content: ' ';
  214. }
  215. }
  216. .purchase {
  217. background: rgb(246, 245, 248);
  218. .purchase-top {
  219. background: #fff;
  220. padding: 0.28rem 0.32rem 0.18rem 0.32rem;
  221. margin-bottom: 0.18rem;
  222. .purchase-top-bg {
  223. background: url('/images/mobile/@2x/purChase/purChase_bg.png');
  224. background-size: 100%;
  225. width: 6.82rem;
  226. height: 3rem;
  227. margin: 0 auto;
  228. position: relative;
  229. color: #fff;
  230. padding-left: 0.35rem;
  231. padding-top: 0.32rem;
  232. .title {
  233. font-size: 0.28rem;
  234. }
  235. .time {
  236. font-size: 0.24rem;
  237. margin-right: 0.2rem;
  238. }
  239. .desc {
  240. font-size: 0.38rem;
  241. margin: 0.38rem 0;
  242. }
  243. .brand,
  244. .size {
  245. font-size: 0.28rem;
  246. margin-bottom: 0.38rem;
  247. }
  248. }
  249. .purchase-top-control {
  250. margin-top: 0.32rem;
  251. .time {
  252. margin-top: 0.2rem;
  253. margin-left: 0.38rem;
  254. .icon {
  255. background-image: url('/images/mobile/@2x/purChase/time.png');
  256. background-size: 100%;
  257. width: 0.28rem;
  258. height: 0.28rem;
  259. display: inline-block;
  260. vertical-align: middle;
  261. margin-right: 0.05rem;
  262. }
  263. .timetext {
  264. color: #09061e;
  265. font-size: 0.24rem;
  266. margin-left: 0.1rem;
  267. a {
  268. font-size: 0.24rem;
  269. color: #fa7701;
  270. &.number {
  271. font-size: 0.36rem;
  272. }
  273. }
  274. }
  275. }
  276. .goprice {
  277. font-size: 0.28rem;
  278. width: 1.78rem;
  279. height: 0.68rem;
  280. background: linear-gradient(to right, #fb6d03, #fb9400);
  281. color: #fff;
  282. line-height: 0.68rem;
  283. text-align: center;
  284. border-radius: 4px;
  285. }
  286. }
  287. }
  288. .purcharse_banner {
  289. background: #fff;
  290. margin: 0 auto;
  291. text-align: center;
  292. padding: 0.24rem 0 0.36rem 0;
  293. margin-bottom: 0.18rem;
  294. .banner {
  295. background: url('/images/mobile/@2x/purChase/banner.png');
  296. background-size: 100%;
  297. width: 6.8rem;
  298. margin: 0 auto;
  299. height: 0.84rem;
  300. }
  301. }
  302. .purcharse_kong {
  303. width: 100%;
  304. height: 1rem;
  305. position: relative;
  306. }
  307. .purcharse_fixed {
  308. background: linear-gradient(to right, #4f44fd, #7188ff);
  309. width: 100%;
  310. height: 0.88rem;
  311. line-height: 0.88rem;
  312. text-align: center;
  313. color: #fff;
  314. font-size: 0.32rem;
  315. position: fixed;
  316. bottom: 0px;
  317. .money_icon {
  318. background: url('/images/mobile/@2x/purChase/money_icon.png');
  319. width: 0.39rem;
  320. height: 0.39rem;
  321. background-size: 100%;
  322. margin-top: 0.22rem;
  323. margin-right: 0.2rem;
  324. margin-left: 2.8rem;
  325. }
  326. }
  327. .purcharseListContent {
  328. padding-top: 0.3rem;
  329. padding-bottom: 0.37rem;
  330. background: #fff;
  331. .seek-title {
  332. background: #fff;
  333. }
  334. .purchase_btn_look {
  335. font-size: 0.26rem;
  336. color: #6a63ea;
  337. width: 1.37rem;
  338. height: 0.48rem;
  339. text-align: center;
  340. border-radius: 4px;
  341. text-align: center;
  342. border: 1px solid #6a63ea;
  343. line-height: 0.48rem;
  344. margin: 0.31rem auto;
  345. }
  346. .purchse_btn_more_title {
  347. font-size: 0.22rem;
  348. color: #6a63ea;
  349. text-align: center;
  350. a {
  351. color: #6a63ea;
  352. }
  353. }
  354. }
  355. .company {
  356. position: relative;
  357. height: 1.36rem;
  358. background: #f4f4f4;
  359. text-align: center;
  360. img {
  361. width: 1.15rem;
  362. height: 0.23rem;
  363. margin-top: 0.24rem;
  364. }
  365. p {
  366. font-size: 0.21rem;
  367. color: #aaa;
  368. margin: 0.13rem 0 0 0;
  369. }
  370. a {
  371. margin-top: 0.12rem;
  372. font-size: 0.18rem;
  373. color: #bbb;
  374. }
  375. .hr {
  376. width: 1.09rem;
  377. height: 0.02rem;
  378. background: #d9d9d9;
  379. position: absolute;
  380. left: 1.94rem;
  381. top: 0.35rem;
  382. &.right {
  383. right: 1.94rem;
  384. left: auto;
  385. }
  386. }
  387. }
  388. }
  389. </style>