task_operate.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369
  1. <template>
  2. <view class="total-page page-box task-bg">
  3. <Nav :title="title" :genre="1" :opacity="scrollTop" is_fixed :bgHeight="bgHeight"></Nav>
  4. <view class="operate_body page-env-160" :style="{top:`${$tools.topHeight()}px`}">
  5. <view class="sys-background-fff m-lr30 m-t30 m-b20 p-lr30 r-20">
  6. <view class="" v-if="type!=='3'">
  7. <view class="row-justify-sb center flex p-tb30 bor-bottom-1 size-28">
  8. <view class="wh-text"><text></text>下一阶段处理</view>
  9. <view class="center line-34" @click="openPopupObj(1)">
  10. <text class="size-28">{{stageData.stageName?stageData.stageName:'请选择任务阶段'}}</text>
  11. <uni-icons type="forward" size="18" color="#D8D8D8"></uni-icons>
  12. </view>
  13. </view>
  14. <view class="row-justify-sb center p-tb30 bor-bottom-1 size-28" v-if="selectType<2">
  15. <view class="wh-text"><text></text>下一执行人员</view>
  16. <view class="center line-30" @click="openPopupObj(2)">
  17. <text class="size-28">{{stageData.userName?stageData.userName:'请选择执行人员'}}</text>
  18. <uni-icons type="forward" size="18" color="#D8D8D8"></uni-icons>
  19. </view>
  20. </view>
  21. <en-input :label="'回款金额'" v-if="stageData.operate_ids.indexOf('2')>-1"
  22. v-model="businessData.returned_total" type="digit" placeholder="请输入回款金额"></en-input>
  23. <en-input :label="'出款金额'" v-if="stageData.operate_ids.indexOf('1')>-1"
  24. v-model="businessData.out_total" type="digit" placeholder="请输入出款金额"></en-input>
  25. <en-input :label="'银行出款'" v-if="stageData.operate_ids.indexOf('4')>-1"
  26. v-model="businessData.bank_total" type="digit" placeholder="请输入银行出款"></en-input>
  27. <view v-if="stageData.operate_ids.indexOf('3')>-1">
  28. <en-input :label="'回款姓名'" v-model="businessData.returned_name" type="text"
  29. placeholder="请输入回款人姓名"></en-input>
  30. <!-- 此处应该是select-->
  31. <en-input :label="'银行出款'" v-model="businessData.returned_bank_id" :localData="bankData"
  32. placeholder="请选择还款银行"></en-input>
  33. </view>
  34. </view>
  35. <!-- <view class="" v-else>-->
  36. <!-- <WhInput :name="'冲销类型'" :is_border="false" is_select disabled></WhInput>-->
  37. <!-- </view>-->
  38. </view>
  39. <view class="sys-background-fff m-lr30 r-20">
  40. <SendChat v-model="msgData" :placeholder="type==='2'?'请输入审核意见~~':'请输入描述~~'"></SendChat>
  41. </view>
  42. </view>
  43. <view v-show="showExecute">
  44. <uni-data-picker class="" :popup-title="popupTitle" :localdata="popupData" ref="popupObj"
  45. @change="setNewExecute" :border="false" :clear-icon="false" @popupclosed="setPopupClosed">
  46. </uni-data-picker>
  47. </view>
  48. <EnButton text="提交" @onSubmit="submit"></EnButton>
  49. </view>
  50. </template>
  51. <script>
  52. import WhInput from "@/components/en-from/en-input/en-input.vue"
  53. import SendChat from "@/page_task/task_details/module/send_chat.vue"
  54. import tools from "@/service/tools";
  55. import {
  56. auditTask,
  57. getReturnedBankList,
  58. getTaskStage,
  59. setExecuteTask,
  60. setMsg,
  61. setStageOperate
  62. } from "@/api/task";
  63. import {
  64. getStageUser
  65. } from "@/api/task";
  66. import EnInput from "@/components/en-from/en-input/en-input.vue";
  67. export default {
  68. components: {
  69. EnInput,
  70. WhInput,
  71. SendChat
  72. },
  73. data() {
  74. return {
  75. bgHeight: 110,
  76. scrollTop: 0,
  77. is_handle: true,
  78. title: '任务反馈',
  79. businessId: '',
  80. type: '',
  81. stageData: {
  82. operate_ids: []
  83. },
  84. businessData: {
  85. 'id': '',
  86. 'manage_id': '',
  87. 'stage_id': '',
  88. 'audit_type': '',
  89. 'msg': '',
  90. 'msg_img': [],
  91. 'file_list': [],
  92. 'returned_total': '',
  93. 'out_total': '',
  94. 'bank_total': '',
  95. 'returned_name': '',
  96. 'returned_bank_id': '',
  97. },
  98. msgData: {
  99. 'msg': '',
  100. 'msg_img': [],
  101. 'file_list': [],
  102. },
  103. users: [],
  104. stageList: [],
  105. isAudit: false,
  106. showExecute: false,
  107. popupData: [],
  108. popupType: 1,
  109. auditType: 0,
  110. popupTitle: '',
  111. previewList: [],
  112. current: 0,
  113. selectType: 1,
  114. //新增阶段操作数据
  115. operateType: 1,
  116. stageId: 0,
  117. operateArr: [],
  118. operateData: {
  119. 'returned_total': '',
  120. 'out_total': '',
  121. 'returned_bank': '',
  122. 'returned_bank_id': '',
  123. },
  124. bankData: []
  125. }
  126. },
  127. watch: {
  128. 'msgData': {
  129. handler() {
  130. this.businessData.msg = this.msgData.msg
  131. this.businessData.msg_img = this.msgData.msg_img
  132. this.businessData.file_list = this.msgData.file_list
  133. },
  134. deep: true
  135. }
  136. },
  137. onLoad(ret) {
  138. console.log(ret)
  139. if (ret.businessId === undefined) {
  140. tools.leftClick()
  141. } else {
  142. this.businessId = ret.businessId
  143. this.type = ret.type
  144. console.log(this.type === '2')
  145. if (ret.auditType) this.businessData.audit_type = ret.auditType * 1
  146. if (this.type === '1') {
  147. this.title = '任务反馈'
  148. } else if (this.type === '2') {
  149. this.title = '任务审核'
  150. } else if (this.type === '3') {
  151. this.title = '任务执行'
  152. } else {
  153. this.title = '任务冲销'
  154. }
  155. this.type = 3
  156. this.getTaskStage();
  157. }
  158. },
  159. onPageScroll(res) {
  160. this.scrollTop = res.scrollTop / 120
  161. },
  162. methods: {
  163. openPopupObj(type) {
  164. this.popupType = type;
  165. if (type === 1) {
  166. if (this.selectType > 2) {
  167. tools.error('此阶段不能修')
  168. return false;
  169. }
  170. this.popupTitle = '请选择执行阶段'
  171. this.popupData = this.stageList
  172. } else {
  173. if (this.selectType > 1) {
  174. tools.error('此阶段不能修改')
  175. return false;
  176. }
  177. this.popupTitle = '请选择执行人'
  178. this.popupData = this.users
  179. }
  180. this.showExecute = true;
  181. this.$refs.popupObj.show();
  182. },
  183. setPopupClosed() {
  184. //关闭选择器
  185. this.showExecute = false;
  186. },
  187. submitOperate() {
  188. this.operateData.businessId = this.businessData.id
  189. this.operateData.stageId = this.stageId
  190. setStageOperate(this.operateData).then((res) => {
  191. if (res.code === 1) {
  192. this.operateData = {
  193. 'returned_total': '',
  194. 'out_total': '',
  195. }
  196. this.operateType = 1
  197. tools.success(res.msg)
  198. this.$emit('endTaskSet')
  199. } else {
  200. tools.error(res.msg)
  201. }
  202. })
  203. },
  204. setNewExecute(e) {
  205. //设置新执行人
  206. let newData = e.detail.value[0]
  207. this.showExecute = false;
  208. if (this.popupType === 1) {
  209. this.businessData.stage_id = newData.value
  210. this.stageData.stageName = newData.text
  211. this.getStageUser(this.businessData.stage_id)
  212. this.stageList.forEach((stage) => {
  213. if (stage.value === newData.value) {
  214. if (stage.type !== 2) {
  215. this.selectType = 2
  216. } else {
  217. this.selectType = 1
  218. }
  219. }
  220. })
  221. } else {
  222. this.businessData.manage_id = newData.value
  223. this.stageData.userName = newData.text
  224. }
  225. },
  226. getStageUser(stage_id) {
  227. getStageUser({
  228. 'stage_id': stage_id
  229. }).then((res) => {
  230. if (res.code === 1) {
  231. this.users = res.data
  232. this.businessData.manage_id = this.users[0].value
  233. this.stageData.userName = this.users[0].text
  234. }
  235. })
  236. },
  237. submit() {
  238. if (this.type === '2') {
  239. this.auditTask()
  240. } else if (this.type === '1') {
  241. this.setExecuteTask()
  242. } else if (this.type === '3') {
  243. this.setMsg()
  244. }
  245. },
  246. setEnd() {
  247. uni.$emit('newTaskList')
  248. setTimeout(() => {
  249. tools.leftClick()
  250. }, 1000)
  251. },
  252. setMsg() {
  253. if (this.isAjax) {
  254. return;
  255. }
  256. // this.isAjax=true;
  257. this.msgData.business_id = this.businessId
  258. if (this.replyId) {
  259. this.msgData.reply_id = this.replyId;
  260. }
  261. setMsg(this.msgData).then((res) => {
  262. if (res.code === 1) {
  263. tools.success(res.msg)
  264. this.msgData.reply_id = ''
  265. this.msgData.msg = ''
  266. this.msgData.msg_img = []
  267. this.setEnd()
  268. } else {
  269. tools.error(res.msg)
  270. this.isAjax = false;
  271. }
  272. })
  273. },
  274. getTaskStage() {
  275. getTaskStage({
  276. 'id': this.businessId
  277. }).then((res) => {
  278. if (res.code === 1) {
  279. this.stageData = res.data.stageData;
  280. console.log(this.stageData.operate_ids)
  281. if (this.stageData.operate_ids.indexOf('3') > -1) {
  282. //获取回款银行信息
  283. getReturnedBankList().then((bankRes) => {
  284. if (bankRes.code === 1) {
  285. this.bankData = bankRes.data
  286. }
  287. })
  288. }
  289. this.businessData.id = res.data.business.id;
  290. this.businessData.manage_id = res.data.business.manage_id;
  291. this.businessData.stage_id = res.data.business.stage_id;
  292. this.stageId = res.data.business.stage_id;
  293. this.users = res.data.users;
  294. this.stageList = res.data.stageList;
  295. let isNext = false
  296. this.stageList.forEach((item) => {
  297. if (res.data.business.stage_id === item.value) {
  298. isNext = true
  299. } else if (isNext) {
  300. this.businessData.stage_id = item.value
  301. this.stageData.stageName = item.text
  302. this.getStageUser(this.businessData.stage_id)
  303. if (item.type > 2) {
  304. this.selectType = 2
  305. } else {
  306. this.selectType = 1
  307. }
  308. isNext = false
  309. }
  310. })
  311. if (this.stageData.operateNum > 1) {
  312. this.selectType = 3;
  313. }
  314. } else {
  315. tools.error('阶段信息异常')
  316. }
  317. })
  318. },
  319. auditTask() {
  320. uni.showModal({
  321. title: '提示',
  322. content: this.businessData.audit_type === 1 ? '是否通过当前任务?' : '是否驳回当前任务?',
  323. success: (res) => {
  324. if (res.confirm) {
  325. auditTask(this.businessData).then((auditRes) => {
  326. if (auditRes.code === 1) {
  327. tools.success(auditRes.msg)
  328. this.setEnd()
  329. } else {
  330. tools.error(auditRes.msg)
  331. }
  332. })
  333. }
  334. }
  335. });
  336. },
  337. setExecuteTask() {
  338. setExecuteTask(this.businessData).then((auditRes) => {
  339. if (auditRes.code === 1) {
  340. tools.success(auditRes.msg)
  341. // this.$emit('endTaskSet')
  342. this.setEnd()
  343. } else {
  344. tools.error(auditRes.msg)
  345. }
  346. })
  347. },
  348. }
  349. }
  350. </script>
  351. <style lang="scss" scoped>
  352. .operate_body {
  353. width: 100%;
  354. position: absolute;
  355. }
  356. .wh-input {
  357. width: 100%;
  358. text-align: right;
  359. direction: rtl;
  360. }
  361. </style>