lilei 4 months ago
parent
commit
73cbfc0be6

+ 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/' // 生产
 		},

+ 20 - 19
pages/index/index.vue

@@ -182,7 +182,6 @@
 	import { getShopStatus, getShopUserParam } from '@/api/bizParam.js'
 	import { getShopCategory, getShopProductList } from '@/api/shop.js'
 	import { openWebView, clickTab, toAuthStore, clickBannerList, toLogin } from "@/utils/index.js"
-	import { storeAccount } from '@/api/user.js'
 	export default {
 		components: {
 			iconItemsList, // 图标网格
@@ -378,6 +377,14 @@
 				this.getProductList()
 			}
 		},
+		watch:{
+			hasShopiing(a,b){
+				if(a!=b&&a){
+					// 获取抵扣支付权限
+					this.getPayBalanceAuth()
+				}
+			}
+		},
 		methods: {
 			// 去认证
 			authStore(){
@@ -393,6 +400,11 @@
 					if(this.userInfo.sysUserFlag == '1'){
 						// 查询是否有数字货架
 						this.getStoreShelf(flag)
+						// 如果已开通商城
+						if(this.hasShopiing){
+							// 获取抵扣支付权限
+							this.getPayBalanceAuth()
+						}
 					}else{// 游客
 						this.getHasShopping()
 						// 获取扫描次数
@@ -484,10 +496,6 @@
 						if(this.hasShopiing){
 							// 判断员工是否开启商城
 							this.showShopPage(flag)
-							// 获取抵扣支付权限
-							this.getPayBalanceAuth()
-							// 获取抵扣余额
-							this.getStoreAccount()
 						}else{
 							this.showNoShopPage(flag)
 						}
@@ -507,13 +515,6 @@
 					this.$store.state.vuex_showBalanceAuth = data && data.storeParamList&&data.storeParamList[0]&&data.storeParamList[0].paramValue == 1
 				})
 			},
-			// 抵扣余额
-			getStoreAccount(){
-				const data = this.$store.state.vuex_storeShelf
-				storeAccount({storeSn:data.storeSn}).then(res => {
-					this.$store.state.vuex_storeAccount = res.data
-				})
-			},
 			// 显示开通商城的页面
 			showShopPage(flag){
 				// 隐藏tab 视频,显示tab购物车
@@ -855,13 +856,13 @@
 			},
 			// 查询是有红包活动
 			getRedPacketRule(){
-				// findCurrentRewardRule().then(res => {
-				// 	this.$store.state.vuex_rewardRule = res.data;
-				// 	// 商城未开通时调用
-				// 	if(res.data && !this.hasShopiing){
-				// 		this.getRedScroll()
-				// 	}
-				// })
+				findCurrentRewardRule().then(res => {
+					this.$store.state.vuex_rewardRule = res.data;
+					// 商城未开通时调用
+					if(res.data && !this.hasShopiing){
+						this.getRedScroll()
+					}
+				})
 			},
 			// 红包奖励信息
 			getRedScroll(){

+ 7 - 1
pages/index/productItem.vue

@@ -31,7 +31,7 @@
 					<view class="flex align_center tejia-tag" v-if="isLogin&&item.promoType=='PROMO_PROD'">
 						特价<text>¥{{item.orginPrice}}</text>
 					</view>
-					<view class="flex align_center rebate-tag" v-if="isLogin&&item.shopProductSubsidy&&item.shopProductSubsidy.subsidyAmount<item.price&&!item.shopPromoProduct">
+					<view class="flex align_center rebate-tag" v-if="isLogin&&item.shopProductSubsidy&&item.shopProductSubsidy.subsidyAmount<item.price&&!item.shopPromoProduct&&showBalanceAuth">
 						可抵扣<text>¥{{item.shopProductSubsidy.subsidyAmount}}</text>
 					</view>
 				</view>
@@ -75,6 +75,12 @@
 				
 			}
 		},
