zq-erp/src/main/java/com/matrix/system/hive/action/ProjServiceController.java
@@ -1,6 +1,7 @@ package com.matrix.system.hive.action; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.util.StrUtil; import com.matrix.core.anotations.RemoveRequestToken; import com.matrix.core.constance.MatrixConstance; import com.matrix.core.exception.GlobleException; @@ -504,7 +505,9 @@ if (balanceverifyResult.isError()) { return new AjaxResult(AjaxResult.STATUS_FAIL, balanceverifyResult.getMsg()); } if (StrUtil.isEmpty(sysProjServices.getState())) { sysProjServices.setState(Dictionary.SERVICE_STATU_DYY); } SysProjServices newSysProjServices = sysProjServicesService.addSysProjServices(sysProjServices); if (newSysProjServices != null) { return AjaxResult.buildSuccessInstance(Arrays.asList(newSysProjServices)); @@ -558,6 +561,18 @@ } } /** * 删除服务单项目/套餐 * @param id * @return */ @RequestMapping(value = "/delServiceOrderItems") @ResponseBody public AjaxResult delServiceOrderItems(Long id) { sysProjServicesService.deleteProjServiceItemById(id); return AjaxResult.buildSuccessInstance("删除成功"); } // 准备页面数据 private void pageDate() { zq-erp/src/main/java/com/matrix/system/hive/service/SysProjServicesService.java
@@ -72,6 +72,11 @@ */ public int modifyCancelProjServices(SysProjServices projServices); /** * 删除服务单中明细, 即项目/套餐 */ public int deleteProjServiceItemById(Long id); /** * 划扣 zq-erp/src/main/java/com/matrix/system/hive/service/imp/SysProjServicesServiceImpl.java
@@ -145,10 +145,13 @@ } if (sysProjServices.getId() == null) { sysProjServices.setCreateTime(new Date()); sysProjServices.setServiceNo(codeService.getServiceOrderCode()); Double hkPrice = 0.0; int i = sysProjServicesDao.insert(sysProjServices); } Double hkPrice = 0.0; // 计算项目总时长 int totalTime = 0; //处理订单明细 @@ -230,7 +233,7 @@ sysBeauticianState.setProjId(sysProjInfo.getId()); sysBeauticianState.setServicesId(sysProjServices.getId()); sysBeauticianState.setShopId(sysProjServices.getShopId()); sysBeauticianState.setState(Dictionary.BEATUI_STATE_DYY); sysBeauticianState.setState(sysProjServices.getState()); beauticianStateDao.insert(sysBeauticianState); } // 设置项目总时长 @@ -513,12 +516,20 @@ private void backProjCount(SysProjServices projServices) { List<SysBeauticianState> beauticianStateList = beauticianStateDao.selectBySerIds(projServices.getId()); backProjCountItems(beauticianStateList, 1); } private void backProjCountItems(List<SysBeauticianState> beauticianStateList, int type) { Map<Long, List<SysProjUse>> taocanMap = new HashMap<>(); // 回退项目余额 for (SysBeauticianState beauticianState : beauticianStateList) { if (type == 1) { // 该修改为 有效日期判断更新所有 beauticianState.setState(Dictionary.BEATUI_STATE_YYQX); beauticianStateDao.update(beauticianState); } else { beauticianStateDao.deleteById(beauticianState.getId()); } SysProjUse sysProjUse = sysProjUseDao.selectById(beauticianState.getPuseId()); if (sysProjUse != null && sysProjUse.getId() != null) { @@ -586,6 +597,16 @@ } } @Override public int deleteProjServiceItemById(Long id) { SysBeauticianState sysBeauticianState = beauticianStateDao.selectById(id); List<SysBeauticianState> list = new ArrayList<>(); list.add(sysBeauticianState); backProjCountItems(list, 2); return 1; } // 划扣 jyy @Transactional(rollbackFor = Exception.class) @Override zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/servicceAddForm.html
@@ -124,8 +124,8 @@ </el-tab-pane> <el-tab-pane label="套餐" name="tab2"> <template v-for="item in taocanList" > <p class="el-big-title">【{{item.isCourse=='N'?'固定套餐':'任选套餐'}}】{{item.projName}} <template v-for="(item,index) in taocanList" v-if="index > 3 ? tcIsOpen : true"> <p class="el-big-title">{{index}}【{{item.isCourse=='N'?'固定套餐':'任选套餐'}}】{{item.projName}} <span style="float: right" v-if="item.failTime != null">有效期:{{item.failTime}}</span> <code v-if="item.projInfo.isCourse=='Y'" > 剩余次数:<span v-if="item.projInfo.isInfinite == 'Y'">无限次</span><span v-else>{{item.surplusCount}}</span> </code> </p> @@ -165,7 +165,10 @@ </el-table-column> </el-table> </template> <el-row style="text-align: center; margin-top: 5px;"> <el-link type="primary" v-if="!tcIsOpen && taocanList.length > 0" @click="tcIsOpen = true">点击展开</el-link> <el-link type="primary" v-if="tcIsOpen" @click="tcIsOpen = false">点击隐藏</el-link> </el-row> </el-tab-pane> </el-tabs> @@ -238,6 +241,7 @@ orderItemList:[], projList:[], taocanList:[], tcIsOpen : false, yyTime:new Date(), zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/yyServiceAddForm.html
New file @@ -0,0 +1,347 @@ <!DOCTYPE HTML> <html xmlns:th="http://www.thymeleaf.org" xmlns:matrix="http://www.w3.org/1999/xhtml"> <head> <meta charset="utf-8"> <META HTTP-EQUIV="Pragma" CONTENT="no-cache"> <meta name="renderer" content="webkit|ie-comp|ie-stand"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/> <meta http-equiv="Cache-Control" content="no-siteapp"/> <!-- 本框架基本脚本和样式 --> <script type="text/javascript" th:src="@{/js/systools/MBaseVue.js}"></script> <link rel="stylesheet" th:href="@{/plugin/element-ui/index.css}"> <script type="text/javascript" th:src="@{/plugin/moment.min.js}"></script> <link th:href="@{/css/styleOne/style.min.css}" rel="stylesheet" type="text/css"/> <!-- 富文本编辑器 --> <script type="text/javascript" charset="utf-8" th:src="@{/plugin/beditor/ueditor.config.js}"></script> <script type="text/javascript" charset="utf-8" th:src="@{/plugin/beditor/ueditor.all.js}"> </script> <script type="text/javascript" charset="utf-8" th:src="@{/plugin/beditor/lang/zh-cn/zh-cn.js}"></script> <style> .mform{ display: flex; align-items: center; margin-top: 10px; } .mixSearchBox .searchResultTable { position: absolute; padding: 10px; border: 1px solid #e4e7ed; border-radius: 4px; background-color: #fff; box-shadow: 0 2px 12px 0 rgba(0, 0, 0, .1); box-sizing: border-box; margin: 10px 0; z-index: 99999999; } .el-icon-delete{ cursor: pointer; } .el-icon-delete:hover{ color: #F56C6C; } .tabs { margin-bottom: 80px; } .foot_bar2 { top: 98%; position: absolute; width: 98%; height: 80px; overflow: hidden; left: 0px; display: flex; align-items: center; z-index: 99; justify-content: center; } .max-height{ height: 98%; } .orderBox{ position: relative; border-left: 1px solid #EFEFEF; padding-left: 10px; margin-left:10px ; } </style> </head> <body> <div class="ibox-content max-height" id="app" v-cloak> <el-row class="max-height"> <el-col :span="16" > <el-tabs class="tabs" type="card" v-model="activeName" > <el-tab-pane label="项目" name="tab1"> <el-table :data="projList" style="width: 98%"> <el-table-column prop="projName" label="项目"> </el-table-column> <el-table-column prop="balance" label="余额" width="180"> </el-table-column> <el-table-column prop="surplusCount" label="余次"> </el-table-column> <el-table-column prop="failTimeStr" label="有效期"> </el-table-column> <el-table-column prop="source" label="来源"> </el-table-column> <el-table-column prop="address" label="操作"> <template slot-scope="scope"> <el-button v-if="scope.row.surplusCount>0" type="primary" size="mini" @click="selected(scope.$index, scope.row)">添加 </el-button> </template> </el-table-column> </el-table> </el-tab-pane> <el-tab-pane label="套餐" name="tab2"> <template v-for="(item,index) in taocanList" v-if="index > 3 ? tcIsOpen : true"> <p class="el-big-title">【{{item.isCourse=='N'?'固定套餐':'任选套餐'}}】{{item.projName}} <span style="float: right" v-if="item.failTime != null">有效期:{{item.failTime}}</span> <code v-if="item.projInfo.isCourse=='Y'" > 剩余次数:<span v-if="item.projInfo.isInfinite == 'Y'">无限次</span><span v-else>{{item.surplusCount}}</span> </code> </p> <el-table :data="item.taocanProjUse" style="width: 98%"> <el-table-column prop="projName" label="项目"> </el-table-column> <el-table-column prop="balance" label="余额" width="180"> </el-table-column> <el-table-column prop="surplusCount" label="余次"> </el-table-column> <!-- <el-table-column--> <!-- prop="failTimeStr"--> <!-- label="有效期">--> <!-- </el-table-column>--> <el-table-column prop="source" label="来源"> </el-table-column> <el-table-column prop="address" label="操作"> <template slot-scope="scope"> <el-button v-if="scope.row.surplusCount>0" type="primary" size="mini" @click="selected(scope.$index, scope.row, item.projName)">添加 </el-button> </template> </el-table-column> </el-table> </template> <el-row style="text-align: center; margin-top: 5px;"> <el-link type="primary" v-if="!tcIsOpen && taocanList.length > 0" @click="tcIsOpen = true">点击展开</el-link> <el-link type="primary" v-if="tcIsOpen" @click="tcIsOpen = false">点击隐藏</el-link> </el-row> </el-tab-pane> </el-tabs> </el-col> <el-col :span="7" class="orderBox max-height" > <p class="el-big-title">服务开单</p> <el-row class="mform" v-for="(item,index) in orderItemList" > <el-col :span="16" >{{item.projUse.projName}}</el-col> <el-col :span="6" > <el-input @blur="checkCount(item)" type="number" v-model="item.count"> </el-input> </el-col> <el-col :offset="1" :span="1" > <i @click="remove(index)" class="el-icon-delete "></i> </el-col> </el-row> <el-row class="foot_bar2"> <el-button :loading="submiting" type="primary" @click="submitForm('form')" >添加</el-button> <el-button @click="closeFram()">取消</el-button> </el-row> </el-col> </el-row> </div> </body> <script type="text/javascript" th:src="@{/js/plugin/jquery-2.1.4.min.js}"></script> <script type="text/javascript" th:src="@{/js/plugin/jquery.query.js}"></script> <script type="text/javascript" th:src="@{/js/systools/AjaxProxyVue.js}"></script> <script type="text/javascript" th:src="@{/js/plugin/vue.js}"></script> <script type="text/javascript" th:src="@{/plugin/element-ui/index.js}"></script> <script src="https://cdn.jsdelivr.net/npm/@riophae/vue-treeselect@^0.4.0/dist/vue-treeselect.umd.min.js"></script> <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@riophae/vue-treeselect@^0.4.0/dist/vue-treeselect.min.css"> <script> var id = $.query.get("id"); //校验方法 var ValidatorFactory = { validateUseCount: function (rule, value, callback) { if ((true)) { return callback; } else { return callback(new Error('请输入套餐最大使用次数')); } } }; Vue.component('ValidatorFactory', ValidatorFactory); Vue.component('treeselect', VueTreeselect.Treeselect) var app = new Vue({ el: '#app', data: { submiting:false, activeName:"tab1", orderItemList:[], projList:[], taocanList:[], tcIsOpen : false, yyTime:new Date(), }, /** * 初始化数据表 */ created: function () { this.loadinfo(); }, methods: { /** * 提交表单 * */ submitForm(formName) { let _this=this; _this.submiting = true; if(_this.orderItemList.length<1){ _this.$message.error('请选择下单项目'); return false; } let formData={ vipId:id, serviceItems:[], } parent.app.addProjItems(_this.orderItemList); _this.closeFram(); }, open(data) { let _this=this; this.$confirm('服务创建成功是否马上排班?', '确认信息', { distinguishCancelAndClose: true, confirmButtonText: '马上排班', cancelButtonText: '暂不排班' }).then(() => { window.location.href=basePath+"/admin/projService/yypb?pageFlae=1&id="+data.rows[0].id; }) .catch(action => { if(action === 'cancel'){ _this.submiting = false; _this.closeFram(); } }); }, remove(index){ this.orderItemList.splice(index, 1); }, checkCount(item){ if(item.count>item.projUse.surplusCount){ item.count=item.projUse.surplusCount; this.$message.error('下单次数不能大于余次'); }else if(item.count<0){ item.count=1; this.$message.error('下单次数不能小于0'); } }, /** * 选择产品 * */ selected(index, row, name) { //是否已经被选择了 let selected = false; this.orderItemList.forEach(item => { if (item.projUse.id == row.id) { selected = true; //叠加次数 if(item.count<item.projUse.surplusCount){ item.count=item.count+1; }else{ this.$message.error('下单次数不能大于余次'); } return; } }); if (!selected) { if(row.surplusCount>0){ this.orderItemList.push({ projUse: row, count: 1, name : name }); } } }, loadinfo(){ let _this=this; AjaxProxy.requst({ app: _this, url: basePath + "/admin/projService/getUserProjInfo?vipId="+id, callback: function (data) { _this.projList = data.mapInfo.projList; _this.taocanList = data.mapInfo.taoCanList; } }); }, closeFram: function () { parent.layer.close(parent.layer.getFrameIndex(window.name)); }, } }) </script> </body> </html> zq-erp/src/main/resources/templates/views/admin/hive/beautySalon/yypb-form.html
@@ -101,6 +101,12 @@ </div> </div> <div class="form-group"> <label class="col-md-1 control-label"></label> <div class="col-md-11"> <el-button size="medium" type="primary" @click="addProjForm">新增项目</el-button> </div> </div> <div class="form-group"> <label class="col-md-1 control-label">服务设置</label> <div class="col-md-11"> <table class="table table-bordered"> @@ -110,6 +116,7 @@ <th>服务时间</th> <th width="300px">美疗师</th> <th style="width: 100px;">提成</th> <th>操作</th> </tr> <tr v-for="(item,index) in projService.serviceItems"> @@ -153,6 +160,10 @@ <td> <el-input v-model="item.extract"></el-input> </td> <td> <el-button size="mini" type="danger" @click="handleDelete(index)">删除</el-button> </td> </tr> @@ -186,6 +197,7 @@ </div> <script type="text/javascript" th:src="@{/js/plugin/jquery-2.1.4.min.js}"></script> <script type="text/javascript" th:src="@{/js/plugin/jquery.query.js}"></script> <script type="text/javascript" th:src="@{/js/systools/MJsBase.js}"></script> <script type="text/javascript" th:src="@{/plugin/bootstrap-3.3.5/js/bootstrap.min.js}"></script> <script type="text/javascript" th:src="@{/js/systools/AjaxProxyVue.js}"></script> <script type="text/javascript" th:src="@{/js/plugin/vue.js}"></script> @@ -201,6 +213,8 @@ }, //美疗师分配列表 serviceItems: [], // 删除的服务单明细 deleteItems : [], //美疗师 beauty: [], pls: [], @@ -339,6 +353,7 @@ devisionId: projService.devisionId, yyTime: projService.yyTime, serviceItems: serviceItems, deleteItems : _this.deleteItems, //床位时间 bedState: { startTime: startTime, @@ -477,7 +492,93 @@ }); _this.projService.totalTime = totalTime; _this.changeYyTime(); }, handleDelete : function(index) { let _this = this; var items = this.projService.serviceItems; if (items.length > 1) { let delItem = items.splice(index, 1); if (delItem[0].servicesId) { AjaxProxy.requst({ app: _this, url: basePath + "/admin/projService/delServiceOrderItems?id="+delItem[0].id, callback: function (data) { _this.$message({ message: data.info, type: 'success' }); } }); } } else { this.$message({ message: '需保留一个项目', type: 'error' }); } }, addProjForm() { var vipId = this.projService.vipInfo.id; layer.full(layer.open({ type: 2, title: "添加项目", maxmin: true, area: [MUI.SIZE_L, '500px'], content: [basePath + '/admin/redirect/hive/beautySalon/yyServiceAddForm?id='+vipId] })); }, addProjItems(rows) { let _this = this; var serviceItems = this.projService.serviceItems; for (let i = 0; i < rows.length; i++) { let row = rows[i] let flag = false; for (let j = 0; j < serviceItems.length; j++) { let item = serviceItems[j]; if (item.puseId == row.projUse.id) { flag = true; break; } } if (flag) { continue; } let items = []; row.projUse.projInfo.name = row.name + "--" + row.projUse.projName; items.push({ puseId : row.projUse.id, count : row.count, projUse : row.projUse, projInfo : row.projUse.projInfo }); let data = {}; data.id = _this.projService.id; data.state = _this.projService.state; data.serviceItems = items; AjaxProxy.requst({ app: _this, data : data, url: basePath + "/admin/projService/addService", callback: function (data) { _this.$message({ message: "添加成功", type: 'success' }); _this.loadInfo(); } }); } }, }, filters: zq-erp/src/main/resources/templates/views/admin/sys/customerDataDictionary-list.html
@@ -87,7 +87,7 @@ </div> <label class="col-sm-2 control-label">排序</label> <div class="col-sm-4"> <input autocomplete="off" name="fnSequence" type="number" class="form-control" <input autocomplete="off" name="sort" type="number" class="form-control" id="sortIndex"> </div> </div> @@ -150,7 +150,7 @@ initFunctionSelected(loj.getString(0,"parentId")); $("#id").val(loj.getString(0, "id")); $("#value").val(loj.getString(0, "value")); $("#sort").val(loj.getString(0, "sort")); $("#sortIndex").val(loj.getString(0, "sort")); $("#typeCode").val(loj.getString(0, "typeCode")); });