index.vue 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515
  1. <template>
  2. <div>
  3. <basicDetails
  4. ref="details"
  5. :titleText="`${mainData.sonum}`"
  6. :editData="mainData"
  7. :mainAreaData="mainAreaData"
  8. turnPageId="20230105143002"
  9. idname="sa_orderid"
  10. ownertable="sa_order"
  11. delApiId="20221108152102"
  12. tags=""
  13. :statusCheck="[{key:'status',value:'审核'},{key:'status',value:'提交'},{key:'status',value:'关闭'}]"
  14. :tabs="['订单明细','基本信息','订单进度','居间费明细','发货单','物流单','发票记录','收支明细','核销记录','erp对接记录','变更记录']"
  15. @pageChange="pageChange"
  16. @onEditSuccess="queryMainData($route.query.id)">
  17. <div slot="customOperation" class="inline-16" v-if="Object.keys(mainData).length > 0">
  18. <Edit class="inline-16" v-if="tool.checkAuth($route.name,'update') && (mainData.status == '新建')" :data="mainData" @onSuccess="queryMainData();$refs.prod && $refs.prod.listData()" />
  19. <EditRemark :data="mainData" @onSuccess="queryMainData"></EditRemark>
  20. <changeSaler class="inline-16" ref="saler" @selectRow="salerChange">
  21. <el-button v-if="tool.checkAuth($route.name,'changeSaler')" type="primary" slot="input" size="mini" @click="$refs.saler.visible=true;$refs.saler.listData()">变更业务员</el-button>
  22. </changeSaler>
  23. <el-button v-if="tool.checkAuth($route.name,'confirmDate') && mainData.status === '交期待确认'" class="inline-16" type="primary" size="mini" @click="confirmdate">确认交期</el-button>
  24. <el-button v-if="tool.checkAuth($route.name,'backconfirmDate') && mainData.status === '交期待确认' || mainData.status === '交期确认'" class="inline-16" type="primary" size="mini" @click="backconfirmdate">交期退回</el-button>
  25. <confirmDate v-if="tool.checkAuth($route.name,'replyDate')" class="inline-16" :data="mainData" @onSuccess="queryMainData"></confirmDate>
  26. <el-popover
  27. placement="top"
  28. trigger="click">
  29. <p class="mt-10 normal-title">选择评审类型</p>
  30. <el-select class="mt-10" v-model="value" placeholder="请选择" size="mini">
  31. <el-option
  32. v-for="item in options"
  33. :key="item.value "
  34. :label="item.value + '-' + item.remarks"
  35. :value="item.value">
  36. <span style="float: left">{{ item.value }}</span>
  37. <span style="float: right; color: #8492a6; font-size: 12px">{{ item.remarks?item.remarks:'暂无描述' }}</span>
  38. </el-option>
  39. </el-select>
  40. <div style="text-align: right; margin: 0">
  41. <el-button type="primary" size="mini" @click="onSubmit('审核')">确定</el-button>
  42. </div>
  43. <el-button :disabled="mainData.status !== '提交' && mainData.status !== '交期确认'" class="inline-16" @click="visible=true" v-if="tool.checkAuth($route.name,'examine')" type="primary" size="mini" slot="reference">审 核</el-button>
  44. </el-popover>
  45. <el-button v-if="tool.checkAuth($route.name,'examine') && mainData.status === '审核'" type="primary" size="mini" @click="onReturnCheck">反审核</el-button>
  46. <el-button v-if="tool.checkAuth($route.name,'reback') && mainData.status === '提交'" type="primary" size="mini" @click="dialogVisible = true">退 回</el-button>
  47. <el-button v-if="tool.checkAuth($route.name,'submit') && mainData.status === '新建'" type="primary" size="mini" @click="onSubmit('提交')">提 交</el-button>
  48. <el-button v-if="tool.checkAuth($route.name,'finishOrder') && mainData.status === '审核'" type="primary" size="mini" @click="closeOrder">结 案</el-button>
  49. <el-button v-if="tool.checkAuth($route.name,'insert')" type="primary" size="mini" @click="onCopy">复 制</el-button>
  50. </div>
  51. <div slot="slot1">
  52. <default-info :mainData="mainData"></default-info>
  53. </div>
  54. <div slot="slot0">
  55. <product-list @select="select" @onSuccess="queryMainData()" :data="mainData" ref="prod">
  56. <div slot="operation">
  57. <importFile class="inline-16" :bindData="{ownertable:'sa_order',ownerid:$route.query.id,usetype:'default'}" :ordertype="mainData.type" :errorUrl="errorUrl" @clearUrl="errorUrl = null" @onSuccess="bindImportOrder"></importFile>
  58. <changeOrderMx v-if="mainData.status === '审核'" :tableData="selection" class="inline-16" :data="mainData" @onSuccess="$refs['prod'].listData();queryMainData"></changeOrderMx>
  59. <el-button :disabled="mainData.status !== '审核' || selection.length === 0" size="small" type="primary" style="margin-bottom:12px" @click="adddispatch">一键发货</el-button>
  60. </div>
  61. </product-list>
  62. </div>
  63. <div slot="slot2">
  64. <orderprogress></orderprogress>
  65. </div>
  66. <div slot="slot3">
  67. <rebat></rebat>
  68. </div>
  69. <div slot="slot4">
  70. <dispatch></dispatch>
  71. </div>
  72. <div slot="slot5">
  73. <logistics></logistics>
  74. </div>
  75. <div slot="slot6">
  76. <invoiceTable></invoiceTable>
  77. </div>
  78. <div slot="slot7">
  79. <revenue :data="mainData"></revenue>
  80. </div>
  81. <div slot="slot8">
  82. <writeOff :data="mainData"></writeOff>
  83. </div>
  84. <div slot="slot9">
  85. <erpHistory :data="mainData"></erpHistory>
  86. </div>
  87. <div slot="slot10">
  88. <changeHistory :data="mainData"></changeHistory>
  89. </div>
  90. </basicDetails>
  91. <el-dialog append-to-body title="退回原因" :visible.sync="dialogVisible" width="400px">
  92. <el-input v-model="backreason" type="textarea" placeholder="请输入退回原因"></el-input>
  93. <span slot="footer" class="dialog-footer">
  94. <el-button @click="dialogVisible = false" size="small">取 消</el-button>
  95. <el-button type="primary" @click="onRebanck" size="small">确 定</el-button>
  96. </span>
  97. </el-dialog>
  98. </div>
  99. </template>
  100. <script>
  101. import Edit from '../modules/edit'
  102. import defaultInfo from './tabs/defaultInfo.vue';
  103. import productList from './tabs/productlist.vue'
  104. import confirmDate from '../modules/confirmDate.vue'
  105. import rebat from './tabs/rebatesettlement.vue'
  106. import orderprogress from './tabs/orderpProgress.vue'
  107. import dispatch from './tabs/dispatch.vue'
  108. import logistics from './tabs/logistics.vue'
  109. import invoiceTable from './tabs/invoiceTable.vue'
  110. import changeSaler from '@/template/selectSaler/index'
  111. import revenue from './tabs/revenueAndExp.vue'
  112. import changeOrderMx from './tabs/changeOrderMx.vue'
  113. import writeOff from './tabs/writeoff.vue'
  114. import erpHistory from './tabs/erpHistory.vue'
  115. import changeHistory from './tabs/changeHistory.vue'
  116. import importFile from './importFile.vue'
  117. import EditRemark from '../modules/EditRemark.vue'
  118. export default {
  119. name: "detail",
  120. data() {
  121. return {
  122. mainData:{},
  123. mainAreaData:{},
  124. backreason:'',
  125. options:[],
  126. dialogVisible:false,
  127. visible:false,
  128. value:'',
  129. selection:[],
  130. errorUrl:null
  131. }
  132. },
  133. provide () {
  134. return {
  135. thisDetail:() => this
  136. }
  137. },
  138. components:{
  139. Edit,
  140. defaultInfo,
  141. productList,
  142. confirmDate,
  143. rebat,
  144. orderprogress,
  145. dispatch,
  146. logistics,
  147. invoiceTable,
  148. changeSaler,
  149. revenue,
  150. changeOrderMx,
  151. writeOff,
  152. erpHistory,
  153. changeHistory,
  154. importFile,
  155. EditRemark
  156. },
  157. methods:{
  158. async orderreviewtype () {
  159. const res = await this.$store.dispatch('optiontypeselect','orderreviewtype')
  160. this.options = res.data
  161. this.value = res.data[0].value
  162. },
  163. async queryMainData(id) {
  164. return new Promise(async (re,rj) => {
  165. const res = await this.$api.requested({
  166. "id":'20221108151302',
  167. "content": {
  168. "nocache":true,
  169. "sa_orderid": this.$route.query.id
  170. }
  171. })
  172. this.mainData = res.data
  173. this.changeDataStructure()
  174. this.orderreviewtype()
  175. re()
  176. })
  177. },
  178. changeDataStructure() {
  179. let that = this
  180. this.mainAreaData = [
  181. {
  182. label:'订单状态',
  183. value:this.mainData.status,
  184. style:function () {
  185. let style = {}
  186. switch (that.mainData.status) {
  187. case '新建':
  188. style = {color:"#000000"}
  189. break;
  190. case '提交':
  191. style = {color:"#d90a0a"}
  192. break;
  193. case '交期待确认':
  194. style = {color:"#e09a1a"}
  195. break;
  196. case '交期确认':
  197. style = {color:"#3874f6"}
  198. break;
  199. case '审核':
  200. style = {color:"#52C41A"}
  201. break;
  202. case '关闭':
  203. style = {color:"#b2c0ea"}
  204. break;
  205. default:
  206. break;
  207. }
  208. return style
  209. }
  210. },
  211. {
  212. label:'订单类型',
  213. value:this.mainData.type
  214. },
  215. {
  216. label:'明细分类',
  217. value:this.mainData.typemx
  218. },
  219. {
  220. label:'单据日期',
  221. value:this.mainData.billdate
  222. },
  223. {
  224. label:'企业名称',
  225. value:this.mainData.enterprisename
  226. },
  227. {
  228. label:'订单总金额',
  229. value:this.tool.formatAmount(this.mainData.defaultamount,2),
  230. style:function () {
  231. let style = {color:"#ff0000"}
  232. return style
  233. }
  234. },
  235. {
  236. label:'折后总金额',
  237. value:this.tool.formatAmount(this.mainData.amount,2),
  238. style:function () {
  239. let style = {color:"#ff0000"}
  240. return style
  241. }
  242. },
  243. {
  244. label:'合计数量',
  245. value:this.mainData.qty,
  246. style:function () {
  247. let style = {color:"#ff0000"}
  248. return style
  249. }
  250. },
  251. {
  252. label:'品牌',
  253. value:this.mainData.brandname
  254. },
  255. {
  256. label:'领域',
  257. value:this.mainData.tradefield
  258. },
  259. {
  260. label:'领域明细',
  261. value:this.mainData.tradefieldmx
  262. },
  263. {
  264. label:'评审类型',
  265. value:this.mainData.optiontyperemarks?this.mainData.reviewtype + '-' + this.mainData.optiontyperemarks : this.mainData.reviewtype
  266. },
  267. {
  268. label:'业务员',
  269. value:this.mainData.saler_name
  270. },
  271. {
  272. label:'项目信息',
  273. value:this.mainData.contract_title
  274. },
  275. {
  276. label:'销售分类',
  277. value:`${this.mainData.saletype}${this.mainData.saletyperemarks?'-':''}${this.mainData.saletyperemarks}`
  278. },
  279. {
  280. label:'运费状态',
  281. value:this.mainData.freightstatus
  282. },
  283. {
  284. label:'备注',
  285. value:this.mainData.remarks
  286. },
  287. /*{
  288. label:'返利金使用比例(%)',
  289. value:this.mainData.rebate_userate
  290. },*/
  291. {
  292. label:'退回原因',
  293. value:this.mainData.backreason
  294. },
  295. {
  296. label:'核销状态',
  297. value:this.mainData.writeoffstatus
  298. },
  299. {
  300. label:'开票状态',
  301. value:this.mainData.invoicestatus
  302. },
  303. {
  304. label:'erp单号',
  305. value:this.mainData.erpbillno
  306. },
  307. {
  308. label:'项目备注',
  309. value:this.mainData.projectnote
  310. }
  311. ]
  312. },
  313. // 监听切换数据,上一页,下一页
  314. pageChange (id,rowindex,tabIndex) {
  315. this.$router.replace({path:'/orderdetail',query:{id:id,rowindex:rowindex}})
  316. this.queryMainData(id)
  317. },
  318. /* 变更业务员 */
  319. salerChange (data) {
  320. console.log(data);
  321. this.$confirm(`确定把${data.name}设置为业务员吗`,'提示',{
  322. confirmButtonText:'确定',
  323. cancelButtonText:'取消'
  324. }).then(async () => {
  325. let res = await this.$api.requested({
  326. "id":20230213154802,
  327. "content": {
  328. saler_hrid:data.hrid,
  329. sa_orderid:this.$route.query.id
  330. }
  331. })
  332. console.log(res);
  333. this.tool.showMessage(res,() => {
  334. this.$refs.saler.visible = false
  335. this.queryMainData()
  336. })
  337. })
  338. },
  339. // 提交审核订单
  340. onSubmit (type) {
  341. this.$confirm(`是否${type}该订单`, '提示', {
  342. confirmButtonText: '确定',
  343. cancelButtonText: '取消',
  344. type: 'warning'
  345. }).then(async () => {
  346. const res = await this.$api.requested({
  347. "id": type === '审核'?20221108153502:20221108153402,
  348. "content": {
  349. "sa_orderid": this.mainData.sa_orderid,
  350. "sys_enterpriseid": this.mainData.sys_enterpriseid,
  351. "sa_accountclassid": this.mainData.accountclass.sa_accountclassid,
  352. "reviewtype":type === '审核'?this.value:''
  353. },
  354. })
  355. this.tool.showMessage(res,async ()=>{
  356. this.visible = false
  357. this.queryMainData()
  358. })
  359. }).catch((err) => {
  360. this.$message({
  361. type: 'info',
  362. message: '已取消'
  363. });
  364. });
  365. },
  366. // 反审核订单
  367. onReturnCheck () {
  368. this.$confirm(`是否反审核该订单`, '提示', {
  369. confirmButtonText: '确定',
  370. cancelButtonText: '取消',
  371. type: 'warning'
  372. }).then(async () => {
  373. const res = await this.$api.requested({
  374. "id": 20230102141502,
  375. "content": {
  376. "sa_orderid": this.mainData.sa_orderid,
  377. },
  378. })
  379. this.tool.showMessage(res,()=>{
  380. this.$store.dispatch('changeDetailDrawer',false)
  381. })
  382. }).catch((err) => {
  383. this.$message({
  384. type: 'info',
  385. message: '已取消'
  386. });
  387. });
  388. },
  389. async onRebanck () {
  390. const res = await this.$api.requested({
  391. "id": 20221108161902,
  392. "content": {
  393. "sys_enterpriseid":this.mainData.sys_enterpriseid,
  394. "sa_accountclassid":this.mainData.accountclass.sa_accountclassid,
  395. "sa_orderid": this.mainData.sa_orderid,
  396. "backreason": this.backreason //退回原因,可选
  397. },
  398. })
  399. this.tool.showMessage(res,()=>{
  400. this.queryMainData()
  401. this.dialogVisible = false
  402. this.$store.dispatch('changeDetailDrawer',false)
  403. })
  404. },
  405. async closeOrder () {
  406. const res = await this.$api.requested({
  407. "id": 20221108164502,
  408. "content": {
  409. "sa_orderids":[this.$route.query.id]
  410. },
  411. })
  412. this.tool.showMessage(res,()=>{
  413. this.queryMainData()
  414. this.dialogVisible = false
  415. })
  416. },
  417. async confirmdate () {
  418. const res = await this.$api.requested({
  419. "id": 20221230094802,
  420. "content": {
  421. "sa_orderid": this.$route.query.id
  422. }
  423. })
  424. this.tool.showMessage(res,()=>{
  425. this.queryMainData()
  426. })
  427. },
  428. async backconfirmdate () {
  429. const res = await this.$api.requested({
  430. "id": 20230227160002,
  431. "content": {
  432. "sa_orderid": this.$route.query.id
  433. }
  434. })
  435. this.tool.showMessage(res,()=>{
  436. this.queryMainData()
  437. })
  438. },
  439. async onCopy () {
  440. const res = await this.$api.requested({
  441. "id": 20230102144502,
  442. "content": {
  443. "sa_orderid": this.$route.query.id
  444. }
  445. })
  446. this.tool.showMessage(res,()=>{
  447. /*this.tool.showMessage(res)*/
  448. /* this.$store.dispatch('changeDetailDrawer',false)
  449. this.$store.dispatch('changeDetailDrawer',true)
  450. this.$router.push({path:'/orderdetail',query:{id:res.data.sa_orderid,rowindex:res.data.rowindex}})*/
  451. this.$store.dispatch('changeDetailDrawer',false)
  452. setTimeout(()=>{
  453. this.$router.replace({
  454. path:'/orderdetail',
  455. query:{
  456. id:res.data.sa_orderid
  457. }
  458. })
  459. this.$store.dispatch('changeDetailDrawer',true)
  460. },500)
  461. })
  462. },
  463. select (data) {
  464. this.selection = data
  465. },
  466. async adddispatch () {
  467. const res = await this.$api.requested({
  468. "id": "20230220100604",
  469. "content": {
  470. "sa_orderid":this.mainData.sa_orderid,
  471. "sa_orderitemsids": this.selection.map(e=>{
  472. return e.sa_orderitemsid
  473. })
  474. }
  475. })
  476. this.tool.showMessage(res,()=>{
  477. let route = this.$route
  478. this.oldRoute = {path:route.path,query:route.query}
  479. this.$store.dispatch('setHistoryRouter',this.oldRoute)
  480. this.$router.replace({path:'/dispatchdetail',query:{id:res.data.sa_dispatchid,rowindex:res.data.rowindex}})
  481. })
  482. },
  483. async bindImportOrder (id) {
  484. const res = await this.$api.requested({
  485. "id": this.mainData.type =='特殊订单'?20230308155803:20230227194803,
  486. "content": {
  487. "sa_orderid":this.$route.query.id,
  488. "attachmentid":id
  489. }
  490. })
  491. this.$refs['prod'].listData()
  492. if (res.data !== '成功') {
  493. this.errorUrl = res.data
  494. }
  495. this.queryMainData()
  496. }
  497. },
  498. mounted () {
  499. this.queryMainData(this.$route.query.id)
  500. },
  501. created() {
  502. }
  503. }
  504. </script>
  505. <style scoped>
  506. </style>