bookSet.vue 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. <template>
  2. <view class="app-content">
  3. <view>
  4. <form @submit="formSubmit">
  5. <view class="module-com input-line-wrap">
  6. <tui-list-cell class="line-cell" :hover="false">
  7. <view class="tui-title">预售</view>
  8. <view>
  9. <switch style="transform:scale(0.7,0.7)" :checked="form.presell == 0 ? false : true" @change="presellChange" /> {{form.presell==0 ? '关闭' : '开启'}}
  10. </view>
  11. </tui-list-cell>
  12. </view>
  13. <view class="confirm-btn">
  14. <button class="admin-button-com big blue" formType="submit">
  15. 提交
  16. </button>
  17. </view>
  18. </form>
  19. </view>
  20. </view>
  21. </template>
  22. <script>
  23. import TuiListCell from "@/components/plugin/list-cell";
  24. import { bookSet,getInfo } from "@/api/shop";
  25. export default {
  26. name: "bookSet",
  27. components: {
  28. TuiListCell
  29. },
  30. data() {
  31. return {
  32. form: {
  33. presell:0,
  34. }
  35. };
  36. },
  37. onLoad() {
  38. },
  39. onShow() {
  40. },
  41. methods: {
  42. presellChange(e){
  43. this.form.presell = e.target.value ? 1 : 0
  44. },
  45. async init() {
  46. const { data } = await getInfo()
  47. this.form.presell = data.presell
  48. this.$forceUpdate()
  49. },
  50. confirmFn() {
  51. bookSet(this.form).then((res) => {
  52. this.$msg(res.msg);
  53. if(res.code == 1){
  54. setTimeout(() => {
  55. uni.navigateBack();
  56. }, 1000)
  57. }
  58. });
  59. },
  60. formSubmit(e) {
  61. let rules = [
  62. {
  63. name: "miniKilo",
  64. rule: ["required"],
  65. msg: ["请填写起订公斤数"],
  66. },
  67. {
  68. name: "kiloFee",
  69. rule: ["required"],
  70. msg: ["请填写每公斤服务费"],
  71. },
  72. ];
  73. this.confirmFn();
  74. },
  75. },
  76. };
  77. </script>
  78. <style lang="scss" scoped>
  79. .app-content {
  80. min-height: calc(100vh - 20upx);
  81. padding-top: 20upx;
  82. }
  83. .prompt-text {
  84. color: $fontColor3;
  85. padding-left: 30upx;
  86. margin-bottom: 30upx;
  87. }
  88. .module-com {
  89. margin-bottom: 20upx;
  90. .member-wrap {
  91. .member-det {
  92. font-size: 24upx;
  93. margin-left: 20upx;
  94. }
  95. }
  96. .remark-wrap {
  97. align-items: flex-start;
  98. .remark {
  99. height: 240upx;
  100. }
  101. }
  102. }
  103. // 按钮
  104. .confirm-btn {
  105. width: calc(100% - 60upx);
  106. margin: 60upx 30upx 20upx;
  107. .admin-button-com {
  108. width: 100%;
  109. }
  110. }
  111. </style>