lilei 4 months ago
parent
commit
52abf6de7f

+ 1 - 1
App.vue

@@ -1,7 +1,7 @@
 <script>
 	export default {
 		globalData: {
-			// baseUrl: 'http://192.168.2.10:9110/saas/clz/', // 本地
+			// baseUrl: 'http://192.168.2.132:9110/saas/clz/', // 本地
 			baseUrl: 'https://md.test.zyucgj.com/saas/clz/', // 预发布
 			// baseUrl: 'https://car.zyucgj.com/saas/clz/' // 生产
 		},

+ 8 - 1
pages/morePage/morePage.vue

@@ -41,6 +41,9 @@
 			</view>
 			<!-- 余额数据 -->
 			<view class="list-box">
+				<view class="list-title" style="padding-bottom: 0;padding-top:5px;color: #999;">
+					<text style="font-size: 10px;">ⓛ点击充值余额去充值</text>
+				</view>
 				<view class="list-body">
 					<uni-grid :column="4" :highlight="true" :show-border="false" :square="false" @change="e=>openDataList(e)">
 						<uni-grid-item v-if="hasBalaceAuth">
@@ -708,8 +711,12 @@
 				.value{
 					text-align:center;
 					color: #666;
-					margin-top: 15px;
+					margin-top: 10px;
 					font-size: 16px;
+					font-weight: bold;
+				}
+				.red{
+					color: #00aaff;
 				}
 				.text{
 					text-align:center;

+ 20 - 11
pagesB/accountBalance/accountBalance.vue

@@ -26,7 +26,6 @@
 		</view>
 		<view class="recharge-btn flex align_center justify_center" @tap="handleRecharge(opt)">
 			<text>去充值</text>
-			<uni-icons type="arrowright" size="16"></uni-icons>
 		</view>
       </view>
     </view>
@@ -150,7 +149,7 @@ export default {
 		this.showPopu = false
 		if(isOk){
 			this.getStoreAccount()
-			this.message('支付成功')
+			uni.showToast('支付成功')
 		}
 	}
   }
@@ -166,21 +165,20 @@ export default {
   flex-direction: column;
   
   .balance-info {
-	background: linear-gradient(to bottom, #03A9F4, #2196F3);
+	background: #fff;
+	box-shadow: 0 4rpx 12rpx rgba(30,144,255,0.1);
 	padding: 20rpx;
-	box-shadow: 0 4rpx 12rpx rgba(30, 144, 255, 0.5);
 	margin: 10px;
 	border-radius: 10px;
-    
     .balance-item {
       width: 50%;
-	  color: #fff;
+	  color: #000;
       &:last-child {
         border: none;
       }
       
       .balance-amount {
-        color: #fff;
+        color: #333;
         font-weight: bold;
         font-size: 20px;
 		margin-bottom: 2px;
@@ -189,10 +187,11 @@ export default {
   }
   
   .recharge-options {
-    padding: 24rpx;
+    padding: 20rpx 24rpx 40rpx;
     flex-grow: 1;
 	overflow-y: auto;
     .recharge-option {
+	  min-height: 60px;
       background: #fff;
       border-radius: 12rpx;
       overflow: hidden;
@@ -201,6 +200,9 @@ export default {
       .recharge-option-content{
 		  padding: 20rpx;
 		  line-height: 1.8;
+		  display: flex;
+		  flex-direction: column;
+		  justify-content: center;
 	  }
       .gift-text {
         color: #333;
@@ -208,15 +210,22 @@ export default {
       }
 	  .recharge-val{
 		  font-size: 16px;
-		  color: whitesmoke;
-		  background: #ff5722;
+		  color: red;
+		  background: #fff2de;
 		  padding: 20rpx;
 		  width: 150rpx;
+		  border-right: 1px dashed #fbdbd1;
 	  }
 	  .recharge-btn{
-		  color: #1e90ff;
 		  font-size: 24rpx;
 		  padding: 0 20rpx 0 0;
+		  text{
+			  display: block;
+			  padding:5px 10px;
+			  border-radius: 100px;
+			  background-color: #ff5500;
+			  color: #fff;
+		  }
 	  }
 	  .gift-remark{
 		  color: #999;

+ 29 - 16
pagesB/procureOrder/creatOrder.vue

@@ -38,7 +38,7 @@
 								<text>总金额</text>
 								<text class="price">¥{{Number(totalAmount).toFixed(2)}}</text>
 							</view>
-							<view class="product-price-item" v-if="hasBalancePay&&subsidyAmount">
+							<view class="product-price-item" v-if="showBalanceAuth&&subsidyAmount">
 								<view class="flex align_center" v-if="storeAccount">抵扣(余额:¥{{storeAccount.giveBalance}})</view>
 								<view class="flex align_center" v-if="!disKdk" @click="hasKdk=!hasKdk">
 									<uni-icons size="18" :type="hasKdk?'checkbox-filled':'checkbox'" color="#2196f3"></uni-icons> 
@@ -108,7 +108,6 @@
 			payOptions
 		},
 		onLoad() {
-			this.payType = this.hasBalancePay ? 0 : (this.hasPay ? 1 : 2)
 			// 计算区域高度
 			this.statusBarHeight = uni.getSystemInfoSync().statusBarHeight
 			this.screenWidth = uni.getSystemInfoSync().windowWidth
@@ -149,6 +148,11 @@
 				hasKdk: false, // 是否使用抵扣金额
 			}
 		},
+		watch: {
+			hasBalancePay(v){
+				this.payType = v ? 0 : (this.hasPay ? 1 : 2)
+			}
+		},
 		computed: {
 			...mapState(['hasLogin']),
 			userInfo(){
@@ -162,9 +166,13 @@
 			shelfInfo(){
 				return this.$store.state.vuex_storeShelf
 			},
-			// 抵扣余额支付是否可用,有【余额支付权限】且该产品有抵扣金额
+			// 抵扣余额支付是否可用
+			showBalanceAuth(){
+				return this.$store.state.vuex_showBalanceAuth
+			},
+			// 余额支付是否显示,合计金额小于充值余额
 			hasBalancePay(){
-				return this.$store.state.vuex_showBalanceAuth&&this.storeAccount.giveBalance
+				return this.$store.state.vuex_showBalanceAuth&&this.storeAccount&&this.totalAmount<=this.storeAccount.rechargeBalance
 			},
 			// 抵扣总余额
 			storeAccount(){
@@ -319,15 +327,22 @@
 								bizNo:res.data.purchaseNo,
 								bizType:'SETTLE_BILL',
 								payUserOpenId: this.$store.state.vuex_openid || uni.getStorageSync('openid'),
-								settleType: this.payType == 0 ? 'RECHARGE_BALANCE' : 'WXPAY_ONLINE'
-							}).then(res=>{
-								// 微信支付
-								if(this.payType == 1){
-									this.showPopu = true
-									this.payData = res.data?res.data.payRequestRest:null
+								settleType: this.payType == 0 ? 'RECHARGE_BALANCE' : 'PAY_WECHAT_ONLINE'
+							}).then(ret=>{
+								if(ret.status == 200){
+									// 微信支付
+									if(this.payType == 1){
+										this.showPopu = true
+										this.payData = ret.data?ret.data.payRequestRest:null
+									}else{
+										// 余额支付
+										this.payComplete(null,true)
+									}
 								}else{
-									// 余额支付
-									this.payComplete(null,true)
+									uni.showToast({
+										title: ret.message,
+										icon: 'none'
+									})
 								}
 							})
 						}else{
@@ -462,16 +477,14 @@
 						.price{
 							color: #333;
 						}
-						&:first-child{
+						&:last-child{
 							font-size: 28rpx;
+							justify-content: flex-end;
 							.price{
 								color: #d81e06;
 								font-weight: bold;
 							}
 						}
-						&:last-child{
-							justify-content: flex-end;
-						}
 					}
 				}
 			}

+ 5 - 1
pagesB/procureOrder/orderDetail.vue

@@ -96,7 +96,7 @@
 			<view class="info" v-if="info">
 				<view class="infoList">
 					<text>总金额</text>
-					<view class="price-txt">¥<text>{{Number(info.totalAmount).toFixed(2)}}</text></view>
+					<view class="cText">¥<text>{{Number(info.totalAmount).toFixed(2)}}</text></view>
 				</view>
 				<view class="infoList gray-text" v-if="info.totalSubsidyAmount">
 					<text>总抵扣</text>
@@ -110,6 +110,10 @@
 					<text>代金券</text>
 					<text class="cText">¥{{Number(info.totalTicketGiveAmount).toFixed(2)}}</text>
 				</view>
+				<view class="infoList">
+					<text>合计</text>
+					<view class="price-txt">¥<text>{{Number(info.totalDiscountedAmount).toFixed(2)}}</text></view>
+				</view>
 			</view>
 			<view class="info" v-if="!hasPay && info">
 				<view class="infoList">

+ 60 - 24
pagesB/shopiing/productDetail.vue

@@ -177,8 +177,8 @@
 						<text>配送商:{{shelfInfo.dealerName}}</text>
 						<view @click="callPhone()"><uni-icons size="18" type="phone" color="dodgerblue"></uni-icons><text style="font-size:12px;">拨打</text></view>
 					</view>
-					<view v-if="hasBalancePay&&!isAddCart">
-						<view class="totalBar-box">
+					<view v-if="!isAddCart">
+						<view class="totalBar-box" v-if="hasBalancePay">
 							<view class="flex align_center justify_between">
 								<view>总金额</view>
 								<view><text class="pf">¥</text>{{totalAmount}}</view>
@@ -198,7 +198,7 @@
 								<view><text class="pf">¥</text>{{payAmount}}</view>
 							</view>
 						</view>
-						<payOptions v-model="payType" :hasBalancePay="hasBalancePay" :hasPay="hasPay" @change="v=>hasKdk=v!=2" :balance="storeAccount?storeAccount.rechargeBalance:0"></payOptions>
+						<payOptions v-model="payType" :hasBalancePay="showBalanceAuth" :hasPay="hasPay" @change="v=>hasKdk=v!=2" :balance="storeAccount?storeAccount.rechargeBalance:0"></payOptions>
 					</view>
 				</view>
 				<view class="popu-content-btn">
@@ -339,6 +339,10 @@
 				const shelfInfo = this.shelfInfo
 				return shelfInfo&&shelfInfo.minAmount ? shelfInfo.minAmount : 0
 			},
+			// 抵扣余额支付是否可用
+			showBalanceAuth(){
+				return this.$store.state.vuex_showBalanceAuth
+			},
 			// 抵扣余额支付是否可用,有【余额支付权限】且该产品有抵扣金额
 			hasBalancePay(){
 				return this.$store.state.vuex_showBalanceAuth&&this.storeAccount.giveBalance&&this.detail&&!this.detail.shopPromoProduct
@@ -449,10 +453,12 @@
 							  }
 							}
 							res.data.priceStr = Number(bprice).toFixed(2).toString().split('.')
+							res.data.price = bprice
 							// 可抵扣金额小于抵扣金额且大于0
 							const kdk = res.data.shopProductSubsidy&&res.data.shopProductSubsidy.subsidyAmount>0&&res.data.shopProductSubsidy.subsidyAmount<this.storeAccount.giveBalance
 							this.hasKdk = kdk
 						}
+						console.log(this.detail)
 					}
 					uni.hideLoading()
 				})
@@ -532,19 +538,33 @@
 							// 打开数量选择弹框
 							if(!this.showPopu){
 								this.showPopu = true
-								this.payType = this.hasBalancePay ? 0 : (this.hasPay ? 1 : 2)
+								this.payType = this.showBalanceAuth ? 0 : (this.hasPay ? 1 : 2)
 								this.hasKdk = this.detail.shopProductSubsidy&&this.detail.shopProductSubsidy.subsidyAmount>0&&this.detail.shopProductSubsidy.subsidyAmount<this.storeAccount.giveBalance
 							}else{
-								if(this.hasPay && this.minPayAmount>this.payAmount){
-									uni.showModal({
-										content: '支付金额不能小于'+this.minPayAmount+'元!',
-										showCancel:false,
-										confirmText:'知道了'
-									})
-								}else{
-									// 去结算生产订单
-									this.creatOrder()
+								// 充值余额支付
+								if(this.payType == 0){
+									if(this.storeAccount.rechargeBalance<this.payAmount){
+										uni.showModal({
+											content: '充值余额不足!',
+											showCancel:false,
+											confirmText:'知道了'
+										})
+										return;
+									}
 								}
+								// 微信支付
+								if(this.payType == 1){
+									if(this.hasPay && this.minPayAmount>this.payAmount){
+										uni.showModal({
+											content: '支付金额不能小于'+this.minPayAmount+'元!',
+											showCancel:false,
+											confirmText:'知道了'
+										})
+										return;
+									}
+								}
+								// 去结算生产订单
+								this.creatOrder()
 							}
 						}
 					}
@@ -639,23 +659,39 @@
 						// 这里判断是否开通支付,如果开通打开确认付款弹框
 						if(this.hasPay){
 							// 计算待付款剩余倒计时
-							res.data.timestamp = (new Date(res.data.createDate.replace(/-/g,'/')).getTime() + 1800000 - new Date().getTime())/1000
+							if(this.payType==1){
+								res.data.timestamp = (new Date(res.data.createDate.replace(/-/g,'/')).getTime() + 1800000 - new Date().getTime())/1000
+							}
 							purchasePay({
 								bizSn:res.data.purchaseSn,
 								bizNo:res.data.purchaseNo,
 								bizType:'SETTLE_BILL',
 								payUserOpenId: this.$store.state.vuex_openid || uni.getStorageSync('openid'),
-								settleType: this.payType == 0 ? 'RECHARGE_BALANCE' : 'WXPAY_ONLINE'
-							}).then(res=>{
-								// 微信支付
-								if(this.payType == 1){
-									this.showPay = true
-									this.payData = res.data?res.data.payRequestRest:null
+								settleType: this.payType == 0 ? 'RECHARGE_BALANCE' : 'PAY_WECHAT_ONLINE'
+							}).then(ret=>{
+								if(ret.status == 200){
+									// 微信支付
+									if(this.payType == 1){
+										if(ret.data){
+											this.showPay = true
+											this.payData = ret.data?ret.data.payRequestRest:null
+										}else{
+											uni.showToast({
+												title: '支付失败',
+												icon: 'none'
+											})
+										}
+									}else{
+										// 余额支付
+										this.showPay = true
+										this.showPopu = false
+										this.submitOk = true
+									}
 								}else{
-									// 余额支付
-									this.showPay = true
-									this.showPopu = false
-									this.submitOk = true
+									uni.showToast({
+										title: ret.message,
+										icon: 'none'
+									})
 								}
 								uni.hideLoading()
 							})