auctionDetail.vue 7.4 KB

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