index.vue 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227
  1. <template>
  2. <view class="index">
  3. <view class="u-u-swiper">
  4. <u-swiper @change="change" :height="250" :list="list" :title="title" :effect3d="effect3d"
  5. :indicator-pos="indicatorPos" :mode="mode" :interval="3000" @click="click"></u-swiper>
  6. </view>
  7. <!-- 菜单 -->
  8. <u-row class="tool-quick">
  9. <u-col :span="6" :offset="0">
  10. <image src="/static/index/cz.png" mode="widthFix" class="btn" @click="recharge()"></image>
  11. </u-col>
  12. <u-col :span="6" :offset="0">
  13. <image src="/static/index/tx.png" mode="widthFix" class="btn" @click="withdraw()"></image>
  14. </u-col>
  15. </u-row>
  16. <!-- 余额 -->
  17. <view class="balance">
  18. <text class="title">可用余额</text>
  19. <view class="money">
  20. <text>¥</text>
  21. 888888888888
  22. </view>
  23. </view>
  24. <!-- 商品列表 -->
  25. <view class="product-list">
  26. <text>商品列表</text>
  27. <view class="list-body">
  28. <u-row class="item down" v-for="(item,index) in goodList" @click="buys()">
  29. <u-col :span="2" :offset="0" class="icon-line">
  30. <image src="/static/index/icon.png" mode="widthFix" class="icon"></image>
  31. </u-col>
  32. <u-col :span="4" class="item-name">
  33. <text>{{item.ptitle}}</text>
  34. <view>{{item.en}}</view>
  35. </u-col>
  36. <u-col :span="2" :offset="0" class="diff-icon">
  37. <image src="/static/index/down.png" mode="widthFix" class="icon"></image>
  38. </u-col>
  39. <u-col :span="4" class="item-price">
  40. <view>¥{{item.Price}}</view>
  41. <text class="btn">交易中</text>
  42. </u-col>
  43. </u-row>
  44. </view>
  45. </view>
  46. </view>
  47. </template>
  48. <script>
  49. /*
  50. * 自定义底部导航栏
  51. */
  52. export default {
  53. data() {
  54. return {
  55. list: [{
  56. image: 'https://cdn.uviewui.com/uview/swiper/1.jpg',
  57. title: '昨夜星辰昨夜风,画楼西畔桂堂东'
  58. },
  59. {
  60. image: 'https://cdn.uviewui.com/uview/swiper/2.jpg',
  61. title: '身无彩凤双飞翼,心有灵犀一点通'
  62. },
  63. {
  64. image: 'https://cdn.uviewui.com/uview/swiper/3.jpg',
  65. title: '谁念西风独自凉,萧萧黄叶闭疏窗,沉思往事立残阳'
  66. }
  67. ],
  68. title: false,
  69. mode: 'round',
  70. indicatorPos: 'bottomCenter',
  71. effect3d: false,
  72. goodList:[]
  73. };
  74. },
  75. created() {
  76. this.getIndex();
  77. },
  78. methods:{
  79. titleChange(index) {
  80. this.title = index == 0 ? true : false;
  81. },
  82. modeChange(index) {
  83. this.mode = index == 0 ? 'round' : index == 1 ? 'rect' : index == 2 ? 'number' : 'none';
  84. },
  85. indicatorPosChange(index) {
  86. this.indicatorPos = index == 0 ? 'topLeft' : index == 1 ? 'topRight' : index == 2 ? 'bottomLeft' : index == 3 ? 'bottomCenter' : 'bottomRight';
  87. },
  88. effect3dChange(index) {
  89. this.effect3d = index == 0 ? true : false;
  90. },
  91. click(index) {
  92. this.$refs.uToast.show({
  93. title: `点击了第${index + 1}张图片`,
  94. type: 'success'
  95. })
  96. },
  97. change(index) {
  98. // console.log(index);
  99. },
  100. //获取首页数据
  101. getIndex(){
  102. uni.showLoading({
  103. title: '正在加载'
  104. })
  105. this.$request.sendToken('/index/index', {
  106. 'token': uni.getStorageSync('tokens')
  107. },'POST').then(res => {
  108. uni.hideLoading();
  109. // 打印调用成功回调
  110. console.log(res.data)
  111. this.goodList = res.data;
  112. })
  113. },
  114. //提现页面
  115. withdraw(){
  116. uni.navigateTo({
  117. url: '/pages/money/withdraw'
  118. });
  119. },
  120. //充值页面
  121. recharge(){
  122. uni.navigateTo({
  123. url: '/pages/money/recharge'
  124. });
  125. },
  126. //下单页面
  127. buys(){
  128. uni.navigateTo({
  129. url: '/pages/order/buys'
  130. });
  131. }
  132. }
  133. }
  134. </script>
  135. <style lang="scss" scoped>
  136. .index{
  137. padding: 50upx;
  138. padding-top: 150upx;
  139. .tool-quick{
  140. .btn{
  141. width: 90%;
  142. height: 60upx;
  143. }
  144. margin: 50upx 0;
  145. }
  146. .balance{
  147. background: linear-gradient(275deg, rgba(45, 45, 53, 0.1) 0%, #505058 100%);
  148. border: 4upx solid #979797;
  149. border-radius: 30upx;
  150. // min-height: 200upx;
  151. text-align: center;
  152. overflow: hidden;
  153. padding: 15upx;
  154. color: #FFFFFF;
  155. .title{
  156. color: #FFFFFF;
  157. margin: 20upx 0 ;
  158. }
  159. .money{
  160. padding: 20upx 0 ;
  161. text{
  162. font-size: 24upx;
  163. }
  164. font-size: 34upx;
  165. }
  166. }
  167. .product-list{
  168. padding: 30upx 0;
  169. color: #FFFFFF;
  170. margin-bottom: 120upx;
  171. .item{
  172. margin: 30upx 0;
  173. border-radius: 30upx;
  174. padding: 20upx;
  175. background: linear-gradient(275deg, rgba(45, 45, 53, 0.1) 0%, #505058 100%);
  176. .icon-line{
  177. border-right: 2upx dashed #979797;
  178. overflow: hidden;
  179. }
  180. .icon{
  181. width: 60upx;
  182. }
  183. .item-name{
  184. padding: 20upx !important;
  185. text-align: center !important;
  186. }
  187. .diff-icon{
  188. .icon{
  189. width: 50upx;
  190. }
  191. }
  192. .item-price{
  193. text-align: center !important;
  194. color: #FB736B;
  195. .btn{
  196. background-color: #FB736B;
  197. color: #FFFFFF;
  198. border-radius: 10upx;
  199. padding: 4upx 20upx;
  200. }
  201. view{
  202. margin: 10upx 0;
  203. }
  204. }
  205. }
  206. .down{
  207. }
  208. }
  209. }
  210. </style>