Browse Source

Merge branch '团队管理'

xiaohaizhao 1 year ago
parent
commit
fa81a7277a

+ 2 - 0
pages.json

@@ -108,6 +108,8 @@
 			}
 		}, {
 			"path": "userCenter/personal"
+		}, {
+			"path": "userCenter/wechatbind"
 		}]
 	}],
 	"preloadRule": {

+ 57 - 4
pages/index/index.vue

@@ -9,7 +9,7 @@
 		<dataBank ref="资料库" v-show="page == '资料库'" />
 		<school ref="商学院" v-show="page == '商学院'" />
 		<product ref="单品" v-show="page == '单品'" />
-		
+
 		<bottom-suspension-frame ref="pages" @onChange="pageChange" />
 	</view>
 </template>
@@ -34,6 +34,62 @@ export default {
 			page: '首页'
 		}
 	},
+	onLoad(options) {
+		let user = {
+			wechatBindUserid: 0,
+			userName: ""
+		},
+			that = this;
+		if (options.wechatBindUserid) {
+			user.wechatBindUserid = options.wechatBindUserid;
+			user.userName = options.userName;
+		}
+		if (options.q) {
+			let params = this.getUrlParams(options.q);
+			user.wechatBindUserid = params.wechatBindUserid;
+			user.userName = params.userName;
+		}
+		if (user.wechatBindUserid) {
+			console.log("被邀请绑定账号", user);
+			uni.showModal({
+				title: '提醒',
+				content: `"${user.userName}"是否与当前微信号绑定`,
+				confirmText: '确定绑定',
+				success: function ({ confirm }) {
+					if (confirm) uni.login({
+						success(res) {
+							that.$Http.basic({
+								"id": 20240516090402,
+								"content": {
+									"wechat_code": res.code,
+									"isbinging": 1,
+									"wechatuserinfo": "",
+									"userid": user.wechatBindUserid
+								}
+							}).then(res => {
+								console.log("绑定账号", res)
+								uni.showModal({
+									title: '提示',
+									content: res.msg == '成功' ? '绑定成功' : res.msg,
+									showCancel: false,
+									success: function ({ confirm }) {
+										if (confirm) {
+											if (res.msg == '成功') that.$Login.wechatLogin().then(s => {
+												uni.reLaunch({
+													url: '/pages/index/index'
+												})
+											})
+										}
+									}
+								});
+								if (that.cutoff(res.msg, '绑定成功')) return;
+							})
+						}
+					})
+				}
+			});
+		}
+	},
 	onShow() {
 		const systemInitIsComplete = this.$Http.systemInitIsComplete;
 		if (!systemInitIsComplete || typeof systemInitIsComplete == 'object') {
@@ -53,9 +109,6 @@ export default {
 	methods: {
 		updatePageData(itemId, page) {
 			if (this.$refs[this.page].updatePage) this.$refs.pages.onClick(itemId, page)
-		},
-		changePage(itemId, page, params) {
-
 		},
 		pageChange(detail) {
 			uni.setNavigationBarTitle({

+ 3 - 2
team/team/getInvite.vue

@@ -52,8 +52,6 @@ export default {
         }
     },
     onLoad(options) {
-        console.log("被邀请加入团队", options)
-        this.sys_enterpriseid = options.id;
         const systemInitIsComplete = this.$Http.systemInitIsComplete;
         if (!systemInitIsComplete || typeof systemInitIsComplete == 'object') {
             this.$Http.HomePageStartRendering = render(this)
@@ -66,6 +64,9 @@ export default {
                     clearInterval(count)
                     let user = uni.getStorageSync('userMsg');
                     that.userid = user.userid;
+                    if (options.id) that.sys_enterpriseid = options.id;
+                    if (options.q) that.sys_enterpriseid = this.getUrlParams(options.q).id;
+                    console.log("that.sys_enterpriseid", that.sys_enterpriseid)
                     if (user.usertype == 99) {
                         that.init();
                     } else {

+ 5 - 0
team/team/index.vue

@@ -24,6 +24,11 @@ export default {
             }]
         }
     },
+    onLoad() {
+        uni.setNavigationBarTitle({
+            title: '团队管理'
+        });
+    },
     methods: {
         changeCurrent({ index, name }) {
             this.current = index;

+ 9 - 2
team/team/modules/users.vue

@@ -13,8 +13,7 @@
         </view>
 
         <My_listbox ref="List" @getlist="getList" bottomHeight="70">
-
-
+            <user-list :list="list" @onClick="onClick" />
         </My_listbox>
 
         <view class="footer">
@@ -29,7 +28,9 @@
 </template>
 
 <script>
+import userList from "../../userCenter/modules/userList.vue"
 export default {
+    components: { userList },
     data() {
         return {
             "content": {
@@ -38,6 +39,7 @@ export default {
                 }
             },
             total: 0,
+            list: []
         }
     },
     created() {
@@ -65,6 +67,11 @@ export default {
                 this.content = this.$refs.List.paging(this.content, res)
             })
         },
+        onClick(item) {
+            uni.navigateTo({
+                url: '/team/userCenter/personal?id=' + item.sys_enterprise_hrid
+            });
+        },
         onSearch(condition) {
             this.content.where.condition = condition;
             this.getList(true)

+ 96 - 0
team/userCenter/modules/userList.vue

@@ -0,0 +1,96 @@
+<template>
+    <view>
+        <view class="item" v-for="item in list" :key="item.userid" hover-class="navigator-hover" @click="itemClick(item)">
+            <u--image
+                :src="item.headpic || 'https://yossys06593.obs.cn-east-3.myhuaweicloud.com:443/202404231713854678447B26b4363.svg'"
+                :width="tovw(44)" :height="tovw(44)" shape="circle">
+                <template v-slot:loading>
+                    <u-loading-icon color="red"></u-loading-icon>
+                </template>
+            </u--image>
+            <view class="content">
+                <view class="title u-line-1">
+                    {{ item.name }}
+                </view>
+                <view class="row u-line-1">
+                    {{ item.rolenames }}
+                </view>
+                <view class="row">
+                    <text class="iconfont icon-dianhua-hui" />
+                    {{ item.phonenumber }}
+                </view>
+                <view class="row u-line-1">
+                    <text class="iconfont icon-morenmendian" />
+                    {{ item.storenames || '--' }}
+                </view>
+                <view class="row">
+                    状态:
+                    <text :style="{ color: item.status == '启用' ? '#009270' : '#E3041F' }">
+                        {{ item.status }}
+                    </text>
+                </view>
+            </view>
+        </view>
+    </view>
+</template>
+
+<script>
+export default {
+    props: {
+        list: {
+            type: Array,
+            default: []
+        },
+        onClick: {
+            type: Function
+        }
+    },
+    methods: {
+        itemClick(item) {
+            this.$emit("onClick", item)
+        }
+    },
+}
+</script>
+
+<style lang="scss" scoped>
+.item {
+    width: 355px;
+    background: #FFFFFF;
+    border-radius: 8px;
+    padding: 10px;
+    box-sizing: border-box;
+    background: #fff;
+    margin: 0 auto 10px;
+    display: flex;
+
+    .content {
+        margin-left: 10px;
+
+        .title {
+            line-height: 24px;
+            font-family: Source Han Sans SC, Source Han Sans SC;
+            font-weight: bold;
+            font-size: 16px;
+            color: #333333;
+
+        }
+
+        .row {
+            margin-top: 5px;
+            font-family: Source Han Sans SC, Source Han Sans SC;
+            font-size: 12px;
+            color: #888888;
+
+            .iconfont {
+                margin-right: 5px;
+            }
+        }
+    }
+
+}
+
+.item:last-child {
+    margin-bottom: 0;
+}
+</style>

+ 204 - 3
team/userCenter/personal.vue

@@ -1,13 +1,214 @@
 <template>
     <view>
-        个人信息编辑
+        <block v-if="detail.userid">
+            <view style="height: 10px;" />
+            <user :list="[detail]" />
+        </block>
+
+        <view class="head">
+            <view class="label">
+                基本信息
+            </view>
+            <view class="content">
+                仅显示已填信息<text style="padding: 0 2.5px;" /> <u-switch activeColor="#C40C24" v-model="unShowAll" />
+            </view>
+        </view>
+        <block v-for="item in showList" :key="item.key">
+            <view class="item" hover-class="navigator-hover" v-if="!unShowAll || detail[item.key] || item.value">
+                <view class="content">
+                    <view class="label">
+                        {{ item.label }}:
+                    </view>
+                    <view class="value">
+                        {{ detail[item.key] || item.value || '--' }}
+                    </view>
+                </view>
+            </view>
+        </block>
+        <view style="height: 70px;" />
+        <view class="footer">
+            <navigator class="insert" v-if="detail.iswechatbind == 0"
+                :url="'/team/userCenter/wechatbind?id=' + detail.userid + '&name=' + detail.name">
+                绑定微信
+            </navigator>
+            <navigator class="invite" style="flex: 1;" url="/team/team/InviteUser">
+                编辑
+            </navigator>
+        </view>
     </view>
 </template>
 
 <script>
+import user from "./modules/userList"
 export default {
-
+    components: { user },
+    data() {
+        return {
+            sys_enterprise_hrid: 0,
+            detail: {
+                userid: 0
+            },
+            unShowAll: false,
+            showList: []
+        }
+    },
+    onLoad(options) {
+        console.log("options", options)
+        this.sys_enterprise_hrid = options.id;
+        uni.setNavigationBarTitle({
+            title: '人员信息'
+        });
+        this.getDetail()
+    },
+    methods: {
+        getDetail() {
+            this.$Http.basic({
+                "id": "20240411085402",
+                "content": {
+                    "sys_enterprise_hrid": this.sys_enterprise_hrid
+                }
+            }).then(res => {
+                console.log("门店人员信息", res)
+                if (this.cutoff(res.msg)) return;
+                this.detail = res.data;
+                this.showList = [{
+                    label: "姓名",
+                    key: "name"
+                }, {
+                    label: "手机号",
+                    key: "phonenumber"
+                }, {
+                    label: "性别",
+                    key: "sex"
+                }, {
+                    label: "生日",
+                    key: "birthday"
+                }, {
+                    label: "邮箱",
+                    key: "email"
+                }, {
+                    label: "店内职位",
+                    key: "position"
+                }, {
+                    label: "角色",
+                    key: "rolenames"
+                }, {
+                    label: "人员类型",
+                    value: res.isleader ? '主账号' : '子账号'
+                }, {
+                    label: "所属门店",
+                    key: "storenames"
+                }]
+            })
+        }
+    },
 }
 </script>
 
-<style></style>
+<style lang="scss" scoped>
+.head {
+    display: flex;
+    align-items: center;
+    justify-content: space-between;
+    width: 100vw;
+    height: 45px;
+    background: #F7F7F7;
+    padding: 0 10px;
+    box-sizing: border-box;
+
+    .label {
+        font-family: PingFang SC, PingFang SC;
+        font-weight: bold;
+        font-size: 15px;
+        color: #333333;
+        line-height: 22px;
+    }
+
+    .content {
+        display: flex;
+        align-items: center;
+        font-family: PingFang SC, PingFang SC;
+        font-size: 14px;
+        color: #999999;
+    }
+}
+
+.item {
+    width: 100vw;
+    background: #fff;
+    padding-left: 10px;
+    box-sizing: border-box;
+
+    .content {
+        display: flex;
+        width: 100%;
+        padding: 15px 0;
+        padding-right: 10px;
+        box-sizing: border-box;
+        border-bottom: 0.5px solid #F2F2F2;
+
+        .label {
+            width: 100px;
+            margin-right: 10px;
+            line-height: 20px;
+            font-family: Source Han Sans SC, Source Han Sans SC;
+            font-size: 14px;
+            color: #666666;
+        }
+
+        .value {
+            line-height: 20px;
+            font-family: Source Han Sans SC, Source Han Sans SC;
+            font-size: 14px;
+            color: #333333;
+        }
+    }
+
+    .content:last-child {
+        border-bottom: 0;
+    }
+}
+
+.footer {
+    position: fixed;
+    bottom: 0;
+    display: flex;
+    justify-content: space-between;
+    width: 100vw;
+    height: 65px;
+    background: #FFFFFF;
+    box-shadow: 0px -2px 6px 1px rgba(0, 0, 0, 0.16);
+    padding: 5px 10px;
+    box-sizing: border-box;
+
+    .insert {
+        display: flex;
+        align-items: center;
+        justify-content: center;
+        width: 168px;
+        height: 45px;
+        background: #FFFFFF;
+        border-radius: 5px;
+        border: 1px solid #999999;
+        font-family: PingFang SC, PingFang SC;
+        font-size: 16px;
+        color: #666666;
+        box-sizing: border-box;
+        margin-right: 10px;
+    }
+
+    .invite {
+        display: flex;
+        align-items: center;
+        justify-content: center;
+        width: 177px;
+        height: 45px;
+        background: #C30D23;
+        border-radius: 5px;
+        font-family: PingFang SC, PingFang SC;
+        font-weight: 500;
+        font-size: 16px;
+        color: #FFFFFF;
+    }
+}
+</style>

+ 257 - 0
team/userCenter/wechatbind.vue

@@ -0,0 +1,257 @@
+<template>
+    <view>
+        <view class="painter-box" v-if="userMsg.userid" style="">
+            <view>
+                <l-painter ref="painter" css="position: relative;width: 280px; height: 426px">
+                    <l-painter-image
+                        src="https://yossys06593.obs.cn-east-3.myhuaweicloud.com:443/202405151715764356769B1a729abd.webp"
+                        css="width: 280px; height: 426px;position: absolute;" />
+                    <l-painter-image
+                        :src="userMsg.headpic || 'https://yossys06593.obs.cn-east-3.myhuaweicloud.com:443/202404231713854678447B26b4363.svg'"
+                        css="width: 56px; height:56px;border-radius: 50%;position: absolute;top:20px;left:20px;z-index:2;"
+                        object-fit="fill" />
+                    <l-painter-text :text="name"
+                        css="width:180px;line-height:24px;height:24px;position: absolute;left:86px;top:21px;z-index:2;font-family: Source Han Sans SC, Source Han Sans SC;font-weight: 500;font-size: 16px;color: #333333;  overflow: hidden;white-space: nowrap;text-overflow: ellipsis;" />
+                    <l-painter-text :text="userMsg.areaname"
+                        css="width:180px;line-height:20px;height:20px;position: absolute;left:86px;top:55px;z-index:2;overflow: hidden;white-space: nowrap;text-overflow: ellipsis;font-family: Source Han Sans SC, Source Han Sans SC;font-size: 14px;color: #666666;" />
+                    <l-painter-text text="扫码绑定微信"
+                        css="width:72px;line-height:17px;position: absolute;left:50%;bottom:269px;z-index:2;margin-left:-36px;font-size: 12px;color: #666666;font-family: PingFang SC, PingFang SC;" />
+                    <l-painter-qrcode :text="qrCode + 'wechatBind?wechatBindUserid=' + userid + '&userName=' + userName"
+                        css="width: 200px; height: 200px;position: absolute;left:50%;bottom:55px;z-index:2;margin-left:-100px;" />
+                </l-painter>
+            </view>
+        </view>
+        <view style="height: 70px;" />
+        <view class="footer">
+            <view class="invite" style="flex: 1;" hover-class="navigator-hover" @click="saveTheImage">
+                保存图片
+            </view>
+        </view>
+    </view>
+</template>
+
+<script>
+import lPainter from "../../uni_modules/lime-painter/components/l-painter/l-painter.vue"
+import lPainterView from "../../uni_modules/lime-painter/components/l-painter-view/l-painter-view.vue"
+import lPainterText from "../../uni_modules/lime-painter/components/l-painter-text/l-painter-text.vue"
+import lPainterImage from "../../uni_modules/lime-painter/components/l-painter-image/l-painter-image.vue"
+import lPainterQrcode from "../../uni_modules/lime-painter/components/l-painter-qrcode/l-painter-qrcode.vue"
+import contact from "../../components/contact"
+
+export default {
+    components: { lPainter, lPainterView, lPainterText, lPainterImage, lPainterQrcode, contact },
+    data() {
+        return {
+            userMsg: {
+                userid: 0
+            },
+            qrCode: this.qrCodePrefix,
+            name: "",
+            userid: 0,
+            userName: ""
+        }
+    },
+    onLoad(options) {
+        console.log(options)
+        this.userid = options.id;
+        this.userName = options.name;
+        uni.setNavigationBarTitle({
+            title: '绑定微信'
+        });
+        this.getUserMsg()
+    },
+    methods: {
+        getUserMsg() {
+            this.$Http.basic({
+                "id": 20240510104102,
+                "content": {},
+            }).then(res => {
+                console.log("获取个人信息", res)
+                if (this.cutoff(res.msg)) return;
+                this.userMsg = res.data;
+                this.name = res.data.enterprise_hr.name ? res.data.enterprise_hr.name + ',邀请您加入' : '邀请您加入'
+            })
+        },
+        saveTheImage() {
+            let that = this;
+            this.loading = true;
+            this.$refs.painter.canvasToTempFilePathSync({
+                fileType: "jpg",
+                // 如果返回的是base64是无法使用 saveImageToPhotosAlbum,需要设置 pathType为url
+                pathType: 'url',
+                quality: 1,
+                success: (res) => {
+                    // 非H5 保存到相册
+                    // H5 提示用户长按图另存
+                    uni.saveImageToPhotosAlbum({
+                        filePath: res.tempFilePath,
+                        success: function (e) {
+                            uni.showModal({
+                                title: '提示',
+                                content: '图片已保存到系统相册',
+                                showCancel: false
+                            })
+                            that.loading = false;
+                            this.$Http.basic({
+                                "id": 20240319142702,
+                                "content": {
+                                    sat_sharematerialid: that.detail.sat_sharematerialid, type: 1
+                                }
+                            }).then(res => {
+                                console.log(type, '记录', res)
+                            })
+
+                        },
+                        fail: ({ errMsg }) => {
+                            if (errMsg == 'saveImageToPhotosAlbum:fail auth deny') {
+                                uni.showModal({
+                                    title: '提示',
+                                    content: '请授权添加到相册权限后再试!',
+                                    showCancel: false,
+                                    complete: (complete) => {
+                                        uni.openSetting({
+                                            success: res => {
+                                                that.loading = false;
+                                                if (res.authSetting['scope.writePhotosAlbum']) {
+                                                    this.saveTheImage()
+                                                } else {
+                                                    uni.showModal({
+                                                        title: '提示',
+                                                        content: '未获取授权!已取消保存',
+                                                        showCancel: false,
+                                                    })
+                                                }
+                                            }
+                                        })
+                                    },
+                                })
+                            } else {
+                                that.loading = false;
+                                uni.showModal({
+                                    title: '提示',
+                                    content: '已取消保存',
+                                    showCancel: false,
+                                })
+                            }
+                        },
+                    });
+                },
+            });
+        },
+        onBack() {
+            uni.navigateBack();
+        },
+        getSheraDate() {
+            return {
+                title: this.name, // 标题
+                path: "/pages/index/index?wechatBindUserid=" + this.userid + '&userName=' + this.userName, // 分享路径
+                imageUrl: ""// 分享图
+            };
+        }
+    },
+    onShareAppMessage(res) {
+        return this.getSheraDate()
+    }
+}
+</script>
+
+<style lang="scss" scoped>
+.head {
+    position: relative;
+    width: 100vw;
+
+    .custom {
+        position: absolute;
+        width: 100vw;
+        display: flex;
+        justify-content: center;
+        align-items: center;
+        font-family: PingFang SC, PingFang SC;
+        font-weight: 500;
+        font-size: 17px;
+        color: #FFFFFF;
+
+        .back {
+            position: absolute;
+            padding: 0 10px;
+            left: 0;
+            color: #fff;
+            font-size: 12px;
+            transform: rotateY(180deg);
+        }
+    }
+}
+
+.painter-box {
+    display: flex;
+    justify-content: center;
+    margin-top: 25px;
+}
+
+.share {
+    display: flex;
+    justify-content: space-around;
+    width: 275px;
+    margin: 30px auto 0;
+
+    .item {
+        display: flex;
+        align-items: center;
+        justify-content: center;
+        width: 48px;
+        height: 48px;
+        border-radius: 50%;
+        background: rgba(255, 255, 255, 0.3);
+        overflow: hidden;
+
+        .iconfont {
+            font-size: 28px;
+            color: #fff;
+        }
+    }
+}
+
+
+.footer {
+    position: fixed;
+    bottom: 0;
+    display: flex;
+    justify-content: space-between;
+    width: 100vw;
+    height: 65px;
+    background: #FFFFFF;
+    box-shadow: 0px -2px 6px 1px rgba(0, 0, 0, 0.16);
+    padding: 5px 10px;
+    box-sizing: border-box;
+
+    .insert {
+        display: flex;
+        align-items: center;
+        justify-content: center;
+        width: 168px;
+        height: 45px;
+        background: #FFFFFF;
+        border-radius: 5px;
+        border: 1px solid #999999;
+        font-family: PingFang SC, PingFang SC;
+        font-size: 16px;
+        color: #666666;
+        box-sizing: border-box;
+        margin-right: 10px;
+    }
+
+    .invite {
+        display: flex;
+        align-items: center;
+        justify-content: center;
+        width: 177px;
+        height: 45px;
+        background: #C30D23;
+        border-radius: 5px;
+        font-family: PingFang SC, PingFang SC;
+        font-weight: 500;
+        font-size: 16px;
+        color: #FFFFFF;
+    }
+}
+</style>

+ 11 - 0
utils/tool.js

@@ -236,6 +236,17 @@ function mount() {
             enddate: Vue.prototype.formatTime(new Date(end)).split(' ')[0],
         }
     }
+    Vue.prototype.getUrlParams = urlStr => {
+        const url = decodeURIComponent(urlStr)
+        let obj = {}
+        let str = url.slice(url.indexOf('?') + 1)
+        let arr = str.split('&')
+        for (let j = arr.length, i = 0; i < j; i++) {
+            let arr_temp = arr[i].split('=')
+            obj[arr_temp[0]] = arr_temp[1]
+        }
+        return obj
+    }
 }
 
 module.exports = {