| | |
| | | <combination-title class="newApplicationTitle" title="新增"></combination-title> |
| | | <view class="formDataContaniner"> |
| | | <u--form labelPosition="left" :model="newFormData" ref="formRef"> |
| | | <u-form-item @click="selectLedger" labelWidth="20%" label="账套" borderBottom> |
| | | <u--input disabled disabledColor="#ffffff" v-model="ledgerName" border="none"></u--input> |
| | | </u-form-item> |
| | | <u-form-item labelWidth="20%" label="结算客户" borderBottom ref="customerNameRef"> |
| | | <u--input v-model="newFormData.customerName" disabled disabledColor="#ffffff" border="none"></u--input> |
| | | </u-form-item> |
| | |
| | | </u--form> |
| | | </view> |
| | | |
| | | <!-- 选择账套 --> |
| | | <u-picker |
| | | @change="selectLedgerChange" |
| | | @confirm="selectLedgerConfirm" |
| | | @cancel="selectLedgerCancel" |
| | | @close="selectLedgerClose" |
| | | :show="selectLedgerShow" |
| | | :columns="ledgerList" |
| | | keyName="name" |
| | | ></u-picker> |
| | | |
| | | <!-- 申请日历、范围时间 --> |
| | | <u-calendar :show="timeShow" :mode="mode" @confirm="confirmTime" @close="timeClose" rowHeight="110" :maxDate="maxDate"></u-calendar> |
| | | <u-calendar :show="timeShow" :mode="mode" @confirm="confirmTime" @close="timeClose" rowHeight="110"></u-calendar> |
| | | <!-- 添加合同子项 --> |
| | | <view class="addContractContainer"> |
| | | <u-popup :show="addContractShow" @close="addContractClose" @open="addContractOpen" mode="bottom" round="22"> |
| | |
| | | <script> |
| | | import combinationTitle from '@/components/common/combined-title/combined-title.vue'; |
| | | import popupMenu from '@/components/common/popup-menu/popup-menu.vue'; |
| | | import { BaseUrl } from '@/utils/request.js'; |
| | | |
| | | // 最大显示的日期 |
| | | const d = new Date(); |
| | |
| | | export default { |
| | | data() { |
| | | return { |
| | | // 账套选择器 |
| | | selectLedgerShow: false, |
| | | ledgerList: [], |
| | | ledgerName: '', |
| | | applicationOrderIndex: null, |
| | | tdStyle: 'max-height: 30px;overflow: scroll;', |
| | | spanStyle: 'overflow:auto', |
| | |
| | | // 时间 |
| | | timeShow: false, |
| | | mode: 'range', |
| | | maxDate: `${year}-${month}-${date + 70}`, |
| | | // 选择客户 |
| | | selectCustomerData: { |
| | | compIds: '', |
| | |
| | | } |
| | | }, |
| | | init() { |
| | | this.getLedgerList(); // 账套列表 |
| | | this.jcfavouredpolicyitem(); |
| | | this.coalfiled(); |
| | | this.coalprice(); |
| | |
| | | this.fetchCompTree(); |
| | | this.getFavouredPolicyItem(); |
| | | this.editApplicationFormData(); // 修改申请表单详情 |
| | | }, |
| | | /** |
| | | * 获取分类账套 |
| | | */ |
| | | getLedgerList() { |
| | | this.$reqGet('zhaccountledger', { compId: uni.getStorageSync('userInfo').compId }).then(res => { |
| | | this.ledgerList.push(res.data.records); |
| | | // console.log('账套列表',this.ledgerList); |
| | | // if (res.data.records) { |
| | | // this.newFormData.ledgerId = res.data.records[0].id; |
| | | // this.ledgerName = res.data.records[0].name; |
| | | // } |
| | | }); |
| | | }, |
| | | selectLedger() { |
| | | this.selectLedgerShow = true; |
| | | }, |
| | | selectLedgerChange(index) { |
| | | console.log('账套选择器', index); |
| | | |
| | | |
| | | |
| | | // if(this.newFormData.customerName||this.newFormData.contractNum||this.newFormData.contractName){ |
| | | // this.newFormData.customerName = ''; |
| | | // this.newFormData.contractNum = ''; |
| | | // this.newFormData.contractName = ''; |
| | | // } |
| | | }, |
| | | async selectLedgerConfirm(index) { |
| | | console.log('选择账套点击确定', index); |
| | | this.selectLedgerShow = false; |
| | | |
| | | await this.$reqGet('getAccount', { customerId: this.newFormData.customerId, ledgerId: index.value[0].id }).then(res => { |
| | | let accountReq = res.data; |
| | | let amountPrice = 0; |
| | | this.newFormData.contractOrders.forEach(item => { |
| | | amountPrice += Number(item.amount); |
| | | }); |
| | | console.log('价格合计', amountPrice); |
| | | if (this.newFormData.payType == 0) { |
| | | if (accountReq.balance > amountPrice) { |
| | | this.ledgerName = index.value[0].name; |
| | | this.newFormData.ledgerId = index.value[0].id; |
| | | this.accountDetails = accountReq; |
| | | } else { |
| | | uni.showToast({ |
| | | title: '账户内现汇余额:' + accountReq.balance +',不足支付现在订单', |
| | | icon: 'none' |
| | | }); |
| | | } |
| | | } else if (this.newFormData.payType == 1) { |
| | | if (accountReq.balance2 > amountPrice) { |
| | | this.ledgerName = index.value[0].name; |
| | | this.newFormData.ledgerId = index.value[0].id; |
| | | this.accountDetails = accountReq; |
| | | } else { |
| | | uni.showToast({ |
| | | title: '账户内承兑余额:'+accountReq.balance2+',不足支付现在订单', |
| | | icon: 'none' |
| | | }); |
| | | } |
| | | } |
| | | }); |
| | | |
| | | }, |
| | | selectLedgerCancel() { |
| | | this.selectLedgerShow = false; |
| | | }, |
| | | selectLedgerClose() { |
| | | this.selectLedgerShow = false; |
| | | }, |
| | | // 初始化申请表单 |
| | | async editApplicationFormData() { |
| | |
| | | console.log('整体详情', res.data); |
| | | this.newFormData = res.data; |
| | | this.timeDataStr = this.newFormData.startDate; |
| | | this.ledgerName = res.data.ledgerName; |
| | | }); |
| | | |
| | | // 获取合同详情,煤种 |
| | |
| | | |
| | | // 初始化当前申请客户账户情况 |
| | | if (this.newFormData.customerId) { |
| | | await this.$reqGet('getAccount', { customerId: this.newFormData.customerId }).then(res => { |
| | | await this.$reqGet('getAccount', { customerId: this.newFormData.customerId, ledgerId: this.newFormData.ledgerId }).then(res => { |
| | | this.accountDetails = res.data; |
| | | }); |
| | | } |
| | |
| | | selectCustomerOkClick(v) { |
| | | this.newFormData.customerName = v.customerName; |
| | | this.newFormData.customerId = v.id; |
| | | this.$reqGet('getAccount', { customerId: v.id }).then(res => { |
| | | this.$reqGet('getAccount', { customerId: v.id,ledgerId: this.newFormData.ledgerId }).then(res => { |
| | | this.accountDetails = res.data; |
| | | |
| | | this.searchContractForm.customerName = res.data.customerName; |
| | |
| | | quant: '', |
| | | toStation: '', |
| | | trainType: 1, |
| | | type: '' |
| | | type: '', |
| | | ledgerId:null, |
| | | ledgerName:'' |
| | | }; |
| | | // 运输类型初始化 |
| | | switch (this.addContractFormdata.trainType) { |
| | |
| | | addContractConsignee() { |
| | | this.addContractConsigneeShow = true; |
| | | }, |
| | | // 收货人 |
| | | addContractConsigneeConfirm(v) { |
| | | // console.log('收货人', v); |
| | | this.addContractFormdata.toStation = v.toStation; |
| | | this.addContractFormdata.customerName = v.customerName; |
| | | this.addContractFormdata.customerId = v.id; |
| | | this.$reqGet('getAccount', { customerId: v.id }).then(res => { |
| | | // console.log('获取收货人账号', res); |
| | | // this.accountDetails = res.data; |
| | | // this.newFormData.customerName = res.data.customerName; |
| | | // this.newFormData.customerId = res.data.id; |
| | | // this.searchContractForm.customerName = res.data.customerName; |
| | | }); |
| | | this.$nextTick(() => { |
| | | this.addContractConsigneeShow = false; |
| | | }); |
| | | |
| | | // 赋值给取价格请求参数 |
| | | this.getNewPriceData.customerAddressName = v.customerFullName; |
| | |
| | | } |
| | | this.addContractCoalData.push(a); |
| | | }); |
| | | this.addContractConsigneeShow = false; |
| | | }, |
| | | // 品种选择器 |
| | | addContractCoalConfirm(e) { |
| | |
| | | this.newFormData.contractOrders.forEach(e => { |
| | | amount += Number(e.amount); |
| | | }); |
| | | if (this.newFormData.payType == '0') { |
| | | if (this.newFormData.contractOrders.length <= 0) { |
| | | this.$u.toast('请添加订单子项!'); |
| | | return false; |
| | | } else if (this.accountDetails.balance < amount) { |
| | | let msg = this.accountDetails.balance == null ? 0 : this.accountDetails.balance; |
| | | this.$u.toast('客户账户承兑余额不足,承兑余额:' + msg); |
| | | } else { |
| | | uni.showLoading({ |
| | | title: '加载中...' |
| | | }); |
| | | this.editShenQing(); |
| | | // this.xswaybill(); |
| | | console.log(typeof this.newFormData.payType); |
| | | if (this.newFormData.contractOrders.length > 0) { |
| | | if (this.newFormData.payType == 0) { |
| | | if (this.accountDetails.balance < amount) { |
| | | let msg = this.accountDetails.balance == null ? 0 : this.accountDetails.balance; |
| | | this.$u.toast('客户账户现汇余额不足,承兑余额:' + msg); |
| | | } else { |
| | | uni.showLoading({ |
| | | title: '加载中...' |
| | | }); |
| | | this.editShenQing(); |
| | | // this.xswaybill(); |
| | | } |
| | | } else if (this.newFormData.payType == 1) { |
| | | if (this.accountDetails.balance2 < amount) { |
| | | let msg = this.accountDetails.balance2 == null ? 0 : this.accountDetails.balance2; |
| | | this.$u.toast('客户账户承兑余额不足,承兑余额:' + msg); |
| | | } else { |
| | | uni.showLoading({ |
| | | title: '加载中...' |
| | | }); |
| | | this.editShenQing(); |
| | | } |
| | | } |
| | | } else { |
| | | if (this.newFormData.contractOrders.length <= 0) { |
| | | this.$u.toast('请添加订单子项!'); |
| | | return false; |
| | | } else if (this.accountDetails.balance2 < amount) { |
| | | let msg = this.accountDetails.balance2 == null ? 0 : this.accountDetails.balance2; |
| | | this.$u.toast('客户账户承兑余额不足,承兑余额:' + msg); |
| | | } else { |
| | | uni.showLoading({ |
| | | title: '加载中...' |
| | | }); |
| | | this.editShenQing(); |
| | | } |
| | | uni.showToast({ |
| | | title: '请添加订单子项!', |
| | | icon: 'none' |
| | | }); |
| | | } |
| | | }, |
| | | // 修改申请信息 |
| | | editShenQing() { |
| | | console.log('editApp-------'); |
| | | uni |
| | | .request({ |
| | | url: this.baseUrl + '/yunxiao/xswaybill', |
| | | url: BaseUrl + '/yunxiao/xswaybill', |
| | | method: 'PUT', |
| | | data: this.newFormData, |
| | | header: { |
| | |
| | | }) |
| | | .then(res => { |
| | | uni.hideLoading(); |
| | | this.$u.toast('修改成功'); |
| | | uni.showToast({ |
| | | title:'修改成功!', |
| | | icon:'none', |
| | | duration:1500 |
| | | }) |
| | | this.$nextTick(() => { |
| | | uni.navigateBack({ |
| | | delta: 1 |