+		computed:{
+			// 抵扣余额支付是否可用
+			showBalanceAuth(){
+				return this.$store.state.vuex_showBalanceAuth
+			},
+		},
 		methods: {
 			toDetail(item){
 				if(this.isLogin){

+ 19 - 9
pages/morePage/morePage.vue

@@ -46,26 +46,26 @@
 				</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">
-							<view class="grid-item-box" :index="0">
+						<uni-grid-item v-if="hasBalaceAuth" :index="0" :key="0">
+							<view class="grid-item-box">
 								<text class="value">{{Number(storeAccount.rechargeBalance).toFixed(2)}}</text>
 								<text class="text">充值余额</text>
 							</view>
 						</uni-grid-item>
-						<uni-grid-item v-if="hasBalaceAuth">
-							<view class="grid-item-box" :index="1">
+						<uni-grid-item v-if="hasBalaceAuth" :index="1" :key="1">
+							<view class="grid-item-box">
 								<text class="value">{{Number(storeAccount.giveBalance).toFixed(2)}}</text>
 								<text class="text">抵扣余额</text>
 							</view>
 						</uni-grid-item>
-						<uni-grid-item>
-							<view class="grid-item-box" :index="2" v-if="$hasPermissions('M_couponList_mini')">
+						<uni-grid-item :index="2" :key="2">
+							<view class="grid-item-box" v-if="$hasPermissions('M_couponList_mini')">
 								<text class="value">{{hasShelf?couponCount:0}}</text>
 								<text class="text">优惠券</text>
 							</view>
 						</uni-grid-item>
-						<uni-grid-item>
-							<view class="grid-item-box" :index="3" v-if="hasLogin&&hasRedPacket&&hasShelf">
+						<uni-grid-item :index="3" :key="3">
+							<view class="grid-item-box" v-if="hasLogin&&hasRedPacket&&hasShelf">
 								<text class="value">{{redPackCount}}</text>
 								<text class="text">红包</text>
 							</view>
@@ -120,7 +120,7 @@
 	import UniStatusBar from '@/components/uni-status-bar/uni-status-bar.vue'
 	import { queryQplsConfig,getProductfindByScanCode } from '@/api/shelf.js'
 	import { findUserReward } from '@/api/rewardRule.js'
-	import { ticketQueryCount } from '@/api/user.js'
+	import { ticketQueryCount, storeAccount } from '@/api/user.js'
 	import { clickTab, toLogin } from "@/utils/index.js"
 	export default {
 		components: {
@@ -372,12 +372,21 @@
 			if(!this.hasLogin){
 				this.hidePromoTab()
 			}
+			// 抵扣余额,充值余额
+			this.getStoreAccount()
 		},
 		// 页面卸载
 		onUnload() {
 			uni.$off('refashProm')
 		},
 		methods: {
+			// 抵扣余额
+			getStoreAccount(){
+				const data = this.$store.state.vuex_storeShelf
+				storeAccount({storeSn:data.storeSn}).then(res => {
+					this.$store.state.vuex_storeAccount = res.data
+				})
+			},
 			// 获取优惠券数量
 			getCouponCount(){
 				if(this.userInfo.sysUserFlag == '1'){
@@ -430,6 +439,7 @@
 			},
 			// 点击统计数据
 			openDataList(e){
+				console.log(e)
 				const path = [
 					'/pagesB/accountBalance/accountBalance',
 					'/pagesB/accountBalance/accountBalance',

+ 7 - 1
pagesB/cart/productitem.vue

@@ -35,7 +35,7 @@
 								<view class="flex align_center tejia-tag" v-if="item.promoType=='PROMO_PROD'">
 									特价<text>¥{{item.orginPrice}}</text>
 								</view>
-								<view class="flex align_center rebate-tag" v-if="item.shopProductSubsidy&&item.shopProductSubsidy.subsidyAmount<item.price&&!item.shopPromoProduct">
+								<view class="flex align_center rebate-tag" v-if="item.shopProductSubsidy&&item.shopProductSubsidy.subsidyAmount<item.price&&!item.shopPromoProduct&&showBalanceAuth">
 									可抵扣<text>¥{{item.shopProductSubsidy.subsidyAmount}}</text>
 								</view>
 							</view>
@@ -116,6 +116,12 @@
 				isChange: false
 			}
 		},
+		computed:{
+			// 抵扣余额支付是否可用
+			showBalanceAuth(){
+				return this.$store.state.vuex_showBalanceAuth
+			},
+		},
 		methods: {
 			inputQty(item){
 				this.isChange = true

+ 7 - 1
pagesB/components/chooseProductItemSkline.vue

@@ -35,7 +35,7 @@
 						<view class="flex align_center tejia-tag" v-if="isLogin&&item.promoType=='PROMO_PROD'">
 							特价<text>¥{{item.orginPrice}}</text>
 						</view>
-						<view class="flex align_center rebate-tag" v-if="isLogin&&item.shopProductSubsidy&&item.shopProductSubsidy.subsidyAmount<item.price&&!item.shopPromoProduct">
+						<view class="flex align_center rebate-tag" v-if="isLogin&&item.shopProductSubsidy&&item.shopProductSubsidy.subsidyAmount<item.price&&!item.shopPromoProduct&&showBalanceAuth">
 							可抵扣<text>¥{{item.shopProductSubsidy.subsidyAmount}}</text>
 						</view>
 					</view>
@@ -73,6 +73,12 @@
 			return {
 			}
 		},
+		computed:{
+			// 抵扣余额支付是否可用
+			showBalanceAuth(){
+				return this.$store.state.vuex_showBalanceAuth
+			},
+		},
 		methods: {
 			toDetail(item){
 				this.$emit('toDetail',item)

+ 7 - 1
pagesB/components/productItemSkline.vue

@@ -30,7 +30,7 @@
 					<view class="flex align_center tejia-tag" v-if="item.promoType=='PROMO_PROD'">
 						特价<text>¥{{item.orginPrice}}</text>
 					</view>
-					<view class="flex align_center tejia-tag" v-if="item.shopProductSubsidy&&item.shopProductSubsidy.subsidyAmount<item.price&&!item.shopPromoProduct">
+					<view class="flex align_center tejia-tag" v-if="item.shopProductSubsidy&&item.shopProductSubsidy.subsidyAmount<item.price&&!item.shopPromoProduct&&showBalanceAuth">
 						可抵扣<text>¥{{item.shopProductSubsidy.subsidyAmount}}</text>
 					</view>
 				</view>
@@ -65,6 +65,12 @@
 				
 			}
 		},
+		computed:{
+			// 抵扣余额支付是否可用
+			showBalanceAuth(){
+				return this.$store.state.vuex_showBalanceAuth
+			},
+		},
 		methods: {
 			toDetail(item){
 				this.$emit('detail',item)

+ 6 - 6
pagesB/procureOrder/creatOrder.vue

@@ -186,7 +186,7 @@
 			},
 			// 禁用的支付选项
 			disCzOption(){
-				const ta = this.hasKdk?this.totalAmount-this.subsidyAmount:this.totalAmount
+				const ta = this.hasKdk&&this.totalAmount?this.totalAmount-this.subsidyAmount:this.totalAmount
 				return ta>this.storeAccount.rechargeBalance
 			},
 			// 最小支付金额
@@ -383,9 +383,9 @@
 						this.totalAmount += item.price * item.qty // 总金额
 						this.totalNum += item.qty // 总数量
 						this.total += 1 // 总款数
-						// 有抵扣金额
-						if(item.shopProductSubsidy){
-							this.subsidyAmount += item.shopProductSubsidy.subsidyAmount
+						// 有抵扣金额,且没有促销活动
+						if(item.shopProductSubsidy&&!item.shopPromoProduct){
+							this.subsidyAmount += item.shopProductSubsidy.subsidyAmount||0
 						}
 						// 如果是返券类型
 						if(item.promoType=='BUY_PROD_GIVE_VALID'){
@@ -399,8 +399,8 @@
 						item.giftQty = item.promoType=='BUY_PROD_GIVE_PROD' ? Math.floor(item.qty / item.conditionValue)*item.resultValue : 0
 					})
 				})
-				// 可抵扣金额小于抵扣金额且大于0
-				this.hasKdk = this.subsidyAmount>0&&this.subsidyAmount<this.storeAccount.giveBalance
+				// 总可抵扣金额有余额支付权限,且抵扣金额小于等于抵扣余额
+				this.hasKdk = this.subsidyAmount>0&&this.storeAccount&&this.subsidyAmount<=this.storeAccount.giveBalance&&this.showBalanceAuth
 			},
 		}
 	}

+ 11 - 8
pagesB/shopiing/productDetail.vue

@@ -39,7 +39,7 @@
 							<view class="flex align_center tejia-tag" v-if="detail.promoType=='PROMO_PROD'">
 								特价<text>¥{{detail.orginPrice}}</text>
 							</view>
-							<view class="flex align_center rebate-tag" v-if="detail.shopProductSubsidy&&!detail.shopPromoProduct">
+							<view class="flex align_center rebate-tag" v-if="detail.shopProductSubsidy&&!detail.shopPromoProduct&&showBalanceAuth">
 								可抵扣<text>¥{{detail.shopProductSubsidy.subsidyAmount}}</text>
 							</view>
 						</view>
@@ -138,7 +138,7 @@
 								特价<text>¥{{detail.orginPrice}}</text>
 							</view>
 							<view class="flex align_center rebate-tag" 
-							v-if="hasLogin&&detail.shopProductSubsidy&&detail.shopProductSubsidy.subsidyAmount<detail.price&&!detail.shopPromoProduct">
+							v-if="hasLogin&&detail.shopProductSubsidy&&detail.shopProductSubsidy.subsidyAmount<detail.price&&!detail.shopPromoProduct&&showBalanceAuth">
 								可抵扣<text>¥{{detail.shopProductSubsidy.subsidyAmount}}</text>
 							</view>
 						</view>
@@ -351,7 +351,7 @@
 			},
 			// 抵扣余额支付是否可用,有【余额支付权限】且该产品有抵扣金额
 			hasBalancePay(){
-				return this.$store.state.vuex_showBalanceAuth&&this.storeAccount.giveBalance&&this.detail&&!this.detail.shopPromoProduct
+				return this.$store.state.vuex_showBalanceAuth&&this.storeAccount&&this.storeAccount.giveBalance&&this.detail&&!this.detail.shopPromoProduct
 			},
 			// 门店账户信息
 			storeAccount(){
@@ -359,7 +359,7 @@
 			},
 			// 禁用的支付选项
 			disCzOption(){
-				return this.payAmount>this.storeAccount.rechargeBalance
+				return this.storeAccount && this.payAmount>this.storeAccount.rechargeBalance
 			},
 			// 禁用抵扣金额
 			disKdk(){
@@ -468,9 +468,9 @@
 							}
 							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
+							// 可抵扣金额是否可用,有余额支付权限,且没有促销活动,且有抵扣金额,且抵扣金额小于等于抵扣余额
+							const kdk = res.data.shopProductSubsidy&&res.data.shopProductSubsidy.subsidyAmount>0&&this.storeAccount&&res.data.shopProductSubsidy.subsidyAmount<this.storeAccount.giveBalance
+							this.hasKdk = kdk&&!this.detail.shopPromoProduct&&this.showBalanceAuth
 						}
 					}
 					uni.hideLoading()
