auctionDetail.vue 7.1 KB

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