task_operate.vue 11 KB

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