auctionDetail.vue 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354
  1. <template>
  2. <view class="container">
  3. <view class="auction-end-date">
  4. <text class="iconfont iconshijian"></text>
  5. {{goodData.auctionEndTime}}结束
  6. </view>
  7. <view class="good-info-box">
  8. <image mode="aspectFill" class="goods-img" :src="goodData.imgPath"></image>
  9. <view class="goods-info">
  10. <view class="goods-name">{{goodData.productName}}</view>
  11. <view class="goods-price">
  12. <text class="text">当前价格¥</text>
  13. <text class="price">{{goodData.currentPrice == 0 ? goodData.auctionStartPrice : goodData.currentPrice}}/{{goodData.unit}}</text>
  14. </view>
  15. </view>
  16. </view>
  17. <view class="auction-handle">
  18. <view class="auction-price">
  19. <uni-icons type="minus-filled" size="52" color="#A67A54" @click="reducePrice()"></uni-icons>
  20. <text class="price">{{price}}</text>
  21. <uni-icons type="plus-filled" size="52" color="#A67A54" @click="addPrice()"></uni-icons>
  22. </view>
  23. <view class="auction-tip">本商品每次加价不得低于¥{{goodData.auctionMinAddPrice}}</view>
  24. <view class="handle-button" @click="submitAuction()">立即出价</view>
  25. </view>
  26. <view class="auction-list">
  27. <view class="auction-row" v-for="(item, index) in auctionList" :key="index">
  28. <view class="auction-line"></view>
  29. <view class="auction-point"></view>
  30. <view class="auction-title" v-if="item.nickname || item.paySum">
  31. <text class="auction-name" v-if="item.nickname">{{item.nickname}}</text>
  32. <text class="auction-price" v-if="item.paySum">¥{{item.paySum}}</text>
  33. </view>
  34. <text class="auction-date" v-if="item.payTime">{{item.payTime}}</text>
  35. </view>
  36. </view>
  37. <u-top-tips ref="uTips"></u-top-tips>
  38. </view>
  39. </template>
  40. <script>
  41. const NET = require('@/utils/request')
  42. const API = require('@/config/api')
  43. export default {
  44. data() {
  45. return {
  46. goodId: '',
  47. goodData: {
  48. imgPath: '',
  49. productName: '',
  50. currentPrice: 0,
  51. auctionMinAddPrice: 0,
  52. unit: '',
  53. auctionStartPrice:0
  54. },
  55. price: 0,
  56. auctionBaseList: [{
  57. nickname: '拍品起拍价:',
  58. paySum: '',
  59. }, {
  60. payTime: '竞拍截止时间:'
  61. }, {
  62. payTime: '竞拍正式开始!\n'
  63. }],
  64. auctionList: [],
  65. timer: null
  66. }
  67. },
  68. onLoad(options) {
  69. this.goodId = options.goodId
  70. this.getAuctionData()
  71. },
  72. onShow() {
  73. this.timer = setInterval(() => {
  74. this.getAuctionData()
  75. }, 5000)
  76. },
  77. onHide() {
  78. clearInterval(this.timer)
  79. },
  80. onUnload() {
  81. clearInterval(this.timer)
  82. },
  83. methods: {
  84. // 获取拍卖详情
  85. getAuctionData() {
  86. NET.request(API.getAuctionDetail + this.goodId, {}, 'GET').then(res => {
  87. this.goodData = {
  88. imgPath: res.data.imgPath,
  89. productName: res.data.productName,
  90. currentPrice: parseFloat(res.data.currentPrice),
  91. auctionMinAddPrice: parseFloat(res.data.auctionMinAddPrice),
  92. auctionStartPrice: res.data.auctionStartPrice,
  93. unit: res.data.unit,
  94. auctionEndTime: res.data.auctionEndTime,
  95. }
  96. this.auctionBaseList[0].paySum = res.data.auctionStartPrice
  97. this.auctionBaseList[1].payTime = '竞拍截止时间:' + res.data.auctionEndTime
  98. this.auctionBaseList[2].payTime = '竞拍于 '+res.data.auctionStartTime +' 正式开始!'
  99. this.auctionList = res.data.userPriceResVOs.concat(this.auctionBaseList)
  100. if (this.price <= parseFloat(this.goodData.currentPrice + this.goodData.auctionMinAddPrice)) {
  101. this.price = parseFloat(this.goodData.currentPrice + this.goodData.auctionMinAddPrice).toFixed(2)
  102. }
  103. }).catch(error => {
  104. this.$refs.uTips.show({
  105. title: error.data.msg,
  106. type: 'warning',
  107. })
  108. })
  109. },
  110. // 减价
  111. reducePrice() {
  112. if (this.price > this.goodData.currentPrice + this.goodData.auctionMinAddPrice) {
  113. this.price -= this.goodData.auctionMinAddPrice
  114. this.price = parseFloat(this.price).toFixed(2)
  115. }
  116. },
  117. // 加价
  118. addPrice() {
  119. this.price = (parseFloat(this.price) + parseFloat(this.goodData.auctionMinAddPrice)).toFixed(2)
  120. // this.price = parseFloat(this.price).toFixed(2)
  121. },
  122. // 去支付
  123. submitAuction() {
  124. uni.navigateTo({
  125. url: '/pagesGood/orderPay?flag=2&orderType=2&paySum=' + this.price
  126. });
  127. },
  128. },
  129. }
  130. </script>
  131. <style lang="less" scoped>
  132. page {
  133. width: 100%;
  134. height: 100%;
  135. }
  136. .container {
  137. width: 100%;
  138. height: 100%;
  139. float: left;
  140. background-color: #f7f7f7;
  141. .auction-end-date {
  142. width: 100%;
  143. height: 34px;
  144. float: left;
  145. background: #51A539;
  146. font-size: 15px;
  147. font-family: PingFang SC;
  148. color: #FFFFFF;
  149. line-height: 34px;
  150. text-align: center;
  151. .iconshijian {
  152. font-size: 16px;
  153. margin-right: 8px;
  154. }
  155. }
  156. .good-info-box {
  157. width: 100%;
  158. height: 112px;
  159. float: left;
  160. box-sizing: border-box;
  161. padding: 12px 15px;
  162. background: #FFFFFF;
  163. box-shadow: 0px 1px 5px 0px rgba(101, 101, 101, 0.43);
  164. .goods-img {
  165. width: 88px;
  166. height: 88px;
  167. object-fit: cover;
  168. float: left;
  169. border-radius: 5px;
  170. margin-right: 16px;
  171. }
  172. .goods-info {
  173. width: calc(100% - 104px);
  174. height: 88px;
  175. float: left;
  176. .goods-name {
  177. width: 100%;
  178. height: 36px;
  179. float: left;
  180. margin: 6px 0 20px 0;
  181. font-size: 15px;
  182. font-family: PingFang SC;
  183. color: #333333;
  184. line-height: 18px;
  185. overflow: hidden;
  186. text-overflow: ellipsis;
  187. display: -webkit-box;
  188. -webkit-line-clamp: 2;
  189. -webkit-box-orient: vertical;
  190. word-wrap: break-word;
  191. }
  192. .goods-price {
  193. width: 100%;
  194. height: 26px;
  195. float: left;
  196. font-family: PingFang SC;
  197. color: #51A539;
  198. line-height: 26px;
  199. .text {
  200. font-size: 18px;
  201. }
  202. .price {
  203. font-size: 24px;
  204. }
  205. }
  206. }
  207. }
  208. .auction-handle {
  209. width: 100%;
  210. height: 172px;
  211. float: left;
  212. .auction-price {
  213. width: 100%;
  214. height: 82px;
  215. float: left;
  216. text-align: center;
  217. white-space: nowrap;
  218. line-height: 82px;
  219. .price {
  220. font-size: 56px;
  221. font-family: PingFang SC;
  222. color: #333333;
  223. margin: 0 32px;
  224. }
  225. }
  226. .auction-tip {
  227. width: 100%;
  228. height: 18px;
  229. float: left;
  230. font-size: 12px;
  231. font-family: PingFang SC;
  232. color: #51A539;
  233. line-height: 18px;
  234. text-align: center;
  235. }
  236. .handle-button {
  237. width: 234px;
  238. height: 46px;
  239. float: left;
  240. background: #51A539;
  241. border-radius: 24px;
  242. margin-top: 10px;
  243. position: relative;
  244. left: 50%;
  245. transform: translateX(-50%);
  246. font-size: 24px;
  247. font-family: PingFang SC;
  248. color: #FFFFFF;
  249. line-height: 46px;
  250. text-align: center;
  251. }
  252. }
  253. .auction-list {
  254. width: 100%;
  255. height: calc(100vh - 318px);
  256. float: left;
  257. background: #FFFFFF;
  258. box-shadow: 0px 1px 5px 0px rgba(101, 101, 101, 0.43);
  259. border-radius: 15px 15px 0px 0px;
  260. box-sizing: border-box;
  261. padding: 2px 15px 15px 15px;
  262. overflow-y: auto;
  263. .auction-row {
  264. width: 100%;
  265. float: left;
  266. box-sizing: border-box;
  267. padding: 14px 0 14px 32px;
  268. position: relative;
  269. .auction-line {
  270. width: 1px;
  271. position: absolute;
  272. background: #F1F3F5;
  273. left: 7px;
  274. top: 0;
  275. bottom: 0;
  276. }
  277. .auction-point {
  278. width: 8px;
  279. height: 8px;
  280. position: absolute;
  281. left: 4px;
  282. top: 50%;
  283. transform: translateY(-50%);
  284. background: #DBDDDF;
  285. border-radius: 50%;
  286. }
  287. .auction-title {
  288. font-family: PingFang SC;
  289. line-height: 20px;
  290. .auction-name {
  291. font-size: 12px;
  292. color: #333333;
  293. }
  294. .auction-price {
  295. font-size: 15px;
  296. color: #51A539;
  297. }
  298. }
  299. .auction-date {
  300. width: 100%;
  301. float: left;
  302. font-size: 12px;
  303. font-family: PingFang SC;
  304. color: #656565;
  305. line-height: 20px;
  306. }
  307. }
  308. .auction-row:first-child {
  309. .auction-line {
  310. top: 50%;
  311. }
  312. .auction-point {
  313. width: 16px;
  314. height: 16px;
  315. left: 0px;
  316. background: #51A539;
  317. }
  318. }
  319. .auction-row:last-child {
  320. .auction-line {
  321. bottom: 50%;
  322. }
  323. }
  324. }
  325. }
  326. </style>