memberFeeSet.vue 35 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156
  1. <template>
  2. <div class="m-container">
  3. <h2>
  4. <div class="squrt"></div>
  5. 学练宝收费标准
  6. </h2>
  7. <div
  8. class="m-core"
  9. v-if="(tableList.length > 0 || rules.page > 1) && contextFlag"
  10. >
  11. <save-form
  12. :inline="true"
  13. class="searchForm"
  14. save-key="memberFeeSet"
  15. ref="searchForm"
  16. @submit="search"
  17. @reset="onReSet"
  18. :model.sync="searchForm"
  19. >
  20. <!-- 状态 指导老师 活动方案-->
  21. <el-form-item prop="search">
  22. <el-input
  23. v-model.trim="searchForm.search"
  24. clearable
  25. placeholder="学练宝名称"
  26. ></el-input>
  27. </el-form-item>
  28. <el-form-item prop="organId">
  29. <el-select
  30. class="multiple"
  31. filterable
  32. style="width: 180px !important"
  33. v-model.trim="searchForm.organId"
  34. clearable
  35. placeholder="请选择分部"
  36. >
  37. <el-option
  38. v-for="(item, index) in selects.branchs"
  39. :key="index"
  40. :label="item.name"
  41. :value="item.id"
  42. ></el-option>
  43. </el-select>
  44. </el-form-item>
  45. <el-form-item>
  46. <el-button native-type="submit" type="danger">搜索</el-button>
  47. <el-button native-type="reset" type="primary">重置</el-button>
  48. </el-form-item>
  49. </save-form>
  50. <el-button
  51. type="primary"
  52. style="margin-bottom: 20px"
  53. v-permission="'memberRankOrganizationFeeMapper/add'"
  54. @click="addFee"
  55. >新增收费标准</el-button
  56. >
  57. <el-table
  58. :data="tableList"
  59. :header-cell-style="{ background: '#EDEEF0', color: '#444' }"
  60. >
  61. <el-table-column
  62. align="left"
  63. prop="organName"
  64. label="分部"
  65. ></el-table-column>
  66. <el-table-column
  67. align="left"
  68. prop="rankName"
  69. label="学练宝名称"
  70. width="120px"
  71. ></el-table-column>
  72. <el-table-column align="left" prop="type" label="月收费">
  73. <template slot-scope="scope">
  74. <div>
  75. <p>
  76. 团购:
  77. {{
  78. scope.row.memberFeeSetting.groupPurchaseMonthFee
  79. | hasMoneyFormat
  80. }}
  81. </p>
  82. <p>
  83. 原价:
  84. {{
  85. scope.row.memberFeeSetting.originalMonthFee | hasMoneyFormat
  86. }}
  87. </p>
  88. <div>经营报表</div>
  89. <div>
  90. 确认收入:
  91. {{ scope.row.memberFeeSetting.incomeMonthFee | hasMoneyFormat }}
  92. </div>
  93. </div>
  94. </template>
  95. </el-table-column>
  96. <el-table-column align="left" prop="type" label="季度收费">
  97. <template slot-scope="scope">
  98. <div>
  99. <p>
  100. 团购:
  101. {{
  102. scope.row.memberFeeSetting.groupPurchaseQuarterlyFee
  103. | hasMoneyFormat
  104. }}
  105. </p>
  106. <!-- <p>
  107. 零售:
  108. {{
  109. scope.row.memberFeeSetting.currentQuarterlyFee | hasMoneyFormat
  110. }}
  111. </p> -->
  112. <p>
  113. 原价:
  114. {{
  115. scope.row.memberFeeSetting.originalQuarterlyFee
  116. | hasMoneyFormat
  117. }}
  118. </p>
  119. <div>经营报表</div>
  120. <div>
  121. 确认收入:
  122. {{
  123. scope.row.memberFeeSetting.incomeQuarterlyFee | hasMoneyFormat
  124. }}
  125. </div>
  126. </div>
  127. </template>
  128. </el-table-column>
  129. <el-table-column align="left" prop="type" label="半年收费">
  130. <template slot-scope="scope">
  131. <div>
  132. <p>
  133. 团购:
  134. {{
  135. scope.row.memberFeeSetting.groupPurchaseHalfYearFee
  136. | hasMoneyFormat
  137. }}
  138. </p>
  139. <!-- <p>
  140. 零售:
  141. {{
  142. scope.row.memberFeeSetting.currentHalfYearFee | hasMoneyFormat
  143. }}
  144. </p> -->
  145. <p>
  146. 原价:
  147. {{
  148. scope.row.memberFeeSetting.originalHalfYearFee
  149. | hasMoneyFormat
  150. }}
  151. </p>
  152. <div>经营报表</div>
  153. <div>
  154. 确认收入:
  155. {{
  156. scope.row.memberFeeSetting.incomeHalfYearFee | hasMoneyFormat
  157. }}
  158. </div>
  159. </div>
  160. </template>
  161. </el-table-column>
  162. <el-table-column align="left" prop="type" label="年收费">
  163. <template slot-scope="scope">
  164. <div>
  165. <p>
  166. 团购:
  167. {{
  168. scope.row.memberFeeSetting.groupPurchaseYearFee
  169. | hasMoneyFormat
  170. }}
  171. </p>
  172. <!-- <p>
  173. 零售:
  174. {{ scope.row.memberFeeSetting.currentYearFee | hasMoneyFormat }}
  175. </p> -->
  176. <p>
  177. 原价:
  178. {{
  179. scope.row.memberFeeSetting.originalYearFee | hasMoneyFormat
  180. }}
  181. </p>
  182. <div>经营报表</div>
  183. <div>
  184. 确认收入:
  185. {{ scope.row.memberFeeSetting.incomeYearFee | hasMoneyFormat }}
  186. </div>
  187. </div>
  188. </template>
  189. </el-table-column>
  190. <el-table-column
  191. width="105px"
  192. prop="updateTime"
  193. label="修改时间"
  194. ></el-table-column>
  195. <el-table-column
  196. prop="operatorName"
  197. label="修改人"
  198. width="80px"
  199. ></el-table-column>
  200. <el-table-column align="center" label="操作" width="100px">
  201. <template slot-scope="scope">
  202. <div>
  203. <!-- memberRankSetting/add -->
  204. <auth auths="memberRankOrganizationFeeMapper/get">
  205. <el-button type="text" @click="resetFee(scope.row, 'look')"
  206. >详情</el-button
  207. >
  208. </auth>
  209. <auth :auths="'memberRankOrganizationFeeMapper/update'">
  210. <el-button type="text" @click="resetFee(scope.row, 'update')"
  211. >修改</el-button
  212. >
  213. </auth>
  214. </div>
  215. </template>
  216. </el-table-column>
  217. </el-table>
  218. <pagination
  219. save-key="memberFeeSet"
  220. :total.sync="rules.total"
  221. sync
  222. :page.sync="rules.page"
  223. :limit.sync="rules.limit"
  224. :page-sizes="rules.page_size"
  225. @pagination="getList"
  226. />
  227. </div>
  228. <emptyPage
  229. @submit="addFee"
  230. title="学练宝收费标准"
  231. btnTitle="新建学练宝收费标准"
  232. :context="context"
  233. v-if="!(tableList.length > 0 || rules.page > 1) && contextFlag"
  234. />
  235. <el-dialog
  236. class="dialog"
  237. :title="title"
  238. top="12vh"
  239. :close-on-click-modal="false"
  240. :visible.sync="branchStatus"
  241. v-if="branchStatus"
  242. default-expand-all
  243. @close="onFormClose('ruleForm')"
  244. width="820px"
  245. >
  246. <el-form class="elForm" :model="form" label-position="top" ref="ruleForm">
  247. <div class="wrap">
  248. <el-form-item
  249. label="所属分部"
  250. prop="organIds"
  251. :rules="[{ required: true, message: '请选择分部' }]"
  252. :label-width="formLabelWidth"
  253. >
  254. <el-select
  255. :disabled="addDisabled || pageType === 'update'"
  256. class="multiple"
  257. filterable
  258. v-model.trim="form.organIds"
  259. clearable
  260. multiple
  261. :collapse-tags="true"
  262. placeholder="请选择分部"
  263. @change="getAllMember"
  264. >
  265. <el-option
  266. v-for="(item, index) in selects.branchs"
  267. :key="index"
  268. :label="item.name"
  269. :value="item.id"
  270. ></el-option>
  271. </el-select>
  272. </el-form-item>
  273. <el-form-item
  274. label="学练宝版本"
  275. prop="memberRankSettingId"
  276. :rules="[{ required: true, message: '请选择学练宝版本' }]"
  277. :label-width="formLabelWidth"
  278. >
  279. <el-cascader
  280. filterable
  281. v-model.trim="form.memberRankSettingId"
  282. clearable
  283. placeholder="请选择学练宝版本"
  284. :disabled="addDisabled"
  285. :options="remberList"
  286. :props="{ value: 'id', label: 'name' }"
  287. ></el-cascader>
  288. </el-form-item>
  289. </div>
  290. <div class="lineTitle">月度收费</div>
  291. <div class="wrap">
  292. <el-form-item
  293. prop="groupPurchaseMonthFee"
  294. label="团购价"
  295. :rules="[
  296. { required: true, message: '请输入月收费团购价' },
  297. {
  298. pattern: /^[1-9][0-9]*$/,
  299. message: '请输入大于0的正整数'
  300. },
  301. { validator: validateMonth, trigger: 'blur' }
  302. ]"
  303. :label-width="formLabelWidth"
  304. :placeholder="monthRule"
  305. >
  306. <el-input
  307. v-model="form.groupPurchaseMonthFee"
  308. :disabled="addDisabled"
  309. :placeholder="monthRule"
  310. >
  311. <template slot="append"
  312. >元/月</template
  313. >
  314. </el-input>
  315. </el-form-item>
  316. <el-form-item
  317. prop="currentMonthFee"
  318. label="零售价"
  319. :rules="[
  320. { required: true, message: '请输入月收费零售价' },
  321. {
  322. pattern: /^[1-9][0-9]*$/,
  323. message: '请输入大于0的正整数'
  324. },
  325. { validator: validateMonth, trigger: 'blur' }
  326. ]"
  327. :label-width="formLabelWidth"
  328. >
  329. <el-input
  330. v-model="form.currentMonthFee"
  331. :disabled="addDisabled"
  332. :placeholder="monthRule"
  333. >
  334. <template slot="append"
  335. >元/月</template
  336. >
  337. </el-input>
  338. </el-form-item>
  339. <el-form-item
  340. prop="originalMonthFee"
  341. label="原价"
  342. :rules="[
  343. { required: true, message: '请输入月收费原价' },
  344. {
  345. pattern: /^[1-9][0-9]*$/,
  346. message: '请输入大于0的正整数'
  347. },
  348. { validator: validateMonth, trigger: 'blur' }
  349. ]"
  350. :label-width="formLabelWidth"
  351. >
  352. <el-input
  353. v-model="form.originalMonthFee"
  354. :disabled="addDisabled"
  355. :placeholder="monthRule"
  356. >
  357. <template slot="append"
  358. >元/月</template
  359. >
  360. </el-input>
  361. </el-form-item>
  362. <el-form-item
  363. prop="incomeMonthFee"
  364. label="经营报表确认收入"
  365. :rules="[
  366. { required: true, message: '请输入月度经营报表确认收入' },
  367. {
  368. pattern: /^[1-9][0-9]*$/,
  369. message: '请输入大于0的正整数'
  370. },
  371. { validator: validateMonthIncome, trigger: 'blur' }
  372. ]"
  373. :label-width="formLabelWidth"
  374. >
  375. <el-input
  376. v-model="form.incomeMonthFee"
  377. :disabled="addDisabled"
  378. :placeholder="monthRuleIncome"
  379. >
  380. <template slot="append"
  381. >元</template
  382. >
  383. </el-input>
  384. </el-form-item>
  385. </div>
  386. <div class="lineTitle">季度收费</div>
  387. <div class="wrap">
  388. <el-form-item
  389. prop="groupPurchaseQuarterlyFee"
  390. label="团购价"
  391. :rules="[
  392. { required: true, message: '请输入季度收费团购价' },
  393. {
  394. pattern: /^[1-9][0-9]*$/,
  395. message: '请输入大于0的正整数'
  396. },
  397. { validator: validateQuarterly, trigger: 'blur' }
  398. ]"
  399. :label-width="formLabelWidth"
  400. >
  401. <el-input
  402. v-model="form.groupPurchaseQuarterlyFee"
  403. :disabled="addDisabled"
  404. :placeholder="quarterlyRule"
  405. >
  406. <template slot="append"
  407. >元/季度</template
  408. >
  409. </el-input>
  410. </el-form-item>
  411. <el-form-item
  412. prop="currentQuarterlyFee"
  413. label="零售价"
  414. :rules="[
  415. { required: true, message: '请输入季度收费零售价' },
  416. {
  417. pattern: /^[1-9][0-9]*$/,
  418. message: '请输入大于0的正整数'
  419. },
  420. { validator: validateQuarterly, trigger: 'blur' }
  421. ]"
  422. :label-width="formLabelWidth"
  423. >
  424. <el-input
  425. v-model="form.currentQuarterlyFee"
  426. :disabled="addDisabled"
  427. :placeholder="quarterlyRule"
  428. >
  429. <template slot="append"
  430. >元/季度</template
  431. >
  432. </el-input>
  433. </el-form-item>
  434. <el-form-item
  435. prop="originalQuarterlyFee"
  436. label="原价"
  437. :rules="[
  438. { required: true, message: '请输入季度收费原价' },
  439. {
  440. pattern: /^[1-9][0-9]*$/,
  441. message: '请输入大于0的正整数'
  442. },
  443. { validator: validateQuarterly, trigger: 'blur' }
  444. ]"
  445. :label-width="formLabelWidth"
  446. >
  447. <el-input
  448. v-model="form.originalQuarterlyFee"
  449. :disabled="addDisabled"
  450. :placeholder="quarterlyRule"
  451. >
  452. <template slot="append"
  453. >元/季度</template
  454. >
  455. </el-input>
  456. </el-form-item>
  457. <el-form-item
  458. prop="incomeQuarterlyFee"
  459. label="经营报表确认收入"
  460. :rules="[
  461. { required: true, message: '请输入季度经营报表确认收入' },
  462. {
  463. pattern: /^[1-9][0-9]*$/,
  464. message: '请输入大于0的正整数'
  465. },
  466. { validator: validateQuarterlyIncome, trigger: 'blur' }
  467. ]"
  468. :label-width="formLabelWidth"
  469. >
  470. <el-input
  471. v-model="form.incomeQuarterlyFee"
  472. :disabled="addDisabled"
  473. :placeholder="quarterlyRuleIncome"
  474. >
  475. <template slot="append"
  476. >元</template
  477. >
  478. </el-input>
  479. </el-form-item>
  480. </div>
  481. <div class="lineTitle">半年收费</div>
  482. <div class="wrap">
  483. <el-form-item
  484. prop="groupPurchaseHalfYearFee"
  485. label="半年收费团购价"
  486. :rules="[
  487. { required: true, message: '请输入半年收费团购价' },
  488. {
  489. pattern: /^[1-9][0-9]*$/,
  490. message: '请输入大于0的正整数'
  491. },
  492. { validator: validateHalfYear, trigger: 'blur' }
  493. ]"
  494. :label-width="formLabelWidth"
  495. >
  496. <el-input
  497. v-model="form.groupPurchaseHalfYearFee"
  498. :disabled="addDisabled"
  499. :placeholder="halfYearRule"
  500. >
  501. <template slot="append"
  502. >元/半年</template
  503. >
  504. </el-input>
  505. </el-form-item>
  506. <el-form-item
  507. prop="currentHalfYearFee"
  508. label="半年收费零售价"
  509. :rules="[
  510. { required: true, message: '请输入半年收费零售价' },
  511. {
  512. pattern: /^[1-9][0-9]*$/,
  513. message: '请输入大于0的正整数'
  514. },
  515. { validator: validateHalfYear, trigger: 'blur' }
  516. ]"
  517. :label-width="formLabelWidth"
  518. >
  519. <el-input
  520. v-model="form.currentHalfYearFee"
  521. :disabled="addDisabled"
  522. :placeholder="halfYearRule"
  523. >
  524. <template slot="append"
  525. >元/半年</template
  526. >
  527. </el-input>
  528. </el-form-item>
  529. <el-form-item
  530. prop="originalHalfYearFee"
  531. label="半年收费原价"
  532. :rules="[
  533. { required: true, message: '请输入半年收费原价' },
  534. {
  535. pattern: /^[1-9][0-9]*$/,
  536. message: '请输入大于0的正整数'
  537. },
  538. { validator: validateHalfYear, trigger: 'blur' }
  539. ]"
  540. :label-width="formLabelWidth"
  541. >
  542. <el-input
  543. v-model="form.originalHalfYearFee"
  544. :disabled="addDisabled"
  545. :placeholder="halfYearRule"
  546. >
  547. <template slot="append"
  548. >元/半年</template
  549. >
  550. </el-input>
  551. </el-form-item>
  552. <el-form-item
  553. prop="incomeHalfYearFee"
  554. label="经营报表确认收入"
  555. :rules="[
  556. { required: true, message: '请输入半年经营报表确认收入' },
  557. {
  558. pattern: /^[1-9][0-9]*$/,
  559. message: '请输入大于0的正整数'
  560. },
  561. { validator: validateHalfYearIncome, trigger: 'blur' }
  562. ]"
  563. :label-width="formLabelWidth"
  564. >
  565. <el-input
  566. v-model="form.incomeHalfYearFee"
  567. :disabled="addDisabled"
  568. :placeholder="halfYearRuleIncome"
  569. >
  570. <template slot="append"
  571. >元</template
  572. >
  573. </el-input>
  574. </el-form-item>
  575. </div>
  576. <div class="lineTitle">年度收费</div>
  577. <div class="wrap">
  578. <el-form-item
  579. prop="groupPurchaseYearFee"
  580. label="年收费团购价"
  581. :rules="[
  582. { required: true, message: '请输入年收费团购价' },
  583. {
  584. pattern: /^[1-9][0-9]*$/,
  585. message: '请输入大于0的正整数'
  586. },
  587. { validator: validateYear, trigger: 'blur' }
  588. ]"
  589. :label-width="formLabelWidth"
  590. >
  591. <el-input
  592. v-model="form.groupPurchaseYearFee"
  593. :disabled="addDisabled"
  594. :placeholder="yearRule"
  595. >
  596. <template slot="append"
  597. >元/年</template
  598. >
  599. </el-input>
  600. </el-form-item>
  601. <el-form-item
  602. prop="currentYearFee"
  603. label="年收费零售价"
  604. :rules="[
  605. { required: true, message: '请输入年收费零售价' },
  606. {
  607. pattern: /^[1-9][0-9]*$/,
  608. message: '请输入大于0的正整数'
  609. },
  610. { validator: validateYear, trigger: 'blur' }
  611. ]"
  612. :label-width="formLabelWidth"
  613. >
  614. <el-input
  615. v-model="form.currentYearFee"
  616. :disabled="addDisabled"
  617. :placeholder="yearRule"
  618. >
  619. <template slot="append"
  620. >元/年</template
  621. >
  622. </el-input>
  623. </el-form-item>
  624. <el-form-item
  625. prop="originalYearFee"
  626. label="年收费原价"
  627. :rules="[
  628. { required: true, message: '请输入年收费原价' },
  629. {
  630. pattern: /^[1-9][0-9]*$/,
  631. message: '请输入大于0的正整数'
  632. },
  633. { validator: validateYear, trigger: 'blur' }
  634. ]"
  635. :label-width="formLabelWidth"
  636. >
  637. <el-input
  638. v-model="form.originalYearFee"
  639. :disabled="addDisabled"
  640. :placeholder="yearRule"
  641. >
  642. <template slot="append"
  643. >元/年</template
  644. >
  645. </el-input>
  646. </el-form-item>
  647. <el-form-item
  648. prop="incomeYearFee"
  649. label="经营报表确认收入"
  650. :rules="[
  651. { required: true, message: '请输入年度经营报表确认收入' },
  652. {
  653. pattern: /^[1-9][0-9]*$/,
  654. message: '请输入大于0的正整数'
  655. },
  656. { validator: validateYearIncome, trigger: 'blur' }
  657. ]"
  658. :label-width="formLabelWidth"
  659. >
  660. <el-input
  661. v-model="form.incomeYearFee"
  662. :disabled="addDisabled"
  663. :placeholder="yearRuleIncome"
  664. >
  665. <template slot="append"
  666. >元</template
  667. >
  668. </el-input>
  669. </el-form-item>
  670. </div>
  671. </el-form>
  672. <span slot="footer" class="dialog-footer">
  673. <el-button v-if="!addDisabled" @click="branchStatus = false"
  674. >取 消</el-button
  675. >
  676. <el-button @click="onSubmit" type="primary">确 定</el-button>
  677. </span>
  678. </el-dialog>
  679. </div>
  680. </template>
  681. <script>
  682. import {
  683. api_getMemberRankSetting,
  684. addMemberOrganizationFeeMapperV2,
  685. getmemberRankOrganizationFeeMapper,
  686. getmemberOrganizationFeeMapperkDetail,
  687. resetMemberOrganizationFeeMapper
  688. } from "./api";
  689. import { sysConfigList } from "@/api/generalSettings";
  690. import pagination from "@/components/Pagination/index";
  691. import emptyPage from "@/components/emptyPage";
  692. // numeral(this.list.form[index].courseTotalMinuties * this.list.form[index].unitPrice).format('0,0.00')
  693. export default {
  694. components: { pagination, emptyPage },
  695. name: "memberFeeSet",
  696. data() {
  697. return {
  698. searchForm: {
  699. search: null,
  700. organId: null
  701. },
  702. rules: {
  703. // 分页规则
  704. limit: 10, // 限制显示条数
  705. page: 1, // 当前页
  706. total: 0, // 总条数
  707. page_size: [10, 20, 40, 50] // 选择限制显示条数
  708. },
  709. tableList: [],
  710. addDisabled: false,
  711. title: "新增收费标准",
  712. pageType: "create",
  713. formLabelWidth: "120px",
  714. form: {
  715. currentDayFee: "",
  716. currentHalfYearFee: "",
  717. currentMonthFee: "",
  718. currentYearFee: "",
  719. originalDayFee: "",
  720. originalHalfYearFee: "",
  721. originalMonthFee: "",
  722. originalYearFee: "",
  723. groupPurchaseDayFee: "",
  724. groupPurchaseHalfYearFee: "",
  725. groupPurchaseMonthFee: "",
  726. groupPurchaseQuarterlyFee: "",
  727. groupPurchaseYearFee: "",
  728. organIds: [],
  729. memberRankSettingId: [],
  730. incomeMonthFee: "", // 月经营报表
  731. incomeQuarterlyFee: "", // 季度经营报表
  732. incomeHalfYearFee: "", // 半年经营报表
  733. incomeYearFee: "" // 年经营报表
  734. },
  735. branchStatus: false,
  736. remberList: [],
  737. rulesForm: {
  738. minMonthFee: null,
  739. maxMonthFee: null,
  740. minQuarterlyFee: null,
  741. maxQuarterlyFee: null,
  742. minHalfYearFee: null,
  743. maxHalfYearFee: null,
  744. minYearFee: null,
  745. maxYearFee: null
  746. },
  747. context:
  748. "学练宝收费标准,可根据各分部的实际情况为分部制定不同的售价标准,设置完成后,各分部为学员创建学练宝缴费时默认以此处设置的价格向学员收费。",
  749. contextFlag: false
  750. };
  751. },
  752. async mounted() {
  753. await this.$store.dispatch("setBranchs");
  754. this.getList();
  755. this.getRules();
  756. },
  757. methods: {
  758. async getAllMember() {
  759. // 获取所有的会员
  760. try {
  761. const res = await api_getMemberRankSetting({
  762. organIds: this.form.organIds.join(','),
  763. id: this.form.outId
  764. });
  765. this.remberList = res.data;
  766. // 默认选中第一个
  767. // if (this.pageType == "create" && this.remberList.length > 0) {
  768. // this.form.memberRankSettingId = this.remberList[0].id;
  769. // }
  770. } catch {}
  771. },
  772. async getRules() {
  773. try {
  774. const res = await sysConfigList({ group: "DEFAULT" });
  775. const paramName = "cloud_price_range";
  776. res.data.forEach(item => {
  777. if (item.paramName == paramName) {
  778. const itemValue = item.paranValue
  779. ? JSON.parse(item.paranValue)
  780. : null;
  781. if (itemValue) {
  782. this.rulesForm = itemValue;
  783. }
  784. }
  785. });
  786. } catch (e) {
  787. console.log(e);
  788. }
  789. },
  790. search() {
  791. this.rules.page = 1;
  792. this.getList();
  793. },
  794. onReSet() {
  795. this.$refs.searchForm.resetFields();
  796. this.search();
  797. },
  798. async getList() {
  799. try {
  800. const res = await getmemberRankOrganizationFeeMapper({
  801. ...this.searchForm,
  802. rows: this.rules.limit,
  803. page: this.rules.page
  804. });
  805. this.contextFlag = true;
  806. this.tableList = res.data.rows;
  807. this.rules.total = res.data.total;
  808. } catch {}
  809. },
  810. onFormClose(ruleForm) {
  811. (this.form = {
  812. currentDayFee: "",
  813. currentHalfYearFee: "",
  814. currentMonthFee: "",
  815. currentYearFee: "",
  816. originalDayFee: "",
  817. originalHalfYearFee: "",
  818. originalMonthFee: "",
  819. originalYearFee: "",
  820. incomeMonthFee: "", // 月经营报表
  821. incomeQuarterlyFee: "", // 季度经营报表
  822. incomeHalfYearFee: "", // 半年经营报表
  823. incomeYearFee: "", // 年经营报表
  824. organIds: [],
  825. memberRankSettingId: []
  826. }),
  827. this.$refs[ruleForm].resetFields();
  828. },
  829. addFee() {
  830. this.title = "新增收费标准";
  831. this.addDisabled = false;
  832. this.form.outId = null;
  833. this.pageType = "create";
  834. this.branchStatus = true;
  835. },
  836. async resetFee(row, type) {
  837. if (type == "update") {
  838. this.title = "修改收费标准";
  839. this.pageType = "update";
  840. this.addDisabled = false;
  841. } else {
  842. this.addDisabled = true;
  843. this.title = "查看收费标准";
  844. this.pageType = "look";
  845. }
  846. let obj = {};
  847. for (let key in row.memberFeeSetting) {
  848. if ((row.memberFeeSetting, key, row.memberFeeSetting[key])) {
  849. obj[key] = row.memberFeeSetting[key];
  850. }
  851. }
  852. await this.getAllMember()
  853. this.form = {
  854. ...obj,
  855. organIds: row.organId ? [row.organId] : [],
  856. outId: row.id,
  857. memberRankSettingId: row.memberRankSettingId ? this.formatParentId(row.memberRankSettingId, this.remberList) : [],
  858. };
  859. // this.form.memberRankSettingId =
  860. // this.$forceUpdate()
  861. this.branchStatus = true;
  862. },
  863. formatParentId(id, list, ids = []) {
  864. for (const item of list) {
  865. if (item.children) {
  866. const cIds = this.formatParentId(
  867. id,
  868. item.children,
  869. [...ids, item.id]
  870. );
  871. if (cIds.includes(id)) {
  872. return cIds;
  873. }
  874. }
  875. if (item.id === id) {
  876. return [...ids, id];
  877. }
  878. }
  879. return ids;
  880. },
  881. onSubmit() {
  882. if (this.pageType == "look") {
  883. this.branchStatus = false;
  884. return;
  885. }
  886. console.log(this.form)
  887. this.$refs.ruleForm.validate(async flag => {
  888. if (flag) {
  889. const memberRankSettingId = this.form.memberRankSettingId.length > 0 ? this.form.memberRankSettingId[this.form.memberRankSettingId.length -1] : null
  890. if (this.pageType == "update") {
  891. try {
  892. await resetMemberOrganizationFeeMapper({
  893. memberFeeSetting: { ...this.form },
  894. organId: this.form.organIds.join(','),
  895. memberRankSettingId,
  896. id: this.form.outId
  897. });
  898. this.$message.success("修改成功");
  899. this.branchStatus = false;
  900. this.getList();
  901. } catch (e) {
  902. console.log(e);
  903. }
  904. } else if (this.pageType == "create") {
  905. try {
  906. await addMemberOrganizationFeeMapperV2({
  907. memberFeeSetting: { ...this.form },
  908. organIds: this.form.organIds.join(','),
  909. memberRankSettingId
  910. });
  911. this.$message.success("新建成功");
  912. this.branchStatus = false;
  913. this.getList();
  914. } catch {}
  915. }
  916. }
  917. });
  918. },
  919. validateMonthIncome(rule, value, callback) {
  920. const one = Number(value);
  921. const min = Number(this.rulesForm.minMonthFee);
  922. const max = this.form.groupPurchaseMonthFee
  923. ? Number(this.form.groupPurchaseMonthFee)
  924. : Number(this.rulesForm.maxMonthFee);
  925. if (one >= min && one <= max) {
  926. return callback();
  927. }
  928. return callback(new Error(`月度经营报表应在${min}-${max}之间`));
  929. },
  930. validateMonth(rule, value, callback) {
  931. const one = Number(value);
  932. const min = Number(this.rulesForm.minMonthFee);
  933. const max = Number(this.rulesForm.maxMonthFee);
  934. if (one >= min && one <= max) {
  935. return callback();
  936. }
  937. return callback(new Error(`月度学练宝定价应在${min}-${max}之间`));
  938. },
  939. validateQuarterlyIncome(rule, value, callback) {
  940. const one = Number(value);
  941. const min = Number(this.rulesForm.minQuarterlyFee);
  942. const max = this.form.groupPurchaseQuarterlyFee
  943. ? Number(this.form.groupPurchaseQuarterlyFee)
  944. : Number(this.rulesForm.maxQuarterlyFee);
  945. if (one >= min && one <= max) {
  946. return callback();
  947. }
  948. return callback(new Error(`季度经营报表应在${min}-${max}之间`));
  949. },
  950. validateQuarterly(rule, value, callback) {
  951. const one = Number(value);
  952. const min = Number(this.rulesForm.minQuarterlyFee);
  953. const max = Number(this.rulesForm.maxQuarterlyFee);
  954. if (one >= min && one <= max) {
  955. return callback();
  956. }
  957. return callback(new Error(`季度学练宝定价应在${min}-${max}之间`));
  958. },
  959. validateHalfYearIncome(rule, value, callback) {
  960. const one = Number(value);
  961. const min = Number(this.rulesForm.minHalfYearFee);
  962. const max = this.form.groupPurchaseHalfYearFee
  963. ? Number(this.form.groupPurchaseHalfYearFee)
  964. : Number(this.rulesForm.maxHalfYearFee);
  965. if (one >= min && one <= max) {
  966. return callback();
  967. }
  968. return callback(new Error(`半年经营报表应在${min}-${max}之间`));
  969. },
  970. validateHalfYear(rule, value, callback) {
  971. const one = Number(value);
  972. const min = Number(this.rulesForm.minHalfYearFee);
  973. const max = Number(this.rulesForm.maxHalfYearFee);
  974. if (one >= min && one <= max) {
  975. return callback();
  976. }
  977. return callback(new Error(`半年学练宝定价应在${min}-${max}之间`));
  978. },
  979. validateYearIncome(rule, value, callback) {
  980. const one = Number(value);
  981. const min = Number(this.rulesForm.minYearFee);
  982. const max = this.form.groupPurchaseYearFee
  983. ? Number(this.form.groupPurchaseYearFee)
  984. : Number(this.rulesForm.maxYearFee);
  985. if (one >= min && one <= max) {
  986. return callback();
  987. }
  988. return callback(new Error(`年度经营报表应在${min}-${max}之间`));
  989. },
  990. validateYear(rule, value, callback) {
  991. const one = Number(value);
  992. const min = Number(this.rulesForm.minYearFee);
  993. const max = Number(this.rulesForm.maxYearFee);
  994. if (one >= min && one <= max) {
  995. return callback();
  996. }
  997. return callback(new Error(`年度学练宝定价应在${min}-${max}之间`));
  998. }
  999. },
  1000. watch: {
  1001. branchStatus(val) {
  1002. if (!val) {
  1003. this.onFormClose("ruleForm");
  1004. }
  1005. }
  1006. },
  1007. computed: {
  1008. monthRuleIncome() {
  1009. return `${this.rulesForm.minMonthFee}-${
  1010. this.form.groupPurchaseMonthFee
  1011. ? this.form.groupPurchaseMonthFee
  1012. : this.rulesForm.maxMonthFee
  1013. }`;
  1014. },
  1015. monthRule() {
  1016. return `${this.rulesForm.minMonthFee}-${this.rulesForm.maxMonthFee}`;
  1017. },
  1018. quarterlyRuleIncome() {
  1019. return `${this.rulesForm.minQuarterlyFee}-${
  1020. this.form.groupPurchaseQuarterlyFee
  1021. ? this.form.groupPurchaseQuarterlyFee
  1022. : this.rulesForm.maxQuarterlyFee
  1023. }`;
  1024. },
  1025. quarterlyRule() {
  1026. return `${this.rulesForm.minQuarterlyFee}-${
  1027. this.rulesForm.maxQuarterlyFee
  1028. }`;
  1029. },
  1030. halfYearRuleIncome() {
  1031. return `${this.rulesForm.minHalfYearFee}-${
  1032. this.form.groupPurchaseHalfYearFee
  1033. ? this.form.groupPurchaseHalfYearFee
  1034. : this.rulesForm.maxHalfYearFee
  1035. }`;
  1036. },
  1037. halfYearRule() {
  1038. return `${this.rulesForm.minHalfYearFee}-${
  1039. this.rulesForm.maxHalfYearFee
  1040. }`;
  1041. },
  1042. yearRuleIncome() {
  1043. return `${this.rulesForm.minYearFee}-${
  1044. this.form.groupPurchaseYearFee
  1045. ? this.form.groupPurchaseYearFee
  1046. : this.rulesForm.maxYearFee
  1047. }`;
  1048. },
  1049. yearRule() {
  1050. return `${this.rulesForm.minYearFee}-${this.rulesForm.maxYearFee}`;
  1051. }
  1052. }
  1053. };
  1054. </script>
  1055. <style lang="scss" scoped>
  1056. .feeInput {
  1057. ::v-deep .el-input__inner {
  1058. width: 120px !important;
  1059. }
  1060. }
  1061. .dialog {
  1062. ::v-deep {
  1063. .el-dialog {
  1064. border-radius: 4px;
  1065. overflow: hidden;
  1066. }
  1067. .el-dialog__header {
  1068. display: flex;
  1069. flex-shrink: 0;
  1070. justify-content: space-between;
  1071. align-items: center;
  1072. box-sizing: border-box;
  1073. width: 100%;
  1074. height: 48px;
  1075. padding: 0 20px;
  1076. .el-dialog__title {
  1077. font-weight: 500;
  1078. font-size: 16px;
  1079. }
  1080. .el-dialog__headerbtn {
  1081. position: relative;
  1082. top: 0;
  1083. right: 0;
  1084. &::before {
  1085. position: absolute;
  1086. display: block;
  1087. box-sizing: border-box;
  1088. background-color: transparent;
  1089. border-radius: 50%;
  1090. transition: background-color 0.1s cubic-bezier(0, 0, 1, 1);
  1091. content: "";
  1092. top: 50%;
  1093. left: 50%;
  1094. width: 20px;
  1095. height: 20px;
  1096. transform: translate(-50%, -50%);
  1097. }
  1098. }
  1099. .el-dialog__headerbtn:hover {
  1100. &::before {
  1101. background-color: rgba(0, 0, 0, 0.5);
  1102. }
  1103. }
  1104. .el-dialog__close {
  1105. position: relative;
  1106. }
  1107. }
  1108. .el-dialog__body {
  1109. padding: 10px 20px;
  1110. }
  1111. .el-input-group__append {
  1112. padding: 0 10px;
  1113. }
  1114. }
  1115. }
  1116. .elForm {
  1117. ::v-deep {
  1118. .el-form-item__label {
  1119. max-width: 100%;
  1120. color: #4e5969;
  1121. font-size: 14px;
  1122. white-space: normal;
  1123. padding: 0;
  1124. font-weight: 400;
  1125. line-height: 32px;
  1126. }
  1127. }
  1128. }
  1129. .lineTitle {
  1130. background-color: rgba(247, 247, 247, 1);
  1131. padding: 10px;
  1132. border-radius: 4px;
  1133. color: #333;
  1134. }
  1135. .wrap {
  1136. display: flex;
  1137. align-items: center;
  1138. ::v-deep .el-form-item:not(:last-child) {
  1139. margin-right: 20px;
  1140. }
  1141. .el-form-item {
  1142. width: 180px;
  1143. }
  1144. }
  1145. </style>