zhaoxiaohai преди 4 години
родител
ревизия
7ac2d82001

+ 6 - 0
components/My_GeneralTemplate/index.js

@@ -12,9 +12,15 @@ Component({
             type: String,
             value: "40rpx"
         },
+        /* 自定义头部使用 */
         NavHeight: {
             type: Number,
             value: 0
+        },
+        /* 是否溢出隐藏 */
+        overflowHidden: {
+            type: Boolean,
+            value: true
         }
     },
 

+ 1 - 1
components/My_GeneralTemplate/index.wxml

@@ -1,4 +1,4 @@
-<view class="container" style="padding-bottom: {{padBot}}; padding-top: {{padTop}};">
+<view class="container" style="padding-bottom: {{padBot}}; padding-top: {{padTop}}; {{overflowHidden?'overflow:hidden;':''}}">
     <slot></slot>
 </view>
 <!-- 背景图片 -->

+ 0 - 1
components/My_GeneralTemplate/index.wxss

@@ -5,7 +5,6 @@
     border-radius: 40rpx;
     box-sizing: border-box;
     margin: 252rpx auto 0;
-    overflow: hidden;
 }
 
 /* 顶部背景图片 */

+ 5 - 0
components/My_UploadFiles/index.js

@@ -141,6 +141,11 @@ Component({
                     //返回临时文件路径
                     const fileData = result.data
                     _Http.basic(data).then(res => {
+                        console.log(res)
+                        if(res.msg!="成功")return wx.showToast({
+                          title: res.data,
+                          icon:"none"
+                        })
                         that.uploadFile(res, fileData)
                     }).catch(err => {})
                 },

+ 121 - 25
pages/businessPartner/applyFor.js

@@ -8,25 +8,50 @@ Page({
      * 页面的初始数据
      */
     data: {
-        showBtn: -1,//选中下标
-        pattern: false,//显示方式选择
-        dropDownList:false,//显示下拉菜单
-        methodsList:['上游','下游','双向合作'],
-        addvalue:""
+        requestList: [], //请求列表
+        showBtn: -1, //选中下标
+        pattern: false, //显示方式选择
+        dropDownList: false, //显示下拉菜单
+        methodsList: ['上游', '下游', '双向合作'],
+        addvalue: ""
     },
-
     /**
      * 生命周期函数--监听页面加载
      */
     onLoad: function (options) {
-
+        _Http.basic({
+            "accesstoken": wx.getStorageSync('userData').token,
+            "classname": "customer.tagents.tagents",
+            "method": "query_cooperation",
+            "content": {
+                "getdatafromdbanyway": true,
+                "pageNumber": 1,
+                "pageSize": 20,
+                "where": {
+                    "condition": "",
+                    "ftype": "",
+                    "fstatus": "申请"
+                }
+            }
+        }).then(res => {
+            console.log(res)
+            if (res.msg != "成功") return wx.showToast({
+                title: res.data,
+                icon: 'none'
+            })
+            this.setData({
+                requestList: res.data
+            })
+        })
     },
-    onChange({detail}){
+    onChange({
+        detail
+    }) {
         this.setData({
-            addvalue:detail
+            addvalue: detail
         })
     },
-    onClick(){
+    onClick() {
         _Http.basic({
             "accesstoken": wx.getStorageSync('userData').token,
             "classname": "customer.tagents.tagents",
@@ -35,7 +60,7 @@ Page({
                 "tcooperationagentsid": "27303",
                 "ftype": "1"
             }
-        }).then(res=>{
+        }).then(res => {
             console.log(res)
         })
     },
@@ -46,41 +71,78 @@ Page({
     onReady: function () {
 
     },
-    modeSelect(e){
-        const { index } = e.target.dataset;
-        const content=(this.data.methodsList[index]=='双向合作')?'是否确定***作为您的'+this.data.methodsList[index]+'伙伴':'是否确定***作为您的'+this.data.methodsList[index]+'合作伙伴';
+    modeSelect(e) {
+        const {
+            index
+        } = e.target.dataset,
+            i = this.data.showBtn,
+            that = this;
+        const content = (this.data.methodsList[index] == '双向合作') ? '是否确定将“' + this.data.requestList[i].fagentname + '”作为您的“' + this.data.methodsList[index] + '”伙伴' : '是否确定将“' + this.data.requestList[i].fagentname + '”作为您的“' + this.data.methodsList[index] + '合作”伙伴';
+        let ftype = Number;
+        switch (this.data.methodsList[index]) {
+            case "上游":
+                ftype = 1;
+                break;
+            case "下游":
+                ftype = 2;
+                break;
+            case "双向合作":
+                ftype = 3;
+                break;
+        }
         wx.showModal({
             title: '提示',
             content: content,
             success: function (res) {
-              if (res.confirm) {
-                console.log('确定')
-              } else {
-                console.log('取消')
-              }
+                if (res.confirm) {
+                    _Http.basic({
+                        "accesstoken": wx.getStorageSync('userData').token,
+                        "classname": "customer.tagents.tagents",
+                        "method": "cooperation",
+                        "content": {
+                            "tcooperationagentsid": that.data.requestList[i].tcooperationagentsid,
+                            "ftype": ftype
+                        }
+                    }).then(res => {
+                        if (res.msg != '成功') return wx.showToast({
+                            title: res.data,
+                            icon: "none"
+                        });
+                        wx.showToast({
+                            title: '合作成功!',
+                        })
+                        let requestList = that.data.requestList;
+                        requestList.splice(i, 1);
+                        that.setData({
+                            requestList
+                        })
+                    })
+                } else {
+                    console.log('取消')
+                }
             }
-          })
+        })
     },
     /* 选择 */
     showBtnIndex(e) {
         const {
             index
         } = e.currentTarget.dataset;
-        if(index==this.data.showBtn) return;
+        if (index == this.data.showBtn) return;
         this.setData({
             pattern: false,
             showBtn: index,
         })
     },
     /* 选择合作方式 */
-    chooseCooperationMode(){
+    chooseCooperationMode() {
         this.setData({
-            dropDownList:!this.data.dropDownList
+            dropDownList: !this.data.dropDownList
         })
     },
-    hiddenDropDown(){
+    hiddenDropDown() {
         this.setData({
-            dropDownList:false
+            dropDownList: false
         })
     },
     /* 同意 */
@@ -89,6 +151,40 @@ Page({
             pattern: true
         })
     },
+    /* 拒绝 */
+    refuse(e) {
+        const {
+            index
+        } = e.currentTarget.dataset,
+            that = this;
+        wx.showModal({
+            title: "提示",
+            content: '是否确定拒绝“' + this.data.requestList[index].fbrand + '”的合作请求',
+            success(res) {
+                if (res.confirm) {
+                    _Http.basic({
+                        "accesstoken": wx.getStorageSync('userData').token,
+                        "classname": "customer.tagents.tagents",
+                        "method": "delete_cooperation",
+                        "content": {
+                            "tcooperationagentsid": that.data.requestList[index].tcooperationagentsid
+                        }
+                    }).then(res => {
+                        console.log(res)
+                        if (res.msg != '成功') return wx.showToast({
+                            title: res.data,
+                            icon: "none"
+                        });
+                        let requestList = that.data.requestList;
+                        requestList.splice(index, 1)
+                        that.setData({
+                            requestList
+                        })
+                    })
+                }
+            }
+        })
+    },
 
     /**
      * 生命周期函数--监听页面显示

+ 1 - 2
pages/businessPartner/applyFor.json

@@ -1,6 +1,5 @@
 {
   "usingComponents": {
-    "My_DisplayBox": "/components/My_DisplayBox/index",
-    "van-search": "@vant/weapp/search/index"
+    "My_DisplayBox": "/components/My_DisplayBox/index"
   }
 }

+ 14 - 23
pages/businessPartner/applyFor.wxml

@@ -1,18 +1,21 @@
 <My_DisplayBox title="请求列表" isMore="{{false}}">
     <image slot="display-box-img" class="display-title_image" src="/static/icon-05.png" mode="aspectFit"></image>
-    <view class="company-data" wx:for="{{3}}" data-index="{{index}}" bindtap="showBtnIndex">
-        <image class="company-data-image"></image>
-        <view class="company-data-brandName">
-            品牌a
+    <view class="company-data" wx:for="{{requestList}}" data-index="{{index}}" bindtap="showBtnIndex">
+        <image class="company-data-image" src="{{item.attinfos[0].fobsurl}}"></image>
+        <view class="company-data-brandName u-line-1">
+            {{item.fbrand}}
         </view>
-        <view wx:if="{{showBtn==index}}" class="company-data-but" >
+        <!-- 按钮 -->
+        <view wx:if="{{showBtn==index}}" class="company-data-but">
             <view wx:if="{{!pattern}}">
-                <van-button custom-class="custom-class-company-data jujue" style="margin-right: 20rpx;" catchtap="jumpForDetails">拒绝</van-button>
-                <van-button custom-class="custom-class-company-data" catchtap="ratify">同意</van-button>
-            </view> 
+                <van-button data-index="{{index}}" custom-class="custom-class-company-data jujue" style="margin-right: 20rpx;" catchtap="refuse">拒绝</van-button>
+                <van-button data-index="{{index}}" custom-class="custom-class-company-data" catchtap="ratify">同意</van-button>
+            </view>
+            <!-- 下拉选择 -->
             <view wx:else class="pattern">
-                <input type="text" readonly="readonly" autocomplete="off" bindfocus="chooseCooperationMode" bindblur="hiddenDropDown" style="width: 100%; height: 100%;position: absolute; opacity: 0;"/>
-                选择合作方式<van-icon name="arrow-down" />
+                <input type="text" readonly="readonly" autocomplete="off" bindfocus="chooseCooperationMode" bindblur="hiddenDropDown" style="width: 100%; height: 100%;position: absolute; opacity: 0;" />
+                选择合作方式
+                <van-icon name="arrow-down" />
                 <van-transition show="{{dropDownList}}" class="pattern-item-box" name="fade-down">
                     <view class="pattern-item" bindtap="modeSelect">
                         <view wx:for="{{methodsList}}" data-index="{{index}}">{{item}}</view>
@@ -21,16 +24,4 @@
             </view>
         </view>
     </view>
-</My_DisplayBox>
-
-<!-- 测试 -->
-<van-search
-  value="{{ addvalue }}"
-  label="地址"
-  placeholder="请输入搜索关键词"
-  use-action-slot
-  bind:change="onChange"
-  bind:search="onSearch"
->
-  <view slot="action" bind:tap="onClick">搜索</view>
-</van-search>
+</My_DisplayBox>

+ 1 - 1
pages/businessPartner/applyFor.wxss

@@ -31,7 +31,7 @@
 }
 
 .company-data-brandName {
-    flex: 1;
+    width: 300rpx;
     display: flex;
     align-items: center;
     font-size: 28rpx;

+ 141 - 8
pages/businessPartner/details.js

@@ -1,24 +1,157 @@
-// pages/businessPartner/details.js
+import {
+    ApiModel
+} from "../../utils/api";
+const _Http = new ApiModel;
 Page({
 
     /**
      * 页面的初始数据
      */
     data: {
-        checked:true
+        checked: true, //开关
+        partnerDetails: {}, //合作详情
+        dropDownList: false,
+        methodsList: ['上游', '下游', '双向合作'],
+        showType: '',
+        throttle: true, //截流
     },
 
     /**
      * 生命周期函数--监听页面加载
      */
     onLoad: function (options) {
-
+        const data = JSON.parse(options.data)
+        let showType = '';
+        switch (data.ftype) {
+            case 1:
+                showType = '上游';
+                break;
+            case 2:
+                showType = '下游';
+                break;
+            case 3:
+                showType = '双向合作';
+                break;
+        };
+        this.setData({
+            partnerDetails: data,
+            showType
+        })
+    },
+    /* 选择合作方式 */
+    modeSelect(e) {
+        const {
+            name
+        } = e.target.dataset, {
+                index
+            } = e.target.dataset,
+            that = this;
+        wx.showModal({
+            title: "提示",
+            content: "是否更改与“" + this.data.partnerDetails.fbrand + "”合作方式为" + name,
+            success(res) {
+                if (res.confirm) {
+                    _Http.basic({
+                        "accesstoken": wx.getStorageSync('userData').token,
+                        "classname": "customer.tagents.tagents",
+                        "method": "update_cooperation",
+                        "content": {
+                            "tcooperationagentsid": that.data.partnerDetails.tcooperationagentsid,
+                            "ftype": index + 1
+                        }
+                    }).then(res => {
+                        if (res.msg != '成功') return wx.showToast({
+                            title: res.data,
+                            icon: "none"
+                        });
+                        wx.showToast({
+                            title: '修改成功'
+                        });
+                        that.setData({
+                            showType: name,
+                            "partnerDetails.ftype": index + 1
+                        })
+                    })
+                }
+            }
+        })
+    },
+    /* 下拉获取焦点 */
+    dropDownFocus() {
+        this.setData({
+            dropDownList: true
+        })
+    },
+    /* 下拉失去焦点 */
+    dropDownBlur() {
+        this.setData({
+            dropDownList: false
+        })
+    },
+    /* 开关 */
+    onChange({
+        detail
+    }) {
+        const that = this;
+        if (this.data.checked) {
+            wx.showModal({
+                title: "提示",
+                content: '是否确定取消与“' + this.data.partnerDetails.fbrand + '”的合作关系',
+                success: function (res) {
+                    if (res.confirm) {
+                        that.setData({
+                            checked: detail
+                        });
+                        _Http.basic({
+                            "accesstoken": wx.getStorageSync('userData').token,
+                            "classname": "customer.tagents.tagents",
+                            "method": "delete_cooperation",
+                            "content": {
+                                "tcooperationagentsid": that.data.partnerDetails.tcooperationagentsid
+                            }
+                        }).then(res => {
+                            if (res.msg != '成功') return wx.showToast({
+                                title: res.data,
+                                icon: "error"
+                            })
+                            setTimeout(() => {
+                                wx.navigateBack({
+                                    delta: 1,
+                                })
+                            }, 500);
+                        })
+                    }
+                }
+            })
+        } else {
+            that.setData({
+                checked: detail
+            });
+        }
+    },
+    /* 预览合作商logo */
+    previewImg() {
+        const urls = [this.data.partnerDetails.attinfos[0].fobsurl]
+        wx.previewImage({
+            current: 1, // 当前显示图片的http链接
+            urls: urls
+        })
+    },
+    /* 提交 */
+    submit() {
+        if (!this.data.throttle) return;
+        this.setData({
+            throttle: false
+        });
+        wx.showToast({
+            title: '保存成功'
+        });
+        setTimeout(() => {
+            wx.navigateBack({
+                delta: 1,
+            })
+        }, 500);
     },
-
-    onChange({ detail }) {
-        // 需要手动对 checked 状态进行更新
-        this.setData({ checked: detail });
-      },
 
     /**
      * 生命周期函数--监听页面初次渲染完成

+ 12 - 4
pages/businessPartner/details.wxml

@@ -1,16 +1,24 @@
-<My_GeneralTemplate>
+<My_GeneralTemplate  overflowHidden="{{false}}"  padBot="20rpx">
     <view style="padding: 0 30rpx; box-sizing: border-box;">
         <My_GreyRectangleForm title="商户名" required>
-            <view class="right-text">商户名称</view>
+            <view class="right-text">{{partnerDetails.fbrand}}</view>
         </My_GreyRectangleForm>
         <My_GreyRectangleForm title="商户logo" required>
-            <image class="logo" src="/static/changeImg.png" mode="aspectFit"></image>
+            <image class="logo" src="{{partnerDetails.attinfos[0].fobsurl}}" mode="aspectFill" catchtap="previewImg"></image>
         </My_GreyRectangleForm>
         <My_GreyRectangleForm title="是否合作">
             <van-switch checked="{{ checked }}" bind:change="onChange" />
         </My_GreyRectangleForm>
         <My_GreyRectangleForm title="合作方式" required>
-            <input style="background-color: brown; width: 200rpx;" readonly type="text"/>
+            <input style="background-color: brown; position: absolute; opacity: 0;" readonly type="text" bindfocus="dropDownFocus" bindblur="dropDownBlur" />
+            <view class="right-text">{{showType}}
+                <van-icon size="12px" name="arrow-down" />
+            </view>
+            <van-transition show="{{dropDownList}}" class="pattern-item-box" name="fade-down">
+                <view class="pattern-item" bindtap="modeSelect">
+                    <view wx:for="{{methodsList}}" data-index="{{index}}" data-name="{{item}}">{{item}}</view>
+                </view>
+            </van-transition>
         </My_GreyRectangleForm>
     </view>
 </My_GeneralTemplate>

+ 46 - 0
pages/businessPartner/details.wxss

@@ -1,6 +1,9 @@
 @import "/css/form2.wxss";
 
 .right-text{
+    display: inline-block;
+    text-align: right;
+    width: 200rpx;
     font-size: 32rpx;
     color: rgba(0, 0, 0, .3);
 }
@@ -9,4 +12,47 @@
     width: 120rpx;
     height: 120rpx;
     border-radius: 8rpx;
+}
+
+.submit_but{
+    margin-top:160rpx;
+}
+
+
+/* 选择合作方式 */
+.pattern-item-box{
+    position:absolute;
+    width: 100%;
+    top: 65rpx;
+}
+
+.pattern-item{
+    width: 100%;
+    background-color: #ffffff;
+    border: 2rpx solid #e8e8e8;
+    border-radius: 8rpx;
+    bottom: -70rpx;
+    box-shadow: 0 0 8rpx 0 rgba(0, 0, 0, 0.1);
+}
+
+.pattern-item>view{
+    line-height: 70rpx;
+    text-align: center;
+    color: rgba(0, 0, 0, 0.5);
+}
+
+.pattern-item::after{
+    position: absolute;
+    content: '';
+    display: block;
+    width: 15rpx;
+    height: 15rpx;
+    background-color:#fff;
+    transform:rotate(45deg);
+    border: 2rpx solid #e8e8e8;
+    border-bottom: 0;
+    border-right: 0;
+    top: 0;
+    margin-top: -9rpx;
+    left: 75%;
 }

+ 29 - 19
pages/businessPartner/index.js

@@ -8,40 +8,28 @@ Page({
      * 页面的初始数据
      */
     data: {
-        showIndex:-1,//显示按钮的下标
+        showIndex: -1, //显示按钮的下标
+        cooperationList: [], //合作列表
     },
 
     /**
      * 生命周期函数--监听页面加载
      */
     onLoad: function (options) {
-        _Http.basic({
-            "accesstoken": wx.getStorageSync('userData').token,
-            "classname": "customer.tagents.tagents",
-            "method": "query_cooperation",
-            "content": {
-                "where": {
-                    "condition": "",
-                    "ftype":"",
-                    "fstatus":""
-                }
-            }
-        }).then(res=>{
-            console.log(res)
-        })
     },
     showBtnIndex(e) {
         const {
             index
         } = e.currentTarget.dataset;
         this.setData({
-            showIndex:index
+            showIndex: index
         })
     },
     /* 跳转商户 */
-    jumpForDetails(){
+    jumpForDetails() {
+        const data = this.data.cooperationList[this.data.showIndex];
         wx.navigateTo({
-          url: '/pages/businessPartner/details',
+            url: '/pages/businessPartner/details?data=' + JSON.stringify(data),
         })
     },
     /**
@@ -55,7 +43,29 @@ Page({
      * 生命周期函数--监听页面显示
      */
     onShow: function () {
-
+        _Http.basic({
+            "accesstoken": wx.getStorageSync('userData').token,
+            "classname": "customer.tagents.tagents",
+            "method": "query_cooperation",
+            "content": {
+                "getdatafromdbanyway": true,
+                "pageNumber": 1,
+                "pageSize": 20,
+                "where": {
+                    "condition": "",
+                    "ftype": "",
+                    "fstatus": "合作"
+                }
+            }
+        }).then(res => {
+            if (res.msg != '成功') return wx.showToast({
+                title: res.data,
+                icon: "none"
+            });
+            this.setData({
+                cooperationList: res.data
+            })
+        })
     },
 
     /**

+ 6 - 4
pages/businessPartner/index.wxml

@@ -4,11 +4,13 @@
 
 <My_DisplayBox title="商户列表" isMore="{{false}}">
     <image slot="display-box-img" class="display-title_image" src="/static/icon-05.png" mode="aspectFit"></image>
-    <view class="company-data" wx:for="{{5}}" data-index="{{index}}" bindtap="showBtnIndex">
-        <image class="company-data-image"></image>
+    <view class="company-data" wx:for="{{cooperationList}}" data-index="{{index}}" bindtap="showBtnIndex">
+        <image class="company-data-image" src="{{item.attinfos[0].fobsurl}}" mode="aspectFill"></image>
         <view class="company-data-text">
-            <view class="company-data-brandName">品牌a</view>
-            <view>经营类目:窗帘布</view>
+            <view class="company-data-brandName">{{item.fbrand}}</view>
+            <view wx:if="{{item.ftype==1}}">合作方式:上游</view>
+            <view wx:if="{{item.ftype==2}}">合作方式:下游</view>
+            <view wx:if="{{item.ftype==3}}">合作方式:双向合作</view>
         </view>
         <view class="company-data-but">
             <van-button wx:if="{{index==showIndex}}" custom-class="custom-class-company-data" catchtap="jumpForDetails">合作详情</van-button>

+ 14 - 2
pages/login/index.js

@@ -83,6 +83,7 @@ Page({
         };
         /* 储存 */
         wx.setStorageSync('userData', data);
+        console.log(wx.getStorageSync('userData'))
     },
     /* 登录页面提交数据 */
     loginSubmit() {
@@ -248,9 +249,20 @@ Page({
                 }]
             }
         }).then(res => {
-            console.log(res)
+            if (res.msg != "成功") return wx.showToast({
+                title: res.data,
+                icon: "none"
+            });
+            wx.showToast({
+                title: "提交成功",
+                icon: "none"
+            });
+            setTimeout(() => {
+                wx.redirectTo({
+                    url: '/pages/tabbar-pages/home/index',
+                })
+            }, 500);
         })
-
     },
     /* 获取焦点 */
     inputFocus(e) {

+ 14 - 2
pages/storeMessage/join.wxml

@@ -1,2 +1,14 @@
-<!--pages/storeMessage/join.wxml-->
-<text>pages/storeMessage/join.wxml</text>
+<My_GeneralTemplate padTop="50rpx" padBot="40rpx">
+    <view style="padding: 0 30rpx;">
+        <My_GreyRectangleForm title="商户组织">
+            <van-field autosize disabled="{{isDisabled}}" model:value="{{ fbrand }}" input-class="input-class" placeholder="点击选择" border="{{ false }}" />
+        </My_GreyRectangleForm>
+        <My_GreyRectangleForm title="商户编码">
+            <van-field autosize disabled="{{isDisabled}}" type="number" model:value="{{ fbrand }}" input-class="input-class" placeholder="点击填写" border="{{ false }}" />
+        </My_GreyRectangleForm>
+    </view>
+</My_GeneralTemplate>
+<!-- 提交按钮 -->
+<view wx:if="{{!isDisabled}}" class="submit_but">
+    <van-button bindtap="submit" custom-class="custom-class" round color="linear-gradient(180deg, #82E0E9 0%, #4BBECF 100%);">申请加入</van-button>
+</view>

+ 1 - 1
pages/storeMessage/join.wxss

@@ -1 +1 @@
-/* pages/storeMessage/join.wxss */
+@import "/css/form2.wxss";

+ 0 - 1
pages/storeMessage/select.wxml

@@ -1,4 +1,3 @@
-<!--   -->
 <My_GeneralTemplate padTop="120rpx" padBot="120rpx">
     <block wx:if="{{selectItem=='注册商户'}}">
         <view class="select_box select_index" data-name="注册商户" catchtap="selectAccess">

+ 1 - 0
pages/userCenter/index.js

@@ -154,6 +154,7 @@ Page({
         const {
             value
         } = e.detail;
+        console.log(_Verify.removeSpecialCharacters(value));
         if (name == 'femail') {
             var reg = /^([a-zA-Z]|[0-9])(\w|\-)+@[a-zA-Z0-9]+\.([a-zA-Z]{2,4})$/;
             if (!reg.test(value.trim())) {

+ 10 - 0
utils/verify.js

@@ -43,6 +43,16 @@ class TestVerify {
         return true;
     }
 
+    /* 删除特殊字符 */
+    removeSpecialCharacters(val) {
+        let reg = new RegExp("[`~!@#$^&*()=|{}':;',\\[\\].<>/?~!@#¥……&*()——|{}【】‘;:”“'。,、?]"); 
+        let rs = ""; 
+        for (let i = 0, l = val.length; i < val.length; i++) { 
+            rs = rs + val.substr(i, 1).replace(reg, ''); 
+        } 
+        return rs; 
+    }
+
     /* 附件格式,大小校验 */
     verifyUploader(data) {
         const {