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