auctionDetail.vue 7.6 KB

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