| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388 |
- <template>
- <view>
- <uni-list :border="false">
- <uni-list-item v-for="(item,index) in breedTaskList" :key="item.id" :index="index" :threshold="0">
- <template slot="body">
- <uni-card>
- <u-row>
- <u-col span="10">
- <view class="demo-layout">
- <view>{{item.branchLineName}}<span>{{item.shipmentPackageCount}}</span>{{item.shipmentUnit}}</view>
- <view>{{item.shipmentName}}</view>
- </view>
- </u-col>
- <u-col span="2">
- <u-button @click="deleteBtn(index)" size="small" type="warning" text="移除"></u-button>
- </u-col>
- </u-row>
- </uni-card>
- </template>
- </uni-list-item>
- </uni-list>
- <view class="footer">
- <view>
- <view>
- <text style="margin-top: -10rpx;" class="footer-text">包数:<span>{{totalUnit}}</span></text>
- </view>
- </view>
- <view @click="confirmOrderCodes">确认装车</view>
- </view>
- <uni-fab style="bottom: 100rpx;" ref="fab" :pattern="fabPattern" icon="color" :popMenu="false" horizontal="right" vertical="bottom"
- @fabClick="scanFabClick" />
- <u-notify ref="uNotify"></u-notify>
- </view>
- </template>
- <script>
- import request from '@/common/libs/request.js';
- export default {
- data() {
- return {
- token:"",
- totalUnit:0,
- hitOrders:[],
- fabPattern: {
- color: '#7A7E83',
- backgroundColor: '#fff',
- selectedColor: '#007AFF',
- buttonColor: '#007AFF',
- iconColor: '#fff'
- },
- idMachineInfo: 0,
- breedTaskList: [],
- feedBackPopupShow: false,
- focuseTask: {
- printBill:{},
- printBreed:{}
- },
- feedBackData: {
- feedBackCount: 0,
- feedBackComplete:[1],
- feedBackMemo: ''
- },
- feedBackCompleteStatus:[
- {
- text: '任务已完成',
- value: 1
- }
- ]
- }
- },
- onLoad() {
- // if (process.env.NODE_ENV === 'development') {
- // this.fillBreedTaskByMachine(2, 1);
- // }
- },
- mounted() {
- this.initData()
- },
- methods: {
- confirmOrderCodes(){
- let _that = this;
- var ids = [];
- if(_that.breedTaskList.length<=0){
- uni.showToast({
- title: "请先扫码",
- icon: 'none'
- })
- }
- for (let i = 0; i < _that.breedTaskList.length; i++) {
- ids.push(_that.breedTaskList[i].id)
- }
- let parms = {
- idBillItems: ids.join(','),
- token: _that.token
- }
- console.log(parms);
- request.httpPost("/dnyDriver/truckUp", parms, true).then(res => {
- console.log(res);
- _that.initData()
- if (res.httpCode == 200) {
- _that.hitOrders = [];
- _that.breedTaskList = [];
- _that.totalUnit=0;
- uni.showToast({
- title: "装车成功",
- })
- }else {
- uni.showToast({
- title: res.msg,
- icon: 'none',
- mask: true,
- duration: 3000,
- })
- }
- });
- },
- searchPrintBreed() {
- },
- initData(){
- let _that = this;
- request.httpPost("/dnyDriver/driverFormToken", {},true).then(tokenRes => {
- console.log(tokenRes)
- _that.token = tokenRes.data
- })
- },
- scanFabClick() {
- let _that = this;
- uni.scanCode({
- onlyFromCamera: true,
- scanType: ['barCode', 'qrCode'],
- success: function(res) {
- if (res.result.match(new RegExp("^sendOrder.*$"))) {
- console.log(res.result)
- let idOrder = res.result.split("-")[2];
- console.log(idOrder)
- console.log(_that.hitOrders)
- if(_that.hitOrders.indexOf(idOrder)==-1){
- _that.hitOrders.push(idOrder)
- _that.getShipDetails(idOrder)
- }else {
- uni.showToast({
- title: "此单已扫码",
- icon: 'none'
- })
- }
- }
- }
- })
- },
- getShipDetails(idOrder) {
- let _that = this;
- let parms = {
- idOrder: idOrder
- }
- console.log(parms);
- request.httpPost("/dnyDriver/scanOrderCode", parms, true).then(res => {
- console.log(res);
- if (res.httpCode == 200) {
- console.log(res.data);
- var datas = res.data;
- var itemData = {
- 'branchLineName':datas.branchLineName,
- 'shipmentName':datas.shipmentName,
- 'shipmentPackageCount':datas.shipmentPackageCount,
- 'shipmentUnit':datas.shipmentUnit,
- 'id':datas.id
- }
- _that.totalUnit+=datas.shipmentPackageCount
- _that.breedTaskList.push(itemData)
- console.log(_that.breedTaskList);
- }else {
- if(_that.hitOrders.length>0){
- _that.hitOrders.pop()
- }else {
- _that.hitOrders = [];
- }
-
- _that.$refs.uNotify.warning(res.msg)
- }
- });
- },
- parseBreedTaskStatus(task) {
- if (task.pauseStatus == 0) {
- if (task.taskStatus == 0) {
- return "未开始";
- } else if (task.taskStatus == 1) {
- return "生产中";
- } else if (task.taskStatus == 2) {
- return "终止";
- } else if (task.taskStatus == 5) {
- return "完成";
- } else if (task.taskStatus == 10) {
- return "已完成";
- }
- } else {
- return "暂停";
- }
- },
- viewBreedTaskMore(task) {
- task.showMore = !task.showMore
- },
-
- deleteBtn(index){
- this.totalUnit = this.totalUnit-this.breedTaskList[index].shipmentPackageCount
- this.breedTaskList.splice(index, 1)
- this.hitOrders.splice(index, 1)
-
-
- },
- feedBackPopupClose() {
- this.feedBackPopupShow = false;
- console.log(JSON.stringify(this.feedBackData));
- },
- submitFeedBackForm(ref) {
- let _that = this;
- let isComplete = true;
- if (_that.feedBackData.feedBackComplete.length == 0) {
- isComplete = false
- }
- let postData = {
- item: JSON.stringify({
- idTask: _that.focuseTask.id,
- taskStatus: 1,
- isComplete: isComplete,
- feedbackCount:_that.feedBackData.feedBackCount,
- memo: _that.feedBackData.feedBackMemo
- })
- }
- request.httpPost("/printbill/feedbackTask", postData, true).then(resFeedBack => {
- if (resFeedBack.httpCode == 200) {
- _that.focuseTask.taskStatus = 1;
- uni.showToast({
- title:"反馈成功"
- })
- } else {
- uni.showToast({
- title: resFeedBack.msg
- })
- }
- });
- },
- viewBreedTaskDetail(task) {
- uni.navigateTo({
- url: "../printbill/detail?id=" + task.idPrintBill + "&billCode=" + task.printBill.billCode,
- animationType: 'pop-in'
- })
- },
- viewBreedTaskStep(task) {
- uni.navigateTo({
- url: "../printbill/step?id=" + task.idPrintBill + "&billCode=" + task.printBill.billCode,
- animationType: 'pop-in'
- })
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .footer-text span{
- font-weight: bold;
- color: #e4493c;
- padding: 0 10rpx;
- }
- .demo-layout span{
- font-weight: bold;
- color: #e4493c;
- padding: 0 10rpx;
- }
- .span-txt{
- font-weight: bold;
- color: #e4493c;
- }
- .demo-layout{
- font-size: 36rpx;
- }
- /deep/ .uni-card .uni-card__header{
- border-bottom: none !important;
- }
- /deep/ .uni-list-item__container {
- padding: 0rpx;
- }
- /deep/ .fab{
- .uniui-plusempty:before {
- //content: "\e67b";
- content: '\e654' !important;
- }
- }
- .card-actions {
- display: flex;
- flex-direction: row;
- justify-content: space-around;
- align-items: center;
- height: 45px;
- border-top: 1px #eee solid;
- }
- .card-actions-item {
- display: flex;
- flex-direction: row;
- align-items: center;
- }
- .card-actions-item-text {
- font-size: 12px;
- color: #666;
- margin-left: 5px;
- }
- .textTitle {
- border-left: 0px solid #007AFF;
- display: inline-block;
- width: 180rpx;
- text-align: left;
- margin-bottom: 5px;
- color: #8799a3;
- }
- .u-popup-slot {
- width: 750rpx;
- height: 400px;
- @include flex;
- justify-content: center;
- align-items: center;
- padding: 20px;
- }
- .footer {
- position: fixed;
- bottom: 0;
- z-index: 10;
- display: flex;
- justify-content: space-between;
- width: 100%;
- height: 108rpx;
- background: #FFFFFF;
- border-top: 1px solid #E8E8E8;
- >view {
- width: 50%;
- height: 100%;
- font-size: 34rpx;
- font-weight: 600;
- display: flex;
- justify-content: center;
- align-items: center;
- &:active {
- opacity: 0.8;
- }
- .cart {
- width: 67rpx;
- height: 67rpx;
- margin-top: 10rpx;
- margin-right: 25rpx;
- }
- .amout {
- font-size: 34rpx;
- >text {
- font-size: 20rpx;
- }
- }
- .badge {
- position: relative;
- >text {
- position: absolute;
- top: 2rpx;
- right: 10rpx;
- z-index: 10;
- font-size: 22rpx;
- background: #FF3D00;
- border-radius: 50%;
- color: #fff;
- padding: 0 10rpx 2rpx;
- }
- }
- }
- >view:last-child {
- background: #FFD202;
- }
- }
- </style>
|