HwOrderModal.vue 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428
  1. <template>
  2. <page-layout :title="model.title">
  3. <detail-list slot="headerContent" size="small" :col="2" class="detail-layout" style="padding-bottom: 32px">
  4. <detail-list-item term="需求单号">{{model.requireCode}}</detail-list-item>
  5. </detail-list>
  6. <a-row slot="extra" class="status-list">
  7. <a-col :xs="24" :sm="24">
  8. <div class="text">状态</div>
  9. <div class="heading">{{model.status_text}}</div>
  10. </a-col>
  11. </a-row>
  12. <!-- actions -->
  13. <template slot="action">
  14. <template v-if="model.status == 0">
  15. <a-button @click="handleOkOrder(model)" type="primary" v-has="'order:confirm'">确认订单</a-button>
  16. <a-divider type="vertical" v-has="'order:close'"/>
  17. <a-button @click="handleCloseOrder(model)" v-has="'order:close'">关闭订单</a-button>
  18. </template>
  19. <template v-if="model.status == 2">
  20. <a-button @click="handleLimitOrder(model)" type="primary" v-has="'order:limit'">中止订单</a-button>
  21. </template>
  22. </template>
  23. <!-- 操作 -->
  24. <a-card :bordered="false" :loading="loading" :tabList="tabList"
  25. :activeTabKey="activeTabKey"
  26. @tabChange="key => handleTabChange(key, 'activeTabKey')">
  27. <template v-if="activeTabKey === '1'">
  28. <detail-list title="订单信息">
  29. <detail-list-item term="发布人">{{model.username}}</detail-list-item>
  30. <detail-list-item term="接单人">{{model.hwusername}}</detail-list-item>
  31. <detail-list-item term="结算方式">{{model.hwRequirement.settlementMethod ==0?'一次性结算':'分期结算'}}</detail-list-item>
  32. <detail-list-item term="订单期数">{{model.hwRequirement.settlementMethod ==1?model.hwRequirement.stage+'期':''}}
  33. </detail-list-item>
  34. <detail-list-item term="参考单价">{{model.hwRequirement.price}}</detail-list-item>
  35. <detail-list-item term="参考总价">{{model.totalPrice}}</detail-list-item>
  36. </detail-list>
  37. <a-divider style="margin-bottom: 32px"/>
  38. <detail-list title="订单描述">
  39. {{model.hwRequirement.description}}
  40. </detail-list>
  41. <a-divider style="margin-bottom: 32px"/>
  42. <detail-list title="验收要求">
  43. {{model.hwRequirement.acceptanceCriteria}}
  44. </detail-list>
  45. <a-divider style="margin-bottom: 32px"/>
  46. <detail-list title="相关合同">
  47. <detail-list-item term="服务合同">
  48. {{model.hwRequirement.contractType == 0?'线上合同':'线下合同'}}
  49. <!--<template v-if="model.hwRequirement.contractType == 0">-->
  50. <div class="text" style="margin-top: 10px;">
  51. <a @click="handleWorkDownload(model.hwRequirement.serviceContract)">下载合同</a>
  52. <a @click="handleEditRequireModal(model.hwRequirement)" style="margin-left: 15px" v-has="'order:serviceEdit'">修改</a>
  53. </div>
  54. <!--</template>-->
  55. </detail-list-item>
  56. <detail-list-item term="转包合同" v-if="model.hwRequirement.subcontractType != null">
  57. {{model.hwRequirement.subcontractType == 0?'线上合同':'线下合同'}}
  58. <!--<template v-if="model.hwRequirement.subcontractType == 0">-->
  59. <div class="text" style="margin-top: 10px;">
  60. <a @click="handleWorkDownload(model.hwRequirement.subcontract)">下载合同</a>
  61. <a @click="handleEditRequireSubModal(model.hwRequirement)" style="margin-left: 15px" v-has="'order:subcontractEdit'">修改</a>
  62. </div>
  63. <!--</template>-->
  64. </detail-list-item>
  65. <detail-list-item term="承揽合同" v-has="'order:workContract'">
  66. <template v-if="model.contractType == 0 ||model.contractType == 1 ">
  67. {{model.contractType == 0?'线上合同':'线下合同'}}
  68. <!--<template v-if="model.contractType == 0">-->
  69. <div class="text" style="margin-top: 10px;">
  70. <a @click="handleWorkDownload(model.workContract)">下载合同</a>
  71. <a @click="handleSelectEditModal(model)" style="margin-left: 15px">修改</a>
  72. </div>
  73. <!--</template>-->
  74. </template>
  75. <template v-else>
  76. <a @click="handleSelectModal(model)">选择类型</a>
  77. </template>
  78. </detail-list-item>
  79. </detail-list>
  80. <a-divider style="margin-bottom: 32px"/>
  81. </template>
  82. <template v-if="activeTabKey === '2'">
  83. <a-timeline>
  84. <template v-for="(item ,i) in model.hwOrderProcessDetailList">
  85. <a-timeline-item>
  86. <a-icon slot="dot" type="clock-circle-o" style="font-size: 16px;" />
  87. <p style="margin-bottom: 0px;font-size: 14px">{{item.generateTime}}</p>
  88. <p style="font-size: 16px">{{item.statusText}}</p>
  89. </a-timeline-item>
  90. </template>
  91. </a-timeline>
  92. </template>
  93. <hw-order-select-modal ref="modalSelectForm" @ok="modalFormOk"></hw-order-select-modal>
  94. <hw-order-select-require-modal ref="modalSelectRequireForm" @ok="modalFormOk"></hw-order-select-require-modal>
  95. <hw-order-select-require-sub-modal ref="modalSelectRequireSubForm" @ok="modalFormOk"></hw-order-select-require-sub-modal>
  96. </a-card>
  97. </page-layout>
  98. </template>
  99. <script>
  100. import HwOrderSelectModal from './HwOrderSelectModal'
  101. import HwOrderSelectRequireModal from './HwOrderSelectRequireModal'
  102. import HwOrderSelectRequireSubModal from './HwOrderSelectRequireSubModal'
  103. import PageLayout from '@/components/page/PageLayout'
  104. import STable from '@/components/table/'
  105. import DetailList from '@/components/tools/DetailList'
  106. import ABadge from 'ant-design-vue/es/badge/Badge'
  107. import { httpAction, getAction, putAction, downFile } from '@/api/manage'
  108. import pick from 'lodash.pick'
  109. import JDate from '@/components/jeecg/JDate'
  110. import { initDictOptions } from '@/components/dict/JDictSelectUtil'
  111. import { axios } from '@/utils/request'
  112. const confirmOrder = (params) => putAction('/ordermanager/hwOrder/confirmOrder', params)
  113. const closeOrder = (params) => putAction('/ordermanager/hwOrder/closeOrder', params)
  114. const limitOrder = (params) => putAction('/ordermanager/hwOrder/limitOrder', params)
  115. const DetailListItem = DetailList.Item
  116. export default {
  117. name: 'HwOrderModal',
  118. components: {
  119. PageLayout,
  120. ABadge,
  121. DetailList,
  122. DetailListItem,
  123. STable,
  124. JDate,
  125. HwOrderSelectModal,
  126. HwOrderSelectRequireModal,
  127. HwOrderSelectRequireSubModal
  128. },
  129. data() {
  130. return {
  131. tabList: [
  132. {
  133. key: '1',
  134. tab: '详情'
  135. },
  136. {
  137. key: '2',
  138. tab: '进度明细'
  139. }
  140. ],
  141. labelCol: {
  142. xs: { span: 24 },
  143. sm: { span: 5 }
  144. },
  145. wrapperCol: {
  146. xs: { span: 24 },
  147. sm: { span: 16 }
  148. },
  149. activeTabKey: '1',
  150. loading: false,
  151. model: {},
  152. validatorRules: {
  153. contractType: { rules: [{ required: true, message: '请输入合同方式' }] }
  154. },
  155. detailLength: 0,
  156. url: {
  157. add: '/ordermanager/hwOrder/add',
  158. edit: '/ordermanager/hwOrder/edit',
  159. getColumns: '/ordermanager/hwOrder/detail?id=',
  160. downloadUrl: window._CONFIG['domianURL'] + '/hpSys/common/ossDownload'
  161. }
  162. }
  163. },
  164. created() {
  165. this.initAutoListConfig().then(() => {
  166. }).catch(msg => {
  167. console.log(msg)
  168. })
  169. },
  170. watch: {
  171. '$route'() {
  172. // 刷新参数放到这里去触发,就可以刷新相同界面了
  173. this.initAutoListConfig().then(() => {
  174. }).catch(msg => {
  175. console.log(msg)
  176. })
  177. }
  178. },
  179. computed: {},
  180. methods: {
  181. resetData() {
  182. },
  183. initAutoListConfig() {
  184. return new Promise((resolve, reject) => {
  185. if (!this.$route.params.code) {
  186. reject('列表加载需要参数CODE为空!')
  187. } else {
  188. this.resetData()
  189. this.loading = true
  190. this.code = this.$route.params.code
  191. console.log('cd', this.code)
  192. getAction(`${this.url.getColumns}${this.code}`)
  193. .then(res => {
  194. if (res.success) {
  195. this.configInfohandler(res)
  196. resolve()
  197. } else {
  198. reject('失败')
  199. }
  200. this.loading = false
  201. })
  202. .catch(err => {
  203. reject(err)
  204. })
  205. }
  206. })
  207. },
  208. configInfohandler(res) {
  209. let that = this
  210. //解析字典
  211. initDictOptions('order_status').then((resdict) => {
  212. if (resdict.success) {
  213. var dictOptions = resdict.result
  214. var text = String(res.result.status)
  215. let status = ''
  216. dictOptions.forEach(function(option) {
  217. if (text === option.value) {
  218. status = option.text
  219. }
  220. })
  221. that.model = res.result
  222. console.log('df===', that.model)
  223. if(that.model.status == 2){
  224. if(that.model.serviceStage){
  225. status = '第'+that.model.serviceStage+'期服务中';
  226. }
  227. }
  228. that.model.status_text = status
  229. that.detailLength = res.result.hwOrderProcessDetailList.length
  230. that.model.title = '订单编号: ' + res.result.orderNumber
  231. that.model.totalPrice = res.result.hwRequirement.settlementMethod == 0 ? res.result.hwRequirement.price : this.accMul(res.result.hwRequirement.price, res.result.hwRequirement.stage)
  232. } else {
  233. }
  234. })
  235. },
  236. //确认订单
  237. handleOkOrder(record) {
  238. let that = this
  239. const modal = that.$confirm({
  240. title: '确认订单',
  241. closable: true,
  242. keyboard: false,
  243. maskClosable: true,
  244. content: '是否确认订单准确无误?',
  245. okText: '确认订单',
  246. cancelText: '取消',
  247. onOk: function() {
  248. confirmOrder({ id: record.id }).then((res) => {
  249. if (res.success) {
  250. that.$message.success(res.message)
  251. that.initAutoListConfig().then(() => {
  252. }).catch(msg => {
  253. console.log(msg)
  254. })
  255. } else {
  256. that.$error({
  257. title: '确认失败',
  258. content: res.message,
  259. okText: '确定'
  260. })
  261. }
  262. })
  263. },
  264. onCancel(e) {
  265. modal.destroy()
  266. }
  267. })
  268. },
  269. //取消订单
  270. handleCloseOrder(record) {
  271. let that = this
  272. const modal = that.$confirm({
  273. title: '关闭订单',
  274. closable: true,
  275. keyboard: false,
  276. maskClosable: true,
  277. content: '是否确定关闭订单?',
  278. okText: '确定关闭',
  279. cancelText: '取消',
  280. onOk: function() {
  281. closeOrder({ id: record.id }).then((res) => {
  282. if (res.success) {
  283. that.$message.success(res.message)
  284. that.initAutoListConfig().then(() => {
  285. }).catch(msg => {
  286. console.log(msg)
  287. })
  288. } else {
  289. that.$message.error(res.message)
  290. }
  291. })
  292. },
  293. onCancel(e) {
  294. modal.destroy()
  295. }
  296. })
  297. },
  298. //中止订单
  299. handleLimitOrder(record) {
  300. let that = this
  301. let content = (<p> 是否确定中止订单 ?<br />订单中止后无法给接单人付款,请确认款项已经结清</p>);
  302. const modal = that.$confirm({
  303. title: '中止订单',
  304. closable: true,
  305. keyboard: false,
  306. maskClosable: true,
  307. content: content,
  308. okText: '确定中止',
  309. cancelText: '取消',
  310. onOk: function() {
  311. limitOrder({ id: record.id }).then((res) => {
  312. if (res.success) {
  313. that.$message.success(res.message)
  314. that.initAutoListConfig().then(() => {
  315. }).catch(msg => {
  316. console.log(msg)
  317. })
  318. } else {
  319. that.$message.error(res.message)
  320. }
  321. })
  322. },
  323. onCancel(e) {
  324. modal.destroy()
  325. }
  326. })
  327. },
  328. handleTabChange(key, type) {
  329. this[type] = key
  330. },
  331. //选择类型
  332. handleSelectModal(model) {
  333. this.$refs.modalSelectForm.edit(model)
  334. this.$refs.modalSelectForm.title = '选择合同类型'
  335. this.$refs.modalSelectForm.disableSubmit = false
  336. },
  337. //修改承揽合同
  338. handleSelectEditModal(model) {
  339. this.$refs.modalSelectForm.edit(model)
  340. this.$refs.modalSelectForm.title = '修改合同'
  341. this.$refs.modalSelectForm.disableSubmit = false
  342. },
  343. //修改服务合同
  344. handleEditRequireModal(mod){
  345. this.$refs.modalSelectRequireForm.edit(mod)
  346. this.$refs.modalSelectRequireForm.title = '修改合同'
  347. this.$refs.modalSelectRequireForm.disableSubmit = false
  348. },
  349. //修改转包合同
  350. handleEditRequireSubModal(mod){
  351. this.$refs.modalSelectRequireSubForm.edit(mod)
  352. this.$refs.modalSelectRequireSubForm.title = '修改合同'
  353. this.$refs.modalSelectRequireSubForm.disableSubmit = false
  354. },
  355. //选择合同回调
  356. modalFormOk() {
  357. this.initAutoListConfig().then(() => {
  358. }).catch(msg => {
  359. console.log(msg)
  360. })
  361. },
  362. //下载合同
  363. handleWorkDownload(fileName) {
  364. if(!fileName){
  365. this.$message.warning("未知的文件")
  366. return;
  367. }
  368. if(fileName.indexOf(",")>0){
  369. fileName = fileName.substring(0,fileName.indexOf(","))
  370. }
  371. window.open(this.url.downloadUrl + '?fileName=' + fileName);
  372. },
  373. accMul(num1,num2){
  374. var m = 0, s1 = num1.toString(), s2 = num2.toString()
  375. try {
  376. m += s1.split('.')[1].length
  377. } catch (e) {
  378. }
  379. try {
  380. m += s2.split('.')[1].length
  381. } catch (e) {
  382. }
  383. return Number(s1.replace('.', '')) * Number(s2.replace('.', '')) / Math.pow(10, m)
  384. }
  385. }
  386. }
  387. </script>
  388. <style lang="scss" scoped>
  389. .title {
  390. color: rgba(0, 0, 0, .85);
  391. font-size: 16px;
  392. font-weight: 500;
  393. margin-bottom: 16px;
  394. }
  395. .detail-layout {
  396. margin-left: 44px;
  397. }
  398. .text {
  399. color: rgba(0, 0, 0, .45);
  400. }
  401. .heading {
  402. color: rgba(0, 0, 0, .85);
  403. font-size: 20px;
  404. }
  405. .step-item {
  406. min-height: 148px !important;
  407. }
  408. </style>