outRep.vue 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. <template>
  2. <view class="container">
  3. <view class="example">
  4. <uni-forms ref="form" :model="dataForm" labelWidth="80px">
  5. <uni-forms-item label="借出数量" name="qty">
  6. <uni-data-checkbox v-model="dataForm.qty" :localdata="numData" />
  7. </uni-forms-item>
  8. <uni-forms-item label="借出人" name="borRetBy">
  9. <uni-easyinput v-model="dataForm.borRetBy" placeholder="请输入借出人" />
  10. </uni-forms-item>
  11. <uni-forms-item label="客人" name="custName">
  12. <uni-easyinput v-model="dataForm.custName" placeholder="请输入客人" />
  13. </uni-forms-item>
  14. <uni-forms-item label="时间" name="borRetTime">
  15. <uni-datetime-picker type="date" :clear-icon="false" v-model="dataForm.borRetTime" />
  16. </uni-forms-item>
  17. <uni-forms-item label="备注" name="remark">
  18. <uni-easyinput v-model="dataForm.remark" placeholder="是否会归还" />
  19. </uni-forms-item>
  20. </uni-forms>
  21. <button type="primary" @click="submit">提交</button>
  22. </view>
  23. </view>
  24. </template>
  25. <script>
  26. import {
  27. addOutRep
  28. } from "@/api/trade/shoe-style.js"
  29. import {
  30. updateUserProfile
  31. } from "@/api/system/user"
  32. export default {
  33. data() {
  34. return {
  35. dataForm: {
  36. type: 0,
  37. styleNum: '',
  38. version: '',
  39. qty: 0.5,
  40. borRetBy: "",
  41. custName: "",
  42. borRetTime: new Date(),
  43. remark: ""
  44. },
  45. numData: [{
  46. text: '1只',
  47. value: 0.5
  48. }, {
  49. text: '1双',
  50. value: 1
  51. }],
  52. rules: {
  53. nickName: {
  54. rules: [{
  55. required: true,
  56. errorMessage: '用户昵称不能为空'
  57. }]
  58. },
  59. }
  60. }
  61. },
  62. onLoad(options) {
  63. console.log(options,'options')
  64. if(options){
  65. this.dataForm.version=options.version
  66. this.dataForm.styleNum=options.styleNum
  67. }
  68. // this.getUser()
  69. },
  70. onReady() {
  71. this.$refs.form.setRules(this.rules)
  72. },
  73. methods: {
  74. submit(ref) {
  75. this.$refs.form.validate().then(res => {
  76. // this.dataForm.qty=Number(this.dataForm.qty)
  77. addOutRep(this.dataForm).then(response => {
  78. this.$modal.confirm('操作成功','',false).then(() => {
  79. uni.navigateBack()
  80. })
  81. })
  82. })
  83. }
  84. }
  85. }
  86. </script>
  87. <style lang="scss">
  88. page {
  89. background-color: #ffffff;
  90. }
  91. .example {
  92. padding: 15px;
  93. background-color: #fff;
  94. }
  95. .segmented-control {
  96. margin-bottom: 15px;
  97. }
  98. .button-group {
  99. margin-top: 15px;
  100. display: flex;
  101. justify-content: space-around;
  102. }
  103. .form-item {
  104. display: flex;
  105. align-items: center;
  106. flex: 1;
  107. }
  108. .button {
  109. display: flex;
  110. align-items: center;
  111. height: 35px;
  112. line-height: 35px;
  113. margin-left: 10px;
  114. }
  115. </style>