123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605 |
- <template>
- <view class="container">
- <view class="detail-desc">
- <view class="d-header">
- <text>选择车辆</text>
- </view>
- <scroll-view scroll-y @tap.stop="">
- <checkbox-group class="block" @change="CheckboxChange">
- <view class="cu-list menu text-left">
- <view class="cu-item" v-for="(item,index) in taskInfo" :key="index">
- <label v-if="item.fhFlag == 0" class="flex justify-between align-center flex-sub">
- <view class="flex-sub">{{item.carNo+" [ "+item.tranNo+" ] "}}(未放货)</view>
- <checkbox class="round" :checked="checkedList.includes(String(item.id))"
- :value="item.id"></checkbox>
- </label>
- <label v-else-if="item.fhFlag == 1" class="flex justify-between text-green align-center flex-sub">
- <view class="flex-sub">{{item.carNo+" [ "+item.tranNo+" ] "}}(已放货)</view>
- <checkbox class="round" :checked="checkedList.includes(String(item.id))"
- :value="item.id"></checkbox>
- </label>
- </view>
- </view>
- </checkbox-group>
- </scroll-view>
- <uni-table border stripe emptyText="暂无收款数据" min-width='250px' >
- <uni-tr>
- <uni-th align="center" width="60">收款方式</uni-th>
- <uni-th align="center" width="60">收款金额</uni-th>
- <uni-th align="center" width="70">收款日期</uni-th>
- <uni-th align="center" width="60">收款截图</uni-th>
- <uni-th align="center" width="40">操作</uni-th>
- </uni-tr>
- <uni-tr v-for="(item, index) in collectInfo" >
- <uni-td align="center">{{item.strPaymentMethod}}</uni-td>
- <uni-td align="center">{{item.collectMoney}}</uni-td>
- <uni-td align="center">{{item.strCollectDate}}</uni-td>
- <uni-td align="center">
- <view class="bg-img" v-if="item.collectImg != ''" @tap="ViewImage" :data-url="item.collectImg">
- <image :src="item.collectImg" mode="aspectFit" style="width: 40px; height: 40px;"></image>
- </view>
- </uni-td>
- <uni-td align="center">
- <view v-if="!item.id" style="color: #0081FF;" @click="deleteRow(index)">移除</view>
- </uni-td>
- </uni-tr>
- </uni-table>
- <uni-table border stripe emptyText="" min-width='250px' >
- <uni-tr>
- <uni-th align="center" width="100">应收:{{shouldCollect}}</uni-th>
- <uni-th align="center" width="100">已收:{{alreadyCollect}}</uni-th>
- <uni-th align="center" width="100">未收:{{shouldCollect-alreadyCollect}}</uni-th>
- </uni-tr>
- <uni-tr>
- </uni-tr>
- </uni-table>
- <u-modal v-model="collectShow"
- ref="collectModal"
- title="收款"
- show-cancel-button="true"
- confirm-text="确定"
- cancel-text="取消"
- @confirm="confirm"
- @cancel="cancel" >
- <view class="cu-form-group">
- <view class="title">收款方式</view>
- <picker @change="CollectTypeChange" :value="collectTypeIndex" :range="collectType">
- <view class="picker">
- {{collectTypeIndex>-1?collectType[collectTypeIndex]:'请选择'}}
- </view>
- </picker>
- </view>
- <view v-if="collectTypeIndex == 0" class="cu-form-group">
- <view class="title">收款编号</view>
- <picker @change="CollectNoChange" :value="collectNoIndex" :range="collectNo">
- <view class="picker">
- {{collectNoIndex>-1?collectNo[collectNoIndex]:'请选择'}}
- </view>
- </picker>
- </view>
- <view class="cu-form-group">
- <view class="title">收款金额</view>
- <input placeholder="请填写" name="input" @input="collectMoneyInput"></input>
- </view>
- <view class="cu-form-group">
- <view class="title">收款日期</view>
- <picker mode = "date" @change="CollectDateChange" :value="collectDate" >
- <view class="picker">
- {{collectDate}}
- </view>
- </picker>
- </view>
- <view class="cu-form-group">
- <view class="title">收款截图</view>
- <view class="bg-img" v-if="collectImg != ''" @tap="ViewImage" :data-url="collectImg">
- <image :src="collectImg" mode="aspectFit" style="width: 40px; height: 40px;"></image>
- </view>
- <view class="solids" style="width: 20px; height: 20px;" @tap="ChooseImage" v-if="collectImg == ''">
- <text class='cuIcon-cameraadd'></text>
- </view>
- </view>
- </u-modal>
- <view class="cu-modal" :class="modalName=='workModal'?'show':''" >
- <scroll-view scroll-y class="cu-dialog" :style="userStyle" @tap.stop="">
- <view class="cu-list menu text-center" >
- <!-- <view >{{请选择单号}}</view> -->
- <view class="cu-item" v-for="(item,index) in workList" :key="index" @click="choose(item.workNo)">
- <label class="flex justify-between align-center flex-sub">
- <view class="flex-sub">{{item.workNo}}</view>
- </label>
- </view>
- </view>
- </scroll-view>
- </view>
- </view>
- <view class="page-bottom">
- <view class="action-btn-group">
- <button type="primary" class=" action-btn no-border add-cart-btn" @click="collect">添加收款</button>
- <button type="primary" class=" action-btn no-border add-cart-btn" @click="fanghuo">申请放货</button>
- </view>
- </view>
- </view>
- </template>
- <script>
- import uploadImage from '@/components/ossutil/uploadFile.js';
- import {
- mapState
- } from 'vuex';
- export default {
- data() {
- return {
- taskInfo:[],
- taskInfoTmp:[],
- collectInfo:[],
- collectImg:'',
- grossWeight:'',
- skinWeight:'',
- netWeight:'',
- taskStatus:'',
- userStyle:'',
- modalName:'',
- workList:[],
- taskType:'',
- taskId:'',
- carNo:'',
- checkedList:[],
- collectShow:false,
- collectType: ['预收款', '网银收款', '现金收款'],
- collectTypeIndex: -1,
- collectNoData: [],
- collectNo: [],
- collectNoIndex: -1,
- collectMoney:0,
- collectDate:"请选择",
- workNo:null,
- shouldCollect:0,
- alreadyCollect:0
- };
- },
- computed: {
- ...mapState(['hasLogin','userInfo'])
- },
- onShow() {
- },
- onLoad(options) {
- const that = this
- this.taskId = options.taskId
- this.taskStatus = options.taskStatus
- this.$api.request('task', 'getFanghuoList', failres => {
- that.$api.msg(failres.errmsg)
- uni.hideLoading()
- }).then(res => {
- let data = res.data
- if(data.taskInfo){
- that.taskInfoTmp = data.taskInfo
- }
- if(data.collectInfo){
- that.collectInfo = data.collectInfo
- }
- if(data.workInfo){
- that.workList = data.workInfo
- }
- for(var i=0;i<that.collectInfo.length;i++){
- that.alreadyCollect += that.collectInfo[i].collectMoney
- }
-
- that.shouldCollect = data.shouldCollect
- var height = that.workList.length * 100
- var width = 500
- that.userStyle = "height:"+height+"rpx;width:" + width+"rpx"
- that.modalName = 'workModal'
- uni.hideLoading()
- })
- },
-
- methods: {
- deleteRow(e){
- this.collectInfo.splice(e,1)
- },
- choose(workNo){
- this.workNo = workNo
- this.modalName = null
- const list = this.taskInfoTmp.filter ( item => item.tranNo == workNo)
- this.taskInfo = list
- },
- collectMoneyInput(e){
- this.collectMoney = e.detail.value
- },
- CollectDateChange(e) {
- this.collectDate = e.detail.value
- },
- CollectTypeChange(e) {
- const that = this
- this.collectTypeIndex = e.detail.value
- if(this.collectTypeIndex == 0){
- this.$api.request('task', 'getCollectList', {
- collectType: 1
- }, failres => {
- that.$api.msg(failres.errmsg)
- uni.hideLoading()
- }).then(res => {
- that.collectNoData = res.data
- for(var i=0;i<that.collectNoData.length;i++){
- that.collectNo.push(that.collectNoData[i].collectNo)
- }
- uni.hideLoading()
- })
- }
- },
- CollectNoChange(e) {
- this.collectNoIndex = e.detail.value
- },
- confirm(){
- if(this.collectTypeIndex == -1){
- this.$api.msg('请选择收款方式');
- this.collectShow = true;
- return;
- }
- if(this.collectTypeIndex == 0 && this.collectNoIndex == -1){
- this.$api.msg('请选择预收款编号');
- this.collectShow = true;
- return;
- }
- if(!this.collectMoney){
- this.$api.msg('请填写收款金额');
- this.collectShow = true;
- return;
- }
- if(!this.collectDate){
- this.$api.msg('请选择收款日期');
- this.collectShow = true;
- return;
- }
- if(!this.collectImg){
- this.$api.msg('请上传收款截图');
- this.collectShow = true;
- return;
- }
- const that = this
- // uni.showLoading()
- var paymentMethod;
- if(this.collectTypeIndex == 0){
- paymentMethod = "预收款"
- }
- else if(this.collectTypeIndex == 1){
- paymentMethod = "网银收款"
- }
- else if(this.collectTypeIndex == 2){
- paymentMethod = "现金收款"
- }
- var collectNo;
- if(this.collectNoIndex == -1){
- collectNo = '';
- }
- else{
- collectNo = this.collectNoData[this.collectNoIndex].collectNo
- }
- var tmp = {
- workNo:this.workNo,
- strPaymentMethod:paymentMethod,
- collectNo:collectNo,
- collectMoney:this.collectMoney,
- strCollectDate:this.collectDate,
- collectImg:this.collectImg
- }
- this.collectInfo.push(tmp)
- this.alreadyCollect += Number(this.collectMoney)
- // that.$api.request('task', 'saveCollectKN', {
- // workNo:workNo,
- // paymentMethod:paymentMethod,
- // collectNo:this.collectNoData[this.collectNoIndex].collectNo,
- // collectMoney:this.collectMoney,
- // collectDate:this.collectDate,
- // collectImg:this.collectImg
- // }, failres => {
- // that.$api.msg(failres.errmsg)
- // uni.hideLoading()
- // }).then(res => {
- // uni.hideLoading()
- // that.$api.msg('收款成功')
- // })
- },
- cancel(){
- this.collectShow = false
- },
- collect(e){
- // if(this.checkedList.length == 0){
- // this.$api.msg('请选择收款车辆');
- // return;
- // }
- // var workNo;
- // var tmpList=[];
- // for(var i=0;i<this.taskInfo.length;i++){
- // for(var j=0;j<this.checkedList.length;j++){
- // if(this.taskInfo[i].id == this.checkedList[j]){
- // workNo = this.taskInfo[i].tranNo
- // tmpList.push(workNo)
- // }
- // }
- // }
- // for(var i=0;i<tmpList.length;i++){
- // var workNo = tmpList[i]
- // for(var j=0;j<tmpList.length;j++){
- // if(workNo != tmpList[j]){
- // this.$api.msg('请选择同一单号车辆');
- // return;
- // }
- // }
- // }
- this.collectShow = true
- },
- CheckboxChange(e){
- if(e.detail.value.length == 0){
- this.checkedList = e.detail.value;
- return;
- }
- var newList = e.detail.value
- var currentTarget;
- if(newList.length < this.checkedList.length){
- for(var j = 0;j<newList.length;j++){
- for(var i=0;i<this.checkedList.length;i++){
- if(newList[j] == this.checkedList[i]){
- this.checkedList.splice(i,1)
- }
- }
- }
- for(var i=0;i<this.taskInfo.length;i++){
- if(this.checkedList[0] == this.taskInfo[i].id){
- currentTarget = this.taskInfo[i]
- }
- }
- if(currentTarget.fhFlag == 1){
- for(var j=0;j<this.taskInfo.length;j++){
- if(this.taskInfo[j].batch == currentTarget.batch){
- for(var i=0;i<newList.length;i++){
- if(this.taskInfo[j].id == newList[i]){
- newList.splice(i,1)
- }
- }
- }
- }
-
- }
- this.checkedList = newList;
- }
- else{
- for(var j = 0;j<newList.length;j++){
- for(var i=0;i<this.taskInfo.length;i++){
- if(newList[j] == this.taskInfo[i].id){
- currentTarget = this.taskInfo[i]
- }
- }
- }
- if(currentTarget.fhFlag == 1){
- for(var i=0;i<this.taskInfo.length;i++){
- if(this.taskInfo[i].batch == currentTarget.batch){
- this.checkedList.push(String(this.taskInfo[i].id));
- }
- }
- }
- else{
- this.checkedList = newList;
- }
- }
-
-
- },
- ViewImage(e) {
- var img = [];
- img = e.currentTarget.dataset.url.split(' ')
- uni.previewImage({
- current:0,
- urls: img
- });
- },
- DelImg(e) {
- uni.showModal({
- title: '提示',
- content: '确定要删除该照片吗?',
- cancelText: '取消',
- confirmText: '确定',
- success: res => {
- if (res.confirm) {
- if(e.currentTarget.dataset.index == 0){
- this.collectImg = "";
- }
- }
- }
- })
- },
- ChooseImage() {
- uni.chooseImage({
- count: 1, //默认9
- sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
- sourceType: ['album','camera'], //从相册选择
- success: (res) => {
- //上传图片
- //图片路径可自行修改
- uploadImage(res.tempFilePaths[0], 'collectImg/',
- result => {
- this.collectImg = result
- uni.hideLoading();
- }
- )
- }
- });
- },
- fanghuo(){
- const that = this
- // if(!that.collectImg){
- // this.$api.msg('请上传收款截图');
- // return;
- // }
- if(this.shouldCollect < this.alreadyCollect){
- this.$api.msg('已收款不能大于应收款');
- return;
- }
- var taskId = "";
- for(var i=0;i<that.checkedList.length;i++){
- taskId += that.checkedList[i]+","
- }
- if(taskId == ""){
- this.$api.msg('请选择放货车辆');
- return;
- }
- var workDetailDTO = {
- workNo:this.workNo,
- list:this.collectInfo
- }
- uni.showLoading({
- title: '正在加载',
- mask:true
- })
- that.$api.request('task', 'fanghuoApply', {
- taskId: taskId,
- collectImg:!that.collectImg?'':that.collectImg,
- workDetailDTO:JSON.stringify(workDetailDTO)
- }, failres => {
- that.$api.msg(failres.errmsg)
- uni.hideLoading()
- }).then(res => {
- uni.hideLoading()
- that.$api.msg('申请成功')
- setTimeout(()=>{uni.navigateBack()},1000);
- })
- }
- }
- }
- </script>
- <style lang='scss'>
- .container{
- padding-bottom: 160upx;
- }
- .detail-desc {
- background: #fff;
- margin-top: 16upx;
- width: 750upx;
-
- .d-header {
- display: flex;
- justify-content: center;
- align-items: center;
- height: 80upx;
- font-size: $font-base + 2upx;
- color: $font-color-dark;
- position: relative;
-
- text {
- padding: 0 20upx;
- background: #fff;
- position: relative;
- z-index: 1;
- }
-
- &:after {
- position: absolute;
- left: 50%;
- top: 50%;
- transform: translateX(-50%);
- width: 300upx;
- height: 0;
- content: '';
- border-bottom: 1px solid #ccc;
- }
- }
- }
- .c-list {
- font-size: $font-sm + 2upx;
- color: $font-color-base;
- background: #fff;
-
- .c-row {
- display: flex;
- align-items: center;
- padding: 20upx 30upx;
- position: relative;
- }
-
- .tit {
- width: 220upx;
- }
-
- .con {
- flex: 1;
- color: $font-color-dark;
-
- .selected-text {
- margin-right: 10upx;
- }
- }
-
- .bz-list {
- height: 40upx;
- font-size: $font-sm+2upx;
- color: $font-color-dark;
-
- text {
- display: inline-block;
- margin-right: 30upx;
- }
- }
-
- .con-list {
- flex: 1;
- display: flex;
- flex-direction: column;
- color: $font-color-dark;
- line-height: 40upx;
- text-align: right;
- padding-right: 20upx;
- }
-
- .red {
- color: $uni-color-primary;
- }
- }
- @mixin playcenter {
- display: flex;
- align-items: center;
- justify-content: center;
- }
- .xsh-start {
- width: 105rpx;
- height: 105rpx;
- background: #FFFFFF;
- border-radius: 50%;
- font-size: 29rpx;
- color: #4135EB;
- @include playcenter;
- flex-wrap: wrap;
- }
- .x-modal {
- width: 100%;
- .x-m-title {
- width: 100%;
- height: 90rpx;
- padding: 0 38rpx 0 31rpx;
- box-sizing: border-box;
- font-size: 29rpx;
- color: #333333;
- border-bottom: 1px dashed #999;
- @include playcenter;
- justify-content: space-between;
- .xm-t-clear {
- font-size: 25rpx;
- color: #341DB7;
- @include playcenter;
- >image {
- width: 28rpx;
- height: 28rpx;
- display: block;
- margin-right: 8rpx;
- }
- }
- }
- .x-m-con {
- width: 100%;
- padding: 0 31rpx 18rpx;
- margin-top: 5rpx;
- box-sizing: border-box;
- }
- }
-
- </style>
|