@@ -553,7 +553,8 @@
 								if(this.hasBalancePay){
 									this.payType = this.storeAccount.rechargeBalance<this.payAmount ? (this.hasPay? '1' : '2'):'0'
 								}
-								this.hasKdk = this.detail.shopProductSubsidy&&this.detail.shopProductSubsidy.subsidyAmount>0&&this.detail.shopProductSubsidy.subsidyAmount<this.storeAccount.giveBalance
+								// 有余额支付权限,且没有促销活动,且有抵扣金额,且抵扣金额小于等于抵扣余额
+								this.hasKdk = this.detail.shopProductSubsidy&&this.detail.shopProductSubsidy.subsidyAmount>0&&this.detail.shopProductSubsidy.subsidyAmount<this.storeAccount.giveBalance&&!this.detail.shopPromoProduct&&this.showBalanceAuth
 							}else{
 								// 充值余额支付
 								if(this.payType == 0){
@@ -782,7 +783,9 @@
 					}
 				}
 			},
+			// 修改支付方式
 			payTypeChange(v){
+				// 选择线下支付是,可抵扣金额不能使用
 				this.hasKdk=v!=2
 				// 充值余额支付,判断是否不足
 				if(v==0){

+ 4 - 5
pagesB/transactionRecord/transactionRecord.vue

@@ -69,11 +69,13 @@ export default {
 	  list: [],
 	  total: 0,
 	  tabType:0,
-	  lastMoth:''
+	  lastMoth:'',
+	  accountType: ''
     }
   },
   onLoad(opts){
 	this.tabType = opts.type
+	this.accountType = ['RECHARGE','GIVE'][opts.type]
 	uni.setNavigationBarTitle({
 		title: opts.type==0?'充值交易记录':'消费交易记录'
 	})
@@ -110,9 +112,6 @@ export default {
 	  },
 	  changeTab(type){
 		  this.tabType = type
-		  uni.setNavigationBarTitle({
-		  	title: this.tabType==0?'充值交易记录':'消费交易记录'
-		  })
 		  this.list = []
 		  this.lastMoth = ''
 		  this.getRow(1)
@@ -125,7 +124,7 @@ export default {
 		const params = {
 			storeSn:this.shelfInfo.storeSn,
 			bizTypeList:this.tabType==0 ? ['RECHARGE'] : ['SALES', 'REFUND'],
-			accountType: ['RECHARGE','GIVE'][this.tabType]
+			accountType: this.accountType
 		}
 	    xprhStoreAccountFlowPage({pageNo:this.pageNo,pageSize: this.pageSize,...params}).then(res => {
 	  	if (res.status == 200) {