shish пре 1 месец
родитељ
комит
d88acfc19c

+ 64 - 3
ghsApp/src/admin/custom/rechargeChange.vue

@@ -24,8 +24,8 @@
 						<view class="td td-scene">
 						<view class="td td-scene">
 							<view class="scene-type">{{ item.onlinePay == 2 ? '线上' : '线下' }}</view>
 							<view class="scene-type">{{ item.onlinePay == 2 ? '线上' : '线下' }}</view>
 							<view class="scene-way">{{ item.payWay==0?'微信':item.payWay == 1 ?'支付宝':'' }}</view>
 							<view class="scene-way">{{ item.payWay==0?'微信':item.payWay == 1 ?'支付宝':'' }}</view>
-							<view class="scene-status" :class="item.payStatus == 1 ? 'status-paid' : 'status-unpaid'">
-								{{ item.payStatus == 1 ? '已付款' : '待付款' }}
+							<view class="scene-status" :class="item.refundStatus == 1 ? 'status-refunded' : (item.payStatus == 1 ? 'status-paid' : 'status-unpaid')">
+								{{ item.refundStatus == 1 ? '已退款' : (item.payStatus == 1 ? '已付款' : '待付款') }}
 							</view>
 							</view>
 						</view>
 						</view>
 						<view class="td td-staff">{{ item.staffName }}</view>
 						<view class="td td-staff">{{ item.staffName }}</view>
@@ -37,6 +37,12 @@
 							<view class="balance-remark" v-if="item.remark">{{ item.remark }}</view>
 							<view class="balance-remark" v-if="item.remark">{{ item.remark }}</view>
 						</view>
 						</view>
 						<view class="td td-code">
 						<view class="td td-code">
+							<view
+								v-if="hasFinance == 1 && item.payStatus == 1 && item.refundStatus != 1"
+								class="admin-button-com small red refund-btn"
+								@click.stop="confirmRefund(item)">
+								退款
+							</view>
 						</view>
 						</view>
 					</view>
 					</view>
 				</view>
 				</view>
@@ -49,7 +55,8 @@
 </template>
 </template>
 <script>
 <script>
 import AppWrapperEmpty from "@/components/app-wrapper-empty";
 import AppWrapperEmpty from "@/components/app-wrapper-empty";
