market.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376
  1. <template>
  2. <div class="app-container">
  3. <div class="title-container">
  4. <breadcrumb id="breadcrumb-container" class="breadcrumb-container" />
  5. </div>
  6. <y-page-list-layout :page-list="pageData" :page-para="listQuery" :get-page-list="assetsMarketDeclarePage">
  7. <template slot="left">
  8. <el-input v-model="listQuery.orderId" placeholder="订单号" clearable style="width: 200px;float: left;">
  9. </el-input>
  10. <el-input v-model="listQuery.name" placeholder="项目名称" clearable
  11. style="margin-left: 20px;width: 200px;float: left;">
  12. </el-input>
  13. <el-input v-model="listQuery.reportNo" placeholder="报告号" clearable
  14. style="margin-left: 20px;width: 200px;float: left;">
  15. </el-input>
  16. <el-select clearable v-model="listQuery.commissionRateId" placeholder="提成类型"
  17. style="margin-left: 20px;width: 200px;float: left;">
  18. <el-option v-for="(c, id) in cates" :value="c.id" :label="c.name">{{ c.name }}</el-option>
  19. </el-select>
  20. <el-select clearable v-model="listQuery.declareType" placeholder="申报类型"
  21. style="margin-left: 20px;width: 200px;float: left;">
  22. <el-option :value="true" label="产品">产品</el-option>
  23. <el-option :value="false" label="订单">订单</el-option>
  24. </el-select>
  25. <el-select clearable v-model="listQuery.declareResult" placeholder="审核状态"
  26. style="margin-left: 20px;width: 200px;float: left;">
  27. <el-option value="待申报" label="待申报"></el-option>
  28. <el-option value="审核中" label="审核中"></el-option>
  29. <el-option value="审核通过" label="审核通过"></el-option>
  30. <el-option value="审核拒绝" label="审核拒绝"></el-option>
  31. </el-select>
  32. <el-button class="filter-item" style="margin-left:20px;float: left;" type="primary" @click="searchList()" round>搜索
  33. </el-button>
  34. <el-button class="filter-item" style="float: left;" round type="success" @click="resetSearch()">重置
  35. </el-button>
  36. </template>
  37. <parentTable :data="pageData.records" slot="table" style="width: 100%;">
  38. <el-table-column label="订单号" width="150" align="center">
  39. <template slot-scope="{row}">
  40. <span>{{ row.orderId }}</span>
  41. </template>
  42. </el-table-column>
  43. <el-table-column label="项目名称" width="150" align="center">
  44. <template slot-scope="{row}">
  45. <span>{{ row.name ? row.name : row.orderName }}</span>
  46. </template>
  47. </el-table-column>
  48. <el-table-column label="报告号" width="200" align="center">
  49. <template slot-scope="{row}">
  50. <span>{{ row.reportNo ? row.reportNo : '--' }}</span>
  51. </template>
  52. </el-table-column>
  53. <el-table-column label="评估对象类别" align="center">
  54. <template slot-scope="{row}">
  55. <span>{{ row.businessObjectType }}</span>
  56. </template>
  57. </el-table-column>
  58. <el-table-column label="委托人" align="center">
  59. <template slot-scope="{row}">
  60. <span>{{ row.bailor }}</span>
  61. </template>
  62. </el-table-column>
  63. <el-table-column label="委托联系人" align="center">
  64. <template slot-scope="{row}">
  65. <span>{{ row.bailorContactName }}</span>
  66. </template>
  67. </el-table-column>
  68. <el-table-column label="委托人电话" width="150" align="center">
  69. <template slot-scope="{row}">
  70. <span>{{ row.bailorContactTel }}</span>
  71. </template>
  72. </el-table-column>
  73. <el-table-column label="客户名称" align="center">
  74. <template slot-scope="{row}">
  75. <span>{{ row.clienteleName }}</span>
  76. </template>
  77. </el-table-column>
  78. <el-table-column label="业务来源" align="center">
  79. <template slot-scope="{row}">
  80. <span>{{ row.clienteleSubName }}</span>
  81. </template>
  82. </el-table-column>
  83. <el-table-column label="负责人" align="center">
  84. <template slot-scope="{row}">
  85. <span>{{ row.principal }}</span>
  86. </template>
  87. </el-table-column>
  88. <el-table-column label="下单时间" align="center">
  89. <template slot-scope="{row}">
  90. <span>{{ row.orderCreated }}</span>
  91. </template>
  92. </el-table-column>
  93. <el-table-column label="提成类型" width="150" align="center">
  94. <template slot-scope="{row}">
  95. <span style="color:red">{{ row.commissionType ? row.commissionType : '--' }}</span>
  96. </template>
  97. </el-table-column>
  98. <el-table-column label="申报类型" align="center">
  99. <template slot-scope="{row}">
  100. <span style="font-weight: bold;">{{ row.reportNo ? '产品' : '订单' }}</span>
  101. </template>
  102. </el-table-column>
  103. <el-table-column label="审核状态" align="center">
  104. <template slot-scope="{row}">
  105. <el-tag v-if="row.declareResult == null" type="info" effect="plain">待申报</el-tag>
  106. <el-tag v-else-if="row.declareResult == '审核中'" type="warning" effect="plain">审核中</el-tag>
  107. <el-tag v-else-if="row.declareResult == '审核通过'" type="success" effect="plain">通过</el-tag>
  108. <el-tag v-else-if="row.declareResult == '审核拒绝'" type="danger" effect="plain">拒绝</el-tag>
  109. </template>
  110. </el-table-column>
  111. <el-table-column fixed="right" label="操作" align="center">
  112. <template slot-scope="{row}">
  113. <div>
  114. <el-button v-if="row.declareResult == null || row.declareResult == '审核拒绝'" type="text" size="small"
  115. @click="openDeclareDialog(row)">申报</el-button>
  116. <el-button v-if="row.declareResult == '审核中' || row.declareResult == '审核通过' || row.declareResult == '审核拒绝'"
  117. type="text" size="small" @click="checkDetail(row.id)">查看</el-button>
  118. </div>
  119. </template>
  120. </el-table-column>
  121. </parentTable>
  122. </y-page-list-layout>
  123. <el-dialog :visible.sync="declareDialog" width="45%" center custom-class="doWarehouseClass">
  124. <el-divider content-position="left">
  125. <span style="color:red;font-weight: bold;">
  126. 【市场人员】
  127. </span>资产业务提成申报</el-divider>
  128. <el-form :model="declareForm" ref="declareForm" :rules="rules">
  129. <el-form-item label="订单号:" prop="orderId" label-width="140px" class="postInfo-container-item">
  130. <el-input v-model="declareForm.orderId" :step="1" :max="100" style="width: 100%;" readonly disabled></el-input>
  131. </el-form-item>
  132. <el-form-item label="项目名称:" prop="name" label-width="140px" class="postInfo-container-item">
  133. <el-input v-model="declareForm.name" :step="1" :max="100" style="width: 100%;" readonly disabled></el-input>
  134. </el-form-item>
  135. <el-form-item label="报告号:" prop="reportNo" label-width="140px" class="postInfo-container-item">
  136. <el-input v-model="declareForm.reportNo" :step="1" :max="100" style="width: 100%;" readonly disabled></el-input>
  137. </el-form-item>
  138. <el-form-item label="业务分类:" prop="commissionRateId" label-width="140px" class="postInfo-container-item">
  139. <el-select clearable v-model="declareForm.commissionRateId" placeholder="请选择业务分类" style="width: 100%;">
  140. <el-option v-for="(c, id) in cates" :value="c.id" :label="c.name">{{ c.name }}</el-option>
  141. </el-select>
  142. </el-form-item>
  143. <el-button type="success" round @click="addUser()">添加客户经理</el-button>
  144. <el-table :data="businessPerformanceDistributionForm.distributionList" border
  145. style="width: 100%; margin-top: 10px; margin-bottom: 10px;">
  146. <el-table-column prop="userId" label="客户经理" align="center">
  147. <template slot-scope="{row}">
  148. <el-select filterable clearable v-model="row.memberId" placeholder="选择人员">
  149. <el-option v-for="(u, id) in users" :value="u.id" :label="u.name">{{ u.name }}</el-option>
  150. </el-select>
  151. </template>
  152. </el-table-column>
  153. <el-table-column prop="rate" label="提成比例%" align="center">
  154. <template slot-scope="{row}">
  155. <el-input-number v-model="row.performanceDistribution" :step="1" :max="100"
  156. style="width: 100%;"></el-input-number>
  157. </template>
  158. </el-table-column>
  159. <el-table-column label="操作" align="center">
  160. <template slot-scope="row">
  161. <el-button type="text" @click="removeUser(row.$index)" :disabled="row.$index === 0">删除</el-button>
  162. </template>
  163. </el-table-column>
  164. </el-table>
  165. <el-form-item>
  166. <el-button type="primary" @click="declareMarket()" style="margin-left: 40%;">提交</el-button>
  167. <el-button @click="declareDialog = false">取消</el-button>
  168. </el-form-item>
  169. </el-form>
  170. </el-dialog>
  171. </div>
  172. </template>
  173. <script>
  174. import YPageListLayout from '@/components/YPageListLayout'
  175. import Breadcrumb from '@/components/Breadcrumb'
  176. export default {
  177. name: 'declareAssetMarket',
  178. components: {
  179. Breadcrumb,
  180. YPageListLayout,
  181. },
  182. filters: {
  183. },
  184. data() {
  185. return {
  186. rules: {
  187. commissionRateId: [{
  188. required: true,
  189. message: '业务分类不能为空',
  190. trigger: 'blur'
  191. }],
  192. },
  193. pageData: { records: [] },
  194. listQuery: {
  195. page: 1,
  196. size: 10,
  197. descs: 'id',
  198. },
  199. cates: [],
  200. users: [],
  201. declareDialog: false,
  202. declareForm: {
  203. orderId: null,
  204. name: null,
  205. reportNo: null,
  206. businessId: null,
  207. productionId: null,
  208. businessType: 'COMMISSION_DECLARE_ASSET_MARKET',
  209. commissionRateId: null,
  210. userShareRates: [
  211. {
  212. memberId: this.$store.getters.userInfo.id,
  213. performanceDistribution: 100
  214. }
  215. ],
  216. },
  217. // 资产绩效比例表单
  218. businessPerformanceDistributionForm: {
  219. businessId: null,
  220. businessType: null,
  221. reportNo: null,
  222. userType: null,
  223. distributionList: [
  224. {
  225. memberId: this.$store.getters.userInfo.id,
  226. performanceDistribution: 100,
  227. memberType: "客户经理"
  228. }
  229. ]
  230. }
  231. }
  232. },
  233. created() {
  234. this.assetsMarketDeclarePage();
  235. this.getAssetMarketCate();
  236. },
  237. methods: {
  238. resetSearch() {
  239. this.$router.push({ query: {} });
  240. this.orderDate = '';
  241. this.listQuery = {
  242. current: 1,
  243. size: 10,
  244. descs: 'id',
  245. }
  246. this.assetsMarketDeclarePage()
  247. },
  248. searchList() {
  249. this.listQuery.current = 1;
  250. this.assetsMarketDeclarePage();
  251. },
  252. assetsMarketDeclarePage() {
  253. this.$api.commissonDeclare.assetsMarketDeclarePage(this.listQuery).then(res => {
  254. if (res.code === 200) {
  255. this.pageData = res.data;
  256. }
  257. })
  258. },
  259. getAssetMarketCate() {
  260. this.$api.businessCommissionRate.cateList("ASSET_BUSINESS", "MANAGER").then(res => {
  261. if (res.code === 200) {
  262. this.cates = res.data;
  263. }
  264. })
  265. },
  266. openDeclareDialog(row) {
  267. this.getSimpleAllUser();
  268. this.declareDialog = true;
  269. this.declareForm.orderId = row.orderId;
  270. this.declareForm.name = row.orderName;
  271. this.declareForm.reportNo = row.reportNo;
  272. this.declareForm.businessId = row.businessId;
  273. this.declareForm.productionId = row.productionId;
  274. this.businessPerformanceDistributionForm.businessId = row.businessId;
  275. this.businessPerformanceDistributionForm.businessType = 'ASSET_BUSINESS';
  276. this.businessPerformanceDistributionForm.reportNo = row.reportNo;
  277. // 人员类型(市场人员/评估人员)
  278. this.businessPerformanceDistributionForm.userType = '市场人员';
  279. },
  280. declareMarket() {
  281. this.$refs.declareForm.validate(valid => {
  282. if (valid) {
  283. for (let i in this.businessPerformanceDistributionForm.distributionList) {
  284. if (!this.businessPerformanceDistributionForm.distributionList[i].memberId) {
  285. this.$message.error("客户经理未指定");
  286. return;
  287. }
  288. if (!this.businessPerformanceDistributionForm.distributionList[i].performanceDistribution) {
  289. this.$message.error("设置比例不能为空");
  290. return;
  291. }
  292. }
  293. const sum = this.businessPerformanceDistributionForm.distributionList.reduce((accumulator, obj) => {
  294. return accumulator + obj.performanceDistribution;
  295. }, 0);
  296. if (sum === 100) {
  297. this.declareForm.distributionDto = this.businessPerformanceDistributionForm;
  298. // console.log(this.declareForm);
  299. this.$api.commissonDeclare.assetsDeclare(this.declareForm).then(res => {
  300. if (res.code === 200) {
  301. this.$notify({
  302. title: '成功',
  303. message: '提成申报已提交',
  304. type: 'success',
  305. duration: 2000
  306. });
  307. this.assetsMarketDeclarePage();
  308. this.declareDialog = false;
  309. } else {
  310. this.$notify({
  311. title: '失败',
  312. message: '提成申报提交失败,请联系管理员',
  313. type: 'error',
  314. duration: 2000
  315. });
  316. }
  317. })
  318. } else {
  319. this.$notify({
  320. title: '警告',
  321. message: '所有人员分配的绩效之和必须等于100%!',
  322. type: 'error',
  323. duration: 3000
  324. });
  325. }
  326. }
  327. })
  328. },
  329. getSimpleAllUser() {
  330. this.$api.user.simpleAll().then(res => {
  331. if (res.code === 200) {
  332. this.users = res.data;
  333. }
  334. })
  335. },
  336. addUser() {
  337. if (this.businessPerformanceDistributionForm.distributionList.length > 4) {
  338. this.$message.error("人数超限")
  339. return;
  340. }
  341. let user = new Object;
  342. user.memberType = "客户经理"
  343. user.index
  344. this.businessPerformanceDistributionForm.distributionList.push(user);
  345. },
  346. removeUser(index) {
  347. this.businessPerformanceDistributionForm.distributionList.splice(index, 1)
  348. },
  349. checkDetail(id) {
  350. this.$router.push(`/income/assets/declare/detail?businessId=${id}&businessType=COMMISSION_DECLARE_ASSET_MARKET&doWorkflow=${false}&back=${'/income/assets/declare/market'}`)
  351. }
  352. },
  353. }
  354. </script>
  355. <style lang="scss" scoped>
  356. /deep/.doWarehouseClass {
  357. border-radius: 10px;
  358. }
  359. .real-amount {
  360. /deep/ .el-form-item__label {
  361. color: red;
  362. font-weight: bold
  363. }
  364. }
  365. </style>