|
@@ -26,14 +26,14 @@
|
|
|
<view class="statistical u-flex">
|
|
|
<view class="statisticalList">
|
|
|
<text>总单数:</text>
|
|
|
- <text>{{bill.length}}</text>
|
|
|
+ <text>{{ bill.length }}</text>
|
|
|
</view>
|
|
|
<view class="statisticalList">
|
|
|
<text>待收金额合计:</text>
|
|
|
- <text>¥{{totalPayPrice}}</text>
|
|
|
+ <text>¥{{ totalPayPrice }}</text>
|
|
|
</view>
|
|
|
</view>
|
|
|
- <view class="chooseCon"><billList ref="bill" :showCheck="true" :list="bill" @allChecked="allCheckedCallback"></billList></view>
|
|
|
+ <view class="chooseCon"><billList ref="bill" :showCheck="true" :list="bill" @allChecked="allCheckedCallback"></billList></view>
|
|
|
<view class="footer u-flex">
|
|
|
<view class="f-left">
|
|
|
<u-checkbox @change="allCheckeChange" v-model="allChecked" shape="circle">{{ allChecked ? '取消全选' : '全选' }}</u-checkbox>
|
|
@@ -41,16 +41,16 @@
|
|
|
<view class="f-mid" @click="isDetailShow = !isDetailShow">
|
|
|
<view>
|
|
|
待收:
|
|
|
- <text>¥{{chooseTotalPayPrice}}</text>
|
|
|
+ <text>¥{{ chooseTotalPayPrice }}</text>
|
|
|
</view>
|
|
|
- <view v-if="chooseList.length>0">
|
|
|
+ <view v-if="chooseList.length > 0">
|
|
|
折后:
|
|
|
- <text>¥{{settlement}}</text>
|
|
|
+ <text>¥{{ settlement }}</text>
|
|
|
</view>
|
|
|
- <view class="u-flex" v-if="chooseList.length>0">
|
|
|
+ <view class="u-flex" v-if="chooseList.length > 0">
|
|
|
<view>
|
|
|
折让:
|
|
|
- <text>¥{{discountVal || 0}}</text>
|
|
|
+ <text>¥{{ discountVal || 0 }}</text>
|
|
|
</view>
|
|
|
<view class="costBtn" @click="costShow = true">打折</view>
|
|
|
</view>
|
|
@@ -85,15 +85,15 @@
|
|
|
<view class="costPopupCon">
|
|
|
<view class="costList">
|
|
|
<text class="label">待收金额:</text>
|
|
|
- <text>¥{{chooseTotalPayPrice}}</text>
|
|
|
+ <text>¥{{ chooseTotalPayPrice }}</text>
|
|
|
</view>
|
|
|
<view class="costList u-flex">
|
|
|
<view class="label">折让金额:</view>
|
|
|
- <u-input v-model="discountVal" @input="onKeyInput" :border="true" :height="50"/>
|
|
|
+ <u-input v-model="discountVal" :border="true" :height="50" />
|
|
|
</view>
|
|
|
- <view class="tip" v-if="discountVal>chooseTotalPayPrice">折让金额不能大于待收金额,请重新输入</view>
|
|
|
+ <view class="tip" v-if="discountVal > chooseTotalPayPrice">折让金额不能大于待收金额,请重新输入</view>
|
|
|
<view class="costText">折让后金额</view>
|
|
|
- <view class="costText">¥{{settlement}}</view>
|
|
|
+ <view class="costText">¥{{ settlement }}</view>
|
|
|
</view>
|
|
|
<u-button type="primary" :custom-style="customStyle" shape="circle" @click="handleDisCount">确定</u-button>
|
|
|
</view>
|
|
@@ -105,7 +105,7 @@
|
|
|
|
|
|
<script>
|
|
|
import billList from './billListComponent.vue';
|
|
|
-import { queryUnsettleSaleList,insert } from '@/api/verify.js';
|
|
|
+import { queryUnsettleSaleList, insert } from '@/api/verify.js';
|
|
|
import getDate from '@/libs/getDate.js';
|
|
|
export default {
|
|
|
components: { billList },
|
|
@@ -126,7 +126,7 @@ export default {
|
|
|
},
|
|
|
allChecked: false,
|
|
|
tipShow: false,
|
|
|
- discountVal: null,//折让金额
|
|
|
+ discountVal: null, //折让金额
|
|
|
tipContent: `账单周期指销售单的创建时间`,
|
|
|
placeTab: [
|
|
|
{
|
|
@@ -164,24 +164,25 @@ export default {
|
|
|
}
|
|
|
],
|
|
|
curTab: '0',
|
|
|
-
|
|
|
+
|
|
|
showSearch: false,
|
|
|
showDate: false,
|
|
|
costShow: false,
|
|
|
-
|
|
|
+
|
|
|
customerObj: {
|
|
|
customerName: null
|
|
|
},
|
|
|
cycleName: '',
|
|
|
-
|
|
|
+
|
|
|
params: {
|
|
|
targetSn: undefined,
|
|
|
bizBeginDate: undefined,
|
|
|
bizEndDate: undefined
|
|
|
},
|
|
|
bill: [],
|
|
|
- dateArray:'',
|
|
|
- chooseList:[]
|
|
|
+ dateArray: '',
|
|
|
+ chooseList: [],
|
|
|
+ isDetailShow:false
|
|
|
};
|
|
|
},
|
|
|
onReady() {
|
|
@@ -192,9 +193,9 @@ export default {
|
|
|
},
|
|
|
onLoad(options) {
|
|
|
//获取对账周期默认值
|
|
|
- if(uni.getStorageSync('curTab')){
|
|
|
+ if (uni.getStorageSync('curTab')) {
|
|
|
this.curTab = uni.getStorageSync('curTab');
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
let systemList = this.$store.state.vuex_systemSetList;
|
|
|
let cycleObj = systemList.find(item => {
|
|
|
return item.remarks == 'sales_bill_period';
|
|
@@ -207,6 +208,10 @@ export default {
|
|
|
this.customerObj = JSON.parse(options.data);
|
|
|
this.params.targetSn = this.customerObj.customerSn;
|
|
|
}
|
|
|
+ uni.$on('customerInfo', res => {
|
|
|
+ this.customerObj = res;
|
|
|
+ this.params.targetSn = res.customerSn;
|
|
|
+ });
|
|
|
this.changeTime();
|
|
|
},
|
|
|
onNavigationBarButtonTap() {
|
|
@@ -217,35 +222,48 @@ export default {
|
|
|
onBackPress() {
|
|
|
if (this.showSearch) {
|
|
|
this.showSearch = false;
|
|
|
- }else{
|
|
|
- uni.removeStorageSync('curTab')
|
|
|
+ } else {
|
|
|
+ uni.removeStorageSync('curTab');
|
|
|
}
|
|
|
},
|
|
|
+ onUnload() {
|
|
|
+ uni.removeStorageSync('curTab');
|
|
|
+ },
|
|
|
computed: {
|
|
|
totalPayPrice() {
|
|
|
let totalPrice = 0;
|
|
|
for (let i = 0; i < this.bill.length; i++) {
|
|
|
- this.bill[i].unsettleAmount = this.bill[i].unsettleAmount ? this.bill[i].unsettleAmount :0
|
|
|
+ this.bill[i].unsettleAmount = this.bill[i].unsettleAmount ? this.bill[i].unsettleAmount : 0;
|
|
|
totalPrice += this.bill[i].unsettleAmount;
|
|
|
}
|
|
|
return totalPrice;
|
|
|
},
|
|
|
- chooseTotalPayPrice(){
|
|
|
- let price=0;
|
|
|
- this.chooseList.forEach(item=>{
|
|
|
- item.unsettleAmount =item.unsettleAmount? item.unsettleAmount:0;
|
|
|
+ chooseTotalPayPrice() {
|
|
|
+ let price = 0;
|
|
|
+ this.chooseList.forEach(item => {
|
|
|
+ item.unsettleAmount = item.unsettleAmount ? item.unsettleAmount : 0;
|
|
|
price += item.unsettleAmount;
|
|
|
- })
|
|
|
+ });
|
|
|
return price;
|
|
|
},
|
|
|
- settlement(){
|
|
|
+ settlement() {
|
|
|
return this.chooseTotalPayPrice - this.discountVal || 0;
|
|
|
}
|
|
|
},
|
|
|
methods: {
|
|
|
+ handleClean(){
|
|
|
+ this.showSearch = false;
|
|
|
+ let systemList = this.$store.state.vuex_systemSetList;
|
|
|
+ let cycleObj = systemList.find(item => {
|
|
|
+ return item.remarks == 'sales_bill_period';
|
|
|
+ });
|
|
|
+ this.curTab = this.placeTab.findIndex(con => con.name == cycleObj.valueShow);
|
|
|
+ this.cycleName = this.changeShowTime();
|
|
|
+ this.changeTime();
|
|
|
+ },
|
|
|
//选择客户
|
|
|
- goChooseCustomer(){
|
|
|
- uni.setStorageSync('curTab',this.curTab);
|
|
|
+ goChooseCustomer() {
|
|
|
+ uni.setStorageSync('curTab', this.curTab);
|
|
|
this.jumpPage('/pages/sales/chooseCustomerBill');
|
|
|
},
|
|
|
changeTime() {
|
|
@@ -253,12 +271,12 @@ export default {
|
|
|
this.params.bizBeginDate = this.getQueryDate().beginDate;
|
|
|
this.params.bizEndDate = this.getQueryDate().endDate;
|
|
|
this.cycleName = this.changeShowTime();
|
|
|
- }else if(this.curTab == 7){
|
|
|
+ } else if (this.curTab == 7) {
|
|
|
this.cycleName = this.placeTab[this.curTab].name;
|
|
|
this.params.bizBeginDate = undefined;
|
|
|
this.params.bizEndDate = undefined;
|
|
|
- }else{
|
|
|
- this.dateArray = ''
|
|
|
+ } else {
|
|
|
+ this.dateArray = '';
|
|
|
}
|
|
|
this.getList();
|
|
|
},
|
|
@@ -276,11 +294,18 @@ export default {
|
|
|
this.dateArray = date.startDate + ' ~ ' + date.endDate;
|
|
|
this.params.bizBeginDate = date.startDate + ' 00:00:00';
|
|
|
this.params.bizEndDate = date.endDate + ' 23:59:59';
|
|
|
- this.cycleName=date.startDate + '至' + date.endDate;
|
|
|
+ this.cycleName = date.startDate + '至' + date.endDate;
|
|
|
},
|
|
|
// 更改日期格式显示
|
|
|
- changeShowTime(){
|
|
|
- const fun = [getDate.getTodayInfo, getDate.getYesterdayInfo, getDate.getCurrWeekDaysInfo, getDate.getLastWeekDaysInfo, getDate.getCurrLastMonthDaysInfo, getDate.getLastMonthDaysInfo];
|
|
|
+ changeShowTime() {
|
|
|
+ const fun = [
|
|
|
+ getDate.getTodayInfo,
|
|
|
+ getDate.getYesterdayInfo,
|
|
|
+ getDate.getCurrWeekDaysInfo,
|
|
|
+ getDate.getLastWeekDaysInfo,
|
|
|
+ getDate.getCurrLastMonthDaysInfo,
|
|
|
+ getDate.getLastMonthDaysInfo
|
|
|
+ ];
|
|
|
return fun[this.curTab]();
|
|
|
},
|
|
|
tabChange(data) {
|
|
@@ -302,64 +327,80 @@ export default {
|
|
|
url
|
|
|
});
|
|
|
},
|
|
|
- handleDisCount(){
|
|
|
- this.costShow = false
|
|
|
+ handleDisCount() {
|
|
|
+ if(this.discountVal > this.chooseTotalPayPrice){
|
|
|
+ uni.showToast({
|
|
|
+ title: '折让金额不能大于待收金额,请重新输入',
|
|
|
+ icon: 'none'
|
|
|
+ });
|
|
|
+ return
|
|
|
+ }
|
|
|
+ let reg=/^(([1-9][0-9]*)|(([0]\.\d{1,2}|[1-9][0-9]*\.\d{1,2})))$/;
|
|
|
+ if(!reg.test(this.discountVal)){
|
|
|
+ uni.showToast({
|
|
|
+ title: '折让金额格式不正确,请重新输入',
|
|
|
+ icon: 'none'
|
|
|
+ });
|
|
|
+ return
|
|
|
+ }
|
|
|
+ this.costShow = false;
|
|
|
},
|
|
|
- submitOrder(){//发送对账单
|
|
|
- if(this.chooseList.length==0){
|
|
|
+ submitOrder() {
|
|
|
+ //发送对账单
|
|
|
+ if (this.chooseList.length == 0) {
|
|
|
uni.showToast({
|
|
|
- title:'请选择要发送的对账单',
|
|
|
- icon:'none'
|
|
|
- })
|
|
|
+ title: '请选择要发送的对账单',
|
|
|
+ icon: 'none'
|
|
|
+ });
|
|
|
return;
|
|
|
}
|
|
|
- let obj={
|
|
|
- detailNum:this.chooseList.length,
|
|
|
- totalAmount:this.chooseTotalPayPrice,
|
|
|
- discountAmount:this.discountVal,
|
|
|
- settleAmount:this.settlement,
|
|
|
- detailList:this.chooseList
|
|
|
- }
|
|
|
- let ajaxData=Object.assign(this.params,obj)
|
|
|
+ let obj = {
|
|
|
+ detailNum: this.chooseList.length,
|
|
|
+ totalAmount: this.chooseTotalPayPrice,
|
|
|
+ discountAmount: this.discountVal,
|
|
|
+ settleAmount: this.settlement,
|
|
|
+ detailList: this.chooseList
|
|
|
+ };
|
|
|
+ let ajaxData = Object.assign(this.params, obj);
|
|
|
insert(ajaxData).then(res => {
|
|
|
if (res.status == 200) {
|
|
|
this.goShare();
|
|
|
}
|
|
|
});
|
|
|
},
|
|
|
- allCheckeChange(e){
|
|
|
- this.$refs.bill.allSelect(e.value)
|
|
|
- const list = this.$refs.bill.getAllData()
|
|
|
+ allCheckeChange(e) {
|
|
|
+ this.$refs.bill.allSelect(e.value);
|
|
|
+ const list = this.$refs.bill.getAllData();
|
|
|
},
|
|
|
// 选中事件
|
|
|
- allCheckedCallback(isAllChecked,row){
|
|
|
- const has = this.chooseList.findIndex(k => k.bizSn == row.bizSn)
|
|
|
+ allCheckedCallback(isAllChecked, row) {
|
|
|
+ const has = this.chooseList.findIndex(k => k.bizSn == row.bizSn);
|
|
|
// 在已选列表中
|
|
|
- if(has>=0){
|
|
|
+ if (has >= 0) {
|
|
|
// 取消选中
|
|
|
- if(!row.checked){
|
|
|
- this.chooseList.splice(has,1)
|
|
|
+ if (!row.checked) {
|
|
|
+ this.chooseList.splice(has, 1);
|
|
|
}
|
|
|
- }else{
|
|
|
- if(row.checked){
|
|
|
- this.chooseList.push(row)
|
|
|
+ } else {
|
|
|
+ if (row.checked) {
|
|
|
+ this.chooseList.push(row);
|
|
|
}
|
|
|
}
|
|
|
// 是否全选
|
|
|
- this.allChecked = isAllChecked
|
|
|
+ this.allChecked = isAllChecked;
|
|
|
},
|
|
|
// 分享图文
|
|
|
- goShare(){
|
|
|
+ goShare() {
|
|
|
uni.shareWithSystem({
|
|
|
- summary: '',
|
|
|
- href: '',
|
|
|
- success(){
|
|
|
- // 分享完成,请注意此时不一定是成功分享
|
|
|
- },
|
|
|
- fail(){
|
|
|
- // 分享失败
|
|
|
- }
|
|
|
- })
|
|
|
+ summary: '',
|
|
|
+ href: '',
|
|
|
+ success() {
|
|
|
+ // 分享完成,请注意此时不一定是成功分享
|
|
|
+ },
|
|
|
+ fail() {
|
|
|
+ // 分享失败
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
}
|
|
|
};
|
|
@@ -416,7 +457,7 @@ export default {
|
|
|
}
|
|
|
.footer {
|
|
|
background-color: #f8f8f8;
|
|
|
- padding:10rpx 20rpx;
|
|
|
+ padding: 10rpx 20rpx;
|
|
|
.f-mid {
|
|
|
flex-grow: 1;
|
|
|
color: #666;
|
|
@@ -506,7 +547,7 @@ export default {
|
|
|
color: $uni-text-color-grey;
|
|
|
}
|
|
|
}
|
|
|
- .tip{
|
|
|
+ .tip {
|
|
|
color: $uni-color-error;
|
|
|
font-size: 20rpx;
|
|
|
text-align: right;
|