index.vue 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237
  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. :statusCheck="[{key:'STATUS',value:'手工关闭'},{key:'STATUS',value:'审核'},{key:'STATUS',value:'复核'},{key:'STATUS',value:'关闭'}]"
  13. :tabs="['发货明细','erp上传信息','基础信息']"
  14. @pageChange="pageChange"
  15. @onEditSuccess="queryMainData($route.query.id)">
  16. <div slot="tags">
  17. </div>
  18. <div slot="customOperation">
  19. <add class="inline-16"/>
  20. <Edit class="inline-16" v-if="tool.checkAuth($route.name,'update') && mainData.STATUS == '新建'" :data="mainData" @onSuccess="onSuccess" />
  21. <el-button type="primary" size="mini" v-if="tool.checkAuth($route.name,'cancelBill')" :disabled="mainData.STATUS !== '复核'" @click="cancelBill">手工关闭</el-button>
  22. <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>
  23. <el-button class="inline-16" type="primary" size="mini" v-if="tool.checkAuth($route.name,'recheck')" :disabled="mainData.STATUS !== '新建'" @click="onReCheck">复核</el-button>
  24. </div>
  25. <div slot="slot2">
  26. <default-info :mainData="mainData"></default-info>
  27. </div>
  28. <div slot="slot0">
  29. <product-list ref="product" :data="mainData" @onSuccess="queryMainData"></product-list>
  30. </div>
  31. <div slot="slot1" >
  32. <erpInfo ref="erp" :data="mainData"></erpInfo>
  33. </div>
  34. </basicDetails>
  35. </div>
  36. </template>
  37. <script>
  38. import Edit from '../modules/edit'
  39. import add from '../modules/add'
  40. import productList from '../modules/productlist.vue'
  41. import erpInfo from '../modules/erpInfo.vue'
  42. import defaultInfo from '../modules/defaultInfo.vue'
  43. export default {
  44. name: "detail",
  45. data() {
  46. return {
  47. mainData:{},
  48. mainAreaData:{}
  49. }
  50. },
  51. components:{
  52. add,
  53. Edit,
  54. productList,
  55. defaultInfo,
  56. erpInfo
  57. },
  58. methods:{
  59. async queryMainData(id) {
  60. const res = await this.$api.requested({
  61. "id": "20221114135303",
  62. "version":1,
  63. "content": {
  64. "sa_dispatchid":this.$route.query.id
  65. }
  66. })
  67. this.mainData = res.data
  68. console.log(this.mainData)
  69. this.changeDataStructure()
  70. },
  71. changeDataStructure() {
  72. let that = this
  73. this.mainAreaData = [
  74. {
  75. label:'经销商编号',
  76. value:this.mainData.agentnum
  77. },
  78. {
  79. label:'经销商名称',
  80. value:this.mainData.enterprisename
  81. },
  82. {
  83. label:'发货单号',
  84. value:this.mainData.billno?this.mainData.billno:'--'
  85. },
  86. {
  87. label:'订单号',
  88. value:this.mainData.sonum?this.mainData.sonum:'--'
  89. },
  90. {
  91. label:'状态',
  92. value:this.mainData.STATUS,
  93. style:function () {
  94. let style = {}
  95. switch (that.mainData.STATUS) {
  96. case '新建':
  97. style = {color:"#000000"}
  98. break;
  99. case '提交':
  100. style = {color:"#d90a0a"}
  101. break;
  102. case '审核':
  103. style = {color:"#52C41A"}
  104. break;
  105. case '复核':
  106. style = {color:"#3874f6"}
  107. break;
  108. case '关闭':
  109. style = {color:"#b2c0ea"}
  110. break;
  111. default:
  112. break;
  113. }
  114. return style
  115. }
  116. },
  117. {
  118. label:'发货数量',
  119. value:this.mainData.qty
  120. },
  121. {
  122. label:'发货金额',
  123. value:this.mainData.sumamount ? this.tool.formatAmount(this.mainData.sumamount,2) : '--',
  124. },
  125. {
  126. label:'制单时间',
  127. value:this.mainData.createdate,
  128. },
  129. {
  130. label:'关闭时间',
  131. value:this.mainData.closedate,
  132. },
  133. {
  134. label:'备注',
  135. value:this.mainData.remarks
  136. },
  137. ]
  138. },
  139. // 监听切换数据,上一页,下一页
  140. pageChange (id,rowindex,tabIndex) {
  141. this.flag = false
  142. tabIndex = this.$route.query.tabIndex
  143. this.$router.replace({path:'/dispatchdetail',query:{id:id,rowindex:rowindex,tabIndex:tabIndex}})
  144. this.queryMainData(id)
  145. },
  146. onSuccess(){
  147. this.visible = false
  148. this.queryMainData(this.$route.query.id)
  149. this.$refs.product && this.$refs.product.listData()
  150. console.log('触发');
  151. this.$emit('onSuccess')
  152. },
  153. onCheck () {
  154. this.$confirm(`确定${this.mainData.STATUS === '审核'?'反审核':'审核'}该发货单`, '提示', {
  155. confirmButtonText: '确定',
  156. cancelButtonText: '取消',
  157. type: 'warning'
  158. }).then(async () => {
  159. const res = await this.$api.requested({
  160. "id": this.mainData.STATUS === '审核'?20221114135703:20221114135603,
  161. "version":1,
  162. "content": {
  163. "sa_dispatchid":this.$route.query.id
  164. }
  165. })
  166. this.tool.showMessage(res,()=>{
  167. this.queryMainData()
  168. })
  169. }).catch(() => {
  170. this.$message({
  171. type: 'info',
  172. message: '已取消'
  173. });
  174. });
  175. },
  176. onReCheck() {
  177. this.$confirm(`复核后同步更新ERP,确定复核该发货单吗?`, '提示', {
  178. confirmButtonText: '确定',
  179. cancelButtonText: '取消',
  180. type: 'warning'
  181. }).then(async () => {
  182. const res = await this.$api.requested({
  183. "id":20221114135803,
  184. "content": {
  185. "sa_dispatchid":this.$route.query.id,
  186. "isrecheck":true
  187. }
  188. })
  189. this.tool.showMessage(res,()=>{
  190. this.queryMainData()
  191. })
  192. }).catch((err) => {
  193. console.log(err)
  194. this.$message({
  195. type: 'info',
  196. message: '已取消'
  197. });
  198. });
  199. },
  200. async cancelBill () {
  201. this.$confirm(`确定关闭该发货单吗`, '提示', {
  202. confirmButtonText: '确定',
  203. cancelButtonText: '取消',
  204. type: 'warning'
  205. }).then(async () => {
  206. const res = await this.$api.requested({
  207. "id": "20230404134703",
  208. "content": {
  209. "sa_dispatchid":this.mainData.sa_dispatchid
  210. }
  211. })
  212. this.tool.showMessage(res,()=>{
  213. this.queryMainData()
  214. })
  215. }).catch(() => {
  216. this.$message({
  217. type: 'info',
  218. message: '已取消'
  219. });
  220. })
  221. }
  222. },
  223. mounted () {
  224. this.queryMainData(this.$route.query.id)
  225. },
  226. created() {
  227. }
  228. }
  229. </script>
  230. <style scoped>
  231. </style>