|
@@ -187,7 +187,6 @@
|
|
|
status: 'loading',
|
|
|
noDataText: '暂无数据',
|
|
|
hasShopiing: true, // 是否开通商城
|
|
|
- showPopup: false, // 去认证弹框
|
|
|
bondRecord: null, // 保证金
|
|
|
list:[], // 扫描记录滚动
|
|
|
slist:[], // 红包滚动
|
|
@@ -360,6 +359,18 @@
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
+ // 去登陆
|
|
|
+ toLogin(){
|
|
|
+ uni.navigateTo({
|
|
|
+ url: '/pages/login/login'
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 去认证
|
|
|
+ toAuthStore(){
|
|
|
+ uni.navigateTo({
|
|
|
+ url: '/pages/storeManage/storeAuth'
|
|
|
+ })
|
|
|
+ },
|
|
|
// 初始化页面
|
|
|
pageInit(flag){
|
|
|
this.carouselList = []
|
|
@@ -402,6 +413,8 @@
|
|
|
this.$store.state.vuex_storeShelf = res.data;
|
|
|
// 有数字货架
|
|
|
if(res.data){
|
|
|
+ // 获取轮播数据,包括促销活动
|
|
|
+ this.getCarousel()
|
|
|
// 查询是否有商城
|
|
|
this.getHasShopping(flag)
|
|
|
// 只需加载一次
|
|
@@ -417,14 +430,31 @@
|
|
|
}
|
|
|
// 获取价格权限配置
|
|
|
this.getPriceCofig()
|
|
|
- // 获取轮播数据,包括促销活动
|
|
|
- this.getCarousel()
|
|
|
}else{
|
|
|
// 没有数字货架,隐藏促销模块
|
|
|
this.hidePromoTab()
|
|
|
}
|
|
|
})
|
|
|
},
|
|
|
+ // 最新用户信息
|
|
|
+ getCurrUserInfo(){
|
|
|
+ getCurrUserInfo().then(res => {
|
|
|
+ if(res.data){
|
|
|
+ this.$store.state.vuex_userInfo.userNameCN = res.data.name;
|
|
|
+ this.$store.state.vuex_userInfo.mobile = res.data.mobile;
|
|
|
+ this.$store.state.vuex_userInfo.adminId = res.data.id;
|
|
|
+ this.$store.state.vuex_userPhoto = res.data.photo;
|
|
|
+ uni.setStorageSync('userPhoto', res.data.photo);
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 获取价格配置
|
|
|
+ getPriceCofig(){
|
|
|
+ const data = this.$store.state.vuex_storeShelf
|
|
|
+ queryQplsConfig({shelfSn: data.shelfSn}).then(res => {
|
|
|
+ this.$store.state.vuex_configPrice = res.data || null
|
|
|
+ })
|
|
|
+ },
|
|
|
// 商城信息, flag: true 再次刷新,false 只加载一次
|
|
|
getHasShopping(flag){
|
|
|
getShopStatus().then(res => {
|
|
@@ -452,6 +482,78 @@
|
|
|
this.getRedPacketRule()
|
|
|
})
|
|
|
},
|
|
|
+ // 商品一级分类
|
|
|
+ getGoodType(){
|
|
|
+ this.productTypeList = []
|
|
|
+ getShopCategory({categoryLevel: 1, status: 1}).then(res => {
|
|
|
+ const list = res.data || []
|
|
|
+ const ret = []
|
|
|
+ list.forEach(item => {
|
|
|
+ ret.push({
|
|
|
+ id: item.id,
|
|
|
+ categorySn: item.categorySn,
|
|
|
+ auth: true,
|
|
|
+ name: item.categoryName,
|
|
|
+ icon: item.iconUrl,
|
|
|
+ url: '/pagesB/shopiing/searchProduct?clzId='+item.categorySn+'&clzName='+item.categoryName,
|
|
|
+ target: 'page'
|
|
|
+ })
|
|
|
+ })
|
|
|
+ // 转成二维数组
|
|
|
+ for(let i=0;i<ret.length;i=i+8){
|
|
|
+ this.productTypeList.push({
|
|
|
+ id: 'swiper-item-'+i,
|
|
|
+ list: ret.slice(i,(i+8)>ret.length?ret.length:(i+8))
|
|
|
+ })
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 商品列表查询
|
|
|
+ getHotProductList(){
|
|
|
+ this.productList = []
|
|
|
+ this.hotProductPageNo = 1
|
|
|
+ this.getProductList()
|
|
|
+ },
|
|
|
+ getProductList(){
|
|
|
+ this.status = "loading"
|
|
|
+ const dealerSn = this.hasLogin && this.userInfo && this.userInfo.sysUserFlag == '1' ? this.$store.state.vuex_storeShelf.dealerSn : ''
|
|
|
+ // 获取推荐产品
|
|
|
+ getShopProductList({pageNo:this.hotProductPageNo,pageSize:10,hotFlag:1, status: 1, dealerSn: dealerSn}).then(res => {
|
|
|
+ if(res.status == 200){
|
|
|
+ const list = res.data ? res.data.list : []
|
|
|
+ this.productList.push(list)
|
|
|
+ this.status = res.data.count>=this.list.length ? "nomore" : 'loadmore'
|
|
|
+ // 判断是否最后一页
|
|
|
+ const maxPages = Math.ceil(res.data.count / 10)
|
|
|
+ this.totalhotPage = maxPages
|
|
|
+ this.status = this.hotProductPageNo >= maxPages ? "nomore" : 'loadmore'
|
|
|
+ this.noDataText = this.status == 'nomore' ? '没有更多了' : '更多商品'
|
|
|
+ }else{
|
|
|
+ this.status = "nomore"
|
|
|
+ this.noDataText = res.message || '没有更多了'
|
|
|
+ }
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 获取上方滚动扫描记录
|
|
|
+ getScrollLog(){
|
|
|
+ scanVinLogQueryRoll({pageNo:1,pageSize:50}).then(res => {
|
|
|
+ this.list = res.data.list || []
|
|
|
+ this.list.map(item => {
|
|
|
+ item.placeText = item.userName + '刚刚扫描了一个VIN'
|
|
|
+ })
|
|
|
+ })
|
|
|
+ },
|
|
|
+ // 获取当前门店扫描记录
|
|
|
+ getVinLog(){
|
|
|
+ this.vinList = []
|
|
|
+ this.status = "loading"
|
|
|
+ // VISITOR:游客,EMPLOYEE:雇员
|
|
|
+ getScanVinLogList({ pageNo:1, pageSize:5, identifyType: this.userInfo.identifyType }).then(res => {
|
|
|
+ this.vinList = res.data&&res.data.list || []
|
|
|
+ this.vinList = this.vinList.filter(item => item.vinCode)
|
|
|
+ this.status = 'nomore'
|
|
|
+ })
|
|
|
+ },
|
|
|
// 扫描vin
|
|
|
beforeSwitch(index){
|
|
|
const row = this.$store.state.vuex_tabBarList[index]
|
|
@@ -460,35 +562,63 @@
|
|
|
}
|
|
|
if(row.text == '购物车'){
|
|
|
if(!this.hasLogin){
|
|
|
- uni.navigateTo({
|
|
|
- url: '/pages/login/login'
|
|
|
- })
|
|
|
+ this.toLogin()
|
|
|
return true
|
|
|
}
|
|
|
+ // 游客去认证
|
|
|
if(this.userInfo.sysUserFlag == '0'){
|
|
|
- uni.navigateTo({
|
|
|
- url: '/pages/storeManage/storeAuth'
|
|
|
- })
|
|
|
+ this.toAuthStore()
|
|
|
return true
|
|
|
}
|
|
|
+ // 打开购物车页面
|
|
|
uni.navigateTo({
|
|
|
url:'/pagesB/cart/index',
|
|
|
target: 'page'
|
|
|
})
|
|
|
}
|
|
|
+ // 打开vin扫码页面
|
|
|
if(row.text == '扫描VIN'){
|
|
|
this.openCamera()
|
|
|
}else{
|
|
|
return true
|
|
|
}
|
|
|
},
|
|
|
+ // 去扫VIN
|
|
|
+ openCamera(){
|
|
|
+ if(this.hasLogin){
|
|
|
+ // 游客身份
|
|
|
+ if(this.userInfo.sysUserFlag == '0'){
|
|
|
+ // 最多扫10次
|
|
|
+ if(this.vuex_vinScanNums < this.scanMaxNums){
|
|
|
+ uni.navigateTo({
|
|
|
+ url: "/pages/scan-frame/scan-frame"
|
|
|
+ })
|
|
|
+ }else{
|
|
|
+ uni.showModal({
|
|
|
+ title: '提示',
|
|
|
+ content: '个人用户扫描VIN仅限10次,您的次数已用完!',
|
|
|
+ confirmText: '好的',
|
|
|
+ showCancel: false,
|
|
|
+ success(res) {}
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ // 非游客,直接扫
|
|
|
+ uni.navigateTo({
|
|
|
+ url: "/pages/scan-frame/scan-frame"
|
|
|
+ })
|
|
|
+ }
|
|
|
+ }else{
|
|
|
+ this.toLogin()
|
|
|
+ }
|
|
|
+ },
|
|
|
// 去搜索产品
|
|
|
toSearch(event){
|
|
|
uni.navigateTo({
|
|
|
url:'/pagesB/shopiing/searchProduct?queryWord='+event.value+'&clzId='
|
|
|
})
|
|
|
},
|
|
|
- // 轮播图片
|
|
|
+ // 促销活动的轮播图片
|
|
|
getCarousel(){
|
|
|
this.carouselList = []
|
|
|
// 获取所有促销活动数据
|
|
@@ -497,9 +627,6 @@
|
|
|
res.data&&res.data.map(item => {
|
|
|
item.image = item.imageSet&&item.imageSet[0] // 默认取第一张图片
|
|
|
})
|
|
|
- // 过滤掉产品促销活动
|
|
|
- // this.carouselList = res.data.filter(item => item.content.indexOf("pages/promo/index") < 0)
|
|
|
- // 所有数据
|
|
|
this.carouselList = res.data
|
|
|
}
|
|
|
})
|
|
@@ -518,23 +645,11 @@
|
|
|
this.openTakeGood(0)
|
|
|
}
|
|
|
}else{
|
|
|
- uni.showModal({
|
|
|
- title: '提示',
|
|
|
- content: '你还未申请认证门店,暂无法使用此功能',
|
|
|
- confirmText: '去认证',
|
|
|
- success(res) {
|
|
|
- if(res.confirm){
|
|
|
- uni.navigateTo({
|
|
|
- url: '/pages/storeManage/storeAuth'
|
|
|
- })
|
|
|
- }
|
|
|
- }
|
|
|
- })
|
|
|
+ // 去认证
|
|
|
+ this.toAuthStore()
|
|
|
}
|
|
|
}else{
|
|
|
- uni.navigateTo({
|
|
|
- url: '/pages/login/login'
|
|
|
- })
|
|
|
+ this.toLogin()
|
|
|
}
|
|
|
},
|
|
|
// 获取数据字典
|
|
@@ -554,25 +669,6 @@
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
- // 获取价格配置
|
|
|
- getPriceCofig(){
|
|
|
- const data = this.$store.state.vuex_storeShelf
|
|
|
- queryQplsConfig({shelfSn: data.shelfSn}).then(res => {
|
|
|
- this.$store.state.vuex_configPrice = res.data || null
|
|
|
- })
|
|
|
- },
|
|
|
- // 最新用户信息
|
|
|
- getCurrUserInfo(){
|
|
|
- getCurrUserInfo().then(res => {
|
|
|
- if(res.data){
|
|
|
- this.$store.state.vuex_userInfo.userNameCN = res.data.name;
|
|
|
- this.$store.state.vuex_userInfo.mobile = res.data.mobile;
|
|
|
- this.$store.state.vuex_userInfo.adminId = res.data.id;
|
|
|
- this.$store.state.vuex_userPhoto = res.data.photo;
|
|
|
- uni.setStorageSync('userPhoto', res.data.photo);
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
// 获取最大扫描数
|
|
|
getMaxQty(){
|
|
|
getScanGetMaxQty().then(res => {
|
|
@@ -618,78 +714,6 @@
|
|
|
})
|
|
|
}
|
|
|
},
|
|
|
- // 获取上方滚动扫描记录
|
|
|
- getScrollLog(){
|
|
|
- scanVinLogQueryRoll({pageNo:1,pageSize:50}).then(res => {
|
|
|
- this.list = res.data.list || []
|
|
|
- this.list.map(item => {
|
|
|
- item.placeText = item.userName + '刚刚扫描了一个VIN'
|
|
|
- })
|
|
|
- })
|
|
|
- },
|
|
|
- // 获取当前门店扫描记录
|
|
|
- getVinLog(){
|
|
|
- this.vinList = []
|
|
|
- this.status = "loading"
|
|
|
- // VISITOR:游客,EMPLOYEE:雇员
|
|
|
- getScanVinLogList({ pageNo:1, pageSize:5, identifyType: this.userInfo.identifyType }).then(res => {
|
|
|
- this.vinList = res.data&&res.data.list || []
|
|
|
- this.vinList = this.vinList.filter(item => item.vinCode)
|
|
|
- this.status = 'nomore'
|
|
|
- })
|
|
|
- },
|
|
|
- // 商品一级分类
|
|
|
- getGoodType(){
|
|
|
- this.productTypeList = []
|
|
|
- getShopCategory({categoryLevel: 1, status: 1}).then(res => {
|
|
|
- const list = res.data || []
|
|
|
- const ret = []
|
|
|
- list.forEach(item => {
|
|
|
- ret.push({
|
|
|
- id: item.id,
|
|
|
- categorySn: item.categorySn,
|
|
|
- auth: true,
|
|
|
- name: item.categoryName,
|
|
|
- icon: item.iconUrl,
|
|
|
- url: '/pagesB/shopiing/searchProduct?clzId='+item.categorySn+'&clzName='+item.categoryName,
|
|
|
- target: 'page'
|
|
|
- })
|
|
|
- })
|
|
|
- // 转成二维数组
|
|
|
- for(let i=0;i<ret.length;i=i+8){
|
|
|
- this.productTypeList.push({
|
|
|
- id: 'swiper-item-'+i,
|
|
|
- list: ret.slice(i,(i+8)>ret.length?ret.length:(i+8))
|
|
|
- })
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
- // 商品列表查询
|
|
|
- getHotProductList(){
|
|
|
- this.productList = []
|
|
|
- this.hotProductPageNo = 1
|
|
|
- this.getProductList()
|
|
|
- },
|
|
|
- getProductList(){
|
|
|
- this.status = "loading"
|
|
|
- const dealerSn = this.hasLogin && this.userInfo && this.userInfo.sysUserFlag == '1' ? this.$store.state.vuex_storeShelf.dealerSn : ''
|
|
|
- // 获取推荐产品
|
|
|
- getShopProductList({pageNo:this.hotProductPageNo,pageSize:10,hotFlag:1, status: 1, dealerSn: dealerSn}).then(res => {
|
|
|
- if(res.status == 200){
|
|
|
- const list = res.data ? res.data.list : []
|
|
|
- this.productList.push(list)
|
|
|
- this.status = res.data.count>=this.list.length ? "nomore" : 'loadmore'
|
|
|
- // 判断是否最后一页
|
|
|
- const maxPages = Math.ceil(res.data.count / 10)
|
|
|
- this.totalhotPage = maxPages
|
|
|
- this.status = this.hotProductPageNo >= maxPages ? "nomore" : 'loadmore'
|
|
|
- this.noDataText = this.status == 'nomore' ? '没有更多了' : '更多商品'
|
|
|
- }else{
|
|
|
- this.status = "nomore"
|
|
|
- this.noDataText = res.message || '没有更多了'
|
|
|
- }
|
|
|
- })
|
|
|
- },
|
|
|
// 显示购物车tab
|
|
|
showCatTab(){
|
|
|
const videoIndex = this.$store.state.vuex_tabBarList.findIndex(item => item.text == '视频')
|
|
@@ -794,33 +818,6 @@
|
|
|
})
|
|
|
}
|
|
|
},
|
|
|
- // 单击banner
|
|
|
- clickBanner(index){
|
|
|
- const row = this.imgList[index]
|
|
|
- // 红包
|
|
|
- if(row.activeType == 'redPacket'){
|
|
|
- uni.navigateTo({url:"/pages/morePage/redPacket"})
|
|
|
- }
|
|
|
- // 图文
|
|
|
- if(row.contentType == 'IMAGE_CONTENT'){
|
|
|
- uni.navigateTo({url:"/pagesA/activeDetail/index?sn="+row.promoActiveSn})
|
|
|
- }
|
|
|
- // 视频
|
|
|
- if(row.contentType == 'VIDEO'){
|
|
|
- uni.navigateTo({url:"/pages/videos/detail?form=banner&&sn="+row.promoActiveSn})
|
|
|
- }
|
|
|
- // 链接
|
|
|
- if(row.contentType == 'LINK'){
|
|
|
- // 货架促销活动
|
|
|
- if(row.content.indexOf("pagesB/promoDetail") >= 0){
|
|
|
- uni.navigateTo({
|
|
|
- url: '/pagesB/promoProduct?promoActiveSn='+row.promoActiveSn+'&title='+row.title
|
|
|
- })
|
|
|
- }else{
|
|
|
- openWebView({url:row.content})
|
|
|
- }
|
|
|
- }
|
|
|
- },
|
|
|
// 选择取货方式
|
|
|
clickAction(index){
|
|
|
const shelfSn = this.hasShelf.shelfSn
|
|
@@ -829,7 +826,6 @@
|
|
|
if(index == 0){
|
|
|
uni.scanCode({
|
|
|
success: function (ret) {
|
|
|
- console.log(ret);
|
|
|
const params = {
|
|
|
codeType: ret.scanType == 'QR_CODE' ? 0 : 1
|
|
|
}
|
|
@@ -880,54 +876,58 @@
|
|
|
})
|
|
|
}
|
|
|
},
|
|
|
- // 去扫VIN
|
|
|
- openCamera(){
|
|
|
- if(this.hasLogin){
|
|
|
- // 游客身份
|
|
|
- if(this.userInfo.sysUserFlag == '0'){
|
|
|
- // 最多扫10次
|
|
|
- if(this.vuex_vinScanNums < this.scanMaxNums){
|
|
|
- uni.navigateTo({
|
|
|
- url: "/pages/scan-frame/scan-frame"
|
|
|
- })
|
|
|
- }else{
|
|
|
- uni.showModal({
|
|
|
- title: '提示',
|
|
|
- content: '个人用户扫描VIN仅限10次,您的次数已用完!',
|
|
|
- confirmText: '好的',
|
|
|
- showCancel: false,
|
|
|
- success(res) {}
|
|
|
- })
|
|
|
- }
|
|
|
- }else{
|
|
|
- // 非游客,直接扫
|
|
|
+ // 单击banner
|
|
|
+ clickBanner(index){
|
|
|
+ const row = this.imgList[index]
|
|
|
+ // 红包
|
|
|
+ if(row.activeType == 'redPacket'){
|
|
|
+ uni.navigateTo({url:"/pages/morePage/redPacket"})
|
|
|
+ }
|
|
|
+ // 图文
|
|
|
+ if(row.contentType == 'IMAGE_CONTENT'){
|
|
|
+ uni.navigateTo({url:"/pagesA/activeDetail/index?sn="+row.promoActiveSn})
|
|
|
+ }
|
|
|
+ // 视频
|
|
|
+ if(row.contentType == 'VIDEO'){
|
|
|
+ uni.navigateTo({url:"/pages/videos/detail?form=banner&&sn="+row.promoActiveSn})
|
|
|
+ }
|
|
|
+ // 链接
|
|
|
+ if(row.contentType == 'LINK'){
|
|
|
+ // 货架促销活动
|
|
|
+ if(row.content.indexOf("pagesB/promoDetail") >= 0){
|
|
|
uni.navigateTo({
|
|
|
- url: "/pages/scan-frame/scan-frame"
|
|
|
- })
|
|
|
+ url: '/pagesB/promoProduct?promoActiveSn='+row.promoActiveSn+'&title='+row.title
|
|
|
+ })
|
|
|
+ }else{
|
|
|
+ // 外网页面
|
|
|
+ openWebView({url:row.content})
|
|
|
}
|
|
|
- }else{
|
|
|
- uni.navigateTo({
|
|
|
- url: '/pages/login/login'
|
|
|
- })
|
|
|
}
|
|
|
},
|
|
|
// 查看扫描VIN记录
|
|
|
toAllRecord(){
|
|
|
- uni.navigateTo({
|
|
|
- url: this.hasLogin ? "/pagesA/vinRecord/vinRecord" : '/pages/login/login'
|
|
|
- })
|
|
|
+ if(this.hasLogin){
|
|
|
+ uni.navigateTo({
|
|
|
+ url: "/pagesA/vinRecord/vinRecord"
|
|
|
+ })
|
|
|
+ }else{
|
|
|
+ this.toLogin()
|
|
|
+ }
|
|
|
},
|
|
|
// 查看用户信息
|
|
|
toUser(){
|
|
|
if(this.hasLogin){
|
|
|
- // 用户详细信息 或 门店认证
|
|
|
- uni.navigateTo({
|
|
|
- url: this.userInfo.sysUserFlag == '1' ? '/pages/personData/personData' : '/pages/storeManage/storeAuth'
|
|
|
- })
|
|
|
+ if(this.userInfo.sysUserFlag == '1'){
|
|
|
+ // 用户详细信息
|
|
|
+ uni.navigateTo({
|
|
|
+ url: '/pages/personData/personData'
|
|
|
+ })
|
|
|
+ }else{
|
|
|
+ // 或 门店认证
|
|
|
+ this.toAuthStore()
|
|
|
+ }
|
|
|
}else{
|
|
|
- uni.navigateTo({
|
|
|
- url: '/pages/login/login'
|
|
|
- })
|
|
|
+ this.toLogin()
|
|
|
}
|
|
|
},
|
|
|
// 选择配件
|