-import { getCustomRechargeChange } from '@/api/custom'
+import { getCustomRechargeChange, refundCustomRecharge } from '@/api/custom'
+import { getStaffInfo } from '@/api/shop-admin'
 import list from '@/mixins/list'
 import list from '@/mixins/list'
 export default {
 export default {
 	name: "balanceChange",
 	name: "balanceChange",
@@ -59,10 +66,52 @@ export default {
 	mixins:[list],
 	mixins:[list],
 	data() {
 	data() {
 		return {
 		return {
+			hasFinance: 0,
+			refundingId: 0
 		};
 		};
 	},
 	},
 	methods: {
 	methods: {
+		loadFinancePermission() {
+			getStaffInfo().then(res => {
+				if (res.code == 1 && res.data && res.data.staff) {
+					this.hasFinance = res.data.staff.finance ? 1 : 0
+				}
+			})
+		},
+		confirmRefund(item) {
+			const amount = Math.abs(parseFloat(item.amount)) || 0
+			let content = '确认对该笔充值退款 ¥' + amount + ' ?'
+			if (item.onlinePay == 2) {
+				content = '此单为线上付款,提交后钱会原路退回给客户,确认退款 ¥' + amount + ' ?'
+			}
+			uni.showModal({
+				title: '确认退款',
+				content,
+				success: (res) => {
+					if (res.confirm) {
+						this.submitRefund(item)
+					}
+				}
+			})
+		},
+		submitRefund(item) {
+			if (this.refundingId) {
+				return
+			}
+			this.refundingId = item.id
+			refundCustomRecharge({ id: item.id }).then(res => {
+				if (res.code == 1) {
+					this.$msg('退款成功')
+					this.resetList()
+					this.init()
+				}
+				this.refundingId = 0
+			}).catch(() => {
+				this.refundingId = 0
+			})
+		},
 		async init(){
 		async init(){
+			this.loadFinancePermission()
 			const res = await getCustomRechargeChange({ page:this.list.page,customId:this.option.customId })
 			const res = await getCustomRechargeChange({ page:this.list.page,customId:this.option.customId })
 			if (this.$util.isEmpty(res.data.list)){
 			if (this.$util.isEmpty(res.data.list)){
 				this.completes(res)
 				this.completes(res)
@@ -218,6 +267,11 @@ export default {
 				color: #faad14;
 				color: #faad14;
 				background-color: #fffbe6;
 				background-color: #fffbe6;
 			}
 			}
+
+			&.status-refunded {
+				color: #ff4d4f;
+				background-color: #fff1f0;
+			}
 		}
 		}
 	}
 	}
 	
 	
@@ -258,6 +312,13 @@ export default {
 	
 	
 	.td-code {
 	.td-code {
 		width: 160rpx;
 		width: 160rpx;
+
+		.refund-btn {
+			padding-left: 16rpx;
+			padding-right: 16rpx;
+			font-size: 24rpx;
+			line-height: 1.4;
+		}
 		
 		
 		.code-text {
 		.code-text {
 			font-size: 22rpx;
 			font-size: 22rpx;

+ 5 - 0
ghsApp/src/api/custom/index.js

@@ -20,6 +20,11 @@ export const getCustomRechargeChange = data => {
 	return https.get('/custom-recharge/list', data)
 	return https.get('/custom-recharge/list', data)
 }
 }
 
 
+// 充值记录退款(财务权限,线上原路退)
+export const refundCustomRecharge = data => {
+	return https.post('/custom-recharge/refund', data)
+}
+
 export const getCustomRechargeList = data => {
 export const getCustomRechargeList = data => {
 	return https.get('/custom-recharge/list', data)
 	return https.get('/custom-recharge/list', data)
 }
 }

+ 16 - 1
hdApp/src/admin/ghs/balanceChange.vue

@@ -37,6 +37,10 @@
 					</view>
 					</view>
 					<view v-if="item.showExtraRow" class="bc-row-extra" @click.stop>
 					<view v-if="item.showExtraRow" class="bc-row-extra" @click.stop>
 						<view class="bc-tags-row">
 						<view class="bc-tags-row">
+							<text
+								v-if="item.showRefundTag"
+								class="bc-tag bc-tag--refund"
+							>{{ item.refundTagText }}</text>
 							<text
 							<text
 								v-if="item.showClearLink"
 								v-if="item.showClearLink"
 								class="bc-tag bc-tag--link"
 								class="bc-tag bc-tag--link"
@@ -100,7 +104,13 @@ export default {
 			row.clearLinkText = '结账单 ' + clearSn + ' · 本单销' + clearAmt + '元'
 			row.clearLinkText = '结账单 ' + clearSn + ' · 本单销' + clearAmt + '元'
 			row.showStaff = this.hasText(row.staffName)
 			row.showStaff = this.hasText(row.staffName)
 			row.showRemark = this.hasText(row.remark)
 			row.showRemark = this.hasText(row.remark)
-			row.showExtraRow = row.showClearLink
+			// 充值退款流水:capitalType=82 或事项含「充值退款」
+			const eventText = String(row.event || '')
+			row.showRefundTag = Number(row.capitalType) === 82 || eventText.indexOf('充值退款') >= 0
+			row.refundTagText = row.showStaff
+				? '充值退款 · 操作人 ' + row.staffName
+				: '充值退款'
+			row.showExtraRow = row.showClearLink || row.showRefundTag
 			return row
 			return row
 		},
 		},
 		shouldHideRow(item) {
 		shouldHideRow(item) {
@@ -342,6 +352,11 @@ export default {
 	background: #eef4ff;
 	background: #eef4ff;
 }
 }
 
 
+.bc-tag--refund {
+	color: #cf1322;
+	background: #fff1f0;
+}
+
 .bc-tag--muted {
 .bc-tag--muted {
 	color: #969aa0;
 	color: #969aa0;
 	background: #f3f4f6;
 	background: #f3f4f6;

+ 225 - 44
hdApp/src/admin/ghs/rechargeChange.vue

@@ -1,26 +1,43 @@
 <template>
 <template>
-<view class="app-content">
+	<view class="page-container">
 		<block v-if="!$util.isEmpty(list.data)">
 		<block v-if="!$util.isEmpty(list.data)">
-			<t-table :headerBackgroundColor="'#F0F2F6'">
-				<t-tr header>
-					<t-th>日期</t-th>
-					<t-th>人员</t-th>
-					<t-th>场景</t-th>
-					<t-th>状态</t-th>
-					<t-th>变动</t-th>
-					<t-th>充后余额</t-th>
-				</t-tr>
-				<view v-for="(item, index) in list.data" :key="index" @click="goDetail(item)">
-					<t-tr>
-						<t-td align="center" color="info"><view >{{ item.addTime.substr(5,11) }}</view></t-td>
-						<t-td align="center" color="info"><view>{{ item.staffName }}</view></t-td>
-						<t-td align="center" color="info"><view >{{ item.onlinePay==2?'线上':'线下' }}</view></t-td>
-						<t-td align="center" color="info"><view >{{ item.payStatus == 1 ? '已付款':'待付款' }}</view></t-td>
-						<t-td align="center" color="info"><view >{{ item.amount }}</view></t-td>
-						<t-td align="center" color="info"><view >{{ item.payStatus == 1?parseFloat(item.balance):'' }}</view></t-td>
-					</t-tr>
+			<view class="table-wrapper">
+				<!-- 表头 -->
+				<view class="table-header">
+					<view class="th th-date">日期</view>
+					<view class="th th-scene">场景</view>
+					<view class="th th-staff">人员</view>
+					<view class="th th-amount">金额</view>
+					<view class="th th-balance">余额</view>
 				</view>
 				</view>
-			</t-table>
+
+				<!-- 表体 -->
+				<view class="table-body">
+					<view
+						v-for="(item, index) in list.data"
+						:key="index"
+						class="table-row"
+						@click="goDetail(item)"
+					>
+						<view class="td td-date">{{ item.addTime ? item.addTime.substr(5, 11) : '' }}</view>
+						<view class="td td-scene">
+							<view class="scene-type">{{ item.onlinePay == 2 ? '线上' : '线下' }}</view>
+							<view class="scene-way">{{ item.payWay==0?'微信':item.payWay == 1 ?'支付宝':item.payWay==4?'现金':item.payWay==5?'银行卡':'' }}</view>
+							<view class="scene-status" :class="item.refundStatus == 1 ? 'status-refunded' : (item.payStatus == 1 ? 'status-paid' : 'status-unpaid')">
+								{{ item.refundStatus == 1 ? '已退款' : (item.payStatus == 1 ? '已付款' : '待付款') }}
+							</view>
+						</view>
+						<view class="td td-staff">{{ item.staffName || '-' }}</view>
+						<view class="td td-amount" :class="item.io == 1 ? 'amount-in' : 'amount-out'">
+							{{ item.amount }}{{ item.rechargeType==1 ? '返' : '' }}
+						</view>
+						<view class="td td-balance">
+							<view v-if="item.payStatus == 1">{{ parseFloat(item.balance) }}</view>
+							<view class="balance-remark" v-if="item.remark">{{ item.remark }}</view>
+						</view>
+					</view>
+				</view>
+			</view>
 		</block>
 		</block>
 		<block v-else>
 		<block v-else>
 			<AppWrapperEmpty title="暂无数据" :is-empty="$util.isEmpty(list.data)" />
 			<AppWrapperEmpty title="暂无数据" :is-empty="$util.isEmpty(list.data)" />
@@ -28,50 +45,214 @@
 	</view>
 	</view>
 </template>
 </template>
 <script>
 <script>
-import AppWrapperEmpty from "@/components/app-wrapper-empty"
+/**
+ * 花店端供货商充值记录(只读查看,退款在供货商 ghsApp 操作)
+ */
+import AppWrapperEmpty from '@/components/app-wrapper-empty'
 import { getRechargeList } from '@/api/ghs'
 import { getRechargeList } from '@/api/ghs'
 import list from '@/mixins/list'
 import list from '@/mixins/list'
+
 export default {
 export default {
-	name: "debtChange",
+	name: 'ghsRechargeChange',
 	components: {
 	components: {
 		AppWrapperEmpty
 		AppWrapperEmpty
 	},
 	},
-	mixins:[list],
-	data() {
-		return {
-		};
-	},
+	mixins: [list],
 	methods: {
 	methods: {
-		async init(){
-			const res = await getRechargeList({ page:this.list.page,ghsId:this.option.ghsId })
-			if (this.$util.isEmpty(res.data.list)){
+		async init() {
+			const res = await getRechargeList({
+				page: this.list.page,
+				ghsId: this.option.ghsId
+			})
+			if (this.$util.isEmpty(res.data.list)) {
 				this.completes(res)
 				this.completes(res)
 				return
 				return
 			}
 			}
-			let currentList = res.data.list
-			currentList.forEach(function(item,index,array){
-				array[index].amount = item.io == 0 ? '-'+parseFloat(item.amount) : '+'+parseFloat(item.amount)
-			});
+			const currentList = res.data.list
+			currentList.forEach((item, index, array) => {
+				const io = item.io == null || item.io === '' ? 1 : item.io
+				array[index].io = io
+				array[index].amount = io == 0 ? '-' + parseFloat(item.amount) : '+' + parseFloat(item.amount)
+			})
 			res.data.list = currentList
 			res.data.list = currentList
 			this.completes(res)
 			this.completes(res)
 		},
 		},
-		goDetail(item){
-		}
+		goDetail(item) {}
 	},
 	},
 	async onPullDownRefresh() {
 	async onPullDownRefresh() {
-		this.resetList();
+		this.resetList()
 		await this.init()
 		await this.init()
-		uni.stopPullDownRefresh();
+		uni.stopPullDownRefresh()
 	},
 	},
 	async onReachBottom() {
 	async onReachBottom() {
 		if (!this.list.finished) {
 		if (!this.list.finished) {
 			await this.init()
 			await this.init()
-			uni.stopPullDownRefresh();;
+			uni.stopPullDownRefresh()
 		} else {
 		} else {
-			uni.stopPullDownRefresh();
+			uni.stopPullDownRefresh()
 		}
 		}
-	},
-	
-};
+	}
+}
 </script>
 </script>
-<style lang="scss" scoped></style>
+<style lang="scss" scoped>
+.page-container {
+	background-color: #fff;
+}
+
+.table-wrapper {
+	background-color: #fff;
+}
+
+// 表头
+.table-header {
+	display: flex;
+	background-color: #F0F2F6;
+	border-bottom: 2rpx solid #e8e8e8;
+
+	.th {
+		padding: 24rpx 10rpx;
+		font-size: 26rpx;
+		font-weight: bold;
+		color: #333;
+		text-align: center;
+		border-right: 1rpx solid #e8e8e8;
+
+		&:last-child {
+			border-right: none;
+		}
+	}
+
+	.th-date {
+		width: 140rpx;
+	}
+
+	.th-scene {
+		width: 150rpx;
+	}
+
+	.th-staff {
+		width: 120rpx;
+	}
+
+	.th-amount {
+		width: 140rpx;
+	}
+
+	.th-balance {
+		flex: 1;
+		min-width: 120rpx;
+	}
+}
+
+// 表体
+.table-body {
+	.table-row {
+		display: flex;
+		border-bottom: 1rpx solid #f0f0f0;
+		transition: background-color 0.2s;
+
+		&:active {
+			background-color: #fafafa;
+		}
+
+		&:last-child {
+			border-bottom: none;
+		}
+	}
+
+	.td {
+		padding: 24rpx 10rpx;
+		font-size: 26rpx;
+		color: #666;
+		display: flex;
+		flex-direction: column;
+		justify-content: center;
+		align-items: center;
+		border-right: 1rpx solid #f5f5f5;
+
+		&:last-child {
+			border-right: none;
+		}
+	}
+
+	.td-date {
+		width: 140rpx;
+		font-size: 24rpx;
+		color: #999;
+		text-align: center;
+	}
+
+	.td-scene {
+		width: 150rpx;
+		align-items: center;
+
+		.scene-type {
+			font-size: 26rpx;
+			color: #333;
+			margin-bottom: 4rpx;
+		}
+
+		.scene-way {
+			font-size: 24rpx;
+			color: #666;
+			margin-bottom: 6rpx;
+		}
+
+		.scene-status {
+			font-size: 22rpx;
+			padding: 4rpx 12rpx;
+			border-radius: 4rpx;
+
+			&.status-paid {
+				color: #52c41a;
+				background-color: #f6ffed;
+			}
+
+			&.status-unpaid {
+				color: #faad14;
+				background-color: #fffbe6;
+			}
+
+			&.status-refunded {
+				color: #ff4d4f;
+				background-color: #fff1f0;
+			}
+		}
+	}
+
+	.td-staff {
+		width: 120rpx;
+		font-size: 26rpx;
+		color: #333;
+		text-align: center;
+	}
+
+	.td-amount {
+		width: 140rpx;
+		font-size: 24rpx;
+		font-weight: bold;
+
+		&.amount-in {
+			color: #52c41a;
+		}
+
+		&.amount-out {
+			color: #ff4d4f;
+		}
+	}
+
+	.td-balance {
+		flex: 1;
+		min-width: 120rpx;
+		font-size: 26rpx;
+		color: #333;
+
+		.balance-remark {
+			font-size: 22rpx;
+			color: #999;
+			margin-top: 6rpx;
+			text-align: center;
+		}
+	}
+}
+</style>

+ 5 - 0
hdApp/src/api/ghs/index.js

@@ -70,6 +70,11 @@ export const getRechargeList = data => {
 	return https.get('/ghs-recharge/list', data)
 	return https.get('/ghs-recharge/list', data)
 }
 }
 
 
+// 供货商充值记录退款(财务权限,线上原路退)
+export const refundGhsRecharge = data => {
+	return https.post('/ghs-recharge/refund', data)
+}
+
 export const searchNearbyGhs = data => {
 export const searchNearbyGhs = data => {
 	return https.get('/ghs/search-nearby-ghs', data)
 	return https.get('/ghs/search-nearby-ghs', data)
 }
 }

+ 4 - 0
hdApp/src/api/shop-admin/index.js

@@ -19,6 +19,10 @@ export const getAllStaff = data => {
 	return https.get('/shop-admin/get-all-staff', data)
 	return https.get('/shop-admin/get-all-staff', data)
 }
 }
 
 
+export const getStaffInfo = data => {
+	return https.get('/shop-admin/get-staff-info', data)
+}
+
 export const generateAdmin = data => {
 export const generateAdmin = data => {
 	return https.post('/shop-admin/generate-admin', data)
 	return https.post('/shop-admin/generate-admin', data)
 }
 }