shelfAnalyse.vue 11 KB

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