|
@@ -68,24 +68,31 @@
|
|
<view class="slot-content">
|
|
<view class="slot-content">
|
|
<view style="padding:50rpx 40rpx 20rpx;">
|
|
<view style="padding:50rpx 40rpx 20rpx;">
|
|
<u-form :model="form" ref="uForm" :label-width="150" :rules="rules" :label-style="{color:'#999'}">
|
|
<u-form :model="form" ref="uForm" :label-width="150" :rules="rules" :label-style="{color:'#999'}">
|
|
- <u-form-item :border-bottom ="false" label="总单数:" prop="num">23</u-form-item>
|
|
|
|
- <u-form-item :border-bottom ="false" label="结算方式:" prop="settleType">
|
|
|
|
- <u-input type="text" placeholder="请选择结算方式" :disabled="true" :height="60" v-model="form.settleType" @click="settleShow = true"/>
|
|
|
|
|
|
+ <u-form-item :border-bottom ="false" label="总单数:" prop="num" v-if="billArr">{{billArr.length}}</u-form-item>
|
|
|
|
+ <u-form-item :border-bottom ="false" label="结算方式:" prop="settleTypeName">
|
|
|
|
+ <u-input type="text" placeholder="请选择结算方式" :disabled="true" :height="60" v-model="form.settleTypeName" @click="settleShow = true"/>
|
|
<u-icon :name="settleShow?'arrow-right':'arrow-down'" color="#e0e0e0" size="26"></u-icon>
|
|
<u-icon :name="settleShow?'arrow-right':'arrow-down'" color="#e0e0e0" size="26"></u-icon>
|
|
</u-form-item>
|
|
</u-form-item>
|
|
- <u-form-item :border-bottom ="false" label="待收金额:" prop="num">¥23</u-form-item>
|
|
|
|
- <u-form-item :border-bottom ="false" label="折让金额:" prop="money"><u-input type="number" placeholder="请输入实际收款金额(最多2位小数)" :border="true" :height="60" v-model="form.money"/></u-form-item>
|
|
|
|
|
|
+ <u-form-item v-if="enableFundAccount" :border-bottom ="false" label="结算账户:" prop="settleAccountName">
|
|
|
|
+ <u-input type="text" placeholder="请选择结算账户" :disabled="true" :height="60" v-model="form.settleAccountName" @click="openSettleAccount"/>
|
|
|
|
+ <u-icon :name="settleAccount?'arrow-right':'arrow-down'" color="#e0e0e0" size="26"></u-icon>
|
|
|
|
+ </u-form-item>
|
|
|
|
+ <u-form-item :border-bottom ="false" label="待收金额:" prop="num">¥{{ billInfo.totalAmount ||billInfo.totalAmount == 0 ? toThousands(billInfo.totalAmount,2):'--' }}</u-form-item>
|
|
|
|
+ <u-form-item :border-bottom ="false" label="折让金额:" prop="discountAmount"><u-input type="number" placeholder="请输入实际收款金额(最多2位小数)" :border="true" :height="60" v-model="form.discountAmount"/></u-form-item>
|
|
</u-form>
|
|
</u-form>
|
|
</view>
|
|
</view>
|
|
<view class="costText">折让后金额</view>
|
|
<view class="costText">折让后金额</view>
|
|
- <view class="costText1">¥520</view>
|
|
|
|
|
|
+ <view class="costText1">¥{{settlement<0?0:settlement}}</view>
|
|
<view class="paymentFooter flex algin-center">
|
|
<view class="paymentFooter flex algin-center">
|
|
- <view @click="showPayment = false">取消</view>
|
|
|
|
|
|
+ <view @click="closePopup">取消</view>
|
|
<view @click="handlePay">确定</view>
|
|
<view @click="handlePay">确定</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</view>
|
|
</u-popup>
|
|
</u-popup>
|
|
- <u-select v-model="settleShow" :list="settleList" @confirm="confirmSettle"></u-select>
|
|
|
|
|
|
+ <!-- 提示弹窗 -->
|
|
|
|
+ <u-modal v-model="showModal" confirm-text="知道了" :content="modalContent" :show-title="false"></u-modal>
|
|
|
|
+ <u-picker mode="selector" v-model="settleShow" @confirm="confirmSettle" :default-selector="[0]" :range="settleList" range-key="dispName"></u-picker>
|
|
|
|
+ <u-picker mode="selector" v-model="settleAccount" @confirm="confirmSettleAccount" :default-selector="[0]" :range="accountList" range-key="name"></u-picker>
|
|
<!-- 分享询问弹窗 -->
|
|
<!-- 分享询问弹窗 -->
|
|
<u-modal v-model="shareShow" :show-cancel-button="true" :content="shareContent" @confirm="handleShare" @cancel="shareShow = false;btnLoading = false;"></u-modal>
|
|
<u-modal v-model="shareShow" :show-cancel-button="true" :content="shareContent" @confirm="handleShare" @cancel="shareShow = false;btnLoading = false;"></u-modal>
|
|
</view>
|
|
</view>
|
|
@@ -93,9 +100,11 @@
|
|
|
|
|
|
<script>
|
|
<script>
|
|
import billList from './billListComponent.vue';
|
|
import billList from './billListComponent.vue';
|
|
-import { findBySn, insert } from '@/api/verify.js';
|
|
|
|
|
|
+import { findBySn, insert,settleVerify,settle } from '@/api/verify.js';
|
|
import getDate from '@/libs/getDate.js';
|
|
import getDate from '@/libs/getDate.js';
|
|
import { toThousands } from '@/libs/tools.js'
|
|
import { toThousands } from '@/libs/tools.js'
|
|
|
|
+import { getLookUpDatas } from '@/api/data';
|
|
|
|
+import { queryFunctionState,settleAccountList } from '@/api/user';
|
|
export default {
|
|
export default {
|
|
components: { billList },
|
|
components: { billList },
|
|
data() {
|
|
data() {
|
|
@@ -116,28 +125,35 @@ export default {
|
|
toThousands,
|
|
toThousands,
|
|
showPayment:false,
|
|
showPayment:false,
|
|
form:{
|
|
form:{
|
|
- money:'',
|
|
|
|
- settleType:''
|
|
|
|
|
|
+ receiptAmount:0,
|
|
|
|
+ discountAmount:undefined,
|
|
|
|
+ settleType:'',
|
|
|
|
+ settleTypeName:'',
|
|
|
|
+ settleAccountSn:'',
|
|
|
|
+ settleAccountName:''
|
|
},
|
|
},
|
|
- settleList:[
|
|
|
|
- {
|
|
|
|
- value: '1',
|
|
|
|
- label: '江'
|
|
|
|
- },
|
|
|
|
- {
|
|
|
|
- value: '2',
|
|
|
|
- label: '湖'
|
|
|
|
- }
|
|
|
|
- ],
|
|
|
|
|
|
+ settleList:[],
|
|
rules: {
|
|
rules: {
|
|
- money: [
|
|
|
|
|
|
+ settleTypeName: [
|
|
|
|
+ {
|
|
|
|
+ required: true,
|
|
|
|
+ message: '请选择结算方式',
|
|
|
|
+ trigger: 'change',
|
|
|
|
+ }
|
|
|
|
+ ],
|
|
|
|
+ settleAccountName:[
|
|
{
|
|
{
|
|
required: true,
|
|
required: true,
|
|
- message: '请输入实际收款金额',
|
|
|
|
- trigger: ['change','blur'],
|
|
|
|
|
|
+ message: '请选择结算账户',
|
|
|
|
+ trigger: 'change',
|
|
}
|
|
}
|
|
]
|
|
]
|
|
- }
|
|
|
|
|
|
+ },
|
|
|
|
+ showModal:false,
|
|
|
|
+ modalContent:'',
|
|
|
|
+ enableFundAccount:false,
|
|
|
|
+ accountList:[],//结算账户列表
|
|
|
|
+ settleAccount:false
|
|
};
|
|
};
|
|
},
|
|
},
|
|
onReady() {
|
|
onReady() {
|
|
@@ -156,6 +172,15 @@ export default {
|
|
//经销商信息
|
|
//经销商信息
|
|
userData() {
|
|
userData() {
|
|
return this.$store.state.vuex_userData;
|
|
return this.$store.state.vuex_userData;
|
|
|
|
+ },
|
|
|
|
+ settlement() {
|
|
|
|
+ let totalPrice=this.billInfo.totalAmount?this.billInfo.totalAmount:0;
|
|
|
|
+ let discountPrice=this.form.discountAmount?this.form.discountAmount:0
|
|
|
|
+ let priceNum=totalPrice - discountPrice;
|
|
|
|
+ const ret = priceNum.toFixed(2)
|
|
|
|
+ let endPay=Number(totalPrice)>=Number(discountPrice) ? ret : 0
|
|
|
|
+ this.form.receiptAmount = endPay
|
|
|
|
+ return endPay
|
|
}
|
|
}
|
|
},
|
|
},
|
|
methods: {
|
|
methods: {
|
|
@@ -173,26 +198,141 @@ export default {
|
|
}
|
|
}
|
|
});
|
|
});
|
|
},
|
|
},
|
|
|
|
+ // 关闭弹窗
|
|
|
|
+ closePopup(){
|
|
|
|
+ this.form={
|
|
|
|
+ receiptAmount:0,
|
|
|
|
+ discountAmount:undefined,
|
|
|
|
+ settleType:'',
|
|
|
|
+ settleTypeName:'',
|
|
|
|
+ settleAccountSn:'',
|
|
|
|
+ settleAccountName:''
|
|
|
|
+ }
|
|
|
|
+ this.showPayment = false
|
|
|
|
+ },
|
|
// 打开确认收款弹窗
|
|
// 打开确认收款弹窗
|
|
openPaymentModal(){
|
|
openPaymentModal(){
|
|
- this.showPayment = true
|
|
|
|
- this.$nextTick(()=>{
|
|
|
|
- this.$refs.uForm.setRules(this.rules);
|
|
|
|
- })
|
|
|
|
|
|
+ let _this=this
|
|
|
|
+ // 校验弹窗是否需要打开
|
|
|
|
+ settleVerify({ verifySn: _this.verifySn}).then(res => {
|
|
|
|
+ if (res.status == 200) {
|
|
|
|
+ if(!res.data.falg){
|
|
|
|
+ _this.modalContent = res.data.message
|
|
|
|
+ _this.$nextTick(()=>{
|
|
|
|
+ _this.showModal = true
|
|
|
|
+ })
|
|
|
|
+ }else{
|
|
|
|
+ // 判断是否显示结算类型
|
|
|
|
+ queryFunctionState().then(res => {
|
|
|
|
+ if (res.status == 200) {
|
|
|
|
+ _this.enableFundAccount = res.data.functionEnableFlag == 1
|
|
|
|
+ }
|
|
|
|
+ })
|
|
|
|
+ // if(this.$hasPermissions('M_fundAccountList')&&this.$hasPermissions('B_fundAccountEnable')){
|
|
|
|
+ // queryFunctionState().then(res => {
|
|
|
|
+ // if (res.status == 200) {
|
|
|
|
+ // _this.enableFundAccount = res.data.functionEnableFlag == 1
|
|
|
|
+ // }
|
|
|
|
+ // })
|
|
|
|
+ // }
|
|
|
|
+ _this.getPayType();
|
|
|
|
+ _this.showPayment = true
|
|
|
|
+ _this.$nextTick(()=>{
|
|
|
|
+ _this.$refs.uForm.setRules(_this.rules);
|
|
|
|
+ })
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ });
|
|
},
|
|
},
|
|
- //结算方式
|
|
|
|
|
|
+ //获取结算类型列表
|
|
|
|
+ getPayType(){
|
|
|
|
+ getLookUpDatas({
|
|
|
|
+ lookupCode: 'SETTLE_STYLE',
|
|
|
|
+ pageNo: 1,
|
|
|
|
+ pageSize: 1000
|
|
|
|
+ }).then(result => {
|
|
|
|
+ if (result && result.status == 200) {
|
|
|
|
+ this.settleList = result.data.list;
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ //获取结算账户
|
|
|
|
+ getPayAccount(typeCode){
|
|
|
|
+ settleAccountList({settleStyleSn: typeCode,pageNo:1,pageSize:500,state:'ENABLE'}).then(result => {
|
|
|
|
+ if (result && result.status == 200) {
|
|
|
|
+ result.data.list.forEach(item=>{
|
|
|
|
+ item.name = item.accountName+'-'+item.accountNo
|
|
|
|
+ })
|
|
|
|
+ this.accountList = result.data.list;
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ },
|
|
|
|
+ //结算类型 确定
|
|
confirmSettle(e){
|
|
confirmSettle(e){
|
|
- this.form.settleType = e[0].label
|
|
|
|
|
|
+ let pos=e[0]
|
|
|
|
+ this.form.settleType = this.settleList[pos].code
|
|
|
|
+ this.form.settleTypeName = this.settleList[pos].dispName
|
|
|
|
+ if(this.enableFundAccount){
|
|
|
|
+ this.form.settleAccountSn=''
|
|
|
|
+ this.form.settleAccountName=''
|
|
|
|
+ this.getPayAccount(this.settleList[pos].code)
|
|
|
|
+ }
|
|
},
|
|
},
|
|
submitOrder() {
|
|
submitOrder() {
|
|
//发送对账单
|
|
//发送对账单
|
|
this.shareShow = true;
|
|
this.shareShow = true;
|
|
},
|
|
},
|
|
|
|
+ //结算账户弹窗
|
|
|
|
+ openSettleAccount(){
|
|
|
|
+ if(!this.form.settleTypeName){
|
|
|
|
+ uni.showToast({
|
|
|
|
+ title:'请先选择结算类型',
|
|
|
|
+ icon:'none'
|
|
|
|
+ })
|
|
|
|
+ return
|
|
|
|
+ }
|
|
|
|
+ this.settleAccount = true
|
|
|
|
+ },
|
|
|
|
+ //结算账户 确定
|
|
|
|
+ confirmSettleAccount(e){
|
|
|
|
+ let pos=e[0]
|
|
|
|
+ this.form.settleAccountSn=this.accountList[pos].settleAccountSn
|
|
|
|
+ this.form.settleAccountName=this.accountList[pos].name
|
|
|
|
+ },
|
|
//确认收款
|
|
//确认收款
|
|
handlePay(){
|
|
handlePay(){
|
|
- this.$refs.uForm.validate(valid => {
|
|
|
|
|
|
+ let _this=this
|
|
|
|
+ _this.$refs.uForm.validate(valid => {
|
|
if (valid) {
|
|
if (valid) {
|
|
- console.log('验证通过');
|
|
|
|
|
|
+ let totalPrice=this.billInfo.totalAmount?this.billInfo.totalAmount:0;
|
|
|
|
+ let discountPrice=this.form.discountAmount?this.form.discountAmount:0
|
|
|
|
+ if (discountPrice > totalPrice) {
|
|
|
|
+ uni.showToast({
|
|
|
|
+ title: '折让金额不能大于待收金额,请重新输入',
|
|
|
|
+ icon: 'none'
|
|
|
|
+ });
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ let reg = /^(([1-9][0-9]*)|(([0]\.\d{1,2}|[1-9][0-9]*\.\d{1,2})))$/;
|
|
|
|
+ if(discountPrice && discountPrice!=0){
|
|
|
|
+ if (!reg.test(discountPrice)) {
|
|
|
|
+ uni.showToast({
|
|
|
|
+ title: '折让金额格式不正确,请重新输入',
|
|
|
|
+ icon: 'none'
|
|
|
|
+ });
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ let ajaxData=JSON.stringify(_this.form)
|
|
|
|
+ let newAjaxData = JSON.parse(ajaxData)
|
|
|
|
+ newAjaxData.verifySn = _this.verifySn
|
|
|
|
+ delete newAjaxData.settleAccountName
|
|
|
|
+ settle(newAjaxData).then(result => {
|
|
|
|
+ if (result && result.status == 200) {
|
|
|
|
+ _this.closePopup()
|
|
|
|
+ _this.loadData({ verifySn: _this.verifySn });
|
|
|
|
+ }
|
|
|
|
+ });
|
|
} else {
|
|
} else {
|
|
console.log('验证失败');
|
|
console.log('验证失败');
|
|
}
|
|
}
|