From fd658508f4470f0c479b2a36738b0f50481cbbe9 Mon Sep 17 00:00:00 2001
From: 44323 <443237572@qq.com>
Date: 星期六, 16 九月 2023 10:59:09 +0800
Subject: [PATCH] 后台代码

---
 cloud-server-management/src/main/webapp/static/modular/system/bodySideAppointment/tBodySideAppointment_edit.js |  176 ++++++++++++++++++++++++++++++++++++++++------------------
 1 files changed, 120 insertions(+), 56 deletions(-)

diff --git a/cloud-server-management/src/main/webapp/static/modular/system/bodySideAppointment/tBodySideAppointment_edit.js b/cloud-server-management/src/main/webapp/static/modular/system/bodySideAppointment/tBodySideAppointment_edit.js
index 612e13b..0c2afa8 100644
--- a/cloud-server-management/src/main/webapp/static/modular/system/bodySideAppointment/tBodySideAppointment_edit.js
+++ b/cloud-server-management/src/main/webapp/static/modular/system/bodySideAppointment/tBodySideAppointment_edit.js
@@ -54,7 +54,56 @@
 TQuestion.dataCount = 0;
 TQuestion.phone = "";
 TQuestion.phoneId = "";
+// 选择省 获取对应市区
+TQuestion.oneChange = function () {
+    var province = $('#pCode option:selected').text();
+    var citySelect = document.getElementById("cCode");
+    var storeSelect = document.getElementById("store");
+    var ajax = new $ax(Feng.ctxPath + "/tSite/getCity", function(data){
+        if(data!=null){
+            var content='<option value="">选择市</option>';
+            $.each(data, function(k,v) {
+                content += "<option value='"+v.cityCode+"'>"+v.city+"</option>";
+            });
+            $("#cCode").empty().append(content);
+        }
+    });
+    if (province === ""){
+        citySelect.innerHTML = '<option value="">请先选择省</option>';
+        storeSelect.innerHTML = '<option value="">请先选择省</option>';
+    }else{
+        citySelect.innerHTML = '<option value="">请选择市</option>';
+        storeSelect.innerHTML = '<option value="">请先选择市区</option>';
+    }
+    ajax.set("province",province);
+    ajax.start();
+};
 
+// 选择市 获取对应门店
+TQuestion.oneChangeNext = function (e) {
+    var oneId=$(e).val();
+    var city = $('#cCode option:selected').text();
+
+    var citySelect = document.getElementById("account");
+    var storeSelect = document.getElementById("store");
+    if (oneId === ""){
+        citySelect.innerHTML = '<option style="width: 300px" value="">请先选择省/市</option>';
+        storeSelect.innerHTML = '<option style="width: 300px" value="">请先选择省/市</option>';
+    }
+    var ajax1 = new $ax(Feng.ctxPath + "/tSite/storeChangeNext", function(data){
+        if(data!=null && data.length !== 0){
+            var content='<option value="">选择门店</option>';
+            $.each(data, function(k,v) {
+                content += "<option style='width: 300px' value='"+v.id+"'>"+v.name+"</option>";
+            });
+            $("#store").empty().append(content);
+        }else {
+            storeSelect.innerHTML = '<option value="">当前所选市没有门店</option>';
+        }
+    });
+    ajax1.set("oneId",city);
+    ajax1.start();
+};
 /**
  * 点击添加
  */
@@ -241,83 +290,98 @@
         });
     }
 };
