index.vue 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420
  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="['基本信息','订单明细','订单进度','居间费明细','发货单','物流单','发票记录','收支明细']"
  15. @pageChange="pageChange"
  16. @onEditSuccess="queryMainData($route.query.id)">
  17. <div slot="customOperation" class="inline-16">
  18. <Edit class="inline-16" v-if="tool.checkAuth($route.name,'update') && mainData.status == '新建'" :data="mainData" @onSuccess="queryMainData();$refs.prod && $refs.prod.listData()" />
  19. <changeSaler class="inline-16" ref="saler" @selectRow="salerChange">
  20. <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>
  21. </changeSaler>
  22. <el-button v-if="tool.checkAuth($route.name,'confirmDate') && mainData.status === '交期待确认'" class="inline-16" type="primary" size="mini" @click="confirmdate">确认交期</el-button>
  23. <confirmDate v-if="tool.checkAuth($route.name,'replyDate')" class="inline-16" :data="mainData" @onSuccess="queryMainData"></confirmDate>
  24. <el-popover
  25. placement="top"
  26. v-model="visible"
  27. trigger="click">
  28. <p class="mt-10 normal-title">选择评审类型</p>
  29. <el-select class="mt-10" v-model="value" placeholder="请选择" size="mini">
  30. <el-option
  31. v-for="item in options"
  32. :key="item.value"
  33. :label="item.value"
  34. :value="item.value">
  35. </el-option>
  36. </el-select>
  37. <div style="text-align: right; margin: 0">
  38. <el-button size="mini" type="text" @click="visible = false">取消</el-button>
  39. <el-button type="primary" size="mini" @click="onSubmit('审核')">确定</el-button>
  40. </div>
  41. <el-button class="inline-16" @click="visible=true" v-if="tool.checkAuth($route.name,'examine') && mainData.status === '提交'" type="primary" size="mini" slot="reference">审 核</el-button>
  42. </el-popover>
  43. <el-button v-if="tool.checkAuth($route.name,'examine') && mainData.status === '审核'" type="primary" size="mini" @click="onReturnCheck">反审核</el-button>
  44. <el-button v-if="tool.checkAuth($route.name,'reback') && mainData.status === '提交'" type="primary" size="mini" @click="dialogVisible = true">退 回</el-button>
  45. <el-button v-if="tool.checkAuth($route.name,'submit') && mainData.status === '新建'" type="primary" size="mini" @click="onSubmit('提交')">提 交</el-button>
  46. <el-button v-if="tool.checkAuth($route.name,'close') && mainData.status === '审核'" type="primary" size="mini" @click="closeOrder">关 闭</el-button>
  47. <el-button v-if="tool.checkAuth($route.name,'insert')" type="primary" size="mini" @click="onCopy">复 制</el-button>
  48. </div>
  49. <div slot="slot0">
  50. <default-info :mainData="mainData"></default-info>
  51. </div>
  52. <div slot="slot1">
  53. <product-list @select="select" :data="mainData" ref="prod">
  54. <div slot="operation">
  55. <changeOrderMx v-if="mainData.status === '审核'" class="inline-16" :data="selection" @onSuccess="$refs['prod'].listData()"></changeOrderMx>
  56. <el-button :disabled="mainData.status !== '审核' || selection.length === 0" size="small" type="primary" style="margin-bottom:12px" @click="adddispatch">一键发货</el-button>
  57. </div>
  58. </product-list>
  59. </div>
  60. <div slot="slot2">
  61. <orderprogress></orderprogress>
  62. </div>
  63. <div slot="slot3">
  64. <rebat></rebat>
  65. </div>
  66. <div slot="slot4">
  67. <dispatch></dispatch>
  68. </div>
  69. <div slot="slot5">
  70. <logistics></logistics>
  71. </div>
  72. <div slot="slot6">
  73. <invoiceTable></invoiceTable>
  74. </div>
  75. <div slot="slot7">
  76. <revenue :data="mainData"></revenue>
  77. </div>
  78. </basicDetails>
  79. <el-dialog append-to-body title="退回原因" :visible.sync="dialogVisible" width="400px">
  80. <el-input v-model="backreason" type="textarea" placeholder="请输入退回原因"></el-input>
  81. <span slot="footer" class="dialog-footer">
  82. <el-button @click="dialogVisible = false" size="small">取 消</el-button>
  83. <el-button type="primary" @click="onRebanck" size="small">确 定</el-button>
  84. </span>
  85. </el-dialog>
  86. </div>
  87. </template>
  88. <script>
  89. import Edit from '../modules/edit'
  90. import defaultInfo from './tabs/defaultInfo.vue';
  91. import productList from './tabs/productlist.vue'
  92. import confirmDate from '../modules/confirmDate.vue'
  93. import rebat from './tabs/rebatesettlement.vue'
  94. import orderprogress from './tabs/orderpProgress.vue'
  95. import dispatch from './tabs/dispatch.vue'
  96. import logistics from './tabs/logistics.vue'
  97. import invoiceTable from './tabs/invoiceTable.vue'
  98. import changeSaler from '@/template/selectSaler/index'
  99. import revenue from './tabs/revenueAndExp.vue'
  100. import changeOrderMx from './tabs/changeOrderMx.vue'
  101. export default {
  102. name: "detail",
  103. data() {
  104. return {
  105. mainData:{},
  106. mainAreaData:{},
  107. backreason:'',
  108. options:[],
  109. dialogVisible:false,
  110. visible:false,
  111. value:'',
  112. selection:[]
  113. }
  114. },
  115. provide () {
  116. return {
  117. thisDetail:() => this
  118. }
  119. },
  120. components:{
  121. Edit,
  122. defaultInfo,
  123. productList,
  124. confirmDate,
  125. rebat,
  126. orderprogress,
  127. dispatch,
  128. logistics,
  129. invoiceTable,
  130. changeSaler,
  131. revenue,
  132. changeOrderMx
  133. },
  134. methods:{
  135. async orderreviewtype () {
  136. const res = await this.$store.dispatch('optiontypeselect','orderreviewtype')
  137. this.options = res.data
  138. this.value = res.data[0].value
  139. },
  140. async queryMainData(id) {
  141. return new Promise(async (re,rj) => {
  142. const res = await this.$api.requested({
  143. "id":'20221108151302',
  144. "content": {
  145. "nocache":true,
  146. "sa_orderid": this.$route.query.id
  147. }
  148. })
  149. this.mainData = res.data
  150. console.log(this.mainData,'楚大');
  151. this.changeDataStructure()
  152. this.orderreviewtype()
  153. re()
  154. })
  155. },
  156. changeDataStructure() {
  157. this.mainAreaData = [
  158. {
  159. label:'订单状态',
  160. value:this.mainData.status
  161. },
  162. {
  163. label:'订单类型',
  164. value:this.mainData.type
  165. },
  166. {
  167. label:'明细分类',
  168. value:this.mainData.typemx
  169. },
  170. {
  171. label:'单据日期',
  172. value:this.mainData.billdate
  173. },
  174. {
  175. label:'企业名称',
  176. value:this.mainData.enterprisename
  177. },
  178. {
  179. label:'订单总金额',
  180. value:this.mainData.defaultamount,
  181. style:function () {
  182. let style = {color:"#ff0000"}
  183. return style
  184. }
  185. },
  186. {
  187. label:'折后总金额',
  188. value:this.mainData.amount,
  189. style:function () {
  190. let style = {color:"#ff0000"}
  191. return style
  192. }
  193. },
  194. {
  195. label:'合计数量',
  196. value:this.mainData.qty,
  197. style:function () {
  198. let style = {color:"#ff0000"}
  199. return style
  200. }
  201. },
  202. {
  203. label:'品牌',
  204. value:this.mainData.brandname
  205. },
  206. {
  207. label:'领域',
  208. value:this.mainData.tradefield
  209. },
  210. {
  211. label:'领域明细',
  212. value:this.mainData.tradefieldmx
  213. },
  214. {
  215. label:'评审类型',
  216. value:this.mainData.reviewtype
  217. },
  218. {
  219. label:'业务员',
  220. value:this.mainData.saler_name
  221. },
  222. {
  223. label:'项目信息',
  224. value:this.mainData.contract_title
  225. },
  226. {
  227. label:'备注',
  228. value:this.mainData.remarks
  229. },
  230. /*{
  231. label:'返利金使用比例(%)',
  232. value:this.mainData.rebate_userate
  233. },*/
  234. {
  235. label:'退回原因',
  236. value:this.mainData.backreason
  237. }
  238. ]
  239. },
  240. // 监听切换数据,上一页,下一页
  241. pageChange (id,rowindex,tabIndex) {
  242. this.$router.replace({path:'/orderdetail',query:{id:id,rowindex:rowindex}})
  243. this.queryMainData(id)
  244. },
  245. /* 变更业务员 */
  246. salerChange (data) {
  247. console.log(data);
  248. this.$confirm(`确定把${data.name}设置为业务员吗`,'提示',{
  249. confirmButtonText:'确定',
  250. cancelButtonText:'取消'
  251. }).then(async () => {
  252. let res = await this.$api.requested({
  253. "id":20230213154802,
  254. "content": {
  255. saler_hrid:data.hrid,
  256. sa_orderid:this.$route.query.id
  257. }
  258. })
  259. console.log(res);
  260. this.tool.showMessage(res,() => {
  261. this.$refs.saler.visible = false
  262. this.queryMainData()
  263. })
  264. })
  265. },
  266. // 提交审核订单
  267. onSubmit (type) {
  268. this.$confirm(`是否${type}该订单`, '提示', {
  269. confirmButtonText: '确定',
  270. cancelButtonText: '取消',
  271. type: 'warning'
  272. }).then(async () => {
  273. const res = await this.$api.requested({
  274. "id": type === '审核'?20221108153502:20221108153402,
  275. "content": {
  276. "sa_orderid": this.mainData.sa_orderid,
  277. "sys_enterpriseid": this.mainData.sys_enterpriseid,
  278. "sa_accountclassid": this.mainData.accountclass.sa_accountclassid,
  279. "reviewtype":type === '审核'?this.value:''
  280. },
  281. })
  282. this.tool.showMessage(res,async ()=>{
  283. this.visible = false
  284. this.queryMainData()
  285. })
  286. }).catch((err) => {
  287. this.$message({
  288. type: 'info',
  289. message: err
  290. });
  291. });
  292. },
  293. // 反审核订单
  294. onReturnCheck () {
  295. this.$confirm(`是否反审核该订单`, '提示', {
  296. confirmButtonText: '确定',
  297. cancelButtonText: '取消',
  298. type: 'warning'
  299. }).then(async () => {
  300. const res = await this.$api.requested({
  301. "id": 20230102141502,
  302. "content": {
  303. "sa_orderid": this.mainData.sa_orderid,
  304. },
  305. })
  306. this.tool.showMessage(res,()=>{
  307. this.$store.dispatch('changeDetailDrawer',false)
  308. })
  309. }).catch((err) => {
  310. this.$message({
  311. type: 'info',
  312. message: err
  313. });
  314. });
  315. },
  316. async onRebanck () {
  317. const res = await this.$api.requested({
  318. "id": 20221108161902,
  319. "content": {
  320. "sys_enterpriseid":this.mainData.sys_enterpriseid,
  321. "sa_accountclassid":this.mainData.accountclass.sa_accountclassid,
  322. "sa_orderid": this.mainData.sa_orderid,
  323. "backreason": this.backreason //退回原因,可选
  324. },
  325. })
  326. this.tool.showMessage(res,()=>{
  327. this.queryMainData()
  328. this.dialogVisible = false
  329. this.$store.dispatch('changeDetailDrawer',false)
  330. })
  331. },
  332. async closeOrder () {
  333. const res = await this.$api.requested({
  334. "id": 20221108164502,
  335. "content": {
  336. "sa_orderids":[this.$route.query.id]
  337. },
  338. })
  339. this.tool.showMessage(res,()=>{
  340. this.queryMainData()
  341. this.dialogVisible = false
  342. })
  343. },
  344. async confirmdate () {
  345. const res = await this.$api.requested({
  346. "id": 20221230094802,
  347. "content": {
  348. "sa_orderid": this.$route.query.id
  349. }
  350. })
  351. this.tool.showMessage(res,()=>{
  352. this.queryMainData()
  353. })
  354. },
  355. async onCopy () {
  356. const res = await this.$api.requested({
  357. "id": 20230102144502,
  358. "content": {
  359. "sa_orderid": this.$route.query.id
  360. }
  361. })
  362. this.tool.showMessage(res,()=>{
  363. /*this.tool.showMessage(res)*/
  364. /* this.$store.dispatch('changeDetailDrawer',false)
  365. this.$store.dispatch('changeDetailDrawer',true)
  366. this.$router.push({path:'/orderdetail',query:{id:res.data.sa_orderid,rowindex:res.data.rowindex}})*/
  367. this.$store.dispatch('changeDetailDrawer',false)
  368. setTimeout(()=>{
  369. this.$router.replace({
  370. path:'/orderdetail',
  371. query:{
  372. id:res.data.sa_orderid
  373. }
  374. })
  375. this.$store.dispatch('changeDetailDrawer',true)
  376. },500)
  377. })
  378. },
  379. select (data) {
  380. this.selection = data
  381. },
  382. async adddispatch () {
  383. const res = await this.$api.requested({
  384. "id": "20230220100604",
  385. "content": {
  386. "sa_orderid":this.mainData.sa_orderid,
  387. "sa_orderitemsids": this.selection.map(e=>{
  388. return e.sa_orderitemsid
  389. })
  390. }
  391. })
  392. this.tool.showMessage(res,()=>{
  393. let route = this.$route
  394. this.oldRoute = {path:route.path,query:route.query}
  395. this.$store.dispatch('setHistoryRouter',this.oldRoute)
  396. this.$router.replace({path:'/dispatchdetail',query:{id:res.data.sa_dispatchid,rowindex:res.data.rowindex}})
  397. })
  398. }
  399. },
  400. mounted () {
  401. this.queryMainData(this.$route.query.id)
  402. },
  403. created() {
  404. }
  405. }
  406. </script>
  407. <style scoped>
  408. </style>