bonus-opt.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398
  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="选择日期时间">
  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="选择日期">
  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>
  107. </div>
  108. <div class="panel-footer">
  109. <el-button type="primary" @click="onQYSubmit" :loading="qySubmitButtonStat" style="float: right;">保存
  110. </el-button>
  111. </div>
  112. </div>
  113. </div>
  114. <div class="panel" v-if="permission.hasPermission(`config/bonus-dec-level`)">
  115. <div class="panel-heading">
  116. 管理奖
  117. </div>
  118. <div class="panel-wrapper">
  119. <div class="panel-body">
  120. <el-table :data="decLevelTableData" stripe style="width: 100%;">
  121. <el-table-column prop="LEVEL_NAME" label="级别名称"></el-table-column>
  122. <el-table-column label="奇数代数(推广1人)">
  123. <template slot-scope="scope">
  124. <el-input v-model="scope.row.GL_ODD_DEEP_ONE" min="0" max="100">
  125. <template slot="append">代</template>
  126. </el-input>
  127. </template>
  128. </el-table-column>
  129. <el-table-column label="奇数代数(推广2人)">
  130. <template slot-scope="scope">
  131. <el-input v-model="scope.row.GL_ODD_DEEP_TWO" min="0" max="100">
  132. <template slot="append">代</template>
  133. </el-input>
  134. </template>
  135. </el-table-column>
  136. <el-table-column label="奇数代数(推广3人)">
  137. <template slot-scope="scope">
  138. <el-input v-model="scope.row.GL_ODD_DEEP_THREE" min="0" max="100">
  139. <template slot="append">代</template>
  140. </el-input>
  141. </template>
  142. </el-table-column>
  143. </el-table>
  144. </div>
  145. <div class="panel-footer">
  146. <el-button type="primary" @click="onGLSubmit" :loading="glSubmitButtonStat" style="float: right;">保存
  147. </el-button>
  148. </div>
  149. </div>
  150. </div>
  151. <div class="panel" v-if="permission.hasPermission(`config/bonus-emp-level`)">
  152. <div class="panel-heading">
  153. 荣衔配置
  154. </div>
  155. <div class="panel-wrapper">
  156. <div class="panel-body">
  157. <el-table :data="empLevelTableData" stripe style="width: 100%;">
  158. <el-table-column prop="LEVEL_NAME" label="级别名称"></el-table-column>
  159. <!-- <el-table-column label="荣衔奖比例">-->
  160. <!-- <template slot-scope="scope">-->
  161. <!-- <el-input v-model="scope.row.RX_PERCENT" min="0" max="100">-->
  162. <!-- <template slot="append">%</template>-->
  163. <!-- </el-input>-->
  164. <!-- </template>-->
  165. <!-- </el-table-column>-->
  166. <el-table-column label="级别分数">
  167. <template slot-scope="scope">
  168. <el-input v-model="scope.row.LEVEL_SCORE" min="0">
  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.UPGRADE_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.BS_PERCENT" min="0" max="100">
  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.TOURISM_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.GARAGE_PERCENT" min="0" max="100">
  197. <template slot="append">%</template>
  198. </el-input>
  199. </template>
  200. </el-table-column>
  201. </el-table>
  202. </div>
  203. <div class="panel-footer">
  204. <el-button type="primary" @click="onYCSubmit" :loading="ycSubmitButtonStat" style="float: right;">保存
  205. </el-button>
  206. </div>
  207. </div>
  208. </div>
  209. <div class="panel" v-if="permission.hasPermission(`config/bonus-star-level`)">
  210. <div class="panel-heading">
  211. 星级配置
  212. </div>
  213. <div class="panel-wrapper">
  214. <div class="panel-body">
  215. <el-table :data="starLevelTableData" stripe style="width: 100%;">
  216. <el-table-column prop="LEVEL_NAME" label="级别名称"></el-table-column>
  217. <el-table-column label="级别分数(BV)">
  218. <template slot-scope="scope">
  219. <el-input v-model="scope.row.LEVEL_SCORE" min="0">
  220. <template slot="append">分</template>
  221. </el-input>
  222. </template>
  223. </el-table-column>
  224. <el-table-column label="升级分数(BV)">
  225. <template slot-scope="scope">
  226. <el-input v-model="scope.row.UPGRADE_SCORE" min="0">
  227. <template slot="append">分</template>
  228. </el-input>
  229. </template>
  230. </el-table-column>
  231. <el-table-column label="旅游奖比例">
  232. <template slot-scope="scope">
  233. <el-input v-model="scope.row.TOURISM_PERCENT" min="0" max="100">
  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.GARAGE_PERCENT" min="0" max="100">
  241. <template slot="append">%</template>
  242. </el-input>
  243. </template>
  244. </el-table-column>
  245. </el-table>
  246. </div>
  247. <div class="panel-footer">
  248. <el-button type="primary" @click="onStarSubmit" :loading="starSubmitButtonStat" style="float: right;">保存
  249. </el-button>
  250. </div>
  251. </div>
  252. </div>
  253. </div>
  254. </template>
  255. <script>
  256. import network from '@/utils/network'
  257. import permission from '@/utils/permission'
  258. export default {
  259. name: 'config_bonus-opt',
  260. mounted () {
  261. network.getData('config/bonus-opt').then(response => {
  262. this.configData = response.config
  263. this.decLevelTableData = response.decLevel
  264. this.empLevelTableData = response.empLevel
  265. this.starLevelTableData = response.starLevel
  266. this.loading = false
  267. })
  268. },
  269. data () {
  270. return {
  271. decLevelTableData: null,
  272. empLevelTableData: null,
  273. starLevelTableData: null,
  274. loading: true,
  275. submitButtonStat: false,
  276. qySubmitButtonStat: false,
  277. glSubmitButtonStat: false,
  278. ycSubmitButtonStat: false,
  279. starSubmitButtonStat: false,
  280. configData: null,
  281. permission: permission,
  282. }
  283. },
  284. computed: {
  285. form: function () {
  286. let result = {}
  287. for (let i in this.configData) {
  288. result[i] = this.configData[i].VALUE
  289. }
  290. return result
  291. }
  292. },
  293. methods: {
  294. onSubmit () {
  295. this.submitButtonStat = true
  296. network.postData('config/bonus', this.form).then(response => {
  297. this.$message({
  298. message: response,
  299. type: 'success'
  300. })
  301. this.submitButtonStat = false
  302. }).catch(response => {
  303. this.submitButtonStat = false
  304. })
  305. },
  306. onQYSubmit () {
  307. this.qySubmitButtonStat = true
  308. network.postData('config/bonus-dec-level', {
  309. data: this.decLevelTableData
  310. }).then(response => {
  311. this.$message({
  312. message: response,
  313. type: 'success'
  314. })
  315. this.qySubmitButtonStat = false
  316. }).catch(response => {
  317. this.qySubmitButtonStat = false
  318. })
  319. },
  320. onGLSubmit () {
  321. this.glSubmitButtonStat = 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.glSubmitButtonStat = false
  330. }).catch(response => {
  331. this.glSubmitButtonStat = false
  332. })
  333. },
  334. onYCSubmit () {
  335. this.ycSubmitButtonStat = true
  336. network.postData('config/bonus-emp-level', {
  337. data: this.empLevelTableData
  338. }).then(response => {
  339. this.$message({
  340. message: response,
  341. type: 'success'
  342. })
  343. this.ycSubmitButtonStat = false
  344. }).catch(response => {
  345. this.ycSubmitButtonStat = false
  346. })
  347. },
  348. onStarSubmit() {
  349. this.starSubmitButtonStat = true
  350. network.postData('config/bonus-star-level', {
  351. data: this.starLevelTableData
  352. }).then(response => {
  353. this.$message({
  354. message: response,
  355. type: 'success'
  356. })
  357. this.starSubmitButtonStat = false
  358. }).catch(_ => {
  359. this.starSubmitButtonStat = false
  360. })
  361. },
  362. }
  363. }
  364. </script>
  365. <style scoped>
  366. .hr-tip {
  367. font-size: 12px;
  368. position: relative;
  369. text-align: center;
  370. height: 30px;
  371. line-height: 30px;
  372. color: #999;
  373. margin-bottom: 20px;
  374. }
  375. .hr-tip:before {
  376. content: '';
  377. display: block;
  378. position: absolute;
  379. left: 0;
  380. right: 0;
  381. top: 14px;
  382. border-bottom: 1px dashed #ddd;
  383. height: 1px;
  384. }
  385. .hr-tip span {
  386. display: inline-block;
  387. background: #fff;
  388. position: relative;
  389. padding: 0 10px;
  390. }
  391. </style>