shelfAnalyse.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539
  1. <template>
  2. <view class="shelf-analyse-content">
  3. <view class="headerName u-flex">
  4. <text></text>
  5. <view class="shelfName u-line-1">{{shelfName}}</view>
  6. </view>
  7. <view class="checkbox-price">
  8. <u-checkbox-group placement="row" :size="24">
  9. <u-checkbox v-model="item.checked" activeColor="rgb(4, 133, 246)" v-for="(item,index) in tabList" :key="index" :name="item.val">{{item.name}}</u-checkbox>
  10. </u-checkbox-group>
  11. <view class="search" @click="showModal=true">
  12. <text>筛选</text> <u-icon name="arrow-down"></u-icon>
  13. </view>
  14. </view>
  15. <scroll-view class="product-list" scroll-y @scrolltolower="onreachBottom">
  16. <view class="st-detailList-main">
  17. <view class="st-detailList-main-item" v-for="(item, index) in listData" :key="item.id" @click="toViewDetail(item)">
  18. <view class="st-detailList-item-con flex align_center">
  19. <view class="pimgs">
  20. <u-image :src="item.icon?item.icon:`../../static/${theme}/def_img@2x.png`" width="100" height="100" border-radius="10"></u-image>
  21. </view>
  22. <view class="flex_1 pimgs_right">
  23. <view class="flex align_center justify_between">
  24. <view>
  25. {{item.vinCode}}
  26. </view>
  27. <view class="font_13">
  28. {{item.createDate}}
  29. </view>
  30. </view>
  31. <view class="padding_3">{{item.modelInfo || '--'}} </view>
  32. </view>
  33. </view>
  34. <view class="price-all flex" v-if="selPriceShow">
  35. <view class="price-item" v-if="priceList[0].checked">
  36. <view>空调滤清器</view>
  37. <text class="green" v-if="item.airConditionerFilterFlag == 1">有适配</text>
  38. <text class="red" v-else-if="item.airConditionerFilterFlag == 2">无适配</text>
  39. <text v-else>--</text>
  40. </view>
  41. <view class="price-item" v-if="priceList[1].checked">
  42. <view>空气滤清器</view>
  43. <text class="green" v-if="item.airFilterFlag == 1">有适配</text>
  44. <text class="red" v-else-if="item.airFilterFlag == 2">无适配</text>
  45. <text v-else>--</text>
  46. </view>
  47. <view class="price-item" v-if="priceList[2].checked">
  48. <view>机油滤清器</view>
  49. <text class="green" v-if="item.engineOilFilterFlag == 1">有适配</text>
  50. <text class="red" v-else-if="item.engineOilFilterFlag == 2">无适配</text>
  51. <text v-else>--</text>
  52. </view>
  53. </view>
  54. </view>
  55. <u-empty v-if="listData.length == 0 &&status!='loading'" :src="`/static/${$config('themePath')}/def_no_data@3x.png`" icon-size="150" text="暂无VIN记录" mode="list" :margin-top="260"></u-empty>
  56. <view style="padding-bottom: 20upx;">
  57. <u-loadmore v-if="totalNum>listData.length || status=='loading'" :status="status" />
  58. </view>
  59. </view>
  60. </scroll-view>
  61. <!-- 搜索弹窗 -->
  62. <search :showModal="showModal" @refresh="refreshList" @close="showModal=false"/>
  63. <!-- vin 详情 -->
  64. <div class="cpb_cart-mask" v-if="showCart" @click="showCart=false;selFlag=0">
  65. <div class="cpb_cart-box" @click.stop="showCart=true">
  66. <div class="cpb_close flex align-center justify_center" @click.stop="showCart=false;selFlag=0">
  67. <u-icon name="close"></u-icon>
  68. </div>
  69. <div class="cpb_cart-tit">
  70. <view>VIN详情</view>
  71. <view class="st-detailList-item-con flex">
  72. <view class="pimgs">
  73. <u-image :src="tempData.icon?tempData.icon:`../../static/${theme}/def_img@2x.png`" width="100" height="100" border-radius="10"></u-image>
  74. </view>
  75. <view class="flex_1 pimgs_right">
  76. <view class="padding_3">{{tempData.modelInfo || '--'}} </view>
  77. <view class="font_13">
  78. VIN:{{tempData.vinCode}}
  79. </view>
  80. </view>
  81. </view>
  82. </div>
  83. <div class="cpb_body flex justify_between">
  84. <div class="cpb_tab">
  85. <div :class="selFlag==0?'active':''" @click.stop="changeSel(0)">空调滤清器</div>
  86. <div :class="selFlag==1?'active':''" @click.stop="changeSel(1)">空气滤清器</div>
  87. <div :class="selFlag==2?'active':''" @click.stop="changeSel(2)">机油滤清器</div>
  88. </div>
  89. <div class="cpb_cart-list" v-if="productList.length>0">
  90. <div
  91. v-for="(item, index) in productList"
  92. :key="index"
  93. >
  94. <view class="nav-right-item flex">
  95. <view class="uni-col-2">
  96. <u-image :src="item.productImageUrl?item.productImageUrl:`../../static/${theme}/def_img@2x.png`" width="100" height="100" border-radius="30"></u-image>
  97. </view>
  98. <view class="item-info uni-col-10">
  99. <view class="item-name u-line-2">
  100. {{item.productName}}
  101. </view>
  102. <view class="item-detail">
  103. <view class="item-detail-info align_center flex justify_between">
  104. <view>
  105. {{item.productCode}}
  106. </view>
  107. <!-- 判断是否铺货 -->
  108. <view class="flex justify_end" v-if="item.isShelfProduct != '否'">
  109. <text class="item-detail-text">
  110. 库存:{{item.qty?item.qty:0}}
  111. </text>
  112. </view>
  113. <view class="flex justify_end isShelf" v-else>
  114. 暂未铺货
  115. </view>
  116. </view>
  117. </view>
  118. </view>
  119. </view>
  120. </div>
  121. <div class="loadmoreStyle"><u-loadmore status="nomore" :load-text="loadText"/></div>
  122. </div>
  123. <view v-else class="emptyStyle">
  124. <u-empty :src="`/static/${$config('themePath')}/def_no_data@3x.png`" icon-size="150" text="暂无匹配产品" mode="list"></u-empty>
  125. </view>
  126. </div>
  127. </div>
  128. </div>
  129. </view>
  130. </template>
  131. <script>
  132. import { toThousands } from '@/libs/tools'
  133. import { queryPage,queryDetail } from '@/api/vinLog'
  134. import search from './search.vue'
  135. // import copyText from '@/pages/common/copyText.vue'
  136. export default{
  137. components:{search},
  138. data(){
  139. return{
  140. toThousands,
  141. listData:[],
  142. totalNum:0,
  143. priceList:[
  144. { name: '空调滤清器', checked: true, val: 'kt' },
  145. { name: '空气滤清器', checked: true, val: 'kq' },
  146. { name: '机油滤清器', checked: true, val: 'jy' },
  147. ],
  148. pageNo:1,
  149. pageSize:15,
  150. noDataText: '暂无数据',
  151. theme: '',
  152. status: 'loadmore',
  153. showModal:false,
  154. showCart: false,
  155. params:{},
  156. detail: null,
  157. tempData: null,
  158. productList: [],
  159. shelfSn:'',//货架名称
  160. selFlag:0,
  161. pullDownRefresh:false,//下拉刷新,
  162. loadText:{
  163. nomore: '已显示全部'
  164. },
  165. shelfName:''
  166. }
  167. },
  168. onNavigationBarButtonTap(e){
  169. uni.navigateTo({
  170. url:"/pages/vinAnalyse/fitProductlist?shelfSn="+this.shelfSn +"&shelfName="+ this.shelfName
  171. })
  172. },
  173. onBackPress(e) {
  174. if(this.showModal||this.showCart) {
  175. this.showModal = false;
  176. this.showCart = false;
  177. return true;
  178. }
  179. },
  180. computed: {
  181. selPriceShow() {
  182. const a = this.priceList.filter(item => item.checked)
  183. return a.length > 0
  184. },
  185. tabList(){
  186. return this.priceList
  187. }
  188. },
  189. onLoad(option) {
  190. this.theme = getApp().globalData.theme;
  191. this.shelfSn = option.shelfSn
  192. this.shelfName = option.shelfName
  193. let ajaxData={
  194. shelfSn:option.shelfSn,
  195. pageNo: this.pageNo,
  196. pageSize: this.pageSize
  197. }
  198. this.getList(ajaxData);
  199. },
  200. onReady() {
  201. uni.setNavigationBarTitle({
  202. title:'VIN分析'
  203. })
  204. },
  205. methods:{
  206. toPage(url){
  207. uni.switchTab({
  208. url:url
  209. })
  210. },
  211. // 搜索查询新列表
  212. refreshList(val){
  213. this.params =val ? val : {},
  214. this.listData = []
  215. this.totalNum = 0
  216. delete val.date;
  217. let ajaxData={
  218. shelfSn:this.shelfSn,
  219. pageNo:1,
  220. pageSize: this.pageSize
  221. }
  222. if(val){
  223. Object.assign(ajaxData,val);
  224. }
  225. this.getList(ajaxData);
  226. },
  227. // 列表
  228. getList(params){
  229. const _this = this
  230. this.status = "loading"
  231. queryPage(params).then(res => {
  232. if (res.status == 200) {
  233. if(this.pageNo>1){
  234. this.listData = this.listData.concat(res.data.list || [])
  235. }else{
  236. this.listData = res.data.list || []
  237. }
  238. this.totalNum = res.data.count || 0
  239. } else {
  240. this.listData = []
  241. this.totalNum = 0
  242. this.noDataText = res.message
  243. }
  244. this.status = "loadmore"
  245. if(this.pullDownRefresh){
  246. uni.stopPullDownRefresh();
  247. }
  248. })
  249. },
  250. changeSel(num){
  251. this.selFlag=num;
  252. this.$nextTick(()=>{
  253. this.toViewDetail(this.tempData);
  254. })
  255. },
  256. // 查看详情
  257. toViewDetail(row){
  258. this.tempData = row
  259. queryDetail({id:row.id}).then(res => {
  260. this.showCart = true
  261. if(this.selFlag == 0){
  262. this.productList=res.data.airConditionerFilter
  263. }else if(this.selFlag == 1){
  264. this.productList=res.data.airFilterFlag
  265. }else{
  266. this.productList=res.data.engineOilFilterFlag
  267. }
  268. })
  269. },
  270. //到底部加载更多
  271. onreachBottom() {
  272. if(this.listData.length < this.totalNum){
  273. this.pageNo += 1
  274. let ajaxData={
  275. shelfSn:this.shelfSn,
  276. pageNo: this.pageNo,
  277. pageSize: this.pageSize
  278. }
  279. this.getList(ajaxData)
  280. }else{
  281. this.status = "nomore"
  282. }
  283. },
  284. },
  285. onPullDownRefresh(){
  286. this.pullDownRefresh= true;
  287. this.pageNo =1
  288. let ajaxData={
  289. shelfSn:this.shelfSn,
  290. pageNo: this.pageNo,
  291. pageSize: this.pageSize
  292. }
  293. this.getList(ajaxData)
  294. }
  295. }
  296. </script>
  297. <style lang="scss">
  298. .shelf-analyse-content{
  299. width:100%;
  300. height: 100vh;
  301. .headerName{
  302. background-color: #fff;
  303. padding:0 20rpx;
  304. color: #222;
  305. font-size: 30rpx;
  306. text{
  307. display: block;
  308. height: 30rpx;
  309. width: 6rpx;
  310. background: #0485F6;
  311. margin-right: 10rpx;
  312. border-radius: 10rpx;
  313. }
  314. .shelfName{
  315. font-weight: bold;
  316. width: calc(100% - 16rpx);
  317. }
  318. }
  319. .emptyStyle{
  320. margin:auto;
  321. }
  322. .checkbox-price{
  323. background-color: #fff;
  324. display: flex;
  325. align-items: center;
  326. justify-content: space-between;
  327. padding: 10rpx 25rpx;
  328. color: #191919;
  329. .search{
  330. color:#00aaff;
  331. width: 90rpx;;
  332. }
  333. }
  334. .product-list{
  335. height: calc(100vh - 116rpx);
  336. .st-detailList-main{
  337. padding: 20rpx;
  338. .st-detailList-main-item{
  339. width: 100%;
  340. box-sizing: border-box;
  341. background: #ffffff;
  342. padding: 20upx;
  343. margin-bottom: 25upx;
  344. border-radius: 25upx;
  345. box-shadow: 1px 1px 3px #EEEEEE;
  346. .st-detailList-item-con{
  347. width: 100%;
  348. box-sizing: border-box;
  349. padding: 20upx 0;
  350. font-size: 28upx;
  351. .red{
  352. color: red;
  353. }
  354. .pimgs{
  355. width: 100rpx;
  356. height: 100rpx;
  357. margin-right: 16upx;
  358. }
  359. .pimgs_right{
  360. width:calc(100% - 116upx);
  361. }
  362. .font_13{
  363. font-size: 24upx;
  364. color: #999;
  365. }
  366. .padding_3{
  367. margin: 6upx 0;
  368. overflow:hidden;
  369. text-overflow: ellipsis;
  370. white-space: nowrap
  371. }
  372. }
  373. .price-all{
  374. border-top: 1px solid #e4e7ed;
  375. padding: 10upx 20upx 0;
  376. .price-item{
  377. width: 33.3%;
  378. border-right: 1px solid #e4e7ed;
  379. text-align: center;
  380. >view{
  381. color:#999;
  382. margin-bottom: 10rpx;
  383. font-size: 24rpx;
  384. }
  385. >text{
  386. border:1rpx solid #eee;
  387. font-size: 20rpx;
  388. padding:5rpx 10rpx;
  389. border-radius: 10rpx;
  390. min-width: 100rpx;
  391. display: inline-block;
  392. }
  393. .red{
  394. color:#ff5500;
  395. border-color: #ff5500;
  396. }
  397. .green{
  398. color:#00cb00;
  399. border-color: #00cb00;
  400. }
  401. }
  402. .price-item:last-child{
  403. border-right: none;
  404. }
  405. }
  406. }
  407. }
  408. }
  409. // 详情
  410. .cpb_cart-mask{
  411. position: fixed;
  412. width: 100%;
  413. background: rgba(0,0,0,0.5);
  414. z-index: 900;
  415. bottom: 0;
  416. top: 0;
  417. }
  418. .cpb_cart-box{
  419. background-color: #fff;
  420. position: absolute;
  421. width: 100%;
  422. z-index: 1000;
  423. bottom: 0;
  424. border-radius: 30rpx 30rpx 0 0;
  425. max-height: 70vh;
  426. display: flex;
  427. flex-direction: column;
  428. .cpb_close{
  429. position: absolute;
  430. top: 10rpx;
  431. right: 20rpx;
  432. width: 70rpx;
  433. height: 70rpx;
  434. font-size: 32rpx;
  435. color: #999;
  436. }
  437. .cpb_cart-tit{
  438. padding: 20rpx 30rpx 0;
  439. font-size: 30rpx;
  440. border-bottom: 2rpx solid #eee;
  441. .st-detailList-item-con{
  442. padding: 20upx 0;
  443. font-size: 28upx;
  444. .pimgs{
  445. margin-right: 16upx;
  446. }
  447. .pimgs_right{
  448. width:calc(100% - 66upx);
  449. }
  450. .font_13{
  451. font-size: 24upx;
  452. }
  453. .padding_3{
  454. padding: 6upx 0;
  455. word-break: break-all;
  456. }
  457. }
  458. }
  459. .cpb_body{
  460. height: 80vh;
  461. .cpb_tab{
  462. width: 25%;
  463. height: 100%;
  464. background-color: #f8f8f8;
  465. > div{
  466. padding: 30rpx 20rpx;
  467. font-size: 24rpx;
  468. text-align: center;
  469. }
  470. .active{
  471. background-color: #fff;
  472. border-left: 5rpx solid #00aaff;
  473. }
  474. }
  475. }
  476. .cpb_cart-list{
  477. width: 75%;
  478. height: 100%;
  479. padding: 20rpx;
  480. overflow: auto;
  481. flex-grow: 1;
  482. box-sizing: border-box;
  483. > view{
  484. margin-bottom: 20rpx;
  485. }
  486. .nav-right-item{
  487. padding: 0 20upx 20rpx;
  488. }
  489. .item-name{
  490. font-size: 30rpx;
  491. width:100%;
  492. // text{
  493. // background: rgba(3, 54, 146, 0.15);
  494. // color: #1c588a;
  495. // border-radius: 1em;
  496. // font-size: 0.8em;
  497. // padding: 0 0.5em;
  498. // margin-right: 10upx;
  499. // }
  500. }
  501. .item-info{
  502. border-bottom:2rpx solid #eee;
  503. flex-grow: 1;
  504. padding-left: 20rpx;
  505. }
  506. .item-detail{
  507. .item-detail-info{
  508. padding: 10upx 0 4upx;
  509. font-size: 24upx;
  510. > view{
  511. padding-bottom: 20rpx;
  512. align-items: center;
  513. .item-detail-text{
  514. color: #999;
  515. margin-left: 20upx;
  516. }
  517. }
  518. }
  519. .isShelf{
  520. color:#ff5500;
  521. }
  522. }
  523. .loadmoreStyle{
  524. margin-top:20rpx;
  525. }
  526. }
  527. }
  528. }
  529. </style>