浏览代码

团队管理

xiaohaizhao 1 年之前
父节点
当前提交
1286fde577

+ 18 - 3
components/my_form.vue

@@ -1,6 +1,6 @@
 <template>
     <view>
-        <view class="head" v-if="requiredFieldOnly">
+        <view class="requiredFieldOnly-head" v-if="requiredFieldOnly">
             <view class="label">
                 基本信息
             </view>
@@ -62,7 +62,7 @@
                     :style="{ marginTop: tovw(item.marginTop || 0) }">
                     <view class="head">
                         <view class="label">
-                            <text class="must" v-if="item.isMust">*</text>
+                            <text class="must" style="color: #E3041F;" v-if="item.isMust">*</text>
                             {{ item.label }}
                         </view>
                         <view class="state">
@@ -177,6 +177,21 @@
                         </u-radio-group>
                     </view>
                 </view>
+                <!-- 单选 -->
+                <view class="region" v-else-if="item.type == 'radio'">
+                    <view class="box" :class="item.unBorBot ? '' : 'borBot'">
+                        <view class="label">
+                            <text class="must" v-if="item.isMust">*</text>
+                            {{ item.label }}:
+                        </view>
+                        <u-radio-group v-model="item.value" :placement="item.placement || 'row'"
+                            @change="groupChange($event, index)">
+                            <u-radio v-for="option in item.options"
+                                :customStyle="{ marginRight: tovw(option.marginRight || item.marginRight || 0), marginTop: tovw(option.marginTop || item.marginTop || 0) }"
+                                :key="option.label" :label="option.label" :name="option.name" />
+                        </u-radio-group>
+                    </view>
+                </view>
                 <!-- 日期 -->
                 <view class="region" @change="selectRegion($event, index)" v-else-if="item.type == 'route'"
                     :style="{ marginTop: tovw(item.marginTop || 0), opacity: item.disabled ? 0.7 : 1 }"
@@ -528,7 +543,7 @@ export default {
 
 
 <style lang="scss">
-.head {
+.requiredFieldOnly-head {
     display: flex;
     align-items: center;
     justify-content: space-between;

+ 16 - 1
pages.json

@@ -70,6 +70,8 @@
 			"path": "budget/changePrice"
 		}, {
 			"path": "storeQRCode/index"
+		}, {
+			"path": "insert/store"
 		}]
 	}, {
 		"root": "cloud",
@@ -110,12 +112,25 @@
 			"path": "userCenter/personal"
 		}, {
 			"path": "userCenter/wechatbind"
+		}, {
+			"path": "userCenter/insert"
+		}, {
+			"path": "userCenter/selectUser"
+		}]
+	}, {
+		"root": "select",
+		"pages": [{
+			"path": "store/store"
 		}]
 	}],
 	"preloadRule": {
 		"pages/index/index": {
 			"network": "all",
-			"packages": ["packageCase", "packageA", "store", "cloud", "team"]
+			"packages": ["packageCase", "packageA", "store", "cloud", "team", "select"]
+		},
+		"store/insert/store": {
+			"network": "all",
+			"packages": ["team", "select"]
 		}
 	},
 	"globalStyle": {

+ 2 - 3
pages/index/index.vue

@@ -64,7 +64,7 @@ export default {
 				console.log("被邀请绑定账号", that.user);
 				uni.showModal({
 					title: '提醒',
-					content: `"${that.user.userName}"是否与当前微信号绑定`,
+					content: `账号"${that.user.userName}"是否与当前微信号绑定`,
 					confirmText: '确定绑定',
 					success: function ({ confirm }) {
 						if (confirm) uni.login({
@@ -75,7 +75,7 @@ export default {
 										"wechat_code": res.code,
 										"isbinging": 1,
 										"wechatuserinfo": "",
-										"userid": that.user.wechatBindUserid
+										"sys_enterprise_hrid": that.user.wechatBindUserid
 									}
 								}).then(s => {
 									console.log("绑定账号", s)
@@ -97,7 +97,6 @@ export default {
 											}
 										}
 									});
-									if (that.cutoff(res.msg, '绑定成功')) return;
 								})
 							}
 						})

+ 59 - 0
select/store/store.vue

