details.vue 6.8 KB

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