shelfAnalyse.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416
  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. 筛选 <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.productMainPic&&item.productMainPic.imageUrl?item.productMainPic.imageUrl:`../../static/${theme}/def_img@2x.png`" width="100" height="100" border-radius="10"></u-image>
  17. </view>
  18. <view class="flex_1">
  19. <view class="flex align_center justify_between">
  20. <view>
  21. LJJLDS234DD323453
  22. </view>
  23. <view class="font_13">
  24. 2022-05-06 12:25:36
  25. </view>
  26. </view>
  27. <view class="padding_3">{{item.name || '--'}} </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">
  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 { dealerProductList } from '@/api/sales'
  116. import search from './search.vue'
  117. import copyText from '@/pages/common/copyText.vue'
  118. export default{
  119. components:{search,copyText},
  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. }
  142. },
  143. onNavigationBarButtonTap(e){
  144. uni.navigateTo({
  145. url:"/pages/vinAnalyse/shelfAnalyse?data="+encodeURIComponent(JSON.stringify(this.detail))
  146. })
  147. },
  148. onBackPress(e) {
  149. if(this.showModal||this.showCart) {
  150. this.showModal = false;
  151. this.showCart = false;
  152. return true;
  153. }
  154. },
  155. computed: {
  156. selPriceShow() {
  157. const a = this.priceList.filter(item => item.checked)
  158. return a.length > 0
  159. },
  160. tabList(){
  161. return this.priceList
  162. }
  163. },
  164. onLoad(option) {
  165. this.detail = JSON.parse(option.data)
  166. this.theme = getApp().globalData.theme
  167. uni.setNavigationBarTitle({
  168. title: this.detail.shelfName
  169. })
  170. this.getList()
  171. },
  172. methods:{
  173. toPage(url){
  174. uni.switchTab({
  175. url:url
  176. })
  177. },
  178. // 刷新列表
  179. refreshList(val){
  180. this.params =val ? val : {},
  181. this.listData = []
  182. this.totalNum = 0
  183. this.getList(1)
  184. },
  185. // 列表
  186. getList(pageNo){
  187. const _this = this
  188. if (pageNo) {
  189. this.pageNo = pageNo
  190. }
  191. let params = Object.assign(this.params, { pageNo: this.pageNo, pageSize: this.pageSize })
  192. this.status = "loading"
  193. console.log(params)
  194. dealerProductList(params).then(res => {
  195. if (res.status == 200) {
  196. if(this.pageNo>1){
  197. this.listData = this.listData.concat(res.data.list || [])
  198. }else{
  199. this.listData = res.data.list || []
  200. }
  201. this.totalNum = res.data.count || 0
  202. } else {
  203. this.listData = []
  204. this.totalNum = 0
  205. this.noDataText = res.message
  206. }
  207. this.status = "loadmore"
  208. })
  209. },
  210. // scroll-view到底部加载更多
  211. onreachBottom() {
  212. if(this.listData.length < this.totalNum){
  213. this.pageNo += 1
  214. this.getList()
  215. }
  216. },
  217. // 查看销售记录
  218. toViewDetail(row){
  219. this.tempData = row
  220. this.showCart = true
  221. }
  222. }
  223. }
  224. </script>
  225. <style lang="scss">
  226. .shelf-analyse-content{
  227. width:100%;
  228. height: 100vh;
  229. .checkbox-price{
  230. background-color: #fff;
  231. display: flex;
  232. align-items: center;
  233. justify-content: space-between;
  234. padding: 10rpx 25rpx;
  235. color: #191919;
  236. .search{
  237. color:#00aaff;
  238. }
  239. }
  240. .product-list{
  241. height: calc(100vh - 84upx);
  242. .st-detailList-main{
  243. padding: 20upx;
  244. .st-detailList-main-item{
  245. background: #ffffff;
  246. padding: 20upx;
  247. margin-bottom: 25upx;
  248. border-radius: 25upx;
  249. box-shadow: 1px 1px 3px #EEEEEE;
  250. .st-detailList-item-con{
  251. padding: 20upx 0;
  252. font-size: 28upx;
  253. .red{
  254. color: red;
  255. }
  256. .pimgs{
  257. margin-right: 16upx;
  258. }
  259. .font_13{
  260. font-size: 24upx;
  261. color: #999;
  262. }
  263. .padding_3{
  264. padding: 6upx 0;
  265. word-break: break-all;
  266. }
  267. }
  268. .price-all{
  269. border-top: 1px solid #e4e7ed;
  270. padding: 10upx 20upx 0;
  271. .price-item{
  272. width: 33.3%;
  273. border-right: 1px solid #e4e7ed;
  274. text-align: center;
  275. >view{
  276. color:#999;
  277. margin-bottom: 10rpx;
  278. font-size: 24rpx;
  279. }
  280. >text{
  281. border:1rpx solid #eee;
  282. font-size: 20rpx;
  283. padding:5rpx 10rpx;
  284. border-radius: 10rpx;
  285. min-width: 100rpx;
  286. display: inline-block;
  287. }
  288. .red{
  289. color:#ff5500;
  290. border-color: #ff5500;
  291. }
  292. .green{
  293. color:#00cb00;
  294. border-color: #00cb00;
  295. }
  296. }
  297. .price-item:last-child{
  298. border-right: none;
  299. }
  300. }
  301. }
  302. }
  303. }
  304. // 详情
  305. .cpb_cart-mask{
  306. position: fixed;
  307. width: 100%;
  308. background: rgba(0,0,0,0.5);
  309. z-index: 900;
  310. bottom: 0;
  311. top: 0;
  312. }
  313. .cpb_cart-box{
  314. background-color: #fff;
  315. position: absolute;
  316. width: 100%;
  317. z-index: 1000;
  318. bottom: 0;
  319. border-radius: 30rpx 30rpx 0 0;
  320. max-height: 70vh;
  321. display: flex;
  322. flex-direction: column;
  323. .cpb_close{
  324. position: absolute;
  325. top: 10rpx;
  326. right: 20rpx;
  327. width: 70rpx;
  328. height: 70rpx;
  329. font-size: 32rpx;
  330. color: #999;
  331. }
  332. .cpb_cart-tit{
  333. padding: 20rpx 30rpx 0;
  334. font-size: 30rpx;
  335. border-bottom: 2rpx solid #eee;
  336. .st-detailList-item-con{
  337. padding: 20upx 0;
  338. font-size: 28upx;
  339. .pimgs{
  340. margin-right: 16upx;
  341. }
  342. .font_13{
  343. font-size: 24upx;
  344. }
  345. .padding_3{
  346. padding: 6upx 0;
  347. word-break: break-all;
  348. }
  349. }
  350. }
  351. .cpb_body{
  352. height: 80vh;
  353. .cpb_tab{
  354. width: 25%;
  355. height: 100%;
  356. background-color: #f8f8f8;
  357. > div{
  358. padding: 30rpx 20rpx;
  359. font-size: 24rpx;
  360. text-align: center;
  361. }
  362. .active{
  363. background-color: #fff;
  364. border-left: 5rpx solid #00aaff;
  365. }
  366. }
  367. }
  368. .cpb_cart-list{
  369. padding: 20rpx;
  370. overflow: auto;
  371. flex-grow: 1;
  372. > view{
  373. margin-bottom: 20rpx;
  374. }
  375. .nav-right-item{
  376. padding: 0 30upx;
  377. }
  378. .item-name{
  379. font-size: 30rpx;
  380. text{
  381. background: rgba(3, 54, 146, 0.15);
  382. color: #1c588a;
  383. border-radius: 1em;
  384. font-size: 0.8em;
  385. padding: 0 0.5em;
  386. margin-right: 10upx;
  387. }
  388. }
  389. .item-info{
  390. border-bottom:2rpx solid #eee;
  391. flex-grow: 1;
  392. padding-left: 0.2em;
  393. }
  394. .item-detail{
  395. .item-detail-info{
  396. padding: 10upx 0 4upx;
  397. font-size: 24upx;
  398. > view{
  399. padding-bottom: 20rpx;
  400. align-items: center;
  401. .item-detail-text{
  402. color: #999;
  403. margin-left: 20upx;
  404. }
  405. }
  406. }
  407. }
  408. }
  409. }
  410. }
  411. </style>