quotationsSecond.vue 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  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,QuotationsList, 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. FatherType: '',
  51. //是否显示弹出层
  52. open: false,
  53. //悬浮按钮右对齐
  54. right: 'right',
  55. //悬浮按钮下对齐
  56. bottom: 'bottom',
  57. //分类列表
  58. categories: [
  59. // 这里是一级分类的数据
  60. ],
  61. // 行情列表
  62. quotationsList: [
  63. // 这里是列表的数据
  64. ],
  65. //查询参数
  66. queryParams: {
  67. // pageNum: 1,
  68. // pageSize: 10,
  69. id: null,
  70. },
  71. //表单数据
  72. form: {},
  73. //分类树列表
  74. forms:{},
  75. imageList: []
  76. }
  77. },
  78. onLoad(e) {
  79. this.FatherType = e.type;
  80. this.getList();
  81. },
  82. methods: {
  83. getList(row) {
  84. // 这里是获取列表的方法
  85. this.form.type = this.FatherType
  86. listQuotations(this.form).then(response => {
  87. this.quotationsList = response.rows.map(item => {
  88. let date = new Date(item.createTime);
  89. item.createTime = date.toLocaleDateString('zh-CN', {dateStyle: 'short'});
  90. return item;
  91. });
  92. });
  93. this.forms.parentId = this.FatherType
  94. //获取分类树的方法
  95. QuotationsList(this.forms).then(response => {
  96. //取出response.rows中所有homeDisplay为1的数据
  97. this.categories = response.rows.filter(item => item.homeDisplay === 1);
  98. });
  99. },
  100. //递归查询分类的父级
  101. //根据分类id查询列表
  102. change(e) {
  103. this.queryParams.type = e.detail.index;
  104. listQuotations(this.queryParams).then(response => {
  105. this.quotationsList = response.rows.map(item => {
  106. let date = new Date(item.createTime);
  107. item.createTime = date.toLocaleDateString('zh-CN', {dateStyle: 'short'});
  108. return item;
  109. });
  110. });
  111. },
  112. //悬浮按钮点击事件
  113. fabClick() {
  114. uni.navigateTo({
  115. url: '../quotations/quotationsForm'
  116. });
  117. },
  118. updateImg(imgList) {
  119. this.imageList = imgList;
  120. }
  121. }
  122. }
  123. </script>
  124. <style>
  125. .grid-item-box {
  126. flex: 1;
  127. // position: relative;
  128. /* #ifndef APP-NVUE */
  129. display: flex;
  130. /* #endif */
  131. flex-direction: column;
  132. align-items: center;
  133. justify-content: center;
  134. padding: 0px 0;
  135. }
  136. .image {
  137. height: 100%;
  138. width: 100%;
  139. }
  140. </style>