index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323
  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="['借用单明细','发货单','物流单','收支明细']"
  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. </basicDetails>
  59. <el-dialog append-to-body title="退回原因" :visible.sync="dialogVisible" width="400px">
  60. <el-input v-model="backreason" type="textarea" placeholder="请输入退回原因"></el-input>
  61. <span slot="footer" class="dialog-footer">
  62. <el-button @click="dialogVisible = false" size="small">取 消</el-button>
  63. <el-button type="primary" @click="onRebanck" size="small">确 定</el-button>
  64. </span>
  65. </el-dialog>
  66. </div>
  67. </template>
  68. <script>
  69. import toolList from './tabs/toolList.vue'
  70. import confirmDate from '../modules/confirmDate.vue'
  71. import dispatch from './tabs/dispatch.vue'
  72. import logistics from './tabs/logistics.vue'
  73. import revenue from './tabs/revenueAndExp.vue'
  74. import Edit from '../modules/edit'
  75. export default {
  76. name: "detail",
  77. data() {
  78. return {
  79. mainData:{},
  80. mainAreaData:{},
  81. backreason:'',
  82. options:[],
  83. dialogVisible:false,
  84. visible:false,
  85. value:''
  86. }
  87. },
  88. provide () {
  89. return {
  90. thisDetail:() => this
  91. }
  92. },
  93. components:{
  94. toolList,
  95. confirmDate,
  96. dispatch,
  97. logistics,
  98. revenue,
  99. Edit
  100. },
  101. methods:{
  102. async orderreviewtype () {
  103. const res = await this.$store.dispatch('optiontypeselect','orderreviewtype')
  104. this.options = res.data
  105. this.value = res.data[0].value
  106. },
  107. onEditSuccess(){
  108. this.queryMainData()
  109. this.queryTool()
  110. },
  111. queryTool(){
  112. this.$refs.tool.listData()
  113. },
  114. async queryMainData(id) {
  115. const res = await this.$api.requested({
  116. "id":20230114140402,
  117. "content": {
  118. "sa_orderid": this.$route.query.id
  119. }
  120. })
  121. this.mainData = res.data
  122. this.changeDataStructure()
  123. this.orderreviewtype()
  124. },
  125. changeDataStructure() {
  126. let that = this
  127. this.mainAreaData = [
  128. {
  129. label:'单据日期',
  130. value:this.mainData.billdate
  131. },
  132. {
  133. label:'状态',
  134. value:this.mainData.status,
  135. style:function () {
  136. let style = {}
  137. switch (that.mainData.status) {
  138. case '新建':
  139. style = {color:"#000000"}
  140. break;
  141. case '提交':
  142. style = {color:"#d90a0a"}
  143. break;
  144. case '交期待确认':
  145. style = {color:"#e09a1a"}
  146. break;
  147. case '交期确认':
  148. style = {color:"#3874f6"}
  149. break;
  150. case '审核':
  151. style = {color:"#52C41A"}
  152. break;
  153. case '关闭':
  154. style = {color:"#b2c0ea"}
  155. break;
  156. default:
  157. break;
  158. }
  159. return style
  160. }
  161. },
  162. {
  163. label:'企业名称',
  164. value:this.mainData.enterprisename
  165. },
  166. {
  167. label:'合计数量',
  168. value:this.mainData.qty * this.mainData.toolcount
  169. },
  170. {
  171. label:'合计金额',
  172. value:this.tool.formatAmount(this.mainData.amount,2)
  173. },
  174. {
  175. label:'借用合同',
  176. value:this.mainData.contract_title?this.mainData.contract_title:'无合同'
  177. },
  178. {
  179. label:'审核日期',
  180. value:this.mainData.checkdate
  181. },
  182. {
  183. label:'收货人',
  184. value:this.mainData.name
  185. },
  186. {
  187. label:'收货地址',
  188. value:this.mainData.province + this.mainData.city + this.mainData.county + this.mainData.address
  189. },
  190. {
  191. label:'备注',
  192. value:this.mainData.remarks
  193. }
  194. ]
  195. },
  196. // 监听切换数据,上一页,下一页
  197. pageChange (id,rowindex,tabIndex) {
  198. this.flag = false
  199. tabIndex = this.$route.query.tabIndex
  200. this.$router.replace({path:'/toolBorrowingMagDetail',query:{id:id,rowindex:rowindex,tabIndex:tabIndex}})
  201. this.queryMainData(id)
  202. },
  203. onSuccess(){
  204. this.visible = false
  205. this.queryMainData(this.$route.query.id)
  206. this.$emit('onSuccess')
  207. },
  208. // 提交审核订单
  209. onSubmit (type) {
  210. this.$confirm(`是否${type}该订单`, '提示', {
  211. confirmButtonText: '确定',
  212. cancelButtonText: '取消',
  213. type: 'warning'
  214. }).then(async () => {
  215. const res = await this.$api.requested({
  216. "id": type === '审核'?20230114161402:20230114160002,
  217. "content": {
  218. "sa_orderid": this.mainData.sa_orderid,
  219. "sys_enterpriseid": this.mainData.sys_enterpriseid,
  220. "sa_accountclassid": this.mainData.accountclass.sa_accountclassid,
  221. "reviewtype":type === '审核'?this.value:''
  222. },
  223. })
  224. this.tool.showMessage(res,async ()=>{
  225. this.visible = false
  226. this.queryMainData()
  227. })
  228. }).catch((err) => {
  229. this.$message({
  230. type: 'info',
  231. message: '取消提交'
  232. });
  233. });
  234. },
  235. // 反审核订单
  236. onReturnCheck () {
  237. this.$confirm(`是否反审核该订单`, '提示', {
  238. confirmButtonText: '确定',
  239. cancelButtonText: '取消',
  240. type: 'warning'
  241. }).then(async () => {
  242. const res = await this.$api.requested({
  243. "id": 20230114161502,
  244. "content": {
  245. "sa_orderid": this.mainData.sa_orderid,
  246. },
  247. })
  248. this.tool.showMessage(res,()=>{
  249. this.$store.dispatch('changeDetailDrawer',false)
  250. })
  251. }).catch((err) => {
  252. this.$message({
  253. type: 'info',
  254. message: err
  255. });
  256. });
  257. },
  258. async onRebanck () {
  259. const res = await this.$api.requested({
  260. "id": 20230116085902,
  261. "content": {
  262. "sys_enterpriseid":this.mainData.sys_enterpriseid,
  263. "sa_accountclassid":this.mainData.accountclass.sa_accountclassid,
  264. "sa_orderid": this.mainData.sa_orderid,
  265. "backreason": this.backreason //退回原因,可选
  266. },
  267. })
  268. this.tool.showMessage(res,()=>{
  269. this.queryMainData()
  270. this.dialogVisible = false
  271. this.$store.dispatch('changeDetailDrawer',false)
  272. })
  273. },
  274. async closeOrder () {
  275. const res = await this.$api.requested({
  276. "id": 20221108164502,
  277. "content": {
  278. "sa_orderids":[this.$route.query.id]
  279. },
  280. })
  281. this.tool.showMessage(res,()=>{
  282. this.queryMainData()
  283. this.dialogVisible = false
  284. })
  285. },
  286. async confirmdate () {
  287. const res = await this.$api.requested({
  288. "id": 20230129154102,
  289. "content": {
  290. "sa_orderid": this.$route.query.id
  291. }
  292. })
  293. this.tool.showMessage(res,()=>{
  294. this.queryMainData()
  295. })
  296. },
  297. async onCopy () {
  298. const res = await this.$api.requested({
  299. "id": 20230102144502,
  300. "content": {
  301. "sa_orderid": this.$route.query.id
  302. }
  303. })
  304. this.tool.showMessage(res,()=>{
  305. this.tool.showMessage(res)
  306. })
  307. },
  308. },
  309. mounted () {
  310. this.queryMainData(this.$route.query.id)
  311. },
  312. created() {
  313. }
  314. }
  315. </script>
  316. <style scoped>
  317. </style>