index.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214
  1. <template>
  2. <view class="mainBox">
  3. <uni-nav-bar background-color="#157A2C" color="#fff" fixed="true" statusBar="true" left-icon="back"
  4. title="配件回收记录" @clickLeft="back">
  5. </uni-nav-bar>
  6. <view class="top-wrapper">
  7. <uni-section>
  8. <uni-easyinput prefixIcon="search" style="width: 460rpx" v-model="searchVal" placeholder="名称">
  9. </uni-easyinput>
  10. </uni-section>
  11. <button class="search_btn" @click="doSearch">搜索</button>
  12. <image class="menu_icon" src="~@/static/pda/menu.svg"></image>
  13. </view>
  14. <view class="wrapper">
  15. <u-list @scrolltolower="scrolltolower" class="listContent" style="height: auto;">
  16. <view v-for="(item, index) in tableList" :key="index" style="position: relative;">
  17. <myCard :columns="columns" :btnList="btnList" :item="item">
  18. </myCard>
  19. </view>
  20. </u-list>
  21. </view>
  22. </view>
  23. </template>
  24. <script>
  25. import {
  26. recyclePage,
  27. } from '@/api/salesServiceManagement/accessory/index.js';
  28. import myCard from '@/pages/saleManage/components/myCard.vue';
  29. export default {
  30. components: {
  31. myCard
  32. },
  33. data() {
  34. return {
  35. columns: [
  36. [{
  37. label: '编号:',
  38. prop: 'code',
  39. type: 'title',
  40. className: 'perce100',
  41. }],
  42. [{
  43. label: '工单编码:',
  44. prop: 'orderWorkCode'
  45. }],
  46. [{
  47. label: '物品名称:',
  48. prop: 'categoryName',
  49. formatter: (row) => {
  50. if (!row.details) return '';
  51. let str = '';
  52. row.details.map((el, idx) => {
  53. if (idx + 1 == row.details.length) {
  54. str += el.categoryName;
  55. } else {
  56. str = str + '' + el.categoryName + ',';
  57. }
  58. });
  59. return str;
  60. }
  61. }],
  62. [{
  63. label: '客户名称:',
  64. prop: 'contactName',
  65. }],
  66. [{
  67. label: '设备名称:',
  68. prop: 'categoryName',
  69. formatter: (row) => {
  70. if (!row.deviceDetails) return '';
  71. let str = '';
  72. row.deviceDetails.map((el, idx) => {
  73. if (idx + 1 == row.deviceDetails.length) {
  74. str += el.categoryName;
  75. } else {
  76. str = str + '' + el.categoryName + ',';
  77. }
  78. });
  79. return str;
  80. }
  81. }],
  82. [{
  83. label: '回收部门:',
  84. prop: 'recycleDeptName',
  85. }, {
  86. label: '回收人:',
  87. prop: 'recycleName',
  88. }],
  89. [{
  90. label: '创建时间:',
  91. prop: 'createTime'
  92. }, {
  93. label: '回收时间:',
  94. prop: 'usageTime',
  95. }],
  96. [{
  97. label: '操作:',
  98. prop: 'action',
  99. type: 'action',
  100. className: 'perce100',
  101. }],
  102. ],
  103. btnList: [{
  104. name: '详情',
  105. apiName: 'details',
  106. btnType: 'primary',
  107. type: '2',
  108. pageUrl: '',
  109. }, {
  110. name: '修改',
  111. apiName: 'edit',
  112. btnType: 'primary',
  113. type: '2',
  114. pageUrl: '',
  115. judge: [{
  116. authorities: '',
  117. }, {
  118. key: 'orderStatus',
  119. value: [1, 6],
  120. }],
  121. }],
  122. page: 1,
  123. size: 10,
  124. isEnd: false,
  125. tableList: [],
  126. searchVal: ''
  127. }
  128. },
  129. created() {
  130. this.doSearch();
  131. },
  132. methods: {
  133. doSearch() {
  134. this.isEnd = false;
  135. this.page = 1;
  136. this.getList();
  137. },
  138. //获取列表信息
  139. getList() {
  140. if (this.isEnd) {
  141. return;
  142. }
  143. uni.showLoading({
  144. title: '加载中'
  145. })
  146. let data = {
  147. pageNum: this.page,
  148. size: this.size,
  149. }
  150. recyclePage(data).then(res => {
  151. if (this.page === 1) {
  152. this.tableList = res.list;
  153. } else {
  154. this.tableList.push(...res.list);
  155. }
  156. console.log(this.tableList, 'res ____')
  157. this.page += 1
  158. this.isEnd = this.tableList.length >= res.count;
  159. uni.hideLoading();
  160. }).catch((e) => {
  161. uni.hideLoading();
  162. })
  163. },
  164. scrolltolower() {
  165. if (this.isEnd) {
  166. return;
  167. }
  168. this.getList();
  169. },
  170. }
  171. }
  172. </script>
  173. <style scoped lang="scss">
  174. .top-wrapper {
  175. background-color: #fff;
  176. display: flex;
  177. width: 750rpx;
  178. height: 88rpx;
  179. padding: 16rpx 32rpx;
  180. align-items: center;
  181. gap: 16rpx;
  182. /deep/.uni-section {
  183. margin-top: 0px;
  184. }
  185. /deep/.uni-section-header {
  186. padding: 0px;
  187. }
  188. .search_btn {
  189. width: 120rpx;
  190. height: 70rpx;
  191. line-height: 70rpx;
  192. padding: 0 24rpx;
  193. background: $theme-color;
  194. font-size: 32rpx;
  195. color: #fff;
  196. margin: 0;
  197. margin-left: 26rpx;
  198. }
  199. .menu_icon {
  200. width: 44rpx;
  201. height: 44rpx;
  202. margin-left: 14rpx;
  203. }
  204. }
  205. </style>