scancodeCar.vue 8.3 KB

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