index.vue 26 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007
  1. <template>
  2. <view class='container uni-column'>
  3. <view class='nav uni-row'>
  4. <view v-for="(item,index) in statusList" :key="index" :class="{'selecter':singleSelectd(item)}">
  5. <text @click='selectedStatus(item)'> {{item['name']}}</text>
  6. </view>
  7. </view>
  8. <!-- 待周转页面 -->
  9. <view class="padding-container" v-if='selectedInfo.id == 4'>
  10. <view class="scroll-container">
  11. <!-- <uni-section title="本地数据" type="line" padding style="height: calc(100vh - 100px);"> -->
  12. <!-- <uni-data-picker placeholder="请选车间与周转区" popup-title="请选择所在车间与周转区" :localdata="dataTree"
  13. v-model="classes" @change="onchange" @nodeclick="onnodeclick" @popupopened="onpopupopened"
  14. @popupclosed="onpopupclosed">
  15. </uni-data-picker> -->
  16. <view
  17. style="font-size: 30rpx;font-weight: bold; flex-direction: row; display: inline-block; line-height: 35px; height: 38px;">
  18. <uni-data-select v-model="workshopId" :localdata="dataTree" :clear="true" placeholder="请选择车间"
  19. @change="handleSelectedWorkshopChange" style="background-color: #ffffff;"></uni-data-select>
  20. <uni-data-select v-model="turnoverId" :localdata="dataChildren" :clear="true" plac
  21. placeholder="请选择周转区" @change="handleSelectedTurnoverIdChange"
  22. style="background-color: #ffffff;"></uni-data-select>
  23. </view>
  24. <!-- </uni-section> -->
  25. <view v-if="listData.length == 0" style="color: #999;margin: 50% auto;">
  26. <text>暂无待周转批次</text>
  27. </view>
  28. <view v-else v-for="(item, index) in listData" :key="index"
  29. :class="{'list-item':true,'selected':isSelected(item)}">
  30. <!-- @click="handleSelection(item)" -->
  31. <view class="title-container uni-row">
  32. <view class="title uni-row">
  33. <text class="label">{{ item['turnoverArea'] }}</text>
  34. <text class="label code">{{ item['preDeptName'] }}</text>
  35. <text class="label code" style="margin-left: 16rpx;">→</text>
  36. <text class="label code" style="margin-left: 16rpx;">{{ item['deptName'] }}</text>
  37. </view>
  38. <view class="right-info uni-row">
  39. <view class="uni-row"><text class="label right">待周转</text></view>
  40. </view>
  41. </view>
  42. <view class="item-info uni-row"> <text class="label ">批次</text>
  43. <text class="label right">{{ item['lotCode'] }}</text>
  44. </view>
  45. <view class="item-info uni-row"> <text class="label">箱数</text>
  46. <text class="label right ">{{ item['carriers'] }}</text>
  47. </view>
  48. <view class="item-info uni-row">
  49. <text class="label">数量</text>
  50. <text class="label right">{{ item['daywork'].temporaryProcessQualifiedNum }}</text>
  51. </view>
  52. <view class="item-info uni-row">
  53. <text class="label">箱号</text>
  54. <text class="label right">{{ item['carrierName']}}</text>
  55. </view>
  56. <view class="item-info uni-row">
  57. <text class="label">申请时间</text>
  58. <text class="label right">{{ item['startTime']}}</text>
  59. </view>
  60. <view class="item-info uni-row" style="align-items: center;">
  61. <text class="label">申请人</text>
  62. <text class="label right">{{ item['nickName']}}</text>
  63. <view class="uni-row">
  64. <button v-if="item['turnoverType'] == 2" size="mini" style="
  65. color: #ffffff;background-color: #1989fa;margin-right: 10rpx;"
  66. @click.stop="handleChangeDept(item)">变更工段</button>
  67. <button size="mini" @click.stop="handleClickProcessList(item)">&nbsp;工艺列表
  68. </button>
  69. </view>
  70. </view>
  71. </view>
  72. </view>
  73. <!-- 抽屉 -->
  74. <uni-drawer ref="showRight" mode="right" :mask-click="true">
  75. <view style="text-align: center; font-size: 48rpx; padding: 48rpx 0 24rpx 0;">工艺列表</view>
  76. <view style="font-size: 24rpx;text-align: center;color: red; margin-bottom: 16rpx;">
  77. 仅显示当前工序及后面工艺
  78. </view>
  79. <scroll-view scroll-y="true" style="height: 82%;" @touchmove.stop>
  80. <view v-for="(item,index) in curProcessAfte" :key="index"
  81. style="padding: 8rpx 5% 8rpx 14%; border-top: 1px solid #cccccc">
  82. <text>{{ index + 1 }}.{{item.processAlias}}</text>
  83. </view>
  84. </scroll-view>
  85. </uni-drawer>
  86. <view class="bottom-btn-container uni-row">
  87. <button class="bottom-btn" @click="handleStartTurn">开始周转</button>
  88. </view>
  89. </view>
  90. <!-- 周转中页面 -->
  91. <view class='turnover-container' v-if='selectedInfo.id == 5'>
  92. <view class="scroll-container">
  93. <view v-if="lotList.length == 0" style="color: #999;margin: 50% auto;">
  94. <text>暂无周转中批次</text>
  95. </view>
  96. <!-- 循环周转中的数据 -->
  97. <view v-else class='item-container'>
  98. <!-- <view v-if="products.length > 0" class="turnover-title uni-row">
  99. <view class="uni-row" style="align-items: center;">
  100. <view><text class='title-color'>{{turnoverContentTitle}}箱</text></view>
  101. <view><text class="second-info">{{turnoverSecondTitle}}</text></view>
  102. </view>
  103. <view><text class="label">周转中</text></view>
  104. </view> -->
  105. <view :class="{'list-container':true,'selected':isSelected(item)}" v-for="(item,index) in lotList"
  106. @click="handleSelection(item)" :key='index'>
  107. <view class="turnover-title uni-row">
  108. <view class="uni-row" style="align-items: center;">
  109. <view><text class='title-color'>{{ item[0]['totalCarrier'] }}箱</text></view>
  110. <view><text class="second-info">目标工段: {{ item[0].deptName }}</text>
  111. </view>
  112. </view>
  113. </view>
  114. <view v-for="(lot,index) in item" :key="index" style="margin-bottom: 10rpx;">
  115. <view class="list-container-item product-description uni-row">
  116. <text class="label left-value">产品描述</text>
  117. <text class="label right-value">{{lot['productDescription']}}</text>
  118. </view>
  119. <view class="list-container-item uni-row">
  120. <text class="label left-value">目标</text>
  121. <text class="label right-value">{{item[0].preDeptName + '→' + item[0].deptName }}</text>
  122. </view>
  123. <view class="list-container-item uni-row">
  124. <text class="label left-value">批次</text>
  125. <text class="label right-value">{{lot['lotCode']}}</text>
  126. </view>
  127. <view class="list-container-item uni-row">
  128. <text class="label left-value">箱数</text>
  129. <text class="label right-value">{{lot['carrierName'].split('、').length}}</text>
  130. </view>
  131. <view class="list-container-item uni-row">
  132. <text class="label left-value">箱号</text>
  133. <text class="label right-value">{{lot['carrierName']}}</text>
  134. </view>
  135. </view>
  136. </view>
  137. </view>
  138. </view>
  139. <!-- <view class='bottom-btn-container uni-row'>
  140. <button type='success' class='bottom-btn' @click="handleScan">扫码确认送达</button>
  141. </view> -->
  142. <view class='bottom-btn-container-2 uni-column'>
  143. <view class="bottom-btn-line uni-row">
  144. <button class='bottom-btn' @click="handleScan" style="background-color: #03d111;">扫码确认送达</button>
  145. </view>
  146. <view class="bottom-btn-line uni-row">
  147. <button type='primary' class='bottom-btn'
  148. @click="handleConfirm('确认送达',store.itemStatus.received)">确认送达</button>
  149. <button class='bottom-btn' @click="handleConfirm('取消周转',store.itemStatus.pendingTurnover,true)"
  150. style="margin-left: 24rpx;background-color: coral;">取消周转</button>
  151. </view>
  152. </view>
  153. </view>
  154. <!-- 已送达页面 -->
  155. <view class='turnover-container' v-if='selectedInfo.id == 7'>
  156. <view class="scroll-container">
  157. <view v-if="deliveredList.length == 0" style="color: #999;margin: 50% auto;">
  158. <text>暂无已送达批次</text>
  159. </view>
  160. <!-- 循环已送达的数据 -->
  161. <view v-else class='item-container'>
  162. <view :class="{'list-container':true,'selected':isSelectedDelivered(item)}"
  163. v-for="(item,index) in deliveredList" @click="handleSelectionDelivered(item)" :key='index'>
  164. <view class="list-container-item product-description uni-row">
  165. <text class="label left-value">周转路径</text>
  166. <text class="">{{item.preDeptName + '→' + item.deptName }}</text>
  167. </view>
  168. <view class="list-container-item product-description uni-row">
  169. <text class="label left-value">产品描述</text>
  170. <text class="label right-value">{{item['productDescription']}}</text>
  171. </view>
  172. <view class="list-container-item uni-row">
  173. <text class="label left-value">批次</text>
  174. <text class="label right-value">{{item['lotCode']}}</text>
  175. </view>
  176. <view class="list-container-item uni-row">
  177. <text class="label left-value">箱数</text>
  178. <text class="label right-value">{{item['carrierName'].split('、').length}}</text>
  179. </view>
  180. <view class="list-container-item uni-row">
  181. <text class="label left-value">箱号</text>
  182. <text class="label right-value">{{item['carrierName']}}</text>
  183. </view>
  184. </view>
  185. </view>
  186. </view>
  187. <view class='bottom-btn-container uni-row'>
  188. <button type='primary' class='bottom-btn'
  189. @click="handleConfirm('取消送达',store.itemStatus.turnoveing)">取消送达</button>
  190. </view>
  191. </view>
  192. </view>
  193. <dialog-turnoverTask ref="turnoverTask"></dialog-turnoverTask>
  194. <dialog-changeTurnover ref="changeTurnoverDialog" @reflushTurnoverList="reflush()" />
  195. <QrScanner v-if="showQrCodeReader" @decode="onDecodeHandler" @close="qrReaderClose" />
  196. </template>
  197. <script setup>
  198. import {
  199. ref
  200. } from 'vue'
  201. import {
  202. onLoad,
  203. onShow
  204. } from '@dcloudio/uni-app'
  205. // import pending from './pending';
  206. import QrScanner from '../vueQrCode/index.vue'
  207. import {
  208. getDayWorkItemList,
  209. getItemList,
  210. getHandlingByCarrierCode
  211. } from '@/api/business/dayWorkItem.js'
  212. import {
  213. isTakeStock
  214. } from '@/api/business/taksStackLot.js'
  215. import {
  216. debounce
  217. } from '@/utils/common.js'
  218. import {
  219. updateDayWorkItem,
  220. updateDayWorkItemBatch,
  221. updateBatchBack
  222. } from '@/api/business/dayWorkItem.js'
  223. import {
  224. getDictInfoByType
  225. } from '@/api/dict/dict.js'
  226. import {
  227. getTreeData
  228. } from '@/api/business/workshop.js'
  229. import {
  230. store
  231. } from '../../store'
  232. const classes = ref(null)
  233. const dataTree = ref([])
  234. const dataChildren = ref([])
  235. const sum = ref(0)
  236. const pendingClass = ref({
  237. selecter: true
  238. })
  239. const turnoverClass = ref({
  240. selecter: false
  241. })
  242. const changeTurnoverDialog = ref(null)
  243. const showQrCodeReader = ref(false);
  244. const selection = ref([])
  245. const selectedInfo = ref({})
  246. const curProcessAfte = ref([])
  247. const pendingShow = ref(true)
  248. const turnoverShow = ref(false)
  249. const listData = ref([])
  250. const products = ref([])
  251. const confirm = ref(null) // 弹窗组件
  252. const turnoverTask = ref(null) // 弹窗组件
  253. const lotList = ref([])
  254. const deliveredList = ref([])
  255. const showRight = ref(null) // 抽屉
  256. const workshopId = ref(null)
  257. const turnoverId = ref(null)
  258. const statusList = ref([{
  259. "id": 4,
  260. "name": "待周转"
  261. },
  262. {
  263. "id": 5,
  264. "name": "周转中"
  265. },
  266. // {
  267. // "id": 7,
  268. // "name": "已送达"
  269. // }
  270. ])
  271. onLoad(() => {
  272. selectedInfo.value = statusList.value[0]
  273. })
  274. onShow(() => {
  275. // init();
  276. getWorkShops()
  277. })
  278. function getWorkShops() {
  279. console.log('getWorkShops')
  280. getTreeData().then(res => {
  281. console.log(res)
  282. if (res.code === 200) {
  283. dataTree.value = res.data
  284. workshopId.value = dataTree.value[0].value
  285. dataChildren.value = dataTree.value[0].children
  286. turnoverId.value = dataChildren.value.length > 0 ? dataChildren.value[0].value : null
  287. handleSelectedTurnoverIdChange()
  288. }
  289. })
  290. }
  291. // function handleScan() {
  292. // console.log('scan')
  293. // }
  294. function init() {
  295. uni.showLoading({
  296. title: '加载中'
  297. })
  298. Promise.all([getItemList({
  299. status: 4,
  300. //turnoverType设置值是为了筛选掉车间内周转
  301. workshopId: workshopId.value,
  302. turnoverId: turnoverId.value,
  303. turnoverType: 1
  304. }), getItemList({
  305. status: 5,
  306. turnoverType: 1,
  307. updaterId: store.userInfo.userId
  308. }), getItemList({
  309. status: 7,
  310. turnoverType: 1,
  311. updaterId: store.userInfo.userId
  312. })])
  313. .then(([res1, res2, res3]) => {
  314. //待周转
  315. if (res1.code == 200) {
  316. listData.value = res1.rows;
  317. // 设置箱数
  318. for (var i = 0; i < listData.value.length; i++) {
  319. listData.value[i].carriers = listData.value[i].carrierName == null ? 0 : listData.value[i]
  320. .carrierName.split('、').length;
  321. }
  322. console.log("待周转任务", res1)
  323. }
  324. //周转
  325. if (res2.code == 200) {
  326. // 通过dayworkId再分组
  327. const groupedRows = res2.rows.reduce((acc, item) => {
  328. const dept = item.deptId;
  329. if (acc.hasOwnProperty(dept)) {
  330. acc[dept].push(item);
  331. } else {
  332. acc[dept] = [item];
  333. }
  334. return acc;
  335. }, {});
  336. // groupedRows 是一个对象,其键是dayworkId,值是具有相同dayworkId的对象数组
  337. // 如果需要将它转换为二维数组,您可以使用 Object.values 方法
  338. lotList.value = Object.values(groupedRows);
  339. // 设置箱数
  340. for (let i = 0; i < lotList.value.length; i++) {
  341. lotList.value[i][0].totalCarrier = 0;
  342. for (let j = 0; j < lotList.value[i].length; j++) {
  343. lotList.value[i][0].totalCarrier += lotList.value[i][j].carrierName.split('、').length;
  344. }
  345. }
  346. console.log(lotList.value)
  347. console.log(res2.rows)
  348. }
  349. if (res3.code == 200) {
  350. deliveredList.value = res3.rows;
  351. }
  352. uni.hideLoading();
  353. })
  354. }
  355. //变更工段
  356. function handleChangeDept(item) {
  357. changeTurnoverDialog.value.open(item)
  358. }
  359. function handleClickProcessList(item) {
  360. let curProcessAfterList = [];
  361. console.log("工序列表", item)
  362. let nextIndex = 0;
  363. for (let i = 0; i < item.processSequence.length; i++) {
  364. if (item.processStepNumber == item.processSequence[i].processStepNumber) {
  365. nextIndex = i;
  366. }
  367. }
  368. for (let i = 0; i < item.processSequence.length; i++) {
  369. if (i >= nextIndex) {
  370. curProcessAfterList.push(item.processSequence[i]);
  371. }
  372. }
  373. if (item.status == 3) {
  374. curProcessAfterList.splice(0, 1)
  375. }
  376. console.log(curProcessAfterList)
  377. curProcessAfte.value = curProcessAfterList;
  378. showRight.value.open();
  379. }
  380. function reflush() {
  381. // turnoverContentTitle.value = 0;
  382. lotList.value = [];
  383. init();
  384. }
  385. function handleStartTurn() {
  386. isTakeStock().then(response => {
  387. if (response.data) {
  388. uni.showToast({
  389. icon: 'none',
  390. title: '正在盘点,不能开始周转',
  391. duration: 2000
  392. })
  393. } else {
  394. // if(selection.value.length > 0){
  395. // let msg = '是否确认周转?';
  396. // confirm.value.open(msg);
  397. // }
  398. // turnoverTask.value.open(selection.value);
  399. uni.navigateTo({
  400. url: "/pages/startTurnover/index"
  401. })
  402. }
  403. })
  404. }
  405. /**
  406. * 确认后修改item方法
  407. * @param str 弹窗显示的内容
  408. * @param status 修改的状态
  409. * @param isBack 是否为回退修改
  410. */
  411. function handleConfirm(str, status, isBack = false) {
  412. if (selection.value.length > 0) {
  413. uni.showModal({
  414. title: '提示',
  415. content: `是否${str}?`,
  416. success: function(res) {
  417. if (res.confirm) {
  418. handleUpadteStatus(status, isBack);
  419. } else if (res.cancel) {
  420. }
  421. }
  422. })
  423. } else {
  424. uni.showToast({
  425. icon: 'none',
  426. title: `请选择后再点击${str}按钮`,
  427. duration: 2000
  428. })
  429. }
  430. }
  431. function handleUpadteStatus(status, isBack) {
  432. //盘点
  433. isTakeStock().then(response => {
  434. if (response.data) {
  435. uni.showToast({
  436. icon: 'none',
  437. title: '正在盘点,不能操作周转',
  438. duration: 2000
  439. })
  440. } else {
  441. // 设置周转状态
  442. for (let i = 0; i < selection.value.length; i++) {
  443. selection.value[i].status = status;
  444. }
  445. if (isBack) {
  446. updateBatchBack(selection.value).then(res => {
  447. if (res.code === 200) {
  448. uni.showToast({
  449. icon: 'success',
  450. title: '操作成功',
  451. duration: 2000
  452. });
  453. reflush();
  454. } else {
  455. uni.showToast({
  456. icon: 'none',
  457. title: '操作失败',
  458. duration: 2000
  459. });
  460. }
  461. })
  462. } else {
  463. updateDayWorkItemBatch(selection.value).then(res => {
  464. if (res.code === 200) {
  465. uni.showToast({
  466. icon: 'success',
  467. title: '操作成功',
  468. duration: 2000
  469. });
  470. reflush();
  471. } else {
  472. uni.showToast({
  473. icon: 'none',
  474. title: '操作失败',
  475. duration: 2000
  476. });
  477. }
  478. })
  479. }
  480. // 清空选中数组
  481. selection.value = [];
  482. }
  483. })
  484. }
  485. function isSelected(item) {
  486. //单选
  487. return selection.value == item;
  488. //多选
  489. // return selection.value.includes(item);
  490. }
  491. //H5扫码器回调
  492. function onDecodeHandler(data) {
  493. showQrCodeReader.value = false;
  494. let vehicleObj = {
  495. carrierCode: data
  496. };
  497. if (!vehicleObj.carrierCode || vehicleObj.carrierCode == "") {
  498. uni.showToast({
  499. icon: "none",
  500. title: "请扫载具码",
  501. duration: 1000
  502. })
  503. return;
  504. }
  505. getHandlingByCarrierCode({
  506. carrierCode: vehicleObj.carrierCode
  507. }).then(response => {
  508. if (response.code == 200) {
  509. uni.showToast({
  510. icon: 'success',
  511. title: '已送达',
  512. duration: 1000
  513. })
  514. reflush()
  515. debounce(handleScan, 700)
  516. } else {
  517. uni.showToast({
  518. icon: 'none',
  519. title: response.msg,
  520. duration: 2000
  521. })
  522. }
  523. }).catch(err => {
  524. console.log(err)
  525. uni.showToast({
  526. icon: 'none',
  527. title: err.message
  528. })
  529. })
  530. }
  531. //H5扫码器关闭
  532. function qrReaderClose() {
  533. showQrCodeReader.value = false;
  534. }
  535. async function handleScan() {
  536. // 先判断是否在盘点中假设不在盘点中则可以继续
  537. const res = await isTakeStock()
  538. if (res.data) {
  539. uni.showToast({
  540. icon: 'none',
  541. title: '正在盘点,不能操作周转',
  542. duration: 2000
  543. })
  544. return
  545. }
  546. showQrCodeReader.value = true;
  547. // const mpaasScanModule = uni.requireNativePlugin("Mpaas-Scan-Module");
  548. // if (mpaasScanModule) {
  549. // // 调用插件的 mpaasScan 方法
  550. // mpaasScanModule.mpaasScan({
  551. // // 扫码识别类型,参数可多选,qrCode、barCode,
  552. // // 如不设置,默认识别所有扫码类型,可能有些许影响识别效率
  553. // scanType: ["qrCode", "barCode"],
  554. // // 是否隐藏相册,默认false不隐藏
  555. // hideAlbum: false,
  556. // },
  557. // (ret) => {
  558. // let vehicleObj = {
  559. // carrierCode: ret.resp_result
  560. // };
  561. // if (!vehicleObj.carrierCode || vehicleObj.carrierCode == "") {
  562. // uni.showToast({
  563. // icon: "none",
  564. // title: "请扫载具码",
  565. // duration: 1000
  566. // })
  567. // return;
  568. // }
  569. // getHandlingByCarrierCode({
  570. // carrierCode: vehicleObj.carrierCode
  571. // }).then(response => {
  572. // if (response.code == 200) {
  573. // uni.showToast({
  574. // icon: 'success',
  575. // title: '已送达',
  576. // duration: 1000
  577. // })
  578. // reflush()
  579. // debounce(handleScan, 700)
  580. // } else {
  581. // uni.showToast({
  582. // icon: 'none',
  583. // title: response.msg,
  584. // duration: 2000
  585. // })
  586. // }
  587. // }).catch(err => {
  588. // console.log(err)
  589. // uni.showToast({
  590. // icon: 'none',
  591. // title: err.message
  592. // })
  593. // })
  594. // }
  595. // );
  596. // } else {
  597. // // 测试时用
  598. // getHandlingByCarrierCode({
  599. // carrierCode: '000828'
  600. // }).then(response => {
  601. // if (response.code == 200) {
  602. // uni.showToast({
  603. // icon: 'success',
  604. // title: '已送达'
  605. // })
  606. // reflush()
  607. // debounce(handleScan, 700)
  608. // } else {
  609. // uni.showToast({
  610. // icon: 'none',
  611. // title: response.msg,
  612. // duration: 2000
  613. // })
  614. // }
  615. // }).catch(err => {
  616. // console.log(err)
  617. // uni.showToast({
  618. // icon: 'none',
  619. // title: err.message
  620. // })
  621. // })
  622. // }
  623. }
  624. function handleSelection(item) {
  625. // 单选
  626. if (selection.value == item) {
  627. selection.value = []
  628. } else {
  629. selection.value = item;
  630. }
  631. console.log(selection.value, "selection");
  632. }
  633. function isSelectedDelivered(item) {
  634. //多选
  635. return selection.value.includes(item);
  636. }
  637. function handleSelectionDelivered(item) {
  638. //多选
  639. const buttonIndex = selection.value.findIndex(selectedItem => selectedItem === item);
  640. if (buttonIndex > -1) {
  641. selection.value.splice(buttonIndex, 1); // 取消选中
  642. } else {
  643. selection.value.push(item); // 选中
  644. }
  645. }
  646. function selectPending() {
  647. pendingClass.value['selecter'] = true;
  648. turnoverClass.value['selecter'] = false;
  649. pendingShow.value = true;
  650. turnoverShow.value = false;
  651. }
  652. function selectTurnover() {
  653. pendingClass.value['selecter'] = false;
  654. turnoverClass.value['selecter'] = true;
  655. pendingShow.value = false;
  656. turnoverShow.value = true;
  657. }
  658. function selectedStatus(item) {
  659. console.log(item)
  660. selectedInfo.value = item
  661. }
  662. function singleSelectd(item) {
  663. return selectedInfo.value == item
  664. }
  665. function onchange(e) {
  666. // console.log(e)
  667. // console.log(classes.value)
  668. if (e.detail.value.length == 0) {
  669. workshopId.value = null
  670. turnoverId.value = null
  671. } else if (e.detail.value.length == 1) {
  672. workshopId.value = classes.value
  673. turnoverId.value = null
  674. } else if (e.detail.value.length == 2) {
  675. turnoverId.value = classes.value
  676. }
  677. console.log(workshopId.value)
  678. console.log(turnoverId.value)
  679. reflush()
  680. }
  681. function onpopupopened(e) {
  682. // console.log('popupopend', e)
  683. }
  684. function onpopupclosed(e) {
  685. // console.log('onpopupclosed', e)
  686. }
  687. function onnodeclick(e) {
  688. // console.log('nodeclick', e)
  689. }
  690. function handleSelectedWorkshopChange() {
  691. const item = dataTree.value.find(e => e.value == workshopId.value)
  692. if (item != null) {
  693. dataChildren.value = item.children
  694. const currentItem = dataChildren.value.find(e => e.value == turnoverId.value)
  695. turnoverId.value = currentItem != null ? turnoverId.value : null
  696. } else {
  697. turnoverId.value = null
  698. dataChildren.value = []
  699. }
  700. reflush()
  701. }
  702. function handleSelectedTurnoverIdChange() {
  703. reflush()
  704. }
  705. </script>
  706. <style lang="scss">
  707. $navHeight: 48rpx;
  708. /* 导航栏样式 */
  709. .container {
  710. // height: calc(100% - $navHeight);
  711. // height: 1500rpx;
  712. // position: relative;
  713. // top: $navHeight;
  714. position: absolute;
  715. left: 0;
  716. top: 1.5rem;
  717. right: 0;
  718. height: 96%;
  719. background-color: #f5f5f5;
  720. }
  721. .selected {
  722. border: 1px solid #1684fc;
  723. border-radius: 8rpx;
  724. padding: 8rpx;
  725. }
  726. .nav {
  727. justify-content: space-around;
  728. // position: fixed;
  729. // top:0;
  730. width: 100%;
  731. height: $navHeight;
  732. border-bottom: 3rpx solid rgba(228, 231, 237, 1);
  733. background-color: rgba(255, 255, 255, 1);
  734. .img {
  735. width: 24rpx;
  736. height: 24rpx;
  737. position: fixed;
  738. right: 10rpx;
  739. top: 0;
  740. }
  741. }
  742. .selecter {
  743. height: 48rpx;
  744. color: rgba(25, 137, 250, 1);
  745. border-bottom: 3rpx solid rgba(25, 137, 250, 1);
  746. }
  747. /* 待周转样式 */
  748. .padding-container,
  749. .turnover-container {
  750. height: 90%;
  751. // position: absolute;
  752. // top: 56rpx;
  753. // right: 0;
  754. // bottom: 0rpx;
  755. // left: 0;
  756. background-color: #f5f5f5;
  757. .scroll-container {
  758. position: absolute;
  759. top: 24rpx;
  760. right: 0;
  761. bottom: 136rpx;
  762. left: 0;
  763. }
  764. .bottom-btn-container {
  765. height: 10%;
  766. position: fixed;
  767. right: 0;
  768. bottom: 0;
  769. left: 0;
  770. height: 80rpx;
  771. border-top: 1px solid #999999;
  772. padding: 16rpx 32rpx;
  773. align-items: center;
  774. background-color: #fff;
  775. .bottom-btn {
  776. // padding-left: 0;
  777. // padding-top: 4rpx;
  778. flex: 1;
  779. font-size: 28rpx;
  780. color: #FFFFFF;
  781. background-color: #1684fc;
  782. }
  783. }
  784. .bottom-btn-container-2 {
  785. // height: 50px;
  786. position: fixed;
  787. right: 0;
  788. bottom: 0;
  789. left: 0;
  790. height: 140rpx;
  791. border-top: 1px solid #999999;
  792. padding: 16rpx 32rpx;
  793. align-items: center;
  794. background-color: #fff;
  795. .bottom-btn-line {
  796. display: flex;
  797. width: 100%;
  798. .bottom-btn {
  799. // padding-left: 0;
  800. // padding-top: 4rpx;
  801. flex: 1;
  802. width: 100%;
  803. font-size: 28rpx;
  804. color: #FFFFFF;
  805. background-color: #1684fc;
  806. margin-bottom: 4rpx;
  807. }
  808. .bottom-btn .success {
  809. background-color: #03d111;
  810. }
  811. }
  812. }
  813. }
  814. .padding-container {
  815. .scroll-container {
  816. max-height: 90%;
  817. overflow: auto;
  818. .list-item {
  819. background-color: #fff;
  820. padding: 0 24rpx;
  821. padding-bottom: 24rpx;
  822. margin: 0 24rpx;
  823. margin-bottom: 24rpx;
  824. border-radius: 8rpx;
  825. .title-container {
  826. justify-content: space-between;
  827. margin-top: 8rpx;
  828. margin-bottom: 16rpx;
  829. .title {
  830. height: 48rpx;
  831. align-items: center;
  832. .label {
  833. color: #1684fc;
  834. font-size: 32rpx;
  835. font-weight: bold;
  836. &.code {
  837. color: #000000;
  838. margin-left: 32rpx;
  839. }
  840. }
  841. }
  842. }
  843. .item-info {
  844. margin-bottom: 16rpx;
  845. .label {
  846. font-size: 28rpx;
  847. width: 160rpx;
  848. color: #808080;
  849. &.right {
  850. flex: 1;
  851. color: #000000;
  852. }
  853. }
  854. }
  855. .right-info {
  856. justify-content: flex-end;
  857. margin-top: 2rpx;
  858. .label {
  859. font-size: 28rpx;
  860. color: #808080;
  861. }
  862. }
  863. }
  864. }
  865. }
  866. /* 周转中样式 */
  867. .turnover-container {
  868. .scroll-container {
  869. height: 90%;
  870. overflow: scroll;
  871. .item-container {
  872. // height: 90%;
  873. // padding: 8rpx 0 32rpx 0;
  874. margin: 0 24rpx;
  875. margin-bottom: 24rpx;
  876. background-color: rgba(255, 255, 255, 1);
  877. border-radius: 8rpx;
  878. .turnover-title {
  879. width: auto;
  880. justify-content: space-between;
  881. margin: 16rpx;
  882. font-weight: bold;
  883. .label {
  884. font-size: 28rpx;
  885. color: #808080;
  886. }
  887. }
  888. .list-container {
  889. // margin: 16rpx 24rpx 16rpx 24rpx;
  890. width: calc(100% - 48rpx);
  891. margin: 16rpx auto;
  892. .list-container-item {
  893. border-bottom: 1px solid #999999;
  894. padding: 12rpx 8rpx;
  895. background-color: #EEF0F5;
  896. &.product-description {
  897. background-color: #ECF5FF;
  898. }
  899. .label {
  900. font-size: 28rpx;
  901. color: #999999;
  902. &.left-value {
  903. width: 152rpx;
  904. }
  905. &.right-value {
  906. flex: 1;
  907. color: #000000;
  908. }
  909. }
  910. }
  911. }
  912. .title-color {
  913. color: rgba(22, 132, 252, 1);
  914. font-size: 36rpx;
  915. font-weight: bold;
  916. }
  917. .second-info {
  918. font-size: 36rpx;
  919. font-weight: bold;
  920. margin-left: 32rpx;
  921. }
  922. .turnover-info {
  923. color: rgba(128, 128, 128, 1);
  924. position: absolute;
  925. top: 10rpx;
  926. right: 40rpx;
  927. font-size: 30rpx;
  928. }
  929. }
  930. }
  931. }
  932. </style>