scancodeCar.vue 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359
  1. <template>
  2. <view style="padding-bottom:118rpx;">
  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-loading-page :loading="loading"></u-loading-page>
  34. </view>
  35. </template>
  36. <script>
  37. import request from '@/common/libs/request.js';
  38. export default {
  39. data() {
  40. return {
  41. loading:false,
  42. token:"",
  43. totalUnit:0,
  44. fabPattern: {
  45. color: '#7A7E83',
  46. backgroundColor: '#fff',
  47. selectedColor: '#007AFF',
  48. buttonColor: '#007AFF',
  49. iconColor: '#fff'
  50. },
  51. breedTaskList: []
  52. }
  53. },
  54. mounted() {
  55. this.initData()
  56. },
  57. methods: {
  58. confirmOrderCodes(){
  59. let _that = this;
  60. var ids = [];
  61. if(_that.breedTaskList.length<=0){
  62. uni.showToast({
  63. title: "请先扫码",
  64. icon: 'none'
  65. })
  66. return
  67. }
  68. _that.loading = true;
  69. for (let i = 0; i < _that.breedTaskList.length; i++) {
  70. ids.push(_that.breedTaskList[i].id)
  71. }
  72. let parms = {
  73. idBillItems: ids.join(','),
  74. token: _that.token
  75. }
  76. request.httpPost("/dnyDriver/truckUp", parms, true).then(res => {
  77. _that.loading = false;
  78. _that.breedTaskList = [];
  79. _that.initData()
  80. if (res.httpCode == 200) {
  81. _that.breedTaskList = [];
  82. _that.totalUnit=0;
  83. uni.showToast({
  84. title: "装车成功",
  85. })
  86. }else {
  87. uni.showToast({
  88. title: res.msg,
  89. icon: 'none',
  90. mask: true,
  91. duration: 3000,
  92. })
  93. }
  94. });
  95. },
  96. initData(){
  97. let _that = this;
  98. request.httpPost("/dnyDriver/driverFormToken", {},true).then(tokenRes => {
  99. _that.token = tokenRes.data
  100. })
  101. },
  102. scanFabClick() {
  103. let _that = this;
  104. uni.scanCode({
  105. onlyFromCamera: true,
  106. scanType: ['barCode', 'qrCode'],
  107. success: function(res) {
  108. if (res.result.indexOf('sendOrder') != -1) {
  109. let idOrder = res.result.split("-")[2];
  110. _that.truckUpOrder(idOrder)
  111. }else if(res.result.indexOf('orderLabel') != -1){
  112. let orderCode = res.result.split("-")[1];
  113. _that.getShipDetails(orderCode)
  114. }else {
  115. uni.showToast({
  116. title: "请扫包上的标签码",
  117. icon: 'none'
  118. })
  119. }
  120. }
  121. })
  122. },
  123. truckUpOrder(idOrder){
  124. let _that = this;
  125. let parms = {
  126. idOrder: idOrder
  127. }
  128. request.httpPost("/dnyDriver/truckUpScanSendOrder", parms, true).then(res => {
  129. if(res.httpCode==200){
  130. var datas = res.data.inputItemList;
  131. for (let i = 0; i < datas.length; i++) {
  132. var items = datas[i]
  133. var itemData = {
  134. 'branchLineName':items.branchLineName,
  135. 'shipmentName':items.shipmentName,
  136. 'shipmentPackageCount':items.shipmentPackageCount,
  137. 'erpOrderCode':items.erpOrderCode,
  138. 'shipmentUnit':items.shipmentUnit,
  139. 'id':items.id
  140. }
  141. if(!_that.breedTaskList.find(x => x.id === items.id)){
  142. _that.totalUnit+=items.shipmentPackageCount
  143. _that.breedTaskList.push(itemData)
  144. }else {
  145. uni.showToast({
  146. title: "此单已扫码",
  147. icon: 'none'
  148. })
  149. }
  150. }
  151. if(res.data.inputString){
  152. uni.showToast({
  153. title: res.data.inputString,
  154. icon: 'none',
  155. mask: true,
  156. duration: 5000,
  157. })
  158. }
  159. }else {
  160. uni.showToast({
  161. title: res.msg,
  162. icon: 'none',
  163. mask: true,
  164. duration: 4000,
  165. })
  166. }
  167. })
  168. },
  169. getShipDetails(orderCode) {
  170. let _that = this;
  171. let parms = {
  172. orderCode: orderCode
  173. }
  174. request.httpPost("/dnyDriver/truckUpScanERPOrder", parms, true).then(res => {
  175. if(res.httpCode==200){
  176. var datas = res.data.inputItemList;
  177. for (let i = 0; i < datas.length; i++) {
  178. var items = datas[i]
  179. var itemData = {
  180. 'branchLineName':items.branchLineName,
  181. 'shipmentName':items.shipmentName,
  182. 'shipmentPackageCount':items.shipmentPackageCount,
  183. 'shipmentUnit':items.shipmentUnit,
  184. 'erpOrderCode':items.erpOrderCode,
  185. 'id':items.id
  186. }
  187. if(!_that.breedTaskList.find(x => x.id === items.id)){
  188. _that.totalUnit+=items.shipmentPackageCount
  189. _that.breedTaskList.push(itemData)
  190. }else {
  191. uni.showToast({
  192. title: "此单已扫码",
  193. icon: 'none'
  194. })
  195. }
  196. }
  197. if(res.data.inputString){
  198. uni.showToast({
  199. title: res.data.inputString,
  200. icon: 'none',
  201. mask: true,
  202. duration: 4000,
  203. })
  204. }
  205. }else {
  206. uni.showToast({
  207. title: res.msg,
  208. icon: 'none',
  209. mask: true,
  210. duration: 4000,
  211. })
  212. }
  213. });
  214. },
  215. deleteBtn(index){
  216. this.totalUnit = this.totalUnit-this.breedTaskList[index].shipmentPackageCount
  217. this.breedTaskList.splice(index, 1)
  218. },
  219. }
  220. }
  221. </script>
  222. <style lang="scss" scoped>
  223. .footer-text span{
  224. font-weight: bold;
  225. color: #e4493c;
  226. padding: 0 10rpx;
  227. }
  228. .demo-layout span{
  229. font-weight: bold;
  230. color: #e4493c;
  231. padding: 0 10rpx;
  232. }
  233. .span-txt{
  234. font-weight: bold;
  235. color: #e4493c;
  236. }
  237. .demo-layout{
  238. font-size: 36rpx;
  239. }
  240. /deep/ .uni-card .uni-card__header{
  241. border-bottom: none !important;
  242. }
  243. /deep/ .uni-list-item__container {
  244. padding: 0rpx;
  245. }
  246. /deep/ .fab{
  247. .uniui-plusempty:before {
  248. //content: "\e67b";
  249. content: '\e654' !important;
  250. }
  251. }
  252. .card-actions {
  253. display: flex;
  254. flex-direction: row;
  255. justify-content: space-around;
  256. align-items: center;
  257. height: 45px;
  258. border-top: 1px #eee solid;
  259. }
  260. .card-actions-item {
  261. display: flex;
  262. flex-direction: row;
  263. align-items: center;
  264. }
  265. .card-actions-item-text {
  266. font-size: 12px;
  267. color: #666;
  268. margin-left: 5px;
  269. }
  270. .textTitle {
  271. border-left: 0px solid #007AFF;
  272. display: inline-block;
  273. width: 180rpx;
  274. text-align: left;
  275. margin-bottom: 5px;
  276. color: #8799a3;
  277. }
  278. .u-popup-slot {
  279. width: 750rpx;
  280. height: 400px;
  281. @include flex;
  282. justify-content: center;
  283. align-items: center;
  284. padding: 20px;
  285. }
  286. .footer {
  287. position: fixed;
  288. bottom: 0;
  289. z-index: 10;
  290. display: flex;
  291. justify-content: space-between;
  292. width: 100%;
  293. height: 108rpx;
  294. background: #FFFFFF;
  295. border-top: 1px solid #E8E8E8;
  296. >view {
  297. width: 50%;
  298. height: 100%;
  299. font-size: 34rpx;
  300. font-weight: 600;
  301. display: flex;
  302. justify-content: center;
  303. align-items: center;
  304. &:active {
  305. opacity: 0.8;
  306. }
  307. .cart {
  308. width: 67rpx;
  309. height: 67rpx;
  310. margin-top: 10rpx;
  311. margin-right: 25rpx;
  312. }
  313. .amout {
  314. font-size: 34rpx;
  315. >text {
  316. font-size: 20rpx;
  317. }
  318. }
  319. .badge {
  320. position: relative;
  321. >text {
  322. position: absolute;
  323. top: 2rpx;
  324. right: 10rpx;
  325. z-index: 10;
  326. font-size: 22rpx;
  327. background: #FF3D00;
  328. border-radius: 50%;
  329. color: #fff;
  330. padding: 0 10rpx 2rpx;
  331. }
  332. }
  333. }
  334. >view:last-child {
  335. background: #FFD202;
  336. }
  337. }
  338. </style>