Browse Source

产品管理与成员管理

zhaoxiaohai 3 years ago
parent
commit
b4236d5d4e
43 changed files with 1119 additions and 197 deletions
  1. 7 2
      README.md
  2. 1 1
      app.js
  3. 7 0
      components/My_formCell/index.js
  4. 12 12
      components/My_formCell/index.wxml
  5. 6 0
      components/My_formCell/index.wxss
  6. 16 3
      components/My_group_item/index.js
  7. 5 5
      components/My_group_item/index.wxml
  8. 1 2
      components/My_group_item/index.wxss
  9. 36 5
      components/My_group_list/index.js
  10. 2 2
      components/My_group_list/index.wxml
  11. 139 5
      components/My_group_new-change/index.js
  12. 2 1
      components/My_group_new-change/index.json
  13. 6 8
      components/My_group_new-change/index.wxml
  14. 36 0
      components/My_product_item/index.js
  15. 4 0
      components/My_product_item/index.json
  16. 22 0
      components/My_product_item/index.wxml
  17. 69 0
      components/My_product_item/index.wxss
  18. 76 5
      components/My_product_list/index.js
  19. 5 1
      components/My_product_list/index.json
  20. 15 2
      components/My_product_list/index.wxml
  21. 337 0
      components/My_product_new-change/index.js
  22. 7 0
      components/My_product_new-change/index.json
  23. 25 0
      components/My_product_new-change/index.wxml
  24. 7 0
      components/My_product_new-change/index.wxss
  25. 49 0
      components/My_user_right/index.js
  26. 4 0
      components/My_user_right/index.json
  27. 11 0
      components/My_user_right/index.wxml
  28. 42 0
      components/My_user_right/index.wxss
  29. 22 2
      pages/group&product/change.js
  30. 2 1
      pages/group&product/change.json
  31. 4 1
      pages/group&product/change.wxml
  32. 7 2
      pages/group&product/index.js
  33. 4 1
      pages/group&product/index.wxml
  34. 2 0
      pages/login/index.js
  35. 20 5
      pages/tabbarPage/User/index.js
  36. 4 4
      pages/tabbarPage/User/index.wxml
  37. 30 17
      pages/userMessage/index.js
  38. 1 1
      pages/userMessage/index.wxml
  39. 60 9
      pages/userPerfectMsg/index.js
  40. 12 12
      pages/userPerfectMsg/index.wxml
  41. 1 1
      utils/api.js
  42. 0 86
      utils/uploadfile.js
  43. 1 1
      utils/verify.js

+ 7 - 2
README.md

@@ -3,7 +3,9 @@
 普通文字大小:26rpx
 普通字体颜色:#646566
 灰色字体颜色:#CCCCCC
+错误提示:#EE0A24
 边框颜色:#E4E4E4
+头像缩放模式 aspectFill
 
 app.js 全局变量
 safeAreaBottom -- iPhone X 等机型底部安全距离适配
@@ -28,14 +30,17 @@ My_moreAccount -- 多账号登录
 My_group_list -- 团队列表页面
 My_group_item -- 团队列表成员
 My_group_new-change -- 团队新增或修改
-My_product_list -- 产品列表页面
+My_user_right -- 用户权限
+My_product_list -- 产品管理页
+My_product_item -- 产品
+My_product_new-change -- 产品新增或修改
+
 
 utils文件
 Http.js -- 封装请求
 api.js -- 接口分类
 md5.js -- 验证码加密
 verify.js -- 表单校验
-uploadfile.js -- 上传文件
 
 缓存
 userIndex -- 用户当前使用账户列表中的下标

+ 1 - 1
app.js

@@ -25,6 +25,6 @@ App({
   globalData: {
     myNavBorHeight: null, //自定义头部导航高度
     safeAreaBottom: 0, //底部安全距离
-    accountList: {}, //角色列表
+    accountList: [], //角色列表
   }
 })

+ 7 - 0
components/My_formCell/index.js

@@ -4,13 +4,20 @@ Component({
      * 组件的属性列表
      */
     properties: {
+        /* title */
         title:{
             type:String,
             value:"单元格"
         },
+        /* 必填 */
         required:{
             type:Boolean,
             value:false
+        },
+        /* 上传 */
+        uploading:{
+            type:Boolean,
+            value:false
         }
     },
 

+ 12 - 12
components/My_formCell/index.wxml

@@ -1,13 +1,13 @@
-  <!-- 自定义上传cell -->
-  <view class="cell_box">
-    <view class="cell_con">
-      <!-- 标题 -->
-      <view class="cell_con_title {{required ? 'required' : 'norequired'}}" >
-        {{title}}
-      </view>
-      <!-- 右侧自定义 -->
-      <view>
-        <slot></slot>
-      </view>
+<!-- 自定义上传cell -->
+<view class="cell_box">
+  <view class="cell_con" style="height: {{uploading?'160rpx':'48rpx'}};">
+    <!-- 标题 -->
+    <view class="cell_con_title {{required ? 'required' : 'norequired'}}" style="line-height: {{uploading?'160rpx':'48rpx'}};">
+      {{title}}
     </view>
-  </view>
+    <!-- 右侧自定义 -->
+    <view class="{{uploading?'uploading':''}}">
+      <slot></slot>
+    </view>
+  </view>
+</view>

+ 6 - 0
components/My_formCell/index.wxss

@@ -34,4 +34,10 @@
     content: '';
     margin-left: 18rpx;
     color: #EE1929;
+}
+
+/* 上传 */
+.uploading{
+    flex: 1;
+    margin-left: 25rpx;
 }

+ 16 - 3
components/My_group_item/index.js

@@ -4,7 +4,14 @@ Component({
      * 组件的属性列表
      */
     properties: {
-
+        /* 数据 */
+        userItem: {
+            type: Object
+        },
+        /* 账号类型 */
+        fisadministrator: {
+            type: Number
+        }
     },
 
     /**
@@ -18,6 +25,12 @@ Component({
      * 组件的方法列表
      */
     methods: {
-
+        /* 跳转修改页面 */
+        changeData() {
+            const data = JSON.stringify(this.data.userItem)
+            wx.navigateTo({
+                url: '/pages/group&product/change?type=group&data=' + data,
+            })
+        }
     }
-})
+})

+ 5 - 5
components/My_group_item/index.wxml

@@ -4,21 +4,21 @@
     <view class="member_item">
         <!-- 用户头像 -->
         <view class="member_item_img">
-            <view></view>
+            <image src="{{userItem.attinfos[0].fobsurl}}" mode="aspectFill"></image>
         </view>
         <!-- 用户信息 -->
         <view class="member_item_text">
             <view class="member_item_text_title">
-                用户名
+                {{userItem.fname}}
             </view>
             <view class="member_item_text_row">
-                身份/职位:
+                身份/职位:{{userItem.frole}}
             </view>
             <view class="member_item_text_row">
-                手机:
+                手机:{{userItem.fphonenumber}}
             </view>
         </view>
         <!-- 修改按钮 -->
-        <navigator url="/pages/group&product/change" class="member_item_amend">修改</navigator>
+        <navigator wx:if="{{fisadministrator==1}}" url="#" bindtap="changeData" class="member_item_amend">修改</navigator>
     </view>
 </view>

+ 1 - 2
components/My_group_item/index.wxss

@@ -20,11 +20,10 @@
     width: 180rpx;
 }
 
