index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329
  1. <template>
  2. <div>
  3. <basicDetails
  4. ref="details"
  5. :titleText="`单号:${mainData.sonum}`"
  6. :editData="mainData"
  7. :mainAreaData="mainAreaData"
  8. turnPageId="20230114105002"
  9. idname="sa_orderid"
  10. ownertable="sa_order"
  11. delApiId="20230116100002"
  12. :statusCheck="[{key:'status',value:'审核'},{key:'status',value:'交期待确认'},{key:'status',value:'提交'},{key:'status',value:'交期确认'}]"
  13. :tabs="['借用单明细','发货单','物流单','收支明细','erp对接记录']"
  14. @pageChange="pageChange"
  15. @onEditSuccess="onEditSuccess">
  16. <div slot="customOperation" class="inline-16">
  17. <Edit v-if="tool.checkAuth($route.name,'update') && mainData.status == '新建'" class="inline-16" @onSuccess="queryMainData()" :data="mainData" />
  18. <el-button v-if="tool.checkAuth($route.name,'confirmDate')" :disabled="mainData.status !== '交期待确认'" class="inline-16" type="primary" size="mini" @click="confirmdate">确认交期</el-button>
  19. <confirmDate v-if="tool.checkAuth($route.name,'replyDate')" class="inline-16" :data="mainData" @onSuccess="queryMainData"></confirmDate>
  20. <el-popover
  21. placement="top"
  22. v-model="visible">
  23. <p class="mt-10 normal-title">选择评审类型</p>
  24. <el-select class="mt-10" v-model="value" placeholder="请选择" size="mini">
  25. <el-option
  26. v-for="item in options"
  27. :key="item.value"
  28. :label="item.value + '-' + item.remarks"
  29. :value="item.value">
  30. <span style="float: left">{{ item.value }}</span>
  31. <span style="float: right; color: #8492a6; font-size: 12px">{{ item.remarks?item.remarks:'暂无描述' }}</span>
  32. </el-option>
  33. </el-select>
  34. <div style="text-align: right; margin: 0">
  35. <el-button size="mini" type="text" @click="visible = false">取消</el-button>
  36. <el-button type="primary" size="mini" @click="onSubmit('审核')">确定</el-button>
  37. </div>
  38. <el-button class="inline-16" v-if="tool.checkAuth($route.name,'examine')" :disabled="mainData.status !== '提交' && mainData.status !== '交期确认'" type="primary" size="mini" slot="reference">审 核</el-button>
  39. </el-popover>
  40. <el-button v-if="tool.checkAuth($route.name,'examine')" :disabled="mainData.status !== '审核'" type="primary" size="mini" @click="onReturnCheck">反审核</el-button>
  41. <el-button v-if="tool.checkAuth($route.name,'reback')" type="primary" size="mini" @click="dialogVisible = true">退 回</el-button>
  42. <el-button v-if="tool.checkAuth($route.name,'submit')" :disabled="mainData.status !== '新建'" type="primary" size="mini" @click="onSubmit('提交')">提 交</el-button>
  43. <!-- <el-button v-if="tool.checkAuth($route.name,'close')" :disabled="mainData.status !== '审核'" type="primary" size="mini" @click="closeOrder">关 闭</el-button> -->
  44. <!-- <el-button v-if="tool.checkAuth($route.name,'insert')" type="primary" size="mini" @click="onCopy">复 制</el-button> -->
  45. </div>
  46. <div slot="slot0" >
  47. <toolList ref="tool" :data="mainData" @queryDetail="queryMainData"></toolList>
  48. </div>
  49. <div slot="slot1">
  50. <dispatch></dispatch>
  51. </div>
  52. <div slot="slot2">
  53. <logistics></logistics>
  54. </div>
  55. <div slot="slot3">
  56. <revenue :data="mainData"></revenue>
  57. </div>
  58. <div slot="slot4">
  59. <erpHistory :data="mainData"></erpHistory>
  60. </div>
  61. </basicDetails>
  62. <el-dialog append-to-body title="退回原因" :visible.sync="dialogVisible" width="400px">
  63. <el-input v-model="backreason" type="textarea" placeholder="请输入退回原因"></el-input>
  64. <span slot="footer" class="dialog-footer">
  65. <el-button @click="dialogVisible = false" size="small">取 消</el-button>
  66. <el-button type="primary" @click="onRebanck" size="small">确 定</el-button>
  67. </span>
  68. </el-dialog>
  69. </div>
  70. </template>
  71. <script>
  72. import toolList from './tabs/toolList.vue'
  73. import confirmDate from '../modules/confirmDate.vue'
  74. import dispatch from './tabs/dispatch.vue'
  75. import logistics from './tabs/logistics.vue'
  76. import revenue from './tabs/revenueAndExp.vue'
  77. import Edit from '../modules/edit'
  78. import erpHistory from './tabs/erpHistory.vue'
  79. export default {
  80. name: "detail",
  81. data() {
  82. return {
  83. mainData:{},
  84. mainAreaData:{},
  85. backreason:'',
  86. options:[],
  87. dialogVisible:false,
  88. visible:false,
  89. value:''
  90. }
  91. },
  92. provide () {
  93. return {
  94. thisDetail:() => this
  95. }
  96. },
  97. components:{
  98. toolList,
  99. confirmDate,
  100. dispatch,
  101. logistics,
  102. revenue,
  103. Edit,
  104. erpHistory
  105. },
  106. methods:{
  107. async orderreviewtype () {
  108. const res = await this.$store.dispatch('optiontypeselect','orderreviewtype')
  109. this.options = res.data
  110. this.value = res.data[0].value
  111. },
  112. onEditSuccess(){
  113. this.queryMainData()
  114. this.queryTool()
  115. },
  116. queryTool(){
  117. this.$refs.tool.listData()
  118. },
  119. async queryMainData(id) {
  120. const res = await this.$api.requested({
  121. "id":20230114140402,
  122. "content": {
  123. "sa_orderid": this.$route.query.id
  124. }
  125. })
  126. this.mainData = res.data
  127. this.changeDataStructure()
  128. this.orderreviewtype()
  129. },
  130. changeDataStructure() {
  131. let that = this
  132. this.mainAreaData = [
  133. {
  134. label:'单据日期',
  135. value:this.mainData.billdate
  136. },
  137. {
  138. label:'状态',
  139. value:this.mainData.status,
  140. style:function () {
  141. let style = {}
  142. switch (that.mainData.status) {
  143. case '新建':
  144. style = {color:"#000000"}
  145. break;
  146. case '提交':
  147. style = {color:"#d90a0a"}
  148. break;
  149. case '交期待确认':
  150. style = {color:"#e09a1a"}
  151. break;
  152. case '交期确认':
  153. style = {color:"#3874f6"}
  154. break;
  155. case '审核':
  156. style = {color:"#52C41A"}
  157. break;
  158. case '关闭':
  159. style = {color:"#b2c0ea"}
  160. break;
  161. default:
  162. break;
  163. }
  164. return style
  165. }
  166. },
  167. {
  168. label:'企业名称',
  169. value:this.mainData.enterprisename
  170. },
  171. {
  172. label:'合计数量',
  173. value:this.mainData.qty * this.mainData.toolcount
  174. },
  175. {
  176. label:'合计金额',
  177. value:this.tool.formatAmount(this.mainData.amount,2)
  178. },
  179. {
  180. label:'借用合同',
  181. value:this.mainData.contract_title?this.mainData.contract_title:'无合同'
  182. },
  183. {
  184. label:'审核日期',
  185. value:this.mainData.checkdate
  186. },
  187. {
  188. label:'收货人',
  189. value:this.mainData.name
  190. },
  191. {
  192. label:'收货地址',
  193. value:this.mainData.province + this.mainData.city + this.mainData.county + this.mainData.address
  194. },
  195. {
  196. label:'备注',
  197. value:this.mainData.remarks
  198. }
  199. ]
  200. },
  201. // 监听切换数据,上一页,下一页
  202. pageChange (id,rowindex,tabIndex) {
  203. this.flag = false
  204. tabIndex = this.$route.query.tabIndex
  205. this.$router.replace({path:'/toolBorrowingMagDetail',query:{id:id,rowindex:rowindex,tabIndex:tabIndex}})
  206. this.queryMainData(id)
  207. },
  208. onSuccess(){
  209. this.visible = false
  210. this.queryMainData(this.$route.query.id)
  211. this.$emit('onSuccess')
  212. },
  213. // 提交审核订单
  214. onSubmit (type) {
  215. this.$confirm(`是否${type}该订单`, '提示', {
  216. confirmButtonText: '确定',
  217. cancelButtonText: '取消',
  218. type: 'warning'
  219. }).then(async () => {
  220. const res = await this.$api.requested({
  221. "id": type === '审核'?20230114161402:20230114160002,
  222. "content": {
  223. "sa_orderid": this.mainData.sa_orderid,
  224. "sys_enterpriseid": this.mainData.sys_enterpriseid,
  225. "sa_accountclassid": this.mainData.accountclass.sa_accountclassid,
  226. "reviewtype":type === '审核'?this.value:''
  227. },
  228. })
  229. this.tool.showMessage(res,async ()=>{
  230. this.visible = false
  231. this.queryMainData()
  232. })
  233. }).catch((err) => {
  234. this.$message({
  235. type: 'info',
  236. message: '取消提交'
  237. });
  238. });
  239. },
  240. // 反审核订单
  241. onReturnCheck () {
  242. this.$confirm(`是否反审核该订单`, '提示', {
  243. confirmButtonText: '确定',
  244. cancelButtonText: '取消',
  245. type: 'warning'
  246. }).then(async () => {
  247. const res = await this.$api.requested({
  248. "id": 20230114161502,
  249. "content": {
  250. "sa_orderid": this.mainData.sa_orderid,
  251. },
  252. })
  253. this.tool.showMessage(res,()=>{
  254. this.$store.dispatch('changeDetailDrawer',false)
  255. })
  256. }).catch((err) => {
  257. this.$message({
  258. type: 'info',
  259. message: err
  260. });
  261. });
  262. },
  263. async onRebanck () {
  264. const res = await this.$api.requested({
  265. "id": 20230116085902,
  266. "content": {
  267. "sys_enterpriseid":this.mainData.sys_enterpriseid,
  268. "sa_accountclassid":this.mainData.accountclass.sa_accountclassid,
  269. "sa_orderid": this.mainData.sa_orderid,
  270. "backreason": this.backreason //退回原因,可选
  271. },
  272. })
  273. this.tool.showMessage(res,()=>{
  274. this.queryMainData()
  275. this.dialogVisible = false
  276. this.$store.dispatch('changeDetailDrawer',false)
  277. })
  278. },
  279. async closeOrder () {
  280. const res = await this.$api.requested({
  281. "id": 20221108164502,
  282. "content": {
  283. "sa_orderids":[this.$route.query.id]
  284. },
  285. })
  286. this.tool.showMessage(res,()=>{
  287. this.queryMainData()
  288. this.dialogVisible = false
  289. })
  290. },
  291. async confirmdate () {
  292. const res = await this.$api.requested({
  293. "id": 20230129154102,
  294. "content": {
  295. "sa_orderid": this.$route.query.id
  296. }
  297. })
  298. this.tool.showMessage(res,()=>{
  299. this.queryMainData()
  300. })
  301. },
  302. async onCopy () {
  303. const res = await this.$api.requested({
  304. "id": 20230102144502,
  305. "content": {
  306. "sa_orderid": this.$route.query.id
  307. }
  308. })
  309. this.tool.showMessage(res,()=>{
  310. this.tool.showMessage(res)
  311. })
  312. },
  313. },
  314. mounted () {
  315. this.queryMainData(this.$route.query.id)
  316. },
  317. created() {
  318. }
  319. }
  320. </script>
  321. <style scoped>
  322. </style>