scancodeCar.vue 9.3 KB

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