index.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269
  1. <template>
  2. <view class="content">
  3. <view class="indexTab">
  4. <view class="indexTabline" :class="{active:tabIndex==1}" @click="tabClick(1)">按车型</view>
  5. <view class="indexTabline" :class="{active:tabIndex==2}" @click="tabClick(2)">VIN查询</view>
  6. <view class="indexTabline" :class="{active:tabIndex==3}" @click="tabClick(3)">商品</view>
  7. </view>
  8. <!-- <view class="kogjian"></view> -->
  9. <carModel ref="carModelView" v-if="tabIndex==1"></carModel>
  10. <vinquery ref="vinView" v-if="tabIndex==2"></vinquery>
  11. <!-- <goods ref="goodsView" v-if="tabIndex==3"></goods> -->
  12. <view class="goodsBox" v-if="tabIndex==3">
  13. <view style="height: 90rpx;"></view>
  14. <view class="goodscontent">
  15. <view class="carSs goodsSs">
  16. <view class="carssBox" >
  17. <img src="../../static/img/icon_search.png" alt="" class="carSsImg">
  18. <input type="text" placeholder="名称、规格、出厂编码、OE、品牌" class="carssInput" v-model="goodsName" @confirm="getgoodsList">
  19. </view>
  20. </view>
  21. <view class="listBox">
  22. <view class="listLine" v-for="(item,index) in list" @click="godetail(item)">
  23. <img :src="item.imgs.split(',')[0]|| require('../../static/img/pic_def_bj.png')" alt="图片加载失败" class="lineIMg">
  24. <view class="listlineRight">
  25. <view class="lineName">{{ item.brand }} {{ item.name }}</view>
  26. <view class="linespecificationModel">{{ item.specificationModel }} | {{ item.factoryNumber }}</view>
  27. <view class="linemodelRemark">备注:{{ item.modelRemark||'--' }}</view>
  28. </view>
  29. </view>
  30. </view>
  31. <view class="nodata" v-if="!list.length&&!loading">
  32. <img src="../../static/img/pic_empty_def.png" alt="" class="nodataImg">
  33. <view class="nodataTxt">暂无匹配商品</view>
  34. </view>
  35. </view>
  36. </view>
  37. </view>
  38. </template>
  39. <script>
  40. import carModel from './carModel.vue'
  41. import vinquery from './../vin/vinquery.vue'
  42. import goods from './../goods/goods.vue'
  43. export default {
  44. components: {
  45. carModel, //注册子组件
  46. vinquery,
  47. goods
  48. },
  49. data() {
  50. return {
  51. tabIndex:1,
  52. list:[],
  53. goodsName:'',
  54. page:1,
  55. limit:10,
  56. loading:true,
  57. }
  58. },
  59. onLoad() {
  60. // console.log(this.$getHashQuery("openId")openId=o2Rn3v1Mv_lXX3xijvHF6Z8EclAw)
  61. // console.log(this.$store.state.openId)
  62. if (this.$getHashQuery('openId')) {
  63. const openId = this.$getHashQuery('openId')
  64. this.$store.commit('mutationsopenId', openId)
  65. uni.setStorageSync('openId', openId);
  66. } else if (!this.$store.state.openId) {
  67. // location.href = this.$baseURL + '/weChat/authorize'
  68. }
  69. var that=this;
  70. setTimeout(function(){
  71. that.$refs.carModelView.getdata();
  72. },500)
  73. /* this.$http('matchingByOpen/queryCarModelGroupPackage', {
  74. }, 'POST').then(res => {
  75. }) */
  76. },
  77. methods: {
  78. godetail(item){
  79. uni.navigateTo({
  80. url:'datail?id='+item.id
  81. })
  82. },
  83. tabClick(index){
  84. this.tabIndex=index;
  85. if(index==1){
  86. var that=this;
  87. setTimeout(function(){
  88. that.$refs.carModelView.getdata();
  89. },500)
  90. }
  91. if(index==3){
  92. this.getgoodsList
  93. }
  94. },
  95. getgoodsList(){
  96. this.page=1;
  97. this.list=[];
  98. uni.showLoading({ title: '加载中'});
  99. this.loading=true;
  100. this.$http('partsByOpen/queryPartsList', {
  101. name:this.goodsName,
  102. page:this.page,
  103. limit:10,
  104. }, 'POST').then(res => {
  105. this.list=res.data;
  106. this.loading=false;
  107. uni.hideLoading();
  108. })
  109. }
  110. },
  111. onReachBottom(){
  112. console.log("上拉");
  113. if(this.goodsName){
  114. uni.showLoading({ title: '加载中'});
  115. this.loading=true;
  116. this.page++
  117. this.$http('partsByOpen/queryPartsList', {
  118. name:this.goodsName,
  119. page:this.page,
  120. limit:10,
  121. }, 'POST').then(res => {
  122. var list=res.data
  123. this.list=this.list.concat(list);
  124. this.loading=false;
  125. uni.hideLoading();
  126. })
  127. }
  128. },
  129. onPullDownRefresh() {
  130. this.page = 1;
  131. this.getgoodsList()
  132. setTimeout(function() {
  133. uni.stopPullDownRefresh();
  134. }, 500);
  135. },
  136. }
  137. </script>
  138. <style scoped>
  139. .content{
  140. min-height: 100vh;
  141. background: #F4F5F7;
  142. }
  143. .indexTab{
  144. display: flex;
  145. justify-content: space-around;
  146. line-height: 90rpx;
  147. background: #FFFFFF;
  148. border-bottom: 2rpx solid #eee;
  149. color: #333333;
  150. font-size: 30rpx;
  151. width: 100%;
  152. position: fixed;
  153. top: 0px;
  154. left: 0;
  155. z-index: 9999;
  156. }
  157. .indexTabline{
  158. font-size: 32rpx;
  159. width: 130rpx;
  160. text-align: center;
  161. }
  162. .active{
  163. border-bottom: 4rpx solid #3F90F7;
  164. color: #3F90F7;
  165. }
  166. .kogjian{
  167. height: 96rpx;
  168. }
  169. .goodscontent{
  170. min-height:calc(100vh - 44px) ;
  171. background: #FFFFFF;
  172. }
  173. .carSs{
  174. width: 750rpx;
  175. height: 96rpx;
  176. background: #FFFFFF;
  177. padding-top: 24rpx;
  178. position: relative;
  179. }
  180. .carssBox{
  181. width: 702rpx;
  182. height: 72rpx;
  183. background: #F4F5F7;
  184. border-radius: 36rpx;
  185. margin: 0 auto;
  186. }
  187. .carSsImg{
  188. width: 40rpx;
  189. height: 40rpx;
  190. margin-top: 16rpx;
  191. margin-left: 20rpx;
  192. }
  193. .carssInput{
  194. line-height:72rpx;
  195. font-size: 28rpx;
  196. height:72rpx;
  197. padding-left: 16rpx;
  198. width: 600rpx;
  199. }
  200. .carssBox{
  201. display: flex;
  202. }
  203. .listBox{
  204. padding: 0 24rpx;
  205. background: #FFFFFF;
  206. padding-top: 120rpx;
  207. width: 702rpx;
  208. }
  209. .lineIMg{
  210. width: 110rpx;
  211. height: 110rpx;
  212. }
  213. .listLine{
  214. padding: 20rpx 0;
  215. border-bottom: 1px solid #EEEEEE;
  216. display: flex;
  217. }
  218. .listlineRight{
  219. width: 600rpx;
  220. padding-left: 20rpx;
  221. }
  222. .lineName{
  223. color: #3C3C3C;font-size: 28rpx;
  224. }
  225. .linespecificationModel{
  226. color: #999999;font-size: 24rpx;padding-top: 5rpx;
  227. }
  228. .linemodelRemark{
  229. color: #999999;font-size: 24rpx;padding-top: 10rpx;
  230. overflow: hidden;
  231. text-overflow: ellipsis;
  232. white-space: nowrap;
  233. width: 550rpx;
  234. }
  235. .nodataImg{
  236. width: 452rpx;
  237. }
  238. .nodata{
  239. text-align: center;
  240. height: calc(100vh - 310rpx );
  241. }
  242. .nodataTxt{
  243. color: #999999;
  244. line-height: 40px;
  245. font-size: 28rpx;
  246. padding-top: 12rpx;
  247. }
  248. .goodsSs{
  249. position: fixed !important;
  250. width: 100vw;
  251. top: 90rpx;
  252. left: 0;
  253. }
  254. </style>