tag.vue 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
  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.materialId }}</view>
  23. </view>
  24. <view class="row flex-start">
  25. <view class="label">物料名称:</view>
  26. <view class="value">{{ query.materialName }}</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. const v = this
  81. // 获取当前页面类型
  82. this.type = option.type || 1
  83. // 获取选中的物料
  84. uni.getStorage({
  85. key: 'reviewDtl',
  86. success: function (res) {
  87. v.query = res.data.checkDetailsInfoList[res.data.index]
  88. v.quantity = res.data.checkDetailsInfoList[res.data.index].stockBackDetailsList[res.data.jindex].materialMeters
  89. v.query.code = res.data.checkDetailsInfoList[res.data.index].materialId
  90. console.log(v.query)
  91. }
  92. });
  93. uni.$on('materialcfm', res => {
  94. console.log(res)
  95. this.query = res[0]
  96. })
  97. uni.$on('clear', res => {
  98. // this.query = {}
  99. this.quantity = ''
  100. })
  101. uni.$on('chooseContract', res => {
  102. console.log('purchaseBillNo-', this.purchaseBillNo)
  103. this.purchaseBillNo = res.purchaseBillNo
  104. this.batchNo = res.batchNo
  105. })
  106. },
  107. onUnload() {
  108. uni.$off('materialcfm')
  109. uni.$off('clear')
  110. uni.$off('chooseContract')
  111. },
  112. onShow() {
  113. },
  114. methods: {
  115. toChooseContract () {
  116. if(!this.query.code) {
  117. return this.$msg.showToast('请选择物料!')
  118. }
  119. this.$utils.open(`/pages/store-manage/contract-list/contract-list?materialCode=${this.query.code}`)
  120. },
  121. bind() {
  122. if(!this.query.code) {
  123. return this.$msg.showToast('请选择物料!')
  124. }
  125. if(!(this.purchaseBillNo && this.batchNo)) {
  126. return this.$msg.showToast('请选择合同批次!')
  127. }
  128. if(!this.quantity) {
  129. return this.$msg.showToast('请输入物料长度!')
  130. }
  131. let data = {
  132. materialCode: this.query.code,
  133. quantity: this.quantity,
  134. purchaseBillNo: this.purchaseBillNo,
  135. batchNo: this.batchNo
  136. }
  137. this.$utils.open(`/pages/warehouse/tag-scan?data=${this.$utils.object2Code(data)}`)
  138. },
  139. // 获取物料
  140. toChoose(item,type){
  141. let items = JSON.stringify(this.query);
  142. // #ifdef H5
  143. items = encodeURIComponent(JSON.stringify(this.query));
  144. // #endif
  145. this.$utils.open(`/pages/material-tree/material-tree?arr=${items}&type=${type}`)
  146. },
  147. clear(){
  148. this.query=[];
  149. this.isChoose=[]
  150. }
  151. }
  152. }
  153. </script>
  154. <style lang="scss" scoped>
  155. @import '../../static/css/mycss.scss';
  156. .container-wrap {
  157. background-color: #FFFFFF;
  158. .container {
  159. .form {
  160. padding: 0 50rpx;
  161. .title {
  162. padding: 30rpx 0;
  163. font-size: 36rpx;
  164. font-weight: bold;
  165. text-align: center;
  166. }
  167. .row {
  168. padding-bottom: 10rpx;
  169. position: relative;
  170. &:last-child {
  171. padding-bottom: 0;
  172. }
  173. .label {
  174. font-size: 28rpx;
  175. }
  176. .value {
  177. flex: 1;
  178. }
  179. // &.bottom-line {
  180. // &::after {
  181. // content: '';
  182. // display: block;
  183. // width: 100%;
  184. // border-bottom: 1px solid #000000;
  185. // }
  186. // }
  187. }
  188. .btn {
  189. padding: 20rpx 0;
  190. }
  191. }
  192. }
  193. }
  194. /deep/ .u-select__body__picker-view__item {
  195. .u-line-1 {
  196. font-size: 36rpx;
  197. }
  198. }
  199. /deep/ .u-select__header__btn {
  200. font-size: 36rpx;
  201. }
  202. </style>