set.vue 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  1. <template>
  2. <div class="app-content">
  3. <div>
  4. <form @submit="formSubmit">
  5. <div class="module-com input-line-wrap">
  6. <tui-list-cell class="line-cell" :arrow="false">
  7. <div class="tui-title">采购模式:</div>
  8. <radio-group class="tui-input" @change="cgModelChange">
  9. <label class="list" for="cModeJy">
  10. <radio id="cModeJy" value="1" :checked="cgModel == 1" />
  11. <span class="checkbox-text">简约</span>
  12. </label>
  13. <label class="list" for="cModelBz">
  14. <radio id="cModelBz" value="0" :checked="cgModel == 0" />
  15. <span class="checkbox-text">标准</span>
  16. </label>
  17. </radio-group>
  18. </tui-list-cell>
  19. <tui-list-cell class="line-cell" :arrow="false" v-if="cgModel == 1">
  20. <div class="tui-title">每公斤运费:</div>
  21. <input v-model="form.cgPerCost" type="digit" placeholder-class="phcolor" class="tui-input" @focus="form.cgPerCost=''" name="cgPerCost" placeholder="" />
  22. </tui-list-cell>
  23. </div>
  24. <div class="confirm-btn">
  25. <button class="admin-button-com big blue" formType="submit">保存</button>
  26. </div>
  27. </form>
  28. </div>
  29. </div>
  30. </template>
  31. <script>
  32. import TuiListCell from "@/components/plugin/list-cell";
  33. import { currentShop,updateCgModel } from "@/api/shop";
  34. export default {
  35. name: "cgSet",
  36. components: {TuiListCell},
  37. data() {
  38. return {
  39. form:{
  40. cgPerCost:'',
  41. },
  42. hasLoad:false,
  43. cgModel:0
  44. };
  45. },
  46. onLoad() {
  47. },
  48. onShow() {
  49. },
  50. methods: {
  51. cgModelChange(e){
  52. let value = e.detail.value
  53. this.cgModel = value
  54. },
  55. init(){
  56. if(this.hasLoad){
  57. return false
  58. }
  59. currentShop().then(res=>{
  60. if(res.code == 1){
  61. this.hasLoad = true
  62. this.form.cgPerCost = res.data.cgPerCost
  63. this.cgModel = res.data.cgModel
  64. this.$forceUpdate()
  65. }
  66. })
  67. },
  68. formSubmit() {
  69. let that = this
  70. if(that.cgModel == 1){
  71. if(that.$util.isMoney(that.form.cgPerCost) == false){
  72. that.$msg('请输入运费成本')
  73. return false
  74. }
  75. }
  76. updateCgModel({cgPerCost:that.form.cgPerCost,cgModel:that.cgModel}).then(res=>{
  77. if(res.code == 1){
  78. that.$msg(res.msg)
  79. setTimeout(function(){
  80. //这个切换得更彻底
  81. that.$store.commit("setLoginInfo", {})
  82. that.$util.pageTo({url: "/admin/home/workbench",type: 3})
  83. },1000);
  84. }
  85. })
  86. }
  87. },
  88. };
  89. </script>
  90. <style lang="scss" scoped>
  91. .app-content {
  92. min-height: calc(100vh - 20upx);
  93. padding-top: 20upx;
  94. }
  95. .prompt-text {
  96. color: $fontColor3;
  97. padding-left: 30upx;
  98. margin-bottom: 30upx;
  99. }
  100. .module-com {
  101. margin-bottom: 20upx;
  102. .member-wrap {
  103. .member-det {
  104. font-size: 24upx;
  105. margin-left: 20upx;
  106. }
  107. }
  108. .remark-wrap {
  109. align-items: flex-start;
  110. .remark {
  111. height: 240upx;
  112. }
  113. }
  114. }
  115. // 按钮
  116. .confirm-btn {
  117. width: calc(100% - 60upx);
  118. margin: 60upx 30upx 20upx;
  119. .admin-button-com {
  120. width: 100%;
  121. }
  122. }
  123. </style>