addExpend.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130
  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" :arrow="false">
  7. <view class="tui-title">类型</view>
  8. <button class="admin-button-com middle" @tap="form.type = 3" :class="form.type == 3? 'blue' : 'default'">伙食</button>
  9. <button class="admin-button-com middle" @tap="form.type = 0" :class="form.type == 0 ? 'blue' : 'default'">店租</button>
  10. <button class="admin-button-com middle" @tap="form.type = 1" :class="form.type == 1? 'blue' : 'default'">水电</button>
  11. <button class="admin-button-com middle" @tap="form.type = 2" :class="form.type == 2? 'blue' : 'default'">物业</button>
  12. <button class="admin-button-com middle" @tap="form.type = 4" :class="form.type == 4? 'blue' : 'default'">房租</button>
  13. <button class="admin-button-com middle" @tap="form.type = 5" :class="form.type == 5? 'blue' : 'default'">其它</button>
  14. </tui-list-cell>
  15. <tui-list-cell class="line-cell" :arrow="true">
  16. <view class="tui-title">支付</view>
  17. <picker mode="selector" :value="form.payWay" :range="payWayList" range-key="name" @change="payWayChange" class="tui-input" >
  18. <input v-model="form.payWay" name="payWay" type="text" hidden />
  19. <view style="padding:6upx 0 6upx 0;">{{payWayList[payWayindex].name}}</view>
  20. </picker>
  21. </tui-list-cell>
  22. <tui-list-cell class="line-cell" :hover="false">
  23. <view class="tui-title">金额</view>
  24. <input v-model="form.amount" type="digit" @focus="form.amount=''" placeholder-class="phcolor" placeholder-style="color:#CCCCCC" class="tui-input" name="amount" placeholder="请填写" />
  25. </tui-list-cell>
  26. <tui-list-cell class="line-cell remark-wrap" :hover="false">
  27. <view class="tui-title">备注</view>
  28. <view class="tui-input">
  29. <textarea v-model="form.remark" @focus="form.remark=''" style="height:80upx;" class="tui-textarea remark" name="remark" placeholder-class="phcolor" placeholder="选填" />
  30. </view>
  31. </tui-list-cell>
  32. </view>
  33. <view class="confirm-btn">
  34. <view style="margin-bottom:20upx;font-size:33upx;color:red;font-weight:bold;">当前在:{{shopInfo.shopName}}</view>
  35. <button class="admin-button-com big blue" formType="submit">添加</button>
  36. </view>
  37. </form>
  38. </view>
  39. </view>
  40. </template>
  41. <script>
  42. import TuiListCell from "@/components/plugin/list-cell";
  43. import { addExpend} from '@/api/expend'
  44. import {currentShop} from "@/api/shop";
  45. export default {
  46. name: "addExpend",
  47. components: {
  48. TuiListCell
  49. },
  50. data() {
  51. return {
  52. form:{
  53. //0店租 1水电 2物业 3伙食 4房租 5其它
  54. type:3,
  55. amount:'',
  56. remark:'',
  57. payWay:0
  58. },
  59. payWayList:[{name:"员工微信",id:0},{name:"现金",id:4},{name:"员工支付宝",id:1},{name:"银行卡",id:5}],
  60. payWayindex:0,
  61. shopInfo:{shopName:''}
  62. };
  63. },
  64. onLoad () {
  65. currentShop().then(res => {
  66. this.shopInfo = res.data
  67. })
  68. },
  69. methods: {
  70. payWayChange(e){
  71. let index = e.detail.value
  72. this.payWayindex = index
  73. this.form.payWay = this.payWayList[index].id
  74. },
  75. formSubmit(){
  76. if(Number(this.form.amount) <= 0){
  77. this.$msg('请填写金额')
  78. return false
  79. }
  80. this.$util.confirmModal({content:'确认提交?'},() => {
  81. addExpend(this.form).then(res=>{
  82. if(res.code == 1){
  83. this.$msg("提交成功");
  84. setTimeout(function(){
  85. uni.navigateBack({ delta: 1 })
  86. },1000)
  87. }
  88. })
  89. })
  90. }
  91. }
  92. };
  93. </script>
  94. <style lang="scss" scoped>
  95. .app-content {
  96. min-height: calc(100vh - 20upx);
  97. padding-top: 20upx;
  98. }
  99. .prompt-text {
  100. color: $fontColor3;
  101. padding-left: 30upx;
  102. margin-bottom: 30upx;
  103. }
  104. .module-com {
  105. margin-bottom: 20upx;
  106. .member-wrap {
  107. .member-det {
  108. font-size: 24upx;
  109. margin-left: 20upx;
  110. }
  111. }
  112. .remark-wrap {
  113. align-items: flex-start;
  114. .remark {
  115. height: 240upx;
  116. }
  117. }
  118. }
  119. .confirm-btn {
  120. width: calc(100% - 60upx);
  121. margin: 60upx 30upx 20upx;
  122. .admin-button-com {
  123. width: 100%;
  124. }
  125. }
  126. </style>