task_operate.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370
  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.getTaskStage();
  156. }
  157. },
  158. onPageScroll(res) {
  159. this.scrollTop = res.scrollTop / 120
  160. },
  161. methods: {
  162. openPopupObj(type) {
  163. this.popupType = type;
  164. if (type === 1) {
  165. if (this.selectType > 2) {
  166. tools.error('此阶段不能修')
  167. return false;
  168. }
  169. this.popupTitle = '请选择执行阶段'
  170. this.popupData = this.stageList
  171. } else {
  172. if (this.selectType > 1) {
  173. tools.error('此阶段不能修改')
  174. return false;
  175. }
  176. this.popupTitle = '请选择执行人'
  177. this.popupData = this.users
  178. }
  179. this.showExecute = true;
  180. this.$refs.popupObj.show();
  181. },
  182. setPopupClosed() {
  183. //关闭选择器
  184. this.showExecute = false;
  185. },
  186. submitOperate() {
  187. this.operateData.businessId = this.businessData.id
  188. this.operateData.stageId = this.stageId
  189. setStageOperate(this.operateData).then((res) => {
  190. if (res.code === 1) {
  191. this.operateData = {
  192. 'returned_total': '',
  193. 'out_total': '',
  194. }
  195. this.operateType = 1
  196. tools.success(res.msg)
  197. this.$emit('endTaskSet')
  198. } else {
  199. tools.error(res.msg)
  200. }
  201. })
  202. },
  203. setNewExecute(e) {
  204. //设置新执行人
  205. let newData = e.detail.value[0]
  206. this.showExecute = false;
  207. if (this.popupType === 1) {
  208. this.businessData.stage_id = newData.value
  209. this.stageData.stageName = newData.text
  210. this.getStageUser(this.businessData.stage_id)
  211. this.stageList.forEach((stage) => {
  212. if (stage.value === newData.value) {
  213. if (stage.type !== 2) {
  214. this.selectType = 2
  215. } else {
  216. this.selectType = 1
  217. }
  218. }
  219. })
  220. } else {
  221. this.businessData.manage_id = newData.value
  222. this.stageData.userName = newData.text
  223. }
  224. },
  225. getStageUser(stage_id) {
  226. getStageUser({
  227. 'stage_id': stage_id
  228. }).then((res) => {
  229. if (res.code === 1) {
  230. this.users = res.data
  231. this.businessData.manage_id = this.users[0].value
  232. this.stageData.userName = this.users[0].text
  233. }
  234. })
  235. },
  236. submit() {
  237. console.log('aaaaaaaaaaaaaaaaaaaaaaaaaa')
  238. console.log('this.type:'+this.type)
  239. if (this.type === '2') {
  240. this.auditTask()
  241. } else if (this.type === '1') {
  242. this.setExecuteTask()
  243. } else if (this.type === '3') {
  244. this.setMsg()
  245. }
  246. },
  247. setEnd() {
  248. uni.$emit('newTaskList')
  249. setTimeout(() => {
  250. tools.leftClick()
  251. }, 1000)
  252. },
  253. setMsg() {
  254. if (this.isAjax) {
  255. return;
  256. }
  257. // this.isAjax=true;
  258. this.msgData.business_id = this.businessId
  259. if (this.replyId) {
  260. this.msgData.reply_id = this.replyId;
  261. }
  262. setMsg(this.msgData).then((res) => {
  263. if (res.code === 1) {
  264. tools.success(res.msg)
  265. this.msgData.reply_id = ''
  266. this.msgData.msg = ''
  267. this.msgData.msg_img = []
  268. this.setEnd()
  269. } else {
  270. tools.error(res.msg)
  271. this.isAjax = false;
  272. }
  273. })
  274. },
  275. getTaskStage() {
  276. getTaskStage({
  277. 'id': this.businessId
  278. }).then((res) => {
  279. if (res.code === 1) {
  280. this.stageData = res.data.stageData;
  281. console.log(this.stageData.operate_ids)
  282. if (this.stageData.operate_ids.indexOf('3') > -1) {
  283. //获取回款银行信息
  284. getReturnedBankList().then((bankRes) => {
  285. if (bankRes.code === 1) {
  286. this.bankData = bankRes.data
  287. }
  288. })
  289. }
  290. this.businessData.id = res.data.business.id;
  291. this.businessData.manage_id = res.data.business.manage_id;
  292. this.businessData.stage_id = res.data.business.stage_id;
  293. this.stageId = res.data.business.stage_id;
  294. this.users = res.data.users;
  295. this.stageList = res.data.stageList;
  296. let isNext = false
  297. this.stageList.forEach((item) => {
  298. if (res.data.business.stage_id === item.value) {
  299. isNext = true
  300. } else if (isNext) {
  301. this.businessData.stage_id = item.value
  302. this.stageData.stageName = item.text
  303. this.getStageUser(this.businessData.stage_id)
  304. if (item.type > 2) {
  305. this.selectType = 2
  306. } else {
  307. this.selectType = 1
  308. }
  309. isNext = false
  310. }
  311. })
  312. if (this.stageData.operateNum > 1) {
  313. this.selectType = 3;
  314. }
  315. } else {
  316. tools.error('阶段信息异常')
  317. }
  318. })
  319. },
  320. auditTask() {
  321. uni.showModal({
  322. title: '提示',
  323. content: this.businessData.audit_type === 1 ? '是否通过当前任务?' : '是否驳回当前任务?',
  324. success: (res) => {
  325. if (res.confirm) {
  326. auditTask(this.businessData).then((auditRes) => {
  327. if (auditRes.code === 1) {
  328. tools.success(auditRes.msg)
  329. this.setEnd()
  330. } else {
  331. tools.error(auditRes.msg)
  332. }
  333. })
  334. }
  335. }
  336. });
  337. },
  338. setExecuteTask() {
  339. setExecuteTask(this.businessData).then((auditRes) => {
  340. if (auditRes.code === 1) {
  341. tools.success(auditRes.msg)
  342. // this.$emit('endTaskSet')
  343. this.setEnd()
  344. } else {
  345. tools.error(auditRes.msg)
  346. }
  347. })
  348. },
  349. }
  350. }
  351. </script>
  352. <style lang="scss" scoped>
  353. .operate_body {
  354. width: 100%;
  355. position: absolute;
  356. }
  357. .wh-input {
  358. width: 100%;
  359. text-align: right;
  360. direction: rtl;
  361. }
  362. </style>