auctionDetail.vue 7.4 KB

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