diff --git a/common/js/request.js b/common/js/request.js
index 955de79..3ba8888 100644
--- a/common/js/request.js
+++ b/common/js/request.js
@@ -65,56 +65,80 @@ export default {
})
},
async login() {
- // 从缓存中获取登录信息
- let userInfo = uni.getStorageSync('userProfile');
- if (userInfo) {
- return true;
- }
-
- // TODO:调用小程序服务端确认是否是授权登录过的用户
- let loginRes = {
- logined: false,
- userInfo: {}
- };
- // 未登录过的获取微信用户信息
- if (!loginRes.logined) {
- userInfo = await wx.getUserProfile({
- desc: '用于小程序登录'
- });
- // 获取微信登录凭证
- const wxLoginRes = await wx.login();
- console.log(wxLoginRes)
- // 再次请求小程序服务端存储用户,服务端添加附加用户信息后返回
- loginRes = {
- logined: true,
- userInfo: {
- ...userInfo,
- userId: 1,
- wxLoginCode: wxLoginRes.code
- }
- };
-
- const wxAuthRes = await uni.request({
- url: '/wx/auth',
- header: {
- code: wxLoginRes.code
- }
- })
- console.log(wxAuthRes)
- loginRes.userInfo.openId = wxAuthRes[1].data.data.openid;
- }
- userInfo = loginRes.userInfo;
-
- if (!userInfo) {
- uni.showToast({
- icon: 'error',
- title: '微信用户信息获取失败,请退出小程序重试'
- })
- return false;
- }
- // 页面存储用户登录有效信息,以便其他页面调用
- uni.setStorageSync('userProfile', userInfo);
+ // 从缓存中获取登录信息
+ let userInfo = uni.getStorageSync('userProfile');
+ if (userInfo) {
+ return true;
+ }
+
+ userInfo = await wx.getUserProfile({
+ desc: '用于小程序登录'
+ });
+ console.log("从微信获取基本用户信息:" + userInfo);
+ // 获取微信登录凭证
+ const wxLoginRes = await wx.login();
+ console.log(wxLoginRes)
+ // 获取openid
+ const wxAuthRes = await uni.request({
+ url: '/wx/auth',
+ header: {
+ code: wxLoginRes.code
+ }
+ })
+ console.log(wxAuthRes)
+ const openId = wxAuthRes[1].data.data.openid;
+ // 第一次从服务端获取用户信息
+ let wxGetUserRes = await this.qryUserInfo(openId);
+ // 获取失败则获取微信信息再调用注册接口
+ if (!wxGetUserRes.data) {
+ // 注册完成后再次从服务端获取用户信息
+ let registerRes = await this.registerUser({
+ openId: openId,
+ name: userInfo.userInfo.nickName,
+ customerLogoUrl: userInfo.userInfo.avatarUrl,
+ status: 0
+ });
+ if (registerRes.code === 0) {
+ wxGetUserRes = await this.qryUserInfo(openId);
+ }
+ }
+ if (!wxGetUserRes.data) {
+ userInfo = null;
+ } else {
+ userInfo = {
+ ...wxGetUserRes.data,
+ wxLoginCode: wxLoginRes.code
+ }
+ }
+ console.log("通过后台服务获取用户信息:" + userInfo);
+ if (!userInfo || userInfo.customerId == null || userInfo.customerId == undefined) {
+ uni.showToast({
+ icon: 'error',
+ title: '微信用户信息获取失败,请退出小程序重试'
+ })
+ return false;
+ }
+ // 页面存储用户登录有效信息,以便其他页面调用
+ uni.setStorageSync('userProfile', userInfo);
return true;
+ },
+ async registerUser(params = {}) {
+ let res = await uni.request({
+ url: '/wx/addUser',
+ method: 'POST',
+ data: params
+ })
+ return res[1].data;
+ },
+ async qryUserInfo(openId) {
+ let res = await uni.request({
+ url: '/wx/getUserInfo',
+ method: 'POST',
+ data: {
+ openId: openId
+ }
+ })
+ return res[1].data;
},
getCurUserInfo() {
let userProfile = uni.getStorageSync('userProfile');
diff --git a/components/uni-combox/my-uni-combox.vue b/components/uni-combox/my-uni-combox.vue
index 7c4afe8..269bf45 100644
--- a/components/uni-combox/my-uni-combox.vue
+++ b/components/uni-combox/my-uni-combox.vue
@@ -4,7 +4,7 @@
{{label}}
-
diff --git a/pages.json b/pages.json
index fc04042..48a96a3 100644
--- a/pages.json
+++ b/pages.json
@@ -1,43 +1,44 @@
{
"pages": [{
- // "path": "pages/index/index"
- "path": "pages/my/master-occupancy"
- }],
- "subPackages": [{
- "root": "pages/area-proxy/",
- "pages": [{
- "path": "my-team"
- }]
+ "path": "pages/index/index"
+ }],
+ "subPackages": [{
+ "root": "pages/area-proxy/",
+ "pages": [{
+ "path": "my-team"
+ }]
+ }, {
+ "root": "pages/demand-center/",
+ "pages": [{
+ "path": "rule"
+ }, {
+ "path": "accept-demand-center"
+ }, {
+ "path": "demand-detail"
+ }]
+ }, {
+ "root": "pages/order-manage/",
+ "pages": [{
+ "path": "order-manage"
+ }, {
+ "path": "serv-detail"
+ }, {
+ "path": "finish-order"
+ }]
}, {
- "root": "pages/demand-center/",
+ "root": "pages/my/",
"pages": [{
- "path": "rule"
+ "path": "new-serv"
}, {
- "path": "accept-demand-center"
+ "path": "goods-manage"
}, {
- "path": "demand-detail"
+ "path": "master-occupancy"
+ }, {
+ "path": "withdraw"
+ }, {
+ "path": "bank-account-bind"
}]
- }, {
- "root": "pages/order-manage/",
- "pages": [{
- "path": "order-manage"
- }, {
- "path":"serv-detail"
- }, {
- "path": "finish-order"
- }]
- }
- // {
- // "root": "pages/my/",
- // "pages": [{
- // "path": "new-serv"
- // }, {
- // "path": "goods-manage"
- // }, {
- // "path": "master-occupancy"
- // }]
- // }
- ],
+ }],
"globalStyle": {
"navigationStyle": "custom",
"navigationBarTextStyle": "black"
diff --git a/pages/index/index-home.vue b/pages/index/index-home.vue
index d5f2e7b..3874137 100644
--- a/pages/index/index-home.vue
+++ b/pages/index/index-home.vue
@@ -1,13 +1,13 @@
-
+
+ :style="'width: 120rpx; height: 120rpx; background-image:url(' + curUserInfo.customerLogoUrl + ');'">
- {{curUserInfo.userInfo.nickName}}
+ {{curUserInfo.name}}
@@ -167,7 +167,7 @@
},
methods: {
async loadData() {
- this.curUserInfo = uni.getStorageSync('userProfile');
+ this.curUserInfo = this.$request.getCurUserInfo();
console.log(this.curUserInfo)
this.isAuthWxLoginModal = this.curUserInfo ? false : true;
if (!this.isAuthWxLoginModal) {
diff --git a/pages/index/my-home.vue b/pages/index/my-home.vue
index d2ef435..65ddd44 100644
--- a/pages/index/my-home.vue
+++ b/pages/index/my-home.vue
@@ -1,11 +1,11 @@
-
+ :style="'width: 150rpx; height: 150rpx; background-image:url(' + curUserInfo.customerLogoUrl + ');'">
- {{curUserInfo.userInfo.nickName}}
+ {{curUserInfo.name}}
{{myInfo.balance}}
@@ -65,7 +65,8 @@
myInfo: {},
menuList: [{
name: '提现',
- icon: 'moneybag'
+ icon: 'moneybag',
+ pageUrl: '/pages/my/withdraw'
}, {
name: '交易明细',
icon: 'form'
@@ -74,7 +75,8 @@
icon: 'calendar'
}, {
name: '师傅入驻',
- icon: 'profile'
+ icon: 'profile',
+ pageUrl: '/pages/my/master-occupancy'
}, {
name: '商品管理',
icon: 'goods',
diff --git a/pages/my/bank-account-bind.vue b/pages/my/bank-account-bind.vue
new file mode 100644
index 0000000..4a3e070
--- /dev/null
+++ b/pages/my/bank-account-bind.vue
@@ -0,0 +1,106 @@
+
+
+
+
+ 返回
+ 帐号绑定/修改
+
+
+
+ 支付宝
+ 银行卡
+
+
+
+
+ 开户人姓名
+
+
+
+ 支付宝账户
+
+
+
+
+
+
+ 开户人姓名
+
+
+
+ 银行名称
+
+
+
+ 银行卡号
+
+
+
+ 银行卡号开户城市
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/pages/my/master-occupancy.vue b/pages/my/master-occupancy.vue
index 0db228a..1531b33 100644
--- a/pages/my/master-occupancy.vue
+++ b/pages/my/master-occupancy.vue
@@ -13,6 +13,7 @@
+
@@ -39,7 +40,9 @@
-
+
{{item0.areaName}}
@@ -55,14 +58,137 @@
-
+
+
-
+
+
+
+
+
+ 服务技能{{index + 1}}(将按服务技能派单)
+
+
+ 删除
+
+
+
+
+
+
+
+
+
+
+
+ {{item0.goodsCategoryName}}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+ 特殊技能{{index + 1}}(特殊工种如空调安装等请上传)
+
+
+ 删除
+
+
+
+
+ 特殊技能:
+
+
+
+
+
+
+ 技能证书:
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 保险证明:
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 保险日期:
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -90,34 +216,46 @@
cityObj: {},
districtObj: {},
streetIds: []
- }]
+ }],
+ typeList: [],
+ servSkill: [{
+ subTypeList: [],
+ subSubTypeList: [],
+ typeObj: {},
+ subTypeObj: {},
+ subSubTypeIds: [],
+ otherServSkill: null
+ }],
+ specialTypeList: [],
+ specialSkill: [{
+ specialSubTypeList: [],
+ specialSubSubTypeList: [],
+ specialTypeObj: {},
+ specialSubTypeObj: {},
+ specialSubSubTypeObj: {},
+ skillCert: [],
+ insurCert: [],
+ insurStartDate: '',
+ insurEndDate: ''
+ }],
}
},
methods: {
loadData() {
this.loadProvinceList();
+ this.loadTypeList();
+ this.loadSpecialSkill();
},
+ /* 服务区域 start */
async loadProvinceList() {
let res = await this.$request.areaListByStep();
this.provinceList = res.data;
},
async chooseRegion(e, type, index) {
- let that = this;
let res = await this.$request.areaListByStep({
parentCode: e.areaCode
});
if (res.code == 0) {
- // if (index > this.servArea.length - 1) {
- // this.servArea.push({
- // cityList: [],
- // districtList: [],
- // streetList: [],
- // provinceObj: e,
- // cityObj: {},
- // districtObj: {},
- // streetIds: []
- // });
- // }
switch (type) {
case 0: {
this.servArea[index].cityList = res.data;
@@ -145,45 +283,186 @@
}
}
},
- checkStreet(e, index) {
- // let that = this;
+ checkStreet(e, index) {
let checkedIndexArr = e.detail.value;
- // let streetIds = [];
- // checkedIndexArr.forEach((checkedIndex) => {
- // console.log("areaCode:" + that.servArea[index].streetList[checkedIndex].areaCode);
- // streetIds.push(that.servArea[index].streetList[checkedIndex].areaCode)
- // });
- console.log(checkedIndexArr)
- this.servArea[index].streetIds = checkedIndexArr;
- console.log(this.servArea[index].streetIds)
+ this.servArea[index].streetIds = checkedIndexArr;
},
addServArea() {
- this.servArea.push({
- cityList: [],
- districtList: [],
- streetList: [],
- provinceObj: {},
- cityObj: {},
- districtObj: {},
- streetIds: []
+ this.servArea.push({
+ cityList: [],
+ districtList: [],
+ streetList: [],
+ provinceObj: {},
+ cityObj: {},
+ districtObj: {},
+ streetIds: []
});
},
delServArea(index) {
- this.servArea.splice(index, 1);
- console.log(this.servArea)
+ this.servArea.splice(index, 1);
},
+ /* 服务区域 end */
+ /* 服务技能 start */
+ async loadTypeList() {
+ let res = await this.$request.listByStep();
+ this.typeList = res.data;
+ },
+ async chooseType(e, type, index) {
+ let res = await this.$request.listByStep({
+ goodsCategoryId: e.goodsCategoryId
+ });
+ if (res.code == 0) {
+ switch (type) {
+ case 0: {
+ this.servSkill[index].subTypeList = res.data;
+ this.servSkill[index].subSubTypeList = [];
+ this.servSkill[index].subTypeObj = {};
+ this.servSkill[index].subSubTypeIds = [];
+ }
+ break;
+ case 1: {
+ this.servSkill[index].subSubTypeList = res.data;
+ this.servSkill[index].subSubTypeIds = [];
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ },
+ checkGoodType(e, index) {
+ let checkedIndexArr = e.detail.value;
+ this.servSkill[index].subSubTypeIds = checkedIndexArr;
+ },
+ addServSkill() {
+ this.servSkill.push({
+ subTypeList: [],
+ subSubTypeList: [],
+ typeObj: {},
+ subTypeObj: {},
+ subSubTypeIds: [],
+ otherServSkill: null
+ });
+ },
+ delServSkill(index) {
+ this.servSkill.splice(index, 1);
+ },
+ /* 服务技能 end */
+ /* 特殊技能 start */
+ async loadSpecialSkill() {
+ let res = await this.$request.listByStep();
+ this.specialTypeList = res.data;
+ },
+ async chooseSpecialSkill(e, type, index) {
+ let res = await this.$request.listByStep({
+ goodsCategoryId: e.goodsCategoryId
+ });
+ if (res.code == 0) {
+ switch (type) {
+ case 0: {
+ this.specialSkill[index].specialSubTypeList = res.data;
+ this.specialSkill[index].specialSubSubTypeList = [];
+ this.specialSkill[index].specialSubTypeObj = {};
+ this.specialSkill[index].specialSubSubTypeObj = {};
+ }
+ break;
+ case 1: {
+ this.specialSkill[index].specialSubSubTypeList = res.data;
+ this.specialSkill[index].specialSubSubTypeObj = {};
+ }
+ break;
+ default:
+ break;
+ }
+ }
+ },
+ addSpecialSkill() {
+ this.specialSkill.push({
+ specialSubTypeList: [],
+ specialSubSubTypeList: [],
+ specialTypeObj: {},
+ specialSubTypeObj: {},
+ specialSubSubTypeObj: {},
+ skillCert: [],
+ insurCert: [],
+ insurStartDate: '',
+ insurEndDate: ''
+ });
+ },
+ delSpecialSkill(index) {
+ this.specialSkill.splice(index, 1);
+ },
+ changeInsurDate(e, index) {
+ this.specialSkill[index].insurStartDate = e[0];
+ this.specialSkill[index].insurEndDate = e[1];
+ },
+ async chooseImage(e, imgList) {
+ uni.chooseImage({
+ count: 2, //默认9
+ sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
+ sourceType: ['album'], //从相册选择
+ success: (res) => {
+ // 上传图片
+ this.$request.uploadFile(res.tempFilePaths[0]).then((uploadRes) => {
+ // 成功后才存入缓存
+ if (uploadRes.code === 0) {
+ imgList.push(uploadRes.url);
+ }
+ });
+ }
+ });
+ },
+ viewImage(e, imgList) {
+ uni.previewImage({
+ urls: imgList,
+ current: e.currentTarget.dataset.url
+ });
+ },
+ delImg(e, imgList) {
+ uni.showModal({
+ title: '',
+ content: '确定要删除这张图片吗?',
+ cancelText: '取消',
+ confirmText: '确定',
+ success: res => {
+ if (res.confirm) {
+ imgList.splice(e.currentTarget.dataset.index, 1)
+ }
+ }
+ })
+ },
+ /* 特殊技能 end */
nextStep() {
- this.curStep = this.curStep === this.stepList.length - 1 ? this.curStep : ++this.curStep
+ this.curStep = this.curStep === this.stepList.length - 1 ? this.curStep : ++this.curStep;
+ console.log(this.servSkill)
},
preStep() {
- this.curStep = this.curStep === 0 ? 0 : --this.curStep
- },
+ this.curStep = this.curStep === 0 ? 0 : --this.curStep;
+ console.log(this.servSkill)
+ },
+ submit() {
+ console.log(this.specialSkill)
+ }
},
}
-
diff --git a/pages/my/my-money-bag.vue b/pages/my/my-money-bag.vue
new file mode 100644
index 0000000..360d8c7
--- /dev/null
+++ b/pages/my/my-money-bag.vue
@@ -0,0 +1,16 @@
+
+
+
+
+ 返回
+ 我的钱包
+
+
+
+
+
+
+
+
diff --git a/pages/my/withdraw.vue b/pages/my/withdraw.vue
new file mode 100644
index 0000000..0eb2568
--- /dev/null
+++ b/pages/my/withdraw.vue
@@ -0,0 +1,102 @@
+
+
+
+
+ 返回
+ 提现
+
+
+
+ 提现帐号绑定
+
+
+
+
+ 可提现金额:
+ {{balance}}
+
+ 提现金额
+
+ ¥
+
+
+
+
+ 发票凭证(电子票)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+