index.vue 15 KB

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