details.vue 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361
  1. <template>
  2. <view class="container">
  3. <view class="logo"><image :src="logo"></image></view>
  4. <view class="select-box flex_item">
  5. <view @tap="handleTap('picker')">{{ title }}</view>
  6. <lb-picker
  7. ref="picker"
  8. v-model="value"
  9. mode="selector"
  10. :list="typeList"
  11. :dataset="{ name: 'type' }"
  12. @change="handleChange"
  13. @confirm="handleConfirm"
  14. @cancel="handleCancel"
  15. ></lb-picker>
  16. <image src="../../static/img/img37.png"></image>
  17. </view>
  18. <view class="list" v-show="list.length > 0">
  19. <view class="list-box" v-for="(ls, index) in list" :key="index">
  20. <view class="flex">
  21. <view class="list-tpl flex_item">
  22. <image src="../../static/img/img36.png"></image>
  23. <view class="tpl-name">{{ ls.title }}</view>
  24. </view>
  25. <view class="num clamp">{{ ls.number }}</view>
  26. </view>
  27. <view class="tpl-time">{{ ls.add_time }}</view>
  28. </view>
  29. </view>
  30. <view class="empty-box" v-show="list.length == 0"><empty></empty></view>
  31. <view class="flex submit-box">
  32. <view class="submit" @click="recharge">充币</view>
  33. <view class="tip"></view>
  34. <view class="submit" @click="withdraw">提币</view>
  35. </view>
  36. <uni-popup ref="popup" type="center">
  37. <view class="popup">
  38. <view class="cancel flex" @click="close">
  39. <view></view>
  40. <view class="tip">x</view>
  41. </view>
  42. <view class="list-boxs">
  43. <view class="popup-text">购买数量:</view>
  44. <view class="password"><input type="number" v-model="num" placeholder="请输入算力数量" /></view>
  45. <view class="popup-text">币种选择:</view>
  46. <view class="content" @click="useOutClickSide"><easy-select ref="easySelect" :options="moneyTypeList" :value="name" @selectOne="selectOne"></easy-select></view>
  47. <view class="confirm-btn" @click="pay"><text>确认充币</text></view>
  48. </view>
  49. </view>
  50. </uni-popup>
  51. </view>
  52. </template>
  53. <script>
  54. import { moneyLog, recharge } from '@/api/finance.js';
  55. import { moneyType } from '@/api/index.js';
  56. import LbPicker from '@/components/lb-picker';
  57. import empty from '@/components/empty';
  58. export default {
  59. components: {
  60. LbPicker,
  61. empty
  62. },
  63. data() {
  64. return {
  65. code: '',
  66. title: '筛选',
  67. type: '',
  68. value: '',
  69. index: 0,
  70. typeList: [],
  71. list: '',
  72. num: '',
  73. moneyTypeList: [],
  74. money: '',
  75. name: '',
  76. logo: '',
  77. price: '',
  78. mark: '',
  79. _address_qr: '',
  80. __money_address: '',
  81. ids: '',
  82. keysAddr: '',
  83. charge: 0,
  84. address: '',
  85. way: [],
  86. waypath: ''
  87. };
  88. },
  89. onLoad(option) {
  90. console.log(option,"detail-option")
  91. this.waypath = option.waypath
  92. console.log(this.waypath,'+++++++++++++++++++++')
  93. this.way = option.way
  94. console.log("detail",this.way)
  95. this.code = option.code;
  96. this.logo = option.logo;
  97. this.name = option.name;
  98. this.price = option.price;
  99. this.charge = option.charge;
  100. this.address = option.address
  101. console.log(this.address,"detail")
  102. this._address_qr = option._address_qr;
  103. this.__money_address = option.__money_address;
  104. this.mark = option.mark;
  105. this.ids = option.ids;
  106. this.keysAddr = option.keysAddr;
  107. this.moneyType();
  108. this.loadData();
  109. },
  110. onShow() {},
  111. methods: {
  112. async loadData() {
  113. let obj = this;
  114. moneyLog(
  115. {
  116. page: 1,
  117. limit: 10000,
  118. type: obj.type
  119. },
  120. obj.code
  121. ).then(({ data }) => {
  122. obj.typeList = data.type_list;
  123. obj.list = data.list;
  124. console.log(obj.list)
  125. });
  126. },
  127. // 所有币种
  128. async moneyType() {
  129. let obj = this;
  130. moneyType({}).then(({ data }) => {
  131. obj.moneyTypeList = data;
  132. });
  133. },
  134. pay() {
  135. let obj = this;
  136. recharge(
  137. {
  138. num: obj.num,
  139. money_type: obj.code
  140. },
  141. obj.buyId
  142. )
  143. .then(({ data }) => {
  144. obj.$api.msg(data.msg);
  145. obj.$refs.popup.close();
  146. obj.num = '';
  147. obj.code = '';
  148. uni.navigateTo({
  149. url: '/pages/finance/recharge?LOGO=' + data._address_qr + '&order_id=' + data.order_id + '&ddress=' + data.__money_address + '&id=' + data.id
  150. });
  151. })
  152. .catch(e => {
  153. obj.$refs.popup.close();
  154. });
  155. },
  156. selectOne(options) {
  157. this.name = options.name;
  158. this.code = options.code;
  159. },
  160. useOutClickSide() {
  161. this.$refs.easySelect.hideOptions && this.$refs.easySelect.hideOptions();
  162. },
  163. handleTap(name) {
  164. this.$refs[name].show();
  165. },
  166. handleChange(e) {
  167. // this.title = e.item.title;
  168. // this.type = e.item.type;
  169. },
  170. handleConfirm(e) {
  171. this.title = e.item.title;
  172. this.type = e.item.type;
  173. this.loadData();
  174. },
  175. handleCancel(e) {},
  176. recharge() {
  177. uni.navigateTo({
  178. url:
  179. '/pages/finance/recharge?logo=' +
  180. this.logo +
  181. '&name=' +
  182. this.name +
  183. '&code=' +
  184. this.code +
  185. '&_address_qr=' +
  186. this._address_qr +
  187. '&__money_address=' +
  188. this.__money_address +
  189. '&mark=' +
  190. this.mark +
  191. '&ids=' +
  192. this.ids +
  193. '&keysAddr=' +
  194. this.keysAddr +
  195. '&charge=' + this.charge +
  196. '&address=' + this.address +
  197. '&way=' + this.way +
  198. '&waypath=' + this.waypath
  199. });
  200. // this.$refs.popup.open();
  201. },
  202. close() {
  203. this.$refs.popup.close();
  204. },
  205. withdraw() {
  206. uni.navigateTo({
  207. url: '/pages/finance/withdraw?logo=' + this.logo + '&name=' + this.name + '&code=' + this.code + '&money=' + this.price
  208. });
  209. },
  210. navTo(url) {
  211. uni.navigateTo({
  212. url
  213. });
  214. }
  215. }
  216. };
  217. </script>
  218. <style lang="scss">
  219. page {
  220. min-height: 100%;
  221. background-color: #ffffff;
  222. .container {
  223. width: 100%;
  224. padding: 60rpx 30rpx 120rpx 30rpx;
  225. }
  226. }
  227. .logo {
  228. text-align: center;
  229. image {
  230. width: 119rpx;
  231. height: 119rpx;
  232. }
  233. }
  234. .select-box {
  235. position: absolute;
  236. right: 0;
  237. padding: 30rpx 30rpx;
  238. font-size: 32rpx;
  239. font-weight: 500;
  240. color: #333333;
  241. image {
  242. width: 21rpx;
  243. height: 11rpx;
  244. margin-left: 15rpx;
  245. }
  246. .select-name {
  247. padding-right: 15rpx;
  248. }
  249. }
  250. .list {
  251. margin-top: 120rpx;
  252. }
  253. .list-box {
  254. padding: 60rpx 0rpx 30rpx 0rpx;
  255. font-size: 30rpx;
  256. font-weight: 400;
  257. color: #333333;
  258. .tpl-time {
  259. font-size: 24rpx;
  260. font-weight: 400;
  261. color: #999999;
  262. width: 100%;
  263. text-align: right;
  264. padding-top: 25rpx;
  265. }
  266. .list-tpl {
  267. image {
  268. width: 39rpx;
  269. height: 43rpx;
  270. }
  271. .tpl-name {
  272. padding: 0rpx 15rpx 0rpx 30rpx;
  273. }
  274. }
  275. .num {
  276. font-size: 36rpx;
  277. font-weight: 400;
  278. color: #fb3a2f;
  279. width: 50%;
  280. text-align: right;
  281. }
  282. }
  283. .empty-box {
  284. width: 100%;
  285. height: 500rpx;
  286. padding-top: 200rpx;
  287. }
  288. .submit-box {
  289. position: fixed;
  290. bottom: 0;
  291. left: 0;
  292. width: 100%;
  293. background-color: #5771df;
  294. color: #ffffff;
  295. .submit {
  296. padding: 20rpx 20%;
  297. }
  298. .tip {
  299. width: 2rpx;
  300. height: 37rpx;
  301. background: #ffffff;
  302. }
  303. }
  304. //弹窗
  305. .popup {
  306. background-color: #ffffff;
  307. border-radius: 25rpx;
  308. font-size: 30rpx;
  309. .cancel {
  310. text-align: center;
  311. width: 100%;
  312. line-height: 60rpx;
  313. .tip {
  314. background-color: #5771df;
  315. color: #ffffff;
  316. width: 70rpx;
  317. height: 70rpx;
  318. border-top-right-radius: 25rpx;
  319. }
  320. }
  321. .list-boxs {
  322. padding: 0rpx 80rpx;
  323. .password {
  324. padding: 50rpx 0rpx;
  325. width: 100%;
  326. input {
  327. width: 70%;
  328. height: 80rpx;
  329. border: 2rpx solid #999999;
  330. padding-left: 25rpx;
  331. box-shadow: 0px 3px 5px 0px rgba(0, 0, 0, 0.27);
  332. border-radius: 11rpx;
  333. }
  334. }
  335. .confirm-btn {
  336. padding-bottom: 120rpx;
  337. padding-top: 30rpx;
  338. text {
  339. background-color: #5771df;
  340. color: #ffffff;
  341. width: 70%;
  342. text-align: center;
  343. padding: 25rpx 90rpx;
  344. border-radius: 15rpx;
  345. }
  346. }
  347. }
  348. }
  349. </style>