detail.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. <template>
  2. <mobile-frame>
  3. <view class="info">
  4. <view class="one">
  5. <uni-forms ref="form" :modelValue="form" :rules="rules" label-width="auto">
  6. <uni-forms-item label="维护快递单号" name="customer_transport_no">
  7. <uni-easyinput type="text" v-model="form.customer_transport_no" placeholder="请输入快递单号" />
  8. </uni-forms-item>
  9. </uni-forms>
  10. <view class="btn">
  11. <button type="primary" @click="onSubmit('form')" size="small">提交</button>
  12. </view>
  13. </view>
  14. </view>
  15. </mobile-frame>
  16. </template>
  17. <script>
  18. export default {
  19. data() {
  20. return {
  21. id: '',
  22. form: {},
  23. rules: {
  24. customer_transport_no: {
  25. rules: [{
  26. required: true,
  27. errorMessage: '请输入快递单号',
  28. }]
  29. }
  30. },
  31. };
  32. },
  33. onLoad: function(e) {
  34. const that = this;
  35. that.$set(that, `id`, e.id || '');
  36. that.watchLogin();
  37. },
  38. onShow: function() {},
  39. methods: {
  40. // 提交保存
  41. async onSubmit(ref) {
  42. const that = this;
  43. that.$refs[ref].validate().then(async params => {
  44. let form = that.form;
  45. let transport = {};
  46. transport.customer_transport_no = params.customer_transport_no;
  47. form.transport = transport;
  48. const arr = await that.$api(`/afterSale/${that.id}`, 'POST', form);
  49. if (arr.errcode == '0') {
  50. uni.showToast({
  51. title: `维护信息成功`,
  52. icon: 'success',
  53. });
  54. uni.navigateBack({
  55. detail: 1
  56. })
  57. } else {
  58. uni.showToast({
  59. title: arr.errmsg,
  60. icon: 'none',
  61. })
  62. }
  63. })
  64. },
  65. watchLogin() {
  66. const that = this;
  67. uni.getStorage({
  68. key: 'token',
  69. success: async (res) => {},
  70. fail: (err) => {
  71. uni.navigateTo({
  72. url: `/pages/login/index`
  73. })
  74. }
  75. })
  76. },
  77. }
  78. }
  79. </script>
  80. <style lang="scss">
  81. .info {
  82. display: flex;
  83. flex-direction: column;
  84. width: 100vw;
  85. height: 100vh;
  86. .one {
  87. padding: 2vw;
  88. .uni-input {
  89. border: #f1f1ff 1px solid;
  90. padding: 2vw 2vw;
  91. border-radius: 1vw;
  92. }
  93. .btn {
  94. text-align: center;
  95. button {
  96. margin: 0 2vw 2vw 2vw;
  97. background-color: var(--ff0Color);
  98. color: var(--fffColor);
  99. }
  100. .name {
  101. color: var(--f85Color);
  102. font-size: var(--font14Size);
  103. }
  104. }
  105. }
  106. }
  107. .uni-forms-item {
  108. margin-bottom: 6vw !important;
  109. display: flex;
  110. flex-direction: row;
  111. }
  112. </style>