material.vue 8.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382
  1. <template>
  2. <view class="mainBox">
  3. <uni-nav-bar
  4. fixed="true"
  5. statusBar="true"
  6. left-icon="back"
  7. title="领料需求清单"
  8. @clickLeft="back"
  9. >
  10. </uni-nav-bar>
  11. <uni-forms class="list" ref="form" :modelValue="formData" :rules="rules" validate-trigger="blur">
  12. <div class="list-item" v-for="(item,index) in formData.list" :key="index">
  13. <div class="item-title" v-if="index==0">
  14. <div>W3004536 <span>混炼料-A</span></div>
  15. <div class="del" @click="remove(item,index)">删除</div>
  16. </div>
  17. <div class="item-title" v-else>
  18. <div>W3004536 <span>挤压钻针干燥车</span></div>
  19. <div class="del" @click="remove(item,index)">删除</div>
  20. </div>
  21. <div class="item-content">
  22. <template v-if="index==0">
  23. <div class="content-line">
  24. <div class="line-left">
  25. <span>牌号</span>
  26. <p>YL10.2</p>
  27. </div>
  28. </div>
  29. <div class="content-line">
  30. <div class="line-left">
  31. <span>数量</span>
  32. <p>
  33. <uni-forms-item
  34. ref="input"
  35. :rules="[{'required': true,errorMessage: '数量必填'},{pattern:/^[1-9]\d*$/,errorMessage: '请输入正整数',trigger: 'blur'}]" :key="item.id"
  36. :name="['list',index,'number']"
  37. style="margin-top: 40rpx;"
  38. >
  39. <uni-easyinput type="number" v-model="item.number"
  40. />
  41. </uni-forms-item>
  42. KG
  43. </p>
  44. </div>
  45. <div class="line-right">
  46. <u-button class="right-minus" @click="reduce(item,index)" :disabled="item.number<2">-</u-button>
  47. <u-button class="right-add" @click="add(item,index)">+</u-button>
  48. </div>
  49. </div>
  50. <div class="content-line">
  51. <div class="line-left">
  52. <span>仓库</span>
  53. <p>原料1仓</p>
  54. </div>
  55. <div class="line-right">
  56. <u-button class="right-choose" @click="choose(item,index)">选择</u-button>
  57. </div>
  58. </div>
  59. </template>
  60. <template v-else>
  61. <div class="content-line">
  62. <div class="line-left">
  63. <span>规格</span>
  64. <p>8层*3格</p>
  65. </div>
  66. </div>
  67. <div class="content-line">
  68. <div class="line-left">
  69. <span>型号</span>
  70. <p>KT22-3</p>
  71. </div>
  72. </div>
  73. <div class="content-line">
  74. <div class="line-left">
  75. <span>长宽高</span>
  76. <p>200*300*15</p>
  77. </div>
  78. </div>
  79. <div class="content-line">
  80. <div class="line-left">
  81. <span>数量</span>
  82. <p>
  83. <uni-forms-item
  84. ref="input"
  85. :rules="[{'required': true,errorMessage: '数量必填'},{pattern:/^[1-9]\d*$/,errorMessage: '请输入正整数',trigger: 'blur'}]" :key="item.id"
  86. :name="['list',index,'number']"
  87. style="margin-top: 40rpx;"
  88. >
  89. <uni-easyinput type="number" v-model="item.number"
  90. />
  91. </uni-forms-item>
  92. 台
  93. </p>
  94. </div>
  95. <div class="line-right">
  96. <u-button class="right-minus" @click="reduce(item,index)" :disabled="item.number<2">-</u-button>
  97. <u-button class="right-add" @click="add(item,index)">+</u-button>
  98. </div>
  99. </div>
  100. <div class="content-line">
  101. <div class="line-left">
  102. <span>仓库</span>
  103. <p>原料1仓</p>
  104. </div>
  105. <div class="line-right">
  106. <u-button class="right-choose" @click="choose(item,index)">选择</u-button>
  107. </div>
  108. </div>
  109. </template>
  110. </div>
  111. </div>
  112. </uni-forms>
  113. <div class="footer">
  114. <div class="footer-left" @click="addMaterial">添加领料</div>
  115. <div class="footer-right" @click="submit">提交领料清单</div>
  116. </div>
  117. <uni-popup ref="popup" type="bottom">
  118. <div class="popup">
  119. <div class="popup-top">
  120. <div class="top-left">选择仓库</div>
  121. <div class="top-right">
  122. <button @click="close">关闭</button>
  123. <button>确定</button>
  124. </div>
  125. </div>
  126. <div class="popup-list">
  127. <div class="list-item" v-for="(item,index) in warehouseList" :key="index">
  128. {{item.name}}
  129. </div>
  130. </div>
  131. </div>
  132. </uni-popup>
  133. </view>
  134. </template>
  135. <script>
  136. import { post, postJ, get, getJ } from '@/utils/api.js'
  137. export default {
  138. data () {
  139. return {
  140. title:'挤压成型',
  141. formData:{
  142. list:[
  143. {id:0, show:false},
  144. {id:1, show:false},
  145. {id:2, show:false},
  146. {id:3, show:false},
  147. {id:4, show:false}
  148. ]
  149. },
  150. rules:{},
  151. warehouseList:[
  152. {name:'仓库1号'},
  153. {name:'仓库2号'},
  154. {name:'仓库3号'},
  155. {name:'仓库4号'},
  156. {name:'仓库5号'},
  157. {name:'仓库2号'},
  158. {name:'仓库3号'},
  159. {name:'仓库4号'},
  160. {name:'仓库5号'}
  161. ]
  162. //正整数正则 /^[1-9]\d*$/
  163. }
  164. },
  165. onLoad ({ id }) {
  166. if (id) {
  167. // this._getDetail(id)
  168. }
  169. },
  170. methods: {
  171. remove(item,index){
  172. this.formData.list.splice(index,1)
  173. },
  174. reduce(item,index){
  175. this.$set(item,'number',item.number-1)
  176. },
  177. add(item,index){
  178. this.$set(item,'number',item.number+1)
  179. },
  180. choose(item,index){
  181. this.$refs.popup.open('bottom')
  182. },
  183. close() {
  184. this.$refs.popup.close()
  185. },
  186. submit() {
  187. uni.navigateTo({
  188. url:'/pages/production/order/prepare/comfirm'
  189. })
  190. // this.$refs.form.validate().then(res=>{
  191. // console.log('表单数据信息:', res);
  192. // }).catch(err =>{
  193. // console.log('表单错误信息:', err);
  194. // })
  195. },
  196. addMaterial(){
  197. uni.navigateTo({
  198. url:'/pages/production/order/prepare/addpick'
  199. })
  200. }
  201. }
  202. }
  203. </script>
  204. <style lang="scss" scoped>
  205. .list{
  206. width: 94%;
  207. margin: 0 auto;
  208. padding: 0 0 100rpx;
  209. .list-item{
  210. width: 100%;
  211. margin: 20rpx auto 40rpx;
  212. .item-title{
  213. padding: 0 12rpx;
  214. display: flex;
  215. align-items: center;
  216. justify-content: space-between;
  217. font-size: 30rpx;
  218. color: #000;
  219. height: 80rpx;
  220. line-height: 80rpx;
  221. span{
  222. margin-left: 15rpx;
  223. }
  224. .del{
  225. color: #EC808D;
  226. }
  227. }
  228. .item-content{
  229. border: 1rpx solid #ccc;
  230. .content-line{
  231. padding: 0 12rpx;
  232. border-bottom: 1rpx solid #ccc;
  233. display: flex;
  234. align-items: center;
  235. justify-content: space-between;
  236. height: 80rpx;
  237. line-height: 80rpx;
  238. .line-left{
  239. display: flex;
  240. align-items: center;
  241. justify-content: flex-start;
  242. span{
  243. width: 120rpx;
  244. text-align: right;
  245. color: rgb(127, 127, 127);
  246. margin-right: 20rpx;
  247. }
  248. p{
  249. color: #333333;
  250. display: flex;
  251. align-items: center;
  252. justify-content: flex-start;
  253. .uni-easyinput{
  254. width: 220rpx;
  255. margin-right: 10rpx;
  256. }
  257. }
  258. }
  259. .line-right{
  260. display: flex;
  261. align-items: center;
  262. justify-content: flex-end;
  263. .right-minus{
  264. width: 80rpx;
  265. height: 51rpx;
  266. text-align: center;
  267. line-height: 51rpx;
  268. color: #fff;
  269. background: #F59A23;
  270. }
  271. .right-add{
  272. width: 80rpx;
  273. height: 51rpx;
  274. text-align: center;
  275. line-height: 51rpx;
  276. color: #fff;
  277. background: #70B603;
  278. margin-left: 10rpx;
  279. }
  280. .right-choose.u-button--info{
  281. border-color:#70B603;
  282. color: #70B603;
  283. }
  284. }
  285. }
  286. .content-line:last-child{
  287. border-bottom: none;
  288. }
  289. }
  290. }
  291. }
  292. .footer{
  293. width: 100%;
  294. height: 90rpx;
  295. display: flex;
  296. align-items: center;
  297. justify-content: center;
  298. position: fixed;
  299. bottom: 0;
  300. left: 0;
  301. .footer-left{
  302. width: 50%;
  303. height: 90rpx;
  304. line-height: 90rpx;
  305. text-align: center;
  306. font-size: 34rpx;
  307. color: #fff;
  308. background: #4B7902;
  309. }
  310. .footer-right{
  311. width: 50%;
  312. height: 90rpx;
  313. line-height: 90rpx;
  314. text-align: center;
  315. font-size: 34rpx;
  316. color: #fff;
  317. background: #70B603;
  318. }
  319. }
  320. .popup{
  321. width: 100%;
  322. height: 600rpx;
  323. background: #fff;
  324. .popup-top{
  325. width: 100%;
  326. display: flex;
  327. align-items: center;
  328. justify-content: space-between;
  329. height: 80rpx;
  330. background: rgba(21, 122, 44, 1);
  331. color: #fff;
  332. .top-left{
  333. font-size: 32rpx;
  334. margin-left: 10rpx;
  335. }
  336. .top-right{
  337. display: flex;
  338. align-items: center;
  339. justify-content: flex-end;
  340. margin-right: 10rpx;
  341. uni-button{
  342. background: rgba(21, 122, 44, 1);
  343. color: #fff;
  344. width: 100rpx;
  345. height: 60rpx;
  346. line-height: 60rpx;
  347. font-size: 28rpx;
  348. padding: 0;
  349. border: 1rpx solid #fff;
  350. margin-left: 20rpx;
  351. }
  352. }
  353. }
  354. .popup-list{
  355. width: 100%;
  356. height: 520rpx;
  357. overflow-y: auto;
  358. background-color: rgba(242, 242, 242, 1);
  359. .list-item{
  360. width: 100%;
  361. height: 80rpx;
  362. text-align: center;
  363. line-height: 80rpx;
  364. border-bottom: 1rpx solid #fff;
  365. }
  366. .list-item:last-child{
  367. border: none;
  368. }
  369. .list-item:hover{
  370. background: rgba(254,64,102,.25)
  371. }
  372. }
  373. }
  374. </style>