From 36f01c7a56f0941700b19e4f7eec3c63bab40f72 Mon Sep 17 00:00:00 2001
From: yujk <990961482@qq.com>
Date: Thu, 7 Apr 2022 18:23:13 +0800
Subject: [PATCH] =?UTF-8?q?=E9=83=A8=E9=97=A8=EF=BC=8C=E8=B4=A6=E5=A5=97?=
=?UTF-8?q?=E9=80=89=E6=8B=A9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app.json | 3 +-
component/pop-up/index.js | 36 ++++++
component/pop-up/index.json | 4 +
component/pop-up/index.wxml | 7 +
component/pop-up/index.wxss | 37 ++++++
env/env.js | 6 +-
pages/index/index.js | 252 ++++++++++++++++++++++++++++++++----
pages/index/index.json | 3 +-
pages/index/index.wxml | 38 +++++-
pages/index/index.wxss | 76 +++++++++++
utils/API.js | 15 ++-
11 files changed, 440 insertions(+), 37 deletions(-)
create mode 100644 component/pop-up/index.js
create mode 100644 component/pop-up/index.json
create mode 100644 component/pop-up/index.wxml
create mode 100644 component/pop-up/index.wxss
diff --git a/app.json b/app.json
index 53750aa..295acc2 100644
--- a/app.json
+++ b/app.json
@@ -15,7 +15,8 @@
"pages/apply/paymentTemplate/see/see",
"pages/apply/paymentTemplate/add/add",
"pages/payee/index",
- "pages/payee/add/add"
+ "pages/payee/add/add",
+ "component/pop-up/index"
],
"window": {
"backgroundTextStyle": "light",
diff --git a/component/pop-up/index.js b/component/pop-up/index.js
new file mode 100644
index 0000000..5cf6a81
--- /dev/null
+++ b/component/pop-up/index.js
@@ -0,0 +1,36 @@
+Component({
+ options: {
+ multipleSlots: true // 在组件定义时的选项中启用多slot支持
+ },
+ /**
+ * 组件的属性列表
+ */
+ properties: {
+ visible: {
+ type: Boolean,
+ value: false
+ }
+ },
+
+ /**
+ * 组件的初始数据
+ */
+ data: {},
+
+ /**
+ * 组件的方法列表
+ */
+ methods: {
+ popPreventTouchmove() { },
+ popPreventTouchmove2() { },
+ popPreventTouchmove3() { },
+ cityChange() { },
+ close() {
+ this.triggerEvent('close')
+ },
+ handleClickMask(e) {
+ // console.log(e)
+ if (e.target.dataset.type !== 'unclose') this.close()
+ }
+ }
+})
diff --git a/component/pop-up/index.json b/component/pop-up/index.json
new file mode 100644
index 0000000..e8cfaaf
--- /dev/null
+++ b/component/pop-up/index.json
@@ -0,0 +1,4 @@
+{
+ "component": true,
+ "usingComponents": {}
+}
\ No newline at end of file
diff --git a/component/pop-up/index.wxml b/component/pop-up/index.wxml
new file mode 100644
index 0000000..290e8fb
--- /dev/null
+++ b/component/pop-up/index.wxml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/component/pop-up/index.wxss b/component/pop-up/index.wxss
new file mode 100644
index 0000000..438e5bd
--- /dev/null
+++ b/component/pop-up/index.wxss
@@ -0,0 +1,37 @@
+.q-pp {
+ position: fixed;
+ width: 100%;
+ box-sizing: border-box;
+ left: 0;
+ right: 0;
+ bottom: 0;
+ background: #f7f7f7;
+ transform: translate3d(0, 100%, 0);
+ transform-origin: center;
+ transition: all 0.2s ease-in-out;
+ z-index: 900;
+ visibility: hidden;
+}
+
+.q-pp-show {
+ transform: translate3d(0, 0, 0);
+ visibility: visible;
+}
+
+.q-pp-mask {
+ position: fixed;
+ top: 0;
+ left: 0;
+ right: 0;
+ bottom: 0;
+ background: rgba(0, 0, 0, 0.7);
+ z-index: 900;
+ transition: all 0.2s ease-in-out;
+ opacity: 0;
+ visibility: hidden;
+}
+
+.q-pp-mask-show {
+ opacity: 1;
+ visibility: visible;
+}
diff --git a/env/env.js b/env/env.js
index c87839d..7a36baf 100644
--- a/env/env.js
+++ b/env/env.js
@@ -1,11 +1,11 @@
module.exports = {
DEV: {
- URL_PREFIX: 'http://192.168.31.228/api',
+ URL_PREFIX: 'http://192.168.31.228:8080',
},
PRE: {
- URL_PREFIX: 'http://192.168.31.228:8080/api',
+ URL_PREFIX: 'http://192.168.31.228:8080',
},
PROD: {
- URL_PREFIX: 'http://192.168.31.228:8080/api',
+ URL_PREFIX: 'http://192.168.31.228:8080',
}
}
\ No newline at end of file
diff --git a/pages/index/index.js b/pages/index/index.js
index ca60a8d..a252af3 100644
--- a/pages/index/index.js
+++ b/pages/index/index.js
@@ -7,6 +7,19 @@ Page({
wrokScrollHeight:0,
userInfoObj:{}, //用户信息,
item:"",
+ address: '', //详细收货地址(四级)
+ value: [0, 0, 0], // 地址选择器省市区 暂存 currentIndex
+ region: '', //所在地区
+ deptId: '',
+ regionValue: [0, 0, 0], // 地址选择器省市区 最终 currentIndex
+ provinces: [], // 一级地址
+ citys: [], // 二级地址
+ areas: [], // 三级地址
+ visible: false,
+ isCanConfirm: true, //是否禁止在第一列滚动期间点击确定提交数据
+ bookId:"",
+ bookName:"",
+ bookList:[],
active:1,
// 待办列表
todoList:[],
@@ -51,6 +64,21 @@ Page({
this.getTransferList1();
//查询已制单
this.getTransferList2();
+ //查询dept
+ this.getTreeDept();
+ },
+ reset:function(){
+ this.setData({
+ active:1,
+ todoList:[],
+ doneList:[],
+ yfqList:[],
+ yzdList:[],
+ todoNum:0,
+ doneNum:0,
+ yfqNum:0,
+ yzdNum:0
+ })
},
switchTab:function(e){
this.setData({
@@ -65,6 +93,7 @@ Page({
}
}
},
+
getTaskList:function(e){
let data = {
pageNum:1,
@@ -90,7 +119,6 @@ Page({
console.log(res);
},
complete: (res) => {
- console.log(res);
}
})
},
@@ -119,7 +147,6 @@ Page({
console.log(res);
},
complete: (res) => {
- console.log(res);
}
})
},
@@ -133,17 +160,16 @@ Page({
}
UTIL.httpRequest(API.URL_GET_TRANSFERLIST,data, {
success: (res) => {
+ console.log(res);
if (res.code == API.SUCCESS_CODE) {
- console.log(res);
let a = this.data.yfqNum+res.total
this.setData({yfqNum:a})
- this.setData({yfqList:res.rows})
+ let b = this.data.yfqList
+ this.setData({yfqList:res.rows.concat(b)})
}
}, fail: (res) => {
- console.log(res);
},
complete: (res) => {
- console.log(res);
}
})
},
@@ -157,17 +183,16 @@ Page({
}
UTIL.httpRequest(API.URL_GET_TRANSFERLIST,data, {
success: (res) => {
+ console.log(res);
if (res.code == API.SUCCESS_CODE) {
- console.log();
let a = this.data.yfqNum+res.total
this.setData({yfqNum:a})
- this.setData({yfqList:res.rows})
+ let b = this.data.yfqList
+ this.setData({yfqList:res.rows.concat(b)})
}
}, fail: (res) => {
- console.log(res);
},
complete: (res) => {
- console.log(res);
}
})
},
@@ -187,10 +212,8 @@ Page({
this.setData({yzdList:res.rows})
}
}, fail: (res) => {
- console.log(res);
},
complete: (res) => {
- console.log(res);
}
})
},
@@ -201,20 +224,20 @@ Page({
})
},
//跳转支出申请
-swichPayment:function(e){
- console.log(e.currentTarget.dataset.current);
- // let cur = e.currentTarget.dataset.current;
- // if (this.data.currentTaB == cur) {
- // return false;
- // }else{
- // wx.navigateTo({
- // url: '../inCome/index?id=' + id,
- // })
- // }
- wx.navigateTo({
- url: '/pages/apply/index?',
- })
- },
+ swichPayment:function(e){
+ console.log(e.currentTarget.dataset.current);
+ // let cur = e.currentTarget.dataset.current;
+ // if (this.data.currentTaB == cur) {
+ // return false;
+ // }else{
+ // wx.navigateTo({
+ // url: '../inCome/index?id=' + id,
+ // })
+ // }
+ wx.navigateTo({
+ url: '/pages/apply/index?',
+ })
+ },
toList:function(){
wx.navigateTo({
url: '/pages/handle/liist?active='+this.data.active,
@@ -253,9 +276,186 @@ swichPayment:function(e){
success: (res) => {
if (res.code == API.SUCCESS_CODE) {
this.setData({userInfoObj:res.user})
+ this.setData({region:res.user.deptName})
this.setData({item:JSON.stringify(res.user)})
+ this.getBookList()
}
}
})
+ },
+ /* 获取区镇村*/
+ getTreeDept:function(){
+ UTIL.httpRequest(API.URL_GET_TREESELECTBYUSER, {method:'GET'}, {
+ success: (res) => {
+ if (res.code == API.SUCCESS_CODE) {
+ this.setData({provinces:res.data})
+ this.setData({citys:res.data[0].children})
+ this.setData({areas:res.data[0].children[this.data.value[1]].children})
+ }
+ }
+ })
+ },
+ /* 获取区镇村*/
+ getBookList:function(){
+ let d = {
+ loginDeptID : this.data.userInfoObj.loginDeptId
+ }
+ UTIL.httpRequest(API.URL_GET_BOOKLISTBYDEPTID,d, {
+ success: (res) => {
+ if (res.code == API.SUCCESS_CODE) {
+ this.setData({bookList:res.rows})
+ if(this.data.bookName==""&&res.total>0){
+ this.setData({bookName:res.rows[0].bookName})
+ this.setData({bookId:res.rows[0].id})
+ }else if(this.data.bookName==""&&res.total==0){
+ this.setData({bookName:"无可用账套"})
+ }
+ }
+ },fail:(res) => {
+
+ },complete:(res) => {
+
+ }
+ })
+ },
+ bindPickerChange:function(e){
+ this.setData({
+ bookId: this.data.bookList[e.detail.value].id,
+ bookName:this.data.bookList[e.detail.value].bookName
+ })
+ let data={
+ loginBookId:this.data.bookList[e.detail.value].id
+ }
+ let _this = this
+ UTIL.httpRequest(API.URL_GET_CHANGEBOOK,data, {
+ success: (res) => {
+ _this.reset()
+ _this.onLoad()
+ }
+ })
+ },
+ closePopUp() {
+ this.setData({
+ visible: false
+ })
+ },
+ pickAddress() {
+ this.setData({
+ visible: true,
+ value: [...this.data.regionValue]
+ })
+ },
+ // 处理省市县联动逻辑 并保存 value
+ cityChange(e) {
+ var value = e.detail.value
+ let {
+ provinces,
+ citys
+ } = this.data
+ var provinceNum = value[0]
+ var cityNum = value[1]
+ var areaNum = value[2]
+
+ if (this.data.value[0] !== provinceNum) {
+ var id = provinces[provinceNum].id
+ this.setData({
+ value: [provinceNum, 0, 0],
+ citys: this.data.provinces[provinceNum].children,
+ areas: this.data.provinces[provinceNum].children[cityNum].children
+ })
+ } else if (this.data.value[1] !== cityNum) {
+ var id = citys[cityNum].id
+ this.setData({
+ value: [provinceNum, cityNum, 0],
+ areas: this.data.provinces[provinceNum].children[cityNum].children
+ })
+ } else {
+ this.setData({
+ value: [provinceNum, cityNum, areaNum]
+ })
+ }
+ console.log(this.data.value);
+ },
+ preventTouchmove() {},
+ // 城市选择器
+ // 点击地区选择取消按钮
+ cityCancel(e) {
+ var id = this.data.provinces[0].id
+ this.setData({
+ citys: this.data.lastCitys || this.data.userInfoObj.parentDeptName, //默认北京市辖区,
+ areas: this.data.lastAreas || this.data.userInfoObj.deptName,
+ value: [...this.data.regionValue],
+ visible: false
+ })
+ },
+ // 提交时由序号获取省市区id
+ getRegionId(type) {
+ let value = this.data.regionValue
+ let provinceId = this.data.provinces[value[0]].id
+ let townId = this.data.provinces[value[0]].children[value[1]].children[value[2]].id
+ let areaId = ''
+ if (this.data.provinces[value[0]].children[value[1]].children[value[2]].id) {
+ areaId = this.data.provinces[value[0]].children[value[1]].children[value[2]].id
+ } else {
+ areaId = 0
+ }
+
+ if (type === 'provinceId') {
+ return provinceId
+ } else if (type === 'townId') {
+ return townId
+ } else {
+ return areaId
+ }
+ },
+ chooseStart(e) {
+ this.setData({
+ isCanConfirm: false
+ })
+ },
+ chooseEnd(e) {
+ this.setData({
+ isCanConfirm: true
+ })
+ },
+ // 点击地区选择确定按钮
+ citySure(e) {
+ if (this.data.isCanConfirm) {
+ var value = this.data.value
+ this.setData({
+ visible: false
+ })
+ // 将选择的城市信息显示到输入框
+ try {
+ var region = (this.data.provinces[value[0]].label || '') + (this.data.citys[value[1]].label || '')
+ if (this.data.areas.length > 0) {
+ region = this.data.areas[value[2]].label || ''
+ } else {
+ this.data.value[2] = 0
+ }
+ } catch (error) {
+ console.log('adress select something error')
+ }
+ this.setData({
+ region: region,
+ lastCitys: this.data.citys,
+ lastAreas: this.data.areas,
+ regionValue: value,
+ deptId:this.getRegionId('areas')
+ }, () => {
+ let data={
+ loginDeptID : this.getRegionId('areas')
+ }
+ let _this = this
+ UTIL.httpRequest(API.URL_GET_CHANGEDEPT,data, {
+ success: (res) => {
+ setTimeout(()=>{
+ _this.reset()
+ _this.onLoad()
+ },1000)
+ }
+ })
+ })
+ }
}
})
\ No newline at end of file
diff --git a/pages/index/index.json b/pages/index/index.json
index 3ced4d8..072cd74 100644
--- a/pages/index/index.json
+++ b/pages/index/index.json
@@ -1,6 +1,7 @@
{
"usingComponents": {
- "icon-loading":"/component/iconLoading/iconLoading"
+ "icon-loading":"/component/iconLoading/iconLoading",
+ "pop-up": "/component/pop-up/index"
},
"navigationStyle": "custom"
}
\ No newline at end of file
diff --git a/pages/index/index.wxml b/pages/index/index.wxml
index 67a8c2a..8c78354 100644
--- a/pages/index/index.wxml
+++ b/pages/index/index.wxml
@@ -16,12 +16,20 @@
- 未完成
- {{todoNum}}件
+
+
+ {{ region || "请选择" }}
+
- 已完成
- {{doneNum}}件
+
+
+
+
+ {{array[index]|| bookName}}
+
+
+
@@ -31,6 +39,7 @@
+
@@ -160,4 +169,25 @@
+
+
+
+
+ 取消
+ 确定
+
+
+
+ {{item.label}}
+
+
+ {{item.label}}
+
+
+ {{item.label}}
+
+
+
+
+
\ No newline at end of file
diff --git a/pages/index/index.wxss b/pages/index/index.wxss
index 937187f..2eb0fd7 100644
--- a/pages/index/index.wxss
+++ b/pages/index/index.wxss
@@ -302,4 +302,80 @@
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
+ }
+ .btn{
+ width: 100%;
+ height:90rpx;
+ padding:0 24rpx;
+ box-sizing:border-box;
+ line-height: 90rpx;
+ text-align: center;
+ display: flex;
+ background:rgba(255,255,255,.8);
+ justify-content: space-between;
+ }
+ .address-item {
+ min-height: 98rpx;
+ display: flex;
+ justify-content: flex-start;
+ align-items: center;
+ border-bottom: 1px solid #f1f1f1;
+ padding: 0 32rpx
+ }
+
+ .item-title {
+ width: 140rpx;
+ color: #4d4c4c;
+ font-size: 28rpx;
+ height: 98rpx;
+ line-height: 98rpx;
+ }
+ .item-content {
+ width: 520rpx;
+ white-space: nowrap;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ font-size: 28rpx;
+ height: 98rpx;
+ line-height: 98rpx;
+ color: #4d4c4c;
+ }
+ /* 地区级联选择器 */
+
+ .picker-view {
+ width: 100%;
+ display: flex;
+ background-color: #fff;
+ flex-direction: column;
+ justify-content: center;
+ align-items: center;
+ bottom: 0rpx;
+ left: 0rpx;
+ }
+
+ .picker-item {
+ line-height: 70rpx;
+ margin-left: 5rpx;
+ margin-right: 5rpx;
+ text-align: center;
+ }
+
+ .picker-view__pane {
+ height: 100rpx;
+ width: 100%;
+ padding: 20rpx 32rpx;
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ box-sizing: border-box;
+ }
+
+ .picker-view__pane text{
+ color: #00cc88;
+ font-size: 30rpx;
+ }
+
+ .pick-view__group {
+ width: 96%;
+ height: 450rpx;
}
\ No newline at end of file
diff --git a/utils/API.js b/utils/API.js
index 089872d..b078450 100644
--- a/utils/API.js
+++ b/utils/API.js
@@ -49,7 +49,14 @@ const URL_POST_USEREDIT = `${URL_PREFIX}/system/user/edit`;
const URL_GET_ACCOUNTLIST = `${URL_PREFIX}/cashier/account/list`;
//查看事项审批模板列表
const URL_GET_APPROVALITEMSLIST = `${URL_PREFIX}/yinnong/approvalItems/list`;
-
+//获取区、镇、村地区
+const URL_GET_TREESELECTBYUSER = `${URL_PREFIX}/system/dept/treeselectByUser`;
+//获取账套列表
+const URL_GET_BOOKLISTBYDEPTID = `${URL_PREFIX}/finance/book/listByDeptId`;
+//切换部门
+const URL_GET_CHANGEDEPT = `${URL_PREFIX}/system/user/changeDept`;
+//切换账套
+const URL_GET_CHANGEBOOK = `${URL_PREFIX}/system/user/changeBook`;
/****************接口地址end****************/
export {
@@ -74,5 +81,9 @@ export {
URL_POST_UPLOADFILE,
URL_POST_USEREDIT,
URL_GET_ACCOUNTLIST,
- URL_GET_APPROVALITEMSLIST
+ URL_GET_APPROVALITEMSLIST,
+ URL_GET_TREESELECTBYUSER,
+ URL_GET_BOOKLISTBYDEPTID,
+ URL_GET_CHANGEBOOK,
+ URL_GET_CHANGEDEPT
}
\ No newline at end of file