index.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  1. <template>
  2. <view class="content">
  3. <view class="row row-bottom">
  4. <view class="left">日期</view>
  5. <picker mode="date" @change="bindDateChange">
  6. <view>{{param.date}}</view>
  7. </picker>
  8. </view>
  9. <view class="row row-bottom">
  10. <view class="left">类型</view>
  11. <radio-group @change="selectType">
  12. <label v-for="item in inOutType" :key="item">
  13. <radio :value="item" :checked="item==param.type" />{{item}}
  14. </label>
  15. </radio-group>
  16. </view>
  17. <view v-if="param.type=='出库'" class="row row-bottom">
  18. <view class="left">班组</view>
  19. <picker @change="outtypeChange" :value="industryIndex" :range="list" range-key="name">
  20. {{industryIndex>0 ? list[industryIndex].name : industryIndex==0 ? list[0].name :'请选择班组'}}
  21. </picker>
  22. </view>
  23. <view v-if="param.type=='出库'" class="row row-bottom">
  24. <view class="left">班次</view>
  25. <radio-group @change="chang">
  26. <label v-for="item in radioGroup" :key="item">
  27. <radio :value="item" :checked="item==param.banci" />{{item}}
  28. </label>
  29. </radio-group>
  30. </view>
  31. <view v-if="param.type=='出库'" class="row row-bottom">
  32. <view class="left">巴西(吨)</view>
  33. <input v-model='param.filed1' class="right-bottom" type="number" placeholder="请输入"></input>
  34. </view>
  35. <view v-if="param.type=='出库'" class="row row-bottom">
  36. <view class="left">中美洲(吨)</view>
  37. <input v-model='param.filed2' class="right-bottom" type="number" placeholder="请输入"></input>
  38. </view>
  39. <view v-if="param.type=='出库'" class="row row-bottom">
  40. <view class="left">回溶(吨)</view>
  41. <input v-model='param.filed3' class="right-bottom" type="number" placeholder="请输入"></input>
  42. </view>
  43. <view v-if="param.type=='出库'" class="row row-bottom">
  44. <view class="left">加工糖100%(吨)</view>
  45. <input v-model='param.filed4' class="right-bottom" type="number" placeholder="请输入"></input>
  46. </view>
  47. <view v-if="param.type=='出库'" class="row row-bottom">
  48. <view class="left">非食用糖92%(吨)</view>
  49. <input v-model='param.filed5' class="right-bottom" type="number" placeholder="请输入"></input>
  50. </view>
  51. <view v-if="param.type=='出库'" class="row row-bottom">
  52. <view class="left">国储(吨)</view>
  53. <input v-model='param.filed6' class="right-bottom" type="number" placeholder="请输入"></input>
  54. </view>
  55. <view v-if="param.type=='出库'" class="row row-bottom">
  56. <view class="left">合计(吨)</view>
  57. <input :disabled="true" v-model='total' class="right-bottom" placeholder="请输入"></input>
  58. </view>
  59. <view v-if="param.type=='入库'" class="row row-bottom">
  60. <view class="left">入库量(吨)</view>
  61. <input v-model='param.inNum' class="right-bottom" placeholder="请输入"></input>
  62. </view>
  63. <view class="bottom-btn">
  64. <button type="primary" class="submit" hover-class="none" @click="submit()">提交</button>
  65. </view>
  66. </view>
  67. </template>
  68. <script>
  69. export default {
  70. data() {
  71. return {
  72. param: {
  73. filed1: '0',
  74. filed2: '0',
  75. filed3: '0',
  76. filed4: '0',
  77. filed5: '0',
  78. filed6: '0',
  79. total: '0',
  80. banci: '白班',
  81. banzu: '甲班',
  82. type: '出库',
  83. inNum: '0',
  84. date: this.getDate()
  85. },
  86. radioGroup: ['白班', '夜班'],
  87. inOutType: ['出库', '入库'],
  88. list: [{
  89. name: '甲班'
  90. },
  91. {
  92. name: '乙班'
  93. },
  94. {
  95. name: '丙班'
  96. }
  97. ],
  98. industryIndex: 0,
  99. }
  100. },
  101. computed: {
  102. total() {
  103. return parseFloat(this.param.filed1) +
  104. parseFloat(this.param.filed2) +
  105. parseFloat(this.param.filed3) +
  106. parseFloat(this.param.filed4) +
  107. parseFloat(this.param.filed5) +
  108. parseFloat(this.param.filed6);
  109. }
  110. },
  111. onLoad() {
  112. },
  113. methods: {
  114. submit() {
  115. this.param.total = this.total;
  116. let that = this
  117. uni.showModal({
  118. title: '提示',
  119. content: '确定提交?',
  120. success: function(res) {
  121. if (res.confirm) {
  122. uni.showLoading({
  123. title: '正在提交',
  124. mask: true
  125. });
  126. uni.request({
  127. url: 'http://localhost:8888/v1/testTable',
  128. method: 'POST',
  129. data: that.param,
  130. success: (res) => {
  131. console.log(res)
  132. }
  133. })
  134. uni.hideLoading()
  135. .catch(res => {
  136. uni.hideLoading()
  137. })
  138. } else {
  139. // 执行取消后的操作
  140. }
  141. }
  142. })
  143. },
  144. chang(e) {
  145. this.banci = e.detail.value; //选中按钮的value值
  146. },
  147. selectType(e) {
  148. this.type = e.detail.value; //选中按钮的value值
  149. this.param.type = e.detail.value;
  150. },
  151. outtypeChange(e) {
  152. this.industryIndex = e.detail.value
  153. this.banzu = this.list[e.detail.value].name
  154. },
  155. getDate() {
  156. const date = new Date();
  157. let year = date.getFullYear();
  158. let month = date.getMonth() + 1;
  159. let day = date.getDate();
  160. month = month > 9 ? month : '0' + month;
  161. day = day > 9 ? day : '0' + day;
  162. return `${year}-${month}-${day}`;
  163. },
  164. bindDateChange: function(e) {
  165. this.date = e.detail.value;
  166. }
  167. }
  168. }
  169. </script>
  170. <style scoped lang="scss">
  171. .content,
  172. .content1,
  173. .content2 {
  174. border-radius: 20rpx;
  175. background: white;
  176. padding: 20rpx;
  177. .title {
  178. font-size: 28rpx;
  179. font-weight: 600;
  180. color: #333333;
  181. }
  182. .row {
  183. display: flex;
  184. justify-content: space-between;
  185. border-bottom: 1px solid #EEEEEE;
  186. padding: 21rpx 0;
  187. .right,
  188. input {
  189. font-size: 28rpx;
  190. color: #333333;
  191. }
  192. }
  193. .row-bottom {
  194. // border: 0;
  195. .right-bottom {
  196. width: 280rpx;
  197. text-align: right;
  198. }
  199. }
  200. }
  201. .right-bottom {
  202. width: 280rpx;
  203. text-align: right;
  204. }
  205. .logo {
  206. height: 200rpx;
  207. width: 200rpx;
  208. margin-top: 200rpx;
  209. margin-left: auto;
  210. margin-right: auto;
  211. margin-bottom: 50rpx;
  212. }
  213. .text-area {
  214. display: flex;
  215. justify-content: center;
  216. }
  217. .title {
  218. font-size: 36rpx;
  219. color: #8f8f94;
  220. }
  221. .bottom-btn {
  222. padding: 30rpx;
  223. background: #FFFFFF;
  224. width: 92%;
  225. position: fixed;
  226. bottom: 0rpx;
  227. display: flex;
  228. }
  229. </style>