@@ -0,0 +1,59 @@
+<template>
+    <view>
+        <My_listbox ref="List" @getlist="getList" boxBackground="#fff">
+            <view class="list-box">
+                <navigator class="item" v-for="item in list" :key="item.sat_coursewareid"
+                    :url="'/packageA/course/list?id=' + item.sat_coursewareid">
+                    <image class="image" :src="item.cover" mode="aspectFill" lazy-load="true" />
+                    <view class="text">
+                        <view class="title u-line-1">{{ item.title || '--' }}</view>
+                        <view class="teacher u-line-1">讲师:{{ item.teacher || '--' }}</view>
+                        <view class="count u-line-1">共{{ item.courseware_count || 0 }}个课件 | {{ item.study_count || 0 }}人已学习
+                        </view>
+                    </view>
+                </navigator>
+            </view>
+        </My_listbox>
+    </view>
+</template>
+
+<script>
+export default {
+    data() {
+        return {
+            list: [],
+            "content": {
+                "where": {
+                    "condition": "",
+                    "storetype": "",
+                    "status": ""
+                }
+            }
+        }
+    },
+
+    onLoad() {
+        this.getList()
+        uni.setNavigationBarTitle({
+            title: '选择门店'
+        });
+    },
+    methods: {
+        getList(init = false) {
+            if (this.paging(this.content, init)) return;
+            this.$Http.basic({
+                "id": 20240410095602,
+                content: this.content
+            }).then(res => {
+                this.$refs.List.RefreshToComplete()
+                console.log("获取门店列表", res)
+                if (this.cutoff(res.msg)) return;
+                this.list = res.pageNumber == 1 ? res.data : this.list.concat(res.data);
+                this.content = this.$refs.List.paging(this.content, res)
+            })
+        },
+    },
+}
+</script>
+
+<style></style>

+ 162 - 0
store/insert/store.vue

@@ -0,0 +1,162 @@
+<template>
+    <view>
+        <my_form ref="form" :form="form" @isUncomplete="isUncomplete" requiredFieldOnly @interrupt="interrupt" />
+    </view>
+</template>
+
+<script>
+export default {
+    data() {
+        return {
+            sa_storeid: 0,
+            form: []
+        }
+    },
+    async onLoad() {
+        uni.setNavigationBarTitle({
+            title: '新增人员'
+        });
+        this.form = [{
+            key: "storename",
+            type: "text",
+            label: "门店名称",
+            isMust: true,//是否必填
+            value: "",
+        }, {
+            key: "area",
+            type: "text",
+            label: "面积(m²)",
+            isMust: true,//是否必填
+            value: "",
+            inputmode: 'digit',
+        }, {
+            key: "leader_hrid",
+            type: "route",
+            path: "/team/userCenter/selectUser?title=选择负责人",
+            isRadio: true,
+            label: "负责人姓名",
+            isMust: true,//是否必填
+            value: [],
+            showValue: [],
+            interrupt: true
+        }, {
+            key: "phonenumber",
+            type: "text",
+            label: "负责人电话",
+            isMust: true,//是否必填
+            value: "",
+            inputmode: 'number',
+            disabled: true,
+            verify: [this.getReg("phonenumber")]
+        }, {
+            key: "sale_phonenmber",
+            type: "text",
+            label: "门店售前电话",
+            isMust: false,//是否必填
+            value: "",
+            inputmode: 'number',
+            verify: [this.getReg("phonenumber")]
+        }, {
+            key: "service_phonenmber",
+            type: "text",
+            label: "门店售后电话",
+            isMust: false,//是否必填
+            value: "",
+            inputmode: 'number',
+            verify: [this.getReg("phonenumber")]
+        }, {
+            key: "storetype",
+            type: "radio",
+            label: "门店类型",
+            value: "直营",
+            options: [{
+                label: "直营",
+                name: "直营",
+                marginRight: 60
+            }, {
+                label: "分销",
+                name: "分销",
+            }]
+        }, {
+            key: "Class",
+            type: "customClass",
+            label: "门店卖场类型",
+            isMust: false,//是否必填
+            isMultipleChoice: false,//是否多选
+            value: '',// 多选[] 单选 ""
+            list: await this.getCustomClass('storetype')
+        }];
+    },
+    methods: {
+        isUncomplete(uncomplete) {
+            this.uncomplete = uncomplete;
+        },
+        interrupt(item, selected, index) {
+            console.log(item)
+            console.log(selected)
+            console.log(index)
+            switch (item.key) {
+                case "leader_hrid":
+                    item.showValue = [selected.name];
+                    item.value = [selected.sys_enterprise_hrid];
+                    this.$refs.form.setItem(index, item)
+                    this.$refs.form.setValue(index + 1, selected.phonenumber, true)
+                    break;
+            }
+
+        },
+        submit() {
+            this.loading = true;
+            let that = this;
+            this.$refs.form.submit().then(data => {
+                this.$Http.basic({
+                    "id": 20240410095302,
+                    "content": {
+                        "sa_storeid": this.sa_storeid,
+                        ...data
+                    }
+                }).then(res => {
+                    this.loading = false;
+                    console.log("加入团队", res)
+                    if (this.cutoff(res.msg)) return;
+                    this.loading = true;
+                    if (this.attachmentids.length) {
+                        this.uploadCallback(this.attachmentids, "sys_users", this.userid).then(s => {
+                            if (s) getUserMsg()
+                        });
+                        if (this.headportraits.length) this.$Http.basic({
+                            "classname": "system.attachment.Attachment",
+                            "method": "deleteFileLink",
+                            "content": {
+                                linksids: this.headportraits.map(v => v.linksid)
+                            }
+                        })
+
+                    } else {
+                        getUserMsg()
+                    }
+                    function getUserMsg() {
+                        that.$Http.wechatLogin().then(token => {
+                            that.loading = false;
+                            uni.showModal({
+                                title: '提示',
+                                content: '成功加入团队',
+                                showCancel: false,
+                                confirmText: '确定',
+                                confirmColor: '#C40C24',
+                                success: ({ confirm }) => {
+                                    if (confirm) uni.redirectTo({
+                                        url: '/pages/index/index',
+                                    })
+                                }
+                            });
+                        })
+                    }
+                })
+            })
+        },
+    },
+}
+</script>
+
+<style></style>

