quotations.vue 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. <template>
  2. <view>
  3. <view>
  4. <scroll-view class="scroll-view_H" scroll-x="true" @scroll="scroll" scroll-left="120">
  5. <uni-grid :column="5" @change="change" showBorder="false" square="false">
  6. <uni-grid-item v-for="item in categories" :index="item.id">
  7. <view class="grid-item-box">
  8. <image class="image" :src="loadImgSrc(item.icon)" mode="aspectFit"></image>
  9. <text class="text">{{ item.productName }}</text>
  10. </view>
  11. </uni-grid-item>
  12. </uni-grid>
  13. </scroll-view>
  14. </view>
  15. <view class="uni-container">
  16. <uni-table>
  17. <uni-tr>
  18. <uni-th width="80" align="center">名称</uni-th>
  19. <uni-th width="80" align="center">类型</uni-th>
  20. <uni-th width="80" align="center">价格</uni-th>
  21. <uni-th width="100" align="center">时间</uni-th>
  22. </uni-tr>
  23. <uni-tr v-for="(item, index) in quotationsList" :key="index">
  24. <uni-td align="center">{{ item.productName }}
  25. </uni-td>
  26. <uni-td align="center">
  27. <view class="name">{{ item.type }}</view>
  28. </uni-td>
  29. <uni-td align="center">{{ item.price }}
  30. </uni-td>
  31. <uni-td align="center">{{ item.createTime }}
  32. </uni-td>
  33. </uni-tr>
  34. </uni-table>
  35. <uni-fab ref="fab" :horizontal="right" :vertical="bottom"
  36. @fabClick="fabClick()"/>
  37. </view>
  38. </view>
  39. </template>
  40. <script>
  41. import {listConfig, listQuotations} from "@/api/quotations/quotations";
  42. import upload from '../../components/upload/index.vue'
  43. export default {
  44. components: {
  45. upload
  46. },
  47. data() {
  48. return {
  49. //是否显示弹出层
  50. open: false,
  51. //悬浮按钮右对齐
  52. right: 'right',
  53. //悬浮按钮下对齐
  54. bottom: 'bottom',
  55. //分类列表
  56. categories: [
  57. // 这里是一级分类的数据
  58. ],
  59. // 行情列表
  60. quotationsList: [
  61. // 这里是列表的数据
  62. ],
  63. //查询参数
  64. queryParams: {
  65. // pageNum: 1,
  66. // pageSize: 10,
  67. id: null,
  68. },
  69. //表单数据
  70. form: {},
  71. imageList: []
  72. }
  73. },
  74. created() {
  75. this.getList();
  76. },
  77. methods: {
  78. getList(row) {
  79. // 这里是获取列表的方法
  80. listQuotations().then(response => {
  81. this.quotationsList = response.rows.map(item => {
  82. let date = new Date(item.createTime);
  83. item.createTime = date.toLocaleDateString('zh-CN', {dateStyle: 'short'});
  84. return item;
  85. });
  86. });
  87. //获取分类树的方法
  88. listConfig().then(response => {
  89. this.categories = response.data.quotations;
  90. });
  91. },
  92. //根据分类id查询列表
  93. change(e) {
  94. console.log(e)
  95. const type = e.detail.index;
  96. uni.navigateTo({
  97. url: `../quotations/quotationsSecond?type=${type}`
  98. });
  99. },
  100. //悬浮按钮点击事件
  101. fabClick() {
  102. uni.navigateTo({
  103. url: '../quotations/quotationsForm'
  104. });
  105. },
  106. updateImg(imgList) {
  107. this.imageList = imgList;
  108. }
  109. }
  110. }
  111. </script>
  112. <style>
  113. .grid-item-box {
  114. flex: 1;
  115. // position: relative;
  116. /* #ifndef APP-NVUE */
  117. display: flex;
  118. /* #endif */
  119. flex-direction: column;
  120. align-items: center;
  121. justify-content: center;
  122. padding: 0px 0;
  123. }
  124. .image {
  125. height: 100%;
  126. width: 100%;
  127. }
  128. </style>