From 9d5b4d650e5b01081d3537c750e7469db4d161e3 Mon Sep 17 00:00:00 2001 From: 马宇豪 <978517621@qq.com> Date: 星期二, 29 四月 2025 08:53:20 +0800 Subject: [PATCH] 提交 --- pages/tabBar/firstPage/firstPage.vue | 78 ++++++++++++++- pages.json | 18 -- App.vue | 2 static/loginBg.png | 0 /dev/null | 0 pages/tabBar/count/count.vue | 32 ++---- pages/tabBar/current/current.vue | 40 ++++++- pages/tabBar/count/productDetail.vue | 2 static/takeAll.png | 0 manifest.json | 17 ++- api/index.js | 4 pages/tabBar/count/countDetail.vue | 2 pages/index/index.vue | 71 ++----------- 13 files changed, 147 insertions(+), 119 deletions(-) diff --git a/App.vue b/App.vue index bb81cd6..3a8f9af 100644 --- a/App.vue +++ b/App.vue @@ -2,7 +2,7 @@ import {getLastApp} from 'api/index.js'; import VUE_APP_BASE_URL from 'common/constant.js' -var jpushModule = uni.requireNativePlugin("JG-JPush") +// var jpushModule = uni.requireNativePlugin("JG-JPush") export default { data() { return { diff --git a/api/index.js b/api/index.js index 0d58ede..843c822 100644 --- a/api/index.js +++ b/api/index.js @@ -64,9 +64,9 @@ } // 领用 -export function postHazmatUse(hazmatId) { +export function postHazmatUse(hazmatId,used) { return service({ - url: `/api/app/hazmat/hazmatUse/${hazmatId}`, + url: `/api/app/hazmat/hazmatUse/${hazmatId}?used=${used}`, method: 'POST', }) } diff --git a/manifest.json b/manifest.json index 6f3eb62..2e0483e 100644 --- a/manifest.json +++ b/manifest.json @@ -2,7 +2,7 @@ "name" : "危化品管理", "appid" : "__UNI__3D059D7", "description" : "", - "versionName" : "1.0.0", + "versionName" : "1.2", "versionCode" : 1, "transformPx" : false, "networkTimeout" : { @@ -90,6 +90,9 @@ "spotlight@3x" : "unpackage/res/icons/120x120.png" } } + }, + "splashscreen" : { + "androidStyle" : "default" } }, "nativePlugins" : {} @@ -98,12 +101,16 @@ "quickapp" : {}, /* 快应用特有相关 */ "mp-weixin" : { - /* 小程序特有相关 */ - "appid" : "", + "appid" : "wx30be93b9431b6f84", "setting" : { - "urlCheck" : false + "urlCheck" : false, + "es6" : false, + "postcss" : true }, - "usingComponents" : true + "usingComponents" : true, + "uniStatistics" : { + "enable" : true + } }, "vueVersion" : "2" } diff --git a/pages.json b/pages.json index 009bebd..d645f22 100644 --- a/pages.json +++ b/pages.json @@ -30,14 +30,9 @@ { "navigationStyle": "custom", "navigationBarTitleText": "", - "enablePullDownRefresh": true, + "enablePullDownRefresh": false, "app-plus": { - "scrollIndicator": "none", - "pullToRefresh": { - "support": true, - "color": "#000000", - "style": "circle" - } + "scrollIndicator": "none" } } }, @@ -71,14 +66,9 @@ { "navigationStyle": "custom", "navigationBarTitleText": "", - "enablePullDownRefresh": true, + "enablePullDownRefresh": false, "app-plus": { - "scrollIndicator": "none", - "pullToRefresh": { - "support": true, - "color": "#000000", - "style": "circle" - } + "scrollIndicator": "none" } } } diff --git a/pages/index/index.vue b/pages/index/index.vue index 99b3d8f..aeeca37 100644 --- a/pages/index/index.vue +++ b/pages/index/index.vue @@ -14,14 +14,9 @@ <u-form :model="form" ref="uForm" class="form" > <u-form-item style="width: 80%;"><u-input v-model="form.username" :class="{'isFocused': userFocused}" placeholder="请输入用户名" @focus="focusUser"/></u-form-item> <u-form-item style="margin-top: 10px;width: 80%;" > - <u-input v-show="isPwd" v-model="form.password" :class="{'isFocused': codeFocused}" :password="true" placeholder="请输入密码" @focus="focusCode"> + <u-input v-model="form.password" :class="{'isFocused': codeFocused}" :password="isPwd" placeholder="请输入密码" @focus="focusCode"> <template slot="suffix"> - <u-icon name="eye" color="#999" size="20" @click="isPwd = false"></u-icon> - </template> - </u-input> - <u-input v-show="!isPwd" v-model="form.password" :class="{'isFocused': codeFocused}" :password="false" placeholder="请输入密码" @focus="focusCode"> - <template slot="suffix"> - <u-icon name="eye-off" color="#999" size="20" @click="isPwd = true"></u-icon> + <u-icon :name="isPwd?'eye':'eye-off'" color="#999" size="20" @click="isPwd = !isPwd"></u-icon> </template> </u-input> </u-form-item> @@ -31,7 +26,9 @@ </u-form> </view> </view> - + <view class="footer"> + 当前版本:1.2 + </view> </view> </template> @@ -39,7 +36,6 @@ import {login,getLastApp} from '../../api/index.js'; import store from '@/store/index.js' import VUE_APP_BASE_URL from '../../common/constant.js' - const jpushModule = uni.requireNativePlugin('JG-JPush') import loginTop from '../../static/loginBg.png' import loginPic from '../../static/loginPic.png' export default { @@ -57,40 +53,17 @@ }, isPwd: true, type: '', - //极光推送 - connectStatus: '未连接', - registrationID: '未获得', isLogining: false } }, onShow() { if(uni.getStorageSync('name') && uni.getStorageSync('pwd')){ - // this.form.name = uni.getStorageSync('name'); - // this.form.pwd = uni.getStorageSync('pwd'); -// if(uni.getStorageSync('roleName') == '工作人员'){ -// this.$store.commit('setRoleId', 'user_other'); -// uni.switchTab({ -// url: '/pages/tabBar/notice/notice' -// }); -// }else if (uni.getStorageSync('roleName') == '管理员'){ -// this.$store.commit('setRoleId', ''); -// uni.showToast({ -// icon: "none", -// title: '管理员请使用平台登录' -// }); -// }else{ -// this.$store.commit('setRoleId', 'user_leader'); -// uni.switchTab({ -// url: '/pages/tabBar/firstPage/firstPage' -// }); -// } }else{ uni.clearStorageSync(); uni.clearStorage(); } }, onLoad() { - // this.connect() }, methods: { base64Encode(str) { @@ -163,29 +136,7 @@ this.isLogining = false; }) }, - connect() { - uni.$on('connectStatusChange', (connectStatus) => { - var connectStr = '' - if (connectStatus == true) { - connectStr = '已连接' - this.getRegistrationID() - } else { - connectStr = '未连接' - } - console.log('监听到了连接状态变化 --- ', connectStr) - this.connectStatus = connectStr - }) - }, - //获取推送ID - getRegistrationID() { - jpushModule.getRegistrationID(result => { - let registerID = result.registerID - this.registrationID = registerID - this.form.registrationId = registerID; - uni.setStorageSync('registrationID', registerID); - console.log("iddd",uni.getStorageSync('registrationID')) - }) - }, + focusUser(){ this.userFocused = true @@ -215,7 +166,6 @@ .topImg{ width: 100%; - filter: drop-shadow(0 3px 8px rgba(21,148,232,.4)); } .topPic{ width: 80%; @@ -249,7 +199,14 @@ align-items: center; justify-content: center; } - +.footer{ + width: 100%; + position: fixed; + bottom: 24rpx; + text-align: center; + font-size: 22rpx; + color: #999; +} .titleFirst{ width: 80%; font-size: 34rpx; diff --git a/pages/tabBar/count/count.vue b/pages/tabBar/count/count.vue index 2ae4c74..a246841 100644 --- a/pages/tabBar/count/count.vue +++ b/pages/tabBar/count/count.vue @@ -30,7 +30,7 @@ </view> <view class="info-id" @click="resetPwd()"> - <span>修改密码</span><u-icon name="edit-pen" color="#e6e6e6" size="16"></u-icon> + <u-icon name="edit-pen" color="#e6e6e6" size="16"></u-icon><span>修改密码</span> </view> </view> </view> @@ -65,14 +65,9 @@ ref="password" label="新密码" > - <u-input v-show="isPwd1" v-model="pwdForm.password" placeholder="请输入新密码" :password="true"> + <u-input v-model="pwdForm.password" placeholder="请输入新密码" :password="isPwd1"> <template slot="suffix"> - <u-icon name="eye" color="#999" size="20" @click="isPwd1 = false"></u-icon> - </template> - </u-input> - <u-input v-show="!isPwd1" v-model="pwdForm.password" placeholder="请输入新密码" :password="false"> - <template slot="suffix"> - <u-icon name="eye-off" color="#999" size="20" @click="isPwd1 = true"></u-icon> + <u-icon :name="isPwd1?'eye':'eye-off'" color="#999" size="20" @click="isPwd1 = !isPwd1"></u-icon> </template> </u-input> </u-form-item> @@ -81,14 +76,9 @@ ref="rePassword" label="确认密码" > - <u-input v-show="isPwd2" v-model="pwdForm.rePassword" placeholder="请输入新密码" :password="true"> + <u-input v-model="pwdForm.rePassword" placeholder="请输入新密码" :password="isPwd2"> <template slot="suffix"> - <u-icon name="eye" color="#999" size="20" @click="isPwd2 = false"></u-icon> - </template> - </u-input> - <u-input v-show="!isPwd2" v-model="pwdForm.rePassword" placeholder="请输入新密码" :password="false"> - <template slot="suffix"> - <u-icon name="eye-off" color="#999" size="20" @click="isPwd2 = true"></u-icon> + <u-icon :name="isPwd2?'eye':'eye-off'" color="#999" size="20" @click="isPwd2 = !isPwd2"></u-icon> </template> </u-input> </u-form-item> @@ -123,7 +113,7 @@ examList: [], totalPage: 0, user: {}, - avator: '', + avator: avatorPic, showModal: false, pwdForm:{ id: null, @@ -176,11 +166,11 @@ // uni.hideTabBar(); // this.getUserInfo() this.user = uni.getStorageSync('userSet') - if(this.user.logoPath && this.user.logoPath !== ''){ - this.avator = VUE_APP_BASE_URL + '/api/' + this.user.logoPath - }else{ - this.avator = avatorPic - } + // if(this.user.logoPath && this.user.logoPath !== ''){ + // this.avator = VUE_APP_BASE_URL + '/api/' + this.user.logoPath + // }else{ + // this.avator = avatorPic + // } }, methods: { diff --git a/pages/tabBar/count/countDetail.vue b/pages/tabBar/count/countDetail.vue index 14af158..d94be11 100644 --- a/pages/tabBar/count/countDetail.vue +++ b/pages/tabBar/count/countDetail.vue @@ -28,7 +28,7 @@ <span style="font-weight: bold" v-if="item.hazmatBasic">{{item.hazmatBasic.companyName?item.hazmatBasic.companyName + '的':''}}{{item.hazmatBasic.name}}({{item.hazmatBasic.productSn}})</span> <span style="font-weight: bold" v-if="item.productBasic">{{item.productBasic.companyName?item.productBasic.companyName + '的':''}}{{item.productBasic.name}}({{item.productBasic.productSn}})</span> 进行 - <span :class="item.num>=0?'green':'red'" style="font-weight: bold;margin: 0 4px">{{item.state==0?'入库 ':item.state==1?'取用 ':item.state==2?'归还 ':item.state==3?'标签作废 ':item.state==4?'用尽登记 ':item.state==5?'销售 ':'-- '}}</span> + <span :class="item.num>=0?'green':'red'" style="font-weight: bold;margin: 0 4px">{{item.state==0?'入库 ':item.state==1?'取用 ':item.state==2?'归还 ':item.state==3?'标签作废 ':item.state==4?'用尽登记 ':item.state==5?'销售 ':item.state==6?'零头入库 ':'-- '}}</span> </view> <view v-if="item.hazmatBasic" :class="item.num>=0?'green':'red'" style="font-size: 28rpx"> <span v-if="item.num > 0">+</span>{{item.num + item.hazmatBasic.unit}} diff --git a/pages/tabBar/count/productDetail.vue b/pages/tabBar/count/productDetail.vue index 2efbccc..7cc5ceb 100644 --- a/pages/tabBar/count/productDetail.vue +++ b/pages/tabBar/count/productDetail.vue @@ -28,7 +28,7 @@ <span style="font-weight: bold" v-if="item.hazmatBasic">{{item.hazmatBasic.companyName?item.hazmatBasic.companyName + '的':''}}{{item.hazmatBasic.name}}({{item.hazmatBasic.productSn}})</span> <span style="font-weight: bold" v-if="item.productBasic">{{item.productBasic.companyName?item.productBasic.companyName + '的':''}}{{item.productBasic.name}}({{item.productBasic.productSn}})</span> 进行 - <span :class="item.num>=0?'green':'red'" style="font-weight: bold;margin: 0 4px">{{item.state==0?'入库 ':item.state==1?'取用 ':item.state==2?'归还 ':item.state==3?'标签作废 ':item.state==4?'用尽登记 ':item.state==5?'销售 ':'-- '}}</span> + <span :class="item.num>=0?'green':'red'" style="font-weight: bold;margin: 0 4px">{{item.state==0?'入库 ':item.state==1?'取用 ':item.state==2?'归还 ':item.state==3?'标签作废 ':item.state==4?'用尽登记 ':item.state==5?'销售 ':item.state==6?'零头入库 ':'-- '}}</span> </view> <view v-if="item.hazmatBasic" :class="item.num>=0?'green':'red'" style="font-size: 28rpx"> <span v-if="item.num > 0">+</span>{{item.num + item.hazmatBasic.unit}} diff --git a/pages/tabBar/current/current.vue b/pages/tabBar/current/current.vue index febe4c3..88df9d9 100644 --- a/pages/tabBar/current/current.vue +++ b/pages/tabBar/current/current.vue @@ -10,8 +10,9 @@ </view> </view> <!-- 页面内容 --> + <u-toast ref="uToast"></u-toast> <view class="m-p-15"> - <u-sticky> + <view class="searchBar"> <u-input placeholder="请输入或扫描二维码编号进行搜索" v-model="searchContent"> <template slot="prefix"> <u-icon name="scan" color="#2979ff" size="28" @click="scanCode()"></u-icon> @@ -20,7 +21,7 @@ <u-button type="primary" class="searchBtn" size="small" text="溯源查询" shape="circle" @click="getList()"></u-button> </template> </u-input> - </u-sticky> + </view> <view class="productCard" v-if="dataList && dataList.length>0"> <view v-if="dataList[0].hazmatBasic"> <view>名称:<span>{{dataList[0].hazmatBasic?dataList[0].hazmatBasic.name:''}}({{dataList[0].hazmatBasic?dataList[0].hazmatBasic.productSn :''}})</span></view> @@ -36,7 +37,7 @@ <view class="card-i-l"> <span><u-icon name="clock-fill" color="#2979ff" size="18" style="margin-right: 4px"></u-icon>{{item.updateTime}}</span> <view v-if="item.user"> - <span></span>{{item.user.departName}}部门的<span style="font-weight: bold">{{item.user.name }}</span>进行了<span :class="item.num>=0?'green':'red'">{{item.state==0?'入库':item.state==1?'取用':item.state==2?'归还':item.state==3?'标签作废':item.state==4?'用尽登记':item.state==5?'销售':'--'}}</span> + <span></span>{{item.user.departName}}部门的<span style="font-weight: bold">{{item.user.name }}</span>进行了<span :class="item.num>=0?'green':'red'">{{item.state==0?'入库':item.state==1?'取用':item.state==2?'归还':item.state==3?'标签作废':item.state==4?'用尽登记':item.state==5?'销售':item.state==6?'零头入库 ':'--'}}</span> </view> </view> <view v-if="item.hazmatBasic" class="card-i-r" :class="item.num>=0?'green':'red'"> @@ -71,7 +72,7 @@ data() { return { page: 'pages/tabBar/current/current', - statusBarHeight: 0, + statusBarHeight: '', searchContent: '', dataList: [] } @@ -80,6 +81,7 @@ this.statusBarHeight = uni.getSystemInfoSync()['statusBarHeight']; }, onShow() { + // this.getList() // this.role = uni.getStorageSync('roleName'); }, created(){ @@ -88,10 +90,21 @@ methods: { scanCode(){ const t = this + t.dataList = [] + t.searchContent = '' uni.scanCode({ autoZoom: false, + scanType: ['qrCode'], success: function (res) { if(res && res.result){ + if(res.result.indexOf('SJ') == -1 && res.result.indexOf('CP') == -1){ + t.$refs.uToast.show({ + type: 'default', + message: '没有识别到正确的编码,请重新扫码', + duration: 2000 + }) + return + } t.searchContent = res.result getHazmatFlowByCode({code: res.result}).then(re => { if(re.code == 200) { @@ -153,7 +166,7 @@ left: 0; right: 0; width: 100%; - z-index: 1; + z-index: 9999; } .statusBar{ background-color:lightgrey; @@ -167,10 +180,9 @@ } .u-input{ - border-color: #f5f5f5 !important; + border-color: #f5f7fa !important; border-radius: 99px; - background: #f5f5f5; - + background: #f5f7fa; box-shadow: 0px -6px 10px rgba(255, 255, 255, 1), 0px 4px 15px rgba(0, 0, 0, 0.1),0px 3px 6px rgba(0, 0, 0, 0.1) inset !important; transition: box-shadow .1s ease !important; } @@ -184,6 +196,15 @@ padding: 0 15px; margin-top: 20px; box-sizing: border-box; + + .searchBar{ + position: -webkit-sticky; + position: sticky; + top: 50px; + left: 0; + right: 0; + z-index: 9998; + } .productCard{ width: 100%; @@ -215,14 +236,15 @@ box-sizing: border-box; margin-top: 15px; box-shadow: 4px 4px 12px rgba(150,150,150,.05); + padding-bottom: 75px; .card-i{ width: 100%; background: #fff; border-radius: 12px; padding: 20px 15px; - margin: 0 auto; box-sizing: border-box; + margin: 0 auto; display: flex; justify-content: space-between; align-items: center; diff --git a/pages/tabBar/firstPage/firstPage.vue b/pages/tabBar/firstPage/firstPage.vue index 307761e..80a7434 100644 --- a/pages/tabBar/firstPage/firstPage.vue +++ b/pages/tabBar/firstPage/firstPage.vue @@ -13,7 +13,7 @@ </view> </view> <u-toast ref="uToast"></u-toast> - <view class="cardList" v-if="user.useProd == 1"> + <view class="tabList" v-if="user.useProd == 1"> <view class="switchPanel"> <view class="switchBtns"> <view class="btnItem" @click="changeTab(1)"> @@ -59,7 +59,7 @@ <view> 入库时间:{{tabNum == 1?hazmat.createTime:product.createTime}} </view> - <view v-if="modalTitle == '取用' || modalTitle == '扫码作废'"> + <view v-if="modalTitle == '常规取用' || modalTitle == '用尽取用' || modalTitle == '扫码作废'"> <span v-if="tabNum == 1">当前包装存量:{{hazmat.remaining}}{{hazmat.hazmatBasic?hazmat.hazmatBasic.unit:''}}</span> <span v-else>当前包装存量:{{product.remaining}}{{product.productBasic?product.productBasic.unit:''}}</span> </view> @@ -82,7 +82,8 @@ </u-form-item> </u--form> </view> - <u-button v-if="modalTitle == '取用'" type="primary" style="margin-top: 20px" text="确认取用" @click="confirmTake()"></u-button> + <u-button v-if="modalTitle == '常规取用'" type="primary" style="margin-top: 20px" text="确认取用" @click="confirmTake1()"></u-button> + <u-button v-if="modalTitle == '用尽取用'" type="primary" style="margin-top: 20px" text="确认取用" @click="confirmTake2()"></u-button> <u-button v-if="modalTitle == '归还'" type="primary" style="margin-top: 20px" text="确认归还" @click="confirmBack()"></u-button> <u-button v-if="modalTitle == '用尽登记'" type="warning" style="margin-top: 20px" text="确认用尽登记" @click="confirmCheck()"></u-button> <u-button v-if="modalTitle == '销售'" type="primary" style="margin-top: 20px" text="确认销售" @click="confirmSell()"></u-button> @@ -105,6 +106,7 @@ } from '../../../api/index.js' import VUE_APP_BASE_URL from 'common/constant.js' import take from '../../../static/take.png' + import takeAll from '../../../static/takeAll.png' import takeBack from '../../../static/return.png' import check from '../../../static/check.png' import del from '../../../static/delete.png' @@ -121,8 +123,13 @@ cardList1: [ { icon: take, - title: '取用', + title: '常规取用', type: 1 + }, + { + icon: takeAll, + title: '用尽取用', + type: 5 }, { icon: takeBack, @@ -212,8 +219,17 @@ t.modalTitle = title uni.scanCode({ autoZoom: false, + scanType: ['qrCode'], success: function (res) { if(res && res.result){ + if(res.result.indexOf('SJ') == -1 && res.result.indexOf('CP') == -1){ + t.$refs.uToast.show({ + type: 'default', + message: '没有识别到正确的编码,请重新扫码', + duration: 2000 + }) + return + } if(t.tabNum == 1){ getHazmatByCode({code: res.result}).then((re)=>{ if(re.code == 200){ @@ -259,9 +275,9 @@ }) }, - confirmTake(){ + confirmTake1(){ const t = this - postHazmatUse(t.hazmat.id).then((r)=>{ + postHazmatUse(t.hazmat.id,0).then((r)=>{ if(r.code == 200){ t.$refs.uToast.show({ type: 'default', @@ -281,6 +297,29 @@ }) t.closeModal() }, + + confirmTake2(){ + const t = this + postHazmatUse(t.hazmat.id,1).then((r)=>{ + if(r.code == 200){ + t.$refs.uToast.show({ + type: 'default', + message: r.message + }) + }else{ + t.$refs.uToast.show({ + type: 'default', + message: r.message + }) + } + }).catch((err) => { + uni.showToast({ + title: err, + duration: 2000 + }) + }) + t.closeModal() + }, confirmBack() { const t = this @@ -457,7 +496,7 @@ left: 0; right: 0; width: 100%; - z-index: 1; + z-index: 9999; } .barText{ /* text-align: center; */ @@ -484,6 +523,23 @@ width: 100%; } } + +.tabList{ + width: 100%; + box-sizing: border-box; + padding: 0 15px; + margin-top: 15px; + display: flex; + flex-direction: column; + align-items: center; + position: -webkit-sticky; + position: sticky; + top: 50px; + left: 0; + right: 0; + z-index: 9998; +} + .switchPanel{ width: 100%; height: 84rpx; @@ -492,6 +548,7 @@ box-sizing: border-box; border-radius: 8px; box-shadow: 0px -6px 10px rgba(255, 255, 255, 1), 0px 4px 15px rgba(0, 0, 0, 0.1),0px 3px 6px rgba(0, 0, 0, 0.05) inset !important; + background: #f5f7fa; .switchBtns{ width: 100%; @@ -533,11 +590,12 @@ border: 2rpx solid #fff; } } + .cardList{ width: 100%; box-sizing: border-box; padding: 0 15px; - margin-top: 20px; + margin-top: 15px; display: flex; flex-direction: column; align-items: center; @@ -559,6 +617,10 @@ box-shadow: none; } + &:last-of-type{ + margin-bottom: 75px; + } + .cardTit{ font-size: 36rpx; font-weight: bold; diff --git a/static/loginBg.png b/static/loginBg.png index 8e0c2ac..3fbbd0c 100644 --- a/static/loginBg.png +++ b/static/loginBg.png Binary files differ diff --git a/static/loginTop1.png b/static/loginTop1.png deleted file mode 100644 index 6ccff42..0000000 --- a/static/loginTop1.png +++ /dev/null Binary files differ diff --git a/static/takeAll.png b/static/takeAll.png new file mode 100644 index 0000000..27fc992 --- /dev/null +++ b/static/takeAll.png Binary files differ -- Gitblit v1.9.2