makePrint.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133
  1. <template>
  2. <view class="app-content">
  3. <view>
  4. <form @submit="formSubmit" @reset="formReset">
  5. <view class="module-com input-line-wrap">
  6. <tui-list-cell class="line-cell" :hover="false">
  7. <view class="tui-title">小票机编号:</view>
  8. <input v-model="form.printSn" @focus="form.printSn=''" placeholder-class="phcolor" class="tui-input" name="printSn" placeholder="请填写编号,SN码" maxlength="50" type="number" />
  9. </tui-list-cell>
  10. <tui-list-cell class="line-cell" :hover="false">
  11. <view class="tui-title">小票机密钥:</view>
  12. <input v-model="form.printKey" @focus="form.printKey=''" placeholder-class="phcolor" class="tui-input" name="printKey" placeholder="请填写密钥,KEY码" maxlength="50" type="text" />
  13. </tui-list-cell>
  14. <tui-list-cell class="line-cell" :hover="false">
  15. <view class="tui-title">标签机编号:</view>
  16. <input v-model="form.printLabelSn" @focus="form.printLabelSn=''" placeholder-class="phcolor" class="tui-input" name="printLabelSn" placeholder="请填写编号,SN码" maxlength="50" type="number" />
  17. </tui-list-cell>
  18. <tui-list-cell class="line-cell" :hover="false">
  19. <view class="tui-title">标签机密钥:</view>
  20. <input v-model="form.printLabelKey" @focus="form.printLabelKey=''" placeholder-class="phcolor" class="tui-input" name="printLabelKey" placeholder="请填写密钥,KEY码" maxlength="50" type="text" />
  21. </tui-list-cell>
  22. </view>
  23. <view class="confirm-btn">
  24. <button class="admin-button-com big blue" formType="submit"> 提交 </button>
  25. </view>
  26. </form>
  27. </view>
  28. </view>
  29. </template>
  30. <script>
  31. import TuiListCell from "@/components/plugin/list-cell";
  32. import AppAvatarModule from "@/components/module/app-avatar";
  33. const form = require("@/utils/formValidation.js");
  34. import { addMakeCloudPrint,getPrint } from "@/api/shop";
  35. export default {
  36. name: "makePrint",
  37. components: {
  38. TuiListCell,
  39. AppAvatarModule,
  40. },
  41. data() {
  42. return {
  43. form: {
  44. printKey: "",
  45. printSn: "",
  46. printLabelSn:"",
  47. printLabelKey:""
  48. },
  49. roleList: [],
  50. roleSelData: {},
  51. miniCodeSrc: "",
  52. memberData: {},
  53. };
  54. },
  55. methods: {
  56. async init() {
  57. const { data } = await getPrint()
  58. this.form.printKey = data.makePrintKey
  59. this.form.printSn = data.makePrintSn
  60. this.form.printLabelKey = data.makePrintLabelKey
  61. this.form.printLabelSn = data.makePrintLabelSn
  62. this.$forceUpdate()
  63. },
  64. confirmFn() {
  65. addMakeCloudPrint(this.form).then((res) => {
  66. this.$msg(res.msg);
  67. if(res.code == 1){
  68. setTimeout(() => {
  69. uni.navigateBack();
  70. }, 1000)
  71. }
  72. });
  73. },
  74. formSubmit(e) {
  75. let rules = [
  76. {
  77. name: "printSn",
  78. rule: ["required"],
  79. msg: ["请填写小票机编号"],
  80. },
  81. {
  82. name: "printKey",
  83. rule: ["required"],
  84. msg: ["请填写小票机密钥"],
  85. },
  86. ];
  87. this.confirmFn();
  88. },
  89. },
  90. };
  91. </script>
  92. <style lang="scss" scoped>
  93. .app-content {
  94. min-height: calc(100vh - 20upx);
  95. padding-top: 20upx;
  96. }
  97. .prompt-text {
  98. color: $fontColor3;
  99. padding-left: 30upx;
  100. margin-bottom: 30upx;
  101. }
  102. .module-com {
  103. margin-bottom: 20upx;
  104. .member-wrap {
  105. .member-det {
  106. font-size: 24upx;
  107. margin-left: 20upx;
  108. }
  109. }
  110. .remark-wrap {
  111. align-items: flex-start;
  112. .remark {
  113. height: 240upx;
  114. }
  115. }
  116. }
  117. // 按钮
  118. .confirm-btn {
  119. width: calc(100% - 60upx);
  120. margin: 60upx 30upx 20upx;
  121. .admin-button-com {
  122. width: 100%;
  123. }
  124. }
  125. </style>