浏览代码

修改bug

liujun 2 年之前
父节点
当前提交
0d06fb827e
共有 3 个文件被更改,包括 42 次插入22 次删除
  1. 32 14
      pages/sales/bill.vue
  2. 3 1
      pages/sales/billHistory.vue
  3. 7 7
      pages/sales/chooseCustomerBill.vue

+ 32 - 14
pages/sales/bill.vue

@@ -50,7 +50,7 @@
 				<view class="u-flex" v-if="chooseList.length > 0">
 					<view>
 						折让:
-						<text>¥{{ backDiscountVal || 0 }}</text>
+						<text>¥{{ backDiscountVal }}</text>
 					</view>
 					<view class="costBtn" @click="costShow = true">打折</view>
 				</view>
@@ -81,7 +81,7 @@
 		<!-- 选择日期范围 -->
 		<u-calendar v-model="showDate" ref="rangeDate" @change="dateChange" mode="range"></u-calendar>
 		<!-- 打折弹窗 -->
-		<u-popup v-model="costShow" mode="center" :border-radius="20" closeable width="82%">
+		<u-popup v-model="costShow" mode="center" @close="closeCost" :border-radius="20" closeable width="82%">
 			<view class="costPopup">
 				<view class="costPopupTit">东莞市京步车证汽车服务中心</view>
 				<view class="costPopupCon">
@@ -113,7 +113,7 @@
 import billList from './billListComponent.vue';
 import { queryUnsettleSaleList, insert } from '@/api/verify.js';
 import getDate from '@/libs/getDate.js';
-import { toThousands,formatDecimal} from '@/libs/tools.js'
+import {formatDecimal} from '@/libs/tools.js'
 export default {
 	components: { billList },
 	data() {
@@ -195,7 +195,7 @@ export default {
 			shareShow: false,
 			verifySn:'',
 			backDiscountPrice:null,
-			backDiscountVal:null,
+			backDiscountVal:'0.00',
 			cycleNameShow:''
 		};
 	},
@@ -218,7 +218,7 @@ export default {
 				this.curTab = this.placeTab.findIndex(con => con.name == cycleObj.valueShow);
 			}
 		}
-		this.cycleName = this.changeShowTime();
+		
 		// 获取选择客户
 		if (options && options.data) {
 			this.customerObj = JSON.parse(options.data);
@@ -229,6 +229,7 @@ export default {
 			this.params.targetSn = res.customerSn;
 			this.changeTime();
 		});
