From 49e3612d8f4f0dbd3ce261b17f20ad59da59db55 Mon Sep 17 00:00:00 2001 From: 付延余 <f-yanyu@outlook.com> Date: 星期四, 22 十二月 2022 14:18:58 +0800 Subject: [PATCH] 日发运计划接口同步后台更新。数字键盘动作更新。主页、申请页列表功能按钮更新(撤回,编辑,删除)。完善页面细节 --- pages/home/home.vue | 117 +++++++++------------- utils/request.js | 2 pages/jihua/jihua.vue | 61 ++++++++--- api/global.js | 55 ++++++++++ pages/my-application/my-application.vue | 20 ++- 5 files changed, 159 insertions(+), 96 deletions(-) diff --git a/api/global.js b/api/global.js index 37fcfb2..fda8eba 100644 --- a/api/global.js +++ b/api/global.js @@ -1,5 +1,8 @@ // import request from '@/config/request'; -import { BaseUrl } from '@/utils/request.js' +import { + BaseUrl +} from '@/utils/request.js' +// import { resolve } from 'node:path/win32'; // let BaseUrl = "/"; // const CURRENT_KEY = 'CURRENT_KEY'; @@ -98,6 +101,52 @@ }) } +function logout() { + uni.request({ + url: `${BaseUrl}/auth/token/logout`, + method: 'DELETE', + header: { + 'TENANT-ID': 5, + Authorization: 'Bearer ' + uni.getStorageSync('access_token'), + VERSION: 'zzl' + } + }) + .then(res => { + console.log('缂撳瓨娓呯悊鎴愬姛'); + uni.showToast({ + title: '鍒拌揪鐧诲綍椤碉紒' + }); + }) + .catch(err => { + uni.showToast({ + title: '缂撳瓨娓呯悊澶辫触锛�' + }); + }); +} +// 鍒犻櫎鎾ゅ洖鐢宠鎺ュ彛 +function deleteWithDrawApplicationGlobal(id) { + return new Promise((resolve, reject) => { + uni.request({ + url: `${BaseUrl}/yunxiao/xswaybill/${id}`, + method: 'DELETE', + header: { + 'TENANT-ID': 5, + Authorization: 'Bearer ' + uni.getStorageSync('access_token'), + VERSION: 'zzl' + }, + success: (res) => { + resolve(res.data); + }, + fail:(err) => { + uni.showToast({ + title: '鍒犻櫎鍑洪敊', + icon: 'none' + }); + } + }) + }) +} + @@ -109,5 +158,7 @@ export default { apiLogin, - wxSmallLogin + wxSmallLogin, + logout, + deleteWithDrawApplicationGlobal } diff --git a/pages/home/home.vue b/pages/home/home.vue index 77b20e8..8676b1f 100644 --- a/pages/home/home.vue +++ b/pages/home/home.vue @@ -50,10 +50,10 @@ <view class="bottom-container"> <!-- 鎸夐挳鍖哄煙 --> <view class="bottom-content__chulizhong bottom-content__item"> - <view @click="withDrawClick(item.procInstId)" v-if="item.status == 1"> + <!-- <view @click="withDrawClick(item.procInstId)" v-if="item.status == 1"> <image src="@/static/home/cehui.png" mode=""></image> <view>鎾ゅ洖</view> - </view> + </view> --> <view @click="checkTheScheduleClick(item.procInstId)" v-if="item.status == 1"> <image src="@/static/home/jindu.png" mode=""></image> <view>鏌ョ湅杩涘害</view> @@ -66,18 +66,18 @@ <image src="@/static/home/history.png" mode=""></image> <view>閲嶆柊鐢宠</view> </view> --> - <view @click="editMyApplication(item)" v-if="item.status == 1 && item.processName == '鍙戣繍閫氱煡鍗�'"> + <!-- <view @click="editMyApplication(item)" v-if="item.status == 1 && item.processName == '鍙戣繍閫氱煡鍗�'"> <image src="@/static/home/history.png" mode=""></image> <view>缂栬緫</view> - </view> + </view> --> <view @click="approvalHistoryClick(item.procInstId)" v-if="item.status == 2 || item.status == 3"> <image src="@/static/home/history.png" mode=""></image> <view>瀹℃壒鍘嗗彶</view> </view> - <view @click="deleteWithDrawApplication(item.tableId)" v-if="item.status == 3"> + <!-- <view @click="deleteWithDrawApplication(item.tableId)" v-if="item.status == 3"> <image src="@/static/home/delete.png" mode=""></image> <view>鍒犻櫎</view> - </view> + </view> --> </view> <!-- 宸茬粨鏉熷皬缁勬寜閽� --> <!-- <view class="bottom-content__chulizhong bottom-content__item" v-if="item.status == 2"> @@ -125,9 +125,9 @@ <!-- 寰呭姙鎸夐挳 --> <view class="bottom-content__item"> <view @click="theFormDataClick(item.tableId)"> - <image src="@/static/home/jindu.png" mode=""></image> - <view>鐢宠璇︽儏</view> - </view> + <image src="@/static/home/jindu.png" mode=""></image> + <view>鐢宠璇︽儏</view> + </view> <view @click="adopClick(item)"> <image src="@/static/home/tongguo.png" mode=""></image> <view>閫氳繃</view> @@ -175,7 +175,7 @@ </view> <view class="center-content__three center-margin"> <view class=""> - <text>瀹℃壒鎰忚锛歿{ item.comment=='undefined'?'鏈~鍐�':item.comment || '鏈~鍐�' }}</text> + <text>瀹℃壒鎰忚锛歿{ item.comment == 'undefined' ? '鏈~鍐�' : item.comment || '鏈~鍐�' }}</text> </view> <view class=""> <text> @@ -218,7 +218,7 @@ <!-- 鏃ヨ鍒� --> <combined-title title="鏃ュ彂杩愯鍒�" detailsPath="/pages/jihua/jihua" v-if="rijihuaMenu"></combined-title> - <view class="card-group bottomChild" > + <view class="card-group bottomChild"> <combination-card class="card" :showTop="false" v-for="(item, index) in fyData.slice(0, 2)" :key="item.id" v-if="rijihuaMenu"> <template v-slot:top></template> <template v-slot:center> @@ -333,9 +333,19 @@ import combinedTitle from '@/components/common/combined-title/combined-title.vue'; import combinationCard from '@/components/common/combination-card/combination-card.vue'; import { setAccessToken, redirectLogin } from '@/utils/status.js'; +import { logout } from '@/api/global.js'; export default { name: 'home', + onLaunch() { + let that = this; + uni.addInterceptor('redirectTo', { + //鐩戝惉鍏抽棴鏈〉闈㈣烦杞� + success(e) { + that.watchRouter(); + } + }); + }, computed: { rijihuaMenu() { return this.$store.state.rijihuaMenu; @@ -456,24 +466,7 @@ onUnload(event) { //澶氬眰绾ц烦杞箣鍚庯紝鐩戝惉宸︿笂瑙掕繑鍥炰簨浠讹紝鐩存帴閫�鍥炲埌index console.log('鐩戝惉宸︿笂瑙�', event); - uni - .request({ - url: `${BaseUrl}/auth/token/logout`, - method: 'DELETE', - header: { - 'TENANT-ID': 5, - Authorization: 'Bearer ' + uni.getStorageSync('access_token'), - VERSION: 'zzl' - } - }) - .then(res => { - console.log('缂撳瓨娓呯悊鎴愬姛'); - }) - .catch(err => { - uni.showToast({ - title: '缂撳瓨娓呯悊澶辫触锛�' - }); - }); + this.logout(); }, onShow() { // 鑿滃崟娉ㄩ噴锛坅pp寰呯敤锛� @@ -488,6 +481,9 @@ // popupMenu }, methods: { + watchRouter() { + console.log('璺敱璺宠浆'); + }, init() { this.getUserInfo(); // 鐢ㄦ埛淇℃伅 this.getProcessDataList(); // 鐢宠鍒楄〃 @@ -606,19 +602,19 @@ this.withDrawData.procInstId = procInstId; }, withDrawConfirm() { - this.$reqPost('cancel', this.withDrawData).then(res => { - this.withDrawShow = false; - if (res.code == 0) { - uni.showToast({ - title: res.data, - duration: 2000 - }); - } - // 鍒锋柊鍒楄〃 - this.getProcessDataList(); - this.todoList(); - this.doneList(); - }); + this.$reqPost('cancel', this.withDrawData).then(res => { + this.withDrawShow = false; + if (res.code == 0) { + uni.showToast({ + title: res.data, + duration: 2000 + }); + } + // 鍒锋柊鍒楄〃 + this.getProcessDataList(); + this.todoList(); + this.doneList(); + }); }, withDrawCancel() { this.withDrawShow = false; @@ -645,7 +641,7 @@ this.$u.toast('閫氳繃澶辫触!!'); } this.todoList(); // 鎴戠殑寰呭姙 - this.doneList(); + this.doneList(); }); }, adoptModalCancel() { @@ -668,7 +664,7 @@ this.$u.toast('鎿嶄綔澶辫触锛侊紒锛�'); } this.todoList(); // 鎴戠殑寰呭姙 - this.doneList(); + this.doneList(); }); }, rejectModalCancel() { @@ -709,32 +705,16 @@ }); }, // 鍒犻櫎鎾ゅ洖鐢宠 - deleteWithDrawApplication(id){ - uni - .request({ - url: `${BaseUrl}/yunxiao/xswaybill/${id}`, - method: 'DELETE', - header: { - 'TENANT-ID': 5, - Authorization: 'Bearer ' + uni.getStorageSync('access_token'), - VERSION: 'zzl' + deleteWithDrawApplication(id) { + this.deleteWithDrawApplicationGlobal(id) + .then(res => { + if (res.code == 0) { + // 鍒锋柊鍒楄〃 + this.getProcessDataList(); } }) - .then(res => { - uni.showToast({ - title:'鍒犻櫎鎴愬姛', - icon:'none' - }) - - // 鍒锋柊鍒楄〃 - this.getProcessDataList(); - - }) .catch(err => { - uni.showToast({ - title:'鍒犻櫎鍑洪敊', - icon:'none' - }) + console.log('鍒犻櫎鎾ゅ洖鐢宠寮傚父'); }); }, // 閲嶆柊鐢宠 @@ -827,7 +807,6 @@ url: `/pages/approval-history/approval-history?index=${v}` }); }, - redirectLogin() { redirectLogin(); }, @@ -906,7 +885,7 @@ } } } - .bottomChild{ + .bottomChild { margin-bottom: vww(20); } diff --git a/pages/jihua/jihua.vue b/pages/jihua/jihua.vue index 1529468..bfe7338 100644 --- a/pages/jihua/jihua.vue +++ b/pages/jihua/jihua.vue @@ -162,6 +162,7 @@ onPageScroll(e) { // 浼犲叆scrollTop鍊煎苟瑙﹀彂鎵�鏈塭asy-loadimage缁勪欢涓嬬殑婊氬姩鐩戝惉浜嬩欢 this.scrollTop = e.scrollTop; + // console.log('灞忓箷婊氬姩鐩戝惉浜嬩欢',this.scrollTop); }, // 鐐瑰嚮瀵艰埅鏍忚彍鍗曞悗 onNavigationBarButtonTap(e) { @@ -194,17 +195,17 @@ }, deep: true, immediate: true - }, - scrollTop: { - handler: function(newV, oldV) { - if (newV != oldV) { - this.keyBoardClose(); - // this.keyBoardShow = false; - } - } - }, - deep: true, - immediate: true + } + // scrollTop: { + // handler: function(newV, oldV) { + // if (newV != oldV) { + // this.keyBoardClose(); + // // this.keyBoardShow = false; + // } + // }, + // deep: true, + // immediate: true + // } }, methods: { init() { @@ -265,12 +266,16 @@ //鎻愪氦 dataFormSubmit() { this.overlayShow = true; + uni.showLoading({ + title:'鍔犺浇涓�...' + }) this.fyData.forEach(e => { if(!e.shippingDate && e.numPlan){ e.shippingDate = this.info.shippingDate } }); this.$reqPost('addObj', this.fyData).then(res => { + uni.hideLoading(); if(res.code == 0){ setTimeout(()=>{ uni.showToast({ @@ -322,13 +327,15 @@ // 淇敼寮瑰嚭妗� editPopupClose(){ console.log('淇敼寮瑰嚭妗咰lose'); - // this.editPopupShow = false; + this.editPopupShow = false; + this.keyBoardShow = false; }, editPopupOpen(){ console.log('淇敼寮瑰嚭妗哋pen'); }, // 鍒囨崲鍏ㄩ儴鍜屽凡璁剧疆 groupChange(n) { + this.initVariable(); this.isTomJihua = n; if (n == '宸茶缃殑璁″垝') { this.xscarshippingdayplan(); @@ -338,6 +345,7 @@ }, //鍒囨崲浠婃棩鍜屾槑鏃� tabClick(item) { + this.initVariable(); if (item.index == 1) { this.info.shippingDate = this.tomorrowDate(); if (this.isTomJihua == '宸茶缃殑璁″垝') { @@ -354,6 +362,16 @@ } } }, + // 鍒濆鍖栧彉閲� + initVariable(){ + this.keyBoardShow = false; + this.keyBoardValue = null; + this.fayunPlanFocusId = null; + uni.pageScrollTo({ + scrollTop: 0, + duration: 300 + }); + }, inputChange(val) { console.log('鍏ㄩ儴璁″垝', val); }, @@ -363,10 +381,6 @@ }, // input鑾峰彇鐒︾偣 faYunPlanCarsFocus(item) { - // 鑾峰彇璇ョ劍鐐瑰湪椤甸潰鐨勪綅缃� - // let boxBottom = document.getElementById('#u-dropdown'); - // console.log('鍏冪礌',boxBottom); - // let bottom = this.$refs.planViewRef.offsetHeight this.keyBoardShow = true; this.fayunPlanFocusId = item.orderId; this.keyBoardValue = item.numPlan + ''; @@ -375,6 +389,17 @@ } else{ this.isCursor = true; } + + // 鏍规嵁鍒楄〃涓嬫爣锛屼娇灞忓箷婊氬姩鍒扮浉搴斿彲瑙嗕綅缃� + for(let i = 0;i<this.fyData.length;i++){ + if(this.fyData[i].orderId == item.orderId){ + uni.pageScrollTo({ + scrollTop: i*144, + duration: 300 + }); + } + } + }, // 閿洏 valChange(val) { @@ -393,7 +418,7 @@ item.numPlan = val; this.keyBoardValue = item.numPlan; } - } + } }); }, backspace() { @@ -538,7 +563,7 @@ display: flex; flex-direction: column; width: 100%; - padding: vww(44) vww(10) vww(70) vww(10); + padding: vww(44) vww(10) vww(270) vww(10); box-sizing: border-box; .main-inside { width: 100%; diff --git a/pages/my-application/my-application.vue b/pages/my-application/my-application.vue index 1a486b0..91d837b 100644 --- a/pages/my-application/my-application.vue +++ b/pages/my-application/my-application.vue @@ -86,10 +86,10 @@ <view class="bottom-container"> <!-- 鎸夐挳鍖哄煙 --> <view class="bottom-content__chulizhong bottom-content__item"> - <view @click="withDrawClick(item.procInstId)" v-if="item.status == 1"> + <!-- <view @click="withDrawClick(item.procInstId)" v-if="item.status == 1"> <image src="@/static/home/cehui.png" mode=""></image> <view>鎾ゅ洖</view> - </view> + </view> --> <view @click="checkTheScheduleClick(item.procInstId)" v-if="item.status == 1"> <image src="@/static/home/jindu.png" mode=""></image> <view>鏌ョ湅杩涘害</view> @@ -102,18 +102,18 @@ <image src="@/static/home/history.png" mode=""></image> <view>閲嶆柊鐢宠</view> </view> --> - <view @click="editMyApplication(item)" v-if="item.status == 1 && item.processName == '鍙戣繍閫氱煡鍗�'"> + <!-- <view @click="editMyApplication(item)" v-if="item.status == 1 && item.processName == '鍙戣繍閫氱煡鍗�'"> <image src="@/static/home/history.png" mode=""></image> <view>缂栬緫</view> - </view> + </view> --> <view @click="approvalHistoryClick(item.procInstId)" v-if="item.status == 2 || item.status == 3"> <image src="@/static/home/history.png" mode=""></image> <view>瀹℃壒鍘嗗彶</view> </view> - <view @click="deleteWithDrawApplication(item.tableId)" v-if="item.status == 3"> + <!-- <view @click="deleteWithDrawApplication(item.tableId)" v-if="item.status == 3"> <image src="@/static/home/delete.png" mode=""></image> <view>鍒犻櫎</view> - </view> + </view> --> </view> </view> </template> @@ -562,6 +562,14 @@ url: `/pages/approval-history/approval-history?index=${v}` }); }, + // 鍒犻櫎宸叉挙鍥炵敵璇� + deleteWithDrawApplication(id){ + this.deleteWithDrawApplicationGlobal(id).then(res=>{ + console.log('shenqing,鍥炴樉',res); + }).catch(err=>{ + console.log('shenqing,鍒犻櫎閿欒'); + }) + }, // 鏂板鐢宠 newApplicationClick() { uni.navigateTo({ diff --git a/utils/request.js b/utils/request.js index eddc284..ce39c72 100644 --- a/utils/request.js +++ b/utils/request.js @@ -18,7 +18,7 @@ const responseFailedDependency = () => { uni.showToast({ title: '鐧诲綍鐘舵�佽繃鏈�,鍗冲皢杩斿洖鐧诲綍锛�', - icon: 'error', + icon: 'none', position: 'top', duration: 2000 }); -- Gitblit v1.9.1