-
+TQuestion.close = function() {
+    parent.layer.close(window.parent.TQuestion.layerIndex);
+};
 TQuestion.addSubmit = function(){
     var data = {
         id:null,
-        name:"",
-        position:"",
-        sort:"",
+        province:"",
+        provinceCode:"",
+        city:"",
+        cityCode:"",
+        storeId:null,
+        storeName:"",
+        parentName:"",
+        phone:"",
+        learnerName:"",
+        learnerAge:null,
+        birthday:"",
+        appointmentTime:"",
+        status:null,
+        state:null
     };
-    data.name       = $("#name").val()
-    data.position           = $("#position").val()
-    data.sort           = $("#sort").val()
+    data.id                         = $("#id").val()
+    data.province                   = $('#pCode option:selected').text();
+    data.provinceCode               = $("#pCode").val()
+    data.city                       = $('#cCode option:selected').text();
+    data.cityCode                   = $("#cCode").val()
+    data.storeId                    = $("#store").val()
+    data.storeName                  = $('#store option:selected').text();
+    data.parentName                 = $("#parentName").val()
+    data.phone                      = $("#phone").val()
+    data.learnerName                = $("#learnerName").val()
+    data.learnerAge                 = $("#learnerAge").val()
+    data.birthday                   = $("#birthday").val()
+    data.appointmentTime            = $("#appointmentTime").val().replace("T"," ")
+    var roleType = $("#roleType").val()
 
-
-    if($("#name").val()==''){
-        Feng.info("请输入分类名称")
+    if(roleType == 1){
+        if($("#pCode").val()==''){
+            Feng.info("请选择省")
+            return;
+        }
+        if($("#cCode").val()==''){
+            Feng.info("请选择市")
+            return;
+        }
+    }
+    if(roleType == 1 || roleType == 2) {
+        if ($("#store").val() == '') {
+            Feng.info("请选择门店")
+            return;
+        }
+    }
+    if($("#parentName").val()=='' ){
+        Feng.info("请输入家长姓名")
         return;
     }
-    if($("#cCode").val()==''){
-        Feng.info("请选择所在位置")
+
+    if($("#phone").val()=='' ){
+        Feng.info("请输入家长联系方式")
         return;
     }
-    if($("#account").val()=='' ){
-        Feng.info("请输入排序")
+    if($("#learnerName").val()=='' ){
+        Feng.info("请输入学员姓名")
+        return;
+    }
+    if($("#learnerAge").val()=='' ){
+        Feng.info("请输入学员年龄")
+        return;
+    }
+    if($("#birthday").val()=='' ){
+        Feng.info("请选择学员生日")
+        return;
+    }
+    if($("#appointmentTime").val()=='' ){
+        Feng.info("请选择预约时间")
         return;
     }
 
     $.ajax({
-        url: Feng.ctxPath + "/benefits/addBenefits" ,
+        url: Feng.ctxPath + "/bodySideAppointment/addBodySideAppointments" ,
         type: "POST",
         data: JSON.stringify(data),
         contentType: "application/json",
         success: function (response) {
-            Feng.success("添加成功");
-
+            window.parent.TQuestion.table.refresh();
+            TQuestion.close();
+            Feng.success("修改成功");
         },
         error: function (xhr, status, error) {
-            Feng.error("添加失败!" + error);
+            Feng.error("修改失败!" + error);
         }
     });
-    TSite.search();
-};
-TQuestion.updateSubmit = function(){
-    var data = {
-        id:null,
-        name:"",
-        position:"",
-        sort:"",
-    };
-    data.name     = $("#name").val()
-    data.position = $("#position").val()
-    data.sort     = $("#sort").val()
-    data.id       = $("#dataId").val()
-    if($("#name").val()==''){
-        Feng.info("请输入分类名称")
-        return;
-    }
-    if($("#cCode").val()==''){
-        Feng.info("请选择所在位置")
-        return;
-    }
-    if($("#account").val()=='' ){
-        Feng.info("请输入排序")
-        return;
-    }
-    $.ajax({
-        url: Feng.ctxPath + "/benefits/addBenefits" ,
-        type: "POST",
-        data: JSON.stringify(data),
-        contentType: "application/json",
-        success: function (response) {
-            Feng.success("添加成功");
-        },
-        error: function (xhr, status, error) {
-            Feng.error("添加失败!" + error);
-        }
-    });
-    TSite.search();
 };
 /**
  * 查询列表

--
Gitblit v1.7.1