index.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213
  1. <template>
  2. <div>
  3. <basicDetails
  4. ref="details"
  5. :titleText="`${mainData.billno}`"
  6. :editData="mainData"
  7. :mainAreaData="mainAreaData"
  8. delApiId="20221114135503"
  9. turnPageId="20221114135403"
  10. idname="sa_dispatchid"
  11. ownertable="sa_dispatch"
  12. tags=""
  13. :tabs="['基础信息','发货明细']"
  14. @pageChange="pageChange"
  15. @onEditSuccess="queryMainData($route.query.id)">
  16. <div slot="tags">
  17. </div>
  18. <div slot="customOperation">
  19. <Edit class="inline-16" v-if="tool.checkAuth($route.name,'update') && mainData.STATUS == '新建'" :data="mainData" @onSuccess="onSuccess" />
  20. <el-button type="primary" size="mini" v-if="tool.checkAuth($route.name,'check')" :disabled="mainData.STATUS !== '复核'" @click="addLogistics">生成物流单</el-button>
  21. <el-button type="primary" size="mini" v-if="tool.checkAuth($route.name,'check')" :disabled="mainData.STATUS !== '新建' && mainData.STATUS !== '审核'" @click="onCheck">{{mainData.STATUS === '审核'?'反审':mainData.STATUS === '复核'?'反审':'审核'}}</el-button>
  22. <el-button class="inline-16" type="primary" size="mini" v-if="tool.checkAuth($route.name,'recheck')" :disabled="mainData.STATUS !== '审核' && mainData.STATUS !== '复核'" @click="onReCheck">{{mainData.STATUS === '复核'?'反复核':'复核'}}</el-button>
  23. </div>
  24. <div slot="slot0" >
  25. <default-info :mainData="mainData"></default-info>
  26. </div>
  27. <div slot="slot1" >
  28. <product-list ref="product" :mainData="mainData"></product-list>
  29. </div>
  30. </basicDetails>
  31. </div>
  32. </template>
  33. <script>
  34. import Edit from '../modules/edit'
  35. import productList from '../modules/productlist.vue'
  36. import defaultInfo from '../modules/defaultInfo.vue'
  37. import { log } from '@antv/g2plot/lib/utils'
  38. export default {
  39. name: "detail",
  40. data() {
  41. return {
  42. mainData:{},
  43. mainAreaData:{}
  44. }
  45. },
  46. components:{
  47. Edit,
  48. productList,
  49. defaultInfo
  50. },
  51. methods:{
  52. async queryMainData(id) {
  53. const res = await this.$api.requested({
  54. "id": "20221114135303",
  55. "version":1,
  56. "content": {
  57. "sa_dispatchid":this.$route.query.id
  58. }
  59. })
  60. this.mainData = res.data
  61. console.log(this.mainData)
  62. this.changeDataStructure()
  63. },
  64. changeDataStructure() {
  65. let that = this
  66. this.mainAreaData = [
  67. {
  68. label:'发货单号',
  69. value:this.mainData.billno
  70. },
  71. {
  72. label:'订单号',
  73. value:this.mainData.sonum
  74. },
  75. {
  76. label:'发货日期',
  77. value:this.mainData.billdate
  78. },
  79. {
  80. label:'经销商编号',
  81. value:this.mainData.agentnum
  82. },
  83. {
  84. label:'经销商名称',
  85. value:this.mainData.enterprisename
  86. },
  87. {
  88. label:'状态',
  89. value:this.mainData.STATUS,
  90. style:function () {
  91. let style = {}
  92. switch (that.mainData.STATUS) {
  93. case '新建':
  94. style = {color:"#000000"}
  95. break;
  96. case '提交':
  97. style = {color:"#d90a0a"}
  98. break;
  99. case '审核':
  100. style = {color:"#52C41A"}
  101. break;
  102. case '复核':
  103. style = {color:"#3874f6"}
  104. break;
  105. case '关闭':
  106. style = {color:"#b2c0ea"}
  107. break;
  108. default:
  109. break;
  110. }
  111. return style
  112. }
  113. },
  114. {
  115. label:'运费状态',
  116. value:this.mainData.freightstatus
  117. },
  118. {
  119. label:'备注',
  120. value:this.mainData.remarks
  121. },
  122. ]
  123. },
  124. // 监听切换数据,上一页,下一页
  125. pageChange (id,rowindex,tabIndex) {
  126. this.flag = false
  127. tabIndex = this.$route.query.tabIndex
  128. this.$router.replace({path:'/dispatchdetail',query:{id:id,rowindex:rowindex,tabIndex:tabIndex}})
  129. this.queryMainData(id)
  130. },
  131. onSuccess(){
  132. this.visible = false
  133. this.queryMainData(this.$route.query.id)
  134. this.$refs.product && this.$refs.product.listData()
  135. console.log('触发');
  136. this.$emit('onSuccess')
  137. },
  138. onCheck () {
  139. this.$confirm(`确定${this.mainData.STATUS === '审核'?'反审核':'审核'}该发货单`, '提示', {
  140. confirmButtonText: '确定',
  141. cancelButtonText: '取消',
  142. type: 'warning'
  143. }).then(async () => {
  144. const res = await this.$api.requested({
  145. "id": this.mainData.STATUS === '审核'?20221114135703:20221114135603,
  146. "version":1,
  147. "content": {
  148. "sa_dispatchid":this.$route.query.id
  149. }
  150. })
  151. this.tool.showMessage(res,()=>{
  152. this.queryMainData()
  153. })
  154. }).catch(() => {
  155. this.$message({
  156. type: 'info',
  157. message: '已取消'
  158. });
  159. });
  160. },
  161. onReCheck() {
  162. this.$confirm(`确定${this.mainData.STATUS === '复核'?'反复核':'复核'}该发货单`, '提示', {
  163. confirmButtonText: '确定',
  164. cancelButtonText: '取消',
  165. type: 'warning'
  166. }).then(async () => {
  167. const res = await this.$api.requested({
  168. "id":20221114135803,
  169. "version":1,
  170. "content": {
  171. "sa_dispatchid":this.$route.query.id,
  172. "isrecheck":this.mainData.STATUS === '复核'?false:true
  173. }
  174. })
  175. this.tool.showMessage(res,()=>{
  176. this.queryMainData()
  177. })
  178. }).catch(() => {
  179. this.$message({
  180. type: 'info',
  181. message: '已取消'
  182. });
  183. });
  184. },
  185. async addLogistics () {
  186. const res = await this.$api.requested({
  187. "id": "20230216185104",
  188. "content": {
  189. "sa_dispatchid":this.mainData.sa_dispatchid
  190. }
  191. })
  192. this.tool.showMessage(res,()=>{
  193. let route = this.$route
  194. this.oldRoute = {path:route.path,query:route.query}
  195. this.$store.dispatch('setHistoryRouter',this.oldRoute)
  196. this.$router.replace({path:'/logisticsdetail',query:{id:res.data[0].sa_logisticsid,rowindex:res.data[0].rowindex}})
  197. })
  198. }
  199. },
  200. mounted () {
  201. this.queryMainData(this.$route.query.id)
  202. },
  203. created() {
  204. }
  205. }
  206. </script>
  207. <style scoped>
  208. </style>