tag-init.vue 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  1. <!-- 初始化标签 -->
  2. <template>
  3. <view class="container-wrap">
  4. <uni-nav-bar title="新建标签" :status-bar="true" background-color="#3F92F9" color="#FFF">
  5. <view slot="left">
  6. <u-icon name="account-fill" color="#FFF" size="35"></u-icon>
  7. </view>
  8. <view slot="right" @tap="$utils.back()">
  9. <span style="color: #FFFFFF;">返回</span>
  10. </view>
  11. </uni-nav-bar>
  12. <view class="container">
  13. <scroll-view
  14. scroll-y="true"
  15. style="height: calc(100vh - 150rpx);padding-bottom: 50rpx;">
  16. <view class="form">
  17. <view class="title">
  18. 物料信息
  19. </view>
  20. <view class="row flex-start">
  21. <view class="label">物料编号:</view>
  22. <view class="value">{{ query.code }}</view>
  23. </view>
  24. <view class="row flex-start">
  25. <view class="label">物料名称:</view>
  26. <view class="value">{{ query.name }}</view>
  27. </view>
  28. <view class="row flex-start">
  29. <view class="label">物料分类:</view>
  30. <view class="value">{{ query.categoryCode }}</view>
  31. </view>
  32. <view class="row flex-start">
  33. <view class="label">门幅:</view>
  34. <view class="value">{{ query.width }}</view>
  35. </view>
  36. <view class="row flex-start">
  37. <view class="label">克重:</view>
  38. <view class="value">{{ query.unitWeight }}</view>
  39. </view>
  40. <view class="btn">
  41. <u-button throttleTime="300" type="default" @click="toChoose(query,3)"> + 选择物料</u-button>
  42. </view>
  43. <view class="row" style="margin-top: 40rpx;">
  44. <view class="label">选择仓库:</view>
  45. <view class="value">
  46. <my-select @change="selectHandle"></my-select>
  47. </view>
  48. </view>
  49. <view class="row">
  50. <view class="label">物料长度:</view>
  51. <u-input v-model="quantity" type="number" :adjustPosition="true" :border="true" border-color="#000" placeholder="请输入物料长度"/>
  52. </view>
  53. </view>
  54. </scroll-view>
  55. <view class="footer">
  56. <my-fixed-button text="绑定RFID标签" :customClick="true" @click="bind"></my-fixed-button>
  57. </view>
  58. </view>
  59. </view>
  60. </template>
  61. <script>
  62. import DateFormat from '../../js_sdk/xfl-DateFormat/DateFormat.js';
  63. export default {
  64. data() {
  65. return {
  66. type: 1, // 当前页面类型 1打印二维码标签 2绑定RFID标签
  67. query:[],
  68. quantity: '',
  69. plcCode: 1
  70. }
  71. },
  72. onLoad(option) {
  73. // 获取当前页面类型
  74. this.type = option.type || 1
  75. // 获取选中的物料
  76. uni.$on('materialcfm', res => {
  77. console.log(res)
  78. this.query = res[0]
  79. })
  80. uni.$on('clear', res => {
  81. // this.query = {}
  82. this.quantity = ''
  83. })
  84. },
  85. onUnload() {
  86. uni.$off('materialcfm')
  87. uni.$off('clear')
  88. },
  89. onShow() {
  90. },
  91. methods: {
  92. bind() {
  93. if(!this.query.code) {
  94. return this.$msg.showToast('请选择物料!')
  95. }
  96. if(!this.quantity) {
  97. return this.$msg.showToast('请输入物料长度!')
  98. }
  99. let data = {
  100. materialCode: this.query.code,
  101. quantity: this.quantity,
  102. plcCode: this.plcCode
  103. }
  104. this.$utils.open(`/pages/tag/tag-init-scan?data=${this.$utils.object2Code(data)}`)
  105. },
  106. /* 下拉选择 */
  107. selectHandle(data) {
  108. console.log(data)
  109. this.plcCode = data.newVal
  110. },
  111. // 获取物料
  112. toChoose(item,type){
  113. let items = JSON.stringify(this.query);
  114. // #ifdef H5
  115. items = encodeURIComponent(JSON.stringify(this.query));
  116. // #endif
  117. this.$utils.open(`/pages/material-tree/material-tree?arr=${items}&type=${type}`)
  118. },
  119. clear(){
  120. this.query=[];
  121. this.isChoose=[]
  122. }
  123. }
  124. }
  125. </script>
  126. <style lang="scss" scoped>
  127. @import '../../static/css/mycss.scss';
  128. .container-wrap {
  129. background-color: #FFFFFF;
  130. .container {
  131. .form {
  132. padding: 0 50rpx;
  133. .title {
  134. padding: 30rpx 0;
  135. font-size: 36rpx;
  136. font-weight: bold;
  137. text-align: center;
  138. }
  139. .row {
  140. padding-bottom: 10rpx;
  141. position: relative;
  142. &:last-child {
  143. padding-bottom: 0;
  144. }
  145. .label {
  146. font-size: 28rpx;
  147. }
  148. .value {
  149. flex: 1;
  150. }
  151. // &.bottom-line {
  152. // &::after {
  153. // content: '';
  154. // display: block;
  155. // width: 100%;
  156. // border-bottom: 1px solid #000000;
  157. // }
  158. // }
  159. }
  160. .btn {
  161. padding: 20rpx 0;
  162. }
  163. }
  164. }
  165. }
  166. /deep/ .u-select__body__picker-view__item {
  167. .u-line-1 {
  168. font-size: 36rpx;
  169. }
  170. }
  171. /deep/ .u-select__header__btn {
  172. font-size: 36rpx;
  173. }
  174. </style>