scancodeCar.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450
  1. <template>
  2. <view>
  3. <uni-list :border="false">
  4. <uni-list-item v-for="(item,index) in breedTaskList" :key="item.id" :index="index" :threshold="0">
  5. <template slot="body">
  6. <uni-card>
  7. <u-row>
  8. <u-col span="10">
  9. <view class="demo-layout">
  10. <view>{{item.branchLineName}}<span>{{item.shipmentPackageCount}}</span>{{item.shipmentUnit}}</view>
  11. <view>{{item.erpOrderCode}}</view>
  12. <view>{{item.shipmentName}}</view>
  13. </view>
  14. </u-col>
  15. <u-col span="2">
  16. <u-button @click="deleteBtn(index)" size="small" type="warning" text="移除"></u-button>
  17. </u-col>
  18. </u-row>
  19. </uni-card>
  20. </template>
  21. </uni-list-item>
  22. </uni-list>
  23. <view class="footer">
  24. <view>
  25. <view>
  26. <text style="margin-top: -10rpx;" class="footer-text">包数:<span>{{totalUnit}}</span></text>
  27. </view>
  28. </view>
  29. <view @click="confirmOrderCodes">确认装车</view>
  30. </view>
  31. <uni-fab style="bottom: 100rpx;" ref="fab" :pattern="fabPattern" icon="color" :popMenu="false" horizontal="right" vertical="bottom"
  32. @fabClick="scanFabClick" />
  33. <u-notify ref="uNotify"></u-notify>
  34. </view>
  35. </template>
  36. <script>
  37. import request from '@/common/libs/request.js';
  38. export default {
  39. data() {
  40. return {
  41. token:"",
  42. totalUnit:0,
  43. hitOrders:[],
  44. fabPattern: {
  45. color: '#7A7E83',
  46. backgroundColor: '#fff',
  47. selectedColor: '#007AFF',
  48. buttonColor: '#007AFF',
  49. iconColor: '#fff'
  50. },
  51. idMachineInfo: 0,
  52. breedTaskList: [],
  53. feedBackPopupShow: false,
  54. focuseTask: {
  55. printBill:{},
  56. printBreed:{}
  57. },
  58. feedBackData: {
  59. feedBackCount: 0,
  60. feedBackComplete:[1],
  61. feedBackMemo: ''
  62. },
  63. feedBackCompleteStatus:[
  64. {
  65. text: '任务已完成',
  66. value: 1
  67. }
  68. ]
  69. }
  70. },
  71. onLoad() {
  72. // if (process.env.NODE_ENV === 'development') {
  73. // this.fillBreedTaskByMachine(2, 1);
  74. // }
  75. },
  76. mounted() {
  77. this.initData()
  78. },
  79. methods: {
  80. confirmOrderCodes(){
  81. let _that = this;
  82. var ids = [];
  83. if(_that.breedTaskList.length<=0){
  84. uni.showToast({
  85. title: "请先扫码",
  86. icon: 'none'
  87. })
  88. }
  89. for (let i = 0; i < _that.breedTaskList.length; i++) {
  90. ids.push(_that.breedTaskList[i].id)
  91. }
  92. let parms = {
  93. idBillItems: ids.join(','),
  94. token: _that.token
  95. }
  96. console.log(parms);
  97. request.httpPost("/dnyDriver/truckUp", parms, true).then(res => {
  98. console.log(res);
  99. _that.initData()
  100. if (res.httpCode == 200) {
  101. _that.hitOrders = [];
  102. _that.breedTaskList = [];
  103. _that.totalUnit=0;
  104. uni.showToast({
  105. title: "装车成功",
  106. })
  107. }else {
  108. uni.showToast({
  109. title: res.msg,
  110. icon: 'none',
  111. mask: true,
  112. duration: 3000,
  113. })
  114. }
  115. });
  116. },
  117. searchPrintBreed() {
  118. },
  119. initData(){
  120. let _that = this;
  121. request.httpPost("/dnyDriver/driverFormToken", {},true).then(tokenRes => {
  122. console.log(tokenRes)
  123. _that.token = tokenRes.data
  124. })
  125. },
  126. scanFabClick() {
  127. let _that = this;
  128. uni.scanCode({
  129. onlyFromCamera: true,
  130. scanType: ['barCode', 'qrCode'],
  131. success: function(res) {
  132. console.log("res",res);
  133. console.log(res.result)
  134. if (res.result.indexOf('sendOrder') != -1) {
  135. let idOrder = res.result.split("-")[2];
  136. console.log(idOrder)
  137. _that.truckUpOrder(idOrder)
  138. }else if(res.result.indexOf('orderLabel') != -1){
  139. let orderCode = res.result.split("-")[1];
  140. console.log(orderCode)
  141. _that.getShipDetails(orderCode)
  142. }
  143. }
  144. })
  145. },
  146. truckUpOrder(idOrder){
  147. let _that = this;
  148. let parms = {
  149. idOrder: idOrder
  150. }
  151. request.httpPost("/dnyDriver/truckUpScanSendOrder", parms, true).then(res => {
  152. if(res.httpCode==200){
  153. var datas = res.data.inputItemList;
  154. for (let i = 0; i < datas.length; i++) {
  155. var items = datas[i]
  156. var itemData = {
  157. 'branchLineName':items.branchLineName,
  158. 'shipmentName':items.shipmentName,
  159. 'shipmentPackageCount':items.shipmentPackageCount,
  160. 'erpOrderCode':items.erpOrderCode,
  161. 'shipmentUnit':items.shipmentUnit,
  162. 'id':items.id
  163. }
  164. if(!_that.breedTaskList.find(x => x.id === items.id)){
  165. _that.totalUnit+=items.shipmentPackageCount
  166. _that.breedTaskList.push(itemData)
  167. }else {
  168. uni.showToast({
  169. title: "此单已扫码",
  170. icon: 'none'
  171. })
  172. }
  173. }
  174. if(res.data.inputString){
  175. uni.showToast({
  176. title: res.data.inputString,
  177. icon: 'none',
  178. mask: true,
  179. duration: 4000,
  180. })
  181. }
  182. }else {
  183. uni.showToast({
  184. title: res.msg,
  185. icon: 'none',
  186. mask: true,
  187. duration: 4000,
  188. })
  189. }
  190. })
  191. },
  192. getShipDetails(orderCode) {
  193. let _that = this;
  194. let parms = {
  195. orderCode: orderCode
  196. }
  197. request.httpPost("/dnyDriver/truckUpScanERPOrder", parms, true).then(res => {
  198. if(res.httpCode==200){
  199. var datas = res.data.inputItemList;
  200. for (let i = 0; i < datas.length; i++) {
  201. var items = datas[i]
  202. var itemData = {
  203. 'branchLineName':items.branchLineName,
  204. 'shipmentName':items.shipmentName,
  205. 'shipmentPackageCount':items.shipmentPackageCount,
  206. 'shipmentUnit':items.shipmentUnit,
  207. 'erpOrderCode':items.erpOrderCode,
  208. 'id':items.id
  209. }
  210. if(!_that.breedTaskList.find(x => x.id === items.id)){
  211. _that.totalUnit+=items.shipmentPackageCount
  212. _that.breedTaskList.push(itemData)
  213. }else {
  214. uni.showToast({
  215. title: "此单已扫码",
  216. icon: 'none'
  217. })
  218. }
  219. }
  220. if(res.data.inputString){
  221. uni.showToast({
  222. title: res.data.inputString,
  223. icon: 'none',
  224. mask: true,
  225. duration: 4000,
  226. })
  227. }
  228. }else {
  229. uni.showToast({
  230. title: res.msg,
  231. icon: 'none',
  232. mask: true,
  233. duration: 4000,
  234. })
  235. }
  236. });
  237. },
  238. parseBreedTaskStatus(task) {
  239. if (task.pauseStatus == 0) {
  240. if (task.taskStatus == 0) {
  241. return "未开始";
  242. } else if (task.taskStatus == 1) {
  243. return "生产中";
  244. } else if (task.taskStatus == 2) {
  245. return "终止";
  246. } else if (task.taskStatus == 5) {
  247. return "完成";
  248. } else if (task.taskStatus == 10) {
  249. return "已完成";
  250. }
  251. } else {
  252. return "暂停";
  253. }
  254. },
  255. viewBreedTaskMore(task) {
  256. task.showMore = !task.showMore
  257. },
  258. deleteBtn(index){
  259. this.totalUnit = this.totalUnit-this.breedTaskList[index].shipmentPackageCount
  260. this.breedTaskList.splice(index, 1)
  261. this.hitOrders.splice(index, 1)
  262. },
  263. feedBackPopupClose() {
  264. this.feedBackPopupShow = false;
  265. console.log(JSON.stringify(this.feedBackData));
  266. },
  267. submitFeedBackForm(ref) {
  268. let _that = this;
  269. let isComplete = true;
  270. if (_that.feedBackData.feedBackComplete.length == 0) {
  271. isComplete = false
  272. }
  273. let postData = {
  274. item: JSON.stringify({
  275. idTask: _that.focuseTask.id,
  276. taskStatus: 1,
  277. isComplete: isComplete,
  278. feedbackCount:_that.feedBackData.feedBackCount,
  279. memo: _that.feedBackData.feedBackMemo
  280. })
  281. }
  282. request.httpPost("/printbill/feedbackTask", postData, true).then(resFeedBack => {
  283. if (resFeedBack.httpCode == 200) {
  284. _that.focuseTask.taskStatus = 1;
  285. uni.showToast({
  286. title:"反馈成功"
  287. })
  288. } else {
  289. uni.showToast({
  290. title: resFeedBack.msg
  291. })
  292. }
  293. });
  294. },
  295. viewBreedTaskDetail(task) {
  296. uni.navigateTo({
  297. url: "../printbill/detail?id=" + task.idPrintBill + "&billCode=" + task.printBill.billCode,
  298. animationType: 'pop-in'
  299. })
  300. },
  301. viewBreedTaskStep(task) {
  302. uni.navigateTo({
  303. url: "../printbill/step?id=" + task.idPrintBill + "&billCode=" + task.printBill.billCode,
  304. animationType: 'pop-in'
  305. })
  306. }
  307. }
  308. }
  309. </script>
  310. <style lang="scss" scoped>
  311. .footer-text span{
  312. font-weight: bold;
  313. color: #e4493c;
  314. padding: 0 10rpx;
  315. }
  316. .demo-layout span{
  317. font-weight: bold;
  318. color: #e4493c;
  319. padding: 0 10rpx;
  320. }
  321. .span-txt{
  322. font-weight: bold;
  323. color: #e4493c;
  324. }
  325. .demo-layout{
  326. font-size: 36rpx;
  327. }
  328. /deep/ .uni-card .uni-card__header{
  329. border-bottom: none !important;
  330. }
  331. /deep/ .uni-list-item__container {
  332. padding: 0rpx;
  333. }
  334. /deep/ .fab{
  335. .uniui-plusempty:before {
  336. //content: "\e67b";
  337. content: '\e654' !important;
  338. }
  339. }
  340. .card-actions {
  341. display: flex;
  342. flex-direction: row;
  343. justify-content: space-around;
  344. align-items: center;
  345. height: 45px;
  346. border-top: 1px #eee solid;
  347. }
  348. .card-actions-item {
  349. display: flex;
  350. flex-direction: row;
  351. align-items: center;
  352. }
  353. .card-actions-item-text {
  354. font-size: 12px;
  355. color: #666;
  356. margin-left: 5px;
  357. }
  358. .textTitle {
  359. border-left: 0px solid #007AFF;
  360. display: inline-block;
  361. width: 180rpx;
  362. text-align: left;
  363. margin-bottom: 5px;
  364. color: #8799a3;
  365. }
  366. .u-popup-slot {
  367. width: 750rpx;
  368. height: 400px;
  369. @include flex;
  370. justify-content: center;
  371. align-items: center;
  372. padding: 20px;
  373. }
  374. .footer {
  375. position: fixed;
  376. bottom: 0;
  377. z-index: 10;
  378. display: flex;
  379. justify-content: space-between;
  380. width: 100%;
  381. height: 108rpx;
  382. background: #FFFFFF;
  383. border-top: 1px solid #E8E8E8;
  384. >view {
  385. width: 50%;
  386. height: 100%;
  387. font-size: 34rpx;
  388. font-weight: 600;
  389. display: flex;
  390. justify-content: center;
  391. align-items: center;
  392. &:active {
  393. opacity: 0.8;
  394. }
  395. .cart {
  396. width: 67rpx;
  397. height: 67rpx;
  398. margin-top: 10rpx;
  399. margin-right: 25rpx;
  400. }
  401. .amout {
  402. font-size: 34rpx;
  403. >text {
  404. font-size: 20rpx;
  405. }
  406. }
  407. .badge {
  408. position: relative;
  409. >text {
  410. position: absolute;
  411. top: 2rpx;
  412. right: 10rpx;
  413. z-index: 10;
  414. font-size: 22rpx;
  415. background: #FF3D00;
  416. border-radius: 50%;
  417. color: #fff;
  418. padding: 0 10rpx 2rpx;
  419. }
  420. }
  421. }
  422. >view:last-child {
  423. background: #FFD202;
  424. }
  425. }
  426. </style>