Browse Source

接口调试

lilei 4 months ago
parent
commit
5dafba7672

+ 2 - 2
App.vue

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

+ 32 - 0
api/recharge.js

@@ -14,4 +14,36 @@ export const rechargeList = params => {
     data: params,
     method: 'POST'
   })
+}
+
+// 创建充值订单
+export const createRechargeOrder = params => {
+  return request({
+    url: 'rechargeOrder/create',
+    data: params,
+    method: 'POST'
+  })
+}
+// 查询充值订单
+export const queryRechargeOrder = params => {
+  return request({
+    url: `rechargeOrder/queryBySn/${params.rechargeSn}`,
+    method: 'get'
+  })
+}
+// 查询充值订单分页
+export const queryRechargeOrderPage = params => {
+  return request({
+    url: `rechargeOrder/queryPage/${params.pageNo}/${params.pageSize}`,
+	data: params,
+    method: 'post'
+  })
+}
+// 查询消费订单分页
+export const xprhStoreAccountFlowPage = params => {
+  return request({
+    url: `xprhStoreAccountFlow/queryPage/${params.pageNo}/${params.pageSize}`,
+	data: params,
+    method: 'post'
+  })
 }

+ 16 - 0
api/shelf.js

@@ -339,4 +339,20 @@ export const findShelfUserParam = (params) => {
     data: params,
     method: 'post'
   })
+}
+// 查询余额支付配置
+export const queryBalancePaymentParam = (params) => {
+  return request({
+    url: `shelf/storeParam/queryBalancePaymentParam`,
+    data: params,
+    method: 'post'
+  })
+}
+//修改余额支付配置
+export const updateBalancePaymentParam = (params) => {
+  return request({
+    url: `shelf/storeParam/updateBalancePaymentParam`,
+    data: params,
+    method: 'post'
+  })
 }

+ 7 - 0
api/user.js

@@ -53,4 +53,11 @@ export const ticketQueryCount = params => {
     method: 'post',
     data: params
   })
+}
+// 门店抵扣余额
+export const storeAccount = (params) => {
+  return request({
+    url: `xprhStoreAccount/findByStoreSn/${params.storeSn}`,
+    method: 'get'
+  })
 }

+ 9 - 9
pages.json

@@ -115,7 +115,7 @@
             "path" : "pages/storeManage/priceSetting/priceSetting",
             "style" :                                                                                    
             {
-                "navigationBarTitleText": "价格显示设置",
+                "navigationBarTitleText": "价格显示授权",
                 "enablePullDownRefresh": false
             }
             
@@ -535,8 +535,15 @@
         	"path" : "shopShow/shopShow",
         	"style" : 
         	{
-        		"navigationBarTitleText" : "商城显示设置"
+        		"navigationBarTitleText" : "商城显示授权"
         	}
+        },{
+            "path" : "balanceSetting/balanceSetting",
+            "style" :                                                                                    
+            {
+                "navigationBarTitleText": "余额支付授权",
+                "enablePullDownRefresh": false
+            }
         },
         {
         	"path" : "accountBalance/accountBalance",
@@ -553,13 +560,6 @@
         	{
         		"navigationBarTitleText" : "交易记录"
         	}
-        },
-        {
-        	"path" : "balPaySetting/balPaySetting",
-        	"style" : 
-        	{
-        		"navigationBarTitleText" : "余额支付授权"
-        	}
         }
 		]
 	}

+ 20 - 2
pages/index/index.vue

@@ -171,7 +171,7 @@
 	import UniStatusBar from '@/components/uni-status-bar/uni-status-bar.vue'
 	import iconItemsList from '@/components/icon-items-list/icon-items-list.vue'
 	import productItem from './productItem.vue'
-	import { shelfBondRecordWaitPayRecord, findStoreShelf, shelfGetTotalWaitQty, getProductfindByScanCode, queryQplsConfig } from '@/api/shelf.js'
+	import { shelfBondRecordWaitPayRecord, findStoreShelf, shelfGetTotalWaitQty, getProductfindByScanCode, queryQplsConfig, queryBalancePaymentParam } from '@/api/shelf.js'
 	import { xprhStoreApplyRead } from '@/api/xprh.js'
 	import { findCurrentRewardRule } from '@/api/rewardRule.js'
 	import { listLookUp, getLookUpDatas, getCurrUserInfo } from '@/api/data.js';
@@ -182,6 +182,7 @@
 	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, // 图标网格
