task_operate.vue 11 KB

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