{{include file="public/header" /}}

<!-- right content start  -->
<div class="content-right">
	<div class="content">
		<!-- form start -->
		<form class="am-form form-validation view-save" action="{{:MyUrl('admin/user/save')}}" method="POST" request-type="ajax-url" request-value="{{:MyUrl('admin/user/index', $params)}}">
			<legend>
				<span class="am-text-default">用户{{if empty($data['id'])}}添加{{else /}}编辑{{/if}}</span>
				<a href="{{:MyUrl('admin/user/index', $params)}}" class="am-fr am-text-sm am-margin-top-sm am-icon-mail-reply"> 返回</a>
			</legend>
			<div class="am-form-group">
				<label>用户名</label>
				<input type="text" name="username" class="am-radius" placeholder="用户名" data-validation-message="用户名 2~30 个字符" {{if !empty($data)}} value="{{$data.username}}"{{/if}} />
			</div>
			<div class="am-form-group">
				<label>昵称</label>
				<input type="text" name="nickname" class="am-radius" placeholder="昵称" data-validation-message="昵称最多 16 个字符" {{if !empty($data)}} value="{{$data.nickname}}"{{/if}} />
			</div>

			<div class="am-form-group">
				<label>手机号码</label>
				<input type="text" name="mobile" class="am-radius" placeholder="手机号码" pattern="{{:MyConst('common_regex_mobile')}}" data-validation-message="手机号码格式错误" {{if !empty($data)}} value="{{$data.mobile}}"{{/if}} />
			</div>
			<div class="am-form-group">
				<label>电子邮箱</label>
				<input type="email" name="email" class="am-radius" placeholder="电子邮箱" data-validation-message="电子邮箱格式错误" {{if !empty($data)}} value="{{$data.email}}"{{/if}} />
			</div>

			<div class="am-form-group">
				<label>支付宝openid</label>
				<input type="text" name="alipay_openid" class="am-radius" placeholder="支付宝openid" data-validation-message="请填写支付宝openid" {{if !empty($data)}} value="{{$data.alipay_openid}}"{{/if}} />
			</div>
			<div class="am-form-group">
				<label>百度openid</label>
				<input type="text" name="baidu_openid" class="am-radius" placeholder="百度openid" data-validation-message="请填写百度openid" {{if !empty($data)}} value="{{$data.baidu_openid}}"{{/if}} />
			</div>
			<div class="am-form-group">
				<label>头条openid</label>
				<input type="text" name="toutiao_openid" class="am-radius" placeholder="头条openid" data-validation-message="请填写头条openid" {{if !empty($data)}} value="{{$data.toutiao_openid}}"{{/if}} />
			</div>
			<div class="am-form-group">
				<label>QQopenid</label>
				<input type="text" name="qq_openid" class="am-radius" placeholder="QQopenid" data-validation-message="请填写QQopenid" {{if !empty($data)}} value="{{$data.qq_openid}}"{{/if}} />
			</div>
			<div class="am-form-group">
				<label>QQunionid</label>
				<input type="text" name="qq_unionid" class="am-radius" placeholder="QQunionid" data-validation-message="请填写QQunionid" {{if !empty($data)}} value="{{$data.qq_unionid}}"{{/if}} />
			</div>
			<div class="am-form-group">
				<label>微信openid</label>
				<input type="text" name="weixin_openid" class="am-radius" placeholder="微信openid" data-validation-message="请填写微信openid" {{if !empty($data)}} value="{{$data.weixin_openid}}"{{/if}} />
			</div>
			<div class="am-form-group">
				<label>微信unionid</label>
				<input type="text" name="weixin_unionid" class="am-radius" placeholder="微信unionid" data-validation-message="请填写微信unionid" {{if !empty($data)}} value="{{$data.weixin_unionid}}"{{/if}} />
			</div>
			<div class="am-form-group">
				<label>微信webopenid</label>
				<input type="text" name="weixin_web_openid" class="am-radius" placeholder="微信webopenid" data-validation-message="请填写微信webopenid" {{if !empty($data)}} value="{{$data.weixin_web_openid}}"{{/if}} />
			</div>

			<div class="am-form-group">
				<label>生日</label>
				<input type="text" name="birthday" class="am-radius Wdate" placeholder="生日" pattern="{{:MyConst('common_regex_date')}}" data-validation-message="生日格式有误" {{if !empty($data)}} value="{{$data.birthday_text}}" {{/if}} onclick="WdatePicker({firstDayOfWeek:1,dateFmt:'yyyy-MM-dd'})" />
			</div>
			<div class="am-form-group">
				<label>详细地址</label>
				<input type="text" placeholder="详细地址" name="address" data-validation-message="详细地址2~60 个字符" class="am-radius" {{if !empty($data)}} value="{{$data.address}}"{{/if}} />
			</div>
			{{include file="lib/gender" /}}
			<div class="am-form-group">
				<label>积分</label>
				<input type="number" placeholder="积分" name="integral" data-validation-message="详细地址2~60 个字符" class="am-radius" {{if !empty($data)}} value="{{$data.integral}}"{{/if}} />
			</div>

			{{include file="lib/user_status" /}}

			<div class="am-form-group">
				<label>邀请用户ID</label>
				<input type="number" placeholder="邀请用户ID" name="referrer" data-validation-message="请输入邀请用户ID" min="0" class="am-radius" {{if !empty($data)}} value="{{$data.referrer}}"{{/if}} />
			</div>

			<div class="am-form-group">
				<label>登录密码</label>
				<input type="text" placeholder="登录密码" name="pwd" pattern="{{:MyConst('common_regex_pwd')}}" data-validation-message="登录密码格式 6~18 个字符之间" class="am-radius" value="" />
			</div>

			<!-- 插件扩展数据 start -->
			{{if isset($shopxo_is_develop) and $shopxo_is_develop eq true}}
                <div class="plugins-tag">
                    <span>plugins_view_admin_user_save</span>
                </div>
            {{/if}}
			{{if !empty($plugins_view_admin_user_save_data) and is_array($plugins_view_admin_user_save_data)}}
				<div class="am-alert am-alert-secondary">
					<label class="am-text-sm am-text-warning">该区域为插件扩展数据，请按照插件文档填写相应的值</label>
					<div>
						{{foreach $plugins_view_admin_user_save_data as $hook}}
		                    {{if is_string($hook) or is_int($hook)}}
		                        {{$hook|raw}}
		                    {{/if}}
		                {{/foreach}}
					</div>
				</div>
			{{/if}}
			<!-- 插件扩展数据 end -->

			<div class="am-form-group am-form-group-refreshing am-margin-top-lg am-padding-left-0">
				<input type="hidden" name="id" {{if !empty($data)}} value="{{$data.id}}"{{/if}} />
				<button type="submit" class="am-btn am-btn-primary am-radius btn-loading-example am-btn-sm am-btn-block" data-am-loading="{loadingText:'处理中...'}">保存</button>
			</div>
		</form>
        <!-- form end -->
	</div>
</div>
<!-- right content end  -->
		
<!-- footer start -->
{{include file="public/footer" /}}
<!-- footer end -->