index.vue 17 KB

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