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