addMerchant.html 23.8 KB
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488
<!--  第一部分:菜单导航 start -->

<!--  第一部分:菜单导航 end -->
<div class="wrapper wrapper-content">
  <div class="row">
    <div class="col-lg-12">
      <div class="ibox float-e-margins">
        <div style="text-align: left;">
          <button class="btn btn-success aButton" ng-show="createAccouts.length > 0 || mark == 'edit'" ng-click="save()"
            ng-disabled="saveBtnDisabled">完成</button>
          <a href="javascript:void(0)" class="btn btn-default aButton" ng-click="back()">返回</a>
        </div>
        <div class="ibox-title">
          <h3>{{title}}</h3>
        </div>
        <div class="ibox-content" ng-show="createAccouts.length > 0 || mark == 'edit'">
          <div class="row">
            <form name="merchantForm" role="form" class="form-horizontal" novalidate>
              <div class="row">
                <div class="form-group col-sm-6">
                  <div class="col-sm-10">
                    <p class="text-danger form-text" style="margin-left: 8%">标 * 号的部分为必填项</p>
                  </div>
                </div>
              </div>
              <div class="row">
                <div class="form-group col-sm-6">
                  <label class="col-sm-2 control-label required">商户名称:</label>
                  <div class="col-sm-6">
                    <input type="text" class="form-control" placeholder="请输入商户名称" name="merchantName"
                      ng-model="merchant.merchantName" ng-required="true" maxlength="50" ng-disabled="mark=='edit'"
                      v-async="validMerchantName(value)" ng-model-options="{ updateOn: 'blur',allowInvalid: true }">
                    <div class="m-t-xs" ng-show="merchantForm.merchantName.$invalid && submitted">
                      <p ng-show="merchantForm.merchantName.$error.required" class="text-danger form-text">请输入商户名称</p>
                      <p ng-show="merchantForm.merchantName.$error.vAsync" class="text-danger form-text">商户名称已存在</p>
                    </div>
                  </div>
                </div>
              </div>
              <div class="row">
                <div class="form-group col-sm-6">
                  <label class="col-sm-2 control-label">商户简称:</label>
                  <div class="col-sm-6">
                    <input type="text" class="form-control" placeholder="请输入商户简称" name="name"
                      ng-model="merchant.shortName" maxlength="30">
                  </div>
                </div>
              </div>

              <div class="row">
                <div class="form-group col-sm-6" ng-show="mark != 'edit'">
                  <label class="col-sm-2 control-label required">账户等级:</label>
                  <div class="col-sm-6">
                    <ui-select class="a_select w-80 pd0 " ng-model="$parent.userType" name="userType"
                      ng-change="changeUserType()" theme="select2" ng-required="mark != 'edit'" style="width:150px">
                      <ui-select-match placeholder="全部">{{$select.selected.confValue}}
                      </ui-select-match>
                      <ui-select-choices repeat="item in createAccouts | filter:{confValue:$select.search}">
                        <span ng-bind="item.confValue"></span>
                      </ui-select-choices>
                    </ui-select>
                    <div class="m-t-xs" ng-show="merchantForm.userType.$invalid && submitted">
                      <p ng-show="merchantForm.userType.$error.required" class="text-danger form-text">请选择商户类型</p>
                    </div>
                  </div>
                </div>
              </div>

              <div class="row">
                <div class="form-group col-sm-6">
                  <label class="col-sm-2 control-label required">账户类型:</label>
                  <div class="col-sm-6">
                    <ui-select class="a_select w-80 pd0 " ng-model="$parent.merchantType" name="merchantType"
                      theme="select2" ng-required="true" style="width:150px" ng-disabled="mark=='edit'">
                      <ui-select-match placeholder="全部">{{$select.selected.name}}
                      </ui-select-match>
                      <ui-select-choices repeat="item in merchantTypeList | filter:{name:$select.search}">
                        <span ng-bind="item.name"></span>
                      </ui-select-choices>
                    </ui-select>
                    <div class="m-t-xs" ng-show="merchantForm.merchantType.$invalid && submitted">
                      <p ng-show="merchantForm.merchantType.$error.required" class="text-danger form-text">请选择商户分类</p>
                    </div>
                  </div>
                </div>
              </div>

              <div class="row">
                <div class="form-group col-sm-6"
                  ng-if="$root.loginUser.isSuper && mark != 'edit' && userType.confKey != 5">
                  <label class="col-sm-2 control-label required">上级商户号:</label>
                  <div class="col-sm-6">
                    <input type="text" class="form-control" placeholder="请输入上级商户号" name="parentMerchantId"
                      ng-model="$parent.merchant.parentMerchantId" maxlength="9" ng-pattern="/^[1-9]\d*$/"
                      v-async="validMerchantId()" ng-model-options="{ updateOn: 'blur',allowInvalid: true }"
                      ng-required="true" ng-change="changeMerchantId()">
                    <div class="m-t-xs" ng-show="merchantForm.parentMerchantId.$invalid && submitted">
                      <p ng-show="merchantForm.parentMerchantId.$error.required" class="text-danger form-text">请输入上级商户号
                      </p>
                      <p ng-show="merchantForm.parentMerchantId.$error.pattern" class="text-danger form-text">请输入正确的商户号
                      </p>
                      <p ng-show="merchantForm.parentMerchantId.$error.vAsync" class="text-danger form-text">
                        {{validParentMerchantMsg}}</p>
                    </div>
                  </div>
                </div>
              </div>
              <div class="row">
                <div class="form-group col-sm-6">
                  <label class="col-sm-2 control-label">区域:</label>
                  <div class="col-sm-6">
                    <ui-select class="a_select w-80 pd0 " ng-model="$parent.merchant.region" name="region"
                      theme="select2" style="width:150px">
                      <ui-select-match placeholder="全部">{{$select.selected.confValue}}
                      </ui-select-match>
                      <ui-select-choices repeat="item in regionList | filter:{confValue:$select.search}">
                        <span ng-bind="item.confValue"></span>
                      </ui-select-choices>
                    </ui-select>
                  </div>
                </div>
              </div>
              
			  <div class="row">
                <div class="form-group col-sm-6">
                  <label class="col-sm-2 control-label">驻店联系人:</label>
                  <div class="col-sm-6">
                    <input type="text" class="form-control" placeholder="请输入驻店联系人" name="stayContactName"
                           ng-model="merchant.stayContactName" maxlength="10">
                  </div>
                </div>
              </div>
              <div class="row">
                <div class="form-group col-sm-6">
                  <label class="col-sm-2 control-label">驻店电话:</label>
                  <div class="col-sm-6">
                    <input type="text" class="form-control" placeholder="请输入驻店电话" name="stayPhone"
                           ng-model="merchant.stayPhone" maxlength="15">
                  </div>
                </div>
              </div>
              <div class="row">
                <div class="form-group col-sm-6">
                  <label class="col-sm-2 control-label">SAP代码:</label>
                  <div class="col-sm-6">
                    <input type="text" class="form-control" placeholder="请输入SAP代码" name="sap"
                           ng-model="merchant.sap" maxlength="10">
                  </div>
                </div>
              </div>

              <div class="row">
                <div class="form-group col-sm-6"
                  ng-if="allChannelList.length > 0 && mark != 'edit' && userType.confKey == 5">
                  <label class="col-sm-2 control-label required">渠道:</label>
                  <div class="col-sm-6">
                    <ui-select class="a_select w-80 pd0 " ng-model="$parent.merchant.channel" name="channel"
                      theme="select2"
                      ng-required="allChannelList.length > 0 && mark != 'edit' && userType.confKey == 5">
                      <ui-select-match placeholder="全部">{{$select.selected.channelName}}
                      </ui-select-match>
                      <ui-select-choices repeat="item in allChannelList | filter:{channelName:$select.search}">
                        <span ng-bind="item.channelName"></span>
                      </ui-select-choices>
                    </ui-select>
                    <div class="m-t-xs" ng-show="merchantForm.channel.$invalid && submitted">
                      <p ng-show="merchantForm.channel.$error.required" class="text-danger form-text">请选择渠道</p>
                    </div>
                  </div>
                </div>
              </div>

              <div class="row">
                <div class="form-group col-sm-6">
                  <label class="col-sm-2 control-label">商户地址:</label>
                  <div class="col-sm-6">
                    <input type="text" class="form-control" name="address" ng-model="merchant.address" name="address"
                      maxlength="50" readonly placeholder="请选择商户地址">
                    <span class="span-btn btn-primary" id='address_btn' ng-click="openMapDialog()">选择地址</span>
                  </div>
                </div>
              </div>
              <div class="form-group storeImg">
                <label class="col-sm-1 control-label">门店照片:</label>
                <div class="col-sm-11">
                  <!-- <div style="width: 228px; height: 151px;position: relative;" ng-click="imgCrop()">
                    <div class="addImg" ng-show="!merchant.shopPhoto">+</div>
                    <img ng-show="merchant.shopPhoto" style="width: 100%; height: 100%;" ng-src="{{merchant.shopPhoto}}" alt="">
                    <span class="icon" ng-class="isSelected ? 'selected' : ''"></span>
                  </div> -->
                  <div ng-repeat="item in merchantImgs track by $index"
                    style="width: 228px; height: 151px;position: relative;display: inline-block;"
                    ng-click="imgCrop($index)">
                    <div class="addImg" ng-show="!item">+</div>
                    <img ng-show="item" style="width: 100%; height: 100%;" ng-src="{{item}}" alt="">
                    <!-- <img ng-show="item" class="del-icon" ng-click="handleDelImg($event,$index)" src="images/clear.png"/> -->
                    <!-- <span class="icon"></span> -->
                  </div>
                  <div class="">(请上传图片大小在10MB内的jpg、jpeg、png、bmp文件)</div>
                </div>
              </div>

              <div class="row">
                <div class="form-group col-sm-6">
                  <label class="col-sm-2 control-label">联系人:</label>
                  <div class="col-sm-6">
                    <input type="text" class="form-control" placeholder="请输入联系人" name="contactName"
                      ng-model="merchant.contactName" maxlength="10">
                  </div>
                </div>
              </div>

              <div class="row">
                <div class="form-group col-sm-6">
                  <label class="col-sm-2 control-label">商户电话:</label>
                  <div class="col-sm-6">
                    <input type="text" class="form-control" ng-required="merchant.phone" placeholder="请输入联系电话"
                      name="phone" ng-model="merchant.phone" minlength="3" maxlength="15">
                    <div class="m-t-xs" ng-show="merchantForm.phone.$invalid && submitted">
                      <p class="text-danger form-text">请输入正确的电话号码</p>
                    </div>
                  </div>
                </div>
              </div>

              <div class="row">
                <div class="form-group col-sm-6">
                  <label class="col-sm-2 control-label">营业时间:</label>
                  <div class="col-sm-6" style="display:flex;">
                    <div class="input-group clockpicker" style="float:left; width:47%;">
                      <input type="text" class="form-control" readonly ng-model="businessHours.openTime">
                      <span ng-show="openShow" class="input-clear" ng-click="clearOpenTime()">×</span>
                      <span class="input-group-addon">
                        <span class="glyphicon glyphicon-time"></span>
                      </span>
                    </div>
                    <div style="margin: 0 5px;line-height: 30px;"> - </div>
                    <div class="input-group clockpicker" style="float:left; width:47%;">
                      <input type="text" class="form-control" readonly ng-model="businessHours.closeTime">
                      <span ng-show="closeShow" class="input-clear" ng-click="clearCloseTime()">×</span>
                      <span class="input-group-addon">
                        <span class="glyphicon glyphicon-time"></span>
                      </span>
                    </div>
                  </div>
                  <div class="m-t-xs" ng-show="timeShowError">
                    <p class="text-danger form-text">请输入正确的营业时间</p>
                  </div>
                </div>
              </div>

              <div class="row">
                <div class="form-group col-sm-6">
                  <label class="col-sm-2 control-label">营业范围:</label>
                  <div class="col-sm-8">
                    <label ng-repeat="item in labelList" style="margin-right: 20px;">
                      <input icheck type="checkbox" name="" ng-model="item.checked" ng-change="changeLabelItem(item)"
                        ng-disabled="selectLabelName.length >= 10 && !item.checked"> {{item.name}}
                    </label>
                    <div ng-repeat="item in curSelfLabelList" class="selfLabel">
                      <input type="text" class="form-control" placeholder="请自定义营业范围,建议不超过10个" ng-model="item.name"
                        ng-change="changeLabelItem()" maxlength="4"
                        ng-disabled="selectLabelName.length >= 10 && !item.name">
                      <div class="add" ng-click="addLabel();"
                        ng-if="$last && curSelfLabelList.length < 10 && selectLabelName.length < 10">+</div>
                      <div class="add" ng-click="deleteLabel($index);"
                        ng-if="!($index == 0 && curSelfLabelList.length == 1)">-</div>
                    </div>
                  </div>
                </div>
              </div>

              <div class="row">
                <div class="form-group role-edit-wrap col-sm-6">
                  <label class="col-sm-2 control-label" style="margin: 0 0 0 10px;">主营品牌:</label>
                  <div class="col-sm-6">
                    <div class="tree-list-wrap">
                      <div class="search-box">
                        <input type="text" class="form-control" placeholder="请输入搜索" ng-model='searchCar'>
                      </div>
                      <ul class="tree-list">
                        <li class="tree-list-item bordered" ng-repeat="item in carBrandOptions">
                          <label><input icheck type="checkbox" ng-model="item.checked"
                              ng-change="toggleCarBrand($index,1);">{{item.name}}</label>
                          <span class="fa" ng-class="item.toggle?'fa-angle-up':'fa-angle-down'"
                            ng-click="toggleCarBrand($index,2);"></span>
                          <span class="fa fa-spin fa-spinner" ng-show="item.toggle && !item.childs1"></span>
                          <!--二级 -->
                          <ul class="sub-tree-list" ng-class="item.toggle?'active':''">
                            <div class="search-box">
                              <input type="text" class="form-control" placeholder="请输入搜索" id='search-{{$index}}'>
                            </div>
                            <li class="tree-list-item bordered" ng-repeat="subitem in item.childs1">
                              <label><input icheck type="checkbox" name="" ng-model="subitem.checked"
                                  ng-change="toggleCarBrand($parent.$index,3);">{{subitem.name}}</label>
                            </li>
                          </ul>
                        </li>
                      </ul>
                    </div>
                  </div>
                </div>
              </div>

              <div class="row">
                <div class="form-group col-sm-6">
                  <label class="col-sm-2 control-label required">登录账号:</label>
                  <div class="col-sm-6">
                    <input type="text" class="form-control" ng-pattern="/^(?![0-9]+$)[0-9A-Za-z]{3,15}$/"
                      ng-if="mark!='edit'" placeholder="3~15位字符,至少包含一个字母" name="accountName"
                      ng-model="merchant.accountName" maxlength="15" required ng-disabled="mark=='edit'"
                      v-async="validAccountName(value)" ng-model-options="{ updateOn: 'blur',allowInvalid: true }">

                    <input type="text" class="form-control" ng-if="mark=='edit'" placeholder="3~15位字符,至少包含一个字母"
                      name="accountName" ng-model="merchant.accountName" maxlength="15" required
                      ng-disabled="mark=='edit'" v-async="validAccountName(value)"
                      ng-model-options="{ updateOn: 'blur',allowInvalid: true }">
                    <div class="m-t-xs" ng-show="merchantForm.accountName.$invalid && submitted">
                      <p ng-show="merchantForm.accountName.$error.pattern" class="text-danger form-text">请输入正确的账号格式</p>
                      <p ng-show="merchantForm.accountName.$error.required" class="text-danger form-text">请输入登录账号</p>
                      <p ng-show="merchantForm.accountName.$error.vAsync" class="text-danger form-text">该账号已存在</p>
                    </div>
                  </div>
                </div>
              </div>

              <div class="row">
                <div class="form-group col-sm-6">
                  <label class="col-sm-2 control-label required">登录手机号:</label>
                  <div class="col-sm-10">
                    <input type="text" class="form-control" placeholder="请输入登录手机号" ng-disabled="mark=='edit' && merchant.loginPhone"
                      name="loginPhone"
                      ng-model="loginPhone" ng-pattern="/^[1][3,4,5,6,7,8,9][0-9]{9}$/" maxlength="11" required
                      style="width:58%;display:inline;">
                    <!--
                    <button type="button" class="btn btn-primary" ng-click="updateLoginPhone(3)"
                      data-style="expand-right" ng-if="mark=='edit' && !merchant.loginPhone"
                      ng-disabled="!loginPhone">绑定</button>
                    <button type="button" class="btn btn-primary" ng-click="changeEditLoginPhone(true)"
                      data-style="expand-right"
                      ng-if="mark=='edit' && merchant.loginPhone && !editLoginPhone">修改</button>
                    
                    <button type="button" class="btn btn-primary" ng-click="updateLoginPhone(1)"
                      data-style="expand-right" ng-if="mark=='edit' && merchant.loginPhone && !editLoginPhone"
                      ng-disabled="saveBtnDisabled2">解绑</button>
                    <button type="button" class="btn btn-primary" ng-click="updateLoginPhone(2)"
                      data-style="expand-right" ng-if="mark=='edit' && editLoginPhone && merchant.loginPhone"
                      ng-disabled="!loginPhone || loginPhone == merchant.loginPhone">确定</button>
                    <button type="button" class="btn btn-primary" ng-click="changeEditLoginPhone(false)"
                      data-style="expand-right"
                      ng-if="mark=='edit' && editLoginPhone && merchant.loginPhone">取消</button>-->
                    <div class="m-t-xs" ng-show="merchantForm.loginPhone.$invalid && submitted">
                      <p class="text-danger form-text">请输入正确的登录手机号</p>
                    </div>
                  </div>
                </div>
              </div>

              <div class="row">
                <div class="form-group col-sm-6" ng-if="source != 1">
                  <label class="col-sm-2 control-label required">角色权限:</label>
                  <div class="col-sm-6">
                    <ui-select class="a_select w-80 pd0 " ng-model="$parent.merchant.role" name="role" theme="select2"
                      required style="width:300px;">
                      <ui-select-match placeholder="全部">{{$select.selected.name}}
                      </ui-select-match>
                      <ui-select-choices repeat="item in (selectRoleList | filter:{name:$select.search})">
                        <span ng-bind="item.name"></span>
                      </ui-select-choices>
                    </ui-select>
                    <div class="m-t-xs" ng-show="merchantForm.role.$invalid && submitted">
                      <p ng-show="merchantForm.role.$error.required" class="text-danger form-text">请选择角色权限</p>
                    </div>
                  </div>
                </div>
              </div>
            </form>
          </div>
        </div>

      </div>
    </div>
  </div>
