details.vue 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418
  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. };
  122. },
  123. onLoad(option) {
  124. console.log(option,"detail-option")
  125. this.waypath = option.waypath
  126. this.way = option.way
  127. console.log("detail",this.way)
  128. this.code = option.code;
  129. this.logo = option.logo;
  130. this.name = option.name;
  131. this.price = option.price;
  132. this.charge = option.charge;
  133. this.address = option.address
  134. console.log(this.address,"detail")
  135. this._address_qr = option._address_qr;
  136. this.__money_address = option.__money_address;
  137. this.mark = option.mark;
  138. this.ids = option.ids;
  139. this.keysAddr = option.keysAddr;
  140. this.moneyType();
  141. this.loadData();
  142. },
  143. onShow() {
  144. },
  145. methods: {
  146. async loadData() {
  147. let obj = this;
  148. moneyLog({
  149. page: 1,
  150. limit: 10000,
  151. type: obj.type,
  152. }, obj.code).then(({
  153. data
  154. }) => {
  155. obj.typeList = data.type_list;
  156. obj.list = data.list;
  157. });
  158. },
  159. // 所有币种
  160. async moneyType(){
  161. let obj = this;
  162. moneyType({}).then(({ data }) => {
  163. obj.moneyTypeList = data;
  164. });
  165. },
  166. pay(){
  167. let obj = this;
  168. recharge({
  169. num:obj.num,
  170. money_type:obj.code
  171. },obj.buyId).then(({ data }) => {
  172. obj.$api.msg(data.msg);
  173. obj.$refs.popup.close();
  174. obj.num='';
  175. obj.code = '';
  176. uni.navigateTo({
  177. url:'/pages/finance/recharge?LOGO='+data._address_qr+'&order_id='+data.order_id+'&ddress='+data.__money_address+'&id='+data.id+'&=charge'+obj.charge
  178. })
  179. }).catch(e => {
  180. obj.$refs.popup.close();
  181. });
  182. },
  183. selectOne(options) {
  184. this.name = options.name;
  185. this.code = options.code;
  186. },
  187. useOutClickSide() {
  188. this.$refs.easySelect.hideOptions && this.$refs.easySelect.hideOptions()
  189. },
  190. handleTap(name) {
  191. this.$refs[name].show()
  192. },
  193. handleChange(e) {
  194. // this.title = e.item.title;
  195. // this.type = e.item.type;
  196. },
  197. handleConfirm(e) {
  198. this.title = e.item.title;
  199. this.type = e.item.type;
  200. this.loadData();
  201. },
  202. handleCancel(e) {},
  203. recharge(){
  204. uni.navigateTo({
  205. url:
  206. '/pages/finance/recharge?logo=' +
  207. this.logo +
  208. '&name=' +
  209. this.name +
  210. '&code=' +
  211. this.code +
  212. '&_address_qr=' +
  213. this._address_qr +
  214. '&__money_address=' +
  215. this.__money_address +
  216. '&mark=' +
  217. this.mark +
  218. '&ids=' +
  219. this.ids +
  220. '&keysAddr=' +
  221. this.keysAddr +
  222. '&charge=' + this.charge +
  223. '&address=' + this.address +
  224. '&way=' + this.way +
  225. '&waypath=' + this.waypath
  226. });
  227. // this.$refs.popup.open();
  228. },
  229. close() {
  230. // this.$refs.popup.close();
  231. this.$refs.mation.close();
  232. },
  233. withdraw(){
  234. uni.navigateTo({
  235. url:'/pages/finance/withdraw?logo='+this.logo+'&name='+this.name+'&code='+this.code+'&money='+this.price
  236. })
  237. },
  238. navTo(url) {
  239. uni.navigateTo({
  240. url
  241. });
  242. },
  243. nav(index) {
  244. const obj = this;
  245. obj.text = obj.list[index].mark;
  246. obj.balance = obj.list[index].balance;
  247. obj.number = obj.list[index].number;
  248. if(obj.list[index].pm == 1) {
  249. obj.pm = '+';
  250. obj.before = parseFloat(obj.balance) - parseFloat(obj.number);
  251. }else{
  252. obj.pm = '-';
  253. obj.before = parseFloat(obj.balance) + parseFloat(obj.number);
  254. }
  255. this.$refs.mation.open();
  256. }
  257. }
  258. };
  259. </script>
  260. <style lang="scss">
  261. page {
  262. min-height: 100%;
  263. background-color: #ffffff;
  264. .container {
  265. width: 100%;
  266. padding: 60rpx 30rpx 120rpx 30rpx;
  267. }
  268. }
  269. .logo {
  270. text-align: center;
  271. image {
  272. width: 119rpx;
  273. height: 119rpx;
  274. }
  275. }
  276. .select-box {
  277. position: absolute;
  278. right: 0;
  279. padding: 30rpx 30rpx;
  280. font-size: 32rpx;
  281. font-weight: 500;
  282. color: #333333;
  283. image {
  284. width: 21rpx;
  285. height: 11rpx;
  286. margin-left: 15rpx;
  287. }
  288. .select-name {
  289. padding-right: 15rpx;
  290. }
  291. }
  292. .list {
  293. margin-top: 120rpx;
  294. }
  295. .list-box {
  296. padding: 60rpx 0rpx 30rpx 0rpx;
  297. font-size: 30rpx;
  298. font-weight: 400;
  299. color: #333333;
  300. .tpl-time {
  301. font-size: 24rpx;
  302. font-weight: 400;
  303. color: #999999;
  304. width: 100%;
  305. text-align: right;
  306. padding-top: 25rpx;
  307. }
  308. .list-tpl {
  309. image {
  310. width: 39rpx;
  311. height: 43rpx;
  312. }
  313. .tpl-name {
  314. padding: 0rpx 15rpx 0rpx 30rpx;
  315. }
  316. }
  317. .num {
  318. font-size: 36rpx;
  319. font-weight: 400;
  320. color: #FB3A2F;
  321. width: 50%;
  322. text-align: right;
  323. }
  324. }
  325. .empty-box{
  326. width: 100%;
  327. height:500rpx;
  328. padding-top: 200rpx;
  329. }
  330. .submit-box {
  331. position: fixed;
  332. bottom: 0;
  333. left: 0;
  334. width: 100%;
  335. background-color: #5771DF;
  336. color: #FFFFFF;
  337. .submit {
  338. padding: 20rpx 20%;
  339. }
  340. .tip {
  341. width: 2rpx;
  342. height: 37rpx;
  343. background: #FFFFFF;
  344. }
  345. }
  346. //弹窗
  347. .popup{
  348. height: 618rpx;
  349. background: #FFFFFF;
  350. box-shadow: 3rpx 3rpx 6rpx 0rpx rgba(31, 31, 31, 0.17);
  351. border-radius: 40rpx;
  352. width: 700rpx;
  353. .cancel{
  354. text-align: center;
  355. width: 100%;
  356. line-height: 60rpx;
  357. position: relative;
  358. .tip{
  359. color: #000000;
  360. width:70rpx;
  361. height: 70rpx;
  362. position: absolute;
  363. top: 0;
  364. right: 0;
  365. }
  366. }
  367. .list-boxs{
  368. width: 90%;
  369. margin: 0 auto;
  370. margin-top: 100rpx;
  371. .textBox {
  372. padding: 24rpx 18rpx;
  373. .font {
  374. font-size: 28rpx;
  375. font-family: PingFang SC;
  376. font-weight: bold;
  377. color: #4F4F4F;
  378. }
  379. .number {
  380. font-size: 28rpx;
  381. font-family: PingFang SC;
  382. font-weight: bold;
  383. color: #FB3A2F;
  384. }
  385. .text {
  386. text-indent:2em;
  387. font-size: 28rpx;
  388. font-family: PingFang SC;
  389. font-weight: bold;
  390. color: #4F4F4F;
  391. }
  392. }
  393. .xian {
  394. width: 100%;
  395. height: 1px;
  396. background: #E7DFE8;
  397. }
  398. }
  399. }
  400. </style>