+		this.cycleName = this.changeShowTime();
 	},
 	onReady() {
 		setTimeout(()=>{
@@ -258,7 +259,7 @@ export default {
 				this.bill[i].unsettleAmount = this.bill[i].unsettleAmount ? this.bill[i].unsettleAmount : 0;
 				totalPrice += this.bill[i].unsettleAmount;
 			}
-			return formatDecimal(totalPrice,2);
+			return totalPrice.toFixed(2);
 		},
 		chooseTotalPayPrice() {
 			let price = 0;
@@ -266,16 +267,20 @@ export default {
 				item.unsettleAmount = item.unsettleAmount ? item.unsettleAmount : 0;
 				price += item.unsettleAmount;
 			});
-			return formatDecimal(price,2);
+			return price.toFixed(2);
 		},
 		settlement() {
 			let totalPrice=this.chooseTotalPayPrice?this.chooseTotalPayPrice:0;
 			let discountPrice=this.discountVal?this.discountVal:0
-			let priceNum=totalPrice - discountPrice;
-			return formatDecimal(priceNum,2)
+			let priceNum=(totalPrice - discountPrice)>0?(totalPrice - discountPrice) :0;
+			return priceNum.toFixed(2)
 		}
 	},
 	methods: {
+		closeCost(){
+			this.costShow = false
+			this.discountVal= ''
+		},
 		chooseCycleData() {
 			uni.setStorageSync('chooseList', this.chooseList);
 			this.showSearch = true;
@@ -391,7 +396,7 @@ export default {
 			}
 			this.costShow = false;
 			this.backDiscountPrice = this.settlement
-			this.backDiscountVal = this.discountVal
+			this.backDiscountVal = Number(this.discountVal).toFixed(2)
 		},
 		submitOrder() {
 			//发送对账单
@@ -429,8 +434,9 @@ export default {
 			}
 			if(this.settlement *1 <0){
 				this.backDiscountVal = '0.00'
+				this.discountVal = ''
 			}else{
-				this.backDiscountVal = this.discountVal
+				this.backDiscountVal = this.discountVal?(this.discountVal).toFixed(2):'0.00'
 			}
 			 this.backDiscountPrice = this.settlement
 			// 是否全选
@@ -439,7 +445,8 @@ export default {
 		// 分享图文
 		handleShare() {
 			this.submitLoading = false;
-			let url = 'http://p.iscm.360arrow.com/dzd/index.html?userSn=' + this.userData.orgSn + '&verifySn='+this.verifySn + '&name='+this.userData.orgName;
+			let verifyId = Date.now()+this.nanoid();
+			let url = 'http://p.iscm.360arrow.com/dzd/index.html?userSn=' + this.userData.orgSn + '&verifySn='+verifyId + '&name='+this.userData.orgName;
 			if (uni.getSystemInfoSync().platform == 'ios') {
 				uni.share({
 					provider: 'weixin',
@@ -478,13 +485,14 @@ export default {
 				totalAmount: this.chooseTotalPayPrice,
 				discountAmount: this.backDiscountVal || 0,
 				settleAmount: this.chooseTotalPayPrice - this.backDiscountVal ,
-				detailList: this.chooseList
+				detailList: this.chooseList,
+				verifySn:Date.now()+this.nanoid()
 			};
 			let ajaxData = Object.assign(this.params, obj);
 			insert(ajaxData).then(res => {
 				this.shareShow = false;
 				if (res.status == 200) {
-					this.verifySn  = res.data.verifySn
+					console.log('生成历史对账单成功')
 				} else {
 					uni.showToast({
 						title: res.message,
@@ -492,6 +500,16 @@ export default {
 					});
 				}
 			});
+		},
+		// 生成随机对账单id
+		nanoid (size = 5) {
+			let urlAlphabet ='0123456789'
+		  let id = ''
+		  let i = size
+		  while (i--) {
+		    id += urlAlphabet[(Math.random() * 10) | 0]
+		  }
+		  return id
 		}
 	}
 };

+ 3 - 1
pages/sales/billHistory.vue

@@ -8,7 +8,7 @@
 			<view class="list" @click="jumpPage('/pages/sales/billHistoryDetail?billId='+item.verifySn)" v-for="(item,i) in billList" :key="i">
 				<view class="list_t u-flex u-row-between">
 					<view class="u-line-1">{{item.customer.customerName}}</view>
-					<view>¥{{item.settleAmount}}</view>
+					<view>¥{{toThousands(item.settleAmount||0,2)}}</view>
 				</view>
 				<view class="list_b u-flex u-row-between" >
 					<view>{{item.createDate}}</view>
@@ -30,9 +30,11 @@
 
 <script>
 	import { queryPage } from '@/api/verify.js';
+	import { toThousands } from '@/libs/tools.js'
 	export default {
 		data(){
 			return {
+				toThousands,
 				wordColor:this.$config('infoColor'),
 				curCustomerName:'',
 				pageNo: 1,

+ 7 - 7
pages/sales/chooseCustomerBill.vue

@@ -5,9 +5,9 @@
 				<view class="tab">
 					<u-tabs :show-bar="false" :active-item-style="activeItemStyle" :list="tabsList" :is-scroll="false" :current="params.allCustomerFlag" @change="changeTabs"></u-tabs>
 				</view>
-				<view class="payType" @click="gatherShow = true">
-					<text v-if="!payTypeWord" :style="{ color: wordColor }">收款方式</text>
-					<text v-else :style="{ color: $config('primaryColor') }">{{payTypeWord}}</text>
+				<view class="payType u-flex" @click="gatherShow = true">
+					<view class="u-line-1" v-if="!payTypeWord" :style="{ color: wordColor }">收款方式</view>
+					<view class="u-line-1" v-else :style="{ color: $config('primaryColor') }">{{payTypeWord}}</view>
 					<u-icon name="shaixuan" custom-prefix="iscm-icon" size="30" :color="wordColor"></u-icon>
 				</view>
 			</view>
@@ -226,14 +226,14 @@ export default {
 		position: relative;
 		background: #fff;
 		.tab {
-			width: 60%;
+			width: 50%;
 			margin: 0 auto;
 		}
 		.payType {
 			position: absolute;
-			right: 20rpx;
-			text {
-				vertical-align: top;
+			right: 18rpx;
+			max-width: 160rpx;
+			view {
 				font-size: 26rpx;
 			}
 		}