You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

736 lines
24 KiB

3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
  1. <template>
  2. <div>
  3. <el-card>
  4. <div slot="header">单位分组</div>
  5. <!--分组信息-->
  6. <div style="display: flex;">
  7. <div :style="'display: block;width:' + (window.pageWidth - 45 - 110) + 'px;'">
  8. <div style="display: flex">
  9. <div>
  10. <span>体检单位</span>
  11. <el-select
  12. v-model="customerOrgId"
  13. placeholder="请选择体检单位"
  14. filterable :filter-method="filterMethod" default-first-option
  15. clearable @clear="customerOrg = deepCopy(customerOrgAll)"
  16. style="margin-left: 10px"
  17. @change="changeCustomerOrg"
  18. size="small"
  19. >
  20. <el-option
  21. v-for="item in customerOrg"
  22. :key="item.id"
  23. :label="item.displayName"
  24. :value="item.id"
  25. >
  26. {{ item.displayName }}
  27. </el-option>
  28. </el-select>
  29. </div>
  30. <div style="margin-left: 20px">
  31. <span>单位体检次数</span>
  32. <el-select
  33. v-model="customerOrgRegister"
  34. placeholder="次数"
  35. style="width: 60px; margin-left: 10px"
  36. size="small"
  37. @change="changeTimes"
  38. value-key="id"
  39. >
  40. <el-option
  41. v-for="item in customerOrgRegisterList"
  42. :key="item.id"
  43. :label="item.medicalTimes"
  44. :value="item"
  45. />
  46. </el-select>
  47. </div>
  48. </div>
  49. <div>
  50. <el-table
  51. :data="customerOrgGroups" ref="customerOrgGroups"
  52. style="margin-top: 2px"
  53. row-key="id"
  54. border
  55. height="240px"
  56. size="small"
  57. highlight-current-row :row-class-name="handleRowClassName"
  58. @row-click="rowClick"
  59. >
  60. <el-table-column
  61. type="index"
  62. label="序号"
  63. min-width="50"
  64. align="center"
  65. />
  66. <el-table-column prop="displayName" label="名称" min-width="150" />
  67. <el-table-column
  68. prop="price"
  69. label="价格"
  70. min-width="60"
  71. align="center"
  72. />
  73. <el-table-column
  74. prop="forSexId"
  75. label="适用性别"
  76. min-width="60"
  77. align="center"
  78. >
  79. <template slot-scope="scope">
  80. {{ dddw(dict.forSex, "id", scope.row.forSexId, "displayName") }}
  81. </template>
  82. </el-table-column>
  83. <el-table-column
  84. prop="maritalStatusId"
  85. label="适用婚姻状况"
  86. min-width="80"
  87. align="center"
  88. >
  89. <template slot-scope="scope">
  90. {{
  91. dddw(
  92. dict.forMaritalStatus,
  93. "id",
  94. scope.row.maritalStatusId,
  95. "displayName"
  96. )
  97. }}
  98. </template>
  99. </el-table-column>
  100. <el-table-column
  101. prop="creatorName"
  102. label="创建者"
  103. min-width="60"
  104. align="center"
  105. />
  106. <el-table-column label="创建时间" min-width="150" align="center">
  107. <template slot-scope="scope">
  108. {{
  109. scope.row.creationTime
  110. ? moment(scope.row.creationTime).format("yyyy-MM-DD HH:mm:ss")
  111. : ""
  112. }}
  113. </template>
  114. </el-table-column>
  115. <el-table-column label="操作">
  116. <template>
  117. <el-tag
  118. class="move"
  119. style="cursor: move; margin-left: 15px"
  120. draggable="true"
  121. >
  122. <i class="el-icon-d-caret" style="width: 1rem; height: 1rem"></i>
  123. </el-tag>
  124. </template>
  125. </el-table-column>
  126. </el-table>
  127. </div>
  128. </div>
  129. <!--按钮-->
  130. <div style="display: block;margin-left: 10px;">
  131. <div style="margin-top: 30px;">
  132. <el-button class="btnClass" @click="btnAdd">新增</el-button>
  133. </div>
  134. <div>
  135. <el-button class="btnClass" @click="btnEdit" >编辑</el-button>
  136. </div>
  137. <div>
  138. <el-button class="btnClass" @click="btnDel" >删除</el-button>
  139. </div>
  140. <div>
  141. <el-button class="btnClass" @click="btnSetTop" >置顶</el-button>
  142. </div>
  143. <div>
  144. <el-button class="btnClass" @click="btnSetBottom" >置低</el-button>
  145. </div>
  146. <div>
  147. <el-button class="btnClass" @click="btnSort" :disabled="!isDrag" >保存排序</el-button>
  148. </div>
  149. </div>
  150. </div>
  151. <!--分组项目信息 -->
  152. <div>
  153. <CustomerOrgGroupAsbitem :customerOrgGroup="form" :refreshMoney="refreshMoney"/>
  154. </div>
  155. </el-card>
  156. <!-- 新增或者编辑弹框 -->
  157. <el-dialog
  158. :title="form.id ? '编辑' : '新增'"
  159. :close-on-click-modal="false"
  160. :visible.sync="dialogVisible"
  161. width="800px"
  162. >
  163. <el-form :model="form" label-width="80px" :rules="rules" ref="form">
  164. <el-row>
  165. <el-col :span="8">
  166. <el-form-item prop="displayName" label="分组名称">
  167. <el-input v-model="form.displayName" size="small" />
  168. </el-form-item>
  169. </el-col>
  170. <el-col :span="8">
  171. <el-form-item label="金额">
  172. <el-input v-model="form.price" type="number" size="small" />
  173. </el-form-item>
  174. </el-col>
  175. <el-col :span="8">
  176. <el-form-item label="适用性别">
  177. <el-select v-model="form.forSexId" placeholder="请选择" size="small" >
  178. <el-option
  179. v-for="item in dict.forSex"
  180. :key="item.id"
  181. :label="item.displayName"
  182. :value="item.id"
  183. >
  184. </el-option>
  185. </el-select>
  186. </el-form-item>
  187. </el-col>
  188. <el-col :span="8">
  189. <el-form-item label="婚姻状况">
  190. <el-select
  191. v-model="form.maritalStatusId"
  192. placeholder="请选择"
  193. style="width: 100%" size="small" >
  194. <el-option
  195. v-for="item in dict.forMaritalStatus"
  196. :key="item.id"
  197. :label="item.displayName"
  198. :value="item.id"
  199. >
  200. </el-option>
  201. </el-select>
  202. </el-form-item>
  203. </el-col>
  204. <el-col :span="8">
  205. <el-form-item label="年龄下限">
  206. <el-input v-model="form.ageLowerLimit" type="number" min="1" max="200" size="small" />
  207. </el-form-item>
  208. </el-col>
  209. <el-col :span="8">
  210. <el-form-item label="年龄上限">
  211. <el-input v-model="form.ageUpperLimit" type="number" min="1" max="200" size="small" />
  212. </el-form-item>
  213. </el-col>
  214. <el-col :span="8">
  215. <el-form-item label="适用职务">
  216. <el-input v-model="form.jobPost" size="small" />
  217. </el-form-item>
  218. </el-col>
  219. <el-col :span="8">
  220. <el-form-item label="适用职称">
  221. <el-input v-model="form.jobTitle" size="small" />
  222. </el-form-item>
  223. </el-col>
  224. <el-col :span="8">
  225. <el-form-item label="备注">
  226. <el-input v-model="form.remark" size="small" />
  227. </el-form-item>
  228. </el-col>
  229. </el-row>
  230. </el-form>
  231. <span slot="footer" class="dialog-footer">
  232. <el-button @click="dialogVisible = false">取消</el-button>
  233. <el-button type="success" @click="computePrice">同比折算组合项目价格</el-button>
  234. <el-button type="primary" @click="onSubmit('form')">确定</el-button>
  235. </span>
  236. </el-dialog>
  237. <!-- -->
  238. </div>
  239. </template>
  240. <script>
  241. import moment from "moment";
  242. import Sortable from "sortablejs";
  243. import { getapi, postapi, putapi, deletapi } from "@/api/api";
  244. import { mapState } from "vuex";
  245. import { dddw, deepCopy, objCopy, arrayExistObj } from "../../utlis/proFunc";
  246. import CustomerOrgGroupAsbitem from "../../components/customerOrg/customerOrgGroupAsbitem.vue";
  247. export default {
  248. components: {
  249. CustomerOrgGroupAsbitem,
  250. },
  251. data() {
  252. return {
  253. customerOrg: [], //体检单位
  254. customerOrgGroups: [], //体检单位分组
  255. customerOrgId: "", //当前选中的体检单位id
  256. customerOrgRegisterList: [], //体检次数列表
  257. customerOrgRegister: {}, //体检次数
  258. isDrag: false,
  259. form: {
  260. //体检单位分组
  261. customerOrgId:'', //复制分组时用到(预留查历次分组)
  262. isComplete:'N', //体检次数是否完成,如完成不允许调整分组项目
  263. id: "",
  264. customerOrgRegisterId: null, //所属体检次数
  265. displayName: "",
  266. price: 0,
  267. forSexId: "A",
  268. maritalStatusId: "A",
  269. ageLowerLimit: 0,
  270. ageUpperLimit: 200,
  271. jobPost: "",
  272. jobTitle: "",
  273. remark: "",
  274. isMaxMedicalTimes: "N",
  275. },
  276. formInit: {},
  277. rules: {
  278. displayName: [
  279. { required: true, message: "请填写分组名称", trigger: "blur" },
  280. ],
  281. },
  282. dialogVisible: false,
  283. };
  284. },
  285. computed: {
  286. ...mapState(["personnelUnit", "window", "dict"]),
  287. },
  288. created() {
  289. this.rowDrop();
  290. this.formInit = deepCopy(this.form);
  291. },
  292. mounted() {
  293. //获取初始数据(单位、适用性别)
  294. this.dictInit();
  295. },
  296. methods: {
  297. moment,
  298. dddw,deepCopy,
  299. //刷新分组价格(供子组件调用)
  300. refreshMoney(formData){
  301. console.log('this is parent')
  302. let lfind = arrayExistObj(this.customerOrgGroups,'id',formData.id)
  303. if(lfind > -1) this.customerOrgGroups[lfind].price = formData.price
  304. },
  305. //确定排序
  306. btnSort() {
  307. const result = [];
  308. this.customerOrgGroups.forEach((item, index) => {
  309. result.push({ id: item.id, displayOrder: index });
  310. });
  311. putapi("/api/app/customerorggroup/updatesortmany", {
  312. itemList: result,
  313. }).then((res) => {
  314. this.$message.success("操作成功");
  315. this.isDrag = false;
  316. });
  317. },
  318. //初始化Sortable组件
  319. rowDrop() {
  320. // this.$nextTick(() => {
  321. // const tbody = document.querySelector(".el-table__body-wrapper tbody");
  322. // const _this = this;
  323. // Sortable.create(tbody, {
  324. // handle: ".move",
  325. // animation: 300,
  326. // onEnd({ newIndex, oldIndex }) {
  327. // _this.isDrag = false;
  328. // const currRow = _this.customerOrgGroups.splice(oldIndex, 1)[0];
  329. // _this.customerOrgGroups.splice(newIndex, 0, currRow);
  330. // _this.customerOrgGroups.map((item, index) => {
  331. // if (index == newIndex && index == oldIndex) {
  332. // } else if (index == oldIndex) {
  333. // } else if (index == newIndex) {
  334. // }
  335. // });
  336. // console.log(_this.customerOrgGroups.map((item) => item.displayOrder));
  337. // },
  338. // });
  339. // });
  340. this.$nextTick(() => {
  341. const el = document.querySelector(".el-table__body-wrapper tbody");
  342. //console.log('el0',el)
  343. const that = this;
  344. Sortable.create(el, {
  345. handle: ".move",
  346. animation: 300,
  347. //拖拽结束
  348. onEnd({ newIndex, oldIndex }) {
  349. that.isDrag = true;
  350. const currRow = that.customerOrgGroups.splice(oldIndex, 1)[0];
  351. that.customerOrgGroups.splice(newIndex, 0, currRow);
  352. console.log('el',el)
  353. },
  354. });
  355. });
  356. },
  357. //置底
  358. btnSetBottom() {
  359. if (!this.form.id) {
  360. this.$message.warning("请选择操作的数据");
  361. return
  362. }
  363. let lfind = arrayExistObj(this.customerOrgGroups,'id',this.form.id)
  364. let currentRow = {}
  365. putapi(
  366. `/api/app/customerorggroup/updatemanysort?id=${this.form.id}&SortType=2`
  367. ).then((res) => {
  368. this.$message.success("操作成功");
  369. currentRow = this.customerOrgGroups.splice(lfind,1)[0] //删除并赋值
  370. this.customerOrgGroups.unshift(currentRow)
  371. this.$refs['customerOrgGroups'].setCurrentRow(currentRow);
  372. });
  373. },
  374. //置顶
  375. btnSetTop() {
  376. if (!this.form.id) {
  377. this.$message.warning("请选择操作的数据");
  378. return
  379. }
  380. let lfind = arrayExistObj(this.customerOrgGroups,'id',this.form.id)
  381. let currentRow = {}
  382. putapi(
  383. `/api/app/customerorggroup/updatemanysort?id=${this.form.id}&SortType=1`
  384. ).then((res) => {
  385. this.$message.success("操作成功");
  386. currentRow = this.customerOrgGroups.splice(lfind,1)[0]
  387. this.customerOrgGroups.unshift(currentRow)
  388. this.$refs['customerOrgGroups'].setCurrentRow(currentRow);
  389. });
  390. },
  391. //选中颜色
  392. handleRowClassName({ row, rowIndex }) {
  393. // highLightBg 为 'selected'的高亮
  394. //console.log(rowIndex, row)
  395. //return row.highLightBg == 'selected' ? 'high-light-bg' : '';
  396. if (row.choosed) {
  397. return 'current-row';
  398. } else {
  399. return '';
  400. }
  401. },
  402. //获取初始数据
  403. dictInit() {
  404. //获取单位列表
  405. getapi("/api/app/customer-org/parent-all").then((res) => {
  406. if (res.code != -1) {
  407. this.customerOrgAll = res.data;
  408. let lfind = arrayExistObj(this.customerOrgAll,"id",this.dict.personOrgId);
  409. if (lfind > -1) this.customerOrgAll.splice(lfind, 1);
  410. this.customerOrg = deepCopy(this.customerOrgAll)
  411. }
  412. });
  413. //获取适用性别
  414. getapi("/api/app/for-sex").then((res) => {
  415. if (res.code != -1) {
  416. this.dict.forSex = res.data;
  417. }
  418. });
  419. },
  420. //获取体检次数下的分组
  421. getCustomerOrgGroup(customerOrgRegisterId) {
  422. this.isDrag = false
  423. objCopy(this.formInit,this.form)
  424. this.form.customerOrgRegisterId = customerOrgRegisterId
  425. this.customerOrgGroups = [];
  426. getapi(
  427. `/api/app/customerorggroup/getlistinfilter?CustomerOrgRegisterId=${customerOrgRegisterId}`
  428. ).then((res) => {
  429. if (res.code != -1) {
  430. this.customerOrgGroups = res.data.items;
  431. this.customerOrgGroups.forEach((e) => {
  432. e.customerOrgRegisterId = customerOrgRegisterId;
  433. });
  434. }
  435. });
  436. },
  437. filterMethod(keyWords) {
  438. if (keyWords) {
  439. this.customerOrg = [];
  440. this.customerOrgAll.forEach(item => {
  441. if (item.displayName.toLowerCase().indexOf(keyWords.toLowerCase()) > - 1
  442. || item.simpleCode.toLowerCase().indexOf(keyWords.toLowerCase()) > - 1
  443. // || item.shortName.toLowerCase().indexOf(keyWords.toLowerCase()) > - 1
  444. ) {
  445. this.customerOrg.push(item);
  446. }
  447. });
  448. } else {
  449. this.customerOrg = deepCopy(this.customerOrgAll);
  450. }
  451. },
  452. //选择单位
  453. changeCustomerOrg(v) {
  454. getapi(
  455. `/api/app/customerorgregister/getlistincustomerorgid?CustomerOrgId=${v}`
  456. ).then((res) => {
  457. if (res.code != -1) {
  458. this.customerOrgRegisterList = res.data;
  459. if (res.data.length > 0) {
  460. this.customerOrgRegister = res.data[res.data.length - 1];
  461. this.getCustomerOrgGroup(this.customerOrgRegister.id);
  462. } else {
  463. this.customerOrgRegister = {};
  464. this.customerOrgGroups = [];
  465. this.isDrag = false
  466. }
  467. objCopy(this.formInit,this.form)
  468. }
  469. });
  470. },
  471. //选择体检次数
  472. changeTimes(v) {
  473. this.getCustomerOrgGroup(v.id);
  474. },
  475. //点击分组
  476. rowClick(row) {
  477. objCopy(row, this.form);
  478. this.form.isComplete = this.customerOrgRegister.isComplete
  479. },
  480. //新增弹框
  481. btnAdd() {
  482. if (!this.customerOrgRegister.id) {
  483. this.$message.warning("请选择体检次数");
  484. return;
  485. }
  486. if(this.customerOrgRegister.isComplete.toUpperCase() == 'Y'){
  487. this.$message.warning("该单位体检次数已完成,不允许新增分组");
  488. return;
  489. }
  490. if (this.customerOrgRegister.isComplete.toUpperCase() == "Y") {
  491. this.$message.warning("该单位的该次体检次数已完成,不能再添加分组!");
  492. return;
  493. }
  494. this.form = deepCopy(this.formInit);
  495. this.form.customerOrgRegisterId = this.customerOrgRegister.id;
  496. this.form.customerOrgId = this.customerOrgId;
  497. this.dialogVisible = true;
  498. },
  499. //编辑弹框
  500. btnEdit() {
  501. if (!this.form.id) {
  502. this.$message.warning("请选择需要操作的数据");
  503. return;
  504. }
  505. if(this.customerOrgRegister.isComplete.toUpperCase() == 'Y'){
  506. this.$message.warning("该单位体检次数已完成,不允许编辑分组");
  507. return;
  508. }
  509. this.dialogVisible = true;
  510. },
  511. //删除
  512. btnDel() {
  513. if (!this.form.id) {
  514. this.$message.warning("请选择需要操作的数据");
  515. return;
  516. }
  517. if(this.customerOrgRegister.isComplete.toUpperCase() == 'Y'){
  518. this.$message.warning("该单位体检次数已完成,不允许删除分组");
  519. return;
  520. }
  521. this.$confirm("此操作将永久删除该记录, 是否继续?", "提示", {
  522. confirmButtonText: "是",
  523. cancelButtonText: " 否 ",
  524. type: "warning",
  525. })
  526. .then(() => {
  527. return deletapi(`/api/app/customer-org-group/${this.form.id}`);
  528. })
  529. .then((res) => {
  530. if (res.code != -1) {
  531. this.$message.success("删除成功");
  532. let lfind = arrayExistObj(
  533. this.customerOrgGroups,
  534. "id",
  535. this.form.id
  536. );
  537. if (lfind > -1) this.customerOrgGroups.splice(lfind, 1);
  538. objCopy(this.formInit,this.form)
  539. this.isDrag = false
  540. }
  541. })
  542. .catch((err) => {
  543. if (err == "cancel") {
  544. this.$message.info("已取消删除");
  545. }
  546. });
  547. },
  548. onSubmit(formName) {
  549. this.$refs[formName].validate((valid, fields) => {
  550. if (!valid) {
  551. this.$message.warning(fields[Object.keys(fields)[0]][0].message);
  552. return false;
  553. }
  554. if (!this.form.customerOrgRegisterId) {
  555. this.$message.warning("请选择单位体检次数!");
  556. return false;
  557. }
  558. let body = deepCopy(this.form);
  559. delete body.id;
  560. delete body.customerOrgId;
  561. delete body.isComplete;
  562. if (this.form.id) {
  563. //编辑
  564. putapi(`/api/app/customer-org-group/${this.form.id}`, body).then(
  565. (res) => {
  566. if (res.code != -1) {
  567. this.$message.success("操作成功!");
  568. let lfind = arrayExistObj(
  569. this.customerOrgGroups,
  570. "id",
  571. this.form.id
  572. );
  573. if (lfind > -1)
  574. objCopy(this.form, this.customerOrgGroups[lfind]);
  575. this.dialogVisible = false;
  576. }
  577. }
  578. );
  579. } else {
  580. //新增
  581. postapi(
  582. "/api/customerorggroup/createcustomerorggroupincustomerorgregister",
  583. body
  584. ).then((res) => {
  585. if (res.code != -1) {
  586. this.$message.success("操作成功!");
  587. this.form.id = res.data.id;
  588. this.customerOrgGroups.push(deepCopy(res.data));
  589. this.$refs['customerOrgGroups'].setCurrentRow(this.customerOrgGroups[this.customerOrgGroups.length - 1]);
  590. this.dialogVisible = false;
  591. }
  592. });
  593. }
  594. });
  595. },
  596. computePrice(){
  597. if(!this.form.id){
  598. this.$message.warning("尚未保存信息,不可执行此操作!")
  599. return
  600. }
  601. let customerOrgGroupId = this.form.id
  602. let customerOrgGroupAsbitems = [] //分组包含的套餐
  603. getapi(`/api/app/customerorggroupdetail/getcustomerorggroupdetailinasbitem?CustomerOrgGroupId=${customerOrgGroupId}
  604. `).then(res => {
  605. if(res.code != -1){
  606. customerOrgGroupAsbitems = res.data;
  607. if(customerOrgGroupAsbitems.length < 1){
  608. this.$message.warning("当前分组尚未设置组合项目,不可执行此操作!")
  609. }else{
  610. let body = {
  611. customerOrgGroupId,
  612. details:this.madeNewGroupAsbitems(customerOrgGroupAsbitems,this.form.price)
  613. }
  614. console.log('body',body)
  615. return postapi('/api/app/customerorggroupdetail/createcustomerorggroupdetailmany',body)
  616. }
  617. }
  618. }).then(res =>{
  619. if(res.code != -1){
  620. //this.$message.success("操作成功");
  621. //触发分组明细刷新
  622. this.form.id = ''
  623. //要做延时处理,否则不会触发监听
  624. setTimeout(() => {
  625. this.form.id = customerOrgGroupId;
  626. this.onSubmit('form')
  627. }, 100)
  628. }
  629. })
  630. },
  631. madeNewGroupAsbitems(oldGroupAsbitems,newTotal){
  632. newTotal = Number(newTotal).toFixed(2)
  633. let newGroupAsbitems = []
  634. let oldTotal = Number(0)
  635. oldGroupAsbitems.forEach(e =>{
  636. oldTotal += Number(e.asbitemMoney) //customerOrgGroupDetailMoney
  637. })
  638. oldTotal = Number(oldTotal).toFixed(2)
  639. let discount = 0
  640. if(oldTotal != 0) discount = (newTotal * 100 /oldTotal).toFixed(2)
  641. oldTotal = Number(0)
  642. oldGroupAsbitems.forEach(e =>{
  643. e.customerOrgGroupDetailPrice = (e.price * discount/100).toFixed(2)
  644. e.customerOrgGroupDetailMoney = (e.customerOrgGroupDetailPrice * e.customerOrgGroupDetailAmount).toFixed(2)
  645. oldTotal += Number(e.customerOrgGroupDetailMoney)
  646. })
  647. oldTotal = Number(oldTotal).toFixed(2)
  648. //console.log('discount,oldTotal',discount,oldTotal)
  649. let didTotal = Number(newTotal - oldTotal).toFixed(2)
  650. if(didTotal != 0){
  651. for(let i = 0;i<oldGroupAsbitems.length;i++){
  652. if(oldGroupAsbitems[i].customerOrgGroupDetailAmount == 1){
  653. oldGroupAsbitems[i].customerOrgGroupDetailPrice = (Number(oldGroupAsbitems[i].customerOrgGroupDetailPrice) + Number(didTotal)).toFixed(2)
  654. break
  655. }
  656. }
  657. }
  658. oldGroupAsbitems.forEach(e =>{
  659. newGroupAsbitems.push({
  660. customerOrgGroupId:e.customerOrgGroupId,
  661. asbitemId:e.asbitemId,
  662. price:e.customerOrgGroupDetailPrice,
  663. amount:e.customerOrgGroupDetailAmount
  664. })
  665. })
  666. return newGroupAsbitems
  667. },
  668. },
  669. };
  670. </script>
  671. <style scoped>
  672. @import "../../assets/css/global_button.css";
  673. @import "../../assets/css/global_dialog.css";
  674. @import "../../assets/css/global_table.css";
  675. @import "../../assets/css/global_form.css";
  676. @import "../../assets/css/global_input.css";
  677. @import "../../assets/css/global.css";
  678. .btnClass {
  679. width:100px;
  680. margin-bottom: 5px
  681. }
  682. </style>