task_operate.vue 12 KB

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