updateStatus.vue 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. <template>
  2. <view class="uni-app">
  3. <view class="status-bar" />
  4. <view class="main-container">
  5. <wk-nav-bar :title="navTitle">
  6. <!-- #ifndef MP-WEIXIN -->
  7. <button class="button white-btn" @click="handleSave">
  8. 确定
  9. </button>
  10. <!-- #endif -->
  11. </wk-nav-bar>
  12. <view class="container">
  13. <wk-form
  14. ref="form"
  15. :fields="fieldArr" />
  16. </view>
  17. <!-- #ifdef MP-WEIXIN -->
  18. <view class="footer-btn-group">
  19. <button class="button" @click="handleSave">
  20. 确定
  21. </button>
  22. </view>
  23. <!-- #endif -->
  24. </view>
  25. </view>
  26. </template>
  27. <script>
  28. import {
  29. ResetInvoiceStatus,
  30. UpdateInvoiceStatus
  31. } from '@/api/crm/invoice.js'
  32. import Fields from '@/utils/fields.js'
  33. export default {
  34. name: 'UpdateStatus',
  35. data() {
  36. return {
  37. loading: true,
  38. routerQuery: {},
  39. fieldArr: [
  40. new Fields({ fieldName: 'invoiceNumber', name: '发票号码', formType: 'text' }),
  41. new Fields({ fieldName: 'realInvoiceDate', name: '实际开票日期', formType: 'date' }),
  42. new Fields({ fieldName: 'logisticsNumber', name: '物流单号', formType: 'text' })
  43. ]
  44. }
  45. },
  46. computed: {
  47. navTitle() {
  48. if (
  49. this.routerQuery &&
  50. Number(this.routerQuery.status) === 1
  51. ) {
  52. return '重置开票信息'
  53. }
  54. return '标记为已开票'
  55. }
  56. },
  57. onLoad(options) {
  58. this.routerQuery = options || {}
  59. },
  60. methods: {
  61. handleSave() {
  62. this.$refs.form.getForm().then(data => {
  63. console.log('save: ', data.entity)
  64. const params = data.entity || {}
  65. params.invoiceId = this.routerQuery.id
  66. const status = Number(this.routerQuery.status)
  67. const request = status === 1 ? ResetInvoiceStatus : UpdateInvoiceStatus
  68. request(params).then(res => {
  69. this.$refreshAndToPrev(this)
  70. }).catch(() => {})
  71. }).catch(() => {})
  72. }
  73. }
  74. }
  75. </script>
  76. <style scoped lang="scss">
  77. </style>