boxSplit.vue 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304
  1. <template>
  2. <gui-page :custom-header="true" :is-header-sized="false" :header-class="['gui-theme-background-color']">
  3. <template #gHeader>
  4. <view style="height:44px;" class="gui-flex gui-nowrap gui-rows gui-align-items-center">
  5. <!-- 使用组件实现返回按钮及返回首页按钮 -->
  6. <text
  7. style="font-size:44rpx;"
  8. class="gui-header-leader-btns gui-color-white font-icons"
  9. @tap="goBack"
  10. >&#xe6c5;</text>
  11. <!-- 导航文本此处也可以是其他自定义内容 -->
  12. <text
  13. class="gui-h4 gui-blod gui-flex1 gui-text-center gui-color-white gui-ellipsis gui-primary-text"
  14. >拆箱</text>
  15. <!-- 此处加一个右侧展位元素与左侧同宽,实现标题居中 -->
  16. <!-- 实际宽度请根据自己情况设置 -->
  17. <view style="width:40px;" />
  18. <!-- 如果右侧有其他内容可以利用条件编译和定位来实现-->
  19. </view>
  20. </template>
  21. <template #gBody>
  22. <view class="form">
  23. <view class="row-1">
  24. <view class="row-1-card">
  25. <text
  26. class="gui-form-input input-200 gui-color-gray"
  27. >{{ productionList[0]?.boxNo? productionList[0]?.boxNo:"请扫描箱码" }}</text>
  28. <view style="display: flex; flex-direction: row;">
  29. <text class="font-icons" @click="handleMapass">&#xe6b7;</text>
  30. </view>
  31. </view>
  32. </view>
  33. <view class="checkbox-list">
  34. <view v-if="productionList.length > 0">
  35. <view
  36. v-for="(item, key) in productionList"
  37. :key="key"
  38. class="checkbox-item"
  39. @click="handleCheckedItem(item)"
  40. >
  41. <view v-if="computedChecked(item.id)" class="checkbox-cubes">
  42. <view class="checkbox-box" />
  43. <view class="checkbox-icon">✔</view>
  44. </view>
  45. <view class="checkbox-panel">
  46. <view class="checkbox-panel-item">
  47. <text>SN码</text>
  48. <text>{{ item.materialSerinalNo }}</text>
  49. </view>
  50. <view class="checkbox-panel-item">
  51. <text>产品编码</text>
  52. <text>{{ item.productCode }}</text>
  53. </view>
  54. <view class="checkbox-panel-item">
  55. <text>产品名称</text>
  56. <text>{{ item.productName }}</text>
  57. </view>
  58. </view>
  59. </view>
  60. </view>
  61. <view v-else>
  62. <view class="bg-image">
  63. <image src="@/static/empty.png" mode="heightFix" />
  64. <text>这里什么都没有...</text>
  65. </view>
  66. </view>
  67. </view>
  68. </view>
  69. <gui-right-menus>
  70. <!-- 扩展按钮 -->
  71. <template #menus-more>
  72. <view
  73. hover-class="gui-tap"
  74. class="menu-items gui-bg-green gui-flex gui-columns gui-justify-content-center"
  75. @click="handleSplit"
  76. >
  77. <text class="menu-text gui-block gui-text-center gui-color-white">拆分</text>
  78. </view>
  79. </template>
  80. <!-- 核心按钮 -->
  81. <template #menus-primary>
  82. <view class="menu-items gui-bg-primary gui-flex gui-columns gui-justify-content-center">
  83. <text class="menu-icon gui-color-white gui-block gui-text-center gui-icons">&#xe614;</text>
  84. <text class="menu-text gui-color-white gui-block gui-text-center">功能</text>
  85. </view>
  86. </template>
  87. </gui-right-menus>
  88. </template>
  89. </gui-page>
  90. </template>
  91. <script>
  92. import {
  93. computed,
  94. defineComponent,
  95. ref
  96. } from 'vue'
  97. export default defineComponent({
  98. setup() {
  99. const goBack = function() {
  100. uni.$goBack('/pages/workbranch/warehouse/box/boxList')
  101. }
  102. const productionList = ref([])
  103. const checkboxParams = ref({
  104. checkboxIds: [], // 待选项的物料批次集合
  105. checkedIds: [] // 选中的字段
  106. })
  107. const computedChecked = computed(() => {
  108. return item => checkboxParams.value.checkedIds.includes(item)
  109. })
  110. const inputting = function(e) {
  111. console.log(e)
  112. }
  113. // 多选事件
  114. const handleCheckedItem = function(item) {
  115. const ifExist = checkboxParams.value.checkedIds.includes(item?.id)
  116. if (ifExist) {
  117. const fdIndex = checkboxParams.value.checkedIds.findIndex(option => option === item?.id)
  118. checkboxParams.value.checkedIds.splice(fdIndex, 1)
  119. } else {
  120. checkboxParams.value.checkedIds.push(item?.id)
  121. }
  122. }
  123. const handleMapass = function() {
  124. // uni.$reqGet("getWmsBoxSnList", { boxNo: "1633704467249389570" })
  125. // .then(({
  126. // data
  127. // }) => {
  128. // // for(let x = 0; x < 10; x++) {
  129. // // data?.list?.forEach(item => {
  130. // // productionList.value.push(item);
  131. // // })
  132. // // }
  133. // // checkboxParams.value.checkboxIds = Array.from(productionList.value, item => item
  134. // // ?.id);
  135. // productionList.value = data?.list;
  136. // checkboxParams.value.checkboxIds = Array.from(productionList.value, item => item
  137. // ?.id);
  138. // })
  139. const mpaasScanModule = uni.requireNativePlugin('Mpaas-Scan-Module')
  140. mpaasScanModule.mpaasScan({
  141. // 扫码识别类型,参数可多选,qrCode、barCode,不设置,默认识别所有
  142. 'scanType': ['qrCode', 'barCode'],
  143. // 是否隐藏相册,默认false不隐藏
  144. 'hideAlbum': false
  145. },
  146. (ret) => {
  147. if (ret.resp_code === 1000) {
  148. uni.$reqGet('getWmsBoxSnList', {
  149. boxNo: ret.resp_code
  150. })
  151. .then(({
  152. data
  153. }) => {
  154. productionList.value = data?.list
  155. checkboxParams.value.checkboxIds = Array.from(productionList.value,
  156. item => item
  157. ?.id)
  158. })
  159. }
  160. })
  161. }
  162. // 拆分
  163. const handleSplit = function() {
  164. const ids = checkboxParams.value.checkedIds.toString(',')
  165. if (checkboxParams.value.checkedIds.length > 0) {
  166. uni.$reqGet('boxSplit', {
  167. ids
  168. })
  169. .then(({
  170. code,
  171. data,
  172. msg
  173. }) => {
  174. if (code === 0) {
  175. uni.$grace.msg('拆分成功')
  176. setTimeout(() => {
  177. uni.redirectTo({
  178. url: '/pages/workbranch/warehouse/box/boxSplit'
  179. })
  180. }, 500)
  181. } else {
  182. uni.$grace.msg(msg)
  183. }
  184. })
  185. }
  186. }
  187. return {
  188. goBack,
  189. productionList,
  190. inputting,
  191. handleMapass,
  192. handleSplit,
  193. computedChecked,
  194. handleCheckedItem
  195. }
  196. }
  197. })
  198. </script>
  199. <style lang="scss" scoped>
  200. .gui-header-leader-btns {
  201. color: black;
  202. font-size: 24px !important;
  203. margin-left: 24rpx;
  204. }
  205. .gui-sbody {
  206. background-color: rgba(234, 239, 242, 1);
  207. }
  208. .form {
  209. margin-top: 85px;
  210. }
  211. .row-1 {
  212. height: 55px;
  213. display: flex;
  214. justify-content: center;
  215. background-color: white;
  216. .row-1-card {
  217. flex: 1;
  218. display: flex;
  219. flex-direction: row;
  220. justify-content: space-between;
  221. align-items: center;
  222. padding-left: 10px;
  223. padding-right: 10px;
  224. }
  225. }
  226. .input-200 {
  227. width: 200px;
  228. padding-left: 10px;
  229. }
  230. .input-300 {
  231. width: 300px;
  232. padding-left: 10px;
  233. }
  234. .font-icons {
  235. width: 40px;
  236. font-size: 20px;
  237. }
  238. .checkbox-list {
  239. padding-top: 12px;
  240. .checkbox-item {
  241. display: flex;
  242. flex-direction: row;
  243. align-items: center;
  244. height: 126px;
  245. line-height: 42px;
  246. background-color: white;
  247. margin: 1px 0;
  248. .checkbox-cubes {
  249. width: 30px;
  250. height: 126px;
  251. position: absolute;
  252. .checkbox-box {
  253. /*宽高为0*/
  254. width: 0;
  255. height: 0;
  256. position: relative;
  257. /*在三角形底边设置一个边界颜色*/
  258. border-left: 28px solid skyblue;
  259. /*其它3边设置相同颜色,*/
  260. border-bottom: 25px solid transparent;
  261. }
  262. .checkbox-icon {
  263. height: 20px;
  264. position: absolute;
  265. top: 0;
  266. left: 3px;
  267. display: flex;
  268. align-items: center;
  269. font-size: 10px;
  270. font-weight: bold;
  271. color: white;
  272. }
  273. }
  274. .checkbox-panel {
  275. width: 100%;
  276. padding: 0 18px;
  277. .checkbox-panel-item {
  278. display: flex;
  279. justify-content: space-between;
  280. }
  281. }
  282. }
  283. }
  284. ::v-deep .uni-checkbox-input {
  285. border-radius: 50% !important;
  286. }
  287. </style>