task-set.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465
  1. <template>
  2. <view class="task-set">
  3. <!-- <headNav :isBackShow="true" :textContents="'任务设置'" :navBackgroundColor="'#fff'"></headNav> -->
  4. <view class="nav">
  5. 任务设置
  6. </view>
  7. <!-- <view class="task-tab" v-if="stageData.operate_ids.length>0">-->
  8. <!-- <view class="tab-item" :class="{'tab-select':operateType===1}" @click="setOperateType(1)">任务操作</view>-->
  9. <!-- <view class="tab-item" :class="{'tab-select':operateType===2}" @click="setOperateType(2)">阶段操作</view>-->
  10. <!-- </view>-->
  11. <view v-if="true">
  12. <view class="content">
  13. <view class="choose-box">
  14. <view class="choose-box-left">
  15. 下一处理阶段
  16. </view>
  17. <view class="choose-box-right" @click="openPopupObj(1)">
  18. <view class="choose-box-right-content">
  19. {{stageData.stageName?stageData.stageName:'请选择任务阶段'}}
  20. </view>
  21. <image class="choose-box-right-img" src="@/static/add-client/choose.png" mode=""></image>
  22. </view>
  23. </view>
  24. <view class="choose-box choose-box-two" v-if="selectType<2">
  25. <view class="choose-box-left">
  26. 下一执行人员
  27. </view>
  28. <view class="choose-box-right" @click="openPopupObj(2)">
  29. <view class="choose-box-right-content">
  30. {{stageData.userName?stageData.userName:'请选择执行人员'}}
  31. </view>
  32. <image class="choose-box-right-img" src="@/static/add-client/choose.png" mode=""></image>
  33. </view>
  34. </view>
  35. <view class="choose-box-stage">
  36. <en-input v-if="stageData.operate_ids.indexOf('2')>-1" label="回款金额" v-model="businessData.returned_total" type="digit" placeholder="请输入回款金额" right-text="万元"></en-input>
  37. <en-input v-if="stageData.operate_ids.indexOf('1')>-1" label="出款金额" v-model="businessData.out_total" type="digit" placeholder="请输入出款金额" right-text="万元"></en-input>
  38. <en-input v-if="stageData.operate_ids.indexOf('4')>-1" label="银行出款" v-model="businessData.bank_total" type="digit" placeholder="请输入银行出款" right-text="万元"></en-input>
  39. <view v-if="stageData.operate_ids.indexOf('3')>-1">
  40. <en-input label="回款姓名" v-model="businessData.returned_name" type="text" placeholder="请输入回款人姓名"></en-input>
  41. <en-select label="回款银行" v-model="businessData.returned_bank_id" :localData="bankData" placeholder="请选择还款银行"></en-select>
  42. </view>
  43. </view>
  44. <add-msg v-model="msgData"></add-msg>
  45. </view>
  46. <view class="submit-box" @click="submit">
  47. <view class="submit">
  48. 提交
  49. </view>
  50. </view>
  51. <view v-show="showExecute">
  52. <uni-data-picker class="" :popup-title="popupTitle" :localdata="popupData" ref="popupObj" @change="setNewExecute"
  53. :border="false" :clear-icon="false" @popupclosed="setPopupClosed">
  54. </uni-data-picker>
  55. </view>
  56. </view>
  57. <view class="operate-box" v-else>
  58. <view class="content-box">
  59. <en-input v-if="stageData.operate_ids.indexOf('1')>-1" label="回款金额" v-model="operateData.returned_total" type="number" placeholder="请输入回款金额"></en-input>
  60. <en-input v-if="stageData.operate_ids.indexOf('2')>-1" label="出款金额" v-model="operateData.out_total" type="number" placeholder="请选择还款银行"></en-input>
  61. </view>
  62. <view class="submit-box" @click="submitOperate">
  63. <view class="submit">
  64. 提交
  65. </view>
  66. </view>
  67. </view>
  68. </view>
  69. </template>
  70. <script>
  71. import {
  72. auditTask, getReturnedBankList,
  73. getTaskStage,
  74. setExecuteTask, setStageOperate
  75. } from "@/api/task";
  76. import tools from "@/service/tools";
  77. import PreviewImage from "@/components/PreviewImage/index";
  78. import {getStageUser} from "@/api/task";
  79. import AddMsg from "./module/add-msg";
  80. import EnInput from "@/components/en-from/en-input/en-input";
  81. import EnSelect from "@/components/en-from/en-select/en-select";
  82. export default {
  83. props: {
  84. businessId: {
  85. default: 0
  86. },
  87. },
  88. components: {
  89. EnSelect,
  90. EnInput,
  91. AddMsg,
  92. PreviewImage
  93. },
  94. data() {
  95. return {
  96. stageData: {
  97. operate_ids:[]
  98. },
  99. businessData: {
  100. 'id': '',
  101. 'manage_id': '',
  102. 'stage_id': '',
  103. 'audit_type': '',
  104. 'msg': '',
  105. 'msg_img': [],
  106. 'file_list': [],
  107. 'returned_total':'',
  108. 'out_total':'',
  109. 'bank_total':'',
  110. 'returned_name':'',
  111. 'returned_bank_id':'',
  112. },
  113. msgData:{
  114. 'msg': '',
  115. 'msg_img': [],
  116. 'file_list': [],
  117. },
  118. users: [],
  119. stageList: [],
  120. isAudit: false,
  121. showExecute: false,
  122. popupData: [],
  123. popupType: 1,
  124. auditType: 0,
  125. popupTitle: '',
  126. previewList: [],
  127. current: 0,
  128. selectType: 1,
  129. //新增阶段操作数据
  130. operateType:1,
  131. stageId:0,
  132. operateArr:[],
  133. operateData:{
  134. 'returned_total':'',
  135. 'out_total':'',
  136. 'returned_bank':'',
  137. 'returned_bank_id':'',
  138. },
  139. bankData:[]
  140. }
  141. },
  142. watch:{
  143. 'msgData':{
  144. handler() {
  145. this.businessData.msg=this.msgData.msg
  146. this.businessData.msg_img=this.msgData.msg_img
  147. this.businessData.file_list=this.msgData.file_list
  148. },
  149. deep: true
  150. }
  151. },
  152. mounted() {
  153. this.getTaskStage();
  154. },
  155. methods: {
  156. setOperateType(operateType){
  157. if(this.operateType!==operateType){
  158. this.operateType=operateType
  159. }
  160. },
  161. submitOperate(){
  162. this.operateData.businessId=this.businessData.id
  163. this.operateData.stageId=this.stageId
  164. setStageOperate(this.operateData).then((res)=>{
  165. if(res.code===1){
  166. this.operateData={
  167. 'returned_total':'',
  168. 'out_total':'',
  169. }
  170. this.operateType=1
  171. tools.success(res.msg)
  172. this.$emit('endTaskSet')
  173. }else {
  174. tools.error(res.msg)
  175. }
  176. })
  177. },
  178. setPopupClosed() {
  179. //关闭选择器
  180. this.showExecute = false;
  181. },
  182. setNewExecute(e) {
  183. //设置新执行人
  184. let newData = e.detail.value[0]
  185. this.showExecute = false;
  186. if (this.popupType === 1) {
  187. this.businessData.stage_id = newData.value
  188. this.stageData.stageName = newData.text
  189. this.getStageUser(this.businessData.stage_id)
  190. this.stageList.forEach((stage) => {
  191. if (stage.value === newData.value) {
  192. if (stage.type !== 2 ) {
  193. this.selectType = 2
  194. }else {
  195. this.selectType = 1
  196. }
  197. }
  198. })
  199. } else {
  200. this.businessData.manage_id = newData.value
  201. this.stageData.userName = newData.text
  202. }
  203. },
  204. getStageUser(stage_id){
  205. getStageUser({'stage_id':stage_id}).then((res)=>{
  206. if(res.code===1){
  207. this.users=res.data
  208. this.businessData.manage_id = this.users[0].value
  209. this.stageData.userName = this.users[0].text
  210. }
  211. })
  212. },
  213. openPopupObj(type) {
  214. this.popupType = type;
  215. if (type === 1) {
  216. if (this.selectType > 2) {
  217. tools.error('此阶段不能修')
  218. return false;
  219. }
  220. this.popupTitle = '请选择执行阶段'
  221. this.popupData = this.stageList
  222. } else {
  223. if (this.selectType > 1) {
  224. tools.error('此阶段不能修改')
  225. return false;
  226. }
  227. this.popupTitle = '请选择执行人'
  228. this.popupData = this.users
  229. }
  230. this.showExecute = true;
  231. this.$refs.popupObj.show();
  232. },
  233. startStage() {
  234. this.isAudit = false;
  235. this.getTaskStage();
  236. },
  237. startAuditType(auditType) {
  238. this.isAudit = true;
  239. this.businessData.audit_type = auditType;
  240. this.getTaskStage();
  241. },
  242. submit() {
  243. // console.log('sadsadsajkhhjasd---------------------')
  244. // uni.$emit('updateMemberInfo')
  245. // console.log('newReceiving:---------------------')
  246. if (this.isAudit) {
  247. this.auditTask()
  248. } else {
  249. this.setExecuteTask()
  250. }
  251. },
  252. setExecuteTask() {
  253. setExecuteTask(this.businessData).then((auditRes) => {
  254. if (auditRes.code === 1) {
  255. tools.success(auditRes.msg)
  256. this.$emit('endTaskSet')
  257. uni.$emit('newTaskList')
  258. } else {
  259. tools.error(auditRes.msg)
  260. }
  261. })
  262. },
  263. auditTask() {
  264. uni.showModal({
  265. title: '提示',
  266. content: this.businessData.audit_type === 1 ? '是否通过当前任务?' : '是否驳回当前任务?',
  267. success: (res) => {
  268. if (res.confirm) {
  269. auditTask(this.businessData).then((auditRes) => {
  270. if (auditRes.code === 1) {
  271. tools.success(auditRes.msg)
  272. this.$emit('endTaskSet')
  273. uni.$emit('newTaskList')
  274. console.log('newReceiving:---------------------')
  275. } else {
  276. tools.error(auditRes.msg)
  277. }
  278. })
  279. }
  280. }
  281. });
  282. },
  283. getTaskStage() {
  284. getTaskStage({
  285. 'id': this.businessId
  286. }).then((res) => {
  287. if (res.code === 1) {
  288. this.stageData = res.data.stageData;
  289. console.log(this.stageData.operate_ids)
  290. if(this.stageData.operate_ids.indexOf('3')>-1){
  291. //获取回款银行信息
  292. getReturnedBankList().then((bankRes)=>{
  293. if(bankRes.code===1){
  294. this.bankData=bankRes.data
  295. }
  296. })
  297. }
  298. this.businessData.id = res.data.business.id;
  299. this.businessData.manage_id = res.data.business.manage_id;
  300. this.businessData.stage_id = res.data.business.stage_id;
  301. this.stageId = res.data.business.stage_id;
  302. this.users = res.data.users;
  303. this.stageList = res.data.stageList;
  304. let isNext=false
  305. this.stageList.forEach((item)=>{
  306. if(res.data.business.stage_id===item.value){
  307. isNext=true
  308. }else if(isNext){
  309. this.businessData.stage_id=item.value
  310. this.stageData.stageName=item.text
  311. this.getStageUser(this.businessData.stage_id)
  312. if (item.type > 2 ) {
  313. this.selectType = 2
  314. }else {
  315. this.selectType = 1
  316. }
  317. isNext=false
  318. }
  319. })
  320. if (this.stageData.operateNum > 1) {
  321. this.selectType = 3;
  322. }
  323. } else {
  324. tools.error('阶段信息异常')
  325. }
  326. })
  327. },
  328. leftClick() {
  329. uni.navigateBack({
  330. delta: 1
  331. })
  332. },
  333. },
  334. }
  335. </script>
  336. <style lang="scss" scoped>
  337. .task-set {
  338. width: 100%;
  339. min-height: 50vh;
  340. max-height: 70vh;
  341. background: #F6F7FB;
  342. overflow: auto;
  343. border-radius: 20rpx 20rpx 0rpx 0rpx;
  344. .nav {
  345. font-size: 18px;
  346. font-weight: bold;
  347. text-align: center;
  348. padding: 30rpx 0 15rpx;
  349. background: #fff;
  350. }
  351. .task-tab{
  352. display: flex;
  353. justify-content: space-between;
  354. height: 88rpx;
  355. .tab-item{
  356. width: 50%;
  357. height: 100%;
  358. font-size: 14px;
  359. color: #333333;
  360. line-height: 88rpx;
  361. text-align: center;
  362. background: #fff;
  363. border: 2rpx solid #3169FA;
  364. box-sizing: border-box;
  365. }
  366. .tab-select{
  367. background: #3169FA;
  368. color: #FFFFFF;
  369. border:none;
  370. }
  371. }
  372. .content {
  373. width: 100%;
  374. height: auto;
  375. padding: 22rpx 0 106rpx 0;
  376. .choose-box {
  377. width: 100%;
  378. height: auto;
  379. padding: 34rpx 35rpx;
  380. box-sizing: border-box;
  381. background: #fff;
  382. border-top: 1px solid #F0F0F0;
  383. display: flex;
  384. align-items: center;
  385. justify-content: space-between;
  386. .choose-box-left {
  387. font-size: 16px;
  388. color: #666666;
  389. }
  390. .choose-box-right {
  391. display: flex;
  392. align-items: center;
  393. .choose-box-right-content {
  394. font-size: 16px;
  395. font-weight: 400;
  396. color: #232A35;
  397. margin: 0 18rpx 0 0;
  398. }
  399. .choose-box-right-img {
  400. width: 12rpx;
  401. height: 20rpx;
  402. }
  403. }
  404. }
  405. .choose-box-stage{
  406. background: #fff;
  407. padding: 0 22rpx;
  408. margin-bottom: 22rpx;
  409. }
  410. .choose-box-two {
  411. margin: 0 0 22rpx 0;
  412. }
  413. }
  414. .submit-box {
  415. width: 100%;
  416. height: auto;
  417. border-top: 1px solid #F0F0F0;
  418. background: #fff;
  419. position: fixed;
  420. left: 0;
  421. bottom: 0;
  422. padding: 12rpx 32rpx;
  423. box-sizing: border-box;
  424. .submit {
  425. width: 100%;
  426. height: auto;
  427. background: #3169FA;
  428. border-radius: 4px;
  429. font-size: 16px;
  430. color: #FFFFFF;
  431. padding: 20rpx 0;
  432. text-align: center;
  433. }
  434. }
  435. .operate-box{
  436. .content-box {
  437. margin-top: 20rpx;
  438. height: auto;
  439. padding: 0 20rpx;
  440. background: #fff;
  441. }
  442. }
  443. }
  444. </style>