+ 5 - 3
team/team/index.vue

@@ -4,17 +4,19 @@
             @click="changeCurrent" :current="current" />
 
         <users ref="人员" v-show="pageNmae == '人员'" />
+        <store ref="门店" v-show="pageNmae == '门店'" />
     </view>
 </template>
 
 <script>
 import users from "./modules/users.vue"
+import store from "./modules/store.vue"
 export default {
-    components: { users },
+    components: { users, store },
     data() {
         return {
-            current: 1,
-            pageNmae: "人员",
+            current: 2,
+            pageNmae: "门店",
             tabs: [{
                 name: '经销商',
             }, {

+ 141 - 0
team/team/modules/store.vue

@@ -0,0 +1,141 @@
+<template>
+    <view class="">
+        <view class="search-box">
+            <My_search background="#fff" @onSearch="onSearch" />
+        </view>
+        <view class="head">
+            <text>
+                门店
+            </text>
+            <text>
+                共{{ total }}个
+            </text>
+        </view>
+
+        <My_listbox ref="List" @getlist="getList" bottomHeight="70">
+            <user-list :list="list" @onClick="onClick" />
+        </My_listbox>
+
+        <view class="footer">
+            <navigator class="invite" @click="onInsert" url="/store/insert/store">
+                新增门店
+            </navigator>
+        </view>
+    </view>
+</template>
+
+<script>
+import userList from "../modules/userList"
+export default {
+    components: { userList },
+    data() {
+        return {
+            "content": {
+                "where": {
+                    "condition": ""
+                }
+            },
+            total: 0,
+            list: []
+        }
+    },
+    created() {
+        this.init()
+    },
+    methods: {
+        init() {
+            this.getList(true)
+        },
+        getList(init = false) {
+            if (this.paging(this.content, init)) return;
+            this.$Http.basic({
+                "id": "20240410095602",
+                content: this.content
+            }).then(res => {
+                console.log("门店列表", res)
+                this.$refs.List.RefreshToComplete()
+                if (this.cutoff(res.msg)) return;
+                /*     res.data = res.data.map(v => {
+                        v.cover = v.attinfos.length ? this.getSpecifiedImage(v.attinfos.find(s => s.usetype == "sa_fad") || v.attinfos[0]) : uni.getStorageSync("site").logo || ''
+                        return v
+                    }) */
+                this.total = res.total;
+                this.list = res.pageNumber == 1 ? res.data : this.list.concat(res.data), this.colors;
+                this.content = this.$refs.List.paging(this.content, res)
+            })
+        },
+        onClick(item) {
+            uni.navigateTo({
+                url: '/team/userCenter/personal?id=' + item.sys_enterprise_hrid
+            });
+        },
+        onInsert() {
+            this.$Http.uploadStoreList = function () {
+                if (this.content.pageNumber && this.content.pageNumber >= 2) {
+                    let content = this.paging(this.content, true, true)
+                    this.$Http.basic({
+                        "id": "20240410095602",
+                        content
+                    }).then(res => {
+                        console.log("更新门店列表", res)
+                        if (this.cutoff(res.msg)) return;
+                        this.list = res.data;
+                        delete this.$Http.uploadStoreList
+                    })
+                }
+            }.bind(this)
+        },
+        onSearch(condition) {
+            this.content.where.condition = condition;
+            this.getList(true)
+        }
+    },
+}
+</script>
+
+<style lang="scss" scoped>
+.search-box {
+    margin-top: 10px;
+    padding: 0 10px;
+    box-sizing: border-box;
+}
+
+.head {
+    display: flex;
+    align-items: center;
+    justify-content: space-between;
+    height: 37px;
+    padding: 0 10px;
+    box-sizing: border-box;
+    font-family: Source Han Sans SC, Source Han Sans SC;
+    font-size: 12px;
+    color: #666666;
+}
+
+.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;
+
+    .invite {
+        display: flex;
+        align-items: center;
+        justify-content: center;
+        flex: 1;
+        height: 45px;
+        background: #C30D23;
+        border-radius: 5px;
+        font-family: PingFang SC, PingFang SC;
+        font-weight: 500;
+        font-size: 16px;
+        color: #FFFFFF;
+    }
+}
+</style>

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


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

@@ -17,7 +17,7 @@
         </My_listbox>
 
         <view class="footer">
-            <navigator class="insert" url="">
+            <navigator class="insert" url="/team/userCenter/insert" @click="onInsert">
                 新增人员
             </navigator>
             <navigator class="invite" url="/team/team/InviteUser">
@@ -28,7 +28,7 @@
 </template>
 
 <script>
-import userList from "../../userCenter/modules/userList.vue"
+import userList from "../../team/modules/userList"
 export default {
     components: { userList },
     data() {
@@ -72,6 +72,22 @@ export default {
                 url: '/team/userCenter/personal?id=' + item.sys_enterprise_hrid
             });
         },
+        onInsert() {
+            this.$Http.uploadUserList = function () {
+                if (this.content.pageNumber && this.content.pageNumber >= 2) {
+                    let content = this.paging(this.content, true, true)
+                    this.$Http.basic({
+                        "id": "20240410161802",
+                        content
+                    }).then(res => {
+                        console.log("更新人员列表", res)
+                        if (this.cutoff(res.msg)) return;
+                        this.list = res.data;
+                        delete this.$Http.uploadUserList
+                    })
+                }
+            }.bind(this)
+        },
         onSearch(condition) {
             this.content.where.condition = condition;
             this.getList(true)

+ 128 - 0
team/userCenter/insert.vue

@@ -0,0 +1,128 @@
+<template>
+    <view>
+        <my_form ref="form" :form="form" @isUncomplete="isUncomplete" requiredFieldOnly />
+
+    </view>
+</template>
+
+<script>
+export default {
+    data() {
+        return {
+            sys_enterprise_hrid: 0,
+            form: []
+        }
+    },
+    async onLoad() {
+        uni.setNavigationBarTitle({
+            title: '新增人员'
+        });
+        let form = [{
+            key: "name",
+            type: "text",
+            label: "姓名",
+            isMust: true,//是否必填
+            value: "",
+        }, {
+            key: "phonenumber",
+            type: "text",
+            label: "手机号",
+            isMust: true,//是否必填
+            value: "",
+            placeholder: "请输入收货人手机号",
+            inputmode: 'number',
+            verify: [this.getReg("phonenumber")]
+        }, {
+            key: "sex",
+            type: "sex",
+            label: "性别",
+            value: "男",
+        }, {
+            key: "birthday",
+            type: "date",
+            label: "生日",
+            value: "",
+            placeholder: "请选择出生日期",
+        }, {
+            key: "email",
+            type: "text",
+            label: "邮箱",
+            isMust: false,//是否必填
+            value: "",
+            verify: [this.getReg("email")]
+        }, {
+            key: "position",
+            type: "text",
+            label: "店内职位",
+            isMust: false,//是否必填
+            value: "",
+        }, {
+            key: "sa_storeids",
+            type: "route",
+            path: "/select/store/store",
+            isRadio: false,
+            label: "所属门店",
+            isMust: false,//是否必填
+            value: [],
+            showValue: [],
+        }];
+        this.form = form;
+    },
+    methods: {
+        isUncomplete(uncomplete) {
+            this.uncomplete = uncomplete;
+        },
+        submit() {
+            this.loading = true;
+            let that = this;
+            this.$refs.form.submit().then(data => {
+                this.$Http.basic({
+                    "id": 20240410164102,
+                    "content": {
+                        "sys_enterprise_hrid": this.sys_enterprise_hrid,
+                        ...data
+                    }
+                }).then(res => {
+                    this.loading = false;
+                    console.log("加入团队", res)
+                    if (this.cutoff(res.msg)) return;
+                    this.loading = true;
+                    if (this.attachmentids.length) {
+                        this.uploadCallback(this.attachmentids, "sys_users", this.userid).then(s => {
+                            if (s) getUserMsg()
+                        });
+                        if (this.headportraits.length) this.$Http.basic({
+                            "classname": "system.attachment.Attachment",
+                            "method": "deleteFileLink",
+                            "content": {
+                                linksids: this.headportraits.map(v => v.linksid)
+                            }
+                        })
+                    } else {
+                        getUserMsg()
+                    }
+                    function getUserMsg() {
+                        that.$Http.wechatLogin().then(token => {
+                            that.loading = false;
+                            uni.showModal({
+                                title: '提示',
+                                content: '成功加入团队',
+                                showCancel: false,
+                                confirmText: '确定',
+                                confirmColor: '#C40C24',
+                                success: ({ confirm }) => {
+                                    if (confirm) uni.redirectTo({
+                                        url: '/pages/index/index',
+                                    })
+                                }
+                            });
+                        })
+                    }
+                })
+            })
+        },
+    },
+}
+</script>
+
+<style></style>

+ 1 - 1
team/userCenter/personal.vue

@@ -39,7 +39,7 @@
 </template>
 
 <script>
-import user from "./modules/userList"
+import user from "../team/modules/userList.vue"
 export default {
     components: { user },
     data() {

+ 51 - 0
team/userCenter/selectUser.vue

@@ -0,0 +1,51 @@
+<template>
+    <My_listbox ref="List" @getlist="getList" bottomHeight="70">
+        <view style="height: 10px;" />
+        <user-list :list="list" @onClick="onClick" />
+    </My_listbox>
+</template>
+
+<script>
+import userList from "../team/modules/userList.vue"
+export default {
+    components: { userList },
+    data() {
+        return {
+            "content": {
+                "where": {
+                    "condition": ""
+                }
+            },
+            total: 0,
+            list: []
+        }
+    },
+    onLoad(options) {
+        this.getList(true)
+        uni.setNavigationBarTitle({
+            title: options.title || '选择用户'
+        });
+    },
+    methods: {
+        getList(init = false) {
+            if (this.paging(this.content, init)) return;
+            this.$Http.basic({
+                "id": "20240410161802",
+                content: this.content
+            }).then(res => {
+                console.log("人员列表", res)
+                this.$refs.List.RefreshToComplete()
+                if (this.cutoff(res.msg)) return;
+                this.total = res.total;
+                this.list = res.pageNumber == 1 ? res.data : this.list.concat(res.data), this.colors;
+                this.content = this.$refs.List.paging(this.content, res)
+            })
+        },
+        onClick(item) {
+            this.$Http.routeSelected(item)
+        },
+    },
+}
+</script>
+
+<style></style>