tag.vue 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  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="row flex-start">
  41. <view class="label">采购合同号:</view>
  42. <view class="value">{{ purchaseBillNo }}</view>
  43. </view>
  44. <view class="row flex-start">
  45. <view class="label">批次号:</view>
  46. <view class="value">{{ batchNo }}</view>
  47. </view>
  48. <view class="btn">
  49. <u-button throttleTime="300" type="default" @click="toChoose(query,3)"> + 选择物料</u-button>
  50. </view>
  51. <view class="btn">
  52. <u-button throttleTime="300" type="default" @click="toChooseContract()"> + 选择合同批次</u-button>
  53. </view>
  54. <view class="row" style="margin-top: 40rpx;">
  55. <view class="label">物料长度:</view>
  56. <u-input v-model="quantity" type="number" :border="true" border-color="#000" placeholder="请输入物料长度"/>
  57. <span style="padding: 0 10rpx;">米</span>
  58. </view>
  59. </view>
  60. </scroll-view>
  61. <view class="footer">
  62. <my-fixed-button text="绑定RFID标签" :customClick="true" @click="bind"></my-fixed-button>
  63. </view>
  64. </view>
  65. </view>
  66. </template>
  67. <script>
  68. import DateFormat from '../../js_sdk/xfl-DateFormat/DateFormat.js';
  69. export default {
  70. data() {
  71. return {
  72. type: 1, // 当前页面类型 1打印二维码标签 2绑定RFID标签
  73. query:[],
  74. quantity: '',
  75. purchaseBillNo: '',
  76. batchNo: ''
  77. }
  78. },
  79. onLoad(option) {
  80. // 获取当前页面类型
  81. this.type = option.type || 1
  82. // 获取选中的物料
  83. uni.$on('materialcfm', res => {
  84. console.log(res)
  85. this.query = res[0]
  86. })
  87. uni.$on('clear', res => {
  88. // this.query = {}
  89. this.quantity = ''
  90. })
  91. uni.$on('chooseContract', res => {
  92. console.log('purchaseBillNo-', this.purchaseBillNo)
  93. this.purchaseBillNo = res.purchaseBillNo
  94. this.batchNo = res.batchNo
  95. })
  96. },
  97. onUnload() {
  98. uni.$off('materialcfm')
  99. uni.$off('clear')
  100. uni.$off('chooseContract')
  101. },
  102. onShow() {
  103. },
  104. methods: {
  105. toChooseContract () {
  106. if(!this.query.code) {
  107. return this.$msg.showToast('请选择物料!')
  108. }
  109. this.$utils.open(`/pages/store-manage/contract-list/contract-list?materialCode=${this.query.code}`)
  110. },
  111. bind() {
  112. if(!this.query.code) {
  113. return this.$msg.showToast('请选择物料!')
  114. }
  115. if(!(this.purchaseBillNo && this.batchNo)) {
  116. return this.$msg.showToast('请选择合同批次!')
  117. }
  118. if(!this.quantity) {
  119. return this.$msg.showToast('请输入物料长度!')
  120. }
  121. let data = {
  122. materialCode: this.query.code,
  123. quantity: this.quantity,
  124. purchaseBillNo: this.purchaseBillNo,
  125. batchNo: this.batchNo
  126. }
  127. this.$utils.open(`/pages/tag/tag-scan?data=${this.$utils.object2Code(data)}`)
  128. },
  129. // 获取物料
  130. toChoose(item,type){
  131. let items = JSON.stringify(this.query);
  132. // #ifdef H5
  133. items = encodeURIComponent(JSON.stringify(this.query));
  134. // #endif
  135. this.$utils.open(`/pages/material-tree/material-tree?arr=${items}&type=${type}`)
  136. },
  137. clear(){
  138. this.query=[];
  139. this.isChoose=[]
  140. }
  141. }
  142. }
  143. </script>
  144. <style lang="scss" scoped>
  145. @import '../../static/css/mycss.scss';
  146. .container-wrap {
  147. background-color: #FFFFFF;
  148. .container {
  149. .form {
  150. padding: 0 50rpx;
  151. .title {
  152. padding: 30rpx 0;
  153. font-size: 36rpx;
  154. font-weight: bold;
  155. text-align: center;
  156. }
  157. .row {
  158. padding-bottom: 10rpx;
  159. position: relative;
  160. &:last-child {
  161. padding-bottom: 0;
  162. }
  163. .label {
  164. font-size: 28rpx;
  165. }
  166. .value {
  167. flex: 1;
  168. }
  169. // &.bottom-line {
  170. // &::after {
  171. // content: '';
  172. // display: block;
  173. // width: 100%;
  174. // border-bottom: 1px solid #000000;
  175. // }
  176. // }
  177. }
  178. .btn {
  179. padding: 20rpx 0;
  180. }
  181. }
  182. }
  183. }
  184. /deep/ .u-select__body__picker-view__item {
  185. .u-line-1 {
  186. font-size: 36rpx;
  187. }
  188. }
  189. /deep/ .u-select__header__btn {
  190. font-size: 36rpx;
  191. }
  192. </style>