details.vue 8.5 KB

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