فهرست منبع

Wesmiler 2021-0115第4期分销功能新增

wesmiler 5 سال پیش
والد
کامیت
f2c1bfc2da

+ 8 - 0
app/weixin/controller/MarketController.php

@@ -40,6 +40,14 @@ class MarketController extends MarketBaseController
     }
 
     /**
+     * 资料
+     * @return mixed
+     */
+    public function profile(){
+        return $this->fetch();
+    }
+
+    /**
      * 我的团队
      * @return mixed
      */

+ 62 - 0
public/themes/default/weixin/market/profile.html

@@ -0,0 +1,62 @@
+<include file="weixin@block:header"/>
+<link rel="stylesheet" href="__TMPL__/weixin/public/assets/css/profile/market-profile.css?v={$version}">
+<link rel="stylesheet" type="text/css" href="__TMPL__/weixin/public/assets/css/lcalendar.css?v={$version}" />
+<div id="app" v-cloak>
+    <div class="fanhui2">
+        <h1>个人信息</h1>
+        <a :href="id? '/weixin/member/profile?id='+id: '/weixin/member/profile'"><img
+                src="__TMPL__/weixin/public/assets/img/tubiao37.png"></a>
+    </div>
+    <div class="main" v-if="params.id">
+        <div class="gerxix_box">
+            <ul>
+                <li><img class="xix_tub" src="__TMPL__/weixin/public/assets/img/tubiao7.png">
+                    <h1>昵称</h1>
+                    <img class="minzu" src="__TMPL__/weixin/public/assets/img/tubiao10.png">
+                    <input class="tianx" type="text" placeholder="请填写" v-model="params.nickname">
+                </li>
+                <li >
+                    <img class="xix_tub" src="__TMPL__/weixin/public/assets/img/tubiao7.png">
+                    <h1>真实姓名</h1>
+                    <img class="minzu" src="__TMPL__/weixin/public/assets/img/tubiao10.png">
+                    <input class="tianx" type="text" placeholder="请填写" v-model="params.realname" readonly="true">
+                </li>
+                <li ><img class="xix_tub" src="__TMPL__/weixin/public/assets/img/xixtb1.png">
+                    <h1>出生日期</h1>
+                    <img class="minzu" src="__TMPL__/weixin/public/assets/img/tubiao10.png">
+                    <input class="tianx" type="text" name="date" id="birthday" :value="params.birthday_code+' '"  placeholder="请选择" :disabled="params.idcard_check==2? true: false"/>
+                </li>
+                <li>
+                    <img class="xix_tub" src="__TMPL__/weixin/public/assets/img/xixtb2.png">
+                    <h1>性别</h1>
+                    <img class="minzu" src="__TMPL__/weixin/public/assets/img/tubiao10.png">
+                    <input class="tianx select-value3" id="sex" type="text" placeholder="请选择" disabled="true">
+                </li>
+                <li><img class="xix_tub" src="__TMPL__/weixin/public/assets/img/xixtb5.png">
+                    <h1>所在地</h1>
+                    <img class="minzu" src="__TMPL__/weixin/public/assets/img/tubiao10.png">
+                    <input class="tianx select-value" id="now_address" type="text" placeholder="请选择">
+                </li>
+            </ul>
+        </div>
+        <div class="gerxix_box" style="margin-top: 10px;">
+            <div class="xixi_bt xixi_bt2">
+                <h1>联系方式</h1>
+                <p>微信及手机号仅作为紧急联系方式,不会暴露给任何用户。</p>
+            </div>
+            <ul>
+                <li><img class="xix_tub" src="__TMPL__/weixin/public/assets/img/xixtb12.png">
+                    <h1>微信号</h1>
+                    <img class="minzu" src="__TMPL__/weixin/public/assets/img/tubiao10.png">
+                    <input class="tianx" v-model="params.wechat_code" type="text" placeholder="请填写">
+                </li>
+            </ul>
+        </div>
+        <div class="ger_banc"><h1 @click="postSubmit()">保存</h1></div>
+    </div>
+</div>
+
+<script src="__TMPL__/weixin/public/assets/lib/city-picker.min.js?v={$version}"></script>
+<script src="__TMPL__/weixin/public/assets/lib/lcalendar.js?v={$version}" type="text/javascript"></script>
+<script src="__TMPL__/weixin/public/assets/js/profile/market-profile.js?v={$version}"></script>
+<include file="weixin@block:footer"/>

+ 42 - 0
public/themes/default/weixin/public/assets/css/market-profile.css

