Browse Source

no message

devlop
xpz2018 3 years ago
parent
commit
c22fc4abca
7 changed files with 106 additions and 57 deletions
  1. 18
      apis/commonApi.js
  2. 1
      pages/device-production-info/index.vue
  3. 18
      pages/digital-workshops/index.vue
  4. 3
      pages/employee-manage/index.vue
  5. 35
      pages/enterprise-info-edit/index.vue
  6. 76
      pages/mine/index.vue
  7. 12
      store/index.js

18
apis/commonApi.js

@ -80,11 +80,19 @@ export function getBaseInfo(data = {}, refresh = false) {
http.get({ url: '/yyt-uec/get/base-info', data }, { hideLoading: true }).then((res) => { http.get({ url: '/yyt-uec/get/base-info', data }, { hideLoading: true }).then((res) => {
if (res) { if (res) {
// 排除供应商角色 // 排除供应商角色
if (res.enterpriseList && res.enterpriseList.length > 0 && res.enterpriseList[0].enterpriseType == enterpriseType.SUPPLIER) {
uni.showToast({
title: '您是供应商角色,请登陆纸掌柜app进行操作',
icon: 'error'
})
var factory = null
var organizationList = res.organizationList
if(res.organizationList && res.organizationList.length > 0){
for (var i = 0; i < res.organizationList.length; i++) {
if(!res.organizationList[i].factoryList || !res.organizationList[i].factoryList.length){
continue
}
factory = res.organizationList[i].factoryList[0]
break
}
}
if (!factory) {
uni.showToast({ title: '没有您的工厂信息,请联系管理员处理', icon: 'error'})
resolve(null) resolve(null)
} else { } else {
baseInfo = res baseInfo = res

1
pages/device-production-info/index.vue

@ -189,7 +189,6 @@ export default {
this.info = res this.info = res
} }
}) })
uni.setStorageSync('factoryId', this.factoryId)
getOrderListByMachine(this.id, {status: 1}).then((res) => { getOrderListByMachine(this.id, {status: 1}).then((res) => {
if (res && res.productionTaskList && res.productionTaskList.length) { if (res && res.productionTaskList && res.productionTaskList.length) {
this.orderList = res.productionTaskList this.orderList = res.productionTaskList

18
pages/digital-workshops/index.vue

@ -184,6 +184,10 @@ export default {
watch: { watch: {
factoryId(val, oldVal) { factoryId(val, oldVal) {
uni.setStorageSync('factoryId', this.factoryId) uni.setStorageSync('factoryId', this.factoryId)
var organization = this.findOrgByFactoryId(this.factoryId)
if(organization){
uni.setStorageSync('organizationId', organization.organizationId)
}
if(this.factoryId){ if(this.factoryId){
this.getCameraList() this.getCameraList()
this.getList() this.getList()
@ -218,6 +222,20 @@ export default {
this.current = e.currentIndex; this.current = e.currentIndex;
} }
}, },
findOrgByFactoryId(factoryId){
var organizationList = this.$store.state.userInfo.organizationList
for (var i = 0; i < organizationList.length; i++) {
if(!organizationList[i].factoryList || !organizationList[i].factoryList.length){
continue
}
for (var k = 0; k < organizationList[i].factoryList.length; k++) {
if(organizationList[i].factoryList[k].id == factoryId){
return organizationList[i]
}
}
}
return null
},
getList() { getList() {
getMachinList({ factoryId: this.factoryId, pageSize: 1000 }).then((res) => { getMachinList({ factoryId: this.factoryId, pageSize: 1000 }).then((res) => {
let list = res.records let list = res.records

3
pages/employee-manage/index.vue

@ -92,7 +92,6 @@ export default {
}, },
findOrgByFactoryId(factoryId){ findOrgByFactoryId(factoryId){
var organizationList = this.$store.state.userInfo.organizationList var organizationList = this.$store.state.userInfo.organizationList
console.log(organizationList)
for (var i = 0; i < organizationList.length; i++) { for (var i = 0; i < organizationList.length; i++) {
if(!organizationList[i].factoryList || !organizationList[i].factoryList.length){ if(!organizationList[i].factoryList || !organizationList[i].factoryList.length){
continue continue
@ -119,7 +118,7 @@ export default {
provider: 'weixin', provider: 'weixin',
scene: "WXSceneSession", scene: "WXSceneSession",
type: 5, type: 5,
imageUrl: 'https://qncloud.oss-cn-shenzhen.aliyuncs.com/common/45309546072860651.webp',
imageUrl: 'https://qncloud.oss-cn-shenzhen.aliyuncs.com/common/46359753264412852.webp',
title: '欢迎加入普瑞特', title: '欢迎加入普瑞特',
miniProgram: { miniProgram: {
id: 'gh_ddfcf0fe593d', id: 'gh_ddfcf0fe593d',

35
pages/enterprise-info-edit/index.vue

@ -220,22 +220,37 @@ export default {
} }
}) })
}, },
created() {
const enterpriseId = this.$store.state.companyInfo.id
if (enterpriseId) {
getCompanyInfoById(enterpriseId).then((res) => {
if (res) {
this.form = res
this.form.id = enterpriseId
}
})
}
onLoad() {
var factoryId = uni.getStorageSync('factoryId')
var organization = this.findOrgByFactoryId(factoryId)
if(organization){
getCompanyInfoById(organization.enterpriseId).then((res) => {
if (res) {
this.form = res
this.form.id = organization.enterpriseId
}
})
}
}, },
methods: { methods: {
back, back,
cancel() { cancel() {
back() back()
}, },
findOrgByFactoryId(factoryId){
var organizationList = this.$store.state.userInfo.organizationList
for (var i = 0; i < organizationList.length; i++) {
if(!organizationList[i].factoryList || !organizationList[i].factoryList.length){
continue
}
for (var k = 0; k < organizationList[i].factoryList.length; k++) {
if(organizationList[i].factoryList[k].id == factoryId){
return organizationList[i]
}
}
}
return null
},
showLocationList() { showLocationList() {
if (!this.form.name || !this.form.name.trim()) { if (!this.form.name || !this.form.name.trim()) {
uni.showToast({ uni.showToast({

76
pages/mine/index.vue

@ -19,7 +19,7 @@
<image v-if="userInfo.fddEnterpriseStatus === fddStatus.CERTIFIED_SUCCESS" class="image" src="/static/imgs/mine/certified-icon.png"></image> <image v-if="userInfo.fddEnterpriseStatus === fddStatus.CERTIFIED_SUCCESS" class="image" src="/static/imgs/mine/certified-icon.png"></image>
<image v-else class="image" @click="certifyCompany()" src="/static/imgs/mine/non-certified-icon.png"></image> <image v-else class="image" @click="certifyCompany()" src="/static/imgs/mine/non-certified-icon.png"></image>
</view> </view>
<view style="margin-top: 16rpx; width: 380rpx">
<view style="margin-top: 16rpx; width: 450rpx">
<text style="font-size: 26rpx; color: #fff; font-weight: 400; word-break: break-all" @click="jumpEnterpriseEdit"> <text style="font-size: 26rpx; color: #fff; font-weight: 400; word-break: break-all" @click="jumpEnterpriseEdit">
{{ hasCompany ? userInfo.companyName : '点击完善企业信息' }} {{ hasCompany ? userInfo.companyName : '点击完善企业信息' }}
</text> </text>
@ -131,6 +131,7 @@ export default {
workingNum: 0, workingNum: 0,
freeNum: 0 freeNum: 0
}, },
hasLogin: false,
fsAuditStatus: Object.freeze(fsAuditStatus), fsAuditStatus: Object.freeze(fsAuditStatus),
orderStatusEnum: Object.freeze(orderStatusEnum) orderStatusEnum: Object.freeze(orderStatusEnum)
} }
@ -207,13 +208,25 @@ export default {
} }
}) })
}, },
findOrgByFactoryId(factoryId){
var organizationList = this.$store.state.userInfo.organizationList
for (var i = 0; i < organizationList.length; i++) {
if(!organizationList[i].factoryList || !organizationList[i].factoryList.length){
continue
}
for (var k = 0; k < organizationList[i].factoryList.length; k++) {
if(organizationList[i].factoryList[k].id == factoryId){
return organizationList[i]
}
}
}
return null
},
jumpEnterpriseEdit() { jumpEnterpriseEdit() {
if (!this.hasCompany) { if (!this.hasCompany) {
loginGo2('enterprise-info') loginGo2('enterprise-info')
} else { } else {
if (this.$store.state.companyInfo.enterpriseType === enterpriseType.PRINT_PACKAGE_FACTORY) {
loginGo2('enterprise-info-edit')
}
loginGo2('enterprise-info-edit')
} }
} }
}, },
@ -227,9 +240,6 @@ export default {
isVip() { isVip() {
return this.$store.state.companyInfo.isVip return this.$store.state.companyInfo.isVip
}, },
hasLogin() {
return this.$store.state.qnToken != ''
},
curAvatar() { curAvatar() {
if (!this.hasLogin) { if (!this.hasLogin) {
return '/static/imgs/mine/user-avatar.png' return '/static/imgs/mine/user-avatar.png'
@ -239,36 +249,36 @@ export default {
} else { } else {
return '/static/imgs/mine/default-avatar.png' return '/static/imgs/mine/default-avatar.png'
} }
},
userInfo() {
return {
avatar: this.$store.state.userInfo.avatar || '',
name: this.$store.state.userInfo.name || this.$store.state.userInfo.mobile || '',
companyName: this.$store.state.companyInfo.name || '',
fddEnterpriseStatus: this.$store.state.companyInfo.fddEnterpriseStatus || 1
}
},
hasCompany() {
return this.$store.state.companyInfo.id != null
} }
}, },
onShow() { onShow() {
this.hasLogin &&
getFsCredit({
enterpriseId: this.$store.state.companyInfo.id
}).then((res) => {
if (res) {
this.fsInfo = res
this.factoryId = uni.getStorageSync('factoryId')
this.organization = this.findOrgByFactoryId(this.factoryId)
var companyName = ''
if(this.organization){
companyName = this.organization.organizationName
this.hasLogin = true
this.hasCompany = true
this.userInfo = {
avatar: this.$store.state.userInfo.avatar || '',
name: this.$store.state.userInfo.name || this.$store.state.userInfo.mobile || '',
companyName,
fddEnterpriseStatus: this.$store.state.companyInfo.fddEnterpriseStatus || 1
} }
})
this.hasLogin && getBaseInfo({}, true)
!this.hasLogin && (this.fsInfo.status = -1)
this.hasCompany &&
getDeviceStatistics().then((res) => {
if (res) {
this.deviceInfo = res
}
})
getFsCredit({
enterpriseId: this.organization.enterpriseId
}).then((res) => {
if (res) {
this.fsInfo = res
}
})
getDeviceStatistics().then((res) => {
if (res) {
this.deviceInfo = res
}
})
}
} }
} }
</script> </script>

12
store/index.js

@ -177,12 +177,12 @@ if (!store) {
console.warn('companyInfo必须是对象') console.warn('companyInfo必须是对象')
return return
} }
for (let param of companyInfoParams) {
if (companyInfo[param] === undefined) {
console.warn(`companyInfo必须包含${param}`)
return
}
}
// for (let param of companyInfoParams) {
// if (companyInfo[param] === undefined) {
// console.warn(`companyInfo必须包含${param}`)
// return
// }
// }
try { try {
uni.setStorageSync('companyInfo', JSON.stringify(companyInfo)) uni.setStorageSync('companyInfo', JSON.stringify(companyInfo))
state.companyInfo = companyInfo state.companyInfo = companyInfo

Loading…
Cancel
Save