bonus-opt.vue 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412
  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-column label="房奖比例">
  253. <template slot-scope="scope">
  254. <el-input v-model="scope.row.VILLA_PERCENT" min="0" max="100">
  255. <template slot="append">%</template>
  256. </el-input>
  257. </template>
  258. </el-table-column>
  259. </el-table>
  260. </div>
  261. <div class="panel-footer">
  262. <el-button type="primary" @click="onStarSubmit" :loading="starSubmitButtonStat" style="float: right;">保存
  263. </el-button>
  264. </div>
  265. </div>
  266. </div>
  267. </div>
  268. </template>
  269. <script>
  270. import network from '@/utils/network'
  271. import permission from '@/utils/permission'
  272. export default {
  273. name: 'config_bonus-opt',
  274. mounted () {
  275. network.getData('config/bonus-opt').then(response => {
  276. this.configData = response.config
  277. this.decLevelTableData = response.decLevel
  278. this.empLevelTableData = response.empLevel
  279. this.starLevelTableData = response.starLevel
  280. this.loading = false
  281. })
  282. },
  283. data () {
  284. return {
  285. decLevelTableData: null,
  286. empLevelTableData: null,
  287. starLevelTableData: null,
  288. loading: true,
  289. submitButtonStat: false,
  290. qySubmitButtonStat: false,
  291. glSubmitButtonStat: false,
  292. ycSubmitButtonStat: false,
  293. starSubmitButtonStat: false,
  294. configData: null,
  295. permission: permission,
  296. }
  297. },
  298. computed: {
  299. form: function () {
  300. let result = {}
  301. for (let i in this.configData) {
  302. result[i] = this.configData[i].VALUE
  303. }
  304. return result
  305. }
  306. },
  307. methods: {
  308. onSubmit () {
  309. this.submitButtonStat = true
  310. network.postData('config/bonus', this.form).then(response => {
  311. this.$message({
  312. message: response,
  313. type: 'success'
  314. })
  315. this.submitButtonStat = false
  316. }).catch(response => {
  317. this.submitButtonStat = false
  318. })
  319. },
  320. onQYSubmit () {
  321. this.qySubmitButtonStat = true
  322. network.postData('config/bonus-dec-level', {
  323. data: this.decLevelTableData
  324. }).then(response => {
  325. this.$message({
  326. message: response,
  327. type: 'success'
  328. })
  329. this.qySubmitButtonStat = false
  330. }).catch(response => {
  331. this.qySubmitButtonStat = false
  332. })
  333. },
  334. onGLSubmit () {
  335. this.glSubmitButtonStat = true
  336. network.postData('config/bonus-dec-level', {
  337. data: this.decLevelTableData
  338. }).then(response => {
  339. this.$message({
  340. message: response,
  341. type: 'success'
  342. })
  343. this.glSubmitButtonStat = false
  344. }).catch(response => {
  345. this.glSubmitButtonStat = false
  346. })
  347. },
  348. onYCSubmit () {
  349. this.ycSubmitButtonStat = true
  350. network.postData('config/bonus-emp-level', {
  351. data: this.empLevelTableData
  352. }).then(response => {
  353. this.$message({
  354. message: response,
  355. type: 'success'
  356. })
  357. this.ycSubmitButtonStat = false
  358. }).catch(response => {
  359. this.ycSubmitButtonStat = false
  360. })
  361. },
  362. onStarSubmit() {
  363. this.starSubmitButtonStat = true
  364. network.postData('config/bonus-star-level', {
  365. data: this.starLevelTableData
  366. }).then(response => {
  367. this.$message({
  368. message: response,
  369. type: 'success'
  370. })
  371. this.starSubmitButtonStat = false
  372. }).catch(_ => {
  373. this.starSubmitButtonStat = false
  374. })
  375. },
  376. }
  377. }
  378. </script>
  379. <style scoped>
  380. .hr-tip {
  381. font-size: 12px;
  382. position: relative;
  383. text-align: center;
  384. height: 30px;
  385. line-height: 30px;
  386. color: #999;
  387. margin-bottom: 20px;
  388. }
  389. .hr-tip:before {
  390. content: '';
  391. display: block;
  392. position: absolute;
  393. left: 0;
  394. right: 0;
  395. top: 14px;
  396. border-bottom: 1px dashed #ddd;
  397. height: 1px;
  398. }
  399. .hr-tip span {
  400. display: inline-block;
  401. background: #fff;
  402. position: relative;
  403. padding: 0 10px;
  404. }
  405. </style>