rgDetail.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240
  1. <template>
  2. <view class="content">
  3. <view class="top1 flex">
  4. <image @click="back()" class="top-icon1" src="../../static/img/cb2.png" mode=""></image>
  5. <image @click="navTo('/pages/user/myrg')" class="top-icon2" src="../../static/img/cb1.png" mode=""></image>
  6. </view>
  7. <view class="main" v-if="info">
  8. <view class="main-top flex">
  9. <view class="main-icon"><image :src="info.imgs" mode=""></image></view>
  10. <view class="main-top-info">
  11. <view class="main-title clamp">{{ info.name }}</view>
  12. <view class="main-btype">{{ $t('rg.rgbz') }}:{{ info.coinname.toLocaleUpperCase() }}</view>
  13. <view class="main-time">{{ $t('rg.kssj') }}:{{ info.starttime }}</view>
  14. <view class="main-time">{{ $t('rg.jssj') }}:{{ info.finishtime }}</view>
  15. </view>
  16. </view>
  17. <view class="xian"><u-line-progress active-color="#2979ff" :percent="((info.num * 1 - info.sellnum * 1) / (info.num * 1)) * 100"></u-line-progress></view>
  18. <view class="main-bottom flex">
  19. <view class="main-bottom-item first">
  20. <view class="main-bottom-item-font">{{ $t('rg.fxzl') }}</view>
  21. <view class="main-bottom-item-num">{{ info.num }}</view>
  22. </view>
  23. <view class="main-bottom-item">
  24. <view class="main-bottom-item-font">{{ $t('rg.rgdj') }}</view>
  25. <view class="main-bottom-item-num">{{ info.price }} {{ info.buycoin.toLocaleUpperCase() }}</view>
  26. </view>
  27. <view class="main-bottom-item">
  28. <view class="main-bottom-item-font">{{ $t('rg.scsj') }}</view>
  29. <view class="main-bottom-item-num">{{ info.lockday }}{{ $t('rg.t') }}</view>
  30. </view>
  31. </view>
  32. <view class="main-bottom flex">
  33. <view class="main-bottom-item first">
  34. <view class="main-bottom-item-font">{{ $t('rg.cysl') }}</view>
  35. <view class="main-bottom-item-num">{{ info.sellnum }}</view>
  36. </view>
  37. <view class="main-bottom-item">
  38. <view class="main-bottom-item-font">{{ $t('rg.rgsx') }}</view>
  39. <view class="main-bottom-item-num">{{ info.allmax }}</view>
  40. </view>
  41. <view class="main-bottom-item">
  42. <view class="main-bottom-item-font">{{ $t('rg.dczd') }}</view>
  43. <view class="main-bottom-item-num">{{ info.min }}</view>
  44. </view>
  45. </view>
  46. <view class="sr-input flex">
  47. <input :placeholder="$t('rg.qsr')" type="number" v-model="num" />
  48. <view class="main-type">{{ info.coinname.toLocaleUpperCase() }}</view>
  49. </view>
  50. <view class="sr-input flex">
  51. <view class="main-type">{{ $t('rg.xyzf') }}:{{ num != '' ? info.price * 1 * num : '0.00' }}</view>
  52. <view class="main-type">{{ info.buycoin.toLocaleUpperCase() }}</view>
  53. </view>
  54. <view class="font">{{ $t('rg.ky') }}{{ info.buycoin.toLocaleUpperCase() }}: {{ money }}</view>
  55. <view class="sr-btn" @click="submit()">{{ $t('rg.ljcy') }}</view>
  56. <view class="info">
  57. <view class="info-item">
  58. {{ $t('rg.xmsm') }}:
  59. <view v-html="info.content"></view>
  60. </view>
  61. </view>
  62. </view>
  63. </view>
  64. </template>
  65. <script>
  66. import { details, upbuynum } from '@/api/wallet.js';
  67. export default {
  68. data() {
  69. return {
  70. id: '',
  71. info: '',
  72. money: '',
  73. num: ''
  74. };
  75. },
  76. onLoad(opt) {
  77. this.id = opt.id;
  78. this.loadData();
  79. },
  80. onShow() {},
  81. methods: {
  82. back() {
  83. uni.navigateBack();
  84. },
  85. navTo(url) {
  86. uni.navigateTo({
  87. url
  88. });
  89. },
  90. loadData() {
  91. details({ id: this.id }).then(({ data }) => {
  92. this.info = data.info;
  93. this.money = data.money;
  94. });
  95. },
  96. submit() {
  97. if (this.num * 1 <= 0) {
  98. return this.$api.msg(this.$t('rg.rgsl'));
  99. }
  100. if (this.num * 1 > this.money * 1) {
  101. return this.$api.msg(this.$t('rg.yebz'));
  102. }
  103. upbuynum({ pid: this.id, num: this.num }).then(e => {
  104. this.loadData();
  105. this.num = '';
  106. return this.$api.msg(this.$t('rg.rgcg'));
  107. });
  108. }
  109. }
  110. };
  111. </script>
  112. <style lang="scss">
  113. page,
  114. .content {
  115. min-height: 100%;
  116. height: auto;
  117. background: #f5f5f5;
  118. }
  119. .top1 {
  120. padding: 20rpx 40rpx;
  121. .top-icon1 {
  122. width: 52rpx;
  123. height: 36rpx;
  124. }
  125. .top-icon2 {
  126. width: 48rpx;
  127. height: 48rpx;
  128. }
  129. }
  130. .main {
  131. background: #fff;
  132. margin-top: 20rpx;
  133. padding: 16rpx 20rpx 24rpx;
  134. .main-top {
  135. justify-content: flex-start;
  136. align-items: center;
  137. .main-icon {
  138. width: 250rpx;
  139. height: 250rpx;
  140. image {
  141. width: 100%;
  142. height: 100%;
  143. }
  144. }
  145. .main-top-info {
  146. margin-left: 10rpx;
  147. .main-title {
  148. font-size: 32rpx;
  149. font-weight: bold;
  150. color: #707a8a;
  151. }
  152. .main-btype {
  153. margin-top: 6rpx;
  154. font-size: 28rpx;
  155. color: #707a8a;
  156. }
  157. .main-time {
  158. margin-top: 6rpx;
  159. font-size: 28rpx;
  160. color: #707a8a;
  161. }
  162. }
  163. }
  164. .xian {
  165. margin-top: 20rpx;
  166. }
  167. .main-bottom {
  168. padding: 28rpx 16rpx;
  169. .first {
  170. align-items: flex-start !important;
  171. }
  172. .main-bottom-item {
  173. display: flex;
  174. flex-direction: column;
  175. align-items: center;
  176. .main-bottom-item-font {
  177. font-size: 28rpx;
  178. color: #707a8a;
  179. }
  180. .main-bottom-item-num {
  181. margin-top: 10rpx;
  182. font-size: 28rpx;
  183. color: #707a8a;
  184. }
  185. }
  186. }
  187. .sr-input {
  188. margin-top: 20rpx;
  189. display: flex;
  190. align-items: center;
  191. width: 100%;
  192. height: 80rpx;
  193. line-height: 80rpx;
  194. background: #f5f5f5;
  195. border-radius: 20rpx;
  196. padding: 0rpx 30rpx;
  197. input {
  198. width: 292rpx;
  199. font-size: 28rpx;
  200. background: #f5f5f5;
  201. }
  202. .main-type {
  203. font-size: 28rpx;
  204. color: #707a8a;
  205. margin-right: 20rpx;
  206. }
  207. }
  208. .font {
  209. margin-top: 20rpx;
  210. padding-left: 30rpx;
  211. font-size: 28rpx;
  212. color: #707a8a;
  213. }
  214. .sr-btn {
  215. width: 100%;
  216. height: 80rpx;
  217. line-height: 80rpx;
  218. text-align: center;
  219. border-radius: 10rpx;
  220. margin: 40rpx auto 0;
  221. background: linear-gradient(to left, #eeb80d, #ffe35b);
  222. font-size: 28rpx;
  223. color: #000;
  224. }
  225. .info {
  226. margin: 40rpx auto 0;
  227. width: 690rpx;
  228. background: #ffffff;
  229. border-radius: 20rpx;
  230. padding: 30rpx 20rpx;
  231. .info-item {
  232. font-size: 28rpx;
  233. color: #000;
  234. margin-bottom: 20rpx;
  235. }
  236. }
  237. }
  238. </style>