shelfAnalyse.vue 12 KB

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