fitProductlist.vue 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281
  1. <template>
  2. <view class="modal-box">
  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. uni.setNavigationBarTitle({
  92. title:options.shelfName
  93. })
  94. },
  95. methods: {
  96. // 获取数字货架列表
  97. loadData(params) {
  98. const _this = this;
  99. _this.status = 'loading';
  100. reportPage(params).then(res => {
  101. if (res.status == 200) {
  102. if(this.pageNo>1){
  103. this.list = this.list.concat(res.data.list || [])
  104. }else{
  105. this.list = res.data.list || []
  106. }
  107. this.totalNum = res.data.count || 0
  108. } else {
  109. this.list = []
  110. this.totalNum = 0
  111. this.noDataText = res.message
  112. }
  113. this.status = "loadmore"
  114. });
  115. },
  116. chooseSort(i) {
  117. this.isSortFlag = i;
  118. },
  119. reset() {
  120. this.isSortFlag = -1;
  121. let ajaxData = {
  122. pageNo: 1,
  123. pageSize: this.pageSize,
  124. shelfSn: this.shelfSn
  125. };
  126. this.loadData(ajaxData);
  127. },
  128. handelSort() {
  129. if (this.isSortFlag == -1) {
  130. uni.showToast({
  131. title: '请选择排序方式',
  132. icon: 'none',
  133. duration: 4000
  134. });
  135. } else {
  136. var ajaxData = {
  137. shelfSn: this.shelfSn,
  138. pageNo: this.pageNo,
  139. pageSize: this.pageSize
  140. };
  141. if (this.isSortFlag == 0) {
  142. ajaxData.orderBy = 'xvfp.scan_vin_date desc,xp.code asc';
  143. } else if (this.isSortFlag == 1) {
  144. ajaxData.orderBy = 'xvfp.in_stock_count desc,xp.code asc';
  145. } else {
  146. ajaxData.orderBy = 'xvfp.not_stock_count desc,xp.code asc';
  147. }
  148. this.isSortFlag = -1;
  149. this.sortShow=false;
  150. this.loadData(ajaxData);
  151. }
  152. }
  153. },
  154. //到底部加载更多
  155. onReachBottom() {
  156. if (this.list.length < this.totalNum) {
  157. this.pageNo += 1;
  158. let ajaxData = {
  159. shelfSn: this.shelfSn,
  160. pageNo: this.pageNo,
  161. pageSize: this.pageSize
  162. };
  163. this.loadData(ajaxData);
  164. } else {
  165. this.status = 'nomore';
  166. }
  167. }
  168. };
  169. </script>
  170. <style lang="less" scoped>
  171. .modal-box {
  172. background: #ffffff;
  173. padding: 20rpx;
  174. width: 100%;
  175. .searchBox {
  176. width: 100%;
  177. display: flex;
  178. align-items: center;
  179. .searchBox_l {
  180. width: 80%;
  181. border: 1rpx solid #e0e0e0;
  182. border-radius: 36rpx;
  183. box-sizing: border-box;
  184. }
  185. .searchBox_r {
  186. width: 19%;
  187. color: #666666;
  188. text-align: right;
  189. text {
  190. margin-right: 10rpx;
  191. }
  192. }
  193. }
  194. .listBox {
  195. width: 100%;
  196. display: flex;
  197. padding: 30rpx 0;
  198. border-bottom: 1rpx solid #e0e0e0;
  199. .listBox_l {
  200. width: 150rpx;
  201. height: 150rpx;
  202. overflow: hidden;
  203. border-radius: 20rpx;
  204. margin-right: 20rpx;
  205. image {
  206. width: 100%;
  207. height: 100%;
  208. }
  209. }
  210. .listBox_r {
  211. width: calc(100% - 170rpx);
  212. .type {
  213. color: #222;
  214. font-size: 32rpx;
  215. }
  216. .tit {
  217. margin: 10rpx 0;
  218. overflow: hidden;
  219. text-overflow: ellipsis;
  220. display: -webkit-box;
  221. -webkit-line-clamp: 1;
  222. -webkit-box-orient: vertical;
  223. }
  224. .bot {
  225. width: 100%;
  226. view {
  227. &:first-child {
  228. color: #999;
  229. text {
  230. color: green;
  231. margin: 0 10rpx;
  232. }
  233. }
  234. &:last-child {
  235. color: #999;
  236. text {
  237. color: red;
  238. margin: 0 10rpx;
  239. }
  240. }
  241. }
  242. }
  243. }
  244. }
  245. // 弹窗样式
  246. .sortPopup {
  247. padding: 30rpx 20rpx;
  248. box-sizing: border-box;
  249. .sortList {
  250. width: 100%;
  251. height: 70rpx;
  252. text-align: center;
  253. line-height: 70rpx;
  254. border-radius: 60rpx;
  255. color: #333;
  256. margin-bottom: 30rpx;
  257. font-size: 26rpx;
  258. background-color: #e0e0e0;
  259. }
  260. .butBox {
  261. margin-top: 100rpx;
  262. }
  263. .sortChecked {
  264. background-color: #999;
  265. color: #ffffff;
  266. }
  267. }
  268. .emptyStyle {
  269. margin-top: 280rpx;
  270. }
  271. .u-size-medium {
  272. padding: 0 60rpx !important;
  273. }
  274. }
  275. </style>