Browse Source

商户管理系统

zhaoxiaohai 3 years ago
parent
commit
888d002e32

+ 3 - 1
app.json

@@ -41,7 +41,9 @@
         "pages/liveStreaming/index",
         "pages/businessPartner/index",
         "pages/businessPartner/details",
-        "pages/businessPartner/applyFor"
+        "pages/businessPartner/applyFor",
+        "pages/storeMessage/select",
+        "pages/storeMessage/join"
     ],
     "usingComponents": {
         "van-button": "@vant/weapp/button/index",

+ 56 - 56
pages/storeMessage/index.js

@@ -12,7 +12,7 @@ Page({
      * 页面的初始数据
      */
     data: {
-        fisadministrator: (wx.getStorageSync('userData').fisadministrator == 1) ? true : false, //是否主账号
+        isDisabled: false, //是否禁用
         butText: "保存", //按钮文字
         popups: false, //弹出层控制
         /*  */
@@ -45,33 +45,32 @@ Page({
      * 生命周期函数--监听页面加载
      */
     onLoad: function (options) {
-        _Http.basic({
-            "accesstoken": wx.getStorageSync('userData').token,
-            "classname": "customer.tagents.tagents",
-            "method": "query_enterpriseAgentsMain",
-            "content": {}
-        }).then(res => {
-            const data = res.data[0];
-            if (data.ftype == '个人' && data.fisauthenticating == 1) {
-                wx.showToast({
-                    title: '商户信息审核中',
-                    icon: "none",
-                    duration: 5000,
-                })
-                this.setData({
-                    butText: "审核中",
-                    fisadministrator: false
-                })
-                this.returnData(data)
-            } else if (data.ftype == '个人' && data.fisauthenticating == 0) {
-                this.setData({
-                    requestType: "商户认证",
-                    butText: "立即认证"
-                })
-            } else {
-                this.returnData(data)
-            };
-        })
+        // 判断主子账号 是否禁用
+        this.setData({
+            isDisabled: (wx.getStorageSync('userData').fisadministrator == 1) ? false : true
+        });
+        //判断进入方式
+        if (options.data == null) {
+            console.log("注册进入")
+            this.setData({
+                requestType: "商户认证"
+            })
+        } else if (options.data == 1) {
+            wx.showToast({
+                title: '商户信息审核中',
+                icon: 'none',
+                duration: 5000
+            });
+            this.setData({
+                requestType: "商户认证",
+                isDisabled: true
+            })
+        } else {
+            console.log("商户进入");
+            const data = JSON.parse(options.data);
+            console.log(data)
+            this.returnData(data)
+        }
     },
     /* 添加图片 */
     imageChange(data) {
@@ -81,9 +80,8 @@ Page({
     },
     /* 选择类目回调 */
     saleprodChange(arr) {
-        let {
-            detail
-        } = arr, showSaleprodclass = "";
+        let detail = arr.detail,
+            showSaleprodclass = "";
         for (let i = 0; i < detail.length; i++) {
             showSaleprodclass += (detail[i] + ',');
         };
@@ -96,23 +94,25 @@ Page({
     /* 返回数据 */
     returnData(data) {
         let attinfos = [];
-        for (let i = 0; i < data.attinfos.length; i++) {
-            let arr = {
+        // 格式化图片
+        if (data.attinfos.length >= 1) {
+            const i = data.attinfos.length - 1;
+            attinfos = [{
                 url: data.attinfos[i].fobsurl,
                 ownerid: data.attinfos[i].ownerid,
                 tattachmentid: data.attinfos[i].tattachmentid,
                 ownertable: data.attinfos[i].ownertable,
                 fdocument: data.attinfos[i].fdocument
-            }
-            attinfos.push(arr)
-        };
+            }]
+        }
 
         //格式化经营类目
         if (data.saleprodclass.length >= 1) {
             this.saleprodChange({
-                detali: data.saleprodclass
+                detail: data.saleprodclass
             })
         }
+
         this.setData({
             fbrand: data.fbrand,
             saleprodclass: data.saleprodclass,
@@ -123,21 +123,18 @@ Page({
             faddress: data.faddress,
             fdutyparagraph: data.fdutyparagraph,
             attinfos,
-            isLogo: imageData
         })
     },
     /* 提交数据 */
     submit() {
-        if (!this.data.fisadministrator) return wx.showToast({
-            title: '当前无权限修改',
-            icon: "none"
-        });
         if (!this.formVerify()) return wx.showToast({
             title: '请检查表单内容',
             icon: "error"
         });
-        /* 验证附件列表  */
-        if (!_Verify.required(this.data.isLogo, "请上传品牌logo")) return;
+        if (this.data.attinfos.length < 1) return wx.showToast({
+            title: '请上传品牌LOGO!',
+            icon: "none"
+        });
         /* 发送请求 */
         _Http.basic({
             "accesstoken": wx.getStorageSync('userData').token,
@@ -157,14 +154,17 @@ Page({
                 }]
             }
         }).then(res => {
-            if (res.data == '成功') {
-                wx.showToast({
-                    title: '提交成功',
-                });
+            if (res.msg != '成功') return wx.showToast({
+                title: res.data,
+            })
+            wx.showToast({
+                title: '提交成功',
+            });
+            setTimeout(() => {
                 wx.navigateBack({
                     delta: 1,
                 })
-            }
+            }, 500)
         })
     },
     /* 表单验证 */
@@ -177,7 +177,7 @@ Page({
             verify = false;
         }
         /* 验证经营类目  */
-        if (!_Verify.required(this.data.saleprodclass)) {
+        if (!_Verify.required(this.data.showSaleprodclass)) {
             errTips.saleprodclass = true;
             verify = false;
         }
@@ -213,7 +213,7 @@ Page({
     },
     /* 弹出层 */
     showPop() {
-        if (!this.data.fisadministrator) return;
+        if (this.data.isDisabled) return;
         this.setData({
             popups: !this.data.popups
         })
@@ -237,17 +237,17 @@ Page({
         const {
             value
         } = e.detail;
+        let errTips = this.data.errTips;
         /* 联系方式验证 */
         if (name == 'fphonenumber') {
-            _Verify.phoneNumber(this.data.fphonenumber, true)
+            if(!_Verify.phoneNumber(this.data.fphonenumber, true)) errTips[name] = true;
         }
         if (value.trim() == "") {
-            let errTips = this.data.errTips;
             errTips[name] = true;
-            this.setData({
-                errTips
-            })
         }
+        this.setData({
+            errTips
+        })
     },
     /* 更改logo */
     logoChange(data) {

+ 10 - 10
pages/storeMessage/index.wxml

@@ -2,39 +2,39 @@
 <My_GeneralTemplate padBot="20rpx">
     <view class="store_message">
         <My_GreyRectangleForm title="品牌名" required>
-            <van-field autosize disabled="{{!fisadministrator}}" model:value="{{ fbrand }}" data-name="fbrand" bind:focus='inputFocus' bindblur='inputBlur' error="{{errTips.fbrand}}" input-class="input-class" placeholder="点击填写" border="{{ false }}" />
+            <van-field autosize disabled="{{isDisabled}}" model:value="{{ fbrand }}" data-name="fbrand" bind:focus='inputFocus' bindblur='inputBlur' error="{{errTips.fbrand}}" input-class="input-class" placeholder="点击填写" border="{{ false }}" />
         </My_GreyRectangleForm>
 
         <My_GreyRectangleForm title="品牌LOGO" required>
-            <My_UploadFiles id="UploadFiles" UploadShow="{{true}}" fisadministrator="{{!fisadministrator}}" fileList="{{attinfos}}" bind:imageChange="logoChange" previewSize="65px" upType="Logo" maxCount='1' Tips="请上传logo图片" bindimageChange="imageChange"></My_UploadFiles>
+            <My_UploadFiles id="UploadFiles" UploadShow="{{true}}" fisadministrator="{{isDisabled}}" fileList="{{attinfos}}" bind:imageChange="logoChange" previewSize="65px" upType="Logo" maxCount='1' Tips="请上传logo图片" bindimageChange="imageChange"></My_UploadFiles>
         </My_GreyRectangleForm>
 
         <My_GreyRectangleForm title="经营类目" required>
             <view style="width: 100%; height: 100%; z-index: 999; position: absolute;" bindtap="showPop"></view>
-            <van-field autosize disabled="{{!fisadministrator}}" model:value="{{ showSaleprodclass }}" data-name="saleprodclass" bind:focus='inputFocus' bindblur='inputBlur' error="{{errTips.saleprodclass}}" input-class="input-class" placeholder="点击设置" border="{{ false }}" />
+            <van-field autosize disabled="{{isDisabled}}" model:value="{{ showSaleprodclass }}" data-name="saleprodclass" bind:focus='inputFocus' bindblur='inputBlur' error="{{errTips.saleprodclass}}" input-class="input-class" placeholder="点击设置" border="{{ false }}" />
         </My_GreyRectangleForm>
 
         <My_GreyRectangleForm title="联系人" required>
-            <van-field autosize disabled="{{!fisadministrator}}" model:value="{{ fcontact }}" data-name="fcontact" bind:focus='inputFocus' bindblur='inputBlur' error="{{errTips.fcontact}}" input-class="input-class" placeholder="点击填写" border="{{ false }}" />
+            <van-field autosize disabled="{{isDisabled}}" model:value="{{ fcontact }}" data-name="fcontact" bind:focus='inputFocus' bindblur='inputBlur' error="{{errTips.fcontact}}" input-class="input-class" placeholder="点击填写" border="{{ false }}" />
         </My_GreyRectangleForm>
 
         <My_GreyRectangleForm title="联系方式" required>
-            <van-field autosize disabled="{{!fisadministrator}}" model:value="{{ fphonenumber }}" data-name="fphonenumber" bind:focus='inputFocus' bindblur='inputBlur' error="{{errTips.fphonenumber}}" input-class="input-class" placeholder="点击填写" border="{{ false }}" />
+            <van-field autosize disabled="{{isDisabled}}" model:value="{{ fphonenumber }}" data-name="fphonenumber" bind:focus='inputFocus' bindblur='inputBlur' error="{{errTips.fphonenumber}}" input-class="input-class" placeholder="点击填写" border="{{ false }}" />
         </My_GreyRectangleForm>
 
         <My_GreyRectangleForm title="注册公司名" required>
-            <van-field autosize disabled="{{!fisadministrator}}" model:value="{{ fagentname }}" data-name="fagentname" bind:focus='inputFocus' bindblur='inputBlur' error="{{errTips.fagentname}}" input-class="input-class" placeholder="点击填写" border="{{ false }}" />
+            <van-field autosize disabled="{{isDisabled}}" model:value="{{ fagentname }}" data-name="fagentname" bind:focus='inputFocus' bindblur='inputBlur' error="{{errTips.fagentname}}" input-class="input-class" placeholder="点击填写" border="{{ false }}" />
         </My_GreyRectangleForm>
 
         <My_GreyRectangleForm title="公司介绍" required>
-            <van-field autosize disabled="{{!fisadministrator}}" model:value="{{ fintroduction }}" data-name="fintroduction" bind:focus='inputFocus' bindblur='inputBlur' error="{{errTips.fintroduction}}" input-class="input-class" placeholder="点击填写" border="{{ false }}" />
+            <van-field autosize disabled="{{isDisabled}}" model:value="{{ fintroduction }}" data-name="fintroduction" bind:focus='inputFocus' bindblur='inputBlur' error="{{errTips.fintroduction}}" input-class="input-class" placeholder="点击填写" border="{{ false }}" />
         </My_GreyRectangleForm>
 
         <My_GreyRectangleForm title="地址" required>
-            <van-field autosize disabled="{{!fisadministrator}}" model:value="{{ faddress }}" data-name="faddress" bind:focus='inputFocus' bindblur='inputBlur' error="{{errTips.faddress}}" input-class="input-class" placeholder="点击填写" border="{{ false }}" />
+            <van-field autosize disabled="{{isDisabled}}" model:value="{{ faddress }}" data-name="faddress" bind:focus='inputFocus' bindblur='inputBlur' error="{{errTips.faddress}}" input-class="input-class" placeholder="点击填写" border="{{ false }}" />
         </My_GreyRectangleForm>
         <My_GreyRectangleForm title="统一社会代码">
-            <van-field autosize disabled="{{!fisadministrator}}" model:value="{{ fdutyparagraph }}" input-class="input-class" placeholder="点击填写" border="{{ false }}" />
+            <van-field autosize disabled="{{isDisabled}}" model:value="{{ fdutyparagraph }}" input-class="input-class" placeholder="点击填写" border="{{ false }}" />
         </My_GreyRectangleForm>
     </view>
 </My_GeneralTemplate>
@@ -43,6 +43,6 @@
     <My_Checkbox title="经营类目" saleprodclass="{{saleprodclass}}" bind:saleprodChange="saleprodChange"></My_Checkbox>
 </van-action-sheet>
 <!-- 提交按钮 -->
-<view class="submit_but">
+<view wx:if="{{!isDisabled}}" class="submit_but">
     <van-button bindtap="submit" custom-class="custom-class" round color="linear-gradient(180deg, #82E0E9 0%, #4BBECF 100%);">{{butText}}</van-button>
 </view>

+ 66 - 0
pages/storeMessage/join.js

@@ -0,0 +1,66 @@
+// pages/storeMessage/join.js
+Page({
+
+    /**
+     * 页面的初始数据
+     */
+    data: {
+
+    },
+
+    /**
+     * 生命周期函数--监听页面加载
+     */
+    onLoad: function (options) {
+
+    },
+
+    /**
+     * 生命周期函数--监听页面初次渲染完成
+     */
+    onReady: function () {
+
+    },
+
+    /**
+     * 生命周期函数--监听页面显示
+     */
+    onShow: function () {
+
+    },
+
+    /**
+     * 生命周期函数--监听页面隐藏
+     */
+    onHide: function () {
+
+    },
+
+    /**
+     * 生命周期函数--监听页面卸载
+     */
+    onUnload: function () {
+
+    },
+
+    /**
+     * 页面相关事件处理函数--监听用户下拉动作
+     */
+    onPullDownRefresh: function () {
+
+    },
+
+    /**
+     * 页面上拉触底事件的处理函数
+     */
+    onReachBottom: function () {
+
+    },
+
+    /**
+     * 用户点击右上角分享
+     */
+    onShareAppMessage: function () {
+
+    }
+})

+ 3 - 0
pages/storeMessage/join.json

@@ -0,0 +1,3 @@
+{
+  "usingComponents": {}
+}

+ 2 - 0
pages/storeMessage/join.wxml

@@ -0,0 +1,2 @@
+<!--pages/storeMessage/join.wxml-->
+<text>pages/storeMessage/join.wxml</text>

+ 1 - 0
pages/storeMessage/join.wxss

@@ -0,0 +1 @@
+/* pages/storeMessage/join.wxss */

+ 89 - 0
pages/storeMessage/select.js

@@ -0,0 +1,89 @@
+// pages/storeMessage/select.js
+Page({
+
+    /**
+     * 页面的初始数据
+     */
+    data: {
+        selectItem: '注册商户', //选中项
+    },
+
+    /**
+     * 生命周期函数--监听页面加载
+     */
+    onLoad: function (options) {
+
+    },
+
+    /* 选择入口 */
+    selectAccess(e) {
+        const {
+            name
+        } = e.target.dataset;
+        this.setData({
+            selectItem: name
+        })
+    },
+
+    /* 跳转页面 */
+    submit() {
+        if (this.data.selectItem == '注册商户') {
+            wx.redirectTo({
+                url: '/pages/storeMessage/index',
+            })
+        } else {
+            wx.redirectTo({
+                url: '/pages/storeMessage/join',
+            })
+        }
+    },
+
+    /**
+     * 生命周期函数--监听页面初次渲染完成
+     */
+    onReady: function () {
+
+    },
+
+    /**
+     * 生命周期函数--监听页面显示
+     */
+    onShow: function () {
+
+    },
+
+    /**
+     * 生命周期函数--监听页面隐藏
+     */
+    onHide: function () {
+
+    },
+
+    /**
+     * 生命周期函数--监听页面卸载
+     */
+    onUnload: function () {
+
+    },
+
+    /**
+     * 页面相关事件处理函数--监听用户下拉动作
+     */
+    onPullDownRefresh: function () {
+
+    },
+
+    /**
+     * 页面上拉触底事件的处理函数
+     */
+    onReachBottom: function () {
+
+    },
+
+    /**
+     * 用户点击右上角分享
+     */
+    onShareAppMessage: function () {
+
+    }
+})

+ 3 - 0
pages/storeMessage/select.json

@@ -0,0 +1,3 @@
+{
+  "usingComponents": {}
+}

+ 34 - 0
pages/storeMessage/select.wxml

@@ -0,0 +1,34 @@
+<!--   -->
+<My_GeneralTemplate padTop="120rpx" padBot="120rpx">
+    <block wx:if="{{selectItem=='注册商户'}}">
+        <view class="select_box select_index" data-name="注册商户" catchtap="selectAccess">
+            <image data-name="注册商户" class="select_icon" src="/static/store-select/icon-04.png"></image>
+            <view data-name="注册商户">注册商户</view>
+            <image data-name="注册商户" class="select_rIcon" src="/static/store-select/icon-06.png"></image>
+        </view>
+
+        <view class="select_box" data-name="加入商户组织" bindtap="selectAccess" style="margin-top: 70rpx;">
+            <image data-name="加入商户组织" class="select_icon" src="/static/store-select/icon-02.png"></image>
+            <view data-name="加入商户组织">加入商户组织</view>
+            <image data-name="加入商户组织" class="select_rIcon" src="/static/store-select/icon-03.png"></image>
+        </view>
+    </block>
+    <block wx:else>
+        <view class="select_box" data-name="注册商户" catchtap="selectAccess">
+            <image data-name="注册商户" class="select_icon" src="/static/store-select/icon-01.png"></image>
+            <view data-name="注册商户">注册商户</view>
+            <image data-name="注册商户" class="select_rIcon" src="/static/store-select/icon-03.png"></image>
+        </view>
+
+        <view class="select_box  select_index" data-name="加入商户组织" bindtap="selectAccess" style="margin-top: 70rpx;">
+            <image data-name="加入商户组织" class="select_icon" src="/static/store-select/icon-04.png"></image>
+            <view data-name="加入商户组织">加入商户组织</view>
+            <image data-name="加入商户组织" class="select_rIcon" src="/static/store-select/icon-06.png"></image>
+        </view>
+    </block>
+</My_GeneralTemplate>
+
+<!-- 提交按钮 -->
+<view class="submit_but">
+    <van-button bindtap="submit" custom-class="custom-class" round color="linear-gradient(180deg, #82E0E9 0%, #4BBECF 100%);">下一步</van-button>
+</view>

+ 49 - 0
pages/storeMessage/select.wxss

@@ -0,0 +1,49 @@
+@import "/css/form2.wxss";
+/* 选择盒子 */
+.select_box {
+    display: flex;
+    align-items: center;
+    width: 548rpx;
+    height: 100rpx;
+    border-radius: 50rpx;
+    background-color: #F6F7F8;
+    border: 2rpx solid rgba(151, 151, 151, 0.05);
+    margin: 0 auto;
+    box-sizing: border-box;
+}
+
+/* 选中项 */
+.select_index {
+    background: #4EBFCF;
+    border: 0;
+}
+.select_index>view{
+    color: #fff !important;
+}
+
+/* 图标 */
+.select_icon {
+    width: 76rpx;
+    height: 76rpx;
+    margin-left: 24rpx;
+}
+
+/* 文字 */
+.select_box>view {
+    flex: 1;
+    font-size: 32rpx;
+    color: #000000;
+    margin-left: 10rpx;
+}
+
+/* 右边图标 */
+.select_rIcon {
+    width: 130rpx;
+    height: 48rpx;
+    margin-right: 30rpx;
+}
+
+/* 下一步按钮 */
+.submit_but{
+    margin-top: 60rpx;
+}

+ 30 - 2
pages/tabbar-pages/user/index.js

@@ -50,8 +50,36 @@ Page({
                 url: '/pages/productManagement/index'
             })
         } else if (name == '商户管理') {
-            wx.navigateTo({
-                url: '/pages/storeMessage/index'
+             /* 查询商户信息,有跳转到商户信息 没有跳转商户入口选择 */
+             _Http.basic({
+                "accesstoken": wx.getStorageSync('userData').token,
+                "classname": "customer.tagents.tagents",
+                "method": "query_enterpriseAgentsMain",
+                "content": {}
+            }).then(res => {
+                console.log(res)
+                if (res.msg != '成功') return;
+                const data = res.data[0];
+                //商户
+                if (data.ftype != '个人') return wx.navigateTo({
+                    url: '/pages/storeMessage/index?data=' + JSON.stringify(data),
+                });
+                if(data.fisauthenticating==1){
+                    //正在审核中
+                    return wx.navigateTo({
+                        url: '/pages/storeMessage/index?data='+ data.fisauthenticating,
+                    });
+                }else{
+                    //无商户信息子账号
+                    if(wx.getStorageSync('userData').fisadministrator==0) return wx.showToast({
+                      title: '暂无商户信息',
+                      icon:"none"
+                    })
+                    //未认证
+                    wx.navigateTo({
+                      url: '/pages/storeMessage/select',
+                    })
+                }
             })
         } else if (name == '合作商家') {
             wx.navigateTo({

+ 6 - 0
project.private.config.json

@@ -113,6 +113,12 @@
                     "pathName": "pages/tradeShow/index",
                     "query": "",
                     "scene": null
+                },
+                {
+                    "name": "选择操作",
+                    "pathName": "pages/storeMessage/select",
+                    "query": "",
+                    "scene": null
                 }
             ]
         }

BIN
static/store-select/icon-01.png


BIN
static/store-select/icon-02.png


BIN
static/store-select/icon-03.png


BIN
static/store-select/icon-04.png


BIN
static/store-select/icon-05.png


BIN
static/store-select/icon-06.png