details.vue 9.0 KB

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