index.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253
  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. uni.showToast({
  132. title: '提交成功',
  133. mask: true,
  134. icon: 'success',
  135. duration: 2000
  136. })
  137. console.log(res)
  138. }
  139. })
  140. uni.hideLoading()
  141. .catch(res => {
  142. uni.hideLoading()
  143. })
  144. } else {
  145. // 执行取消后的操作
  146. }
  147. },
  148. })
  149. },
  150. chang(e) {
  151. this.banci = e.detail.value; //选中按钮的value值
  152. this.param.banci = e.detail.value;
  153. },
  154. selectType(e) {
  155. this.type = e.detail.value; //选中按钮的value值
  156. this.param.type = e.detail.value;
  157. },
  158. outtypeChange(e) {
  159. this.industryIndex = e.detail.value
  160. this.banzu = this.list[e.detail.value].name
  161. this.param.banzu =this.list[e.detail.value].name
  162. },
  163. getDate() {
  164. const date = new Date();
  165. let year = date.getFullYear();
  166. let month = date.getMonth() + 1;
  167. let day = date.getDate();
  168. month = month > 9 ? month : '0' + month;
  169. day = day > 9 ? day : '0' + day;
  170. return `${year}-${month}-${day}`;
  171. },
  172. bindDateChange: function(e) {
  173. this.date = e.detail.value;
  174. }
  175. }
  176. }
  177. </script>
  178. <style scoped lang="scss">
  179. .content,
  180. .content1,
  181. .content2 {
  182. border-radius: 20rpx;
  183. background: white;
  184. padding: 20rpx;
  185. .title {
  186. font-size: 28rpx;
  187. font-weight: 600;
  188. color: #333333;
  189. }
  190. .row {
  191. display: flex;
  192. justify-content: space-between;
  193. border-bottom: 1px solid #EEEEEE;
  194. padding: 21rpx 0;
  195. .right,
  196. input {
  197. font-size: 28rpx;
  198. color: #333333;
  199. }
  200. }
  201. .row-bottom {
  202. // border: 0;
  203. .right-bottom {
  204. width: 280rpx;
  205. text-align: right;
  206. }
  207. }
  208. }
  209. .right-bottom {
  210. width: 280rpx;
  211. text-align: right;
  212. }
  213. .logo {
  214. height: 200rpx;
  215. width: 200rpx;
  216. margin-top: 200rpx;
  217. margin-left: auto;
  218. margin-right: auto;
  219. margin-bottom: 50rpx;
  220. }
  221. .text-area {
  222. display: flex;
  223. justify-content: center;
  224. }
  225. .title {
  226. font-size: 36rpx;
  227. color: #8f8f94;
  228. }
  229. .bottom-btn {
  230. padding: 30rpx;
  231. background: #FFFFFF;
  232. width: 92%;
  233. position: fixed;
  234. bottom: 0rpx;
  235. display: flex;
  236. }
  237. </style>