shelfAnalyse.vue 11 KB

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