shelfAnalyse.vue 12 KB

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