@@ -483,6 +484,10 @@
 						if(this.hasShopiing){
 							// 判断员工是否开启商城
 							this.showShopPage(flag)
+							// 获取抵扣支付权限
+							this.getPayBalanceAuth()
+							// 获取抵扣余额
+							this.getStoreAccount()
 						}else{
 							this.showNoShopPage(flag)
 						}
@@ -495,6 +500,20 @@
 					this.getRedPacketRule()
 				}
 			},
+			// 抵扣支付权限
+			getPayBalanceAuth(){
+				queryBalancePaymentParam({userId:this.userInfo&&this.userInfo.userid}).then(res => {
+					const data = res.data[0]
+					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购物车
@@ -607,7 +626,6 @@
 								  }
 							  }
 							  item.priceStr = Number(item.price).toFixed(2).toString().split('.')
-							  delete item.shopPromoProduct
 						 })
 						 if(flag!=1){
 							 this.productList.push(list)

+ 3 - 0
pages/index/productItem.vue

@@ -31,6 +31,9 @@
 					<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">
+						可抵扣<text>¥{{item.shopProductSubsidy.subsidyAmount}}</text>
+					</view>
 				</view>
 			</view>
 		</view>

+ 12 - 6
pages/morePage/morePage.vue

@@ -43,15 +43,15 @@
 			<view class="list-box">
 				<view class="list-body" :style="{paddingTop:item.text?0:'10px'}">
 					<uni-grid :column="4" :highlight="true" :show-border="false" :square="false" @change="e=>openDataList(e)">
-						<uni-grid-item>
+						<uni-grid-item v-if="hasBalaceAuth">
 							<view class="grid-item-box" :index="0">
-								<text class="value">15000</text>
+								<text class="value">{{storeAccount.rechargeBalance}}</text>
 								<text class="text">充值余额</text>
 							</view>
 						</uni-grid-item>
-						<uni-grid-item>
+						<uni-grid-item v-if="hasBalaceAuth">
 							<view class="grid-item-box" :index="1">
-								<text class="value">1000</text>
+								<text class="value">{{storeAccount.giveBalance}}</text>
 								<text class="text">抵扣余额</text>
 							</view>
 						</uni-grid-item>
@@ -154,6 +154,12 @@
 			hasShopSeting(){
 				return this.$store.state.vuex_hasShopiing
 			},
+			hasBalaceAuth(){
+				return this.$store.state.vuex_showBalanceAuth
+			},
+			storeAccount(){
+				return this.$store.state.vuex_storeAccount
+			},
 			itemList(){
 				const list = [
 					{
@@ -324,8 +330,8 @@
 							{
 								text: '余额支付授权',
 								icon: 'payrecord',
-								auth: this.$store.state.vuex_showShopAuth&&this.userInfo&&this.userInfo.superAdmin == 1,
-								path: '/pagesB/balPaySetting/balPaySetting',
+								auth: this.userInfo&&this.userInfo.superAdmin == 1,
+								path: '/pagesB/balanceSetting/balanceSetting',
 								color: '#009688',
 								isShelf: true
 							},

+ 56 - 11
pagesB/accountBalance/accountBalance.vue

@@ -37,7 +37,9 @@
 </template>
 
 <script>
-import {rechargeDetail,rechargeList} from '../../api/recharge.js'
+import {rechargeDetail,rechargeList,createRechargeOrder} from '../../api/recharge.js'
+import {storeAccount} from '@/api/user.js'
+import { purchasePay } from '@/api/purchase.js'
 import {
 	    mapState,
 	    mapMutations,
@@ -51,8 +53,8 @@ export default {
 		  info: null,
 		  payData: null,
 		  balanceList: [
-			{ label: '充值余额', value: '10000.00' },
-			{ label: '抵扣余额', value: '1000.00' }
+			{ id:0,label: '充值余额', value: '0' },
+			{ id:1,label: '抵扣余额', value: '0' }
 		  ],
 		  rechargeOptions: [],
     }
@@ -67,11 +69,6 @@ export default {
   	shelfInfo(){
   		return this.$store.state.vuex_storeShelf
   	},
-  	//是否开启线上支付
-  	hasPay(){
-  		const shelfInfo = this.shelfInfo
-  		return shelfInfo&&shelfInfo.payOnlineFlag&&shelfInfo.payOnlineFlag=='1'
-  	},
   	// 经销商电话
   	dealerPhone(){
   		const shelfInfo = this.shelfInfo
@@ -80,12 +77,25 @@ export default {
   	// 付款信息
   	payInfo(){
   		return this.$store.state.vuex_tempOrderData
-  	}
+  	},
+	storeAccount(){
+		return this.$store.state.vuex_storeAccount
+	},
   },
   onShow() {
+	  this.getStoreAccount()
 	  this.getList()
   },
   methods: {
+	  // 抵扣余额
+	  getStoreAccount(){
+		storeAccount({storeSn:this.shelfInfo.storeSn}).then(res => {
+			this.$store.state.vuex_storeAccount = res.data
+			this.balanceList[0].value = res.data.rechargeBalance
+			this.balanceList[1].value = res.data.giveBalance
+			this.balanceList.splice()
+		})
+	  },
 	getList(){
 		rechargeList({dealerSn:this.shelfInfo.dealerSn}).then(res => {
 			this.rechargeOptions = res.data||[]
@@ -94,17 +104,52 @@ export default {
 	// 消费记录
 	viewRecord(item){
 		uni.navigateTo({
-			url:'/pagesB/transactionRecord/transactionRecord'
+			url:'/pagesB/transactionRecord/transactionRecord?type='+item.id
 		})
 	},
 	// 充值
     handleRecharge(info) {
       this.info = info
-	  this.showPopu = true
+	  uni.showLoading({
+	  	title:'加载中...'
+	  })
+	  createRechargeOrder({
+		  rechargeRuleSn: info.rechargeRuleSn,
+		  rechargeAmount:info.rechargeAmount,
+		  giftAmount:info.giveAmount,
+		  dealerSn:this.shelfInfo.dealerSn,
+		  shelfSn:this.shelfInfo.shelfSn,
+		  customerSn:this.userInfo.userSn,
+		  storeSn:this.shelfInfo.storeSn,
+	  }).then(res =>{
+		  if(res.status == 200){
+			  purchasePay({
+					bizSn:res.data.rechargeSn,
+					bizNo:res.data.rechargeNo,
+					bizType:'RECHARGE_BILL',
+					payUserOpenId: this.$store.state.vuex_openid || uni.getStorageSync('openid')
+				}).then(ret=>{
+					if(ret.status == 200){
+						this.showPopu = true
+						this.payData = res.data?res.data.payRequestRest:null
+					}
+					setTimeout(()=>{
+						uni.hideLoading()
+					},300)
+					uni.showToast(res.message)
+				})
+		  }else{
+			  setTimeout(()=>{
+				uni.hideLoading()
+			  },300)
+			  uni.showToast(res.message)
+		  }
+	  })
     },
 	payComplete(item,isOk){
 		this.showPopu = false
 		if(isOk){
+			this.getStoreAccount()
 			this.message('支付成功')
 		}
 	}

+ 0 - 22
pagesB/balPaySetting/balPaySetting.vue

@@ -1,22 +0,0 @@
-<template>
-	<view>
-		
-	</view>
-</template>
-
-<script>
-	export default {
-		data() {
-			return {
-				
-			}
-		},
-		methods: {
-			
-		}
-	}
-</script>
-
-<style>
-
-</style>

+ 153 - 0
pagesB/balanceSetting/balanceSetting.vue

@@ -0,0 +1,153 @@
+<template>
+	<view class="page-body scroll-list">
+		<scroll-view scroll-y style="height: 100%;width: 100%;overflow: auto;" @scrolltolower="onreachBottom">
+			<view style="height: 20rpx;" ></view>
+			<view  
+			class="check-order-list" 
+			v-for="(item,index) in list" 
+			:key="item.userId" 
+			>
+				<view class="flex align_center justify_between">
+					<view class="u-name">
+						<text style="margin-right: 0.5rem;">{{item.userName}}</text>
+					</view>
+					<view class="u-mobile">
+						<text v-if="item.isManager == 1">门店负责人/ </text>
+						<text v-if="item.isManager == 0 && item.roleName">{{item.roleName}} / </text>
+						{{item.phone}}
+					</view>
+				</view>
+				<view class="set-item flex align_center justify_between">
+					余额支付权限:
+					<u-radio-group @change="e=>changeShow(e,item)" v-model="item.show" :width="150">
+						<u-radio :name="1">有</u-radio>
+						<u-radio :name="0">无</u-radio>
+					</u-radio-group>
+				</view>
+			 </view>
+			 <view style="padding:0 30upx 30upx;">
+				 <u-empty :src="`/static/nodata.png`" icon-size="180" :text="noDataText" img-width="120" v-if="list.length==0 && status!='loading'" mode="list"></u-empty>
+				 <u-loadmore v-if="(total>=list.length&&list.length)||status=='loading'" :status="status" />
+			 </view>
+		</scroll-view>
+	</view>
+</template>
+
+<script>
+	import {queryBalancePaymentParam, updateBalancePaymentParam } from '@/api/shelf.js'
+	import moment from 'moment'
+	export default{
+		name:'personnel',
+		data(){
+			return{
+				status: 'loading',
+				noDataText: '暂无数据',
+				// 查询条件
+				pageNo: 1,
+				pageSize: 1000,
+				list: [],
+				total: 0,
+			}
+		},
+		onShow() {
+			this.getRow(1)
+		},
+		computed:{
+			userInfo(){
+				return this.$store.state.vuex_userInfo
+			},
+			hasOnlyAdmin(){
+				return this.list.length ==1 && this.list[0].isManager == 1 || this.list.length == 0
+			},
+		},
+		methods:{
+			// 查询列表
+			getRow (pageNo) {
+			  let _this = this
+			  this.status = "loading"
+			  queryBalancePaymentParam({}).then(res => {
+				if (res.code == 200 || res.status == 204 || res.status == 200) {
+				  const list = res.data || []
+				  list.forEach(item=>{
+					  const st = item.storeParamList&&item.storeParamList[0]&&item.storeParamList[0]
+					  item.show = st && st.paramValue
+					  item.paramCode = st && st.paramCode
+					  item.paramName = st && st.paramName
+					  item.status = st && st.status
+				  })
+				  if(_this.pageNo>1){
+					  _this.list = _this.list.concat(list)
+				  }else{
+					  _this.list = list
+				  }
+				  _this.total = list.length || 0
+				} else {
+				  _this.list = []
+				  _this.total = 0
+				  _this.noDataText = res.message
+				}
+				 
+				_this.status = _this.total>=_this.list.length ? "nomore" : 'loadmore'
+			  })
+			},
+			// scroll-view到底部加载更多
+			onreachBottom() {
+				if(this.list.length < this.total){
+					this.pageNo += 1
+					this.getRow()
+				}else{
+					this.status = "nomore"
+				}
+			},
+			changeShow(e,item){
+				console.log(e,item)
+				uni.showLoading({
+					title: '加载中'
+				})
+				const userId = item.userId
+				const shelf = this.$store.state.vuex_storeShelf
+				updateBalancePaymentParam({id:item.id,'userId':userId,'paramValue':e,paramCode: item.paramCode,paramName:item.paramName,status:item.status}).then(res=>{
+					uni.hideLoading()
+					if(res.status == 200){
+						item.show = e
+						uni.$emit("refashHome")
+					}else{
+						item.show = !e ? 1 : 0
+					}
+					this.list.splice()
+					uni.showToast(res.message)
+				})
+			}
+		}
+	}
+</script>
+
+<style lang="less">
+	.page-body{
+		height: 100vh;
+		padding:0;
+	}
+	.scroll-list{
+		.check-order-list{
+			background: #ffffff;
+			padding: 10upx 20upx;
+			margin: 0 25rpx 25rpx 25rpx;
+			border-radius: 20upx;
+			box-shadow: 1px 1px 3px #EEEEEE;
+			> view{
+				padding: 0.5rem;
+				.u-name{
+					font-size: 32rpx;
+				}
+				.u-mobile{
+					color: #666;
+				}
+			}
+		}
+		.set-item {
+			::v-deep .u-radio__label{
+				flex: 1;
+			}
+		}
+	}
+</style>

+ 3 - 0
pagesB/cart/productitem.vue

@@ -35,6 +35,9 @@
 								<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.shopPromoProduct">
+									可抵扣<text>¥{{item.shopProductSubsidy.subsidyAmount}}</text>
+								</view>
 							</view>
 							<view v-else></view>
 							<view v-if="type=='edit'">

+ 3 - 0
pagesB/components/chooseProductItemSkline.vue

@@ -35,6 +35,9 @@
 						<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">
+							可抵扣<text>¥{{item.shopProductSubsidy.subsidyAmount}}</text>
+						</view>
 					</view>
 				 </view>
 			 </view>

+ 3 - 0
pagesB/components/productItemSkline.vue

@@ -30,6 +30,9 @@
 					<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">
+						可抵扣<text>¥{{item.shopProductSubsidy.subsidyAmount}}</text>
+					</view>
 				</view>
 			</view>
 		</view>

+ 1 - 1
pagesB/procureOrder/creatOrder.vue

@@ -296,7 +296,7 @@
 							purchasePay({
 								bizSn:res.data.purchaseSn,
 								bizNo:res.data.purchaseNo,
-								bizType:'PURCHASE',
+								bizType:'SETTLE_BILL',
 								payUserOpenId: this.$store.state.vuex_openid || uni.getStorageSync('openid')
 							}).then(res=>{
 								this.showPopu = true

+ 1 - 1
pagesB/procureOrder/orderDetail.vue

@@ -384,7 +384,7 @@
 			purchasePay({
 				bizSn:item.purchaseSn,
 				bizNo:item.purchaseNo,
-				bizType:'PURCHASE',
+				bizType:'SETTLE_BILL',
 				payUserOpenId: this.$store.state.vuex_openid || uni.getStorageSync('openid')
 			}).then(res=>{
 				this.showPopu = true

+ 1 - 1
pagesB/procureOrder/orderList.vue

@@ -292,7 +292,7 @@
 				purchasePay({
 					bizSn:item.purchaseSn,
 					bizNo:item.purchaseNo,
-					bizType:'PURCHASE',
+					bizType:'SETTLE_BILL',
 					payUserOpenId: this.$store.state.vuex_openid || uni.getStorageSync('openid')
 				}).then(res=>{
 					uni.hideLoading()

+ 1 - 1
pagesB/shopShow/shopShow.vue

@@ -7,7 +7,7 @@
 			v-for="(item,index) in list" 
 			:key="item.userId" 
 			>
-				<view class="flex align_center justify_between" @click="editPerson(item)">
+				<view class="flex align_center justify_between">
 					<view class="u-name">
 						<text style="margin-right: 0.5rem;">{{item.userName}}</text>
 					</view>

+ 44 - 12
pagesB/shopiing/productDetail.vue

@@ -39,6 +39,9 @@
 							<view class="flex align_center tejia-tag" v-if="detail.promoType=='PROMO_PROD'">
 								特价<text>¥{{detail.orginPrice}}</text>
 							</view>
+							<view class="flex align_center tejia-tag" v-if="detail.shopProductSubsidy&&!detail.shopPromoProduct">
+								可抵扣<text>¥{{detail.shopProductSubsidy.subsidyAmount}}</text>
+							</view>
 						</view>
 						<view class="product-info-nums">
 							<view class="share">
@@ -134,6 +137,10 @@
 							<view class="flex align_center tejia-tag" v-if="hasLogin&&detail.promoType=='PROMO_PROD'">
 								特价<text>¥{{detail.orginPrice}}</text>
 							</view>
+							<view class="flex align_center rebate-tag" 
+							v-if="hasLogin&&detail.shopProductSubsidy&&detail.shopProductSubsidy.subsidyAmount<item.price&&!detail.shopPromoProduct">
+								可抵扣<text>¥{{detail.shopProductSubsidy.subsidyAmount}}</text>
+							</view>
 						</view>
 						<view style="margin-top: 10px;" class="popu-content-num flex align_center justify_end">
 							<text>数量</text>
@@ -170,22 +177,25 @@
 						<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 v-if="hasBalancePay&&storeAccount.giveBalance&&!isAddCart">
 						<view class="totalBar-box">
 							<view class="flex align_center justify_between">
 								<view>总金额</view>
-								<view><text class="pf">¥</text>50.00</view>
+								<view><text class="pf">¥</text>{{totalAmount}}</view>
 							</view>
 							<view class="flex align_center justify_between">
-								<view>抵扣(余额:<text class="pf">¥</text>3.00)</view>
-								<view class="flex align_center"><uni-icons size="18" type="checkbox" color="#2196f3"></uni-icons> <text class="pf">¥</text>2.00</view>
+								<view v-if="storeAccount">抵扣(余额:<text class="pf">¥</text>{{storeAccount.giveBalance}})</view>
+								<view class="flex align_center" v-if="detail.shopProductSubsidy" @click="hasKdk=!hasKdk">
+									<uni-icons size="18" :type="hasKdk?'checkbox-filled':'checkbox'" color="#2196f3"></uni-icons> 
+									<text class="pf">¥</text>{{detail.shopProductSubsidy.subsidyAmount}}
+								</view>
 							</view>
-							<view class="flex align_center justify_between">
+							<view class="flex align_center justify_between" v-if="detail.shopProductSubsidy">
 								<view>合计</view>
-								<view><text class="pf">¥</text>48.00</view>
+								<view><text class="pf">¥</text>{{Number(totalAmount-detail.shopProductSubsidy.subsidyAmount).toFixed(2)}}</view>
 							</view>
 						</view>
-						<payOptions v-model="payType"></payOptions>
+						<payOptions v-model="payType" :balance="storeAccount?storeAccount.rechargeBalance:0"></payOptions>
 					</view>
 				</view>
 				<view class="popu-content-btn">
@@ -282,6 +292,8 @@
 				isAddCart: false, // 是否加入购物车
 				payData: null, // 支付参数
 				payType: 0, // 支付方式,抵扣、还是微信
+				hasKdk: false,
+				disKdk: false,
 			}
 		},
 		onLoad(option) {
@@ -324,7 +336,10 @@
 			},
 			// 抵扣余额支付是否可用,有【余额支付权限】且该产品有抵扣金额
 			hasBalancePay(){
-				return true
+				return this.$store.state.vuex_showBalanceAuth
+			},
+			storeAccount(){
+				return this.$store.state.vuex_storeAccount
 			},
 			// 经销商电话
 			dealerPhone(){
@@ -334,6 +349,10 @@
 			totalNum(){
 				return this.hasLogin&&this.userInfo.sysUserFlag == '1' ? this.$store.state.vuex_cartTotal : 0
 			},
+			// 总金额
+			totalAmount(){
+				return this.hasLogin&&this.detail&&this.detail.price * this.qty
+			},
 			// 赠品数量
 			giftNum(){
 				return this.detail && this.detail.promoType=='BUY_PROD_GIVE_PROD' ? Math.floor(this.qty / this.detail.conditionValue)*this.detail.resultValue : 0
@@ -421,6 +440,10 @@
 							  }
 							}
 							res.data.priceStr = Number(bprice).toFixed(2).toString().split('.')
+							// 可抵扣金额小于抵扣金额且大于0
+							const kdk = res.data.shopProductSubsidy.subsidyAmount>0&&res.data.shopProductSubsidy.subsidyAmount<this.storeAccount.giveBalance
+							this.hasKdk = kdk
+							this.disKdk = !kdk
 						}
 					}
 					uni.hideLoading()
@@ -610,11 +633,20 @@
 							purchasePay({
 								bizSn:res.data.purchaseSn,
 								bizNo:res.data.purchaseNo,
-								bizType:'PURCHASE',
-								payUserOpenId: this.$store.state.vuex_openid || uni.getStorageSync('openid')
+								bizType:'SETTLE_BILL',
+								payUserOpenId: this.$store.state.vuex_openid || uni.getStorageSync('openid'),
+								settleType: this.payType == 0 ? 'RECHARGE_BALANCE' : 'WXPAY_ONLINE'
 							}).then(res=>{
-								this.showPay = true
-								this.payData = res.data?res.data.payRequestRest:null
+								// 微信支付
+								if(this.payType == 1){
+									this.showPay = true
+									this.payData = res.data?res.data.payRequestRest:null
+								}else{
+									// 余额支付
+									this.showPay = true
+									this.showPopu = false
+									this.submitOk = true
+								}
 								uni.hideLoading()
 							})
 						}else{

+ 3 - 1
pagesB/shopiing/searchProduct.vue

@@ -252,7 +252,9 @@
 								  conditionValue: k.conditionValue,
 								  discountType: k.discountType,
 								  promoProductSn: k.promoProductSn,
-								  promoSn: k.promoSn
+								  promoSn: k.promoSn,
+								  shopProductSubsidy: k.shopProductSubsidy,
+								  shopPromoProduct: k.shopPromoProduct
 							  }
 							})
 							// 追加数据

+ 3 - 1
pagesB/shopiing/shopProduct.vue

@@ -291,7 +291,9 @@
 								  conditionValue: k.conditionValue,
 								  discountType: k.discountType,
 								  promoProductSn: k.promoProductSn,
-								  promoSn: k.promoSn
+								  promoSn: k.promoSn,
+								  shopProductSubsidy: k.shopProductSubsidy,
+								  shopPromoProduct: k.shopPromoProduct
 							  }
 							})
 							// 追加数据

+ 130 - 60
pagesB/transactionRecord/transactionRecord.vue

@@ -2,81 +2,151 @@
   <view class="container">
     <!-- 头部 -->
     <view class="header">
-      <text class="active">消费</text>
-	  <text>充值</text>
+      <text :class="tabType==1?'active':''" @tap="changeTab(1)">消费</text>
+	  <text :class="tabType==0?'active':''" @tap="changeTab(0)">充值</text>
     </view>
 
     <!-- 主体内容 -->
-    <scroll-view class="scroll-content" scroll-y>
-      <view class="month-list">
-		  <!-- 3月记录 -->
-		  <view class="month-card">
-		    <view class="month-header">
-		      <text class="month-title">2025年3月</text>
-		      <text class="month-total">总计:¥4.00</text>
-		    </view>
-		    
-		    <view class="record-list">
-		      <view 
-		        class="record-item"
-		        v-for="(item, index) in marchRecords"
-		        :key="index"
-		      >
-		        <view class="item-left">
-		          <text class="amount-label">消费</text>
-				  <text class="time">{{item.time}}</text>
-		        </view>
-				<text class="amount">¥{{item.amount}}</text>
-		      </view>
-		    </view>
+    <view class="scroll-content" >
+		<scroll-view scroll-y style="height: 100%;width:100%;overflow: auto;" @scrolltolower="onreachBottom">
+		  <view class="month-list">
+			  <!-- 3月记录 -->
+			  <view class="month-card" v-for="item in list" :key="item.tradeMonth">
+			    <view class="month-header">
+			      <text class="month-title">{{item.tradeMonth}}</text>
+			      <text class="month-total">总计:¥{{item.totalAmount}}</text>
+			    </view>
+			    
+			    <view class="record-list">
+			      <view 
+			        class="record-item"
+			        v-for="(sitem, index) in item.list"
+			        :key="sitem.id"
+			      >
+			        <view class="item-left">
+			          <text class="amount-label">{{tabType==0?'充值':'消费'}}</text>
+					  <text class="time" v-if="tabType==1&&sitem.bizType=='SALES'">{{sitem.finishFlag==1?'支付时间':'采购时间'}}:{{sitem.tradeDate}}</text>
+					  <text class="time" v-if="tabType==1&&sitem.bizType=='REFUND'">退款时间:{{sitem.tradeDate}}</text>
+					  <text class="time" v-if="tabType==0">{{sitem.bizType=='ZERO'?'清零时间':'充值时间'}}:{{sitem.tradeDate}}</text>
+			        </view>
+					<text class="amount">¥{{sitem.tradeAmount}}</text>
+			      </view>
+			    </view>
+			  </view>
+			  <view style="padding:0 30upx 30upx;">
+				 <u-empty :src="`/static/nodata.png`" icon-size="180" :text="noDataText" img-width="120" v-if="list.length==0 && status!='loading'" mode="list"></u-empty>
+				 <u-loadmore v-if="(total>=list.length&&list.length)||status=='loading'" :status="status" />
+			 </view>
 		  </view>
-		  
-		  <!-- 2月记录 -->
-		  <view class="month-card">
-		    <view class="month-header">
-		      <text class="month-title">2025年2月</text>
-		      <text class="month-total">总计:¥6.00</text>
-		    </view>
-		    
-		    <view class="record-list">
-		      <view 
-		        class="record-item"
-		        v-for="(item, index) in febRecords"
-		        :key="index"
-		      >
-		        <view class="item-left">
-		          <text class="amount-label">消费</text>
-				  <text class="time">{{item.time}}</text>
-		        </view>
-		         <text class="amount">¥{{item.amount}}</text>
-		      </view>
-		    </view>
-		  </view>
-	  </view>
-    </scroll-view>
+		</scroll-view>
+	</view>
   </view>
 </template>
 
 <script>
+import {xprhStoreAccountFlowPage} from '@/api/recharge.js'
+import {
+	    mapState,
+	    mapMutations,
+	} from 'vuex'
 export default {
   data() {
     return {
-      marchRecords: [
-        { amount: 1.00, time: '2025/03/04 08:00:29' },
-        { amount: 1.00, time: '2025/03/03 18:42:57' },
-        { amount: 1.00, time: '2025/03/03 18:16:31' },
-        { amount: 1.00, time: '2025/03/03 08:06:20' }
-      ],
-      febRecords: [
-        { amount: 1.00, time: '2025/02/28 20:36:46' },
-        { amount: 1.00, time: '2025/02/28 07:55:45' }
-      ]
+      status: 'loading',
+	  noDataText: '暂无数据',
+	  // 查询条件
+	  pageNo: 1,
+	  pageSize: 10,
+	  list: [],
+	  total: 0,
+	  tabType:0,
+	  lastMoth:''
     }
+  },
+  onLoad(opts){
+	this.tabType = opts.type  
+  },
+  onShow() {
+	this.getRow(1)
+  },
+  computed: {
+  	...mapState(['hasLogin']),
+  	// 登录用户信息
+  	userInfo(){
+  		return this.$store.state.vuex_userInfo
+  	},
+  	// 货架经销商信息
+  	shelfInfo(){
+  		return this.$store.state.vuex_storeShelf
+  	},
+	maxNums(){
+		let nums = 0
+		this.list.forEach(item => {
+			nums += item.list.length
+		})
+		return nums
+	}
+  },
+  methods: {
+	  changeTab(type){
+		  this.tabType = type
+		  this.list = []
+		  this.lastMoth = ''
+		  this.getRow(1)
+	  },
+	  // 查询列表
+	  getRow (pageNo) {
+	    let _this = this
+	    this.status = "loading"
+		// 0 充值,1 消费
+		const params = {
+			storeSn:this.shelfInfo.storeSn,
+			bizTypeList:this.tabType==0 ? ['RECHARGE'] : ['SALES', 'REFUND'],
+			accountType: ['RECHARGE','GIVE'][this.tabType]
+		}
+	    xprhStoreAccountFlowPage({pageNo:this.pageNo,pageSize: this.pageSize,...params}).then(res => {
+	  	if (res.status == 200) {
+	  	  const list = res.data&&res.data.list || []
+	  	  if(_this.pageNo>1){
+			  const fm = list[0] && list[0].tradeMonth
+			  // 如果相等,将数据拼接到上页去
+			  if(fm == _this.lastMoth){
+				  let preList = _this.list[_this.list.length-1].list
+				  preList = preList.concat(list[0].list)
+				  _this.list[_this.list.length-1].list = preList
+				  // 删除第一项
+				  list[0].list = []
+			  }
+			  console.log(list)
+	  		  _this.list = _this.list.concat(list.length?list.filter(item=>item.list.length):list)
+	  	  }else{
+	  		  _this.list = list
+	  	  }
+		  // 最后一条的月份
+		  _this.lastMoth = _this.list.length>0 ? _this.list[_this.list.length-1].tradeMonth : ''
+	  	  _this.total = res.data.count || 0
+	  	} else {
+	  	  _this.list = []
+	  	  _this.total = 0
+	  	  _this.noDataText = res.message
+	  	}
+	  	_this.status = _this.total>=_this.maxNums ? "nomore" : 'loadmore'
+	    })
+	  },
+	  // scroll-view到底部加载更多
+	  onreachBottom() {
+	  	if(this.maxNums < this.total){
+	  		this.pageNo += 1
+	  		this.getRow()
+	  	}else{
+	  		this.status = "nomore"
+	  	}
+	  },
   }
 }
 </script>
 
-<style lang="scss">
+<style lang="less">
 .container {
   height: 100vh;
   display: flex;
@@ -102,7 +172,7 @@ export default {
 }
 
 .scroll-content {
-  flex-grow: 1;
+  height: calc(100vh - 90px);
   .month-list{
 	  padding: 0 15px;
   }

+ 2 - 0
store/index.js

@@ -68,6 +68,8 @@ const store = new Vuex.Store({
 		vuex_configPrice: null, // 价格显示配置
 		vuex_hasShopiing: false, // 是否有商城
 		vuex_showShopAuth: false, // 是否显示商城设置
+		vuex_showBalanceAuth: false, // 是否显示抵扣金额
+		vuex_storeAccount: null, //门店账户余额
 		vuex_uuidTempData: lifeData.vuex_uuidTempData ? lifeData.vuex_uuidTempData : null, // 唯一码临时数据
 		vuex_cartList: lifeData.vuex_cartList ? lifeData.vuex_cartList : [], // 购物车列表按活动缓存
 		vuex_tabBarList: [