-.member_item_img>view {
+.member_item_img>image {
     position: absolute;
     width: 120rpx;
     height: 120rpx;
-    background-color: #000;
     border-radius: 50%;
     overflow: hidden;
     top: 50%;

+ 36 - 5
components/My_group_list/index.js

@@ -1,23 +1,54 @@
 // components/My_group_list/index.js
+import {
+    ApiModel
+} from "../../utils/api"
+const _Http = new ApiModel();
 Component({
     /**
      * 组件的属性列表
      */
     properties: {
-
+        /* 账号类型 */
+        fisadministrator:{
+            type:Number
+        }
     },
 
+    pageLifetimes: {
+        show: function () {
+            const that = this;
+            // 页面被展示
+            _Http.basic({
+                "accesstoken": wx.getStorageSync('token'),
+                "classname": "customer.usercenter.teammsg.teammsg",
+                "method": "query_userList",
+                "content": {
+                    "getdatafromdbanyway": true
+                }
+            }).then(s => {
+                console.log(s)
+                if (s.msg != "成功") return;
+                this.setData({
+                    memberList: s.data
+                })
+            })
+        },
+    },
     /**
      * 组件的初始数据
      */
     data: {
-
+        memberList: [], //成员列表
     },
-
     /**
      * 组件的方法列表
      */
     methods: {
-
+        //新增
+        newAdd() {
+            wx.navigateTo({
+                url: '/pages/group&product/change?type=group',
+            })
+        }
     }
-})
+})

+ 2 - 2
components/My_group_list/index.wxml

@@ -1,8 +1,8 @@
 <!-- 搜索 -->
 <van-search value="{{ value }}" placeholder="请输入搜索关键词" shape="round" use-action-slot bind:change="onChange" bind:search="onSearch">
-  <view class="search_left" slot="action" bind:tap="onClick">
+  <view wx:if="{{fisadministrator==1}}" class="search_left" slot="action" bind:tap="newAdd">
     <van-icon name="add" style="color: #1ABC9C;" /> 新增
   </view>
 </van-search>
 <!-- 列表 -->
-<My_group_item wx:for="{{3}}"></My_group_item>
+<My_group_item wx:for="{{memberList}}" userItem="{{item}}" fisadministrator="{{fisadministrator}}"></My_group_item>

+ 139 - 5
components/My_group_new-change/index.js

