details.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250
  1. <template>
  2. <view class="container">
  3. <view class="imageBox">
  4. <image :src="'https://www.bscnice.com'+info.image" ></image>
  5. </view>
  6. <view class="name">{{info.name}}</view>
  7. <view class="info flex">
  8. <view class="price">{{ $t("details.价格") }}:<text class="tip">{{info.price * 1}}NUSD</text></view>
  9. <view class="price">{{ $t("details.总收益") }}:<text class="tip">{{info.send_all * 1}}NUSD</text></view>
  10. </view>
  11. <view class="partition"></view>
  12. <view class="detailes" @click="navTo('/pages/index/detailsTpl')">
  13. <view class="flex detaTpl">
  14. <view class="flex_item tpl">
  15. <view class="tip"></view>
  16. <view class="nameTip">{{ $t("details.当前运作矿机") }}</view>
  17. </view>
  18. <view class="tpls">{{ $t("details.今日挖矿收益") }}</view>
  19. </view>
  20. <view class="flex detaTip">
  21. <view class="text">{{info.name}}</view>
  22. <view class="num">{{info.day_send * 1}}NUSD</view>
  23. </view>
  24. <view class="go"><u-icon name="arrow-right" size="14" color="#fff"></u-icon></view>
  25. </view>
  26. <view class="goBuy" :class="{ submitNo: !payOn }" @click="payOn ? buyOrder() : ''">{{ $t("details.立即购买") }}</view>
  27. </view>
  28. </template>
  29. <script>
  30. import { detail,order } from '@/api/index.js';
  31. import {mapState,mapActions,mapMutations} from "vuex";
  32. export default {
  33. data () {
  34. return {
  35. id:"",
  36. info:'',
  37. payOn:true
  38. }
  39. },
  40. onLoad (option) {
  41. this.id = option.id
  42. uni.setNavigationBarTitle({
  43. title: this.$t('details.矿机详情'),
  44. });
  45. this.loadDate()
  46. },
  47. onShow () {
  48. },
  49. computed: {
  50. ...mapState({
  51. langList: "langList",
  52. lang: "lang",
  53. }),
  54. },
  55. methods: {
  56. buyOrder(){
  57. let obj = this
  58. obj.payOn = false
  59. ethereum.request({
  60. method: 'eth_requestAccounts'
  61. }).then((account) => {
  62. const PKR_ORDER = 'PKR_ORDER' + (new Date()).getTime();
  63. ethereum.request({
  64. "method": "personal_sign",
  65. "params": [
  66. PKR_ORDER,
  67. account[0]
  68. ]
  69. }).then((res) => {
  70. obj.buyIndex(res,PKR_ORDER);
  71. });
  72. });
  73. },
  74. buyIndex(sign,msg){
  75. let obj = this
  76. order({
  77. sign,
  78. msg,
  79. id:obj.id,
  80. }).then(function(res){
  81. if(res.code == 0){
  82. obj.payOn = true
  83. uni.showToast({
  84. title: res.msg,
  85. icon: "error",
  86. duration:3000
  87. });
  88. }else{
  89. obj.payOn = true
  90. uni.showToast({
  91. title:obj.$t('details.开通完成'),
  92. icon: "success",
  93. });
  94. // setTimeout(function () {
  95. // obj.$router.go(0)
  96. // }, 1000);
  97. }
  98. }).catch(e => {
  99. obj.payOn = true
  100. console.log(e,11111);
  101. });
  102. },
  103. loadDate(){
  104. let obj = this
  105. detail(obj.id).then(function(res){
  106. if(res.code == 1){
  107. obj.info = res.data.info
  108. }else{
  109. uni.showToast({
  110. title: res.msg,
  111. duration: 1500,
  112. mask: false,
  113. icon: 'none',
  114. })
  115. }
  116. })
  117. },
  118. navTo(url){
  119. uni.navigateTo({
  120. url:url
  121. })
  122. },
  123. },
  124. }
  125. </script>
  126. <style lang="scss">
  127. page {
  128. width: 100%;
  129. }
  130. .container {
  131. width: 100%;
  132. padding: 30rpx 30rpx;
  133. color: #fff;
  134. padding-bottom: 150rpx;
  135. }
  136. .imageBox{
  137. width: 100%;
  138. height: 690rpx;
  139. background: url('../../static/img/img27.png') no-repeat;
  140. background-size: 100% 100%;
  141. text-align: center;
  142. padding-top: 70rpx;
  143. image{
  144. width: 100%;
  145. height: 100%;
  146. }
  147. }
  148. .name{
  149. font-weight: bold;
  150. font-size: 36rpx;
  151. color: #FFFFFF;
  152. padding: 40rpx 0rpx;
  153. }
  154. .info{
  155. margin-bottom: 45rpx;
  156. .price{
  157. font-weight: bold;
  158. font-size: 28rpx;
  159. .tip{
  160. font-weight: bold;
  161. font-size: 37rpx;
  162. color: #E83F30;
  163. background: linear-gradient(258deg, #FFF0CF 0%, #CBA16B 30.0048828125%, #FCE9CF 67.67578125%, #C29963 100%);
  164. -webkit-background-clip: text;
  165. -webkit-text-fill-color: transparent;
  166. }
  167. }
  168. }
  169. .partition{
  170. height: 15rpx;
  171. background: #F8F6F6;
  172. opacity: 0.11;
  173. position: absolute;
  174. width: 100%;
  175. left: 0;
  176. }
  177. .detailes{
  178. margin-top: 100rpx;
  179. background: url('../../static/img/img26.png') no-repeat;
  180. width: 100%;
  181. height: 158rpx;
  182. background-size: 100% 100%;
  183. padding: 37rpx 26rpx;
  184. padding-right: 70rpx;
  185. position: relative;
  186. .detaTpl{
  187. .tpl{
  188. .tip{
  189. width: 8rpx;
  190. height: 30rpx;
  191. background: linear-gradient(80deg, #FFF0CF, #CBA16B, #FCE9CF, #C29963);
  192. border-radius: 4rpx;
  193. }
  194. .nameTip{
  195. font-weight: 500;
  196. font-size: 23rpx;
  197. color: #999999;
  198. padding-left: 15rpx;
  199. }
  200. }
  201. .tpls{
  202. font-weight: 500;
  203. font-size: 24rpx;
  204. color: #999999;
  205. }
  206. }
  207. .detaTip{
  208. padding-top: 10rpx;
  209. .text{
  210. font-weight: bold;
  211. font-size: 32rpx;
  212. color: #999999;
  213. line-height: 55rpx;
  214. background: linear-gradient(258deg, #FFF0CF 0%, #CBA16B 30.0048828125%, #FCE9CF 67.67578125%, #C29963 100%);
  215. -webkit-background-clip: text;
  216. -webkit-text-fill-color: transparent;
  217. }
  218. .num{
  219. font-weight: bold;
  220. font-size: 28rpx;
  221. color: #FFFFFF;
  222. }
  223. }
  224. .go{
  225. position: absolute;
  226. top: 43%;
  227. right: 20rpx;
  228. }
  229. }
  230. .goBuy{
  231. position: fixed;
  232. bottom: 0;
  233. width: 100%;
  234. left: 0;
  235. font-weight: 500;
  236. font-size: 36rpx;
  237. color: #31190B;
  238. background: linear-gradient(258deg, #FFF0CF, #CBA16B, #FCE9CF, #C29963);
  239. height: 98rpx;
  240. line-height: 98rpx;
  241. text-align: center;
  242. padding-bottom: env(safe-area-inset-bottom);
  243. }
  244. .submitNo {
  245. background: #999999 !important;
  246. color: #fff !important;
  247. }
  248. </style>