addBackOrder.vue 7.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362
  1. <template>
  2. <view class="modal-box">
  3. <view class="header_box">
  4. <view class="headerName u-flex">
  5. <text class="barBox"></text>
  6. <view class="shelfName u-line-1">{{shelfName}}对方的观点和个人就一个人国服日服固定板</view>
  7. <view class="screeningBox" @click="sortShow = true">
  8. <text>滞销天数</text>
  9. <u-icon color="#666666" size="36" name="shaixuan" custom-prefix="iscm-icon"></u-icon>
  10. </view>
  11. </view>
  12. <view class="searchBox">
  13. <view class="searchBox_l">
  14. <u-search
  15. placeholder="请输入产品编码或产品名称搜索"
  16. @change="getSearchCon"
  17. @search="getSearchCon"
  18. @custom="getSearchCon"
  19. @clear="clearSearch"
  20. v-model="keyword"
  21. bg-color="#FFF"
  22. shape="round"
  23. :show-action="false"
  24. ></u-search>
  25. </view>
  26. <view class="searchBox_r">
  27. <u-icon color="#666666" size="40" name="saomiao" custom-prefix="iscm-icon"></u-icon>
  28. </view>
  29. </view>
  30. </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">
  36. <!-- <u-button hover-class="none" shape="circle" size="medium" @click="reset">重置</u-button> -->
  37. <!-- <u-button hover-class="none" :custom-style="customBtnStyle" size="medium" shape="circle" @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. sortShow: false,
  49. keyword: '',
  50. sortList: [
  51. {
  52. id: 1,
  53. name: '最近一次VIN扫描时间降序'
  54. },
  55. {
  56. id: 2,
  57. name: '适配有货降序'
  58. },
  59. {
  60. id: 3,
  61. name: '适配无货降序'
  62. }
  63. ],
  64. isSortFlag: 0,
  65. list: [],
  66. shelfSn: '',
  67. shelfName: '',
  68. pageNo: 1,
  69. pageSize: 10,
  70. noDataText: '暂无数据',
  71. status: 'loading',
  72. totalNum: 0,
  73. total: 0,
  74. theme:'',
  75. customBtnStyle: { // 自定义按钮样式
  76. borderColor: this.$config('primaryColor'),
  77. backgroundColor: this.$config('primaryColor'),
  78. color: '#fff'
  79. },
  80. };
  81. },
  82. onLoad(options) {
  83. this.theme = getApp().globalData.theme;
  84. this.shelfSn = options.shelfSn;
  85. this.shelfName = options.shelfName;
  86. let ajaxData = {
  87. pageNo: this.pageNo,
  88. pageSize: this.pageSize,
  89. shelfSn: this.shelfSn
  90. };
  91. this.loadData(ajaxData);
  92. },
  93. onBackPress(e) {
  94. if (this.sortShow) {
  95. this.sortShow = false;
  96. this.isSortFlag = 0;
  97. return true;
  98. }
  99. },
  100. methods: {
  101. // 获取数字货架列表
  102. loadData(params) {
  103. const _this = this;
  104. _this.status = 'loading';
  105. reportPage(params).then(res => {
  106. if (res.status == 200) {
  107. if (this.pageNo > 1) {
  108. this.list = this.list.concat(res.data.list || []);
  109. } else {
  110. this.list = res.data.list || [];
  111. }
  112. this.totalNum = res.data.count || 0;
  113. } else {
  114. this.list = [];
  115. this.totalNum = 0;
  116. this.noDataText = res.message;
  117. }
  118. this.status = 'loadmore';
  119. });
  120. },
  121. chooseSort(i) {
  122. this.isSortFlag = i;
  123. this.handelSort();
  124. },
  125. reset() {
  126. this.isSortFlag = 0;
  127. this.pageNo = 1;
  128. let ajaxData = {
  129. pageNo: 1,
  130. pageSize: this.pageSize,
  131. shelfSn: this.shelfSn
  132. };
  133. this.loadData(ajaxData);
  134. },
  135. // 搜索
  136. getSearchCon() {
  137. this.pageNo = 1;
  138. var reg = new RegExp('[\\u4E00-\\u9FFF]+', 'g');
  139. var ajaxData = null;
  140. if (reg.test(this.keyword)) {
  141. //包含汉字
  142. ajaxData = {
  143. pageNo: 1,
  144. pageSize: this.pageSize,
  145. shelfSn: this.shelfSn,
  146. productName: this.keyword.trim()
  147. };
  148. } else {
  149. ajaxData = {
  150. pageNo: 1,
  151. pageSize: this.pageSize,
  152. shelfSn: this.shelfSn,
  153. productCode: this.keyword.trim()
  154. };
  155. }
  156. if (this.isSortFlag == 0) {
  157. ajaxData.orderBy = 'xvfp.scan_vin_date desc,xp.code asc';
  158. } else if (this.isSortFlag == 1) {
  159. ajaxData.orderBy = 'xvfp.in_stock_count desc,xp.code asc';
  160. } else {
  161. ajaxData.orderBy = 'xvfp.not_stock_count desc,xp.code asc';
  162. }
  163. this.loadData(ajaxData);
  164. },
  165. // 清空搜索内容
  166. clearSearch() {
  167. this.keyword = '';
  168. this.reset();
  169. },
  170. handelSort() {
  171. this.pageNo = 1;
  172. var ajaxData = {
  173. shelfSn: this.shelfSn,
  174. pageNo: 1,
  175. pageSize: this.pageSize
  176. };
  177. if (this.keyword) {
  178. var reg = new RegExp('[\\u4E00-\\u9FFF]+', 'g');
  179. if (reg.test(this.keyword)) {
  180. ajaxData.productName=this.keyword.trim();
  181. }else{
  182. ajaxData.productCode=this.keyword.trim();
  183. }
  184. }
  185. if (this.isSortFlag == 0) {
  186. ajaxData.orderBy = 'xvfp.scan_vin_date desc,xp.code asc';
  187. } else if (this.isSortFlag == 1) {
  188. ajaxData.orderBy = 'xvfp.in_stock_count desc,xp.code asc';
  189. } else {
  190. ajaxData.orderBy = 'xvfp.not_stock_count desc,xp.code asc';
  191. }
  192. this.sortShow = false;
  193. this.loadData(ajaxData);
  194. }
  195. },
  196. //到底部加载更多
  197. onReachBottom() {
  198. if (this.list.length < this.totalNum) {
  199. this.pageNo += 1;
  200. var ajaxData = {
  201. shelfSn: this.shelfSn,
  202. pageNo: this.pageNo,
  203. pageSize: this.pageSize
  204. };
  205. if (this.keyword) {
  206. var reg = new RegExp('[\\u4E00-\\u9FFF]+', 'g');
  207. if (reg.test(this.keyword)) {
  208. ajaxData.productName=this.keyword.trim();
  209. }else{
  210. ajaxData.productCode=this.keyword.trim();
  211. }
  212. }
  213. if (this.isSortFlag == 0) {
  214. ajaxData.orderBy = 'xvfp.scan_vin_date desc,xp.code asc';
  215. } else if (this.isSortFlag == 1) {
  216. ajaxData.orderBy = 'xvfp.in_stock_count desc,xp.code asc';
  217. } else {
  218. ajaxData.orderBy = 'xvfp.not_stock_count desc,xp.code asc';
  219. }
  220. this.loadData(ajaxData);
  221. } else {
  222. this.status = 'nomore';
  223. }
  224. }
  225. };
  226. </script>
  227. <style lang="less" scoped>
  228. .modal-box {
  229. background: #ffffff;
  230. padding: 20rpx;
  231. width: 100%;
  232. .header_box{
  233. width: 100%;
  234. padding: 0 20rpx 20rpx;
  235. background-color: #fff;
  236. .headerName{
  237. padding-bottom: 15rpx;
  238. color: #222;
  239. font-size: 30rpx;
  240. .barBox{
  241. display: block;
  242. height: 30rpx;
  243. width: 6rpx;
  244. background: #0485F6;
  245. margin-right: 10rpx;
  246. border-radius: 10rpx;
  247. }
  248. .shelfName{
  249. font-weight: bold;
  250. width: calc(100% - 166rpx);
  251. }
  252. .screeningBox{
  253. font-size: 26rpx;
  254. width: 150rpx;
  255. text-align: right;
  256. text{
  257. vertical-align: top;
  258. }
  259. }
  260. }
  261. .searchBox {
  262. width: 100%;
  263. display: flex;
  264. align-items: center;
  265. padding:0 20rpx;
  266. border: 1rpx solid #e0e0e0;
  267. border-radius: 32rpx;
  268. box-sizing: border-box;
  269. .searchBox_l{
  270. width: 93%;
  271. }
  272. .searchBox_r{
  273. width: 7%;
  274. }
  275. }
  276. }
  277. .listBox {
  278. width: 100%;
  279. display: flex;
  280. padding: 30rpx 0;
  281. border-bottom: 1rpx solid #e0e0e0;
  282. .listBox_l {
  283. width: 150rpx;
  284. height: 150rpx;
  285. overflow: hidden;
  286. border-radius: 20rpx;
  287. margin-right: 20rpx;
  288. image {
  289. width: 100%;
  290. height: 100%;
  291. }
  292. }
  293. .listBox_r {
  294. width: calc(100% - 170rpx);
  295. .type {
  296. color: #222;
  297. font-size: 32rpx;
  298. }
  299. .tit {
  300. margin: 10rpx 0;
  301. overflow: hidden;
  302. text-overflow: ellipsis;
  303. display: -webkit-box;
  304. -webkit-line-clamp: 1;
  305. -webkit-box-orient: vertical;
  306. }
  307. .bot {
  308. width: 100%;
  309. view {
  310. &:first-child {
  311. color: #999;
  312. text {
  313. color: green;
  314. margin: 0 10rpx;
  315. }
  316. }
  317. &:last-child {
  318. color: #999;
  319. text {
  320. color: red;
  321. margin: 0 10rpx;
  322. }
  323. }
  324. }
  325. }
  326. }
  327. }
  328. // 弹窗样式
  329. .sortPopup {
  330. padding: 30rpx 20rpx;
  331. box-sizing: border-box;
  332. .sortList {
  333. width: 100%;
  334. height: 70rpx;
  335. text-align: center;
  336. line-height: 70rpx;
  337. border-radius: 60rpx;
  338. color: #333;
  339. margin-bottom: 30rpx;
  340. font-size: 26rpx;
  341. border: 1rpx solid #e0e0e0;
  342. }
  343. .butBox {
  344. margin-top: 100rpx;
  345. }
  346. .sortChecked {
  347. background-color: rgb(0, 122, 255);
  348. color: #ffffff;
  349. }
  350. }
  351. .emptyStyle {
  352. margin-top: 280rpx;
  353. }
  354. .u-size-medium {
  355. padding: 0 60rpx !important;
  356. }
  357. }
  358. </style>