|
@@ -1,6 +1,8 @@
|
|
|
import { mapGetters,mapActions } from 'vuex'
|
|
import { mapGetters,mapActions } from 'vuex'
|
|
|
import { pageTo, getCheckLogin, isLogin } from '@/utils/util.js'
|
|
import { pageTo, getCheckLogin, isLogin } from '@/utils/util.js'
|
|
|
import { getUser, wxLoginFn } from '@/utils/auth'
|
|
import { getUser, wxLoginFn } from '@/utils/auth'
|
|
|
|
|
+import { postWxCode, getDictionaries } from '@/api/mini'
|
|
|
|
|
+import { getStaffApi } from '@/api/common'
|
|
|
import constant from '@/constant'
|
|
import constant from '@/constant'
|
|
|
export default {
|
|
export default {
|
|
|
data() {
|
|
data() {
|
|
@@ -14,12 +16,14 @@ export default {
|
|
|
// 全局混入,插入全局跳转函数
|
|
// 全局混入,插入全局跳转函数
|
|
|
pageTo: pageTo,
|
|
pageTo: pageTo,
|
|
|
AUTHORITY_SHOW: false,
|
|
AUTHORITY_SHOW: false,
|
|
|
- shopAdminId: null
|
|
|
|
|
|
|
+ shopAdminId: null,
|
|
|
|
|
+ MODEL_TITLE: '您还没有网店哦',
|
|
|
|
|
+ MODEL_BTN_TEXT: '免费申请'
|
|
|
}
|
|
}
|
|
|
},
|
|
},
|
|
|
computed: {
|
|
computed: {
|
|
|
...mapGetters({ loginInfo: "getLoginInfo" }),
|
|
...mapGetters({ loginInfo: "getLoginInfo" }),
|
|
|
- ...mapGetters(["getLoginInfo"])
|
|
|
|
|
|
|
+ ...mapGetters(["getLoginInfo", 'userInfo'])
|
|
|
},
|
|
},
|
|
|
// 页面生命周期才触发
|
|
// 页面生命周期才触发
|
|
|
onLoad: function (option) {
|
|
onLoad: function (option) {
|
|
@@ -32,8 +36,8 @@ export default {
|
|
|
uni.setStorageSync('account', option.account)
|
|
uni.setStorageSync('account', option.account)
|
|
|
}
|
|
}
|
|
|
uni.setStorageSync('currentQuery', JSON.stringify(option))
|
|
uni.setStorageSync('currentQuery', JSON.stringify(option))
|
|
|
- console.log(uni.getStorageSync('SHOPADMINID'),'this.shopAdminId')
|
|
|
|
|
- if (uni.getStorageSync('SHOPADMINID') == '0') {
|
|
|
|
|
|
|
+ console.log(uni.getStorageSync('SHOP_ADMIN_STROAGE_SHOW'),'this.shopAdminId', this.getLoginInfo)
|
|
|
|
|
+ if (uni.getStorageSync('SHOP_ADMIN_STROAGE_SHOW') == '0' || uni.setStorageSync('OPEN_SHOP_ID') == '2') {
|
|
|
this.AUTHORITY_SHOW = true
|
|
this.AUTHORITY_SHOW = true
|
|
|
}
|
|
}
|
|
|
if (this.$util.isEmpty(this.getLoginInfo)) {
|
|
if (this.$util.isEmpty(this.getLoginInfo)) {
|
|
@@ -49,12 +53,16 @@ export default {
|
|
|
})
|
|
})
|
|
|
if (needRedirect === true) {
|
|
if (needRedirect === true) {
|
|
|
//客户访问不能查看的页面跳转去官网
|
|
//客户访问不能查看的页面跳转去官网
|
|
|
- if (res.data.shopAdminId == '0') {
|
|
|
|
|
|
|
+ console.log('res.data.damin', res.data.admin.openShop)
|
|
|
|
|
+ if (res.data.shopAdminId == '0' && res.data.admin.openShop == '1') {
|
|
|
this.AUTHORITY_SHOW = true;
|
|
this.AUTHORITY_SHOW = true;
|
|
|
- uni.setStorageSync('SHOPADMINID', res.data.shopAdminId)
|
|
|
|
|
- this.shopAdminId = true;
|
|
|
|
|
- } else {
|
|
|
|
|
- uni.removeStorageSync('SHOPADMINID')
|
|
|
|
|
|
|
+ uni.setStorageSync('SHOP_ADMIN_STROAGE_SHOW', res.data.shopAdminId)
|
|
|
|
|
+ } else if (res.data.admin.openShop == '2' && res.data.shopAdminId == '0') {
|
|
|
|
|
+ this.MODEL_TITLE = '已申请'
|
|
|
|
|
+ this.MODEL_BTN_TEXT = '查看申请进度'
|
|
|
|
|
+ this.AUTHORITY_SHOW = true
|
|
|
|
|
+ uni.removeStorageSync('SHOP_ADMIN_STROAGE_SHOW')
|
|
|
|
|
+ uni.setStorageSync('OPEN_SHOP_ID', res.data.admin.openShop)
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
getUser(true)
|
|
getUser(true)
|
|
@@ -77,14 +85,96 @@ export default {
|
|
|
methods: {
|
|
methods: {
|
|
|
...mapActions(['setUserShopAll']),
|
|
...mapActions(['setUserShopAll']),
|
|
|
toFreeApply_HOME () {
|
|
toFreeApply_HOME () {
|
|
|
- this.$util.pageTo({
|
|
|
|
|
- url: "/pagesClient/official/index",
|
|
|
|
|
- type: 2,
|
|
|
|
|
- query: {
|
|
|
|
|
- ...this.option
|
|
|
|
|
- }
|
|
|
|
|
- });
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ let status = ''
|
|
|
|
|
+ if (uni.getStorageSync('SHOP_ADMIN_STROAGE_SHOW') == '0') {
|
|
|
|
|
+ this.$util.pageTo({
|
|
|
|
|
+ url: "/pagesClient/official/index",
|
|
|
|
|
+ type: 2,
|
|
|
|
|
+ query: {
|
|
|
|
|
+ ...this.option
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ } else {
|
|
|
|
|
+ getStaffApi().then(res => {
|
|
|
|
|
+ console.log(res)
|
|
|
|
|
+ if (res.data.openShop == '2') {
|
|
|
|
|
+ status = '2'
|
|
|
|
|
+ } else if (res.data.openShop == '3') {
|
|
|
|
|
+ status = '3'
|
|
|
|
|
+ }
|
|
|
|
|
+ this.$util.pageTo({
|
|
|
|
|
+ url: '/admin/home/result',
|
|
|
|
|
+ type: 2,
|
|
|
|
|
+ query: {
|
|
|
|
|
+ status
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ }).catch(err => {})
|
|
|
|
|
+ // this.$util.pageTo({
|
|
|
|
|
+ // url: '/admin/home/result',
|
|
|
|
|
+ // type: 2,
|
|
|
|
|
+ // query: {
|
|
|
|
|
+ // status: '2'
|
|
|
|
|
+ // }
|
|
|
|
|
+ // })
|
|
|
|
|
+ }
|
|
|
|
|
+ },
|
|
|
|
|
+ experienceFun(){
|
|
|
|
|
+ /**姜枫 2021.04.30 小程序审核体验账号**/
|
|
|
|
|
+ postWxCode().then(subRes => {
|
|
|
|
|
+ if (this.$util.isEmpty(subRes)) {
|
|
|
|
|
+ return false
|
|
|
|
|
+ }
|
|
|
|
|
+ uni.setStorageSync('token', subRes.data.token)
|
|
|
|
|
+ uni.setStorageSync('shopId', subRes.data.admin.currentShopId)
|
|
|
|
|
+ getDictionaries({ token: subRes.data.token }).then(res => {
|
|
|
|
|
+ if (this.$util.isEmpty(res)) {
|
|
|
|
|
+ return false
|
|
|
|
|
+ }
|
|
|
|
|
+ this.$store.commit('setDictionariesInfo', {
|
|
|
|
|
+ ...res.data.dict,
|
|
|
|
|
+ ...res.data
|
|
|
|
|
+ })
|
|
|
|
|
+ this.$store.commit('setMyShopInfo', {
|
|
|
|
|
+ ...res.data.shop,
|
|
|
|
|
+ ...res.data
|
|
|
|
|
+ })
|
|
|
|
|
+ })
|
|
|
|
|
+ this.$store.commit('setLoginInfo', {
|
|
|
|
|
+ ...subRes.data.admin,
|
|
|
|
|
+ ...subRes.data
|
|
|
|
|
+ })
|
|
|
|
|
+ uni.removeStorageSync('SHOP_ADMIN_STROAGE_SHOW')
|
|
|
|
|
+ uni.removeStorageSync('OPEN_SHOP_ID')
|
|
|
|
|
+ this.AUTHORITY_SHOW = false
|
|
|
|
|
+ //启动更新逻辑 shish 2020.5.18
|
|
|
|
|
+ if (subRes.data.update == 1) {
|
|
|
|
|
+ const updateManager = wx.getUpdateManager()
|
|
|
|
|
+ updateManager.onCheckForUpdate(function (res) {
|
|
|
|
|
+ // 请求完新版本信息的回调
|
|
|
|
|
+ console.log(res.hasUpdate)
|
|
|
|
|
+ })
|
|
|
|
|
+ updateManager.onUpdateReady(function () {
|
|
|
|
|
+ wx.showModal({
|
|
|
|
|
+ title: '更新提示',
|
|
|
|
|
+ content: '新版本已经准备好,是否重启应用?',
|
|
|
|
|
+ success(res) {
|
|
|
|
|
+ if (res.confirm) {
|
|
|
|
|
+ // 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
|
|
|
|
|
+ updateManager.applyUpdate()
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ })
|
|
|
|
|
+ })
|
|
|
|
|
+ updateManager.onUpdateFailed(function () {})// 新版本下载失败
|
|
|
|
|
+ return true;
|
|
|
|
|
+ }
|
|
|
|
|
+ getUser(true)
|
|
|
|
|
+ //获取门店信息
|
|
|
|
|
+ this.setUserShopAll();
|
|
|
|
|
+ uni.switchTab({url:'/admin/home/workbench'})
|
|
|
|
|
+ })
|
|
|
|
|
+ },
|
|
|
},
|
|
},
|
|
|
mounted() {
|
|
mounted() {
|
|
|
if (this.mInit) {
|
|
if (this.mInit) {
|