task_operate.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372
  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-select :label="'银行出款'" v-model="businessData.returned_bank_id" :localData="bankData"
  32. placeholder="请选择还款银行"></en-select>
  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. import EnSelect from "@/components/en-from/en-select/en-select.vue";
  68. export default {
  69. components: {
  70. EnSelect,
  71. EnInput,
  72. WhInput,
  73. SendChat
  74. },
  75. data() {
  76. return {
  77. bgHeight: 110,
  78. scrollTop: 0,
  79. is_handle: true,
  80. title: '任务反馈',
  81. businessId: '',
  82. type: '',
  83. stageData: {
  84. operate_ids: []
  85. },
  86. businessData: {
  87. 'id': '',
  88. 'manage_id': '',
  89. 'stage_id': '',
  90. 'audit_type': '',
  91. 'msg': '',
  92. 'msg_img': [],
  93. 'file_list': [],
  94. 'returned_total': '',
  95. 'out_total': '',
  96. 'bank_total': '',
  97. 'returned_name': '',
  98. 'returned_bank_id': '',
  99. },
  100. msgData: {
  101. 'msg': '',
  102. 'msg_img': [],
  103. 'file_list': [],
  104. },
  105. users: [],
  106. stageList: [],
  107. isAudit: false,
  108. showExecute: false,
  109. popupData: [],
  110. popupType: 1,
  111. auditType: 0,
  112. popupTitle: '',
  113. previewList: [],
  114. current: 0,
  115. selectType: 1,
  116. //新增阶段操作数据
  117. operateType: 1,
  118. stageId: 0,
  119. operateArr: [],
  120. operateData: {
  121. 'returned_total': '',
  122. 'out_total': '',
  123. 'returned_bank': '',
  124. 'returned_bank_id': '',
  125. },
  126. bankData: []
  127. }
  128. },
  129. watch: {
  130. 'msgData': {
  131. handler() {
  132. this.businessData.msg = this.msgData.msg
  133. this.businessData.msg_img = this.msgData.msg_img
  134. this.businessData.file_list = this.msgData.file_list
  135. },
  136. deep: true
  137. }
  138. },
  139. onLoad(ret) {
  140. console.log(ret)
  141. if (ret.businessId === undefined) {
  142. tools.leftClick()
  143. } else {
  144. this.businessId = ret.businessId
  145. this.type = ret.type
  146. console.log(this.type === '2')
  147. if (ret.auditType) this.businessData.audit_type = ret.auditType * 1
  148. if (this.type === '1') {
  149. this.title = '任务反馈'
  150. } else if (this.type === '2') {
  151. this.title = '任务审核'
  152. } else if (this.type === '3') {
  153. this.title = '任务执行'
  154. } else {
  155. this.title = '任务冲销'
  156. }
  157. this.getTaskStage();
  158. }
  159. },
  160. onPageScroll(res) {
  161. this.scrollTop = res.scrollTop / 120
  162. },
  163. methods: {
  164. openPopupObj(type) {
  165. this.popupType = type;
  166. if (type === 1) {
  167. if (this.selectType > 2) {
  168. tools.error('此阶段不能修')
  169. return false;
  170. }
  171. this.popupTitle = '请选择执行阶段'
  172. this.popupData = this.stageList
  173. } else {
  174. if (this.selectType > 1) {
  175. tools.error('此阶段不能修改')
  176. return false;
  177. }
  178. this.popupTitle = '请选择执行人'
  179. this.popupData = this.users
  180. }
  181. this.showExecute = true;
  182. this.$refs.popupObj.show();
  183. },
  184. setPopupClosed() {
  185. //关闭选择器
  186. this.showExecute = false;
  187. },
  188. submitOperate() {
  189. this.operateData.businessId = this.businessData.id
  190. this.operateData.stageId = this.stageId
  191. setStageOperate(this.operateData).then((res) => {
  192. if (res.code === 1) {
  193. this.operateData = {
  194. 'returned_total': '',
  195. 'out_total': '',
  196. }
  197. this.operateType = 1
  198. tools.success(res.msg)
  199. this.$emit('endTaskSet')
  200. } else {
  201. tools.error(res.msg)
  202. }
  203. })
  204. },
  205. setNewExecute(e) {
  206. //设置新执行人
  207. let newData = e.detail.value[0]
  208. this.showExecute = false;
  209. if (this.popupType === 1) {
  210. this.businessData.stage_id = newData.value
  211. this.stageData.stageName = newData.text
  212. this.getStageUser(this.businessData.stage_id)
  213. this.stageList.forEach((stage) => {
  214. if (stage.value === newData.value) {
  215. if (stage.type !== 2) {
  216. this.selectType = 2
  217. } else {
  218. this.selectType = 1
  219. }
  220. }
  221. })
  222. } else {
  223. this.businessData.manage_id = newData.value
  224. this.stageData.userName = newData.text
  225. }
  226. },
  227. getStageUser(stage_id) {
  228. getStageUser({
  229. 'stage_id': stage_id
  230. }).then((res) => {
  231. if (res.code === 1) {
  232. this.users = res.data
  233. this.businessData.manage_id = this.users[0].value
  234. this.stageData.userName = this.users[0].text
  235. }
  236. })
  237. },
  238. submit() {
  239. console.log('aaaaaaaaaaaaaaaaaaaaaaaaaa')
  240. console.log('this.type:'+this.type)
  241. if (this.type === '2') {
  242. this.auditTask()
  243. } else if (this.type === '1') {
  244. this.setExecuteTask()
  245. } else if (this.type === '3') {
  246. this.setMsg()
  247. }
  248. },
  249. setEnd() {
  250. uni.$emit('newTaskList')
  251. setTimeout(() => {
  252. tools.leftClick()
  253. }, 1000)
  254. },
  255. setMsg() {
  256. if (this.isAjax) {
  257. return;
  258. }
  259. // this.isAjax=true;
  260. this.msgData.business_id = this.businessId
  261. if (this.replyId) {
  262. this.msgData.reply_id = this.replyId;
  263. }
  264. setMsg(this.msgData).then((res) => {
  265. if (res.code === 1) {
  266. tools.success(res.msg)
  267. this.msgData.reply_id = ''
  268. this.msgData.msg = ''
  269. this.msgData.msg_img = []
  270. this.setEnd()
  271. } else {
  272. tools.error(res.msg)
  273. this.isAjax = false;
  274. }
  275. })
  276. },
  277. getTaskStage() {
  278. getTaskStage({
  279. 'id': this.businessId
  280. }).then((res) => {
  281. if (res.code === 1) {
  282. this.stageData = res.data.stageData;
  283. console.log(this.stageData.operate_ids)
  284. if (this.stageData.operate_ids.indexOf('3') > -1) {
  285. //获取回款银行信息
  286. getReturnedBankList().then((bankRes) => {
  287. if (bankRes.code === 1) {
  288. this.bankData = bankRes.data
  289. }
  290. })
  291. }
  292. this.businessData.id = res.data.business.id;
  293. this.businessData.manage_id = res.data.business.manage_id;
  294. this.businessData.stage_id = res.data.business.stage_id;
  295. this.stageId = res.data.business.stage_id;
  296. this.users = res.data.users;
  297. this.stageList = res.data.stageList;
  298. let isNext = false
  299. this.stageList.forEach((item) => {
  300. if (res.data.business.stage_id === item.value) {
  301. isNext = true
  302. } else if (isNext) {
  303. this.businessData.stage_id = item.value
  304. this.stageData.stageName = item.text
  305. this.getStageUser(this.businessData.stage_id)
  306. if (item.type > 2) {
  307. this.selectType = 2
  308. } else {
  309. this.selectType = 1
  310. }
  311. isNext = false
  312. }
  313. })
  314. if (this.stageData.operateNum > 1) {
  315. this.selectType = 3;
  316. }
  317. } else {
  318. tools.error('阶段信息异常')
  319. }
  320. })
  321. },
  322. auditTask() {
  323. uni.showModal({
  324. title: '提示',
  325. content: this.businessData.audit_type === 1 ? '是否通过当前任务?' : '是否驳回当前任务?',
  326. success: (res) => {
  327. if (res.confirm) {
  328. auditTask(this.businessData).then((auditRes) => {
  329. if (auditRes.code === 1) {
  330. tools.success(auditRes.msg)
  331. this.setEnd()
  332. } else {
  333. tools.error(auditRes.msg)
  334. }
  335. })
  336. }
  337. }
  338. });
  339. },
  340. setExecuteTask() {
  341. setExecuteTask(this.businessData).then((auditRes) => {
  342. if (auditRes.code === 1) {
  343. tools.success(auditRes.msg)
  344. // this.$emit('endTaskSet')
  345. this.setEnd()
  346. } else {
  347. tools.error(auditRes.msg)
  348. }
  349. })
  350. },
  351. }
  352. }
  353. </script>
  354. <style lang="scss" scoped>
  355. .operate_body {
  356. width: 100%;
  357. position: absolute;
  358. }
  359. .wh-input {
  360. width: 100%;
  361. text-align: right;
  362. direction: rtl;
  363. }
  364. </style>