@@ -0,0 +1,42 @@
+.gerxix_box{padding: 15px 15px 0 15px;background: #fff;}
+
+.xixi_bt{height: 40px; background: #fff;border-bottom: 1px solid #efefef;}
+
+.xixi_bt2{height: 56px;}
+
+.xixi_bt h1{border-left: 4px solid #ffd132;font-size: 16px;color: #333;font-weight: bold;padding-left: 10px;height: 22px;line-height:22px;margin-top: 9px;}
+
+.xixi_bt p{font-size: 12px;color: #999;line-height: 20px;margin-top: 6px;}
+
+.gerxix_box li{height: 40px;width: 100%;border-bottom: 1px solid #efefef;overflow: hidden;}
+
+.xix_tub{width: 18px;height: 18ppx;float: left;margin-top:10px;}
+
+.gerxix_box li h1{float: left;font-size: 14px;line-height:40px;margin-left: 6px;}
+
+.tianx{font-size: 14px;color: #333;width: 55%;height: 40px;float: right;line-height: 40px;margin-right: 15px;text-align: right;border: none;outline: medium;background: #fff;}
+.code {
+    width: 30%;
+}
+.minzu{float: right;width:12px;margin-top:14px;}
+
+.yanzm {
+    font-size: 12px;
+    color: #333;
+    width: 20%;
+    height: 26px;
+    float: right;
+    line-height: 26px;
+    border: none;
+    outline: medium;
+    background: #ffd132;
+    margin-top: 7px;
+    width: 80px;
+    text-align: center;
+    border-radius: 4px;
+}
+.ger_banc{margin-top: 10px;height: 80px;padding: 15px;background: #fff;}
+
+.ger_banc h1{font-size: 18px;height: 45px;line-height: 45px;text-align: center;background: #ffd132;color: #333;border-radius: 6px;margin-top: 20px;}
+
+

+ 374 - 0
public/themes/default/weixin/public/assets/js/market-profile.js

@@ -0,0 +1,374 @@
+var app = new Vue({
+    'el': '#app',
+    'data': {
+        // 当前导航
+        curNav: 'member',
+        // 用户信息
+        memberInfo: {},
+        // 参数
+        params: {
+            id: 0,
+            address: '广西壮族自治区 南宁市 西乡塘区',
+            birthday: '',
+            birthday_code: ' ',
+            education: 0,
+            salary: 0,
+            occupation: '',
+            now_address: '广西壮族自治区 南宁市 西乡塘区',
+            home_address: '广西壮族自治区 南宁市 西乡塘区',
+        },
+        // 条件参数
+        ages: [],
+        // 身高
+        heights: [],
+        // 体重
+        weights: [],
+        // 收入
+        salarys: [],
+        // 学历
+        educations: [],
+        // 收入
+        incomes: [],
+        // 职业
+        positions: [],
+        // 性别
+        sexs: ['男', '女'],
+        // 婚姻状况
+        marrieds: [],
+        // 资产状况
+        propertys: [],
+        time: 60,
+        timeText: '获取验证码',
+        timeId: null,
+        // 提交状态
+        submitting: {'sendcode': null, 'submit': null},
+        id: 0,
+    },
+    created: function () {
+        this.id = getParam('id');
+        this.getParams();
+    },
+    updated: function () {
+        var _this = this;
+
+        _this.initData();
+    },
+
+    methods: {
+        // 获取用户信息
+        getInfo: function () {
+            var _this = this;
+            $.showLoading("数据加载中...");
+            $.post('/api/member/getHomeInfo', {type: 2}, function (res) {
+                $.hideLoading();
+                if (res.code == 'success') {
+                    _this.memberInfo = res.data
+                    _this.params = res.data.homeInfo
+                    _this.params.realname = _this.params.real_name;
+                    _this.params.mobile_txt = _this.params.mobile;
+                    _this.params.nickname = _this.params.user_nickname;
+                    //_this.initData()
+                } else if (res.code == 'exception') {
+                    $.showLoading(res.message);
+                } else {
+                    $.toast(res.message, 'text');
+                }
+            }, "json");
+        },
+        // 初始化参数
+        getParams: function () {
+            var _this = this;
+            $.post('/api/index/params', {}, function (res) {
+                if (res.code == 'success') {
+                    var paramDatas = res.data;
+                    _this.positions = typeof (paramDatas.positions) != 'undefined' ? paramDatas.positions : [""];
+                    _this.marrieds = typeof (paramDatas.marrieds) != 'undefined' ? paramDatas.marrieds : [""];
+                    if (paramDatas && paramDatas.incomes) {
+                        // _this.salarys.push('请选择');
+                        $.each(paramDatas.incomes, function (k, item) {
+                            if(k>0) {
+                                _this.salarys.push(item.name);
+                            }
+                        })
+                    }
+
+                    if (paramDatas && paramDatas.educations) {
+                        $.each(paramDatas.educations, function (k, item) {
+                            if(k>0){
+                                _this.educations.push(item);
+                            }
+                        })
+                    }
+
+                    if (paramDatas && paramDatas.propertys) {
+                        $.each(paramDatas.propertys, function (k, item) {
+                            if(k>0){
+                                _this.propertys.push(item);
+                            }
+                        })
+                    }
+
+                    _this.getInfo();
+                } else {
+                    $.toast(res.message, 'text');
+                }
+            }, "json");
+        },
+        // 编辑控制
+        checkInput: function(name, val){
+            if(val){
+                $.toast(name+'不能修改', 'text');
+                return false;
+            }
+            return true;
+        },
+        // 初始化
+        initData: function () {
+            var _this = this;
+            // 生日
+            var years = [];
+            var date = new Date();
+            var year = date.getFullYear()-20;
+            for(var i=20;i>=0;i--){
+                years.push(year-i);
+            }
+            _this.params.birthday_code = _this.params.birthday_code? _this.params.birthday_code+' ' : (year-10)+'-01-01 ';
+            $("#birthday").datetimePicker({
+                title: '请选择出生日期',
+                dateFormat: 'yyyy-mm-dd',
+                years: years,
+                /*min: '1980-01-01',
+                max: year+'-01-02',*/
+                yearSplit: '-',
+                monthSplit: '-',
+                dateSplit: '',
+                value: _this.params.birthday_code + ' ',
+                times: function () {
+                    return [];
+                },
+            });
+
+            // 居住地
+            var address = _this.params.now_address? $.trim(_this.params.now_address).split(' ') : []
+            if(address && address.length==2){
+                _this.params.now_address = $.trim(_this.params.now_address)+ ' 市辖区';
+            }
+
+            $("#now_address").val(_this.params.now_address);
+            $("#now_address").cityPicker({
+                title: "请选择所在地",
+                showDistrict: true,
+                onChange: function (picker, values, displayValues) {
+                    console.log(displayValues)
+                    _this.params.now_address = displayValues.join(' ');
+                }
+                // showDistrict: false
+            });
+
+            $.each(_this.sexs, function (k, item) {
+                if (_this.params.sex == k+1) {
+                    $("#sex").val(item);
+                }
+            });
+
+            $("#sex").picker({
+                title: "请选择性别",
+                cols: [
+                    {
+                        textAlign: 'center',
+                        values: _this.sexs,
+                        value: _this.params.sex,
+                    }
+                ],
+                onChange: function (data) {
+                    _this.params.sex = data.cols[0].activeIndex+1;
+                    $("#sex").attr('data-code', data.cols[0].activeIndex+1);
+                },
+                onConfirm: function (data) {
+                    _this.params.sex = data.cols[0].activeIndex+1;
+                },
+            });
+
+            $("#married").picker({
+                title: "请选择性别",
+                cols: [
+                    {
+                        textAlign: 'center',
+                        values: _this.marrieds,
+                        value: _this.params.married,
+                    }
+                ],
+                onChange: function (data) {
+                    _this.params.married = data.cols[0].activeIndex + 1;
+                    $("#married").attr('data-code', data.cols[0].activeIndex + 1);
+                },
+                onConfirm: function (data) {
+                    _this.params.married = data.cols[0].activeIndex + 1;
+                },
+            });
+
+        },
+        // 发送验证码
+        sendCode: function(){
+            var _this = this;
+            if(_this.submitting.sendcode){
+                return false;
+            }
+
+            if(_this.params.mobile_txt && _this.params.mobile_txt == _this.params.mobile){
+                $.toast('手机号码未修改','text');
+                return false;
+            }
+
+            if(_this.params.mobile == '' || _this.params.mobile == null){
+                $.toast('请填写手机号','text');
+                return false;
+            }
+
+            var patternMobile = /1[3-9][0-9]{9}/;
+            if (!patternMobile.test(_this.params.mobile)) {
+                $.toast("请填写正确格式的手机号码", 'text');
+                return false;
+            }
+
+            _this.submitting.sendcode = true;
+
+            // 发送验证码
+            $.showLoading('提交中');
+            $.post('/api/sms/sendCode',{mobile: _this.params.mobile, id: _this.params.id}, function(res){
+                $.hideLoading();
+                if(res.code == 'success'){
+                    _this.timeLock();
+                }else{
+                    _this.submitting.sendcode = false;
+                }
+                $.toast(res.message, 'text');
+
+            }, "json");
+        },
+        // 倒计时
+        timeLock: function(){
+            var _this = this;
+            _this.timeId = setInterval(function(){
+                _this.time--;
+                _this.timeText = _this.time+'s';
+                if(_this.time<=0){
+                    _this.time = 60;
+                    _this.timeText = '获取验证码';
+                    _this.submitting.sendcode = false;
+                    clearInterval(_this.timeId)
+                }
+
+            }, 1000);
+        },
+        // 提交数据
+        postSubmit: function(){
+            var _this = this;
+            if(_this.submitting.submit){
+                return false;
+            }
+            var sex = $("#sex").attr('data-code');
+            var education = $("#education").attr('data-code');
+            var occupation = $("#occupation").attr('data-code');
+            var occupation_text = $.trim($("#occupation").val());
+            if(typeof(sex) != 'undefined'){
+                _this.params.sex = $("#sex").attr('data-code');
+            }
+            if(typeof(education) != 'undefined'){
+                _this.params.education = $("#education").attr('data-code');
+            }
+            if(typeof(occupation) != 'undefined'){
+                _this.params.occupation = $("#occupation").attr('data-code');
+            }
+            if(occupation_text != '' && occupation_text != null){
+                _this.params.occupation = occupation_text;
+            }
+            _this.params.birthday = $("#birthday").val();
+            _this.params.age = $("#age").attr('data-code');
+            _this.params.salary = $("#salary").attr('data-code');
+            _this.params.height = $("#height").attr('data-code');
+            _this.params.weight = $("#weight").attr('data-code');
+            _this.params.now_address = $("#now_address").val();
+            _this.params.home_address = $("#home_address").val();
+            _this.params.married = $("#married").attr('data-code');
+            _this.params.property = $("#property").attr('data-code');
+            console.log(_this.params);
+            if(_this.params.nickname == ''){
+                $.toast("请填写昵称", 'text');
+                return false;
+            }
+
+            if(_this.params.sex <=0 || _this.params.sex == ''){
+                $.toast("请选择您的性别", 'text');
+                return false;
+            }
+
+            if(_this.params.now_address == '' || _this.params.now_address == null){
+                $.toast("请选择您的所在地", 'text');
+                return false;
+            }
+
+            if(_this.params.wechat_code == '' || _this.params.wechat_code == null){
+                $.toast("请填写微信号", 'text');
+                return false;
+            }
+
+            var params = JSON.parse(JSON.stringify(_this.params));
+            if(_this.params.mobile_txt != _this.params.mobile){
+                var patternMobile = /1[3-9][0-9]{9}/;
+                if (!patternMobile.test(_this.params.mobile)) {
+                    $.toast("请填写正确格式的手机号码", 'text');
+                    return false;
+                }
+
+                if(_this.params.code == '' || _this.params.code == null){
+                    $.toast("请填写短信验证码", 'text');
+                    return false;
+                }
+
+                var pattCode = /^[0-9]{4,6}$/;
+                if(!pattCode.test(_this.params.code)){
+                    $.toast("请填写正确格式的短信验证码", 'text');
+                    return false;
+                }
+            }else{
+                params.mobile = '';
+            }
+
+
+            _this.submitting.submit = true;
+            $.showLoading('数据保存中...');
+            $.ajax({
+                url: '/api/member/saveInfo',
+                data: params,
+                type: "post",
+                dataType: 'json',
+                success: function(res) {
+                    $.hideLoading();
+                    _this.submitting.submit = false;
+                    if(res.code == 'success'){
+                        $.toast(res.message,'text');
+                        setTimeout(function(){
+                            location.href = '/weixin/member/profile';
+                        }, 500);
+                    }else if (res.code == 'exception'){
+                        var url = res.data.url;
+                        $.toast(res.message,'text');
+                        if(url){
+                            setTimeout(function(){
+                                $.hideLoading();
+                                location.href = url;
+                            }, 500)
+                        }
+                    }else{
+                        $.toast(res.message,'text');
+                    }
+                },
+                error:function (res) {
+                    _this.submitting.submit = false;
+                    $.toast(res.message,'text');
+                }
+            });
+        }
+    }
+})