preparation.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265
  1. <template>
  2. <view class="mainBox">
  3. <uni-nav-bar
  4. fixed="true"
  5. statusBar="true"
  6. left-icon="back"
  7. :title="`${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" @click="showContent(item)">
  14. <div>工单号 <span>21122403906623533005</span></div>
  15. <image src="~@/static/product/xl.svg" :style="item.show?'transform: rotate(180deg)':''"></image>
  16. </div>
  17. <div class="item-content">
  18. <template v-if="item.show">
  19. <div class="content-line">
  20. <div class="line-left">
  21. <span>产品编码</span>
  22. <p>W30000004536</p>
  23. </div>
  24. </div>
  25. <div class="content-line">
  26. <div class="line-left">
  27. <span>产品名称</span>
  28. <p>精坯木工刀</p>
  29. </div>
  30. </div>
  31. <div class="content-line">
  32. <div class="line-left">
  33. <span>牌号</span>
  34. <p>YL10.2</p>
  35. </div>
  36. </div>
  37. <div class="content-line">
  38. <div class="line-left">
  39. <span>型号</span>
  40. <p>BΦ4.0*310</p>
  41. </div>
  42. </div>
  43. <div class="content-line">
  44. <div class="line-left">
  45. <span>生产数量</span>
  46. <p>
  47. <!-- :rules="[{'required': true,errorMessage: '生产数量必填'}, { pattern: /^[1-9]\d*$/, message: "请输入正整数",trigger: "blur"}]" -->
  48. <uni-forms-item
  49. ref="input"
  50. :rules="[{'required': true,errorMessage: '生产数量必填'},{pattern:/^[1-9]\d*$/,errorMessage: '请输入正整数',trigger: 'blur'}]" :key="item.id"
  51. :name="['list',index,'number']"
  52. style="margin-top: 40rpx;"
  53. >
  54. <uni-easyinput type="number" v-model="item.number"
  55. />
  56. </uni-forms-item>
  57. PCS
  58. </p>
  59. </div>
  60. <div class="line-right">
  61. <u-button class="right-minus" @click="reduce(item,index)" :disabled="item.number<2">-</u-button>
  62. <u-button class="right-add" @click="add(item,index)">+</u-button>
  63. </div>
  64. </div>
  65. <div class="content-line">
  66. <div class="line-left">
  67. <span>生产重量</span>
  68. <p>5KG</p>
  69. </div>
  70. </div>
  71. <div class="content-delt" @click="remove(item,index)">删除</div>
  72. </template>
  73. <div class="content-line" v-else>
  74. <div class="line-left">
  75. <span>精坯木工刀</span>
  76. </div>
  77. <div class="line-right">
  78. 400PCS
  79. </div>
  80. </div>
  81. </div>
  82. </div>
  83. </uni-forms>
  84. <div class="footer">
  85. <div class="footer-left">扫描工单</div>
  86. <div class="footer-right" @click="submit">合并领料清单</div>
  87. </div>
  88. </view>
  89. </template>
  90. <script>
  91. import { post, postJ, get, getJ } from '@/utils/api.js'
  92. export default {
  93. data () {
  94. return {
  95. title:'挤压成型',
  96. formData:{
  97. list:[
  98. {id:0, show:false},
  99. {id:1, show:false},
  100. {id:2, show:false},
  101. {id:3, show:false},
  102. {id:4, show:false}
  103. ]
  104. },
  105. rules:{}
  106. //正整数正则 /^[1-9]\d*$/
  107. }
  108. },
  109. onLoad ({ id }) {
  110. if (id) {
  111. // this._getDetail(id)
  112. }
  113. },
  114. methods: {
  115. showContent(item){
  116. this.$set(item,'show',!item.show)
  117. },
  118. remove(item,index){
  119. this.formData.list.splice(index,1)
  120. },
  121. reduce(item,index){
  122. this.$set(item,'number',item.number-1)
  123. },
  124. add(item,index){
  125. this.$set(item,'number',item.number+1)
  126. },
  127. submit() {
  128. uni.navigateTo({
  129. url: '/pages/production/order/prepare/material'
  130. })
  131. // this.$refs.form.validate().then(res=>{
  132. // console.log('表单数据信息:', res);
  133. // }).catch(err =>{
  134. // console.log('表单错误信息:', err);
  135. // })
  136. }
  137. }
  138. }
  139. </script>
  140. <style lang="scss" scoped>
  141. .list{
  142. width: 94%;
  143. margin: 0 auto;
  144. padding: 0 0 100rpx;
  145. .list-item{
  146. width: 100%;
  147. margin: 20rpx auto 40rpx;
  148. .item-title{
  149. padding: 0 12rpx;
  150. border-bottom: 1rpx solid #ccc;
  151. display: flex;
  152. align-items: center;
  153. justify-content: space-between;
  154. font-size: 30rpx;
  155. color: #000;
  156. font-weight: bold;
  157. height: 80rpx;
  158. line-height: 80rpx;
  159. image{
  160. width: 21rpx;
  161. height: 11rpx;
  162. }
  163. span{
  164. margin-left: 15rpx;
  165. }
  166. }
  167. .item-content{
  168. .content-line{
  169. padding: 0 12rpx;
  170. border-bottom: 1rpx dashed #ccc;
  171. display: flex;
  172. align-items: center;
  173. justify-content: space-between;
  174. height: 80rpx;
  175. line-height: 80rpx;
  176. .line-left{
  177. display: flex;
  178. align-items: center;
  179. justify-content: flex-start;
  180. span{
  181. width: 180rpx;
  182. text-align: left;
  183. color: rgb(127, 127, 127);
  184. }
  185. p{
  186. color: #333333;
  187. display: flex;
  188. align-items: center;
  189. justify-content: flex-start;
  190. .uni-easyinput{
  191. width: 220rpx;
  192. margin-right: 10rpx;
  193. margin-top: 8rpx;
  194. }
  195. }
  196. }
  197. .line-right{
  198. display: flex;
  199. align-items: center;
  200. justify-content: flex-end;
  201. .right-minus{
  202. width: 80rpx;
  203. height: 51rpx;
  204. text-align: center;
  205. line-height: 51rpx;
  206. color: #fff;
  207. background: #F59A23;
  208. border: none;
  209. }
  210. .right-add{
  211. width: 80rpx;
  212. height: 51rpx;
  213. text-align: center;
  214. line-height: 51rpx;
  215. color: #fff;
  216. background: #70B603;
  217. margin-left: 10rpx;
  218. border: none;
  219. }
  220. }
  221. }
  222. .content-delt{
  223. color: #EC808D;
  224. margin: 30rpx auto 0;
  225. width: 100rpx;
  226. text-align: center;
  227. }
  228. }
  229. }
  230. }
  231. .footer{
  232. width: 100%;
  233. height: 90rpx;
  234. display: flex;
  235. align-items: center;
  236. justify-content: center;
  237. position: fixed;
  238. bottom: 0;
  239. left: 0;
  240. .footer-left{
  241. width: 50%;
  242. height: 90rpx;
  243. line-height: 90rpx;
  244. text-align: center;
  245. font-size: 34rpx;
  246. color: #fff;
  247. background: #4B7902;
  248. }
  249. .footer-right{
  250. width: 50%;
  251. height: 90rpx;
  252. line-height: 90rpx;
  253. text-align: center;
  254. font-size: 34rpx;
  255. color: #fff;
  256. background: #70B603;
  257. }
  258. }
  259. </style>