index.vue 5.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216
  1. <template>
  2. <view>
  3. <view class="top-button">
  4. <page-head :showQutation="showQutation" ref="pageHead" @headGetData="headGetData"></page-head>
  5. </view>
  6. <view class="bg-white" :style="{'paddingTop':$refs.pageHead&&$refs.pageHead.searchShow ? '170px' : '50px'}"
  7. style="padding-bottom: 40px;">
  8. <uni-list v-for="(item,index) in tableData" :key="index">
  9. <uni-list-item showArrow link @click="rowClick(item)"
  10. :to="isQuotation ? '' : './ShoeStyleView?' + 'styleNum=' + item.styleNum + '&' + 'version=' + item.version">
  11. <!-- :to="isQuotation ? '' : './ShoeStyleView?data='+ encodeURIComponent()" -->
  12. <template v-slot:header>
  13. <view class="slot-box">
  14. <view style="display: block;width: 135px;">
  15. <view v-if="isQuotation" style="float: left;margin-top: -5px;width: 23px;">
  16. <uni-data-checkbox multiple v-model="item.quotation" :localdata="[{text: '',value: 0}]" />
  17. </view>
  18. <image class="slot-image img" :src="item.foto" mode="widthFix"></image>
  19. </view>
  20. </view>
  21. </template>
  22. <template v-slot:body>
  23. <text class="slot-box slot-text">
  24. <text style="display: block;">{{item.styleNum}} {{item.color}} {{item.version}}</text>
  25. <text style="display: block;font-size: 12px;color: #909399;">
  26. 面料:{{item.upper? item.upper: ''}}</text>
  27. <text style="display: block;font-size: 12px;color: #909399;">
  28. 大底:{{item.outsole? item.outsole: ''}}</text>
  29. </text>
  30. </template>
  31. </uni-list-item>
  32. </uni-list>
  33. </view>
  34. </view>
  35. </template>
  36. <script>
  37. import {
  38. listShoeStyle,
  39. getSign,
  40. SHOE_STYLE_QUERY
  41. } from '@/api/trade/shoe-style.js'
  42. export default {
  43. name: 'Index',
  44. props: {
  45. showQutation: {
  46. type: Boolean,
  47. default: true
  48. },
  49. },
  50. data() {
  51. return {
  52. getDataApi: listShoeStyle,
  53. getSign: getSign,
  54. tableData: [],
  55. // 数据总量
  56. total: 0,
  57. totalPages: null,
  58. loading: false,
  59. queryfrom: Object.assign({}, SHOE_STYLE_QUERY, {
  60. // 每页数据量
  61. pageSize: 15,
  62. // 当前页
  63. pageNum: 1
  64. }),
  65. procOption: [],
  66. picker: [],
  67. // -报价
  68. isQuotation: false, // 是否勾选,开始报价
  69. selects: [], // 选中行
  70. }
  71. },
  72. onLoad() {
  73. // this.getConfig()
  74. this.picker = this.$store.state.user.factoryOption
  75. this.procOption = this.$store.state.user.procOption
  76. console.log(this.procOption)
  77. this.selectedIndexs = []
  78. this.getData()
  79. },
  80. onReachBottom() {
  81. this.bottomload()
  82. },
  83. methods: {
  84. //判断还有无,下一页数据
  85. //判断当前的页码是否大于等于 总页数
  86. bottomload() {
  87. if (this.queryfrom.pageNum >= this.totalPages) {
  88. //没有下一页数据
  89. uni.showToast({ title: '没有下一页数据', })
  90. } else {
  91. //还有下一页
  92. this.queryfrom.pageNum++
  93. this.getData()
  94. }
  95. },
  96. rowClick(row, index) {
  97. if (this.isQuotation) {
  98. if (row.quotation.length == 0) {
  99. row.quotation = [0]
  100. this.selects.push(row)
  101. } else {
  102. row.quotation = []
  103. this.selects = this.selects.filter(it => it.id != row.id)
  104. }
  105. this.$emit('selects', this.selects)
  106. };
  107. },
  108. // 分页触发
  109. change(e) {
  110. // this.$refs.table.clearSelection()
  111. this.selectedIndexs.length = 0
  112. this.getData(e.current)
  113. },
  114. headGetData(val) {
  115. console.log('headGetData')
  116. this.queryfrom = Object.assign(this.queryfrom, val)
  117. this.tableData = []
  118. this.getData(1)
  119. },
  120. // 获取数据
  121. getData(pageCurrent, value = '') {
  122. this.loading = true
  123. this.pageCurrent = pageCurrent ? pageCurrent : this.queryfrom.pageNum
  124. this.queryfrom.pageNum = this.pageCurrent
  125. uni.showLoading({ title: '加载中' })
  126. this.getDataApi(this.queryfrom).then(res => {
  127. uni.hideLoading()
  128. this.loading = false
  129. if (res.code === 200 && res.rows && res.rows.length > 0) {
  130. res.rows = res.rows.map(item => {
  131. let obj = this.selects.find(it => it.id == item.id)
  132. if (obj) {
  133. item.quotation = [0]
  134. } else {
  135. item.quotation = []
  136. }
  137. item.styleId = item.id
  138. return item
  139. })
  140. const total = res.total
  141. //计算总页数----总共几页 = Math.ceil( 总条数 / 一页条数)
  142. this.totalPages = Math.ceil(total / this.queryfrom.pageSize)
  143. this.tableData = [...this.tableData, ...res.rows]
  144. }
  145. }).catch(err => {
  146. uni.hideLoading()
  147. this.loading = false
  148. })
  149. },
  150. }
  151. }
  152. </script>
  153. <style>
  154. /* .import-btn {
  155. padding: 0px;
  156. width: 100%;
  157. height: 36px;
  158. text-align: center;
  159. line-height: 36px;
  160. background-color: #409EFF;
  161. color: aliceblue;
  162. } */
  163. .chat-custom-right {
  164. flex: 1;
  165. /* #ifndef APP-NVUE */
  166. display: flex;
  167. /* #endif */
  168. flex-direction: column;
  169. justify-content: space-between;
  170. align-items: flex-end;
  171. }
  172. .chat-custom-text {
  173. font-size: 12px;
  174. color: #999;
  175. }
  176. .img {
  177. width: 100px;
  178. height: 100%;
  179. margin-right: 10px;
  180. }
  181. .container {
  182. width: 100%;
  183. min-height: 100vh;
  184. display: flex;
  185. flex-direction: column;
  186. }
  187. /* .down-button {
  188. z-index: 10;
  189. position: fixed;
  190. padding: 5px;
  191. bottom: 0px;
  192. width: 100%;
  193. height: 40px;
  194. background-color: #fff;
  195. } */
  196. .top-button {
  197. z-index: 10;
  198. position: fixed;
  199. /* padding: 5px; */
  200. top: 0px;
  201. width: 100%;
  202. height: 50px;
  203. background-color: #fff;
  204. padding: 5px;
  205. border-bottom: 1px #ddd solid;
  206. }
  207. </style>