</div>
<script>
  $(document).ready(function () {
    $('.clockpicker').clockpicker();
  })
</script>
<style type="text/css">
  .addImg {
    width: 100%;
    height: 100%;
    line-height: 88px;
    font-size: 100px;
    text-align: center;
    color: #999999;
    background: #FBFBFB;
    border: 1px solid #D9D9D9;
    border-radius: 4px;
    cursor: pointer;
  }

  .storeImg .tip {
    position: absolute;
    bottom: 0;
    left: 263px;
    width: 100%;
  }

  .add-el-dialog {
    transform: translateX(0);
    margin-top: 2vh !important;
  }

  .dialog-title {
    font-size: 16px;
    color: #696C6E;
  }

  .fileUploadArea .img {
    width: 100px;
    height: 100px;
    opacity: 1;
  }

  .fileUploadArea .img input {
    position: relative;
    opacity: 0;
    z-index: 1;
  }

  .fileUploadArea .img .add {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 20px;
    color: #000;
  }

  .selfLabel input {
    display: inline-block;
    width: 80%;
  }

  .selfLabel .add {
    width: 20px;
    height: 20px;
    cursor: pointer;
    border: 1px solid;
    text-align: center;
    margin-left: 10px;
    border-radius: 100%;
    font-weight: bold;
    box-sizing: border-box;
    display: inline-block;
  }

  .map-btn {
    margin: 5px 15px;
    float: right;
  }

  .input-clear {
    position: absolute;
    top: 25%;
    right: 44px;
    z-index: 100;
    cursor: pointer;
  }

  .span-btn {
    display: inline-block;
    padding: 1px 6px;
    border-width: 2px;
    border-style: outset;
    cursor: pointer;
  }

  .del-icon {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 20px;
    cursor: pointer;
  }
</style>