print.vue 7.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307
  1. <template>
  2. <view style="padding-bottom:118rpx;">
  3. <uni-list :border="false">
  4. <view v-if="branchLineName" class="branch-tit">{{branchLineName}}-{{deliveryBillCode}}</view>
  5. <uni-list-item v-for="(item,index) in breedTaskList" :key="item.id" :index="index" :threshold="0">
  6. <template slot="body">
  7. <uni-card>
  8. <u-row>
  9. <u-col span="12">
  10. <view class="demo-layout">
  11. <view><span>{{item.shipmentPackageCount}}</span>{{item.shipmentUnit}}</view>
  12. <view>{{item.erpOrderCode}}</view>
  13. <view>{{item.shipmentName}}</view>
  14. <view style="font-size: 28rpx">{{item.receiveAddress}}</view>
  15. </view>
  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 style="padding: 10rpx 0">
  25. <text class="footer-text">包&nbsp;&nbsp;&nbsp;&nbsp;数:<span>{{totalUnit}}</span></text><br>
  26. <text class="footer-text">订单数:<span>{{breedTaskList.length}}</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. token:"",
  42. loading:false,
  43. branchLineName:'',
  44. deliveryBillCode:'',
  45. totalUnit:0,
  46. fabPattern: {
  47. color: '#7A7E83',
  48. backgroundColor: '#fff',
  49. selectedColor: '#007AFF',
  50. buttonColor: '#007AFF',
  51. iconColor: '#fff'
  52. },
  53. breedTaskList: []
  54. }
  55. },
  56. mounted() {
  57. this.initData()
  58. },
  59. methods: {
  60. confirmOrderCodes(){
  61. let _that = this;
  62. var ids = [];
  63. if(_that.breedTaskList.length<=0){
  64. uni.showToast({
  65. title: "请先扫码",
  66. icon: 'none'
  67. })
  68. return
  69. }
  70. _that.loading = true;
  71. for (let i = 0; i < _that.breedTaskList.length; i++) {
  72. ids.push(_that.breedTaskList[i].id)
  73. }
  74. let parms = {
  75. idBillItems: ids.join(','),
  76. token: _that.token
  77. }
  78. request.httpPost("/dnyDriver/handOverBillItems", parms, true).then(res => {
  79. _that.loading = false;
  80. _that.initData()
  81. if (res.httpCode == 200) {
  82. _that.breedTaskList = [];
  83. _that.branchLineName = "";
  84. _that.deliveryBillCode = "";
  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. // console.log(res);
  112. if (res.result.indexOf('dnySendBill') != -1) {
  113. let qrCode = res.result
  114. _that.truckUpOrder(qrCode)
  115. }else {
  116. uni.showToast({
  117. title: "请扫送货单的码",
  118. icon: 'none'
  119. })
  120. }
  121. }
  122. })
  123. },
  124. truckUpOrder(qrCode){
  125. let _that = this;
  126. _that.loading = true;
  127. let parms = {
  128. qrCode: qrCode
  129. }
  130. request.httpPost("/dnyDriver/handOverScanBillBranch", parms, true).then(res => {
  131. // console.log("25111",res);
  132. _that.loading = false
  133. _that.breedTaskList = [];
  134. _that.totalUnit = 0;
  135. if(res.httpCode==200){
  136. var datas = res.data;
  137. _that.branchLineName = datas[0].branchLineName
  138. _that.deliveryBillCode = datas[0].deliveryBillCode
  139. for (let i = 0; i < datas.length; i++) {
  140. var items = datas[i]
  141. var itemData = {
  142. 'erpOrderCode':items.erpOrderCode,//发货单号
  143. 'receiveAddress':items.receiveAddress,
  144. 'shipmentPackageCount':items.shipmentPackageCount,
  145. 'shipmentUnit':items.shipmentUnit,
  146. 'shipmentName':items.shipmentName,
  147. 'id':items.id
  148. }
  149. _that.totalUnit+=items.shipmentPackageCount
  150. _that.breedTaskList.push(itemData)
  151. }
  152. }else {
  153. uni.showToast({
  154. title: res.msg,
  155. icon: 'none',
  156. mask: true,
  157. duration: 4000,
  158. })
  159. }
  160. })
  161. },
  162. deleteBtn(index){
  163. this.totalUnit = this.totalUnit-this.breedTaskList[index].shipmentPackageCount
  164. this.breedTaskList.splice(index, 1)
  165. },
  166. }
  167. }
  168. </script>
  169. <style lang="scss" scoped>
  170. .branch-tit{
  171. font-size: 36rpx;
  172. margin-left: 10rpx;
  173. padding-top: 20rpx;
  174. }
  175. .footer-text{
  176. line-height: 18rpx;
  177. }
  178. .footer-text span{
  179. font-weight: bold;
  180. color: #e4493c;
  181. }
  182. .demo-layout span{
  183. font-weight: bold;
  184. color: #e4493c;
  185. padding: 0 5rpx;
  186. }
  187. .span-txt{
  188. font-weight: bold;
  189. color: #e4493c;
  190. }
  191. .demo-layout{
  192. font-size: 36rpx;
  193. }
  194. /deep/ .uni-card .uni-card__header{
  195. border-bottom: none !important;
  196. }
  197. /deep/ .uni-list-item__container {
  198. padding: 0rpx;
  199. }
  200. /deep/ .fab{
  201. .uniui-plusempty:before {
  202. //content: "\e67b";
  203. content: '\e654' !important;
  204. }
  205. }
  206. .card-actions {
  207. display: flex;
  208. flex-direction: row;
  209. justify-content: space-around;
  210. align-items: center;
  211. height: 45px;
  212. border-top: 1px #eee solid;
  213. }
  214. .card-actions-item {
  215. display: flex;
  216. flex-direction: row;
  217. align-items: center;
  218. }
  219. .card-actions-item-text {
  220. font-size: 12px;
  221. color: #666;
  222. margin-left: 5px;
  223. }
  224. .textTitle {
  225. border-left: 0px solid #007AFF;
  226. display: inline-block;
  227. width: 180rpx;
  228. text-align: left;
  229. margin-bottom: 5px;
  230. color: #8799a3;
  231. }
  232. .u-popup-slot {
  233. width: 750rpx;
  234. height: 400px;
  235. @include flex;
  236. justify-content: center;
  237. align-items: center;
  238. padding: 20px;
  239. }
  240. .footer {
  241. position: fixed;
  242. bottom: 0;
  243. z-index: 10;
  244. display: flex;
  245. justify-content: space-between;
  246. width: 100%;
  247. height: 108rpx;
  248. background: #FFFFFF;
  249. border-top: 1px solid #E8E8E8;
  250. >view {
  251. width: 50%;
  252. height: 100%;
  253. font-size: 34rpx;
  254. font-weight: 600;
  255. display: flex;
  256. justify-content: center;
  257. align-items: center;
  258. &:active {
  259. opacity: 0.8;
  260. }
  261. .cart {
  262. width: 67rpx;
  263. height: 67rpx;
  264. margin-top: 10rpx;
  265. margin-right: 25rpx;
  266. }
  267. .amout {
  268. font-size: 34rpx;
  269. >text {
  270. font-size: 20rpx;
  271. }
  272. }
  273. .badge {
  274. position: relative;
  275. >text {
  276. position: absolute;
  277. top: 2rpx;
  278. right: 10rpx;
  279. z-index: 10;
  280. font-size: 22rpx;
  281. background: #FF3D00;
  282. border-radius: 50%;
  283. color: #fff;
  284. padding: 0 10rpx 2rpx;
  285. }
  286. }
  287. }
  288. >view:last-child {
  289. background: #FFD202;
  290. }
  291. }
  292. </style>