@@ -1,27 +1,154 @@
-// components/My_group_new&change/index.js
+import {
+    ApiModel
+} from "../../utils/api";
+import {
+    TestVerify
+} from "../../utils/verify";
+const _Http = new ApiModel();
+const _Verify = new TestVerify();
+
 Component({
     /**
      * 组件的属性列表
      */
     properties: {
-
+        memberMsg: {
+            type: Object
+        }
     },
 
     /**
      * 组件的初始数据
      */
     data: {
+        userid: '', //tenterprise_userid
         userName: "", //账户名称
         frole: "", //身份/职位
         cellPhoneNum: "", //手机号码
-        checked: true, //权限
-        actionSheetShow: false
+        fright: "", //角色选择
+        checked: true, //是否启用
+        actionSheetShow: false, //弹出层显示
+        /* 必填项目 */
+        inputVerify: {
+            userName: false, //用户名
+            frole: false, //身份
+            cellPhoneNum: false //手机号码
+        }
+    },
+    lifetimes: {
+        ready: function () {
+            const {
+                memberMsg
+            } = this.data;
+            /* 判断修改或新增 */
+            if (!memberMsg) return this.setData({
+                userid: 0
+            })
+            /* 修改数据 */
+            this.setData({
+                userName: memberMsg.fname,
+                frole: memberMsg.frole,
+                cellPhoneNum: memberMsg.fphonenumber,
+                userid: memberMsg.tenterprise_userid
+            })
+        }
     },
-
     /**
      * 组件的方法列表
      */
     methods: {
+        /* 获焦恢复 */
+        inputFocus(e) {
+            let inputVerify = this.data.inputVerify;
+            const {
+                name
+            } = e.currentTarget.dataset;
+            inputVerify[name] = false;
+            this.setData({
+                inputVerify
+            })
+        },
+        /* 失焦验证 */
+        inputBlur(e) {
+            let inputVerify = this.data.inputVerify;
+            const {
+                name
+            } = e.currentTarget.dataset;
+            /* 手机号验证 */
+            if (name == 'cellPhoneNum' && !_Verify.phoneNumber(this.data.cellPhoneNum, true)) {
+                inputVerify[name] = true;
+                this.setData({
+                    inputVerify
+                })
+            }
+            /* 验证 */
+            if (e.detail.value != "") return;
+            inputVerify[name] = true;
+            this.setData({
+                inputVerify
+            })
+        },
+        /* 验证 */
+        submitVerify() {
+            let inputVerify = this.data.inputVerify,
+                nextStep = true;
+            if (!_Verify.required(this.data.userName)) {
+                inputVerify.userName = true;
+                nextStep = false;
+            }
+
+            if (!_Verify.required(this.data.frole)) {
+                inputVerify.frole = true
+                nextStep = false;
+            }
+
+            if (!_Verify.phoneNumber(this.data.cellPhoneNum)) {
+                inputVerify.cellPhoneNum = true
+                nextStep = false;
+            }
+            if (!nextStep) {
+                this.setData({
+                    inputVerify
+                })
+            }
+            return nextStep;
+        },
+        /* 提交 */
+        submit() {
+            /* 验证必填项 */
+            if (!this.submitVerify()) return wx.showToast({
+                title: '请检查输入框内容!',
+                icon: "none"
+            })
+            /* 发送请求 */
+            _Http.basic({
+                "accesstoken": wx.getStorageSync('token'),
+                "classname": "customer.usercenter.teammsg.teammsg",
+                "method": "update_userMsg",
+                "content": {
+                    "tenterprise_userid": this.data.userid,
+                    "fname": this.data.userName,
+                    "frole": this.data.frole,
+                    "fphonenumber": this.data.cellPhoneNum,
+                    "subusers": []
+                }
+            }).then(s => {
+                if (s.msg != "成功") return wx.showToast({
+                    title: "修改失败",
+                    icon: 'none'
+                })
+
+                wx.showToast({
+                    title: s.msg,
+                })
+                setTimeout(() => {
+                    wx.navigateBack({
+                        delta: 1
+                    })
+                }, 500)
+            })
+
+        },
         /* 是否启用 */
         switchOnChange() {
             this.setData({
@@ -39,6 +166,13 @@ Component({
             this.setData({
                 actionSheetShow: false
             })
+        },
+        /* 返回权限选项 */
+        userSelect(e) {
+            this.setData({
+                right: e.detail.value,
+                actionSheetShow: false
+            })
         }
     }
 })

+ 2 - 1
components/My_group_new-change/index.json

@@ -1,6 +1,7 @@
 {
     "component": true,
     "usingComponents": {
-        "My_formCell":"../My_formCell/index"
+        "My_formCell":"../My_formCell/index",
+        "My_user_right":"../My_user_right/index"
     }
 }

+ 6 - 8
components/My_group_new-change/index.wxml

@@ -1,21 +1,19 @@
 <!-- 团队新增或修改 -->
 <van-cell-group>
-    <van-field model:value="{{ userName }}" required label="账号名称" placeholder="点击填写" input-align="right" size="large" />
-    <van-field model:value="{{ frole }}" required label="身份/职位" placeholder="点击填写" input-align="right" size="large" />
-    <van-field model:value="{{ cellPhoneNum }}" required label="手机号码" placeholder="点击填写" input-align="right" size="large" />
+    <van-field model:value="{{ userName }}" error="{{inputVerify.userName}}" bind:focus="inputFocus" bind:blur="inputBlur" data-name="userName" required label="账号名称" placeholder="点击填写" input-align="right" size="large" />
+    <van-field model:value="{{ frole }}" error="{{inputVerify.frole}}" bind:focus="inputFocus" bind:blur="inputBlur" data-name="frole" required label="身份/职位" placeholder="点击填写" input-align="right" size="large" />
+    <van-field model:value="{{ cellPhoneNum }}" error="{{inputVerify.cellPhoneNum}}" bind:focus="inputFocus" bind:blur="inputBlur" data-name="cellPhoneNum" required label="手机号码" placeholder="点击填写" input-align="right" size="large" />
     <My_formCell title="权限设置">
-        <view bindtap="actionSheetShow">点击设置</view>
+        <view bindtap="actionSheetShow">{{right?right:'点击设置'}}</view>
     </My_formCell>
     <My_formCell title="是否启用">
         <van-switch checked="{{ checked }}" bind:change="switchOnChange" size="24" />
     </My_formCell>
 </van-cell-group>
 <view class="submit">
-    <van-button type="info" size="large" round>保存</van-button>
+    <van-button type="info" size="large" round bindtap="submit">保存</van-button>
 </view>
 <!-- 底部弹出 -->
 <van-action-sheet show="{{ actionSheetShow }}" bind:close="onClose">
-    <view class="">
-
-    </view>
+    <My_user_right bind:option="userSelect"></My_user_right>
 </van-action-sheet>

+ 36 - 0
components/My_product_item/index.js

@@ -0,0 +1,36 @@
+// components/My_group_item/index.js
+Component({
+    /**
+     * 组件的属性列表
+     */
+    properties: {
+        /* 数据 */
+        productItem: {
+            type: Object
+        },
+        /* 账号类型 */
+        fisadministrator: {
+            type: Number
+        }
+    },
+
+    /**
+     * 组件的初始数据
+     */
+    data: {
+
+    },
+
+    /**
+     * 组件的方法列表
+     */
+    methods: {
+        /* 跳转修改页面 */
+        changeData() {
+            const data = JSON.stringify(this.data.productItem)
+            wx.navigateTo({
+                url: '/pages/group&product/change?type=product&data=' + data,
+            })
+        }
+    }
+})

+ 4 - 0
components/My_product_item/index.json

@@ -0,0 +1,4 @@
+{
+    "component": true,
+    "usingComponents": {}
+}

+ 22 - 0
components/My_product_item/index.wxml

@@ -0,0 +1,22 @@
+<view class="member_list">
+    <view class="member_item">
+        <!-- 产品图片 -->
+        <view class="member_item_img">
+            <image src="{{productItem.attinfos[0].fobsurl}}" mode="aspectFill"></image>
+        </view>
+        <!-- 产品信息 -->
+        <view class="member_item_text">
+            <view class="member_item_text_title">
+                {{productItem.fprodname}}
+            </view>
+            <view class="member_item_text_row">
+                {{productItem.fprodnum}}
+            </view>
+            <view class="member_item_text_row">
+                {{productItem.ftag}}
+            </view>
+        </view>
+        <!-- 修改按钮 -->
+        <navigator wx:if="{{fisadministrator==1}}" url="#" bindtap="changeData" class="member_item_amend">操作</navigator>
+    </view>
+</view>

+ 69 - 0
components/My_product_item/index.wxss

@@ -0,0 +1,69 @@
+/* 列表 */
+.member_list {
+    width: 100vw;
+    border-top: 1px solid #E4E4E4;
+}
+
+/*  */
+.member_item {
+    display: flex;
+    align-items: center;
+    height: 200rpx;
+    border-bottom: 1px solid #E4E4E4;
+    border-top: 1px solid #E4E4E4;
+    background-color: #ffffff;
+    margin-top: 15rpx;
+}
+
+/* 头像 */
+.member_item_img {
+    position: relative;
+    height: 100%;
+    width: 210rpx;
+}
+
+.member_item_img>image {
+    position: absolute;
+    width: 160rpx;
+    height: 160rpx;
+    overflow: hidden;
+    background-color: #E4E4E4;
+    top: 50%;
+    left: 50%;
+    transform: translate(-50%, -50%);
+}
+
+/* 用户信息 */
+.member_item_text {
+    flex: 1;
+    display: flex;
+    flex-direction: column;
+    justify-content: center;
+}
+
+/* 用户名 */
+.member_item_text_title {
+    font-size: 32rpx;
+    color: #8d8d8d;
+
+}
+
+/* 用户身份与手机 */
+.member_item_text_row {
+    font-size: 30rpx;
+    color: #CCCCCC;
+    margin-top: 13rpx;
+}
+
+/* 修改 */
+.member_item_amend {
+    font-size: 34rpx;
+    width: 100rpx;
+    height: 55rpx;
+    line-height: 55rpx;
+    color: #ffffff;
+    text-align: center;
+    border-radius: 15rpx;
+    background-color: #1ABC9C;
+    margin-right: 30rpx;
+}

+ 76 - 5
components/My_product_list/index.js

@@ -1,23 +1,94 @@
-// components/My_product_list/index.js
+import {
+    ApiModel
+} from "../../utils/api";
+const _Http = new ApiModel();
 Component({
     /**
      * 组件的属性列表
      */
     properties: {
-
+        fisadministrator: {
+            type: Number
+        }
     },
 
     /**
      * 组件的初始数据
      */
     data: {
-
+        productList: [], //产品列表
+        tabsActive: 0, //tabs 下标
+        pageNumber: 1, //获取页码
     },
 
+    pageLifetimes: {
+        show: function () {
+            // 页面被展示
+            this.tabsChange({
+                detail: {
+                    index: this.data.tabsActive
+                }
+            })
+        },
+    },
     /**
      * 组件的方法列表
      */
     methods: {
-
+        //tabs切换
+        tabsChange(e) {
+            console.log(e)
+            this.setData({
+                tabsActive: e.detail.index,
+                pageNumber: 1
+            })
+            if (e.detail.index == 0) {
+                console.log("全部")
+                this.queryProduct()
+            } else if (e.detail.index == 1) {
+                console.log("上架中")
+                this.queryProduct({
+                    "fisonsale": 1
+                })
+            } else if (e.detail.index == 2) {
+                console.log("已下架")
+                this.queryProduct({
+                    "fisonsale": 0
+                })
+            }
+        },
+        //搜索
+        searchChange(e) {
+            let text = e.detail.trim();
+            console.log(text)
+        },
+        //查询商品
+        queryProduct(where) {
+            _Http.basic({
+                "accesstoken": wx.getStorageSync('token'),
+                "classname": "customer.products.products",
+                "method": "query_productsList",
+                "content": {
+                    "getdatafromdbanyway": true,
+                    "pageNumber": this.data.pageNumber,
+                    "pageSize": 20,
+                    "where": where
+                }
+            }).then(s => {
+                console.log(s)
+                if (s.msg != "成功") return;
+                //返回列表,页码加1
+                this.setData({
+                    productList: s.data,
+                    pageNumber: this.data.pageNumber + 1
+                })
+            })
+        },
+        //新增或修改
+        newAdd() {
+            wx.navigateTo({
+                url: '/pages/group&product/change?type=product',
+            })
+        }
     }
-})
+})

+ 5 - 1
components/My_product_list/index.json

@@ -1,4 +1,8 @@
 {
     "component": true,
-    "usingComponents": {}
+    "usingComponents": {
+        "van-tab": "@vant/weapp/tab/index",
+        "van-tabs": "@vant/weapp/tabs/index",
+        "My_product_item":"../My_product_item/index"
+    }
 }

+ 15 - 2
components/My_product_list/index.wxml

@@ -1,2 +1,15 @@
-<!--components/My_product_list/index.wxml-->
-<text>components/My_product_list/index.wxml</text>
+<!-- 搜索 -->
+<van-search value="{{ value }}" placeholder="搜索产品" shape="round" use-action-slot bind:change="searchChange" bind:search="onSearch">
+    <view wx:if="{{fisadministrator==1}}" class="search_left" slot="action" bind:tap="newAdd">
+        <van-icon name="add" style="color: #1ABC9C;" /> 上架
+    </view>
+</van-search>
+<view style="height: 10rpx;"></view>
+<!-- tabs -->
+<van-tabs active="{{ tabsActive }}" bind:change="tabsChange">
+    <van-tab title="全部"></van-tab>
+    <van-tab title="上架中"></van-tab>
+    <van-tab title="已下架"></van-tab>
+</van-tabs>
+<!-- 产品 -->
+<My_product_item wx:for="{{productList}}" productItem="{{item}}" fisadministrator="{{fisadministrator}}"></My_product_item>

+ 337 - 0
components/My_product_new-change/index.js

@@ -0,0 +1,337 @@
+import {
+    ApiModel
+} from "../../utils/api";
+import {
+    TestVerify
+} from "../../utils/verify";
+const _Http = new ApiModel();
+const _Verify = new TestVerify();
+
+Component({
+    /**
+     * 组件的属性列表
+     */
+    properties: {
+        productData: {
+            type: Object
+        }
+    },
+
+    /**
+     * 组件的初始数据
+     */
+    data: {
+        newlyBuilt: true, //是否为新增产品,非新增会修改为false 新增请求修改接口后改为false 如果页面关闭为true 会删除该商品
+        productName: "", //产品名称
+        serialNumber: "", //产品编号
+        fileList: [], //图片列表
+        productLabel: "", //产品标签
+        productExplain: "", //产品说明
+        checked: Boolean, //是否上架
+        /* 必填项目 */
+        inputVerify: {
+            productName: false, //产品名称
+            serialNumber: false, //身份
+        },
+        tagents_productid: 0, //产品ID
+        fileListLength: 0, //记录进入图片数量
+    },
+    lifetimes: {
+        ready: function () {
+            if (this.data.productData) {
+                const {
+                    productData
+                } = this.data
+                let checked = Boolean;
+                if (productData.fisonsale == 1) {
+                    checked = true;
+                } else {
+                    checked = false;
+                }
+                this.manageImage(productData.attinfos)
+                /*  */
+                this.setData({
+                    productName: productData.fprodname,
+                    serialNumber: productData.fprodnum,
+                    productLabel: productData.ftag,
+                    tagents_productid: productData.tagents_productid,
+                    checked: checked,
+                    newlyBuilt: false,
+                })
+            } else {
+                /* 新增产品 */
+                _Http.basic({
+                    "accesstoken": wx.getStorageSync('token'),
+                    "classname": "customer.products.products",
+                    "method": "insertOrModifyProducts",
+                    "content": {
+                        "tagents_productid": 0
+                    }
+                }).then(s => {
+                    if (s.msg != "成功") return;
+                    this.setData({
+                        tagents_productid: s.data[0].tagents_productid,
+                        checked: true
+                    })
+                })
+            }
+        },
+        detached() {
+            //新增账号未保存会删除账号
+            if (!this.data.newlyBuilt) return;
+            //删除账号
+            _Http.basic({
+                "accesstoken": wx.getStorageSync('token'),
+                "classname": "customer.products.products",
+                "method": "deleteProducts",
+                "content": {
+                    "tagents_productid": this.data.tagents_productid
+                }
+            }).then(s => {
+                console.log(s)
+            })
+        }
+    },
+    methods: {
+        /* 获焦恢复 */
+        inputFocus(e) {
+            let inputVerify = this.data.inputVerify;
+            const {
+                name
+            } = e.currentTarget.dataset;
+            inputVerify[name] = false;
+            this.setData({
+                inputVerify
+            })
+        },
+        /* 失焦验证 */
+        inputBlur(e) {
+            let inputVerify = this.data.inputVerify;
+            const {
+                name
+            } = e.currentTarget.dataset;
+            /* 手机号验证 */
+            if (name == 'cellPhoneNum' && !_Verify.phoneNumber(this.data.cellPhoneNum, true)) {
+                inputVerify[name] = true;
+                this.setData({
+                    inputVerify
+                })
+            }
+            /* 验证 */
+            if (e.detail.value != "") return;
+            inputVerify[name] = true;
+            this.setData({
+                inputVerify
+            })
+        },
+        /* 验证 */
+        submitVerify() {
+            let inputVerify = this.data.inputVerify,
+                nextStep = true;
+
+            if (!_Verify.required(this.data.productName)) {
+                inputVerify.productName = true;
+                nextStep = false;
+            }
+            
+            if(this.data.fileList.length<1){
+                nextStep = false;
+            }
+
+            if (!_Verify.required(this.data.serialNumber)) {
+                inputVerify.serialNumber = true
+                nextStep = false;
+            }
+
+            if (!nextStep) {
+                this.setData({
+                    inputVerify
+                })
+            }
+
+            return nextStep;
+        },
+        /* 提交 */
+        submit() {
+            /* 验证必填项 */
+            if (!this.submitVerify()) return wx.showToast({
+                title: '请检查输入框内容!',
+                icon: "none"
+            })
+            /* 发送请求 */
+            _Http.basic({
+                "accesstoken": wx.getStorageSync('token'),
+                "classname": "customer.products.products",
+                "method": "insertOrModifyProducts",
+                "content": {
+                    "tagents_productid": this.data.tagents_productid,
+                    "fprodnum": this.data.serialNumber,
+                    "fprodname": this.data.productName,
+                    // "fprice": 100,
+                    // "fprodclassname": "墙布", 
+                    "fintroduction": this.data.productExplain,
+                    "ftag": this.data.productLabel,
+                    // "fnotes": "备注"
+                }
+            }).then(s => {
+                if (s.msg != "成功") return;
+                let putaway = 1;
+                if (this.data.checked) {
+                    putaway = 1
+                } else {
+                    putaway = 0
+                }
+                /* 设置是否上架 */
+                _Http.basic({
+                    "accesstoken": wx.getStorageSync('token'),
+                    "classname": "customer.products.products",
+                    "method": "updatesalestatus",
+                    "content": {
+                        "productlist": [{
+                            "tagents_productid": this.data.tagents_productid,
+                            "fisonsale": putaway
+                        }]
+                    }
+                }).then(s => {
+                    console.log(s)
+                })
+                this.setData({
+                    newlyBuilt: false
+                })
+                wx.showToast({
+                    title: s.msg,
+                })
+                setTimeout(() => {
+                    wx.navigateBack({
+                        delta: 1
+                    })
+                }, 500)
+            })
+        },
+        /* 是否上架 */
+        switchOnChange() {
+            this.setData({
+                checked: !this.data.checked
+            })
+        },
+        /* 上传图片 */
+        afterRead(event) {
+            // 初始化数据
+            this.setData({
+                logoErrTips: ""
+            })
+            var that = this
+            const {
+                file
+            } = event.detail;
+            var index = file.url.lastIndexOf(".");
+            var ext = file.url.substr(index + 1);
+            const fileName = file.url.split('/'),
+                name = fileName[fileName.length - 1];
+            //验证文件格式大小
+            const Uploader = _Verify.verifyUploader({
+                file
+            });
+            if (Uploader == "发送请求") {
+                wx.getFileSystemManager().readFile({
+                    filePath: file.url,
+                    // encoding:'utf-8',
+                    success: result => {
+                        //返回临时文件路径
+                        const fileData = result.data
+                        _Http.basic({
+                            "accesstoken": wx.getStorageSync('token'),
+                            "classname": "system.system.docManage",
+                            "method": "getFileName",
+                            "content": {
+                                "filename": name,
+                                "filetype": ext,
+                                "ownertable": "tagents_product",
+                                "ownerid": that.data.tagents_productid,
+                                "ftype": "default"
+                            }
+                        }).then(res => {
+                            that.uploadFile(res, fileData)
+                        }).catch(err => {
+                            console.log(err)
+                        })
+                    },
+                    fail: console.error
+                })
+            } else {
+                this.setData({
+                    logoErrTips: Uploader
+                })
+            }
+        },
+        /* 上传成功反馈 */
+        uploadFile(res, data) {
+            let that = this;
+            wx.request({
+                url: res.data.obsuploadurl,
+                method: "PUT",
+                data: data,
+                header: {
+                    'content-type': 'application/octet-stream' // 默认值
+                },
+                success() {
+                    _Http.basic({
+                        "accesstoken": wx.getStorageSync('token'),
+                        "classname": "system.system.docManage",
+                        "method": "uploadSuccess",
+                        "content": {
+                            "obsfilename": res.data.obsfilename
+                        }
+                    }).then(res => {
+                        if (res.msg != "成功") return;
+                        let data = {
+                            url: res.data[0].fobsurl,
+                            ownerid: res.data[0].ownerid,
+                            tattachmentid: res.data[0].tattachmentid
+                        };
+                        let fileList = that.data.fileList
+                        fileList.push(data)
+                        that.setData({
+                            fileList
+                        })
+                    }).catch(err => {
+                        console.log(err)
+                    })
+                }
+            })
+        },
+        /* 加工处理图片列表 */
+        manageImage(data) {
+            let fileList = [];
+            for (let i = 0; i < data.length && i < 3; i++) {
+                let a1 = {
+                    url: data[i].fobsurl,
+                    ownerid: data[i].ownerid,
+                    tattachmentid: data[i].tattachmentid
+                }
+                fileList.push(a1)
+            }
+            this.setData({
+                fileList,
+                fileListLength: data.length
+            })
+        },
+        /* 删除图片 */
+        imageDelete(e) {
+            const index = e.detail.index
+            _Http.basic({
+                "accesstoken": wx.getStorageSync('token'),
+                "classname": "system.system.docManage",
+                "method": "deleteDoc",
+                "content": {
+                    "ownertable": "tagents_product",
+                    "ownerid": this.data.fileList[index].ownerid,
+                    "tattachmentid": this.data.fileList[index].tattachmentid
+                }
+            }).then(s => {
+                if (s.msg != "成功") return;
+                this.manageImage(s.data)
+            })
+        },
+    }
+})

+ 7 - 0
components/My_product_new-change/index.json

@@ -0,0 +1,7 @@
+{
+    "component": true,
+    "usingComponents": {
+        "My_formCell":"../My_formCell/index",
+        "My_user_right":"../My_user_right/index"
+    }
+}

+ 25 - 0
components/My_product_new-change/index.wxml

@@ -0,0 +1,25 @@
+<!-- 团队新增或修改 -->
+<van-cell-group>
+    <van-field model:value="{{ productName }}" error="{{inputVerify.productName}}" bind:focus="inputFocus" bind:blur="inputBlur" data-name="productName" required label="产品名" placeholder="点击填写" input-align="right" size="large" />
+    <van-field model:value="{{ serialNumber }}" error="{{inputVerify.serialNumber}}" bind:focus="inputFocus" bind:blur="inputBlur" data-name="serialNumber" required label="产品编码" placeholder="点击填写" input-align="right" size="large" />
+
+    <My_formCell title="产品图" required uploading>
+        <view style="display: flex; align-items: center;">
+            <van-uploader file-list="{{ fileList }}" disabled="{{disabled}}" max-count="3" bind:after-read="afterRead" bind:delete="imageDelete" accept="image" deletable="{{ true }}" />
+            <view wx:if="{{!fileList.length}}" style="margin-top: -20rpx; color: #EE0A24;">
+                <van-icon name="clear" />请上传产品图片
+            </view>
+        </view>
+    </My_formCell>
+
+    <van-field model:value="{{ productLabel }}" label="标签" placeholder="点击填写" input-align="right" size="large" />
+    <van-field model:value="{{ productExplain }}" label="说明" placeholder="点击填写" input-align="right" size="large" />
+
+    <My_formCell title="产品上架">
+        <van-switch checked="{{ checked }}" bind:change="switchOnChange" size="24" />
+    </My_formCell>
+</van-cell-group>
+
+<view class="submit">
+    <van-button type="info" size="large" round bindtap="submit">保存</van-button>
+</view>

+ 7 - 0
components/My_product_new-change/index.wxss

@@ -0,0 +1,7 @@
+/* 提交按钮 */
+.submit{
+    width: 300rpx;
+    height: 100rpx;
+    margin: 40rpx auto 0;
+    
+}

+ 49 - 0
components/My_user_right/index.js

@@ -0,0 +1,49 @@
+// components/My_user_right/index.js
+Component({
+    /**
+     * 组件的属性列表
+     */
+    properties: {
+        option:{
+            type:Function
+        }
+    },
+
+    /**
+     * 组件的初始数据
+     */
+    data: {
+        /* 列表 */
+        list:[
+            {
+                id:"001",
+                value:"管理员"
+            },
+            {
+                id:"002",
+                value:"店长"
+            },{
+                id:"003",
+                value:"店员"
+            },{
+                id:"004",
+                value:"游客"
+            },
+        ],
+        indexSelect:0,//选项下标
+    },
+
+    /**
+     * 组件的方法列表
+     */
+    methods: {
+        /* 切换选项 */
+        itemChenge(e){
+            const {index}=e.target.dataset
+            this.triggerEvent("option",this.data.list[index])
+            this.setData({
+                indexSelect:index
+            })
+        }
+    }
+})

+ 4 - 0
components/My_user_right/index.json

@@ -0,0 +1,4 @@
+{
+    "component": true,
+    "usingComponents": {}
+}

+ 11 - 0
components/My_user_right/index.wxml

@@ -0,0 +1,11 @@
+<!-- 弹出层 用户权限设置 -->
+<view class="pup">
+    <view class="pup_title">更多操作</view>
+    <view class="pup_list" bindtap="itemChenge">
+        <!-- 列表 -->
+        <view wx:for="{{list}}" data-index="{{index}}" class="{{index==indexSelect?'right_select':''}}">{{item.value}}</view>
+        <!-- 按钮 -->
+        
+    </view>
+
+</view>

+ 42 - 0
components/My_user_right/index.wxss

@@ -0,0 +1,42 @@
+.pup_title{
+    width: 100vw;
+    height: 100rpx;
+    font-size: 34rpx;
+    font-weight: 600;
+    line-height: 100rpx;
+    text-align: center;
+    border-bottom: 1rpx solid #E4E4E4;
+}
+
+.pup_list{
+    display: flex;
+    flex-wrap: wrap;
+    justify-content: space-between;
+    width: 95vw;
+    margin: 15rpx auto 0;
+
+}
+.pup_list>view{
+    width: 32%;
+    height: 70rpx;
+    line-height: 70rpx;
+    text-align: center;
+    margin-bottom: 15rpx;
+    border: 1rpx solid #E4E4E4;
+}
+.right_select{
+    position: relative;
+    border: 1rpx solid #52C1F5 !important;
+    overflow: hidden;
+}
+.right_select::after{
+    position: absolute;
+    display: inline-block;
+    content: '';
+    width: 80rpx;
+    height: 80rpx;
+    background-color: #52C1F5;
+    bottom: -50rpx;
+    right: -40rpx;
+    transform: rotate(55deg);
+}

+ 22 - 2
pages/group&product/change.js

@@ -5,14 +5,34 @@ Page({
      * 页面的初始数据
      */
     data: {
-
+        pageType: "", //页面类型
     },
 
     /**
      * 生命周期函数--监听页面加载
      */
     onLoad: function (options) {
-
+        //团队管理
+        if (options.type == "group") {
+            this.setData({
+                pageType: "成员管理",
+            })
+            if (options.data) {
+                this.setData({
+                    memberMsg: JSON.parse(options.data)
+                })
+            }
+        } else if (options.type == "product") {
+            //产品管理
+            this.setData({
+                pageType: "产品管理",
+            })
+            if (options.data) {
+                this.setData({
+                    productData: JSON.parse(options.data)
+                })
+            }
+        }
     },
 
     /**

+ 2 - 1
pages/group&product/change.json

@@ -1,5 +1,6 @@
 {
   "usingComponents": {
-    "My_group_new-change":"../../components/My_group_new-change/index"
+    "My_group_new-change":"../../components/My_group_new-change/index",
+    "My_product_new-change":"../../components/My_product_new-change/index"
   }
 }

+ 4 - 1
pages/group&product/change.wxml

@@ -1 +1,4 @@
-<My_group_new-change></My_group_new-change>
+<!-- 成员新增或修改 -->
+<My_group_new-change wx:if="{{pageType=='成员管理'}}" memberMsg="{{memberMsg}}"></My_group_new-change>
+<!-- 产品新增或修改 -->
+<My_product_new-change wx:if="{{pageType=='产品管理'}}" productData="{{productData}}"></My_product_new-change>

+ 7 - 2
pages/group&product/index.js

@@ -5,14 +5,19 @@ Page({
      * 页面的初始数据
      */
     data: {
-
+        pageType: "", //页面类型 group团队管理 merchandise产品管理
+        fisadministrator:0,//账号类型 1 主 0 子
     },
 
     /**
      * 生命周期函数--监听页面加载
      */
     onLoad: function (options) {
-
+        //设置页面类型
+        this.setData({
+            pageType: options.type,
+            fisadministrator:getApp().globalData.accountList[wx.getStorageSync('userIndex')].fisadministrator
+        })
     },
 
     /**

+ 4 - 1
pages/group&product/index.wxml

@@ -1 +1,4 @@
-<My_group_list></My_group_list>
+<!-- 团队管理 -->
+<My_group_list wx:if="{{pageType=='group'}}" pageType="{{pageType}}" fisadministrator="{{fisadministrator}}"></My_group_list>
+<!-- 产品管理 -->
+<My_product_list wx:if="{{pageType=='merchandise'}}" pageType="{{pageType}}" fisadministrator="{{fisadministrator}}"></My_product_list>

+ 2 - 0
pages/login/index.js

@@ -83,12 +83,14 @@ Page({
             } else if (s.account_list[0].isnewregister == 1) {
                 console.log("新账号")
                 wx.setStorageSync('token', s.account_list[0].token);
+                wx.setStorageSync('userIndex', 0);
                 this.setData({
                     pageType: 1
                 })
             } else {
                 console.log("单账号")
                 wx.setStorageSync('token', s.account_list[0].token);
+                wx.setStorageSync('userIndex', 0);
                 wx.reLaunch({
                     url: "/pages/tabbarPage/Home/index"
                 })

+ 20 - 5
pages/tabbarPage/User/index.js

@@ -8,13 +8,13 @@ Page({
      */
     data: {
         userMsg: {}, //用户信息
+        userimg:{},//用户头像
     },
 
     /**
      * 生命周期函数--监听页面加载
      */
-    onLoad: function (options) {
-    },
+    onLoad: function (options) {},
     /* 跳转修改信息 */
     toUserMsg() {
         const data = JSON.stringify(this.data.userMsg)
@@ -22,6 +22,21 @@ Page({
             url: '/pages/userMessage/index?data=' + data
         })
     },
+    /* 跳转商户管理 */
+    setShop() {
+        wx.navigateTo({
+            url: '/pages/userPerfectMsg/index?type=edit',
+        })
+    },
+    /* 跳转管理页面,团队管理 产品管理 */
+    setPage(e) {
+        const {
+            type
+        } = e.target.dataset;
+        wx.navigateTo({
+            url: '/pages/group&product/index?type=' + type
+        })
+    },
     /**
      * 生命周期函数--监听页面初次渲染完成
      */
@@ -34,7 +49,7 @@ Page({
      */
     onShow: function () {
         this.getTabBar().init();
-        
+
         /* 获取个人信息 */
         _Http.basic({
             "accesstoken": wx.getStorageSync('token'),
@@ -42,10 +57,10 @@ Page({
             "method": "query_usermsg",
             "content": {}
         }).then(s => {
-            console.log(s)
             if (s.msg != "成功") return;
             this.setData({
-                userMsg: s.data[0]
+                userMsg: s.data[0],
+                userimg:s.data[0].attinfos[s.data[0].attinfos.length - 1]
             })
         })
     },

+ 4 - 4
pages/tabbarPage/User/index.wxml

@@ -5,7 +5,7 @@
 <view class="user_box">
   <!-- 用户头像 -->
   <view class="user_img">
-    <image src="{{userMsg.attinfos[0].fobsurl}}" mode="aspectFill"></image>
+    <image src="{{userimg.fobsurl}}" mode="aspectFill"></image>
   </view>
   <!-- 用户文字信息 -->
   <view class="user_text" bindtap="toUserMsg">
@@ -16,8 +16,8 @@
 </view>
 <!-- 功能列表 -->
 <van-cell-group>
-  <van-cell title="商品管理" is-link size="large" icon="shop-o" />
-  <van-cell title="产品管理" is-link size="large" icon="points" />
+  <van-cell title="商户管理" bindtap="setShop" is-link size="large" icon="shop-o" />
+  <van-cell title="产品管理" data-type="merchandise" bindtap="setPage" is-link size="large" icon="points" />
   <van-cell title="合作商家" is-link size="large" icon="friends-o" />
-  <van-cell title="团队管理" is-link size="large" icon="setting-o" border="{{ false }}" />
+  <van-cell title="团队管理" data-type="group" bindtap="setPage" is-link size="large" icon="setting-o" border="{{ false }}" />
 </van-cell-group>

+ 30 - 17
pages/userMessage/index.js

@@ -14,7 +14,8 @@ Page({
      * 页面的初始数据
      */
     data: {
-        fobsurl: {}, //头像
+        fobsurl: {}, //头像列表
+        userImg: {}, //使用头像地址
         fname: "", //用户名
         frole: "", //角色
         fphonenumber: "", //手机号
@@ -37,7 +38,8 @@ Page({
         /* 初始化数据 */
         const data = JSON.parse(options.data)
         this.setData({
-            fobsurl: data.attinfos[0],
+            fobsurl: data.attinfos,
+            userImg: data.attinfos[data.attinfos.length - 1],
             fname: data.fname,
             frole: data.frole,
             fsex: data.fsex,
@@ -69,6 +71,7 @@ Page({
                     success: result => {
                         //返回临时文件路径
                         const fileData = result.data
+                        const userid = getApp().globalData.accountList[wx.getStorageSync('userIndex')].userid
                         _Http.basic({
                             "accesstoken": wx.getStorageSync('token'),
                             "classname": "system.system.docManage",
@@ -77,21 +80,10 @@ Page({
                                 "filename": 'wx' + timestamp,
                                 "filetype": ext,
                                 "ownertable": "tenterprise_users",
-                                "ownerid": getApp().globalData.accountList[wx.getStorageSync('userIndex')].userid,
+                                "ownerid": userid,
                                 "ftype": "headportrait",
                             }
                         }).then(res => {
-                            /* 删除之前头像 */
-                            _Http.basic({
-                                "accesstoken": wx.getStorageSync('token'),
-                                "classname": "system.system.docManage",
-                                "method": "deleteDoc",
-                                "content": {
-                                    "ownertable": "tnotice",
-                                    "ownerid": that.data.fobsurl.ownerid,
-                                    "tattachmentid": that.data.fobsurl.tattachmentid
-                                }
-                            })
                             /* 上次并查询头像 */
                             that.uploadFile(res, fileData)
                         }).catch(err => {
@@ -103,7 +95,7 @@ Page({
             }
         })
     },
-
+    /* 上次成功反馈 */
     uploadFile(res, data) {
         var that = this
         wx.request({
@@ -117,13 +109,16 @@ Page({
                 _Http.basic({
                     "accesstoken": wx.getStorageSync('token'),
                     "classname": "system.system.docManage",
-                    "method": "uploadSuccsess",
+                    "method": "uploadSuccess",
                     "content": {
                         "obsfilename": res.data.obsfilename
                     }
                 }).then(res => {
+                    //删除之前头像
+                    that.imageDelete()
                     that.setData({
-                        fobsurl: res.data[0]
+                        fobsurl: res.data[0],
+                        userImg: res.data[res.data.length - 1],
                     })
                 }).catch(err => {
                     console.log(err)
@@ -131,6 +126,24 @@ Page({
             }
         })
     },
+    /* 删除替换头像 */
+    imageDelete() {
+        const userid = getApp().globalData.accountList[wx.getStorageSync('userIndex')].userid
+        for (let i = 0; i < this.data.fobsurl.length; i++) {
+        _Http.basic({
+            "accesstoken": wx.getStorageSync('token'),
+            "classname": "system.system.docManage",
+            "method": "deleteDoc",
+            "content": {
+                "ownertable": "tenterprise_users",
+                "ownerid": userid,
+                "tattachmentid": this.data.fobsurl[i].tattachmentid
+            }
+        }).then(s => {
+            console.log(s)
+        })
+        }
+    },
 
     /* input必填项获取焦点 */
     inputEssentialFocus(e) {

+ 1 - 1
pages/userMessage/index.wxml

@@ -1,7 +1,7 @@
 <!-- 用户修改信息页面 -->
 <view class="head">
   <view class="user_img">
-    <image src="{{fobsurl.fobsurl}}" mode="aspectFit"></image>
+    <image src="{{userImg.fobsurl}}" mode="aspectFill"></image>
   </view>
   <view class="change_img" bindtap="changeUserImg">修改头像</view>
 </view>

+ 60 - 9
pages/userPerfectMsg/index.js

@@ -14,6 +14,7 @@ Page({
      * 页面的初始数据
      */
     data: {
+        disabled: false, //是否禁用
         brandName: "", //品牌名称
         classify: "", //经营类目
         contact: "", //联系人
@@ -34,12 +35,30 @@ Page({
         logoErrTips: "", //logo格式/大小错误提示
         telephoneErrTitle: "", //手机号错误提示
         tagentsid: "", //上传图片使用
+        butText: "立即创建", //按钮显示文本
+        httpType:"商户认证",//请求方式
     },
 
     /**
      * 生命周期函数--监听页面加载
      */
     onLoad: function (options) {
+        //判断个人中心进入
+        if (options.type == "edit") {
+            //查看是否为主账号
+            const main = getApp().globalData.accountList[wx.getStorageSync('userIndex')];
+            //更改按钮显示文本并隐藏跳过按钮
+            this.setData({
+                butText: "提交修改",
+                httpType:"普通修改"
+            })
+            //非主账号禁用表单
+            if (main != 1) {
+                this.setData({
+                    disabled: true,
+                })
+            }
+        }
         /* 查询商户信息 */
         _Http.basic({
             "accesstoken": wx.getStorageSync('token'),
@@ -48,12 +67,42 @@ Page({
             "content": {}
         }).then(s => {
             if (s.msg != "成功") return;
-            this.setData({
-                tagentsid: s.data[0].tagentsid
-            })
+            let data = s.data[0];
+            console.log(data)
+            if (data.ftype == "普通商户") {
+                this.refreshData(data)
+            } else if (data.ftype == "个人" && data.fisauthenticating == 1) {
+                //商户认证中
+                wx.showToast({
+                    title: '商户认证审核中',
+                    icon: "none",
+                    duration: 5000
+                })
+            } else if (data.ftype == "个人" && data.fisauthenticating == 0) {
+                //商户未认证
+                this.setData({
+                    disabled: false,
+                    butText: "认证商户"
+                })
+            }
         })
     },
-    /* 必填项,获得焦点更新状态 */
+    /* 更新数据 */
+    refreshData(data) {
+        this.setData({
+            brandName: data.fbrand, //品牌名称
+            classify: data.saleprodclass, //经营类目
+            contact: data.fcontact, //联系人
+            telephone: data.fphonenumber, //电话号
+            companyName: data.fagentname, //公司名称
+            companyIntroduce: data.fintroduction, //公司介绍
+            companyAddress: data.faddress, //公司地址
+            userCode: data.fdutyparagraph, //统一社会编码
+            tagentsid: data.tagentsid,//id
+            fileList:data.attinfos[0].fobsurl
+        })
+    },
+    /* 必填项获焦 */
     isInputFocus(e) {
         let data = this.data.ErrRed;
         data[e.currentTarget.dataset.name] = false;
@@ -61,9 +110,10 @@ Page({
             ErrRed: data
         })
     },
-    /* 必填项点更新状态 */
+    /* 必填项失焦 */
     isInputBlur(e) {
         let data = this.data.ErrRed;
+        if (e.detail.value) return;
         data[e.currentTarget.dataset.name] = true;
         this.setData({
             ErrRed: data
@@ -148,12 +198,13 @@ Page({
                 _Http.basic({
                     "accesstoken": wx.getStorageSync('token'),
                     "classname": "system.system.docManage",
-                    "method": "uploadSuccsess",
+                    "method": "uploadSuccess",
                     "content": {
                         "obsfilename": res.data.obsfilename
                     }
                 }).then(res => {
                     if (res.msg != "成功") return;
+                    console.log(res)
                     const fileList = [{
                         url: res.data[0].fobsurl,
                         tattachmentid: res.data[0].tattachmentid
@@ -169,6 +220,7 @@ Page({
     },
     /* 删除logo */
     logoDelete() {
+        console.log(1)
         _Http.basic({
             "accesstoken": wx.getStorageSync('token'),
             "classname": "system.system.docManage",
@@ -179,7 +231,6 @@ Page({
                 "tattachmentid": this.data.fileList.tattachmentid
             }
         }).then(s => {
-            console.log(s)
             if (s.msg != "成功") return;
             this.setData({
                 fileList: "",
@@ -226,13 +277,12 @@ Page({
     setUserMsg() {
         //必填项,校验
         if (!this.inputCertain()) return;
-        console.log(!this.inputCertain())
         _Http.basic({
             "accesstoken": wx.getStorageSync('token'),
             "classname": "customer.tagents.tagents",
             "method": "modify_enterpriseAgent",
             "content": {
-                "ftype": "商户认证",
+                "ftype": this.data.httpType,
                 "data": [{
                     "fagentnum": this.data.companyName,
                     "fbrand": this.data.brandName,
@@ -246,6 +296,7 @@ Page({
             }
         }).then(s => {
             if (s.msg != "成功") return;
+            console.log(s)
             this.toHomePage();
         })
     },

+ 12 - 12
pages/userPerfectMsg/index.wxml

@@ -1,14 +1,14 @@
 <!-- 新用户注册完善商户信息页面 -->
 <van-cell-group>
-  <van-field model:value="{{ brandName }}" required clearable label="品牌名" placeholder="点击填写" input-align="right" size="large" bindfocus="isInputFocus" bindblur="isInputBlur" data-name="brandNameErrRed" error="{{ErrRed.brandNameErrRed&&!brandName}}" />
+  <van-field model:value="{{ brandName }}" disabled="{{disabled}}" required clearable label="品牌名" placeholder="点击填写" input-align="right" size="large" bindfocus="isInputFocus" bindblur="isInputBlur" data-name="brandNameErrRed" error="{{ErrRed.brandNameErrRed}}" />
   <!-- 自定义上传logo -->
   <view class="logo_box">
     <view class="logo_con">
-      <view class="logo_con_title">
+      <view class="logo_con_title" style="color: {{disabled?'#c8c9cc':''}};">
         <text class="">*</text>品牌logo
       </view>
       <view class="logo_up">
-        <van-uploader file-list="{{ fileList }}" max-count="1" bind:after-read="afterRead" bind:delete="logoDelete" accept="image" deletable="{{ true }}" />
+        <van-uploader file-list="{{ fileList }}" disabled="{{disabled}}" max-count="1" bind:after-read="afterRead" bind:delete="logoDelete" accept="image" deletable="{{ true }}" />
       </view>
       <!-- 错误提示 -->
       <view class="logo_err_tips" wx:if="{{logoErrTips}}">
@@ -17,16 +17,16 @@
     </view>
   </view>
   <!-- Vant组件 -->
-  <van-field model:value="{{ classify }}" required clearable label="经营类目" placeholder="点击选择" input-align="right" size="large" bindfocus="isInputFocus" bindblur="isInputBlur" data-name="classifyErrRed" error="{{ErrRed.classifyErrRed&&!classify}}" />
-  <van-field model:value="{{ contact }}" required clearable label="联系人" placeholder="点击填写" input-align="right" size="large" bindfocus="isInputFocus" bindblur="isInputBlur" data-name="contactErrRed" error="{{ErrRed.contactErrRed&&!contact}}" />
-  <van-field model:value="{{ telephone }}" error-message="{{telephoneErrTitle}}" error="{{ErrRed.telephoneErrRed}}" required clearable label="联系方式" placeholder="点击填写" input-align="right" size="large" data-name="telephoneErrRed" bindblur="inputTelephoneBlur" bindfocus="isInputFocus" />
-  <van-field model:value="{{ companyName }}" clearable label="注册公司名" placeholder="点击填写" input-align="right" size="large" />
-  <van-field model:value="{{ companyIntroduce }}" clearable label="公司介绍" placeholder="点击填写" input-align="right" size="large" />
-  <van-field model:value="{{ companyAddress }}" clearable label="地址" placeholder="点击填写" input-align="right" size="large" />
-  <van-field model:value="{{ userCode }}" clearable label="统一社会代码" placeholder="点击填写" input-align="right" size="large" />
+  <van-field model:value="{{ classify }}" disabled="{{disabled}}" required clearable label="经营类目" placeholder="点击填写" input-align="right" size="large" bindfocus="isInputFocus" bindblur="isInputBlur" data-name="classifyErrRed" error="{{ErrRed.classifyErrRed}}" />
+  <van-field model:value="{{ contact }}" disabled="{{disabled}}" required clearable label="联系人" placeholder="点击填写" input-align="right" size="large" bindfocus="isInputFocus" bindblur="isInputBlur" data-name="contactErrRed" error="{{ErrRed.contactErrRed}}" />
+  <van-field model:value="{{ telephone }}" disabled="{{disabled}}" error-message="{{telephoneErrTitle}}" error="{{ErrRed.telephoneErrRed}}" required clearable label="联系方式" placeholder="点击填写" input-align="right" size="large" data-name="telephoneErrRed" bindblur="inputTelephoneBlur" bindfocus="isInputFocus" />
+  <van-field model:value="{{ companyName }}" disabled="{{disabled}}" clearable label="注册公司名" placeholder="点击填写" input-align="right" size="large" />
+  <van-field model:value="{{ companyIntroduce }}" disabled="{{disabled}}" clearable label="公司介绍" placeholder="点击填写" input-align="right" size="large" />
+  <van-field model:value="{{ companyAddress }}" disabled="{{disabled}}" clearable label="地址" placeholder="点击填写" input-align="right" size="large" />
+  <van-field model:value="{{ userCode }}" disabled="{{disabled}}" clearable label="统一社会代码" placeholder="点击填写" input-align="right" size="large" />
 </van-cell-group>
 <!-- 按钮 -->
 <view class="login_but">
-  <van-button type="info" size="large" bindtap="setUserMsg">立即创建</van-button>
+  <van-button type="info" disabled="{{disabled}}" size="large" bindtap="setUserMsg">{{butText}}</van-button>
 </view>
-<view class="jumpOver" bindtap="toHomePage">跳过</view>
+<view wx:if="{{butText=='立即创建'}}" class="jumpOver" bindtap="toHomePage">跳过</view>

+ 1 - 1
utils/api.js

@@ -16,7 +16,7 @@ class ApiModel extends HTTP {
             data
         })
     }
-    /* 查询个人信息,修改个人信息,商户信息调整申请,上传附件,商户信息查询,商户信息调整申请 */
+    /* 基本通用 */
     basic(data) {
         return this.request({
             url: "",

+ 0 - 86
utils/uploadfile.js

@@ -1,86 +0,0 @@
-/* import {
-    ApiModel
-} from './api'
-const _Http = new ApiModel();
-
-class {
-    changeUserImg() {
-        wx.chooseMedia({
-            count: 1,
-            mediaType: ['image'],
-            sourceType: ['album', 'camera'],
-            camera: 'back',
-            success(res) {
-                const file = res.tempFiles[0];
-                var index = file.tempFilePath.lastIndexOf(".");
-                var ext = file.tempFilePath.substr(index + 1);
-                var timestamp = Date.parse(new Date());
-                wx.getFileSystemManager().readFile({
-                    filePath: file.tempFilePath,
-                    // encoding:'utf-8',
-                    success: result => {
-                        //返回临时文件路径
-                        const fileData = result.data
-                        _Http.basic({
-                            "accesstoken": wx.getStorageSync('token'),
-                            "classname": "system.system.docManage",
-                            "method": "getFileName",
-                            "content": {
-                                "filename": 'wx' + timestamp,
-                                "filetype": ext,
-                                "ownertable": "tenterprise_users",
-                                // "ownerid": getApp().globalData.accountList[0].userid,
-                                "ftype": "headportrait",
-                            }
-                        }).then(res => {
-                            // 删除之前头像
-                            _Http.basic({
-                                "accesstoken": wx.getStorageSync('token'),
-                                "classname": "system.system.docManage",
-                                "method": "deleteDoc",
-                                "content": {
-                                    "ownertable": "tnotice",
-                                    "ownerid": that.data.fobsurl.ownerid,
-                                    "tattachmentid": that.data.fobsurl.tattachmentid
-                                }
-                            })
-                            // 上次并查询头像
-                            that.uploadFile(res, fileData)
-                        }).catch(err => {
-                            console.log(err)
-                        })
-                    },
-                    fail: console.error
-                })
-            }
-        })
-    }
-
-    uploadFile(res, data) {
-        var that = this
-        wx.request({
-            url: res.data.obsuploadurl,
-            method: "PUT",
-            data: data,
-            header: {
-                'content-type': 'application/octet-stream' // 默认值
-            },
-            success() {
-                _Http.basic({
-                    "accesstoken": wx.getStorageSync('token'),
-                    "classname": "system.system.docManage",
-                    "method": "uploadSuccsess",
-                    "content": {
-                        "obsfilename": res.data.obsfilename
-                    }
-                }).then(res => {
-                    that.setData({
-                        fobsurl: res.data[0]
-                    })
-                }).catch(err => {
-                    console.log(err)
-                })
-            }
-        })
-    }
-} */

+ 1 - 1
utils/verify.js

@@ -33,7 +33,7 @@ class TestVerify {
 
     /* 必填项目/附件是否上传校验 */
     required(value, title) {
-        if (value.length <= 1) {
+        if (!value || value.length < 1) {
             if (title) wx.showToast({
                 title: title,
                 icon: 'none'