index.vue 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230
  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. <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,'cancelBill')" :disabled="mainData.STATUS !== '复核'" @click="cancelBill">手工关闭</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 !== '新建'" @click="onReCheck">复核</el-button>
  23. </div>
  24. <div slot="slot2">
  25. <default-info :mainData="mainData"></default-info>
  26. </div>
  27. <div slot="slot0">
  28. <product-list ref="product" :data="mainData" @onSuccess="queryMainData"></product-list>
  29. </div>
  30. <div slot="slot1" >
  31. <erpInfo ref="erp" :data="mainData"></erpInfo>
  32. </div>
  33. </basicDetails>
  34. </div>
  35. </template>
  36. <script>
  37. import Edit from '../modules/edit'
  38. import productList from '../modules/productlist.vue'
  39. import erpInfo from '../modules/erpInfo.vue'
  40. import defaultInfo from '../modules/defaultInfo.vue'
  41. export default {
  42. name: "detail",
  43. data() {
  44. return {
  45. mainData:{},
  46. mainAreaData:{}
  47. }
  48. },
  49. components:{
  50. Edit,
  51. productList,
  52. defaultInfo,
  53. erpInfo
  54. },
  55. methods:{
  56. async queryMainData(id) {
  57. const res = await this.$api.requested({
  58. "id": "20221114135303",
  59. "version":1,
  60. "content": {
  61. "sa_dispatchid":this.$route.query.id
  62. }
  63. })
  64. this.mainData = res.data
  65. console.log(this.mainData)
  66. this.changeDataStructure()
  67. },
  68. changeDataStructure() {
  69. let that = this
  70. this.mainAreaData = [
  71. {
  72. label:'经销商编号',
  73. value:this.mainData.agentnum
  74. },
  75. {
  76. label:'经销商名称',
  77. value:this.mainData.enterprisename
  78. },
  79. {
  80. label:'发货单号',
  81. value:this.mainData.billno?this.mainData.billno:'--'
  82. },
  83. {
  84. label:'订单号',
  85. value:this.mainData.sonum?this.mainData.sonum:'--'
  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.qty
  117. },
  118. {
  119. label:'发货金额',
  120. value:this.mainData.sumamount ? this.tool.formatAmount(this.mainData.sumamount,2) : '--',
  121. },
  122. {
  123. label:'制单时间',
  124. value:this.mainData.createdate,
  125. },
  126. {
  127. label:'备注',
  128. value:this.mainData.remarks
  129. },
  130. ]
  131. },
  132. // 监听切换数据,上一页,下一页
  133. pageChange (id,rowindex,tabIndex) {
  134. this.flag = false
  135. tabIndex = this.$route.query.tabIndex
  136. this.$router.replace({path:'/dispatchdetail',query:{id:id,rowindex:rowindex,tabIndex:tabIndex}})
  137. this.queryMainData(id)
  138. },
  139. onSuccess(){
  140. this.visible = false
  141. this.queryMainData(this.$route.query.id)
  142. this.$refs.product && this.$refs.product.listData()
  143. console.log('触发');
  144. this.$emit('onSuccess')
  145. },
  146. onCheck () {
  147. this.$confirm(`确定${this.mainData.STATUS === '审核'?'反审核':'审核'}该发货单`, '提示', {
  148. confirmButtonText: '确定',
  149. cancelButtonText: '取消',
  150. type: 'warning'
  151. }).then(async () => {
  152. const res = await this.$api.requested({
  153. "id": this.mainData.STATUS === '审核'?20221114135703:20221114135603,
  154. "version":1,
  155. "content": {
  156. "sa_dispatchid":this.$route.query.id
  157. }
  158. })
  159. this.tool.showMessage(res,()=>{
  160. this.queryMainData()
  161. })
  162. }).catch(() => {
  163. this.$message({
  164. type: 'info',
  165. message: '已取消'
  166. });
  167. });
  168. },
  169. onReCheck() {
  170. this.$confirm(`复核后同步更新ERP,确定复核该发货单吗?`, '提示', {
  171. confirmButtonText: '确定',
  172. cancelButtonText: '取消',
  173. type: 'warning'
  174. }).then(async () => {
  175. const res = await this.$api.requested({
  176. "id":20221114135803,
  177. "content": {
  178. "sa_dispatchid":this.$route.query.id,
  179. "isrecheck":true
  180. }
  181. })
  182. this.tool.showMessage(res,()=>{
  183. this.queryMainData()
  184. })
  185. }).catch((err) => {
  186. console.log(err)
  187. this.$message({
  188. type: 'info',
  189. message: '已取消'
  190. });
  191. });
  192. },
  193. async cancelBill () {
  194. this.$confirm(`确定关闭该发货单吗`, '提示', {
  195. confirmButtonText: '确定',
  196. cancelButtonText: '取消',
  197. type: 'warning'
  198. }).then(async () => {
  199. const res = await this.$api.requested({
  200. "id": "20230404134703",
  201. "content": {
  202. "sa_dispatchid":this.mainData.sa_dispatchid
  203. }
  204. })
  205. this.tool.showMessage(res,()=>{
  206. this.queryMainData()
  207. })
  208. }).catch(() => {
  209. this.$message({
  210. type: 'info',
  211. message: '已取消'
  212. });
  213. })
  214. }
  215. },
  216. mounted () {
  217. this.queryMainData(this.$route.query.id)
  218. },
  219. created() {
  220. }
  221. }
  222. </script>
  223. <style scoped>
  224. </style>