disinfect-Index.vue 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. <template>
  2. <view>
  3. <view class="box">
  4. <view class="top">
  5. <text class="title">车辆消杀</text>
  6. </view>
  7. <view class="item-line">
  8. 基本信息
  9. </view>
  10. <view class="item">
  11. <view class="l"><text style="color: red;">*</text>车牌号:</view>
  12. <view class="r">
  13. <u-input placeholder="请填写车牌号" v-model="form.carNo" />
  14. </view>
  15. </view>
  16. <view class="item">
  17. <view class="l"><text style="color: red;">*</text>车辆类型:</view>
  18. <view class="r">
  19. <picker class="p-picker" id="qy" @change="bindPickerChange($event)" :value="type.index"
  20. :range="type.list" range-key="name">
  21. <text class="p-text">{{type.list[type.index]}}</text>
  22. <u-icon class="p-icon" name="arrow-down-fill" size="20"></u-icon>
  23. </picker>
  24. </view>
  25. </view>
  26. <view class="item-line">
  27. 业务项
  28. </view>
  29. <view class="item" v-for="item in itemList" :key="item.id">
  30. <view class="l">{{item.itemName}}:
  31. </view>
  32. <view class="r">
  33. <view style="margin-left: 20rpx;">
  34. {{item.price}}元
  35. </view>
  36. </view>
  37. </view>
  38. <view class="item-line">
  39. 其他费用
  40. </view>
  41. <view class="item">
  42. <view class="l">停车费:
  43. </view>
  44. <view class="r">
  45. <view style="margin-left: 20rpx;">
  46. 30元
  47. </view>
  48. </view>
  49. </view>
  50. </view>
  51. <u-button type="primary" text="确定" @click="saveFn"></u-button>
  52. <u-button type="info" text="重置" @click="resetFn" style="margin-top: 20rpx;"></u-button>
  53. <!-- ---------------------------------------------------------- -->
  54. <view class="bottom-safety"></view>
  55. </view>
  56. </template>
  57. <script>
  58. export default {
  59. data() {
  60. return {
  61. type: {
  62. index: 0,
  63. list: ['空车', '载货']
  64. },
  65. form: {
  66. carNo: ''
  67. },
  68. itemList: [],
  69. list: []
  70. }
  71. },
  72. mounted() {
  73. this.getTypeList();
  74. },
  75. onBackPress() {
  76. this.$common.to('/pages/index/index');
  77. return true;
  78. },
  79. methods: {
  80. bindPickerChange(e) {
  81. let index = e.detail.value;
  82. this.type.index = index //当前picker选中的值
  83. if (index == 0) {
  84. this.itemList = this.list;
  85. } else {
  86. this.itemList = this.list.filter(obj => obj.itemName == '车头消杀')
  87. }
  88. },
  89. getTypeList() {
  90. this.$api.getItemList({
  91. business: 0
  92. }).then(resp => {
  93. let list = resp.data[0].items;
  94. this.itemList = list;
  95. this.list = list;
  96. })
  97. },
  98. resetFn() {
  99. this.form.carNo = '';
  100. this.type.index = 0;
  101. this.itemList = this.list;
  102. },
  103. saveFn() {
  104. if(!this.form.carNo){
  105. this.$common.toast('请输入车牌号')
  106. return;
  107. }
  108. this.form.itemJson=JSON.stringify(this.itemList);
  109. this.form.carType=this.type.list[this.type.index]
  110. let that=this;
  111. uni.showModal({
  112. title:'提示',
  113. content:'确认录入该车辆的消杀业务?',
  114. success(res) {
  115. if(res.confirm){
  116. that.$api.addCarDisinfect(that.$common.removeNull(that.form)).then(resp => {
  117. if (resp.code == 200) {
  118. that.$common.to('/pages/onely-disinfect/addSuccess')
  119. }
  120. })
  121. }
  122. }
  123. })
  124. },
  125. },
  126. }
  127. </script>
  128. <style lang="scss">
  129. page {
  130. background-color: #fff;
  131. }
  132. .hs-item {
  133. text-align: center;
  134. }
  135. .item-line {
  136. color: #a2a2a2;
  137. padding: 5px 0 10px 29px;
  138. border-bottom: 1px solid #E5E5E5;
  139. }
  140. .hj {
  141. padding: 50rpx;
  142. font-size: 40rpx;
  143. color: red;
  144. font-weight: bold;
  145. }
  146. .save-btn {
  147. background-color: #ff4200;
  148. height: 88rpx;
  149. display: flex;
  150. justify-content: center;
  151. align-items: center;
  152. margin: 60rpx;
  153. color: #fff;
  154. font-size: 30rpx;
  155. font-weight: bold;
  156. border-radius: 10rpx;
  157. }
  158. @import '@/common/common.scss'
  159. </style>