details.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  1. <template>
  2. <view class="center">
  3. <view class="top"><image src="" mode=""></image></view>
  4. <view class="name-box">
  5. <view class="price-box">
  6. 兑换价:
  7. <text class="price">9800</text>
  8. <text class="unit">拼团积分</text>
  9. <text class="yuan">¥229</text>
  10. </view>
  11. <view class="name clamp">拼购IPFS服务器 紫盘 4TB 移动监控服务器</view>
  12. </view>
  13. <view class="tip-box">
  14. <view class="tip-titele">兑换须知</view>
  15. <view class="tip-main">兑换说明详细介绍兑换说明详细介绍兑换兑换说明详细介绍兑换说明详细介绍兑换说明详细介绍</view>
  16. </view>
  17. <view class="detail">
  18. <view class="detail-title">
  19. 商品详情
  20. </view>
  21. <view class="systom">
  22. </view>
  23. </view>
  24. <view class="btn" @click="buy()">
  25. 立即兑换
  26. </view>
  27. </view>
  28. </template>
  29. <script>
  30. import { miningDateils, buyMining } from '@/api/market.js';
  31. import uniNumberBox from '@/components/uni-number-box.vue';
  32. export default {
  33. components: {
  34. uniNumberBox
  35. },
  36. data() {
  37. return {
  38. id: '',
  39. type: '',
  40. num: 1,
  41. step: 0,
  42. password: '',
  43. price: '',
  44. list: {},
  45. checked: false,
  46. current: 0
  47. };
  48. },
  49. onLoad(option) {
  50. this.id = option.id;
  51. this.type = option.type;
  52. },
  53. computed: {
  54. money() {
  55. return this.num * this.price * this.step;
  56. }
  57. },
  58. onShow() {},
  59. methods: {
  60. async loadData() {
  61. let obj = this;
  62. miningDateils({}, obj.id).then(({ data }) => {
  63. obj.list = data;
  64. // obj.money = obj.list.cost_money;
  65. obj.price = obj.list.cost_money;
  66. obj.step = obj.list.step;
  67. console.log(obj.list);
  68. });
  69. },
  70. //阅读并同意
  71. Getcheckbox() {
  72. let obj = this;
  73. obj.checked = !obj.checked;
  74. },
  75. ToIndex() {
  76. uni.navigateTo({
  77. url: '/pages/finance/xieyi'
  78. });
  79. },
  80. pay() {
  81. let obj = this;
  82. if (obj.password == '') {
  83. obj.$api.msg('请输入交易密码!');
  84. return;
  85. }
  86. if (obj.checked == false) {
  87. obj.$api.msg('请阅读并同意协议!');
  88. return;
  89. }
  90. buyMining(
  91. {
  92. num: obj.num * obj.step,
  93. trade_psw: obj.password
  94. },
  95. obj.id
  96. )
  97. .then(data => {
  98. obj.$api.msg(data.msg);
  99. obj.password = '';
  100. obj.num = 1;
  101. })
  102. .catch(e => {
  103. obj.password = '';
  104. obj.num = 1;
  105. if (e.msg == '交易密码错误') {
  106. return;
  107. }
  108. console.log(e);
  109. var reg = new RegExp('购买矿机所需的');
  110. if (e.msg.match(reg) == -1) {
  111. } else {
  112. setTimeout(function() {
  113. uni.navigateTo({
  114. url: '/pages/finance/recharge'
  115. });
  116. }, 1000);
  117. }
  118. });
  119. },
  120. numberChange(data) {
  121. let obj = this;
  122. obj.num = data.number;
  123. },
  124. buy() {
  125. // let list = JSON.stringify(this.list)
  126. uni.navigateTo({
  127. url: '/pages/market/pay?&id=' + this.id + '&type=' + this.type
  128. });
  129. // console.log(this.list,'--------------***********')
  130. // console.log('buy click')
  131. },
  132. changeCurrent(index) {
  133. this.current = index;
  134. },
  135. back() {
  136. uni.navigateBack({
  137. url: '/pages/calculation/buyCalculation'
  138. });
  139. }
  140. }
  141. };
  142. </script>
  143. <style lang="scss" scoped>
  144. page,
  145. .center {
  146. background: #f8f6f6;
  147. height: 100%;
  148. }
  149. .top {
  150. background: #45969B;
  151. width: 750rpx;
  152. height: 710rpx;
  153. }
  154. .name-box {
  155. padding: 30rpx 26rpx;
  156. line-height: 1;
  157. background-color: #FFFFFF;
  158. .price-box {
  159. font-size: 28rpx;
  160. font-family: PingFang SC;
  161. font-weight: bold;
  162. color: #333333;
  163. .price {
  164. font-size: 48rpx;
  165. color: #E83F30;
  166. }
  167. .unit {
  168. display: inline-block;
  169. padding-left: 10rpx;
  170. color: #E83F30;
  171. }
  172. .yuan {
  173. padding-left: 10rpx;
  174. font-size: 30rpx;
  175. font-weight: 500;
  176. text-decoration: line-through;
  177. color: #999999;
  178. }
  179. }
  180. .name {
  181. font-size: 34rpx;
  182. font-family: PingFang SC;
  183. font-weight: bold;
  184. color: #1D2023;
  185. margin-top: 30rpx;
  186. }
  187. }
  188. .tip-box {
  189. margin-top: 20rpx;
  190. padding: 34rpx 90rpx 50rpx 30rpx;
  191. display: flex;
  192. align-items: flex-start;
  193. background-color: #FFFFFF;
  194. .tip-titele {
  195. font-size: 32rpx;
  196. font-family: PingFang SC;
  197. font-weight: bold;
  198. color: #3B3B3B;
  199. }
  200. .tip-main {
  201. margin-left: 30rpx;
  202. width: 467rpx;
  203. font-size: 26rpx;
  204. font-family: PingFang SC;
  205. font-weight: 500;
  206. color: #8A8A8A;
  207. }
  208. }
  209. .detail {
  210. .detail-title{
  211. width: 750rpx;
  212. height: 80rpx;
  213. line-height: 80rpx;
  214. text-align: center;
  215. font-size: 28rpx;
  216. font-family: PingFangSC;
  217. font-weight: bold;
  218. color: #1D2023;
  219. }
  220. }
  221. .btn {
  222. position: fixed;
  223. bottom: 0;
  224. left: 0;
  225. right: 0;
  226. width: 750rpx;
  227. height: 98rpx;
  228. background: linear-gradient(0deg, #2E58FF, #32C6FF);
  229. text-align: center;
  230. line-height: 98rpx;
  231. font-size: 36rpx;
  232. font-family: PingFang SC;
  233. font-weight: bold;
  234. color: #FFFFFF;
  235. }
  236. </style>