index.vue 10 KB

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