detail.vue 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  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. methods: {
  39. watchLogin() {
  40. const that = this;
  41. uni.getStorage({
  42. key: 'token',
  43. success: async (res) => {},
  44. fail: (err) => {
  45. uni.navigateTo({
  46. url: `/pages/login/index`
  47. })
  48. }
  49. })
  50. },
  51. // 提交保存
  52. async onSubmit(ref) {
  53. const that = this;
  54. that.$refs[ref].validate().then(async params => {
  55. let form = that.form;
  56. let transport = {};
  57. transport.customer_transport_no = params.customer_transport_no;
  58. form.transport = transport;
  59. const arr = await that.$api(`/afterSale/${that.id}`, 'POST', form);
  60. if (arr.errcode == '0') {
  61. uni.showToast({
  62. title: `维护信息成功`,
  63. icon: 'success',
  64. });
  65. uni.navigateBack({
  66. detail: 1
  67. })
  68. } else {
  69. uni.showToast({
  70. title: arr.errmsg,
  71. icon: 'none',
  72. })
  73. }
  74. })
  75. }
  76. }
  77. }
  78. </script>
  79. <style lang="scss">
  80. .info {
  81. display: flex;
  82. flex-direction: column;
  83. width: 100vw;
  84. height: 100vh;
  85. .one {
  86. padding: 2vw;
  87. .uni-input {
  88. border: #f1f1ff 1px solid;
  89. padding: 2vw 2vw;
  90. border-radius: 1vw;
  91. }
  92. .btn {
  93. text-align: center;
  94. button {
  95. margin: 0 2vw 2vw 2vw;
  96. background-color: var(--ff0Color);
  97. color: var(--fffColor);
  98. }
  99. .name {
  100. color: var(--f85Color);
  101. font-size: var(--font14Size);
  102. }
  103. }
  104. }
  105. }
  106. .uni-forms-item {
  107. margin-bottom: 6vw !important;
  108. display: flex;
  109. flex-direction: row;
  110. }
  111. </style>