pingDetails.vue 4.9 KB

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