点餐详细

支付界面
master
pan 4 years ago
parent 3bc468d2b3
commit d0debcc0cd
  1. 10
      src/main/java/com/example/demo/controller/WebController.java
  2. 38
      src/main/resources/templates/order.html

@ -148,12 +148,22 @@ public class WebController {
@GetMapping("/order/detail/{id}") @GetMapping("/order/detail/{id}")
public String getDetailOrder(Model model,@PathVariable String id){ public String getDetailOrder(Model model,@PathVariable String id){
model.addAttribute(Constants.SPAN_NAME,"详细画面"); model.addAttribute(Constants.SPAN_NAME,"详细画面");
Diancan diancan=diancanRespository.getOne(id);
model.addAttribute(Constants.QUERY,diancan);
List<DiancanDetail> diancanDetails=diancanDetailRespository.findByZhuohao(diancan.getZhuohao());
model.addAttribute(Constants.QUERYDETAIL,diancanDetails);
model.addAttribute(Constants.FENLEI,menuRepository.getFenlei());
return "order"; return "order";
} }
@GetMapping("/order/pay/{id}") @GetMapping("/order/pay/{id}")
public String getPayOrder(Model model,@PathVariable String id){ public String getPayOrder(Model model,@PathVariable String id){
model.addAttribute(Constants.SPAN_NAME,"支付画面"); model.addAttribute(Constants.SPAN_NAME,"支付画面");
Diancan diancan=diancanRespository.getOne(id);
model.addAttribute(Constants.QUERY,diancan);
List<DiancanDetail> diancanDetails=diancanDetailRespository.findByZhuohao(diancan.getZhuohao());
model.addAttribute(Constants.QUERYDETAIL,diancanDetails);
model.addAttribute(Constants.FENLEI,menuRepository.getFenlei());
return "order"; return "order";
} }

@ -50,24 +50,25 @@
function getSelect() { function getSelect() {
let fenlei = [[${fenlei}]] let fenlei = [[${fenlei}]]
let fenleistr = '' let fenleistr = ''
let disabled=[[${span_name}]]==='详细画面'||[[${span_name}]]==='支付画面'
for (let item in fenlei) { for (let item in fenlei) {
fenleistr += `<option value="${fenlei[item]}">${fenlei[item]}</option>` fenleistr += `<option value="${fenlei[item]}">${fenlei[item]}</option>`
} }
let count=document.querySelectorAll('select[name$=cailiao]').length let count=document.querySelectorAll('select[name$=cailiao]').length
return `<select class="custom-select" name="diancans[${count}].fenlei" onchange="changeFenLei(this,this.parentElement.querySelector('select[name$=pinmu]'),this.parentElement.querySelector('select[name$=cailiao]'))"> return `<select class="custom-select" ${disabled?'disabled':''} name="diancans[${count}].fenlei" onchange="changeFenLei(this,this.parentElement.querySelector('select[name$=pinmu]'),this.parentElement.querySelector('select[name$=cailiao]'))">
<option value="">请选择分类</option> <option value="">请选择分类</option>
${fenleistr} ${fenleistr}
</select> </select>
<select class="custom-select" name="diancans[${count}].pinmu" onchange="changePinmu(this.parentElement.querySelector('select[name$=fenlei]'),this,this.parentElement.querySelector('select[name$=cailiao]'))"> <select class="custom-select" ${disabled?'disabled':''} name="diancans[${count}].pinmu" onchange="changePinmu(this.parentElement.querySelector('select[name$=fenlei]'),this,this.parentElement.querySelector('select[name$=cailiao]'))">
<option value="">请选择品目</option> <option value="">请选择品目</option>
</select> </select>
<select class="custom-select" name="diancans[${count}].cailiao" required oninvalid="setCustomValidity('请选择材料')" onchange="changeCailiao(document.querySelectorAll('select[name$=cailiao]'))"> <select class="custom-select" ${disabled?'disabled':''} name="diancans[${count}].cailiao" required oninvalid="setCustomValidity('请选择材料')" onchange="changeCailiao(document.querySelectorAll('select[name$=cailiao]'))">
<option value="">请选择材料</option> <option value="">请选择材料</option>
</select> </select>
<input type="text" class="form-control" name="diancans[${count}].sum" placeholder="做法或数量" onchange="changeCailiao(document.querySelectorAll('select[name$=cailiao]'))" oninput="changeCailiao(document.querySelectorAll('select[name$=cailiao]'))">` <input type="text" ${disabled?'readonly':''} class="form-control" name="diancans[${count}].sum" placeholder="做法或数量" onchange="changeCailiao(document.querySelectorAll('select[name$=cailiao]'))" oninput="changeCailiao(document.querySelectorAll('select[name$=cailiao]'))">`
} }
function plus() { function plus() {
@ -195,7 +196,7 @@
<div class="input-group-prepend col-3 pr-2 justify-content-end"> <div class="input-group-prepend col-3 pr-2 justify-content-end">
<span class="input-group-text">客人姓名</span> <span class="input-group-text">客人姓名</span>
</div> </div>
<input type="text" th:field="*{xingming}" class="form-control col-4" oninvalid="setCustomValidity('姓名不能为空')" oninput="setCustomValidity('');" required maxlength="15"> <input type="text" th:readonly="${span_name} eq '详细画面' or ${span_name} eq '支付画面'" th:field="*{xingming}" class="form-control col-4" oninvalid="setCustomValidity('姓名不能为空')" oninput="setCustomValidity('');" required maxlength="15">
</div> </div>
<div class="input-group mt-3"> <div class="input-group mt-3">
@ -203,16 +204,16 @@
<span class="input-group-text">用餐时间</span> <span class="input-group-text">用餐时间</span>
</div> </div>
<div class="custom-control custom-radio custom-control-inline mt-auto mb-auto"> <div class="custom-control custom-radio custom-control-inline mt-auto mb-auto">
<input type="radio" id="customRadioInline1" name="birthday" <input type="radio" th:disabled="${span_name} eq '详细画面' or ${span_name} eq '支付画面'" id="customRadioInline1" name="birthday"
class="custom-control-input" value="1" th:checked="*{birthday eq null}" onclick="birthdayValid(this.parentElement.parentElement.querySelector('input[name=shijian]'))"> class="custom-control-input" value="1" th:checked="*{birthday eq null}" onclick="birthdayValid(this.parentElement.parentElement.querySelector('input[name=shijian]'))">
<label class="custom-control-label" for="customRadioInline1">及时单</label> <label class="custom-control-label" for="customRadioInline1">及时单</label>
</div> </div>
<div class="custom-control custom-radio custom-control-inline mt-auto mb-auto"> <div class="custom-control custom-radio custom-control-inline mt-auto mb-auto">
<input type="radio" id="customRadioInline2" value="2" th:checked="*{birthday ne null}" name="birthday" class="custom-control-input" onclick="changeBirthday(this.parentElement.parentElement.querySelector('input[name=shijian]'))"> <input type="radio" th:disabled="${span_name} eq '详细画面' or ${span_name} eq '支付画面'" id="customRadioInline2" value="2" th:checked="*{birthday ne null}" name="birthday" class="custom-control-input" onclick="changeBirthday(this.parentElement.parentElement.querySelector('input[name=shijian]'))">
<label class="custom-control-label" for="customRadioInline2">指定</label> <label class="custom-control-label" for="customRadioInline2">指定</label>
</div> </div>
<input type="text" th:value="${#dates.format(query.birthday, 'yyyyMMdd HHmm')}" name="shijian" oninput="setCustomValidity('')" oninvalid="setCustomValidity('时间不能为空')" class="form-control col-4"> <input type="text" th:readonly="${span_name} eq '详细画面' or ${span_name} eq '支付画面'" th:value="${#dates.format(query.birthday, 'yyyyMMdd HHmm')}" name="shijian" oninput="setCustomValidity('')" oninvalid="setCustomValidity('时间不能为空')" class="form-control col-4">
</div> </div>
<div class="input-group mt-3"> <div class="input-group mt-3">
@ -220,7 +221,7 @@
<span class="input-group-text">用餐人数</span> <span class="input-group-text">用餐人数</span>
</div> </div>
<input type="number" th:field="*{renshu}" class="form-control col-4"> <input type="number" th:readonly="${span_name} eq '详细画面' or ${span_name} eq '支付画面'" th:field="*{renshu}" class="form-control col-4">
</div> </div>
<div class="input-group mt-3"> <div class="input-group mt-3">
@ -228,7 +229,7 @@
<span class="input-group-text">联系方式(手机)</span> <span class="input-group-text">联系方式(手机)</span>
</div> </div>
<input type="text" th:field="*{tel}" oninput="checkMobie()" class="form-control col-4"> <input type="text" th:readonly="${span_name} eq '详细画面' or ${span_name} eq '支付画面'" th:field="*{tel}" oninput="checkMobie()" class="form-control col-4">
</div> </div>
<div class="input-group mt-3 order-frame fff"> <div class="input-group mt-3 order-frame fff">
@ -258,15 +259,26 @@
<input type="text" id="jine" name="jine" class="form-control col-2" readonly> <input type="text" id="jine" name="jine" class="form-control col-2" readonly>
</div> </div>
<div class="input-group mt-3"> <div class="input-group mt-3" th:if="${span_name!='支付画面'}">
<div class="input-group-prepend"> <div class="input-group-prepend">
<span class="input-group-text">备注</span> <span class="input-group-text">备注</span>
</div> </div>
<textarea class="form-control" th:field="*{beizhu}" aria-label="With textarea"></textarea> <textarea class="form-control" th:readonly="${span_name} eq '详细画面' or ${span_name} eq '支付画面'" th:field="*{beizhu}" aria-label="With textarea"></textarea>
</div> </div>
<div class="mt-3 text-right">
<div class="mt-3 text-right" th:if="${span_name=='修改画面'}">
<button class="btn btn-secondary col-3">提交</button> <button class="btn btn-secondary col-3">提交</button>
</div> </div>
<div class="mt-3 text-right" th:if="${span_name=='详细画面'}">
<a th:href="@{'/api/order/pay/'+${query.zhuohao}}" class="btn btn-secondary col-3">买单</a>
<a th:href="@{'/api/order/'+${query.zhuohao}}" class="btn btn-secondary col-3">修改</a>
<a href="/api/index" class="btn btn-secondary col-3">返回</a>
</div>
<div class="mt-3 text-right" th:if="${span_name=='支付画面'}">
<a th:href="@{'/api/order/'+${query.zhuohao}}" class="btn btn-secondary col-3">修改</a>
<a href="/api/index" class="btn btn-secondary col-3">完成</a>
</div>
</form> </form>
</div> </div>
</div> </div>

Loading…
Cancel
Save