scancodeCar.vue 8.2 KB

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