bonus-opt.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405
  1. <template>
  2. <div v-loading="loading">
  3. <div class="panel" v-if="permission.hasPermission(`config/bonus`)">
  4. <div class="panel-heading">
  5. 基本配置
  6. </div>
  7. <div class="panel-wrapper">
  8. <div class="panel-body">
  9. <el-form ref="form" :model="form" label-width="250px" class="form-page">
  10. <template v-for="item in configData">
  11. <div class="hr-tip" v-if="item.SORT==='101'"><span>复消相关</span></div>
  12. <el-form-item :label="item.TITLE" :key="item.CONFIG_NAME">
  13. <template v-if="item.INPUT_TYPE==='2'">
  14. <el-select v-model="item.VALUE" placeholder="请选择">
  15. <el-option v-for="optionItem in item.OPTIONS" :label="optionItem.label" :value="optionItem.value"
  16. :key="optionItem.label"></el-option>
  17. </el-select>
  18. </template>
  19. <template v-else-if="item.INPUT_TYPE==='3'">
  20. <el-select v-model="item.VALUE" placeholder="请选择" multiple>
  21. <el-option v-for="optionItem in item.OPTIONS" :label="optionItem.label" :value="optionItem.value"
  22. :key="optionItem.label"></el-option>
  23. </el-select>
  24. <!-- <el-checkbox-group v-model="item.VALUE">-->
  25. <!-- <el-checkbox v-for="optionItem in item.OPTIONS" :label="optionItem.label" :value="optionItem.value"-->
  26. <!-- :key="optionItem.label"></el-checkbox>-->
  27. <!-- </el-checkbox-group>-->
  28. </template>
  29. <template v-else-if="item.INPUT_TYPE==='4'">
  30. <el-date-picker v-model="item.VALUE" type="year" placeholder="选择年">
  31. </el-date-picker>
  32. </template>
  33. <template v-else-if="item.INPUT_TYPE==='5'">
  34. <el-date-picker
  35. v-model="item.VALUE"
  36. type="datetime"
  37. placeholder="Select date">
  38. </el-date-picker>
  39. </template>
  40. <template v-else-if="item.INPUT_TYPE==='6'">
  41. <el-date-picker
  42. v-model="item.VALUE"
  43. type="date"
  44. placeholder="Select date">
  45. </el-date-picker>
  46. </template>
  47. <template v-else-if="item.INPUT_TYPE==='7'">
  48. <el-time-select v-model="item.VALUE"
  49. :picker-options="{start: item.OPTIONS.start, end: item.OPTIONS.end, step: item.OPTIONS.step}"
  50. placeholder="选择时间">
  51. </el-time-select>
  52. </template>
  53. <template v-else-if="item.INPUT_TYPE==='8'">
  54. <el-switch v-model="item.VALUE">
  55. </el-switch>
  56. </template>
  57. <template v-else-if="item.INPUT_TYPE==='10'">
  58. <el-table
  59. :data="item.VALUE" stripe style="width: 100%;">
  60. <el-table-column prop="outTitle" label="序号">
  61. <template slot-scope="scope">
  62. {{scope.row.sort}}
  63. </template>
  64. </el-table-column>
  65. <el-table-column prop="outTitle" label="销售额条件(元)">
  66. <template slot-scope="scope">
  67. <el-input v-model="scope.row.salesCondition" placeholder="请输入内容"></el-input>
  68. </template>
  69. </el-table-column>
  70. <el-table-column prop="outTitle" label="奖金金额(元)">
  71. <template slot-scope="scope">
  72. <el-input v-model="scope.row.awardAmount" placeholder="请输入内容"></el-input>
  73. </template>
  74. </el-table-column>
  75. </el-table>
  76. </template>
  77. <template v-else>
  78. <el-input v-model="item.VALUE" placeholder="请输入内容">
  79. <template v-if="!!item.UNIT" slot="append">{{item.UNIT}}</template>
  80. </el-input>
  81. </template>
  82. </el-form-item>
  83. </template>
  84. </el-form>
  85. </div>
  86. <div class="panel-footer">
  87. <el-button type="primary" @click="onSubmit" :loading="submitButtonStat" style="float: right;">保存</el-button>
  88. </div>
  89. </div>
  90. </div>
  91. <div class="panel" v-if="permission.hasPermission(`config/bonus-dec-level`)">
  92. <div class="panel-heading">
  93. 绩效奖
  94. </div>
  95. <div class="panel-wrapper">
  96. <div class="panel-body">
  97. <el-table :data="decLevelTableData" stripe style="width: 100%;">
  98. <el-table-column prop="LEVEL_NAME" label="级别名称"></el-table-column>
  99. <el-table-column label="拿奖比例">
  100. <template slot-scope="scope">
  101. <el-input v-model="scope.row.QY_PERCENT" min="0" max="100">
  102. <template slot="append">%</template>
  103. </el-input>
  104. </template>
  105. </el-table-column>
  106. <el-table-column label="个人封顶值">
  107. <template slot-scope="scope">
  108. <el-input v-model="scope.row.INCOME_CAP" min="0">
  109. <template slot="append">$</template>
  110. </el-input>
  111. </template>
  112. </el-table-column>
  113. </el-table>
  114. </div>
  115. <div class="panel-footer">
  116. <el-button type="primary" @click="onQYSubmit" :loading="qySubmitButtonStat" style="float: right;">保存
  117. </el-button>
  118. </div>
  119. </div>
  120. </div>
  121. <div class="panel" v-if="permission.hasPermission(`config/bonus-dec-level`)">
  122. <div class="panel-heading">
  123. 管理奖
  124. </div>
  125. <div class="panel-wrapper">
  126. <div class="panel-body">
  127. <el-table :data="decLevelTableData" stripe style="width: 100%;">
  128. <el-table-column prop="LEVEL_NAME" label="级别名称"></el-table-column>
  129. <el-table-column label="奇数代数(推广1人)">
  130. <template slot-scope="scope">
  131. <el-input v-model="scope.row.GL_ODD_DEEP_ONE" min="0" max="100">
  132. <template slot="append">代</template>
  133. </el-input>
  134. </template>
  135. </el-table-column>
  136. <el-table-column label="奇数代数(推广2人)">
  137. <template slot-scope="scope">
  138. <el-input v-model="scope.row.GL_ODD_DEEP_TWO" min="0" max="100">
  139. <template slot="append">代</template>
  140. </el-input>
  141. </template>
  142. </el-table-column>
  143. <el-table-column label="奇数代数(推广3人)">
  144. <template slot-scope="scope">
  145. <el-input v-model="scope.row.GL_ODD_DEEP_THREE" min="0" max="100">
  146. <template slot="append">代</template>
  147. </el-input>
  148. </template>
  149. </el-table-column>
  150. </el-table>
  151. </div>
  152. <div class="panel-footer">
  153. <el-button type="primary" @click="onGLSubmit" :loading="glSubmitButtonStat" style="float: right;">保存
  154. </el-button>
  155. </div>
  156. </div>
  157. </div>
  158. <div class="panel" v-if="permission.hasPermission(`config/bonus-emp-level`)">
  159. <div class="panel-heading">
  160. 荣衔配置
  161. </div>
  162. <div class="panel-wrapper">
  163. <div class="panel-body">
  164. <el-table :data="empLevelTableData" stripe style="width: 100%;">
  165. <el-table-column prop="LEVEL_NAME" label="级别名称"></el-table-column>
  166. <!-- <el-table-column label="荣衔奖比例">-->
  167. <!-- <template slot-scope="scope">-->
  168. <!-- <el-input v-model="scope.row.RX_PERCENT" min="0" max="100">-->
  169. <!-- <template slot="append">%</template>-->
  170. <!-- </el-input>-->
  171. <!-- </template>-->
  172. <!-- </el-table-column>-->
  173. <el-table-column label="级别分数">
  174. <template slot-scope="scope">
  175. <el-input v-model="scope.row.LEVEL_SCORE" min="0">
  176. <template slot="append">分</template>
  177. </el-input>
  178. </template>
  179. </el-table-column>
  180. <el-table-column label="升级分数">
  181. <template slot-scope="scope">
  182. <el-input v-model="scope.row.UPGRADE_SCORE" min="0">
  183. <template slot="append">分</template>
  184. </el-input>
  185. </template>
  186. </el-table-column>
  187. <el-table-column label="蓝星奖比例">
  188. <template slot-scope="scope">
  189. <el-input v-model="scope.row.BS_PERCENT" min="0" max="100">
  190. <template slot="append">%</template>
  191. </el-input>
  192. </template>
  193. </el-table-column>
  194. <el-table-column label="旅游奖比例">
  195. <template slot-scope="scope">
  196. <el-input v-model="scope.row.TOURISM_PERCENT" min="0" max="100">
  197. <template slot="append">%</template>
  198. </el-input>
  199. </template>
  200. </el-table-column>
  201. <el-table-column label="车房奖比例">
  202. <template slot-scope="scope">
  203. <el-input v-model="scope.row.GARAGE_PERCENT" min="0" max="100">
  204. <template slot="append">%</template>
  205. </el-input>
  206. </template>
  207. </el-table-column>
  208. </el-table>
  209. </div>
  210. <div class="panel-footer">
  211. <el-button type="primary" @click="onYCSubmit" :loading="ycSubmitButtonStat" style="float: right;">保存
  212. </el-button>
  213. </div>
  214. </div>
  215. </div>
  216. <div class="panel" v-if="permission.hasPermission(`config/bonus-star-level`)">
  217. <div class="panel-heading">
  218. 星级配置
  219. </div>
  220. <div class="panel-wrapper">
  221. <div class="panel-body">
  222. <el-table :data="starLevelTableData" stripe style="width: 100%;">
  223. <el-table-column prop="LEVEL_NAME" label="级别名称"></el-table-column>
  224. <el-table-column label="级别分数(BV)">
  225. <template slot-scope="scope">
  226. <el-input v-model="scope.row.LEVEL_SCORE" min="0">
  227. <template slot="append">分</template>
  228. </el-input>
  229. </template>
  230. </el-table-column>
  231. <el-table-column label="升级分数(BV)">
  232. <template slot-scope="scope">
  233. <el-input v-model="scope.row.UPGRADE_SCORE" min="0">
  234. <template slot="append">分</template>
  235. </el-input>
  236. </template>
  237. </el-table-column>
  238. <el-table-column label="旅游奖比例">
  239. <template slot-scope="scope">
  240. <el-input v-model="scope.row.TOURISM_PERCENT" min="0" max="100">
  241. <template slot="append">%</template>
  242. </el-input>
  243. </template>
  244. </el-table-column>
  245. <el-table-column label="车房奖比例">
  246. <template slot-scope="scope">
  247. <el-input v-model="scope.row.GARAGE_PERCENT" min="0" max="100">
  248. <template slot="append">%</template>
  249. </el-input>
  250. </template>
  251. </el-table-column>
  252. </el-table>
  253. </div>
  254. <div class="panel-footer">
  255. <el-button type="primary" @click="onStarSubmit" :loading="starSubmitButtonStat" style="float: right;">保存
  256. </el-button>
  257. </div>
  258. </div>
  259. </div>
  260. </div>
  261. </template>
  262. <script>
  263. import network from '@/utils/network'
  264. import permission from '@/utils/permission'
  265. export default {
  266. name: 'config_bonus-opt',
  267. mounted () {
  268. network.getData('config/bonus-opt').then(response => {
  269. this.configData = response.config
  270. this.decLevelTableData = response.decLevel
  271. this.empLevelTableData = response.empLevel
  272. this.starLevelTableData = response.starLevel
  273. this.loading = false
  274. })
  275. },
  276. data () {
  277. return {
  278. decLevelTableData: null,
  279. empLevelTableData: null,
  280. starLevelTableData: null,
  281. loading: true,
  282. submitButtonStat: false,
  283. qySubmitButtonStat: false,
  284. glSubmitButtonStat: false,
  285. ycSubmitButtonStat: false,
  286. starSubmitButtonStat: false,
  287. configData: null,
  288. permission: permission,
  289. }
  290. },
  291. computed: {
  292. form: function () {
  293. let result = {}
  294. for (let i in this.configData) {
  295. result[i] = this.configData[i].VALUE
  296. }
  297. return result
  298. }
  299. },
  300. methods: {
  301. onSubmit () {
  302. this.submitButtonStat = true
  303. network.postData('config/bonus', this.form).then(response => {
  304. this.$message({
  305. message: response,
  306. type: 'success'
  307. })
  308. this.submitButtonStat = false
  309. }).catch(response => {
  310. this.submitButtonStat = false
  311. })
  312. },
  313. onQYSubmit () {
  314. this.qySubmitButtonStat = true
  315. network.postData('config/bonus-dec-level', {
  316. data: this.decLevelTableData
  317. }).then(response => {
  318. this.$message({
  319. message: response,
  320. type: 'success'
  321. })
  322. this.qySubmitButtonStat = false
  323. }).catch(response => {
  324. this.qySubmitButtonStat = false
  325. })
  326. },
  327. onGLSubmit () {
  328. this.glSubmitButtonStat = true
  329. network.postData('config/bonus-dec-level', {
  330. data: this.decLevelTableData
  331. }).then(response => {
  332. this.$message({
  333. message: response,
  334. type: 'success'
  335. })
  336. this.glSubmitButtonStat = false
  337. }).catch(response => {
  338. this.glSubmitButtonStat = false
  339. })
  340. },
  341. onYCSubmit () {
  342. this.ycSubmitButtonStat = true
  343. network.postData('config/bonus-emp-level', {
  344. data: this.empLevelTableData
  345. }).then(response => {
  346. this.$message({
  347. message: response,
  348. type: 'success'
  349. })
  350. this.ycSubmitButtonStat = false
  351. }).catch(response => {
  352. this.ycSubmitButtonStat = false
  353. })
  354. },
  355. onStarSubmit() {
  356. this.starSubmitButtonStat = true
  357. network.postData('config/bonus-star-level', {
  358. data: this.starLevelTableData
  359. }).then(response => {
  360. this.$message({
  361. message: response,
  362. type: 'success'
  363. })
  364. this.starSubmitButtonStat = false
  365. }).catch(_ => {
  366. this.starSubmitButtonStat = false
  367. })
  368. },
  369. }
  370. }
  371. </script>
  372. <style scoped>
  373. .hr-tip {
  374. font-size: 12px;
  375. position: relative;
  376. text-align: center;
  377. height: 30px;
  378. line-height: 30px;
  379. color: #999;
  380. margin-bottom: 20px;
  381. }
  382. .hr-tip:before {
  383. content: '';
  384. display: block;
  385. position: absolute;
  386. left: 0;
  387. right: 0;
  388. top: 14px;
  389. border-bottom: 1px dashed #ddd;
  390. height: 1px;
  391. }
  392. .hr-tip span {
  393. display: inline-block;
  394. background: #fff;
  395. position: relative;
  396. padding: 0 10px;
  397. }
  398. </style>