fitProductlist.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279
  1. <template>
  2. <view>
  3. <view class="searchBox">
  4. <view class="searchBox_l"><u-search placeholder="请输入产品编码/产品名称" v-model="keyword" bg-color="#fff" :action-style="searchStyle"></u-search></view>
  5. <view class="searchBox_r" @click="sortShow = true">
  6. <text>排序</text>
  7. <u-icon color="#666666" name="paixu" custom-prefix="iscm-icon"></u-icon>
  8. </view>
  9. </view>
  10. <view v-if="list.length > 0">
  11. <view class="listBox" v-for="(item, i) in list" :key="i">
  12. <view class="listBox_l"><image :src="item.images" width="100%" height="100%"></image></view>
  13. <view class="listBox_r">
  14. <view class="type">{{ item.productCode }}</view>
  15. <view class="tit">{{ item.productName }}i</view>
  16. <view class="bot u-flex u-row-between">
  17. <view>
  18. 适配有货
  19. <text>{{ item.isStockCount || 0 }}</text>
  20. </view>
  21. <view>
  22. 适配无货
  23. <text>{{ item.notStockCount || 0}}</text>
  24. </view>
  25. </view>
  26. </view>
  27. </view>
  28. <view style="padding: 20rpx 0;"><u-loadmore :status="status" /></view>
  29. </view>
  30. <view v-else class="emptyStyle"><u-empty :src="`/static/${$config('themePath')}/def_no_data@3x.png`" icon-size="150" text="暂无匹配产品" mode="list"></u-empty></view>
  31. <!-- 排序弹窗 -->
  32. <u-popup v-model="sortShow" mode="right" width="60%">
  33. <view class="sortPopup">
  34. <view class="sortList" v-for="(item, i) in sortList" :key="i" :class="isSortFlag == i ? 'sortChecked' : ''" @click="chooseSort(i)">{{ item.name }}</view>
  35. <view class="butBox u-flex u-row-between">
  36. <u-button shape="circle" size="medium" @click="reset">重置</u-button>
  37. <u-button shape="circle" size="medium" type="primary" @click="handelSort">确定</u-button>
  38. </view>
  39. </view>
  40. </u-popup>
  41. </view>
  42. </template>
  43. <script>
  44. import { reportPage } from '@/api/vinLog';
  45. export default {
  46. data() {
  47. return {
  48. searchStyle: {
  49. border: '1rpx solid #189Dff',
  50. marginRight: '10rpx',
  51. borderRadius: '26rpx',
  52. color: '#189Dff',
  53. fontSize: '26rpx',
  54. padding: '4rpx 10rpx'
  55. },
  56. sortShow: false,
  57. keyword: '',
  58. sortList: [
  59. {
  60. id: 1,
  61. name: '最近次VIN扫描时间降序'
  62. },
  63. {
  64. id: 2,
  65. name: '适配有货降序'
  66. },
  67. {
  68. id: 3,
  69. name: '适配无货降序'
  70. }
  71. ],
  72. isSortFlag: -1,
  73. list: [],
  74. shelfSn: '',
  75. pageNo: 1,
  76. pageSize: 10,
  77. noDataText: '暂无数据',
  78. status: 'loading',
  79. totalNum:0,
  80. total:0
  81. };
  82. },
  83. onLoad(options) {
  84. this.shelfSn = options.shelfSn;
  85. let ajaxData = {
  86. pageNo: this.pageNo,
  87. pageSize: this.pageSize,
  88. shelfSn: this.shelfSn
  89. };
  90. this.loadData(ajaxData);
  91. },
  92. methods: {
  93. // 获取数字货架列表
  94. loadData(params) {
  95. const _this = this;
  96. _this.status = 'loading';
  97. reportPage(params).then(res => {
  98. if (res.status == 200) {
  99. if(this.pageNo>1){
  100. this.list = this.list.concat(res.data.list || [])
  101. }else{
  102. this.list = res.data.list || []
  103. }
  104. this.totalNum = res.data.count || 0
  105. } else {
  106. this.list = []
  107. this.totalNum = 0
  108. this.noDataText = res.message
  109. }
  110. this.status = "loadmore"
  111. });
  112. },
  113. chooseSort(i) {
  114. this.isSortFlag = i;
  115. },
  116. reset() {
  117. this.isSortFlag = -1;
  118. let ajaxData = {
  119. pageNo: 1,
  120. pageSize: this.pageSize,
  121. shelfSn: this.shelfSn
  122. };
  123. this.loadData(ajaxData);
  124. },
  125. handelSort() {
  126. if (this.isSortFlag == -1) {
  127. uni.showToast({
  128. title: '请选择排序方式',
  129. icon: 'none',
  130. duration: 4000
  131. });
  132. } else {
  133. var ajaxData = {
  134. shelfSn: this.shelfSn,
  135. pageNo: this.pageNo,
  136. pageSize: this.pageSize
  137. };
  138. if (this.isSortFlag == 0) {
  139. ajaxData.orderBy = 'xvfp.scan_vin_date desc,xp.code asc';
  140. } else if (this.isSortFlag == 1) {
  141. ajaxData.orderBy = 'xvfp.in_stock_count desc,xp.code asc';
  142. } else {
  143. ajaxData.orderBy = 'xvfp.not_stock_count desc,xp.code asc';
  144. }
  145. this.isSortFlag = -1;
  146. this.sortShow=false;
  147. this.loadData(ajaxData);
  148. }
  149. }
  150. },
  151. //到底部加载更多
  152. onReachBottom() {
  153. if (this.list.length < this.totalNum) {
  154. this.pageNo += 1;
  155. let ajaxData = {
  156. shelfSn: this.shelfSn,
  157. pageNo: this.pageNo,
  158. pageSize: this.pageSize
  159. };
  160. this.loadData(ajaxData);
  161. } else {
  162. this.status = 'nomore';
  163. }
  164. }
  165. };
  166. </script>
  167. <style lang="less" scoped>
  168. page {
  169. background: #ffffff;
  170. padding: 20rpx;
  171. display: inherit !important;
  172. .searchBox {
  173. width: 100%;
  174. display: flex;
  175. align-items: center;
  176. .searchBox_l {
  177. width: 80%;
  178. border: 1rpx solid #e0e0e0;
  179. border-radius: 36rpx;
  180. box-sizing: border-box;
  181. }
  182. .searchBox_r {
  183. width: 19%;
  184. color: #666666;
  185. text-align: right;
  186. text {
  187. margin-right: 10rpx;
  188. }
  189. }
  190. }
  191. .listBox {
  192. width: 100%;
  193. display: flex;
  194. padding: 30rpx 0;
  195. border-bottom: 1rpx solid #e0e0e0;
  196. .listBox_l {
  197. width: 150rpx;
  198. height: 150rpx;
  199. overflow: hidden;
  200. border-radius: 20rpx;
  201. margin-right: 20rpx;
  202. image {
  203. width: 100%;
  204. height: 100%;
  205. }
  206. }
  207. .listBox_r {
  208. width: calc(100% - 170rpx);
  209. .type {
  210. color: #222;
  211. font-size: 32rpx;
  212. }
  213. .tit {
  214. margin: 10rpx 0;
  215. overflow: hidden;
  216. text-overflow: ellipsis;
  217. display: -webkit-box;
  218. -webkit-line-clamp: 1;
  219. -webkit-box-orient: vertical;
  220. }
  221. .bot {
  222. width: 100%;
  223. view {
  224. &:first-child {
  225. color: #999;
  226. text {
  227. color: green;
  228. margin: 0 10rpx;
  229. }
  230. }
  231. &:last-child {
  232. color: #999;
  233. text {
  234. color: red;
  235. margin: 0 10rpx;
  236. }
  237. }
  238. }
  239. }
  240. }
  241. }
  242. // 弹窗样式
  243. .sortPopup {
  244. padding: 30rpx 20rpx;
  245. box-sizing: border-box;
  246. .sortList {
  247. width: 100%;
  248. height: 70rpx;
  249. text-align: center;
  250. line-height: 70rpx;
  251. border-radius: 60rpx;
  252. color: #333;
  253. margin-bottom: 30rpx;
  254. font-size: 26rpx;
  255. background-color: #e0e0e0;
  256. }
  257. .butBox {
  258. margin-top: 100rpx;
  259. }
  260. .sortChecked {
  261. background-color: #999;
  262. color: #ffffff;
  263. }
  264. }
  265. .emptyStyle {
  266. margin-top: 280rpx;
  267. }
  268. .u-size-medium {
  269. padding: 0 60rpx !important;
  270. }
  271. }
  272. </style>